Created
March 21, 2018 14:56
-
-
Save hrvolapeter/365878ae9f1cb1967c136292a5d8e008 to your computer and use it in GitHub Desktop.
borrowck-use-in-index-lvalue.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 `test` | |
// source = MirSource { def_id: DefId(0/0:3 ~ borrowck_use_in_index_lvalue[317d]::test[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..=5], bb1[0], bb2[0..=6], bb3[0..=6]} | |
| '_#1r | {'_#1r, bb0[0..=5], bb1[0], bb2[0..=6], bb3[0..=6]} | |
| '_#2r | {bb0[1..=5], bb2[0]} | |
| '_#3r | {bb2[2..=6], bb3[0]} | |
| | |
| Inference Constraints | |
| '_#0r live at {'_#0r, bb0[0..=5], bb1[0], bb2[0..=6], bb3[0..=6]} | |
| '_#1r live at {'_#1r, bb0[0..=5], bb1[0], bb2[0..=6], bb3[0..=6]} | |
| '_#2r live at {bb0[1..=5], bb2[0]} | |
| '_#3r live at {bb2[2..=6], bb3[0]} | |
fn test() -> (){ | |
let mut _0: (); // return place | |
scope 1 { | |
let _1: &mut [isize]; // "w" in scope 1 at borrowck-use-in-index-lvalue.rs:15:9: 15:10 | |
scope 3 { | |
let mut _5: &mut [isize]; // "w" in scope 3 at borrowck-use-in-index-lvalue.rs:19:9: 19:14 | |
} | |
scope 4 { | |
} | |
} | |
scope 2 { | |
} | |
let mut _2: usize; | |
let mut _3: usize; | |
let mut _4: bool; | |
let mut _6: usize; | |
let mut _7: usize; | |
let mut _8: bool; | |
| Live variables on entry to bb0: [] | |
bb0: { | |
| Live variables on entry to bb0[0]: [] | |
StorageLive(_1); // bb0[0]: scope 0 at borrowck-use-in-index-lvalue.rs:15:9: 15:10 | |
| Live variables on entry to bb0[1]: [_1] | |
StorageLive(_2); // bb0[1]: scope 1 at borrowck-use-in-index-lvalue.rs:16:7: 16:8 | |
| Live variables on entry to bb0[2]: [_1] | |
_2 = const 5usize; // bb0[2]: scope 1 at borrowck-use-in-index-lvalue.rs:16:7: 16:8 | |
// ty::Const | |
// + ty: usize | |
// + val: Value(ByVal(Bytes(5))) | |
// mir::Constant | |
// + span: borrowck-use-in-index-lvalue.rs:16:7: 16:8 | |
// + ty: usize | |
// + literal: const 5usize | |
| Live variables on entry to bb0[3]: [_1, _2] | |
_3 = Len((*_1)); // bb0[3]: scope 1 at borrowck-use-in-index-lvalue.rs:16:5: 16:9 | |
| Live variables on entry to bb0[4]: [_1, _2, _3] | |
_4 = Lt(_2, _3); // bb0[4]: scope 1 at borrowck-use-in-index-lvalue.rs:16:5: 16:9 | |
| Live variables on entry to bb0[5]: [_1, _2, _3, _4] | |
assert(move _4, "index out of bounds: the len is {} but the index is {}", move _3, _2) -> [success: bb2, unwind: bb1]; // bb0[5]: scope 1 at borrowck-use-in-index-lvalue.rs:16:5: 16:9 | |
} | |
| Live variables on entry to bb1: [] | |
bb1: { // cleanup | |
| Live variables on entry to bb1[0]: [] | |
resume; // bb1[0]: scope 0 at borrowck-use-in-index-lvalue.rs:14:1: 22:2 | |
} | |
| Live variables on entry to bb2: [_1, _2] | |
bb2: { | |
| Live variables on entry to bb2[0]: [_1, _2] | |
(*_1)[_2] = const 0isize; // bb2[0]: scope 1 at borrowck-use-in-index-lvalue.rs:16:5: 16:13 | |
// ty::Const | |
// + ty: isize | |
// + val: Value(ByVal(Bytes(0))) | |
// mir::Constant | |
// + span: borrowck-use-in-index-lvalue.rs:16:12: 16:13 | |
// + ty: isize | |
// + literal: const 0isize | |
| Live variables on entry to bb2[1]: [] | |
StorageLive(_5); // bb2[1]: scope 1 at borrowck-use-in-index-lvalue.rs:19:9: 19:14 | |
| Live variables on entry to bb2[2]: [_5] | |
StorageLive(_6); // bb2[2]: scope 3 at borrowck-use-in-index-lvalue.rs:20:7: 20:8 | |
| Live variables on entry to bb2[3]: [_5] | |
_6 = const 5usize; // bb2[3]: scope 3 at borrowck-use-in-index-lvalue.rs:20:7: 20:8 | |
// ty::Const | |
// + ty: usize | |
// + val: Value(ByVal(Bytes(5))) | |
// mir::Constant | |
// + span: borrowck-use-in-index-lvalue.rs:20:7: 20:8 | |
// + ty: usize | |
// + literal: const 5usize | |
| Live variables on entry to bb2[4]: [_5, _6] | |
_7 = Len((*_5)); // bb2[4]: scope 3 at borrowck-use-in-index-lvalue.rs:20:5: 20:9 | |
| Live variables on entry to bb2[5]: [_5, _6, _7] | |
_8 = Lt(_6, _7); // bb2[5]: scope 3 at borrowck-use-in-index-lvalue.rs:20:5: 20:9 | |
| Live variables on entry to bb2[6]: [_5, _6, _7, _8] | |
assert(move _8, "index out of bounds: the len is {} but the index is {}", move _7, _6) -> [success: bb3, unwind: bb1]; // bb2[6]: scope 3 at borrowck-use-in-index-lvalue.rs:20:5: 20:9 | |
} | |
| Live variables on entry to bb3: [_5, _6] | |
bb3: { | |
| Live variables on entry to bb3[0]: [_5, _6] | |
(*_5)[_6] = const 0isize; // bb3[0]: scope 3 at borrowck-use-in-index-lvalue.rs:20:5: 20:13 | |
// ty::Const | |
// + ty: isize | |
// + val: Value(ByVal(Bytes(0))) | |
// mir::Constant | |
// + span: borrowck-use-in-index-lvalue.rs:20:12: 20:13 | |
// + ty: isize | |
// + literal: const 0isize | |
| Live variables on entry to bb3[1]: [] | |
_0 = (); // bb3[1]: scope 0 at borrowck-use-in-index-lvalue.rs:14:11: 22:2 | |
| Live variables on entry to bb3[2]: [] | |
nop; // bb3[2]: scope 0 at borrowck-use-in-index-lvalue.rs:14:11: 22:2 | |
| Live variables on entry to bb3[3]: [] | |
StorageDead(_5); // bb3[3]: scope 1 at borrowck-use-in-index-lvalue.rs:22:1: 22:2 | |
| Live variables on entry to bb3[4]: [] | |
nop; // bb3[4]: scope 0 at borrowck-use-in-index-lvalue.rs:14:11: 22:2 | |
| Live variables on entry to bb3[5]: [] | |
StorageDead(_1); // bb3[5]: scope 0 at borrowck-use-in-index-lvalue.rs:22:1: 22:2 | |
| Live variables on entry to bb3[6]: [] | |
return; // bb3[6]: scope 0 at borrowck-use-in-index-lvalue.rs:22:2: 22:2 | |
} | |
} |
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 `main` | |
// source = MirSource { def_id: DefId(0/0:4 ~ borrowck_use_in_index_lvalue[317d]::main[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], bb1[0], bb2[0..=1]} | |
| '_#1r | {'_#1r, bb0[0], bb1[0], bb2[0..=1]} | |
| | |
| Inference Constraints | |
| '_#0r live at {'_#0r, bb0[0], bb1[0], bb2[0..=1]} | |
| '_#1r live at {'_#1r, bb0[0], bb1[0], bb2[0..=1]} | |
fn main() -> (){ | |
let mut _0: (); // return place | |
let mut _1: (); | |
| Live variables on entry to bb0: [] | |
bb0: { | |
| Live variables on entry to bb0[0]: [] | |
_1 = const test() -> [return: bb2, unwind: bb1]; // bb0[0]: scope 0 at borrowck-use-in-index-lvalue.rs:24:13: 24:19 | |
// ty::Const | |
// + ty: fn() {test} | |
// + val: Value(ByVal(Undef)) | |
// mir::Constant | |
// + span: borrowck-use-in-index-lvalue.rs:24:13: 24:17 | |
// + ty: fn() {test} | |
// + literal: const test | |
} | |
| Live variables on entry to bb1: [] | |
bb1: { // cleanup | |
| Live variables on entry to bb1[0]: [] | |
resume; // bb1[0]: scope 0 at borrowck-use-in-index-lvalue.rs:24:1: 24:22 | |
} | |
| Live variables on entry to bb2: [] | |
bb2: { | |
| Live variables on entry to bb2[0]: [] | |
_0 = (); // bb2[0]: scope 0 at borrowck-use-in-index-lvalue.rs:24:11: 24:22 | |
| Live variables on entry to bb2[1]: [] | |
return; // bb2[1]: scope 0 at borrowck-use-in-index-lvalue.rs:24:22: 24:22 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment