diff options
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 375850b92..a223e120a 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -142,22 +142,6 @@ impl TypeWalk for ProjectionTy { | |||
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
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 | |||
161 | /// A type. | 145 | /// A type. |
162 | /// | 146 | /// |
163 | /// See also the `TyKind` enum in rustc (librustc/ty/sty.rs), which represents | 147 | /// See also the `TyKind` enum in rustc (librustc/ty/sty.rs), which represents |
@@ -176,13 +160,6 @@ pub enum Ty { | |||
176 | /// trait and all its parameters are fully known. | 160 | /// trait and all its parameters are fully known. |
177 | Projection(ProjectionTy), | 161 | Projection(ProjectionTy), |
178 | 162 | ||
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 | |||
186 | /// A type parameter; for example, `T` in `fn f<T>(x: T) {} | 163 | /// A type parameter; for example, `T` in `fn f<T>(x: T) {} |
187 | Param { | 164 | Param { |
188 | /// The index of the parameter (starting with parameters from the | 165 | /// The index of the parameter (starting with parameters from the |
@@ -618,11 +595,6 @@ impl TypeWalk for Ty { | |||
618 | t.walk(f); | 595 | t.walk(f); |
619 | } | 596 | } |
620 | } | 597 | } |
621 | Ty::UnselectedProjection(p_ty) => { | ||
622 | for t in p_ty.parameters.iter() { | ||
623 | t.walk(f); | ||
624 | } | ||
625 | } | ||
626 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { | 598 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { |
627 | for p in predicates.iter() { | 599 | for p in predicates.iter() { |
628 | p.walk(f); | 600 | p.walk(f); |
@@ -641,9 +613,6 @@ impl TypeWalk for Ty { | |||
641 | Ty::Projection(p_ty) => { | 613 | Ty::Projection(p_ty) => { |
642 | p_ty.parameters.walk_mut(f); | 614 | p_ty.parameters.walk_mut(f); |
643 | } | 615 | } |
644 | Ty::UnselectedProjection(p_ty) => { | ||
645 | p_ty.parameters.walk_mut(f); | ||
646 | } | ||
647 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { | 616 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { |
648 | let mut v: Vec<_> = predicates.iter().cloned().collect(); | 617 | let mut v: Vec<_> = predicates.iter().cloned().collect(); |
649 | for p in &mut v { | 618 | for p in &mut v { |
@@ -774,25 +743,11 @@ impl HirDisplay for ProjectionTy { | |||
774 | } | 743 | } |
775 | } | 744 | } |
776 | 745 | ||
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 | |||
790 | impl HirDisplay for Ty { | 746 | impl HirDisplay for Ty { |
791 | fn hir_fmt(&self, f: &mut HirFormatter<impl HirDatabase>) -> fmt::Result { | 747 | fn hir_fmt(&self, f: &mut HirFormatter<impl HirDatabase>) -> fmt::Result { |
792 | match self { | 748 | match self { |
793 | Ty::Apply(a_ty) => a_ty.hir_fmt(f)?, | 749 | Ty::Apply(a_ty) => a_ty.hir_fmt(f)?, |
794 | Ty::Projection(p_ty) => p_ty.hir_fmt(f)?, | 750 | Ty::Projection(p_ty) => p_ty.hir_fmt(f)?, |
795 | Ty::UnselectedProjection(p_ty) => p_ty.hir_fmt(f)?, | ||
796 | Ty::Param { name, .. } => write!(f, "{}", name)?, | 751 | Ty::Param { name, .. } => write!(f, "{}", name)?, |
797 | Ty::Bound(idx) => write!(f, "?{}", idx)?, | 752 | Ty::Bound(idx) => write!(f, "?{}", idx)?, |
798 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { | 753 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { |