1
Fork 0

Auto merge of #135994 - 1c3t3a:rename-unsafe-ptr, r=oli-obk

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.

r? `@Noratrieb`
This commit is contained in:
bors 2025-02-12 23:18:14 +00:00
commit 6dce9f8c2d
38 changed files with 64 additions and 64 deletions

View file

@ -749,7 +749,7 @@ fn make_thin_self_ptr<'tcx>(
// To get the type `*mut RcInner<Self>`, we just keep unwrapping newtypes until we
// get a built-in pointer type
let mut wide_pointer_layout = layout;
while !wide_pointer_layout.ty.is_unsafe_ptr() && !wide_pointer_layout.ty.is_ref() {
while !wide_pointer_layout.ty.is_raw_ptr() && !wide_pointer_layout.ty.is_ref() {
wide_pointer_layout = wide_pointer_layout
.non_1zst_field(cx)
.expect("not exactly one non-1-ZST field in a `DispatchFromDyn` type")

View file

@ -269,7 +269,7 @@ fn layout_of_uncached<'tcx>(
// Potentially-wide pointers.
ty::Ref(_, pointee, _) | ty::RawPtr(pointee, _) => {
let mut data_ptr = scalar_unit(Pointer(AddressSpace::DATA));
if !ty.is_unsafe_ptr() {
if !ty.is_raw_ptr() {
data_ptr.valid_range_mut().start = 1;
}