diff options
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index c5161dadd..52939e990 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -52,6 +52,7 @@ use hir_ty::{ | |||
52 | autoderef, | 52 | autoderef, |
53 | display::{write_bounds_like_dyn_trait_with_prefix, HirDisplayError, HirFormatter}, | 53 | display::{write_bounds_like_dyn_trait_with_prefix, HirDisplayError, HirFormatter}, |
54 | method_resolution::{self, TyFingerprint}, | 54 | method_resolution::{self, TyFingerprint}, |
55 | primitive::UintTy, | ||
55 | to_assoc_type_id, | 56 | to_assoc_type_id, |
56 | traits::{FnTrait, Solution, SolutionVariables}, | 57 | traits::{FnTrait, Solution, SolutionVariables}, |
57 | AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate, | 58 | AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate, |
@@ -1631,6 +1632,10 @@ impl Type { | |||
1631 | matches!(self.ty.value.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..)) | 1632 | matches!(self.ty.value.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..)) |
1632 | } | 1633 | } |
1633 | 1634 | ||
1635 | pub fn is_usize(&self) -> bool { | ||
1636 | matches!(self.ty.value.interned(&Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize))) | ||
1637 | } | ||
1638 | |||
1634 | pub fn remove_ref(&self) -> Option<Type> { | 1639 | pub fn remove_ref(&self) -> Option<Type> { |
1635 | match &self.ty.value.interned(&Interner) { | 1640 | match &self.ty.value.interned(&Interner) { |
1636 | TyKind::Ref(.., ty) => Some(self.derived(ty.clone())), | 1641 | TyKind::Ref(.., ty) => Some(self.derived(ty.clone())), |