Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: clean api to get raw_ptr type #14213

Merged
merged 2 commits into from Feb 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/hir/src/lib.rs
Expand Up @@ -3190,6 +3190,14 @@ impl Type {
matches!(self.ty.kind(Interner), TyKind::Raw(..))
}

pub fn as_raw_ptr_ty(&self) -> Option<Type> {
swarnimarun marked this conversation as resolved.
Show resolved Hide resolved
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`.
Expand Down