mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
2beabbbf6f
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum.
88 lines
3.0 KiB
Rust
88 lines
3.0 KiB
Rust
// MIR for `main` after built
|
|
|
|
| User Type Annotations
|
|
| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test
|
|
| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test
|
|
| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test
|
|
| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test
|
|
|
|
|
fn main() -> () {
|
|
let mut _0: ();
|
|
let _1: *mut Test as UserTypeProjection { base: UserType(0), projs: [] };
|
|
let _2: ();
|
|
let mut _3: *const Test;
|
|
let mut _4: *mut Test;
|
|
let _6: &&&&*mut Test;
|
|
let _7: &&&*mut Test;
|
|
let _8: &&*mut Test;
|
|
let _9: &*mut Test;
|
|
let _10: ();
|
|
let mut _11: *const Test;
|
|
let mut _12: *mut Test;
|
|
scope 1 {
|
|
debug ptr => _1;
|
|
let _5: &&&&*mut Test as UserTypeProjection { base: UserType(2), projs: [] };
|
|
scope 2 {
|
|
debug ptr_ref => _5;
|
|
}
|
|
}
|
|
|
|
bb0: {
|
|
StorageLive(_1);
|
|
_1 = null_mut::<Test>() -> [return: bb1, unwind: bb4];
|
|
}
|
|
|
|
bb1: {
|
|
FakeRead(ForLet(None), _1);
|
|
AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] });
|
|
StorageLive(_2);
|
|
StorageLive(_3);
|
|
StorageLive(_4);
|
|
_4 = _1;
|
|
_3 = move _4 as *const Test (PointerCoercion(MutToConstPointer));
|
|
StorageDead(_4);
|
|
_2 = Test::x(move _3) -> [return: bb2, unwind: bb4];
|
|
}
|
|
|
|
bb2: {
|
|
StorageDead(_3);
|
|
StorageDead(_2);
|
|
StorageLive(_5);
|
|
StorageLive(_6);
|
|
StorageLive(_7);
|
|
StorageLive(_8);
|
|
StorageLive(_9);
|
|
_9 = &_1;
|
|
_8 = &_9;
|
|
_7 = &_8;
|
|
_6 = &_7;
|
|
_5 = &(*_6);
|
|
FakeRead(ForLet(None), _5);
|
|
AscribeUserType(_5, o, UserTypeProjection { base: UserType(3), projs: [] });
|
|
StorageDead(_6);
|
|
StorageLive(_10);
|
|
StorageLive(_11);
|
|
StorageLive(_12);
|
|
_12 = (*(*(*(*_5))));
|
|
_11 = move _12 as *const Test (PointerCoercion(MutToConstPointer));
|
|
StorageDead(_12);
|
|
_10 = Test::x(move _11) -> [return: bb3, unwind: bb4];
|
|
}
|
|
|
|
bb3: {
|
|
StorageDead(_11);
|
|
StorageDead(_10);
|
|
_0 = const ();
|
|
StorageDead(_9);
|
|
StorageDead(_8);
|
|
StorageDead(_7);
|
|
StorageDead(_5);
|
|
StorageDead(_1);
|
|
return;
|
|
}
|
|
|
|
bb4 (cleanup): {
|
|
resume;
|
|
}
|
|
}
|