Created
May 20, 2019 03:25
-
-
Save wesleywiser/8af2517dfa5254cd226b8ae6631266e7 to your computer and use it in GitHub Desktop.
generator mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIR for `test2::{{closure}}#0` | |
// source = MirSource { instance: Item(DefId(0:17 ~ test[317d]::test2[0]::{{closure}}[0])), promoted: None } | |
// pass_name = ConstProp | |
// disambiguator = before | |
// generator_layout = GeneratorLayout { field_tys: [impl std::future::Future], variant_fields: [[], [], [], [_0]], __local_debuginfo_codegen_only_do_not_use: [LocalDecl { mutability: Mut, is_user_variable: Some(Set(Var(VarBindingForm { binding_mode: BindByValue(MutMutable), opt_ty_info: None, opt_match_place: Some((None, test.rs:8:13: 8:19)), pat_span: test.rs:8:13: 8:25 }))), internal: false, is_block_tail: None, ty: impl std::future::Future, user_ty: UserTypeProjections { contents: [] }, name: Some(pinned(4294967039)), source_info: SourceInfo { span: test.rs:8:13: 8:25, scope: scope[3] }, visibility_scope: scope[4] }] } | |
| User Type Annotations | |
| 0: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }], value: TypeOf(DefId(2:2794 ~ core[a3b7]::pin[0]::{{impl}}[3]::new_unchecked[0]), UserSubsts { substs: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(2:2792 ~ core[a3b7]::pin[0]::{{impl}}[3]), self_ty: std::pin::Pin<^1> }) }) } at test.rs:8:13: 8:25 | |
| | |
fn test2::{{closure}}#0(_1: std::pin::Pin<&mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}]>) -> std::ops::GeneratorState<(), ()> { | |
let mut _0: std::ops::GeneratorState<(), ()>; // return place in scope 0 at test.rs:7:18: 10:2 | |
let mut _3: (); // in scope 0 at test.rs:7:18: 10:2 | |
let mut _4: (); // in scope 0 at test.rs:7:18: 10:2 | |
let mut _5: (); // in scope 0 at test.rs:8:13: 8:25 | |
let mut _6: std::task::Poll<u32>; // in scope 0 at test.rs:8:13: 8:25 | |
let mut _7: std::pin::Pin<&mut impl std::future::Future>; // in scope 0 at test.rs:8:13: 8:25 | |
let mut _8: &mut impl std::future::Future; // in scope 0 at test.rs:8:13: 8:25 | |
let mut _9: &mut impl std::future::Future; // in scope 0 at test.rs:8:13: 8:25 | |
let mut _10: isize; // in scope 0 at test.rs:8:13: 8:25 | |
let mut _12: !; // in scope 0 at test.rs:8:13: 8:25 | |
let mut _13: (); // in scope 0 at test.rs:8:13: 8:25 | |
let mut _14: (); // in scope 0 at test.rs:8:13: 8:25 | |
let mut _15: (); // in scope 0 at test.rs:9:5: 9:13 | |
let mut _16: u32; // in scope 0 at test.rs:9:11: 9:12 | |
let mut _19: (); // in scope 0 at test.rs:7:18: 10:2 | |
let mut _20: isize; // in scope 0 at test.rs:7:18: 10:2 | |
scope 1 { | |
let _2: u32; // "x" in scope 1 at test.rs:8:9: 8:10 | |
} | |
scope 2 { | |
} | |
scope 3 { | |
} | |
scope 4 { | |
let _11: u32; // "x" in scope 4 at test.rs:8:13: 8:25 | |
scope 5 { | |
scope 7 { | |
let mut _17: &mut impl std::future::Future; // in scope 7 at test.rs:8:13: 8:25 | |
} | |
} | |
scope 6 { | |
} | |
scope 8 { | |
let mut _18: [closure@DefId(1:5382 ~ std[e621]::future[0]::poll_with_tls_context[0]::{{closure}}[0]) 0:std::pin::Pin<&mut impl std::future::Future>]; // in scope 8 at test.rs:8:13: 8:25 | |
} | |
} | |
bb0: { | |
_20 = discriminant((*(_1.0: &mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}]))); // bb0[0]: scope 0 at test.rs:7:18: 10:2 | |
switchInt(move _20) -> [0u32: bb1, 1u32: bb17, 2u32: bb18, 3u32: bb16, otherwise: bb19]; // bb0[1]: scope 0 at test.rs:7:18: 10:2 | |
} | |
bb1: { | |
StorageLive(_2); // bb1[0]: scope 0 at test.rs:8:9: 8:10 | |
nop; // bb1[1]: scope 0 at test.rs:8:13: 8:25 | |
(((*(_1.0: &mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}])) as variant#3).0: impl std::future::Future) = const test() -> [return: bb4, unwind: bb3]; // bb1[2]: scope 0 at test.rs:8:13: 8:19 | |
// ty::Const | |
// + ty: fn() -> impl std::future::Future {test} | |
// + val: Scalar(Bits { size: 0, bits: 0 }) | |
// mir::Constant | |
// + span: test.rs:8:13: 8:17 | |
// + ty: fn() -> impl std::future::Future {test} | |
// + literal: Const { ty: fn() -> impl std::future::Future {test}, val: Scalar(Bits { size: 0, bits: 0 }) } | |
} | |
bb2 (cleanup): { | |
discriminant((*(_1.0: &mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}]))) = 2; // bb2[0]: scope 0 at test.rs:7:18: 10:2 | |
resume; // bb2[1]: scope 0 at test.rs:7:18: 10:2 | |
} | |
bb3 (cleanup): { | |
goto -> bb14; // bb3[0]: scope 0 at test.rs:10:1: 10:2 | |
} | |
bb4: { | |
StorageLive(_6); // bb4[0]: scope 4 at test.rs:8:13: 8:25 | |
StorageLive(_7); // bb4[1]: scope 4 at test.rs:8:13: 8:25 | |
StorageLive(_8); // bb4[2]: scope 5 at test.rs:8:13: 8:25 | |
StorageLive(_9); // bb4[3]: scope 5 at test.rs:8:13: 8:25 | |
_9 = &mut (((*(_1.0: &mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}])) as variant#3).0: impl std::future::Future); // bb4[4]: scope 5 at test.rs:8:13: 8:25 | |
_8 = _9; // bb4[5]: scope 5 at test.rs:8:13: 8:25 | |
StorageLive(_17); // bb4[6]: scope 7 at /Users/wesley/code/rust/rust/src/libcore/pin.rs:434:15: 434:22 | |
_17 = move _8; // bb4[7]: scope 7 at /Users/wesley/code/rust/rust/src/libcore/pin.rs:434:15: 434:22 | |
(_7.0: &mut impl std::future::Future) = move _17; // bb4[8]: scope 7 at /Users/wesley/code/rust/rust/src/libcore/pin.rs:434:9: 434:24 | |
StorageDead(_17); // bb4[9]: scope 7 at /Users/wesley/code/rust/rust/src/libcore/pin.rs:434:23: 434:24 | |
StorageDead(_8); // bb4[10]: scope 5 at test.rs:8:24: 8:25 | |
StorageLive(_18); // bb4[11]: scope 8 at /Users/wesley/code/rust/rust/src/libstd/future.rs:114:22: 114:41 | |
(_18.0: std::pin::Pin<&mut impl std::future::Future>) = move _7; // bb4[12]: scope 8 at /Users/wesley/code/rust/rust/src/libstd/future.rs:114:22: 114:41 | |
_6 = const std::future::get_task_context(move _18) -> [return: bb13, unwind: bb5]; // bb4[13]: scope 8 at /Users/wesley/code/rust/rust/src/libstd/future.rs:114:5: 114:42 | |
// ty::Const | |
// + ty: fn([closure@DefId(1:5382 ~ std[e621]::future[0]::poll_with_tls_context[0]::{{closure}}[0]) 0:std::pin::Pin<&mut impl std::future::Future>]) -> std::task::Poll<u32> {std::future::get_task_context::<[closure@DefId(1:5382 ~ std[e621]::future[0]::poll_with_tls_context[0]::{{closure}}[0]) 0:std::pin::Pin<&mut impl std::future::Future>], std::task::Poll<u32>>} | |
// + val: Scalar(Bits { size: 0, bits: 0 }) | |
// mir::Constant | |
// + span: /Users/wesley/code/rust/rust/src/libstd/future.rs:114:5: 114:21 | |
// + ty: fn([closure@DefId(1:5382 ~ std[e621]::future[0]::poll_with_tls_context[0]::{{closure}}[0]) 0:std::pin::Pin<&mut impl std::future::Future>]) -> std::task::Poll<u32> {std::future::get_task_context::<[closure@DefId(1:5382 ~ std[e621]::future[0]::poll_with_tls_context[0]::{{closure}}[0]) 0:std::pin::Pin<&mut impl std::future::Future>], std::task::Poll<u32>>} | |
// + literal: Const { ty: fn([closure@DefId(1:5382 ~ std[e621]::future[0]::poll_with_tls_context[0]::{{closure}}[0]) 0:std::pin::Pin<&mut impl std::future::Future>]) -> std::task::Poll<u32> {std::future::get_task_context::<[closure@DefId(1:5382 ~ std[e621]::future[0]::poll_with_tls_context[0]::{{closure}}[0]) 0:std::pin::Pin<&mut impl std::future::Future>], std::task::Poll<u32>>}, val: Scalar(Bits { size: 0, bits: 0 }) } | |
} | |
bb5 (cleanup): { | |
drop((((*(_1.0: &mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}])) as variant#3).0: impl std::future::Future)) -> bb3; // bb5[0]: scope 0 at test.rs:8:24: 8:25 | |
} | |
bb6: { | |
unreachable; // bb6[0]: scope 0 at test.rs:10:2: 10:2 | |
} | |
bb7: { | |
StorageLive(_11); // bb7[0]: scope 4 at test.rs:8:13: 8:25 | |
_11 = ((_6 as Ready).0: u32); // bb7[1]: scope 4 at test.rs:8:13: 8:25 | |
_2 = _11; // bb7[2]: scope 6 at test.rs:8:13: 8:25 | |
StorageDead(_11); // bb7[3]: scope 4 at test.rs:8:24: 8:25 | |
StorageDead(_6); // bb7[4]: scope 4 at test.rs:8:24: 8:25 | |
StorageDead(_9); // bb7[5]: scope 4 at test.rs:8:24: 8:25 | |
drop((((*(_1.0: &mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}])) as variant#3).0: impl std::future::Future)) -> [return: bb10, unwind: bb3]; // bb7[6]: scope 0 at test.rs:8:24: 8:25 | |
} | |
bb8: { | |
_5 = (); // bb8[0]: scope 6 at test.rs:8:13: 8:25 | |
StorageDead(_11); // bb8[1]: scope 4 at test.rs:8:24: 8:25 | |
StorageDead(_6); // bb8[2]: scope 4 at test.rs:8:24: 8:25 | |
StorageDead(_9); // bb8[3]: scope 4 at test.rs:8:24: 8:25 | |
StorageLive(_14); // bb8[4]: scope 4 at test.rs:8:13: 8:25 | |
_14 = (); // bb8[5]: scope 4 at test.rs:8:13: 8:25 | |
_0 = std::ops::GeneratorState::<(), ()>::Yielded(move _14,); // bb8[6]: scope 4 at test.rs:8:13: 8:25 | |
discriminant((*(_1.0: &mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}]))) = 3; // bb8[7]: scope 4 at test.rs:8:13: 8:25 | |
return; // bb8[8]: scope 4 at test.rs:8:13: 8:25 | |
} | |
bb9: { | |
_13 = (); // bb9[0]: scope 4 at test.rs:8:13: 8:25 | |
StorageDead(_14); // bb9[1]: scope 4 at test.rs:8:24: 8:25 | |
_4 = (); // bb9[2]: scope 4 at test.rs:8:13: 8:25 | |
goto -> bb4; // bb9[3]: scope 4 at test.rs:8:13: 8:25 | |
} | |
bb10: { | |
nop; // bb10[0]: scope 0 at test.rs:8:24: 8:25 | |
StorageLive(_16); // bb10[1]: scope 2 at test.rs:9:11: 9:12 | |
_16 = _2; // bb10[2]: scope 2 at test.rs:9:11: 9:12 | |
_15 = const test3(move _16) -> [return: bb11, unwind: bb3]; // bb10[3]: scope 2 at test.rs:9:5: 9:13 | |
// ty::Const | |
// + ty: fn(u32) {test3} | |
// + val: Scalar(Bits { size: 0, bits: 0 }) | |
// mir::Constant | |
// + span: test.rs:9:5: 9:10 | |
// + ty: fn(u32) {test3} | |
// + literal: Const { ty: fn(u32) {test3}, val: Scalar(Bits { size: 0, bits: 0 }) } | |
} | |
bb11: { | |
StorageDead(_16); // bb11[0]: scope 2 at test.rs:9:12: 9:13 | |
_19 = (); // bb11[1]: scope 0 at test.rs:7:18: 10:2 | |
StorageDead(_2); // bb11[2]: scope 0 at test.rs:10:1: 10:2 | |
goto -> bb15; // bb11[3]: scope 0 at test.rs:10:1: 10:2 | |
} | |
bb12: { | |
_0 = std::ops::GeneratorState::<(), ()>::Complete(move _19,); // bb12[0]: scope 0 at test.rs:10:2: 10:2 | |
discriminant((*(_1.0: &mut [static generator@test.rs:7:18: 10:2 {impl std::future::Future, ()}]))) = 1; // bb12[1]: scope 0 at test.rs:10:2: 10:2 | |
return; // bb12[2]: scope 0 at test.rs:10:2: 10:2 | |
} | |
bb13: { | |
StorageDead(_18); // bb13[0]: scope 8 at /Users/wesley/code/rust/rust/src/libstd/future.rs:114:41: 114:42 | |
StorageDead(_7); // bb13[1]: scope 4 at test.rs:8:24: 8:25 | |
_10 = discriminant(_6); // bb13[2]: scope 4 at test.rs:8:13: 8:25 | |
switchInt(move _10) -> [0isize: bb7, 1isize: bb8, otherwise: bb6]; // bb13[3]: scope 4 at test.rs:8:13: 8:25 | |
} | |
bb14 (cleanup): { | |
goto -> bb2; // bb14[0]: scope 0 at test.rs:10:1: 10:2 | |
} | |
bb15: { | |
goto -> bb12; // bb15[0]: scope 0 at test.rs:10:1: 10:2 | |
} | |
bb16: { | |
StorageLive(_2); // bb16[0]: scope 0 at test.rs:7:18: 10:2 | |
StorageLive(_14); // bb16[1]: scope 0 at test.rs:7:18: 10:2 | |
goto -> bb9; // bb16[2]: scope 0 at test.rs:7:18: 10:2 | |
} | |
bb17: { | |
assert(const false, "generator resumed after completion") -> bb17; // bb17[0]: scope 0 at test.rs:7:18: 10:2 | |
// ty::Const | |
// + ty: bool | |
// + val: Scalar(Bits { size: 1, bits: 0 }) | |
// mir::Constant | |
// + span: test.rs:7:18: 10:2 | |
// + ty: bool | |
// + literal: Const { ty: bool, val: Scalar(Bits { size: 1, bits: 0 }) } | |
} | |
bb18: { | |
assert(const false, "generator resumed after panicking") -> bb18; // bb18[0]: scope 0 at test.rs:7:18: 10:2 | |
// ty::Const | |
// + ty: bool | |
// + val: Scalar(Bits { size: 1, bits: 0 }) | |
// mir::Constant | |
// + span: test.rs:7:18: 10:2 | |
// + ty: bool | |
// + literal: Const { ty: bool, val: Scalar(Bits { size: 1, bits: 0 }) } | |
} | |
bb19: { | |
unreachable; // bb19[0]: scope 0 at test.rs:7:18: 10:2 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment