Skip to content

Commit 038e7c6

Browse files
committed
rename MIR int2ptr casts to match library name
1 parent 67b9d7d commit 038e7c6

File tree

15 files changed

+16
-16
lines changed

15 files changed

+16
-16
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22632263
}
22642264
}
22652265

2266-
CastKind::PointerFromExposedAddress => {
2266+
CastKind::PointerWithExposedProvenance => {
22672267
let ty_from = op.ty(body, tcx);
22682268
let cast_ty_from = CastTy::from_ty(ty_from);
22692269
let cast_ty_to = CastTy::from_ty(*ty);
@@ -2273,7 +2273,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22732273
span_mirbug!(
22742274
self,
22752275
rvalue,
2276-
"Invalid PointerFromExposedAddress cast {:?} -> {:?}",
2276+
"Invalid PointerWithExposedProvenance cast {:?} -> {:?}",
22772277
ty_from,
22782278
ty
22792279
)

compiler/rustc_codegen_cranelift/src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ fn codegen_stmt<'tcx>(
642642
| CastKind::FnPtrToPtr
643643
| CastKind::PtrToPtr
644644
| CastKind::PointerExposeAddress
645-
| CastKind::PointerFromExposedAddress,
645+
| CastKind::PointerWithExposedProvenance,
646646
ref operand,
647647
to_ty,
648648
) => {

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
508508
// Since int2ptr can have arbitrary integer types as input (so we have to do
509509
// sign extension and all that), it is currently best handled in the same code
510510
// path as the other integer-to-X casts.
511-
| mir::CastKind::PointerFromExposedAddress => {
511+
| mir::CastKind::PointerWithExposedProvenance => {
512512
assert!(bx.cx().is_backend_immediate(cast));
513513
let ll_t_out = bx.cx().immediate_backend_type(cast);
514514
if operand.layout.abi.is_uninhabited() {

compiler/rustc_const_eval/src/interpret/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
4040
self.write_immediate(*res, dest)?;
4141
}
4242

43-
CastKind::PointerFromExposedAddress => {
43+
CastKind::PointerWithExposedProvenance => {
4444
let src = self.read_immediate(src)?;
4545
let res = self.pointer_from_exposed_address_cast(&src, cast_layout)?;
4646
self.write_immediate(*res, dest)?;

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
547547
Rvalue::Cast(CastKind::PointerExposeAddress, _, _) => {
548548
self.check_op(ops::RawPtrToIntCast);
549549
}
550-
Rvalue::Cast(CastKind::PointerFromExposedAddress, _, _) => {
550+
Rvalue::Cast(CastKind::PointerWithExposedProvenance, _, _) => {
551551
// Since no pointer can ever get exposed (rejected above), this is easy to support.
552552
}
553553

compiler/rustc_const_eval/src/transform/validate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
10571057
// FIXME(dyn-star): make sure nothing needs to be done here.
10581058
}
10591059
// FIXME: Add Checks for these
1060-
CastKind::PointerFromExposedAddress
1060+
CastKind::PointerWithExposedProvenance
10611061
| CastKind::PointerExposeAddress
10621062
| CastKind::PointerCoercion(_) => {}
10631063
CastKind::IntToInt | CastKind::IntToFloat => {

compiler/rustc_middle/src/mir/statement.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ impl<'tcx> Rvalue<'tcx> {
426426
| CastKind::FnPtrToPtr
427427
| CastKind::PtrToPtr
428428
| CastKind::PointerCoercion(_)
429-
| CastKind::PointerFromExposedAddress
429+
| CastKind::PointerWithExposedProvenance
430430
| CastKind::DynStar
431431
| CastKind::Transmute,
432432
_,

compiler/rustc_middle/src/mir/syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ pub enum CastKind {
13191319
PointerExposeAddress,
13201320
/// An address-to-pointer cast that picks up an exposed provenance.
13211321
/// See the docs on `with_exposed_provenance` for more details.
1322-
PointerFromExposedAddress,
1322+
PointerWithExposedProvenance,
13231323
/// Pointer related casts that are done by coercions. Note that reference-to-raw-ptr casts are
13241324
/// translated into `&raw mut/const *r`, i.e., they are not actually casts.
13251325
PointerCoercion(PointerCoercion),

compiler/rustc_middle/src/ty/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub fn mir_cast_kind<'tcx>(from_ty: Ty<'tcx>, cast_ty: Ty<'tcx>) -> mir::CastKin
8585
(Some(CastTy::Ptr(_) | CastTy::FnPtr), Some(CastTy::Int(_))) => {
8686
mir::CastKind::PointerExposeAddress
8787
}
88-
(Some(CastTy::Int(_)), Some(CastTy::Ptr(_))) => mir::CastKind::PointerFromExposedAddress,
88+
(Some(CastTy::Int(_)), Some(CastTy::Ptr(_))) => mir::CastKind::PointerWithExposedProvenance,
8989
(_, Some(CastTy::DynStar)) => mir::CastKind::DynStar,
9090
(Some(CastTy::Int(_)), Some(CastTy::Int(_))) => mir::CastKind::IntToInt,
9191
(Some(CastTy::FnPtr), Some(CastTy::Ptr(_))) => mir::CastKind::FnPtrToPtr,

compiler/rustc_smir/src/rustc_smir/convert/mir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl<'tcx> Stable<'tcx> for mir::CastKind {
274274
use rustc_middle::mir::CastKind::*;
275275
match self {
276276
PointerExposeAddress => stable_mir::mir::CastKind::PointerExposeAddress,
277-
PointerFromExposedAddress => stable_mir::mir::CastKind::PointerFromExposedAddress,
277+
PointerWithExposedProvenance => stable_mir::mir::CastKind::PointerWithExposedProvenance,
278278
PointerCoercion(c) => stable_mir::mir::CastKind::PointerCoercion(c.stable(tables)),
279279
DynStar => stable_mir::mir::CastKind::DynStar,
280280
IntToInt => stable_mir::mir::CastKind::IntToInt,

compiler/stable_mir/src/mir/body.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ pub enum PointerCoercion {
968968
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
969969
pub enum CastKind {
970970
PointerExposeAddress,
971-
PointerFromExposedAddress,
971+
PointerWithExposedProvenance,
972972
PointerCoercion(PointerCoercion),
973973
DynStar,
974974
IntToInt,

src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fn check_rvalue<'tcx>(
112112
Rvalue::Repeat(operand, _)
113113
| Rvalue::Use(operand)
114114
| Rvalue::Cast(
115-
CastKind::PointerFromExposedAddress
115+
CastKind::PointerWithExposedProvenance
116116
| CastKind::IntToInt
117117
| CastKind::FloatToInt
118118
| CastKind::IntToFloat

tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn int_to_ptr(_1: usize) -> *const i32 {
44
let mut _0: *const i32;
55

66
bb0: {
7-
_0 = _1 as *const i32 (PointerFromExposedAddress);
7+
_0 = _1 as *const i32 (PointerWithExposedProvenance);
88
return;
99
}
1010
}

tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
_3 = main as fn() (PointerCoercion(ReifyFnPointer));
1717
_2 = move _3 as usize (PointerExposeAddress);
1818
StorageDead(_3);
19-
_1 = move _2 as *const fn() (PointerFromExposedAddress);
19+
_1 = move _2 as *const fn() (PointerWithExposedProvenance);
2020
StorageDead(_2);
2121
StorageDead(_1);
2222
_0 = const ();

tests/mir-opt/const_prop/reify_fn_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ fn main() {
55
// CHECK-LABEL: fn main(
66
// CHECK: [[ptr:_.*]] = main as fn() (PointerCoercion(ReifyFnPointer));
77
// CHECK: [[addr:_.*]] = move [[ptr]] as usize (PointerExposeAddress);
8-
// CHECK: [[back:_.*]] = move [[addr]] as *const fn() (PointerFromExposedAddress);
8+
// CHECK: [[back:_.*]] = move [[addr]] as *const fn() (PointerWithExposedProvenance);
99
let _ = main as usize as *const fn();
1010
}

0 commit comments

Comments
 (0)