Merge #11545
11545: add `is_slice` method to `hir::Type` r=flodiebold a=nerdypepper would like to have this on `hir::Type` for a small project i am working on, unless there is another way to check if `hir::Type` is a slice primitive? Co-authored-by: Akshay <nerdy@peppe.rs>
This commit is contained in:
commit
6fa525fb80
@ -2507,6 +2507,10 @@ pub fn is_reference(&self) -> bool {
|
||||
matches!(self.ty.kind(Interner), TyKind::Ref(..))
|
||||
}
|
||||
|
||||
pub fn is_slice(&self) -> bool {
|
||||
matches!(self.ty.kind(Interner), TyKind::Slice(..))
|
||||
}
|
||||
|
||||
pub fn is_usize(&self) -> bool {
|
||||
matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user