64cce5fc7d
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
120 lines
9.2 KiB
Diff
120 lines
9.2 KiB
Diff
- // MIR for `discriminant` before LowerIntrinsics
|
|
+ // MIR for `discriminant` after LowerIntrinsics
|
|
|
|
fn discriminant(_1: T) -> () {
|
|
debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:24: +0:25
|
|
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:30
|
|
let _2: <T as std::marker::DiscriminantKind>::Discriminant; // in scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
|
|
let mut _3: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
|
|
let _4: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
|
|
let _5: u8; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
|
|
let mut _6: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
|
|
let _7: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
|
|
let _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:43: +2:44
|
|
let _9: u8; // in scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
|
|
let mut _10: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
|
|
let _11: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
|
|
let _12: (); // in scope 0 at $DIR/lower_intrinsics.rs:+3:43: +3:45
|
|
let _13: isize; // in scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
|
|
let mut _14: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
|
|
let _15: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
|
|
let _16: E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:43: +4:47
|
|
let mut _17: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
|
|
let mut _18: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
|
|
let mut _19: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
|
|
|
|
bb0: {
|
|
StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
|
|
StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
|
|
StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
|
|
_4 = &_1; // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
|
|
_3 = &(*_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
|
|
- _2 = discriminant_value::<T>(move _3) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
|
|
- // mir::Constant
|
|
- // + span: $DIR/lower_intrinsics.rs:82:5: 82:41
|
|
- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a T) -> <T as DiscriminantKind>::Discriminant {discriminant_value::<T>}, val: Value(<ZST>) }
|
|
+ _2 = discriminant((*_3)); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
|
|
+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
|
|
}
|
|
|
|
bb1: {
|
|
StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:44: +1:45
|
|
StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46
|
|
StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46
|
|
StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
|
|
StorageLive(_6); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
|
|
StorageLive(_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
|
|
_19 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
|
|
// mir::Constant
|
|
// + span: $DIR/lower_intrinsics.rs:83:42: 83:44
|
|
// + literal: Const { ty: &i32, val: Unevaluated(discriminant, [T], Some(promoted[2])) }
|
|
_7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
|
|
_6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
|
|
- _5 = discriminant_value::<i32>(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
|
|
- // mir::Constant
|
|
- // + span: $DIR/lower_intrinsics.rs:83:5: 83:41
|
|
- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a i32) -> <i32 as DiscriminantKind>::Discriminant {discriminant_value::<i32>}, val: Value(<ZST>) }
|
|
+ _5 = discriminant((*_6)); // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
|
|
+ goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
|
|
}
|
|
|
|
bb2: {
|
|
StorageDead(_6); // scope 0 at $DIR/lower_intrinsics.rs:+2:44: +2:45
|
|
StorageDead(_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:45: +2:46
|
|
StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:+2:45: +2:46
|
|
StorageLive(_9); // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
|
|
StorageLive(_10); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
|
|
StorageLive(_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
|
|
_18 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
|
|
// mir::Constant
|
|
// + span: $DIR/lower_intrinsics.rs:84:42: 84:45
|
|
// + literal: Const { ty: &(), val: Unevaluated(discriminant, [T], Some(promoted[1])) }
|
|
_11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
|
|
_10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
|
|
- _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
|
|
- // mir::Constant
|
|
- // + span: $DIR/lower_intrinsics.rs:84:5: 84:41
|
|
- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a ()) -> <() as DiscriminantKind>::Discriminant {discriminant_value::<()>}, val: Value(<ZST>) }
|
|
+ _9 = discriminant((*_10)); // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
|
|
+ goto -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
|
|
}
|
|
|
|
bb3: {
|
|
StorageDead(_10); // scope 0 at $DIR/lower_intrinsics.rs:+3:45: +3:46
|
|
StorageDead(_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:46: +3:47
|
|
StorageDead(_9); // scope 0 at $DIR/lower_intrinsics.rs:+3:46: +3:47
|
|
StorageLive(_13); // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
|
|
StorageLive(_14); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
|
|
StorageLive(_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
|
|
_17 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
|
|
// mir::Constant
|
|
// + span: $DIR/lower_intrinsics.rs:85:42: 85:47
|
|
// + literal: Const { ty: &E, val: Unevaluated(discriminant, [T], Some(promoted[0])) }
|
|
_15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
|
|
_14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
|
|
- _13 = discriminant_value::<E>(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
|
|
- // mir::Constant
|
|
- // + span: $DIR/lower_intrinsics.rs:85:5: 85:41
|
|
- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a E) -> <E as DiscriminantKind>::Discriminant {discriminant_value::<E>}, val: Value(<ZST>) }
|
|
+ _13 = discriminant((*_14)); // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
|
|
+ goto -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
|
|
}
|
|
|
|
bb4: {
|
|
StorageDead(_14); // scope 0 at $DIR/lower_intrinsics.rs:+4:47: +4:48
|
|
StorageDead(_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:48: +4:49
|
|
StorageDead(_13); // scope 0 at $DIR/lower_intrinsics.rs:+4:48: +4:49
|
|
_0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+0:30: +5:2
|
|
drop(_1) -> [return: bb5, unwind: bb6]; // scope 0 at $DIR/lower_intrinsics.rs:+5:1: +5:2
|
|
}
|
|
|
|
bb5: {
|
|
return; // scope 0 at $DIR/lower_intrinsics.rs:+5:2: +5:2
|
|
}
|
|
|
|
bb6 (cleanup): {
|
|
resume; // scope 0 at $DIR/lower_intrinsics.rs:+0:1: +5:2
|
|
}
|
|
}
|
|
|