Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit basic block info for stmts and terminators in MIR dumps only with -Zverbose #71200

Merged
merged 1 commit into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/librustc_mir/util/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ where
let indented_body = format!("{0}{0}{1:?};", INDENT, statement);
writeln!(
w,
"{:A$} // {:?}: {}",
"{:A$} // {}{}",
indented_body,
current_location,
if tcx.sess.verbose() { format!("{:?}: ", current_location) } else { String::new() },
comment(tcx, statement.source_info),
A = ALIGN,
)?;
Expand All @@ -326,9 +326,9 @@ where
let indented_terminator = format!("{0}{0}{1:?};", INDENT, data.terminator().kind);
writeln!(
w,
"{:A$} // {:?}: {}",
"{:A$} // {}{}",
indented_terminator,
current_location,
if tcx.sess.verbose() { format!("{:?}: ", current_location) } else { String::new() },
comment(tcx, data.terminator().source_info),
A = ALIGN,
)?;
Expand Down Expand Up @@ -455,7 +455,7 @@ fn write_scope_tree(
)?;
}

// Local variable types (including the user's name in a comment).
// Local variable types.
for (local, local_decl) in body.local_decls.iter_enumerated() {
if (1..body.arg_count + 1).contains(&local.index()) {
// Skip over argument locals, they're printed in the signature.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,34 @@ fn borrow_and_cast(_1: i32) -> () {
}

bb0: {
StorageLive(_2); // bb0[0]: scope 0 at $DIR/address-of.rs:42:9: 42:10
StorageLive(_3); // bb0[1]: scope 0 at $DIR/address-of.rs:42:13: 42:15
_3 = &_1; // bb0[2]: scope 0 at $DIR/address-of.rs:42:13: 42:15
_2 = &raw const (*_3); // bb0[3]: scope 0 at $DIR/address-of.rs:42:13: 42:15
FakeRead(ForLet, _2); // bb0[4]: scope 0 at $DIR/address-of.rs:42:9: 42:10
StorageDead(_3); // bb0[5]: scope 0 at $DIR/address-of.rs:42:29: 42:30
StorageLive(_4); // bb0[6]: scope 1 at $DIR/address-of.rs:43:9: 43:10
StorageLive(_5); // bb0[7]: scope 1 at $DIR/address-of.rs:43:13: 43:19
_5 = &mut _1; // bb0[8]: scope 1 at $DIR/address-of.rs:43:13: 43:19
_4 = &raw const (*_5); // bb0[9]: scope 1 at $DIR/address-of.rs:43:13: 43:19
FakeRead(ForLet, _4); // bb0[10]: scope 1 at $DIR/address-of.rs:43:9: 43:10
StorageDead(_5); // bb0[11]: scope 1 at $DIR/address-of.rs:43:33: 43:34
StorageLive(_6); // bb0[12]: scope 2 at $DIR/address-of.rs:44:9: 44:10
StorageLive(_7); // bb0[13]: scope 2 at $DIR/address-of.rs:44:13: 44:19
_7 = &mut _1; // bb0[14]: scope 2 at $DIR/address-of.rs:44:13: 44:19
_6 = &raw mut (*_7); // bb0[15]: scope 2 at $DIR/address-of.rs:44:13: 44:19
FakeRead(ForLet, _6); // bb0[16]: scope 2 at $DIR/address-of.rs:44:9: 44:10
StorageDead(_7); // bb0[17]: scope 2 at $DIR/address-of.rs:44:31: 44:32
_0 = const (); // bb0[18]: scope 0 at $DIR/address-of.rs:41:32: 45:2
StorageLive(_2); // scope 0 at $DIR/address-of.rs:42:9: 42:10
StorageLive(_3); // scope 0 at $DIR/address-of.rs:42:13: 42:15
_3 = &_1; // scope 0 at $DIR/address-of.rs:42:13: 42:15
_2 = &raw const (*_3); // scope 0 at $DIR/address-of.rs:42:13: 42:15
FakeRead(ForLet, _2); // scope 0 at $DIR/address-of.rs:42:9: 42:10
StorageDead(_3); // scope 0 at $DIR/address-of.rs:42:29: 42:30
StorageLive(_4); // scope 1 at $DIR/address-of.rs:43:9: 43:10
StorageLive(_5); // scope 1 at $DIR/address-of.rs:43:13: 43:19
_5 = &mut _1; // scope 1 at $DIR/address-of.rs:43:13: 43:19
_4 = &raw const (*_5); // scope 1 at $DIR/address-of.rs:43:13: 43:19
FakeRead(ForLet, _4); // scope 1 at $DIR/address-of.rs:43:9: 43:10
StorageDead(_5); // scope 1 at $DIR/address-of.rs:43:33: 43:34
StorageLive(_6); // scope 2 at $DIR/address-of.rs:44:9: 44:10
StorageLive(_7); // scope 2 at $DIR/address-of.rs:44:13: 44:19
_7 = &mut _1; // scope 2 at $DIR/address-of.rs:44:13: 44:19
_6 = &raw mut (*_7); // scope 2 at $DIR/address-of.rs:44:13: 44:19
FakeRead(ForLet, _6); // scope 2 at $DIR/address-of.rs:44:9: 44:10
StorageDead(_7); // scope 2 at $DIR/address-of.rs:44:31: 44:32
_0 = const (); // scope 0 at $DIR/address-of.rs:41:32: 45:2
// ty::Const
// + ty: ()
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/address-of.rs:41:32: 45:2
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
StorageDead(_6); // bb0[19]: scope 2 at $DIR/address-of.rs:45:1: 45:2
StorageDead(_4); // bb0[20]: scope 1 at $DIR/address-of.rs:45:1: 45:2
StorageDead(_2); // bb0[21]: scope 0 at $DIR/address-of.rs:45:1: 45:2
return; // bb0[22]: scope 0 at $DIR/address-of.rs:45:2: 45:2
StorageDead(_6); // scope 2 at $DIR/address-of.rs:45:1: 45:2
StorageDead(_4); // scope 1 at $DIR/address-of.rs:45:1: 45:2
StorageDead(_2); // scope 0 at $DIR/address-of.rs:45:1: 45:2
return; // scope 0 at $DIR/address-of.rs:45:2: 45:2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ fn main() -> () {
}

bb0: {
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29
StorageLive(_1); // scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
_1 = [const 42u32, const 43u32, const 44u32]; // scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29
// ty::Const
// + ty: u32
// + val: Value(Scalar(0x0000002a))
Expand All @@ -44,23 +44,23 @@ fn main() -> () {
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:13:26: 13:28
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) }
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18
StorageLive(_2); // scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
_2 = const 1usize; // scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x00000001))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:14:17: 14:18
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29
StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27
StorageLive(_3); // scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
StorageLive(_4); // scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_4 = &mut _2; // scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
_3 = &raw mut (*_4); // scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
StorageDead(_4); // scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32
StorageLive(_5); // scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29
StorageLive(_6); // scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_6 = _3; // scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
_5 = const foo(move _6) -> bb1; // scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27
// ty::Const
// + ty: unsafe fn(*mut usize) -> u32 {foo}
// + val: Value(Scalar(<ZST>))
Expand All @@ -70,28 +70,28 @@ fn main() -> () {
}

bb1: {
StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27
StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
_9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
assert(move _9, "index out of bounds: the len is {} but the index is {}", move _8, _7) -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
StorageDead(_6); // scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27
StorageLive(_7); // scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_7 = _2; // scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
_8 = Len(_1); // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
_9 = Lt(_7, _8); // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
assert(move _9, "index out of bounds: the len is {} but the index is {}", move _8, _7) -> bb2; // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
}

bb2: {
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
_0 = const (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
_1[_7] = move _5; // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29
StorageDead(_5); // scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
StorageDead(_7); // scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
_0 = const (); // scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
// ty::Const
// + ty: ()
// + val: Value(Scalar(<ZST>))
// mir::Constant
// + span: $DIR/array-index-is-temporary.rs:12:11: 17:2
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2
StorageDead(_3); // scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_2); // scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
StorageDead(_1); // scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2
return; // scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2
}
}
Loading