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:
commit
6dce9f8c2d
38 changed files with 64 additions and 64 deletions
|
@ -368,7 +368,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,
|
||||
|
@ -840,7 +840,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)
|
||||
|
|
|
@ -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]
|
||||
|
@ -1394,7 +1394,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
/// Returns the type and mutability of `*ty`.
|
||||
///
|
||||
/// The parameter `explicit` indicates if this is an *explicit* dereference.
|
||||
/// Some types -- notably unsafe ptrs -- can only be dereferenced explicitly.
|
||||
/// Some types -- notably raw ptrs -- can only be dereferenced explicitly.
|
||||
pub fn builtin_deref(self, explicit: bool) -> Option<Ty<'tcx>> {
|
||||
match *self.kind() {
|
||||
_ if let Some(boxed) = self.boxed_ty() => Some(boxed),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue