Skip to content

Commit a61615c

Browse files
committed
Upgrade Chalk
... and remove Ty::UnselectedProjection. It'll be handled differently.
1 parent b8c16ec commit a61615c

File tree

4 files changed

+5
-63
lines changed

4 files changed

+5
-63
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_hir/src/ty.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,6 @@ impl TypeWalk for ProjectionTy {
142142
}
143143
}
144144

145-
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
146-
pub struct UnselectedProjectionTy {
147-
pub type_name: Name,
148-
pub parameters: Substs,
149-
}
150-
151-
impl TypeWalk for UnselectedProjectionTy {
152-
fn walk(&self, f: &mut impl FnMut(&Ty)) {
153-
self.parameters.walk(f);
154-
}
155-
156-
fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) {
157-
self.parameters.walk_mut(f);
158-
}
159-
}
160-
161145
/// A type.
162146
///
163147
/// See also the `TyKind` enum in rustc (librustc/ty/sty.rs), which represents
@@ -176,13 +160,6 @@ pub enum Ty {
176160
/// trait and all its parameters are fully known.
177161
Projection(ProjectionTy),
178162

179-
/// This is a variant of a projection in which the trait is
180-
/// **not** known. It corresponds to a case where people write
181-
/// `T::Item` without specifying the trait. We would then try to
182-
/// figure out the trait by looking at all the traits that are in
183-
/// scope.
184-
UnselectedProjection(UnselectedProjectionTy),
185-
186163
/// A type parameter; for example, `T` in `fn f<T>(x: T) {}
187164
Param {
188165
/// The index of the parameter (starting with parameters from the
@@ -618,11 +595,6 @@ impl TypeWalk for Ty {
618595
t.walk(f);
619596
}
620597
}
621-
Ty::UnselectedProjection(p_ty) => {
622-
for t in p_ty.parameters.iter() {
623-
t.walk(f);
624-
}
625-
}
626598
Ty::Dyn(predicates) | Ty::Opaque(predicates) => {
627599
for p in predicates.iter() {
628600
p.walk(f);
@@ -641,9 +613,6 @@ impl TypeWalk for Ty {
641613
Ty::Projection(p_ty) => {
642614
p_ty.parameters.walk_mut(f);
643615
}
644-
Ty::UnselectedProjection(p_ty) => {
645-
p_ty.parameters.walk_mut(f);
646-
}
647616
Ty::Dyn(predicates) | Ty::Opaque(predicates) => {
648617
let mut v: Vec<_> = predicates.iter().cloned().collect();
649618
for p in &mut v {
@@ -774,25 +743,11 @@ impl HirDisplay for ProjectionTy {
774743
}
775744
}
776745

777-
impl HirDisplay for UnselectedProjectionTy {
778-
fn hir_fmt(&self, f: &mut HirFormatter<impl HirDatabase>) -> fmt::Result {
779-
write!(f, "{}", self.parameters[0].display(f.db))?;
780-
if self.parameters.len() > 1 {
781-
write!(f, "<")?;
782-
f.write_joined(&self.parameters[1..], ", ")?;
783-
write!(f, ">")?;
784-
}
785-
write!(f, "::{}", self.type_name)?;
786-
Ok(())
787-
}
788-
}
789-
790746
impl HirDisplay for Ty {
791747
fn hir_fmt(&self, f: &mut HirFormatter<impl HirDatabase>) -> fmt::Result {
792748
match self {
793749
Ty::Apply(a_ty) => a_ty.hir_fmt(f)?,
794750
Ty::Projection(p_ty) => p_ty.hir_fmt(f)?,
795-
Ty::UnselectedProjection(p_ty) => p_ty.hir_fmt(f)?,
796751
Ty::Param { name, .. } => write!(f, "{}", name)?,
797752
Ty::Bound(idx) => write!(f, "?{}", idx)?,
798753
Ty::Dyn(predicates) | Ty::Opaque(predicates) => {

crates/ra_hir/src/ty/infer.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,6 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
429429
let ty = self.resolve_ty_as_possible(&mut vec![], ty);
430430
ty.fold(&mut |ty| match ty {
431431
Ty::Projection(proj_ty) => self.normalize_projection_ty(proj_ty),
432-
Ty::UnselectedProjection(proj_ty) => {
433-
// FIXME use Chalk's unselected projection support
434-
Ty::UnselectedProjection(proj_ty)
435-
}
436432
_ => ty,
437433
})
438434
}

crates/ra_hir/src/ty/traits/chalk.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ impl ToChalk for Ty {
6565
let parameters = proj_ty.parameters.to_chalk(db);
6666
chalk_ir::ProjectionTy { associated_ty_id, parameters }.cast()
6767
}
68-
Ty::UnselectedProjection(proj_ty) => {
69-
let type_name = lalrpop_intern::intern(&proj_ty.type_name.to_string());
70-
let parameters = proj_ty.parameters.to_chalk(db);
71-
chalk_ir::Ty::UnselectedProjection(chalk_ir::UnselectedProjectionTy {
72-
type_name,
73-
parameters,
74-
})
75-
}
7668
Ty::Param { idx, .. } => {
7769
PlaceholderIndex { ui: UniverseIndex::ROOT, idx: idx as usize }.to_ty()
7870
}
@@ -113,7 +105,6 @@ impl ToChalk for Ty {
113105
}
114106
}
115107
chalk_ir::Ty::Projection(_) => unimplemented!(),
116-
chalk_ir::Ty::UnselectedProjection(_) => unimplemented!(),
117108
chalk_ir::Ty::ForAll(_) => unimplemented!(),
118109
chalk_ir::Ty::BoundVar(idx) => Ty::Bound(idx as u32),
119110
chalk_ir::Ty::InferenceVar(_iv) => panic!("unexpected chalk infer ty"),

0 commit comments

Comments
 (0)