pub struct ConstDebugInfo;
impl<'tcx> MirPass<'tcx> for ConstDebugInfo {
- fn run_pass(&self, _tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
+ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
+ if !tcx.sess.opts.debugging_opts.unsound_mir_opts {
+ return;
+ }
+
trace!("running ConstDebugInfo on {:?}", body.source);
for (local, constant) in find_optimization_oportunities(body) {
#[cfg(not(cfail1))]
#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck")]
+ except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
pub fn change_mutability_of_slot() {
let _x: u64 = 0;
#[cfg(not(cfail1))]
#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck")]
+ except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
pub fn change_mutability_of_binding_in_pattern() {
let (mut _a, _b) = (99u8, 'q');
-// compile-flags: -C overflow-checks=no
+// compile-flags: -C overflow-checks=no -Zunsound-mir-opts
struct Point {
x: u32,
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
+ let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
scope 1 {
- debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+ debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+ let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
scope 2 {
- debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+ debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+ let _3: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
scope 3 {
- debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
+ debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
}
}
}
bb0: {
+ StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+ _2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
+ _3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
_0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
+ StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
+ StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
+ StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
return; // scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
}
}
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
+ let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
scope 1 {
- debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+ debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+ let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
scope 2 {
- debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+ debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+ let _3: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
scope 3 {
- debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
+ debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
}
}
}
bb0: {
+ StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+ StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+ _2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+ StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
+ _3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
_0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
+ StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
+ StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
+ StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
return; // scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
}
}
debug f => _1; // in scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:5:9: 5:10
scope 2 (inlined main::{closure#0}) { // at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
debug x => _5; // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+ let _6: (); // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
scope 3 {
- debug y => const (); // in scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+ debug y => _6; // in scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
}
}
}
(_3.0: ()) = move _4; // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
StorageLive(_5); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
_5 = move (_3.0: ()); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+ StorageLive(_6); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+ _6 = const (); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
_0 = const (); // scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+ StorageDead(_6); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
StorageDead(_5); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
StorageDead(_4); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:9: 6:10
StorageDead(_3); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:9: 6:10
fn f_u64() -> () {
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:16
scope 1 (inlined f_dispatch::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21
- debug t => const 0_u64; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
+ debug t => _2; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
let _1: (); // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
let mut _2: u64; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21
fn change_loop_body() -> () {
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
+ let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
scope 1 {
- debug _x => const 0_i32; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
+ debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
}
bb0: {
+ StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
+ _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
_0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
+ StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
}
}
fn change_loop_body() -> () {
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
+ let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
scope 1 {
- debug _x => const 0_i32; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
+ debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
}
bb0: {
+ StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
+ _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
_0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
+ StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
}
}