Skip to content

Instantly share code, notes, and snippets.

@hrvolapeter
Created March 22, 2018 19:57
Show Gist options
  • Save hrvolapeter/947f60a9505c69c99e8afac890486897 to your computer and use it in GitHub Desktop.
Save hrvolapeter/947f60a9505c69c99e8afac890486897 to your computer and use it in GitHub Desktop.
// MIR for `move_out_from_begin_and_end`
// source = MirSource { def_id: DefId(0/0:3 ~ borrowck_move_out_from_array[317d]::move_out_from_begin_and_end[0]), promoted: None }
// pass_name = nll
// disambiguator = 0
| Free Region Mapping
| '_#0r | Global | ['_#0r, '_#1r]
| '_#1r | Local | ['_#1r]
|
| Inferred Region Values
| '_#0r | {'_#0r, bb0[0..=8], bb1[0], bb2[0..=1], bb3[0], bb4[0..=1], bb5[0..=6], bb6[0], bb7[0], bb8[0..=1], bb9[0..=1], bb10[0..=1]}
| '_#1r | {'_#1r, bb0[0..=8], bb1[0], bb2[0..=1], bb3[0], bb4[0..=1], bb5[0..=6], bb6[0], bb7[0], bb8[0..=1], bb9[0..=1], bb10[0..=1]}
|
| Inference Constraints
| '_#0r live at {'_#0r, bb0[0..=8], bb1[0], bb2[0..=1], bb3[0], bb4[0..=1], bb5[0..=6], bb6[0], bb7[0], bb8[0..=1], bb9[0..=1], bb10[0..=1]}
| '_#1r live at {'_#1r, bb0[0..=8], bb1[0], bb2[0..=1], bb3[0], bb4[0..=1], bb5[0..=6], bb6[0], bb7[0], bb8[0..=1], bb9[0..=1], bb10[0..=1]}
fn move_out_from_begin_and_end() -> (){
let mut _0: (); // return place
scope 1 {
let _1: [std::boxed::Box<i32>; 2]; // "a" in scope 1 at borrowck-move-out-from-array.rs:18:9: 18:10
scope 3 {
let _5: std::boxed::Box<i32>; // "_x" in scope 3 at borrowck-move-out-from-array.rs:19:13: 19:15
scope 5 {
let _6: std::boxed::Box<i32>; // "_y" in scope 5 at borrowck-move-out-from-array.rs:20:14: 20:16
}
scope 6 {
}
}
scope 4 {
}
}
scope 2 {
}
let mut _2: std::boxed::Box<i32>;
let mut _3: std::boxed::Box<i32>;
let mut _4: std::boxed::Box<i32>;
| Live variables on entry to bb0: []
bb0: {
| Live variables on entry to bb0[0]: []
StorageLive(_1); // bb0[0]: scope 0 at borrowck-move-out-from-array.rs:18:9: 18:10
| Live variables on entry to bb0[1]: []
StorageLive(_2); // bb0[1]: scope 0 at borrowck-move-out-from-array.rs:18:14: 18:19
| Live variables on entry to bb0[2]: []
StorageLive(_3); // bb0[2]: scope 0 at borrowck-move-out-from-array.rs:18:14: 18:19
| Live variables on entry to bb0[3]: []
_3 = Box(i32); // bb0[3]: scope 0 at borrowck-move-out-from-array.rs:18:14: 18:19
| Live variables on entry to bb0[4]: [_3]
(*_3) = const 1i32; // bb0[4]: scope 0 at borrowck-move-out-from-array.rs:18:18: 18:19
// ty::Const
// + ty: i32
// + val: Value(ByVal(Bytes(1)))
// mir::Constant
// + span: borrowck-move-out-from-array.rs:18:18: 18:19
// + ty: i32
// + literal: const 1i32
| Live variables on entry to bb0[5]: [_3]
_2 = move _3; // bb0[5]: scope 0 at borrowck-move-out-from-array.rs:18:14: 18:19
| Live variables on entry to bb0[6]: [_2]
StorageDead(_3); // bb0[6]: scope 0 at borrowck-move-out-from-array.rs:18:18: 18:19
| Live variables on entry to bb0[7]: [_2]
StorageLive(_4); // bb0[7]: scope 0 at borrowck-move-out-from-array.rs:18:21: 18:32
| Live variables on entry to bb0[8]: [_2]
_4 = const <std::boxed::Box<T>>::new(const 2i32) -> [return: bb2, unwind: bb3]; // bb0[8]: scope 0 at borrowck-move-out-from-array.rs:18:21: 18:32
// ty::Const
// + ty: fn(i32) -> std::boxed::Box<i32> {<std::boxed::Box<T>><i32>::new}
// + val: Value(ByVal(Undef))
// mir::Constant
// + span: borrowck-move-out-from-array.rs:18:21: 18:29
// + ty: fn(i32) -> std::boxed::Box<i32> {<std::boxed::Box<T>><i32>::new}
// + literal: const <std::boxed::Box<T>>::new
// ty::Const
// + ty: i32
// + val: Value(ByVal(Bytes(2)))
// mir::Constant
// + span: borrowck-move-out-from-array.rs:18:30: 18:31
// + ty: i32
// + literal: const 2i32
}
| Live variables on entry to bb1: []
bb1: { // cleanup
| Live variables on entry to bb1[0]: []
resume; // bb1[0]: scope 0 at borrowck-move-out-from-array.rs:17:1: 22:2
}
| Live variables on entry to bb2: [_2, _4]
bb2: {
| Live variables on entry to bb2[0]: [_2, _4]
_1 = [move _2, move _4]; // bb2[0]: scope 0 at borrowck-move-out-from-array.rs:18:13: 18:33
| Live variables on entry to bb2[1]: [_1, _2 (drop), _4 (drop)]
drop(_4) -> [return: bb4, unwind: bb3]; // bb2[1]: scope 0 at borrowck-move-out-from-array.rs:18:32: 18:33
}
| Live variables on entry to bb3: [_2 (drop)]
bb3: { // cleanup
| Live variables on entry to bb3[0]: [_2 (drop)]
drop(_2) -> bb1; // bb3[0]: scope 0 at borrowck-move-out-from-array.rs:18:32: 18:33
}
| Live variables on entry to bb4: [_1, _2 (drop)]
bb4: {
| Live variables on entry to bb4[0]: [_1, _2 (drop)]
StorageDead(_4); // bb4[0]: scope 0 at borrowck-move-out-from-array.rs:18:32: 18:33
| Live variables on entry to bb4[1]: [_1, _2 (drop)]
drop(_2) -> [return: bb5, unwind: bb1]; // bb4[1]: scope 0 at borrowck-move-out-from-array.rs:18:32: 18:33
}
| Live variables on entry to bb5: [_1]
bb5: {
| Live variables on entry to bb5[0]: [_1]
StorageDead(_2); // bb5[0]: scope 0 at borrowck-move-out-from-array.rs:18:32: 18:33
| Live variables on entry to bb5[1]: [_1]
StorageLive(_5); // bb5[1]: scope 1 at borrowck-move-out-from-array.rs:19:13: 19:15
| Live variables on entry to bb5[2]: [_1]
_5 = move _1[1 of 2]; // bb5[2]: scope 1 at borrowck-move-out-from-array.rs:19:13: 19:15
| Live variables on entry to bb5[3]: [_1, _5 (drop)]
StorageLive(_6); // bb5[3]: scope 3 at borrowck-move-out-from-array.rs:20:14: 20:16
| Live variables on entry to bb5[4]: [_1, _5 (drop)]
_6 = move _1[1 of 2]; // bb5[4]: scope 3 at borrowck-move-out-from-array.rs:20:14: 20:16
| Live variables on entry to bb5[5]: [_1 (drop), _5 (drop), _6 (drop)]
_0 = (); // bb5[5]: scope 0 at borrowck-move-out-from-array.rs:17:34: 22:2
| Live variables on entry to bb5[6]: [_1 (drop), _5 (drop), _6 (drop)]
drop(_6) -> [return: bb8, unwind: bb7]; // bb5[6]: scope 3 at borrowck-move-out-from-array.rs:22:1: 22:2
}
| Live variables on entry to bb6: [_1 (drop)]
bb6: { // cleanup
| Live variables on entry to bb6[0]: [_1 (drop)]
drop(_1) -> bb1; // bb6[0]: scope 0 at borrowck-move-out-from-array.rs:22:1: 22:2
}
| Live variables on entry to bb7: [_1 (drop), _5 (drop)]
bb7: { // cleanup
| Live variables on entry to bb7[0]: [_1 (drop), _5 (drop)]
drop(_5) -> bb6; // bb7[0]: scope 1 at borrowck-move-out-from-array.rs:22:1: 22:2
}
| Live variables on entry to bb8: [_1 (drop), _5 (drop)]
bb8: {
| Live variables on entry to bb8[0]: [_1 (drop), _5 (drop)]
StorageDead(_6); // bb8[0]: scope 3 at borrowck-move-out-from-array.rs:22:1: 22:2
| Live variables on entry to bb8[1]: [_1 (drop), _5 (drop)]
drop(_5) -> [return: bb9, unwind: bb6]; // bb8[1]: scope 1 at borrowck-move-out-from-array.rs:22:1: 22:2
}
| Live variables on entry to bb9: [_1 (drop)]
bb9: {
| Live variables on entry to bb9[0]: [_1 (drop)]
StorageDead(_5); // bb9[0]: scope 1 at borrowck-move-out-from-array.rs:22:1: 22:2
| Live variables on entry to bb9[1]: [_1 (drop)]
drop(_1) -> [return: bb10, unwind: bb1]; // bb9[1]: scope 0 at borrowck-move-out-from-array.rs:22:1: 22:2
}
| Live variables on entry to bb10: []
bb10: {
| Live variables on entry to bb10[0]: []
StorageDead(_1); // bb10[0]: scope 0 at borrowck-move-out-from-array.rs:22:1: 22:2
| Live variables on entry to bb10[1]: []
return; // bb10[1]: scope 0 at borrowck-move-out-from-array.rs:22:2: 22:2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment