mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-14 00:47:18 +00:00
add: clean api to get raw_ptr
type
This commit is contained in:
parent
4e29820f6d
commit
9a481d1ecf
1 changed files with 8 additions and 0 deletions
|
@ -3190,6 +3190,14 @@ impl Type {
|
|||
matches!(self.ty.kind(Interner), TyKind::Raw(..))
|
||||
}
|
||||
|
||||
pub fn as_raw_ptr_ty(&self) -> Option<Type> {
|
||||
if let TyKind::Raw(_, ty) = self.ty.kind(Interner) {
|
||||
Some(self.derived(ty.clone()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn contains_unknown(&self) -> bool {
|
||||
// FIXME: When we get rid of `ConstScalar::Unknown`, we can just look at precomputed
|
||||
// `TypeFlags` in `TyData`.
|
||||
|
|
Loading…
Reference in a new issue