Skip to content

Instantly share code, notes, and snippets.

@manuels
Created May 27, 2018 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manuels/60de593238db16a4c6fe815192f7d57c to your computer and use it in GitHub Desktop.
Save manuels/60de593238db16a4c6fe815192f7d57c to your computer and use it in GitHub Desktop.
Rust bug
fn main() {
loop {
let beacon = {
match true {
false => 4,
true => break,
}
};
drop(&beacon);
}
}
// MIR for `main`
// source = MirSource { def_id: DefId(0/0:3 ~ main[317d]::main[0]), promoted: None }
// pass_name = mir_map
// disambiguator = 0
fn main() -> (){
let mut _0: (); // return place
scope 1 {
let _2: i32; // "beacon" in scope 1 at src/main.rs:3:13: 3:19
}
scope 2 {
}
let mut _1: ();
let mut _3: bool;
let mut _4: u8;
let mut _5: !;
let mut _6: ();
let mut _7: &i32;
bb0: {
goto -> bb1; // bb0[0]: scope 0 at src/main.rs:2:5: 10:6
}
bb1: {
falseUnwind -> [real: bb3, cleanup: bb4]; // bb1[0]: scope 0 at src/main.rs:2:5: 10:6
}
bb2: {
goto -> bb29; // bb2[0]: scope 0 at src/main.rs:11:2: 11:2
}
bb3: {
StorageLive(_2); // bb3[0]: scope 0 at src/main.rs:3:13: 3:19
StorageLive(_3); // bb3[1]: scope 0 at src/main.rs:4:19: 4:23
_3 = const true; // bb3[2]: scope 0 at src/main.rs:4:19: 4:23
// ty::Const
// + ty: bool
// + val: Value(Scalar(Bits { defined: 8, bits: 1 }))
// mir::Constant
// + span: src/main.rs:4:19: 4:23
// + ty: bool
// + literal: const true
_4 = discriminant(_3); // bb3[3]: scope 0 at src/main.rs:4:13: 7:14
switchInt(_3) -> [false: bb11, otherwise: bb10]; // bb3[4]: scope 0 at src/main.rs:5:17: 5:22
}
bb4: { // cleanup
resume; // bb4[0]: scope 0 at src/main.rs:1:1: 11:2
}
bb5: {
_2 = const 4i32; // bb5[0]: scope 0 at src/main.rs:5:26: 5:27
// ty::Const
// + ty: i32
// + val: Value(Scalar(Bits { defined: 32, bits: 4 }))
// mir::Constant
// + span: src/main.rs:5:26: 5:27
// + ty: i32
// + literal: const 4i32
goto -> bb14; // bb5[1]: scope 0 at src/main.rs:4:13: 7:14
}
bb6: {
_0 = (); // bb6[0]: scope 0 at src/main.rs:6:25: 6:30
goto -> bb15; // bb6[1]: scope 0 at src/main.rs:6:25: 6:30
}
bb7: {
falseEdges -> [real: bb12, imaginary: bb8]; // bb7[0]: scope 0 at src/main.rs:5:17: 5:22
}
bb8: {
falseEdges -> [real: bb13, imaginary: bb9]; // bb8[0]: scope 0 at src/main.rs:6:17: 6:21
}
bb9: {
unreachable; // bb9[0]: scope 0 at src/main.rs:4:13: 7:14
}
bb10: {
goto -> bb8; // bb10[0]: scope 0 at src/main.rs:6:17: 6:21
}
bb11: {
goto -> bb7; // bb11[0]: scope 0 at src/main.rs:5:17: 5:22
}
bb12: {
goto -> bb5; // bb12[0]: scope 0 at src/main.rs:5:17: 5:22
}
bb13: {
goto -> bb6; // bb13[0]: scope 0 at src/main.rs:6:17: 6:21
}
bb14: {
StorageDead(_3); // bb14[0]: scope 0 at src/main.rs:8:10: 8:11
StorageLive(_7); // bb14[1]: scope 1 at src/main.rs:9:14: 9:21
_7 = &_2; // bb14[2]: scope 1 at src/main.rs:9:14: 9:21
_6 = const std::mem::drop(move _7) -> [return: bb28, unwind: bb4]; // bb14[3]: scope 1 at src/main.rs:9:9: 9:22
// ty::Const
// + ty: fn(&i32) {std::mem::drop::<&i32>}
// + val: Value(Scalar(Bits { defined: 0, bits: 0 }))
// mir::Constant
// + span: src/main.rs:9:9: 9:13
// + ty: fn(&i32) {std::mem::drop::<&i32>}
// + literal: const std::mem::drop
}
bb15: {
goto -> bb16; // bb15[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb16: {
goto -> bb17; // bb16[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb17: {
goto -> bb18; // bb17[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb18: {
goto -> bb19; // bb18[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb19: {
goto -> bb20; // bb19[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb20: {
StorageDead(_3); // bb20[0]: scope 0 at src/main.rs:8:10: 8:11
goto -> bb21; // bb20[1]: scope 0 at src/main.rs:6:25: 6:30
}
bb21: {
goto -> bb22; // bb21[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb22: {
goto -> bb23; // bb22[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb23: {
goto -> bb24; // bb23[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb24: {
goto -> bb25; // bb24[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb25: {
goto -> bb2; // bb25[0]: scope 0 at src/main.rs:6:25: 6:30
}
bb26: {
_5 = (); // bb26[0]: scope 0 at src/main.rs:6:25: 6:30
unreachable; // bb26[1]: scope 0 at src/main.rs:6:25: 6:30
}
bb27: {
StorageDead(_5); // bb27[0]: scope 0 at src/main.rs:6:29: 6:30
goto -> bb14; // bb27[1]: scope 0 at src/main.rs:4:13: 7:14
}
bb28: {
StorageDead(_7); // bb28[0]: scope 1 at src/main.rs:9:21: 9:22
_1 = (); // bb28[1]: scope 0 at src/main.rs:2:10: 10:6
StorageDead(_2); // bb28[2]: scope 0 at src/main.rs:10:5: 10:6
goto -> bb1; // bb28[3]: scope 0 at src/main.rs:2:5: 10:6
}
bb29: {
return; // bb29[0]: scope 0 at src/main.rs:11:2: 11:2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment