From f842ee824534e2dbf3c2976f8007890b2238e3c5 Mon Sep 17 00:00:00 2001 From: Bastian Kersting Date: Fri, 24 Jan 2025 14:08:30 +0000 Subject: 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. --- compiler/rustc_mir_transform/src/check_pointers.rs | 2 +- compiler/rustc_mir_transform/src/check_undefined_transmutes.rs | 2 +- compiler/rustc_mir_transform/src/gvn.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_mir_transform/src') diff --git a/compiler/rustc_mir_transform/src/check_pointers.rs b/compiler/rustc_mir_transform/src/check_pointers.rs index ccaa83fd9e2..d693f739180 100644 --- a/compiler/rustc_mir_transform/src/check_pointers.rs +++ b/compiler/rustc_mir_transform/src/check_pointers.rs @@ -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; } diff --git a/compiler/rustc_mir_transform/src/check_undefined_transmutes.rs b/compiler/rustc_mir_transform/src/check_undefined_transmutes.rs index 8ba14a1158e..ed3b1ae4f42 100644 --- a/compiler/rustc_mir_transform/src/check_undefined_transmutes.rs +++ b/compiler/rustc_mir_transform/src/check_undefined_transmutes.rs @@ -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 diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 1a2120ecd71..77a3854ebde 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -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; -- cgit 1.4.1-3-g733a5