2022-07-13 13:13:07 -05:00
|
|
|
// MIR for `foo` after PreCodegen
|
|
|
|
|
|
|
|
fn foo(_1: Option<String>) -> i32 {
|
|
|
|
debug s => _1; // in scope 0 at $DIR/string.rs:+0:12: +0:13
|
|
|
|
let mut _0: i32; // return place in scope 0 at $DIR/string.rs:+0:34: +0:37
|
2023-05-21 13:44:37 -05:00
|
|
|
let mut _2: bool; // in scope 0 at $DIR/string.rs:+5:1: +5:2
|
|
|
|
let mut _3: isize; // in scope 0 at $DIR/string.rs:+2:9: +2:18
|
|
|
|
let mut _4: &std::string::String; // in scope 0 at $DIR/string.rs:+2:14: +2:17
|
|
|
|
let mut _5: &str; // in scope 0 at $DIR/string.rs:+2:14: +2:17
|
|
|
|
let mut _6: bool; // in scope 0 at $DIR/string.rs:+2:14: +2:17
|
|
|
|
let _7: std::option::Option<std::string::String>; // in scope 0 at $DIR/string.rs:+3:9: +3:10
|
2022-07-13 13:13:07 -05:00
|
|
|
scope 1 {
|
2023-05-21 13:44:37 -05:00
|
|
|
debug s => _7; // in scope 1 at $DIR/string.rs:+3:9: +3:10
|
2022-07-13 13:13:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb0: {
|
2023-05-21 13:44:37 -05:00
|
|
|
_2 = const false; // scope 0 at $DIR/string.rs:+1:11: +1:12
|
|
|
|
_2 = const true; // scope 0 at $DIR/string.rs:+1:11: +1:12
|
|
|
|
_3 = discriminant(_1); // scope 0 at $DIR/string.rs:+1:11: +1:12
|
|
|
|
switchInt(move _3) -> [1: bb1, otherwise: bb5]; // scope 0 at $DIR/string.rs:+1:5: +1:12
|
2022-07-13 13:13:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb1: {
|
2023-05-21 13:44:37 -05:00
|
|
|
_4 = &((_1 as Some).0: std::string::String); // scope 0 at $DIR/string.rs:+2:14: +2:17
|
|
|
|
_5 = <String as Deref>::deref(move _4) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17
|
2022-07-13 13:13:07 -05:00
|
|
|
// mir::Constant
|
|
|
|
// + span: $DIR/string.rs:9:14: 9:17
|
|
|
|
// + literal: Const { ty: for<'a> fn(&'a String) -> &'a <String as Deref>::Target {<String as Deref>::deref}, val: Value(<ZST>) }
|
|
|
|
}
|
|
|
|
|
2023-05-21 13:44:37 -05:00
|
|
|
bb2: {
|
|
|
|
_6 = <str as PartialEq>::eq(_5, const "a") -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17
|
2022-07-13 13:13:07 -05:00
|
|
|
// mir::Constant
|
|
|
|
// + span: $DIR/string.rs:9:14: 9:17
|
|
|
|
// + literal: Const { ty: for<'a, 'b> fn(&'a str, &'b str) -> bool {<str as PartialEq>::eq}, val: Value(<ZST>) }
|
|
|
|
// mir::Constant
|
|
|
|
// + span: $DIR/string.rs:9:14: 9:17
|
|
|
|
// + literal: Const { ty: &str, val: Value(Slice(..)) }
|
|
|
|
}
|
|
|
|
|
2023-05-21 13:44:37 -05:00
|
|
|
bb3: {
|
|
|
|
switchInt(move _6) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/string.rs:+2:14: +2:17
|
|
|
|
}
|
|
|
|
|
2022-07-13 13:13:07 -05:00
|
|
|
bb4: {
|
2023-05-21 13:44:37 -05:00
|
|
|
_0 = const 1234_i32; // scope 0 at $DIR/string.rs:+2:22: +2:26
|
|
|
|
goto -> bb7; // scope 0 at $DIR/string.rs:+2:22: +2:26
|
2022-07-13 13:13:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb5: {
|
2023-05-21 13:44:37 -05:00
|
|
|
StorageLive(_7); // scope 0 at $DIR/string.rs:+3:9: +3:10
|
|
|
|
_2 = const false; // scope 0 at $DIR/string.rs:+3:9: +3:10
|
|
|
|
_7 = move _1; // scope 0 at $DIR/string.rs:+3:9: +3:10
|
|
|
|
_0 = const 4321_i32; // scope 1 at $DIR/string.rs:+3:14: +3:18
|
|
|
|
drop(_7) -> [return: bb6, unwind unreachable]; // scope 0 at $DIR/string.rs:+3:17: +3:18
|
2022-07-13 13:13:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb6: {
|
2023-05-21 13:44:37 -05:00
|
|
|
StorageDead(_7); // scope 0 at $DIR/string.rs:+3:17: +3:18
|
|
|
|
goto -> bb7; // scope 0 at $DIR/string.rs:+3:17: +3:18
|
2022-07-13 13:13:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb7: {
|
2023-05-21 13:44:37 -05:00
|
|
|
switchInt(_2) -> [0: bb9, otherwise: bb8]; // scope 0 at $DIR/string.rs:+5:1: +5:2
|
2022-07-13 13:13:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb8: {
|
2023-05-21 13:44:37 -05:00
|
|
|
drop(_1) -> [return: bb9, unwind unreachable]; // scope 0 at $DIR/string.rs:+5:1: +5:2
|
2022-07-13 13:13:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb9: {
|
2023-05-21 13:44:37 -05:00
|
|
|
return; // scope 0 at $DIR/string.rs:+5:2: +5:2
|
2022-07-13 13:13:07 -05:00
|
|
|
}
|
|
|
|
}
|