1
Fork 0

Rename rustc_middle::Ty::is_unsafe_ptr to is_raw_ptr

The wording unsafe pointer is less common and not mentioned in a lot of
places, instead this is usually called a "raw pointer". For the sake of
uniformity, we rename this method.
This came up during the review of
https://github.com/rust-lang/rust/pull/134424.
This commit is contained in:
Bastian Kersting 2025-01-24 14:08:30 +00:00
parent 80c091958f
commit f842ee8245
28 changed files with 43 additions and 43 deletions

View file

@ -369,7 +369,7 @@ impl<'tcx> SizeSkeleton<'tcx> {
match *ty.kind() {
ty::Ref(_, pointee, _) | ty::RawPtr(pointee, _) => {
let non_zero = !ty.is_unsafe_ptr();
let non_zero = !ty.is_raw_ptr();
let tail = tcx.struct_tail_raw(
pointee,
@ -841,7 +841,7 @@ where
// as the `Abi` or `FieldsShape` is checked by users.
if i == 0 {
let nil = tcx.types.unit;
let unit_ptr_ty = if this.ty.is_unsafe_ptr() {
let unit_ptr_ty = if this.ty.is_raw_ptr() {
Ty::new_mut_ptr(tcx, nil)
} else {
Ty::new_mut_ref(tcx, tcx.lifetimes.re_static, nil)

View file

@ -1199,7 +1199,7 @@ impl<'tcx> Ty<'tcx> {
}
#[inline]
pub fn is_unsafe_ptr(self) -> bool {
pub fn is_raw_ptr(self) -> bool {
matches!(self.kind(), RawPtr(_, _))
}
@ -1207,7 +1207,7 @@ impl<'tcx> Ty<'tcx> {
/// `Box` is *not* considered a pointer here!
#[inline]
pub fn is_any_ptr(self) -> bool {
self.is_ref() || self.is_unsafe_ptr() || self.is_fn_ptr()
self.is_ref() || self.is_raw_ptr() || self.is_fn_ptr()
}
#[inline]