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

@ -190,7 +190,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PointerFinder<'a, 'tcx> {
let pointer_ty = self.local_decls[place.local].ty;
// We only want to check places based on raw pointers
if !pointer_ty.is_unsafe_ptr() {
if !pointer_ty.is_raw_ptr() {
trace!("Indirect, but not based on an raw ptr, not checking {:?}", place);
return;
}

View file

@ -47,7 +47,7 @@ impl<'a, 'tcx> UndefinedTransmutesChecker<'a, 'tcx> {
{
let fn_sig = function.ty(self.body, self.tcx).fn_sig(self.tcx).skip_binder();
if let [input] = fn_sig.inputs() {
return input.is_unsafe_ptr() && fn_sig.output().is_integral();
return input.is_raw_ptr() && fn_sig.output().is_integral();
}
}
false

View file

@ -1397,8 +1397,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
// or `*mut [i32]` <=> `*const [u64]`), including the common special
// case of `*const T` <=> `*mut T`.
if let Transmute = kind
&& from.is_unsafe_ptr()
&& to.is_unsafe_ptr()
&& from.is_raw_ptr()
&& to.is_raw_ptr()
&& self.pointers_have_same_metadata(from, to)
{
kind = PtrToPtr;