diff options
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 915b1028f..87f10e9d5 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
@@ -164,37 +164,7 @@ impl CallableSig { | |||
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | impl Ty { | 167 | impl Ty {} |
168 | pub fn equals_ctor(&self, other: &Ty) -> bool { | ||
169 | match (self.kind(&Interner), other.kind(&Interner)) { | ||
170 | (TyKind::Adt(adt, ..), TyKind::Adt(adt2, ..)) => adt == adt2, | ||
171 | (TyKind::Slice(_), TyKind::Slice(_)) | (TyKind::Array(_, _), TyKind::Array(_, _)) => { | ||
172 | true | ||
173 | } | ||
174 | (TyKind::FnDef(def_id, ..), TyKind::FnDef(def_id2, ..)) => def_id == def_id2, | ||
175 | (TyKind::OpaqueType(ty_id, ..), TyKind::OpaqueType(ty_id2, ..)) => ty_id == ty_id2, | ||
176 | (TyKind::AssociatedType(ty_id, ..), TyKind::AssociatedType(ty_id2, ..)) => { | ||
177 | ty_id == ty_id2 | ||
178 | } | ||
179 | (TyKind::Foreign(ty_id, ..), TyKind::Foreign(ty_id2, ..)) => ty_id == ty_id2, | ||
180 | (TyKind::Closure(id1, _), TyKind::Closure(id2, _)) => id1 == id2, | ||
181 | (TyKind::Ref(mutability, ..), TyKind::Ref(mutability2, ..)) | ||
182 | | (TyKind::Raw(mutability, ..), TyKind::Raw(mutability2, ..)) => { | ||
183 | mutability == mutability2 | ||
184 | } | ||
185 | ( | ||
186 | TyKind::Function(FnPointer { num_binders, sig, .. }), | ||
187 | TyKind::Function(FnPointer { num_binders: num_binders2, sig: sig2, .. }), | ||
188 | ) => num_binders == num_binders2 && sig == sig2, | ||
189 | (TyKind::Tuple(cardinality, _), TyKind::Tuple(cardinality2, _)) => { | ||
190 | cardinality == cardinality2 | ||
191 | } | ||
192 | (TyKind::Str, TyKind::Str) | (TyKind::Never, TyKind::Never) => true, | ||
193 | (TyKind::Scalar(scalar), TyKind::Scalar(scalar2)) => scalar == scalar2, | ||
194 | _ => false, | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | 168 | ||
199 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] | 169 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] |
200 | pub enum ImplTraitId { | 170 | pub enum ImplTraitId { |