diff options
| author | Bastian Kersting <bkersting@google.com> | 2025-01-24 14:08:30 +0000 |
|---|---|---|
| committer | Bastian Kersting <bkersting@google.com> | 2025-02-10 12:49:18 +0000 |
| commit | f842ee824534e2dbf3c2976f8007890b2238e3c5 (patch) | |
| tree | 51bc12d5f2dd54ce423969e556a32a433031b479 /compiler/rustc_const_eval/src | |
| parent | 80c091958f05e573433df974f8d2f2bc3a3eadfb (diff) | |
| download | rust-f842ee824534e2dbf3c2976f8007890b2238e3c5.tar.gz rust-f842ee824534e2dbf3c2976f8007890b2238e3c5.zip | |
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.
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/check_consts/check.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/cast.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/step.rs | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index d0ce027ec2b..90002d3f109 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -710,7 +710,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { if is_int_bool_float_or_char(lhs_ty) && is_int_bool_float_or_char(rhs_ty) { // Int, bool, float, and char operations are fine. - } else if lhs_ty.is_fn_ptr() || lhs_ty.is_unsafe_ptr() { + } else if lhs_ty.is_fn_ptr() || lhs_ty.is_raw_ptr() { assert_matches!( op, BinOp::Eq diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs index e110c155da0..b53c1505f6b 100644 --- a/compiler/rustc_const_eval/src/interpret/cast.rs +++ b/compiler/rustc_const_eval/src/interpret/cast.rs @@ -203,7 +203,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { cast_to: TyAndLayout<'tcx>, ) -> InterpResult<'tcx, ImmTy<'tcx, M::Provenance>> { assert!(src.layout.ty.is_any_ptr()); - assert!(cast_to.ty.is_unsafe_ptr()); + assert!(cast_to.ty.is_raw_ptr()); // Handle casting any ptr to raw ptr (might be a wide ptr). if cast_to.size == src.layout.size { // Thin or wide pointer that just has the ptr kind of target type changed. @@ -212,7 +212,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // Casting the metadata away from a wide ptr. assert_eq!(src.layout.size, 2 * self.pointer_size()); assert_eq!(cast_to.size, self.pointer_size()); - assert!(src.layout.ty.is_unsafe_ptr()); + assert!(src.layout.ty.is_raw_ptr()); return match **src { Immediate::ScalarPair(data, _) => interp_ok(ImmTy::from_scalar(data, cast_to)), Immediate::Scalar(..) => span_bug!( diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index abe73c43d8a..6a17da61c8b 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -241,7 +241,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // Figure out whether this is an addr_of of an already raw place. let place_base_raw = if place.is_indirect_first_projection() { let ty = self.frame().body.local_decls[place.local].ty; - ty.is_unsafe_ptr() + ty.is_raw_ptr() } else { // Not a deref, and thus not raw. false |
