Auto merge of #72632 - jonas-schievink:dest-prop, r=oli-obk

Implement a generic Destination Propagation optimization on MIR

This takes the work that was originally started by `@eddyb` in https://github.com/rust-lang/rust/pull/47954, and then explored by me in https://github.com/rust-lang/rust/pull/71003, and implements it in a general (ie. not limited to acyclic CFGs) and dataflow-driven way (so that no additional infrastructure in rustc is needed).

The pass is configured to run at `mir-opt-level=2` and higher only. To enable it by default, some followup work on it is still needed:
* Performance needs to be evaluated. I did some light optimization work and tested against `tuple-stress`, which caused trouble in my last attempt, but didn't go much in depth here.
  * We can also enable the pass only at `opt-level=2` and higher, if it is too slow to run in debug mode, but fine when optimizations run anyways.
* Debuginfo needs to be fixed after locals are merged. I did not look into what is required for this.
* Live ranges of locals (aka `StorageLive` and `StorageDead`) are currently deleted. We either need to decide that this is fine, or if not, merge the variable's live ranges (or remove these statements entirely – https://github.com/rust-lang/rust/issues/68622).

Some benchmarks of the pass were done in https://github.com/rust-lang/rust/pull/72635.
This commit is contained in:
bors 2020-09-20 01:38:26 +00:00
commit 255a4c58f5
35 changed files with 1919 additions and 456 deletions

View File

@ -204,7 +204,7 @@ impl<'a, 'tcx> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> {
/// `EverInitializedPlaces` tracks all places that might have ever been
/// initialized upon reaching a particular point in the control flow
/// for a function, without an intervening `Storage Dead`.
/// for a function, without an intervening `StorageDead`.
///
/// This dataflow is used to determine if an immutable local variable may
/// be assigned to.

View File

@ -6,6 +6,7 @@ Rust MIR: a lowered representation of Rust.
#![feature(nll)]
#![feature(in_band_lifetimes)]
#![feature(bindings_after_at)]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@ pub mod cleanup_post_borrowck;
pub mod const_prop;
pub mod copy_prop;
pub mod deaggregator;
pub mod dest_prop;
pub mod dump_mir;
pub mod elaborate_drops;
pub mod generator;
@ -467,6 +468,7 @@ fn run_optimization_passes<'tcx>(
&simplify_comparison_integral::SimplifyComparisonIntegral,
&simplify_try::SimplifyArmIdentity,
&simplify_try::SimplifyBranchSame,
&dest_prop::DestinationPropagation,
&copy_prop::CopyPropagation,
&simplify_branches::SimplifyBranches::new("after-copy-prop"),
&remove_noop_landing_pads::RemoveNoopLandingPads,

View File

@ -36,6 +36,12 @@ impl<'tcx> MirPass<'tcx> for RenameReturnPlace {
return;
}
if tcx.sess.opts.debugging_opts.mir_opt_level >= 2 {
// The `DestinationPropagation` pass runs at level 2, so this pass is redundant (and
// fails some asserts).
return;
}
let returned_local = match local_eligible_for_nrvo(body) {
Some(l) => l,
None => {

View File

@ -24,42 +24,42 @@ fn main() -> () {
}
alloc0 (static: FOO, size: 8, align: 4) {
╾─alloc17─╼ 03 00 00 00 │ ╾──╼....
╾─alloc14─╼ 03 00 00 00 │ ╾──╼....
}
alloc17 (size: 48, align: 4) {
alloc14 (size: 48, align: 4) {
0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc4──╼ 00 00 00 00 │ ....░░░░╾──╼....
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 02 00 00 00 │ ....░░░░╾──╼....
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc13─╼ 03 00 00 00 │ ....*...╾──╼....
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc7──╼ 02 00 00 00 │ ....░░░░╾──╼....
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ....*...╾──╼....
}
alloc4 (size: 0, align: 4) {}
alloc8 (size: 16, align: 4) {
╾─alloc7──╼ 03 00 00 00 ╾─alloc9──╼ 03 00 00 00 │ ╾──╼....╾──╼....
alloc7 (size: 16, align: 4) {
╾─alloc6──╼ 03 00 00 00 ╾─alloc8──╼ 03 00 00 00 │ ╾──╼....╾──╼....
}
alloc7 (size: 3, align: 1) {
alloc6 (size: 3, align: 1) {
66 6f 6f │ foo
}
alloc9 (size: 3, align: 1) {
alloc8 (size: 3, align: 1) {
62 61 72 │ bar
}
alloc13 (size: 24, align: 4) {
0x00 │ ╾─alloc12─╼ 03 00 00 00 ╾─alloc14─╼ 03 00 00 00 │ ╾──╼....╾──╼....
0x10 │ ╾─alloc15─╼ 04 00 00 00 │ ╾──╼....
alloc11 (size: 24, align: 4) {
0x00 │ ╾─alloc10─╼ 03 00 00 00 ╾─alloc12─╼ 03 00 00 00 │ ╾──╼....╾──╼....
0x10 │ ╾─alloc13─╼ 04 00 00 00 │ ╾──╼....
}
alloc12 (size: 3, align: 1) {
alloc10 (size: 3, align: 1) {
6d 65 68 │ meh
}
alloc14 (size: 3, align: 1) {
alloc12 (size: 3, align: 1) {
6d 6f 70 │ mop
}
alloc15 (size: 4, align: 1) {
alloc13 (size: 4, align: 1) {
6d c3 b6 70 │ m..p
}

View File

@ -24,46 +24,46 @@ fn main() -> () {
}
alloc0 (static: FOO, size: 16, align: 8) {
╾───────alloc17───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
alloc17 (size: 72, align: 8) {
alloc14 (size: 72, align: 8) {
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc4────────╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
0x20 │ ╾───────alloc8────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc13───────╼ │ ....*...╾──────╼
0x20 │ ╾───────alloc7────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc11───────╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
alloc4 (size: 0, align: 8) {}
alloc8 (size: 32, align: 8) {
0x00 │ ╾───────alloc7────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
0x10 │ ╾───────alloc9────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
alloc7 (size: 32, align: 8) {
0x00 │ ╾───────alloc6────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
0x10 │ ╾───────alloc8────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
alloc7 (size: 3, align: 1) {
alloc6 (size: 3, align: 1) {
66 6f 6f │ foo
}
alloc9 (size: 3, align: 1) {
alloc8 (size: 3, align: 1) {
62 61 72 │ bar
}
alloc13 (size: 48, align: 8) {
0x00 │ ╾───────alloc12───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
0x10 │ ╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
0x20 │ ╾───────alloc15───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
alloc11 (size: 48, align: 8) {
0x00 │ ╾───────alloc10───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
0x10 │ ╾───────alloc12───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
0x20 │ ╾───────alloc13───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
}
alloc12 (size: 3, align: 1) {
alloc10 (size: 3, align: 1) {
6d 65 68 │ meh
}
alloc14 (size: 3, align: 1) {
alloc12 (size: 3, align: 1) {
6d 6f 70 │ mop
}
alloc15 (size: 4, align: 1) {
alloc13 (size: 4, align: 1) {
6d c3 b6 70 │ m..p
}

View File

@ -24,41 +24,41 @@ fn main() -> () {
}
alloc0 (static: FOO, size: 8, align: 4) {
╾─alloc23─╼ 03 00 00 00 │ ╾──╼....
╾─alloc20─╼ 03 00 00 00 │ ╾──╼....
}
alloc23 (size: 48, align: 4) {
alloc20 (size: 48, align: 4) {
0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 00 00 00 00 │ ....░░░░╾──╼....
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc13─╼ 02 00 00 00 │ ....░░░░╾──╼....
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc21─╼ 03 00 00 00 │ ....*...╾──╼....
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc12─╼ 02 00 00 00 │ ....░░░░╾──╼....
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc19─╼ 03 00 00 00 │ ....*...╾──╼....
}
alloc8 (size: 0, align: 4) {}
alloc13 (size: 8, align: 4) {
╾─alloc11─╼ ╾─alloc12─╼ │ ╾──╼╾──╼
alloc12 (size: 8, align: 4) {
╾─alloc10─╼ ╾─alloc11─╼ │ ╾──╼╾──╼
}
alloc11 (size: 1, align: 1) {
alloc10 (size: 1, align: 1) {
05 │ .
}
alloc12 (size: 1, align: 1) {
alloc11 (size: 1, align: 1) {
06 │ .
}
alloc21 (size: 12, align: 4) {
╾─a17+0x3─╼ ╾─alloc18─╼ ╾─a20+0x2─╼ │ ╾──╼╾──╼╾──╼
alloc19 (size: 12, align: 4) {
╾─a15+0x3─╼ ╾─alloc16─╼ ╾─a18+0x2─╼ │ ╾──╼╾──╼╾──╼
}
alloc17 (size: 4, align: 1) {
alloc15 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
alloc18 (size: 1, align: 1) {
alloc16 (size: 1, align: 1) {
2a │ *
}
alloc20 (size: 4, align: 1) {
alloc18 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}

View File

@ -24,44 +24,44 @@ fn main() -> () {
}
alloc0 (static: FOO, size: 16, align: 8) {
╾───────alloc23───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
╾───────alloc20───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
alloc23 (size: 72, align: 8) {
alloc20 (size: 72, align: 8) {
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc8────────╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
0x20 │ ╾───────alloc13───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc21───────╼ │ ....*...╾──────╼
0x20 │ ╾───────alloc12───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc19───────╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
alloc8 (size: 0, align: 8) {}
alloc13 (size: 16, align: 8) {
╾───────alloc11───────╼ ╾───────alloc12───────╼ │ ╾──────╼╾──────╼
alloc12 (size: 16, align: 8) {
╾───────alloc10───────╼ ╾───────alloc11───────╼ │ ╾──────╼╾──────╼
}
alloc11 (size: 1, align: 1) {
alloc10 (size: 1, align: 1) {
05 │ .
}
alloc12 (size: 1, align: 1) {
alloc11 (size: 1, align: 1) {
06 │ .
}
alloc21 (size: 24, align: 8) {
0x00 │ ╾─────alloc17+0x3─────╼ ╾───────alloc18───────╼ │ ╾──────╼╾──────╼
0x10 │ ╾─────alloc20+0x2─────╼ │ ╾──────╼
alloc19 (size: 24, align: 8) {
0x00 │ ╾─────alloc15+0x3─────╼ ╾───────alloc16───────╼ │ ╾──────╼╾──────╼
0x10 │ ╾─────alloc18+0x2─────╼ │ ╾──────╼
}
alloc17 (size: 4, align: 1) {
alloc15 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
alloc18 (size: 1, align: 1) {
alloc16 (size: 1, align: 1) {
2a │ *
}
alloc20 (size: 4, align: 1) {
alloc18 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}

View File

@ -24,10 +24,10 @@ fn main() -> () {
}
alloc0 (static: FOO, size: 4, align: 4) {
╾─alloc9──╼ │ ╾──╼
╾─alloc3──╼ │ ╾──╼
}
alloc9 (size: 168, align: 1) {
alloc3 (size: 168, align: 1) {
0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................
0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾─alloc4──╼ │ ............╾──╼
0x20 │ 01 ef cd ab 00 00 00 00 00 00 00 00 00 00 00 00 │ ................

View File

@ -24,10 +24,10 @@ fn main() -> () {
}
alloc0 (static: FOO, size: 8, align: 8) {
╾───────alloc9────────╼ │ ╾──────╼
╾───────alloc3────────╼ │ ╾──────╼
}
alloc9 (size: 180, align: 1) {
alloc3 (size: 180, align: 1) {
0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................
0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾──alloc4── │ ............╾───
0x20 │ ──────────╼ 01 ef cd ab 00 00 00 00 00 00 00 00 │ ───╼............

View File

@ -6,19 +6,14 @@
let mut _0: u32; // return place in scope 0 at $DIR/copy_propagation.rs:3:20: 3:23
let _2: u32; // in scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
scope 1 {
- debug y => _2; // in scope 1 at $DIR/copy_propagation.rs:4:9: 4:10
+ debug y => _1; // in scope 1 at $DIR/copy_propagation.rs:4:9: 4:10
debug y => _0; // in scope 1 at $DIR/copy_propagation.rs:4:9: 4:10
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
- _2 = _1; // scope 0 at $DIR/copy_propagation.rs:4:13: 4:14
- _0 = _2; // scope 1 at $DIR/copy_propagation.rs:5:5: 5:6
- StorageDead(_2); // scope 0 at $DIR/copy_propagation.rs:6:1: 6:2
+ nop; // scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
+ nop; // scope 0 at $DIR/copy_propagation.rs:4:13: 4:14
+ _0 = _1; // scope 1 at $DIR/copy_propagation.rs:5:5: 5:6
+ nop; // scope 0 at $DIR/copy_propagation.rs:6:1: 6:2
nop; // scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
_0 = _1; // scope 0 at $DIR/copy_propagation.rs:4:13: 4:14
nop; // scope 1 at $DIR/copy_propagation.rs:5:5: 5:6
nop; // scope 0 at $DIR/copy_propagation.rs:6:1: 6:2
return; // scope 0 at $DIR/copy_propagation.rs:6:2: 6:2
}
}

View File

@ -6,15 +6,15 @@
let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:27:27: 27:30
let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
scope 1 {
debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:28:9: 28:10
debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:28:9: 28:10
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
_2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14
nop; // scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
_0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14
_1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:29:5: 29:12
_0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2
nop; // scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6
nop; // scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:31:2: 31:2
}
}

View File

@ -7,10 +7,10 @@
let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
bb0: {
StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
_2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
_1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10
nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:21:20: 24:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:24:2: 24:2
}

View File

@ -8,10 +8,10 @@
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
bb0: {
StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
_3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
_2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
_1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
// mir::Constant
// + span: $DIR/copy_propagation_arg.rs:11:9: 11:14
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar(<ZST>)) }
@ -19,8 +19,8 @@
bb1: {
StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
_1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17
nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:9:19: 12:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:12:2: 12:2
}

View File

@ -0,0 +1,73 @@
- // MIR for `main` before DestinationPropagation
+ // MIR for `main` after DestinationPropagation
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/branch.rs:12:11: 12:11
let _1: i32; // in scope 0 at $DIR/branch.rs:13:9: 13:10
let mut _3: bool; // in scope 0 at $DIR/branch.rs:15:16: 15:22
let _4: i32; // in scope 0 at $DIR/branch.rs:18:9: 18:14
scope 1 {
- debug x => _1; // in scope 1 at $DIR/branch.rs:13:9: 13:10
+ debug x => _2; // in scope 1 at $DIR/branch.rs:13:9: 13:10
let _2: i32; // in scope 1 at $DIR/branch.rs:15:9: 15:10
scope 2 {
debug y => _2; // in scope 2 at $DIR/branch.rs:15:9: 15:10
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/branch.rs:13:9: 13:10
- _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18
+ nop; // scope 0 at $DIR/branch.rs:13:9: 13:10
+ _2 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18
// mir::Constant
// + span: $DIR/branch.rs:13:13: 13:16
// + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar(<ZST>)) }
}
bb1: {
- StorageLive(_2); // scope 1 at $DIR/branch.rs:15:9: 15:10
+ nop; // scope 1 at $DIR/branch.rs:15:9: 15:10
StorageLive(_3); // scope 1 at $DIR/branch.rs:15:16: 15:22
_3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:15:16: 15:22
// mir::Constant
// + span: $DIR/branch.rs:15:16: 15:20
// + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar(<ZST>)) }
}
bb2: {
switchInt(_3) -> [false: bb3, otherwise: bb4]; // scope 1 at $DIR/branch.rs:15:13: 20:6
}
bb3: {
StorageLive(_4); // scope 1 at $DIR/branch.rs:18:9: 18:14
_4 = val() -> bb5; // scope 1 at $DIR/branch.rs:18:9: 18:14
// mir::Constant
// + span: $DIR/branch.rs:18:9: 18:12
// + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar(<ZST>)) }
}
bb4: {
- _2 = _1; // scope 1 at $DIR/branch.rs:16:9: 16:10
+ nop; // scope 1 at $DIR/branch.rs:16:9: 16:10
goto -> bb6; // scope 1 at $DIR/branch.rs:15:13: 20:6
}
bb5: {
StorageDead(_4); // scope 1 at $DIR/branch.rs:18:14: 18:15
- _2 = _1; // scope 1 at $DIR/branch.rs:19:9: 19:10
+ nop; // scope 1 at $DIR/branch.rs:19:9: 19:10
goto -> bb6; // scope 1 at $DIR/branch.rs:15:13: 20:6
}
bb6: {
StorageDead(_3); // scope 1 at $DIR/branch.rs:20:6: 20:7
_0 = const (); // scope 0 at $DIR/branch.rs:12:11: 21:2
- StorageDead(_2); // scope 1 at $DIR/branch.rs:21:1: 21:2
- StorageDead(_1); // scope 0 at $DIR/branch.rs:21:1: 21:2
+ nop; // scope 1 at $DIR/branch.rs:21:1: 21:2
+ nop; // scope 0 at $DIR/branch.rs:21:1: 21:2
return; // scope 0 at $DIR/branch.rs:21:2: 21:2
}
}

View File

@ -0,0 +1,21 @@
//! Tests that assignment in both branches of an `if` are eliminated.
fn val() -> i32 {
1
}
fn cond() -> bool {
true
}
// EMIT_MIR branch.main.DestinationPropagation.diff
fn main() {
let x = val();
let y = if cond() {
x
} else {
val();
x
};
}

View File

@ -0,0 +1,76 @@
- // MIR for `main` before DestinationPropagation
+ // MIR for `main` after DestinationPropagation
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:8:11: 8:11
let mut _1: i32; // in scope 0 at $DIR/cycle.rs:9:9: 9:14
let mut _4: i32; // in scope 0 at $DIR/cycle.rs:12:9: 12:10
let _5: (); // in scope 0 at $DIR/cycle.rs:14:5: 14:12
let mut _6: i32; // in scope 0 at $DIR/cycle.rs:14:10: 14:11
scope 1 {
- debug x => _1; // in scope 1 at $DIR/cycle.rs:9:9: 9:14
+ debug x => _4; // in scope 1 at $DIR/cycle.rs:9:9: 9:14
let _2: i32; // in scope 1 at $DIR/cycle.rs:10:9: 10:10
scope 2 {
- debug y => _2; // in scope 2 at $DIR/cycle.rs:10:9: 10:10
+ debug y => _4; // in scope 2 at $DIR/cycle.rs:10:9: 10:10
let _3: i32; // in scope 2 at $DIR/cycle.rs:11:9: 11:10
scope 3 {
- debug z => _3; // in scope 3 at $DIR/cycle.rs:11:9: 11:10
+ debug z => _4; // in scope 3 at $DIR/cycle.rs:11:9: 11:10
scope 4 {
debug _x => _6; // in scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
}
}
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/cycle.rs:9:9: 9:14
- _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22
+ nop; // scope 0 at $DIR/cycle.rs:9:9: 9:14
+ _4 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22
// mir::Constant
// + span: $DIR/cycle.rs:9:17: 9:20
// + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar(<ZST>)) }
}
bb1: {
- StorageLive(_2); // scope 1 at $DIR/cycle.rs:10:9: 10:10
- _2 = _1; // scope 1 at $DIR/cycle.rs:10:13: 10:14
- StorageLive(_3); // scope 2 at $DIR/cycle.rs:11:9: 11:10
- _3 = _2; // scope 2 at $DIR/cycle.rs:11:13: 11:14
- StorageLive(_4); // scope 3 at $DIR/cycle.rs:12:9: 12:10
- _4 = _3; // scope 3 at $DIR/cycle.rs:12:9: 12:10
- _1 = move _4; // scope 3 at $DIR/cycle.rs:12:5: 12:10
- StorageDead(_4); // scope 3 at $DIR/cycle.rs:12:9: 12:10
+ nop; // scope 1 at $DIR/cycle.rs:10:9: 10:10
+ nop; // scope 1 at $DIR/cycle.rs:10:13: 10:14
+ nop; // scope 2 at $DIR/cycle.rs:11:9: 11:10
+ nop; // scope 2 at $DIR/cycle.rs:11:13: 11:14
+ nop; // scope 3 at $DIR/cycle.rs:12:9: 12:10
+ nop; // scope 3 at $DIR/cycle.rs:12:9: 12:10
+ nop; // scope 3 at $DIR/cycle.rs:12:5: 12:10
+ nop; // scope 3 at $DIR/cycle.rs:12:9: 12:10
StorageLive(_5); // scope 3 at $DIR/cycle.rs:14:5: 14:12
StorageLive(_6); // scope 3 at $DIR/cycle.rs:14:10: 14:11
- _6 = _1; // scope 3 at $DIR/cycle.rs:14:10: 14:11
+ _6 = _4; // scope 3 at $DIR/cycle.rs:14:10: 14:11
_5 = const (); // scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
drop(_6) -> bb2; // scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
}
bb2: {
StorageDead(_6); // scope 3 at $DIR/cycle.rs:14:11: 14:12
StorageDead(_5); // scope 3 at $DIR/cycle.rs:14:12: 14:13
_0 = const (); // scope 0 at $DIR/cycle.rs:8:11: 15:2
- StorageDead(_3); // scope 2 at $DIR/cycle.rs:15:1: 15:2
- StorageDead(_2); // scope 1 at $DIR/cycle.rs:15:1: 15:2
- StorageDead(_1); // scope 0 at $DIR/cycle.rs:15:1: 15:2
+ nop; // scope 2 at $DIR/cycle.rs:15:1: 15:2
+ nop; // scope 1 at $DIR/cycle.rs:15:1: 15:2
+ nop; // scope 0 at $DIR/cycle.rs:15:1: 15:2
return; // scope 0 at $DIR/cycle.rs:15:2: 15:2
}
}

View File

@ -0,0 +1,15 @@
//! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code.
fn val() -> i32 {
1
}
// EMIT_MIR cycle.main.DestinationPropagation.diff
fn main() {
let mut x = val();
let y = x;
let z = y;
x = z;
drop(x);
}

View File

@ -0,0 +1,45 @@
- // MIR for `nrvo` before DestinationPropagation
+ // MIR for `nrvo` after DestinationPropagation
fn nrvo(_1: for<'r> fn(&'r mut [u8; 1024])) -> [u8; 1024] {
debug init => _1; // in scope 0 at $DIR/simple.rs:4:9: 4:13
let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/simple.rs:4:39: 4:49
let mut _2: [u8; 1024]; // in scope 0 at $DIR/simple.rs:5:9: 5:16
let _3: (); // in scope 0 at $DIR/simple.rs:6:5: 6:19
let mut _4: for<'r> fn(&'r mut [u8; 1024]); // in scope 0 at $DIR/simple.rs:6:5: 6:9
let mut _5: &mut [u8; 1024]; // in scope 0 at $DIR/simple.rs:6:10: 6:18
let mut _6: &mut [u8; 1024]; // in scope 0 at $DIR/simple.rs:6:10: 6:18
scope 1 {
- debug buf => _2; // in scope 1 at $DIR/simple.rs:5:9: 5:16
+ debug buf => _0; // in scope 1 at $DIR/simple.rs:5:9: 5:16
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/simple.rs:5:9: 5:16
- _2 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28
+ nop; // scope 0 at $DIR/simple.rs:5:9: 5:16
+ _0 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:5:19: 5:28
StorageLive(_3); // scope 1 at $DIR/simple.rs:6:5: 6:19
StorageLive(_4); // scope 1 at $DIR/simple.rs:6:5: 6:9
_4 = _1; // scope 1 at $DIR/simple.rs:6:5: 6:9
StorageLive(_5); // scope 1 at $DIR/simple.rs:6:10: 6:18
StorageLive(_6); // scope 1 at $DIR/simple.rs:6:10: 6:18
- _6 = &mut _2; // scope 1 at $DIR/simple.rs:6:10: 6:18
+ _6 = &mut _0; // scope 1 at $DIR/simple.rs:6:10: 6:18
_5 = &mut (*_6); // scope 1 at $DIR/simple.rs:6:10: 6:18
_3 = move _4(move _5) -> bb1; // scope 1 at $DIR/simple.rs:6:5: 6:19
}
bb1: {
StorageDead(_5); // scope 1 at $DIR/simple.rs:6:18: 6:19
StorageDead(_4); // scope 1 at $DIR/simple.rs:6:18: 6:19
StorageDead(_6); // scope 1 at $DIR/simple.rs:6:19: 6:20
StorageDead(_3); // scope 1 at $DIR/simple.rs:6:19: 6:20
- _0 = _2; // scope 1 at $DIR/simple.rs:7:5: 7:8
- StorageDead(_2); // scope 0 at $DIR/simple.rs:8:1: 8:2
+ nop; // scope 1 at $DIR/simple.rs:7:5: 7:8
+ nop; // scope 0 at $DIR/simple.rs:8:1: 8:2
return; // scope 0 at $DIR/simple.rs:8:2: 8:2
}
}

View File

@ -0,0 +1,14 @@
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
// EMIT_MIR simple.nrvo.DestinationPropagation.diff
fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
let mut buf = [0; 1024];
init(&mut buf);
buf
}
fn main() {
let _ = nrvo(|buf| {
buf[4] = 4;
});
}

View File

@ -0,0 +1,46 @@
- // MIR for `main` before DestinationPropagation
+ // MIR for `main` after DestinationPropagation
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/union.rs:8:11: 8:11
let _1: main::Un; // in scope 0 at $DIR/union.rs:13:9: 13:11
let mut _2: u32; // in scope 0 at $DIR/union.rs:13:23: 13:28
let _3: (); // in scope 0 at $DIR/union.rs:15:5: 15:27
let mut _4: u32; // in scope 0 at $DIR/union.rs:15:10: 15:26
scope 1 {
debug un => _1; // in scope 1 at $DIR/union.rs:13:9: 13:11
scope 2 {
}
scope 3 {
debug _x => _4; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
}
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/union.rs:13:9: 13:11
StorageLive(_2); // scope 0 at $DIR/union.rs:13:23: 13:28
_2 = val() -> bb1; // scope 0 at $DIR/union.rs:13:23: 13:28
// mir::Constant
// + span: $DIR/union.rs:13:23: 13:26
// + literal: Const { ty: fn() -> u32 {val}, val: Value(Scalar(<ZST>)) }
}
bb1: {
(_1.0: u32) = move _2; // scope 0 at $DIR/union.rs:13:14: 13:30
StorageDead(_2); // scope 0 at $DIR/union.rs:13:29: 13:30
StorageLive(_3); // scope 1 at $DIR/union.rs:15:5: 15:27
StorageLive(_4); // scope 1 at $DIR/union.rs:15:10: 15:26
_4 = (_1.0: u32); // scope 2 at $DIR/union.rs:15:19: 15:24
_3 = const (); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
drop(_4) -> bb2; // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
}
bb2: {
StorageDead(_4); // scope 1 at $DIR/union.rs:15:26: 15:27
StorageDead(_3); // scope 1 at $DIR/union.rs:15:27: 15:28
_0 = const (); // scope 0 at $DIR/union.rs:8:11: 16:2
StorageDead(_1); // scope 0 at $DIR/union.rs:16:1: 16:2
return; // scope 0 at $DIR/union.rs:16:2: 16:2
}
}

View File

@ -0,0 +1,16 @@
//! Tests that projections through unions cancel `DestinationPropagation`.
fn val() -> u32 {
1
}
// EMIT_MIR union.main.DestinationPropagation.diff
fn main() {
union Un {
us: u32,
}
let un = Un { us: val() };
drop(unsafe { un.us });
}

View File

@ -10,15 +10,14 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
let mut _6: &[closure@foo<T>::{{closure}}#0 q:&i32, t:&T]; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:6
let mut _7: (i32,); // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9
let mut _8: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:7: 12:8
let mut _11: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9
let mut _10: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9
scope 1 {
debug x => _3; // in scope 1 at $DIR/inline-closure-captures.rs:11:9: 11:10
scope 2 {
debug _q => _11; // in scope 2 at $DIR/inline-closure-captures.rs:11:14: 11:16
debug _q => _10; // in scope 2 at $DIR/inline-closure-captures.rs:11:14: 11:16
debug q => (*((*_6).0: &i32)); // in scope 2 at $DIR/inline-closure-captures.rs:10:23: 10:24
debug t => (*((*_6).1: &T)); // in scope 2 at $DIR/inline-closure-captures.rs:10:17: 10:18
let mut _9: i32; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9
let mut _10: T; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9
let mut _9: T; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9
}
}
@ -38,17 +37,14 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
StorageLive(_8); // scope 1 at $DIR/inline-closure-captures.rs:12:7: 12:8
_8 = _2; // scope 1 at $DIR/inline-closure-captures.rs:12:7: 12:8
(_7.0: i32) = move _8; // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
StorageLive(_11); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
_11 = move (_7.0: i32); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
StorageLive(_9); // scope 2 at $DIR/inline-closure-captures.rs:11:19: 11:20
_9 = (*((*_6).0: &i32)); // scope 2 at $DIR/inline-closure-captures.rs:11:19: 11:20
StorageLive(_10); // scope 2 at $DIR/inline-closure-captures.rs:11:22: 11:23
_10 = (*((*_6).1: &T)); // scope 2 at $DIR/inline-closure-captures.rs:11:22: 11:23
(_0.0: i32) = move _9; // scope 2 at $DIR/inline-closure-captures.rs:11:18: 11:24
(_0.1: T) = move _10; // scope 2 at $DIR/inline-closure-captures.rs:11:18: 11:24
StorageDead(_10); // scope 2 at $DIR/inline-closure-captures.rs:11:23: 11:24
StorageLive(_10); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
_10 = move (_7.0: i32); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
(_0.0: i32) = (*((*_6).0: &i32)); // scope 2 at $DIR/inline-closure-captures.rs:11:19: 11:20
StorageLive(_9); // scope 2 at $DIR/inline-closure-captures.rs:11:22: 11:23
_9 = (*((*_6).1: &T)); // scope 2 at $DIR/inline-closure-captures.rs:11:22: 11:23
(_0.1: T) = move _9; // scope 2 at $DIR/inline-closure-captures.rs:11:18: 11:24
StorageDead(_9); // scope 2 at $DIR/inline-closure-captures.rs:11:23: 11:24
StorageDead(_11); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
StorageDead(_10); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
StorageDead(_8); // scope 1 at $DIR/inline-closure-captures.rs:12:8: 12:9
StorageDead(_7); // scope 1 at $DIR/inline-closure-captures.rs:12:8: 12:9
StorageDead(_6); // scope 1 at $DIR/inline-closure-captures.rs:12:8: 12:9

View File

@ -3,66 +3,59 @@
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11
let mut _1: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30
let _2: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15
let mut _4: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27
let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _11: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _12: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _13: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _14: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _15: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _16: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _17: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _18: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _19: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _20: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _21: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _24: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _25: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _26: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _27: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30
let mut _4: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _7: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _8: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _9: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _10: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _11: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _12: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _13: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _14: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _16: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _17: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
scope 1 {
debug split => _2; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14
debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14
let _3: std::option::Option<i32>; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14
scope 3 {
debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14
let _7: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _8: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
scope 4 {
debug left_val => _7; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug right_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _22: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _23: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug right_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
scope 5 {
debug arg0 => _22; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug arg0 => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug arg1 => _23; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
scope 6 {
debug x => _22; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug f => _25; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _28: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _29: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
debug x => _20; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug f => _19; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _18: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _19: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _20: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
}
scope 8 {
debug x => _23; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug f => _27; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _30: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _31: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
debug f => _22; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _21: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _22: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _23: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
}
}
scope 10 {
debug pieces => _14; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug args => _15; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _32: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
debug pieces => (_9.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug args => _25; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _24: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _25: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
}
}
}
}
scope 2 {
debug v => _2; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15
debug v => _1; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15
}
scope 7 {
}
@ -70,138 +63,108 @@
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
((_1 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
discriminant(_1) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
_2 = ((_1 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
StorageLive(_3); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14
StorageLive(_4); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
_4 = _2; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
((_3 as Some).0: i32) = move _4; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28
StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
_1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28
StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28
StorageLive(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_6 = &_2; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_5.0: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_5.1: &i32) = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_4.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_4.1: &i32) = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// ty::Const
// + ty: &i32
// + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[1]))
// mir::Constant
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
// + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[1])) }
StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_7 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_8 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_11 = (*_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_10 = Eq(move _11, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_9 = Not(move _10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
switchInt(_9) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_13 = (_4.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_15 = (_4.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_7 = (*_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_6 = Eq(move _7, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_5 = Not(move _6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
switchInt(_5) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
bb1: {
StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
StorageDead(_3); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
}
bb2: {
StorageLive(_13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_14 = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_9.0: &[&str]) = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// ty::Const
// + ty: &[&str; 3]
// + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0]))
// mir::Constant
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
// + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) }
StorageLive(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_20 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_19 = &_20; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_21 = &_8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_18.0: &&i32) = move _19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
(_18.1: &&i32) = move _21; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_22 = (_18.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_23 = (_18.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_24); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
_25 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
(_12.0: &&i32) = &_13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_14 = &_15; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_12.1: &&i32) = move _14; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_20 = (_12.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_23 = (_12.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_19 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
// + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar(<ZST>)) }
StorageLive(_28); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_28 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _25) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_18); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_18 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _19) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
}
bb3: {
StorageLive(_29); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_29 = transmute::<&&i32, &core::fmt::Opaque>(move _22) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_16.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _20) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
}
bb4: {
(_24.0: &core::fmt::Opaque) = move _29; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_24.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _28; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_29); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_28); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_26); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
_27 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_16.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _18; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_18); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_22 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
// + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar(<ZST>)) }
StorageLive(_30); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_30 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_21); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_21 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _22) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
}
bb5: {
StorageLive(_31); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_31 = transmute::<&&i32, &core::fmt::Opaque>(move _23) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_17.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _23) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
}
bb6: {
(_26.0: &core::fmt::Opaque) = move _31; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_26.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _30; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_31); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_30); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_17 = [move _24, move _26]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_26); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_24); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
_16 = &_17; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_15 = move _16 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_32); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
discriminant(_32) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_13.0: &[&str]) = move _14; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_13.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _32; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_13.2: &[std::fmt::ArgumentV1]) = move _15; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_32); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_12 = &_13; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
begin_panic_fmt(move _12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
(_17.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _21; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_21); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_11 = [move _16, move _17]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
_10 = &_11; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_25 = move _10 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_24); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
discriminant(_24) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_9.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _24; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_9.2: &[std::fmt::ArgumentV1]) = move _25; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_24); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_8 = &_9; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
begin_panic_fmt(move _8); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/std/src/macros.rs:LL:COL
// + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar(<ZST>)) }

View File

@ -3,66 +3,59 @@
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11
let mut _1: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30
let _2: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15
let mut _4: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27
let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _11: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _12: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _13: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _14: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _15: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _16: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _17: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _18: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _19: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _20: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _21: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _24: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _25: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _26: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _27: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30
let mut _4: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _7: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _8: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _9: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _10: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _11: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _12: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let _13: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _14: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _16: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _17: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
scope 1 {
debug split => _2; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14
debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14
let _3: std::option::Option<i32>; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14
scope 3 {
debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14
let _7: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _8: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
scope 4 {
debug left_val => _7; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug right_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _22: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let _23: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug right_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
scope 5 {
debug arg0 => _22; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug arg0 => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
debug arg1 => _23; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
scope 6 {
debug x => _22; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug f => _25; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _28: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _29: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
debug x => _20; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug f => _19; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _18: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _19: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _20: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL
}
scope 8 {
debug x => _23; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug f => _27; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _30: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _31: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
debug f => _22; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _21: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _22: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _23: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL
}
}
scope 10 {
debug pieces => _14; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug args => _15; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _32: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
debug pieces => (_9.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
debug args => _25; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
let mut _24: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
let mut _25: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL
}
}
}
}
scope 2 {
debug v => _2; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15
debug v => _1; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15
}
scope 7 {
}
@ -70,138 +63,108 @@
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
((_1 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
discriminant(_1) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
_2 = ((_1 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
StorageLive(_3); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14
StorageLive(_4); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
_4 = _2; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
((_3 as Some).0: i32) = move _4; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28
StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30
_1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15
StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27
discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28
StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28
StorageLive(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_6 = &_2; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_5.0: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_5.1: &i32) = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_4.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_4.1: &i32) = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// ty::Const
// + ty: &i32
// + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[1]))
// mir::Constant
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
// + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[1])) }
StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_7 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_8 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_11 = (*_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_10 = Eq(move _11, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_9 = Not(move _10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
switchInt(_9) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_13 = (_4.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_15 = (_4.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_7 = (*_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_6 = Eq(move _7, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_5 = Not(move _6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
switchInt(_5) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
bb1: {
StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
StorageDead(_3); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
}
bb2: {
StorageLive(_13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_14 = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_9.0: &[&str]) = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// ty::Const
// + ty: &[&str; 3]
// + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0]))
// mir::Constant
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
// + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) }
StorageLive(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_20 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_19 = &_20; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_21 = &_8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_18.0: &&i32) = move _19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
(_18.1: &&i32) = move _21; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_22 = (_18.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_23 = (_18.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_24); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
_25 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
(_12.0: &&i32) = &_13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageLive(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_14 = &_15; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_12.1: &&i32) = move _14; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_20 = (_12.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_23 = (_12.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_19 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
// + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar(<ZST>)) }
StorageLive(_28); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_28 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _25) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_18); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_18 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _19) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
}
bb3: {
StorageLive(_29); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_29 = transmute::<&&i32, &core::fmt::Opaque>(move _22) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_16.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _20) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
}
bb4: {
(_24.0: &core::fmt::Opaque) = move _29; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_24.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _28; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_29); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_28); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_26); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
_27 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
(_16.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _18; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_18); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_22 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
// + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar(<ZST>)) }
StorageLive(_30); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_30 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_21); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_21 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _22) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
}
bb5: {
StorageLive(_31); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_31 = transmute::<&&i32, &core::fmt::Opaque>(move _23) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_17.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _23) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
}
bb6: {
(_26.0: &core::fmt::Opaque) = move _31; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_26.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _30; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_31); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_30); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_17 = [move _24, move _26]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_26); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_24); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
_16 = &_17; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_15 = move _16 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_32); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
discriminant(_32) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_13.0: &[&str]) = move _14; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_13.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _32; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_13.2: &[std::fmt::ArgumentV1]) = move _15; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_32); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_12 = &_13; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
begin_panic_fmt(move _12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
(_17.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _21; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_21); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_11 = [move _16, move _17]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL
_10 = &_11; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_25 = move _10 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_24); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
discriminant(_24) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_9.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _24; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_9.2: &[std::fmt::ArgumentV1]) = move _25; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageDead(_24); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_8 = &_9; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
begin_panic_fmt(move _8); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/std/src/macros.rs:LL:COL
// + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar(<ZST>)) }

View File

@ -1,3 +1,5 @@
// compile-flags: -Zmir-opt-level=1
// EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff
fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
let mut buf = [0; 1024];

View File

@ -2,39 +2,42 @@
+ // MIR for `nrvo` after RenameReturnPlace
fn nrvo(_1: for<'r> fn(&'r mut [u8; 1024])) -> [u8; 1024] {
debug init => _1; // in scope 0 at $DIR/nrvo-simple.rs:2:9: 2:13
- let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/nrvo-simple.rs:2:39: 2:49
+ let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/nrvo-simple.rs:3:9: 3:16
let mut _2: [u8; 1024]; // in scope 0 at $DIR/nrvo-simple.rs:3:9: 3:16
let _3: (); // in scope 0 at $DIR/nrvo-simple.rs:4:5: 4:19
let mut _4: for<'r> fn(&'r mut [u8; 1024]); // in scope 0 at $DIR/nrvo-simple.rs:4:5: 4:9
let mut _5: &mut [u8; 1024]; // in scope 0 at $DIR/nrvo-simple.rs:4:10: 4:18
let mut _6: &mut [u8; 1024]; // in scope 0 at $DIR/nrvo-simple.rs:4:10: 4:18
debug init => _1; // in scope 0 at $DIR/nrvo-simple.rs:4:9: 4:13
- let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/nrvo-simple.rs:4:39: 4:49
+ let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/nrvo-simple.rs:5:9: 5:16
let mut _2: [u8; 1024]; // in scope 0 at $DIR/nrvo-simple.rs:5:9: 5:16
let _3: (); // in scope 0 at $DIR/nrvo-simple.rs:6:5: 6:19
let mut _4: for<'r> fn(&'r mut [u8; 1024]); // in scope 0 at $DIR/nrvo-simple.rs:6:5: 6:9
let mut _5: &mut [u8; 1024]; // in scope 0 at $DIR/nrvo-simple.rs:6:10: 6:18
let mut _6: &mut [u8; 1024]; // in scope 0 at $DIR/nrvo-simple.rs:6:10: 6:18
scope 1 {
- debug buf => _2; // in scope 1 at $DIR/nrvo-simple.rs:3:9: 3:16
+ debug buf => _0; // in scope 1 at $DIR/nrvo-simple.rs:3:9: 3:16
- debug buf => _2; // in scope 1 at $DIR/nrvo-simple.rs:5:9: 5:16
+ debug buf => _0; // in scope 1 at $DIR/nrvo-simple.rs:5:9: 5:16
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/nrvo-simple.rs:3:9: 3:16
- _2 = [const 0_u8; 1024]; // scope 0 at $DIR/nrvo-simple.rs:3:19: 3:28
+ _0 = [const 0_u8; 1024]; // scope 0 at $DIR/nrvo-simple.rs:3:19: 3:28
StorageLive(_3); // scope 1 at $DIR/nrvo-simple.rs:4:5: 4:19
StorageLive(_5); // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
StorageLive(_6); // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
- _6 = &mut _2; // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
+ _6 = &mut _0; // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
_5 = &mut (*_6); // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
_3 = move _1(move _5) -> bb1; // scope 1 at $DIR/nrvo-simple.rs:4:5: 4:19
- StorageLive(_2); // scope 0 at $DIR/nrvo-simple.rs:5:9: 5:16
- _2 = [const 0_u8; 1024]; // scope 0 at $DIR/nrvo-simple.rs:5:19: 5:28
+ _0 = [const 0_u8; 1024]; // scope 0 at $DIR/nrvo-simple.rs:5:19: 5:28
StorageLive(_3); // scope 1 at $DIR/nrvo-simple.rs:6:5: 6:19
StorageLive(_4); // scope 1 at $DIR/nrvo-simple.rs:6:5: 6:9
_4 = _1; // scope 1 at $DIR/nrvo-simple.rs:6:5: 6:9
StorageLive(_5); // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
StorageLive(_6); // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
- _6 = &mut _2; // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
+ _6 = &mut _0; // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
_5 = &mut (*_6); // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
_3 = move _4(move _5) -> bb1; // scope 1 at $DIR/nrvo-simple.rs:6:5: 6:19
}
bb1: {
StorageDead(_5); // scope 1 at $DIR/nrvo-simple.rs:4:18: 4:19
StorageDead(_6); // scope 1 at $DIR/nrvo-simple.rs:4:19: 4:20
StorageDead(_3); // scope 1 at $DIR/nrvo-simple.rs:4:19: 4:20
- _0 = _2; // scope 1 at $DIR/nrvo-simple.rs:5:5: 5:8
- StorageDead(_2); // scope 0 at $DIR/nrvo-simple.rs:6:1: 6:2
return; // scope 0 at $DIR/nrvo-simple.rs:6:2: 6:2
StorageDead(_5); // scope 1 at $DIR/nrvo-simple.rs:6:18: 6:19
StorageDead(_4); // scope 1 at $DIR/nrvo-simple.rs:6:18: 6:19
StorageDead(_6); // scope 1 at $DIR/nrvo-simple.rs:6:19: 6:20
StorageDead(_3); // scope 1 at $DIR/nrvo-simple.rs:6:19: 6:20
- _0 = _2; // scope 1 at $DIR/nrvo-simple.rs:7:5: 7:8
- StorageDead(_2); // scope 0 at $DIR/nrvo-simple.rs:8:1: 8:2
return; // scope 0 at $DIR/nrvo-simple.rs:8:2: 8:2
}
}

View File

@ -0,0 +1,72 @@
- // MIR for `try_identity` before DestinationPropagation
+ // MIR for `try_identity` after DestinationPropagation
fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> {
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57
let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10
let mut _3: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15
let mut _4: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14
let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9
scope 1 {
debug y => _2; // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10
}
scope 2 {
debug err => _6; // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15
scope 3 {
scope 7 {
debug t => _9; // in scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
}
scope 8 {
debug v => _8; // in scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15
}
}
}
scope 4 {
debug val => _10; // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15
scope 5 {
}
}
scope 6 {
- debug self => _4; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
+ debug self => _0; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:7:9: 7:10
- StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15
- StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
- _4 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
- _3 = move _4; // scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
- StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
- _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
+ nop; // scope 0 at $DIR/simplify_try.rs:7:13: 7:15
+ nop; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
+ _0 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
+ nop; // scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
+ nop; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
+ _5 = discriminant(_0); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
goto -> bb1; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
}
bb1: {
- _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
- StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
+ nop; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
+ nop; // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
bb2: {
return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
}

View File

@ -1,6 +1,7 @@
// EMIT_MIR simplify_try.try_identity.SimplifyArmIdentity.diff
// EMIT_MIR simplify_try.try_identity.SimplifyBranchSame.after.mir
// EMIT_MIR simplify_try.try_identity.SimplifyLocals.after.mir
// EMIT_MIR simplify_try.try_identity.DestinationPropagation.diff
fn try_identity(x: Result<u32, i32>) -> Result<u32, i32> {
let y = x?;

View File

@ -0,0 +1,72 @@
- // MIR for `try_identity` before DestinationPropagation
+ // MIR for `try_identity` after DestinationPropagation
fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> {
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57
let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10
let mut _3: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15
let mut _4: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14
let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9
scope 1 {
debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10
}
scope 2 {
debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15
scope 3 {
scope 7 {
debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
}
scope 8 {
debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15
}
}
}
scope 4 {
debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15
scope 5 {
}
}
scope 6 {
- debug self => _4; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
+ debug self => _0; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:7:9: 7:10
- StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15
- StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
- _4 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
- _3 = move _4; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
- StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
- _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
+ nop; // scope 0 at $DIR/simplify_try.rs:7:13: 7:15
+ nop; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
+ _0 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
+ nop; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
+ nop; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
+ _5 = discriminant(_0); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
goto -> bb1; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
}
bb1: {
- _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
- StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
+ nop; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
+ nop; // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
bb2: {
return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
}

View File

@ -2,25 +2,25 @@
+ // MIR for `try_identity` after SimplifyArmIdentity
fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> {
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:5:17: 5:18
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:5:41: 5:57
let _2: u32; // in scope 0 at $DIR/simplify_try.rs:6:9: 6:10
let mut _3: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
let mut _4: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:14
let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let _6: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:7:8: 7:9
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57
let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10
let mut _3: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15
let mut _4: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14
let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9
scope 1 {
- debug y => _2; // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
+ debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
- debug y => _2; // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10
+ debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10
}
scope 2 {
- debug err => _6; // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
+ debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
- debug err => _6; // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15
+ debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15
scope 3 {
scope 7 {
- debug t => _9; // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
@ -29,13 +29,13 @@
scope 8 {
- debug v => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:6:14: 6:15
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15
}
}
}
scope 4 {
- debug val => _10; // in scope 4 at $DIR/simplify_try.rs:6:13: 6:15
+ debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:6:13: 6:15
- debug val => _10; // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15
+ debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15
scope 5 {
}
}
@ -44,55 +44,55 @@
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:6:9: 6:10
StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
_4 = _1; // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:7:9: 7:10
StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15
StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
_4 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
_3 = move _4; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
_5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
_5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
}
bb1: {
- StorageLive(_10); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
- _10 = ((_3 as Ok).0: u32); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
- _2 = _10; // scope 5 at $DIR/simplify_try.rs:6:13: 6:15
- StorageDead(_10); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
+ _0 = move _3; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:6:15: 6:16
- StorageLive(_11); // scope 1 at $DIR/simplify_try.rs:7:8: 7:9
- _11 = _2; // scope 1 at $DIR/simplify_try.rs:7:8: 7:9
- ((_0 as Ok).0: u32) = move _11; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
- discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
- StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:7:9: 7:10
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
goto -> bb3; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
- StorageLive(_10); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15
- _10 = ((_3 as Ok).0: u32); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15
- _2 = _10; // scope 5 at $DIR/simplify_try.rs:7:13: 7:15
- StorageDead(_10); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
+ _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
- StorageLive(_11); // scope 1 at $DIR/simplify_try.rs:8:8: 8:9
- _11 = _2; // scope 1 at $DIR/simplify_try.rs:8:8: 8:9
- ((_0 as Ok).0: u32) = move _11; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
- discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
- StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:8:9: 8:10
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb3; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
bb2: {
- StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
- _6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
- StorageLive(_8); // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
- StorageLive(_9); // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
- _9 = _6; // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
- StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
- _6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
- StorageLive(_8); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15
- StorageLive(_9); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15
- _9 = _6; // scope 3 at $DIR/simplify_try.rs:7:14: 7:15
- _8 = move _9; // scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- StorageDead(_9); // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
- StorageDead(_9); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15
- StorageLive(_12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- _12 = move _8; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- ((_0 as Err).0: i32) = move _12; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- discriminant(_0) = 1; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- StorageDead(_12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- StorageDead(_8); // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
- StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
- StorageDead(_8); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15
- StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
+ _0 = move _3; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:6:15: 6:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
goto -> bb3; // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb3; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
}
bb3: {
return; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
}

View File

@ -1,35 +1,35 @@
// MIR for `try_identity` after SimplifyBranchSame
fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> {
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:5:17: 5:18
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:5:41: 5:57
let _2: u32; // in scope 0 at $DIR/simplify_try.rs:6:9: 6:10
let mut _3: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
let mut _4: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:14
let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let _6: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:7:8: 7:9
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57
let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10
let mut _3: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15
let mut _4: std::result::Result<u32, i32>; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14
let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9
scope 1 {
debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10
}
scope 2 {
debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15
scope 3 {
scope 7 {
debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
}
scope 8 {
debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:6:14: 6:15
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15
}
}
}
scope 4 {
debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:6:13: 6:15
debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15
scope 5 {
}
}
@ -38,24 +38,24 @@ fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:6:9: 6:10
StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
_4 = _1; // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:7:9: 7:10
StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15
StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
_4 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
_3 = move _4; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
_5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
goto -> bb1; // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
_5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
goto -> bb1; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
}
bb1: {
_0 = move _3; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:6:15: 6:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
goto -> bb2; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
_0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
bb2: {
return; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
}

View File

@ -1,13 +1,13 @@
// MIR for `try_identity` after SimplifyLocals
fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> {
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:5:17: 5:18
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:5:41: 5:57
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57
scope 1 {
debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10
}
scope 2 {
debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15
scope 3 {
scope 7 {
debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
@ -18,16 +18,16 @@ fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i
}
}
scope 4 {
debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:6:13: 6:15
debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15
scope 5 {
}
}
scope 6 {
debug self => _1; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
debug self => _0; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb0: {
_0 = move _1; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
return; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
_0 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14
return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
}

View File

@ -0,0 +1,24 @@
// run-pass
// compile-flags: -Zmir-opt-level=2
trait IterExt: Iterator {
fn fold_ex<B, F>(mut self, init: B, mut f: F) -> B
where
Self: Sized,
F: FnMut(B, Self::Item) -> B,
{
let mut accum = init;
while let Some(x) = self.next() {
accum = f(accum, x);
}
accum
}
}
impl<T: Iterator> IterExt for T {}
fn main() {
let test = &["\n"];
test.iter().fold_ex(String::new(), |_, b| b.to_string());
}