Skip to content

Commit

Permalink
more readable printing of validation operands
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 31, 2017
1 parent 5e426e1 commit 09cbe58
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/librustc/mir/mod.rs
Expand Up @@ -877,7 +877,7 @@ pub struct ValidationOperand<'tcx, T> {

impl<'tcx, T: Debug> Debug for ValidationOperand<'tcx, T> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
write!(fmt, "{:?}@{:?}", self.lval, self.ty)?;
write!(fmt, "{:?}: {:?}", self.lval, self.ty)?;
if let Some(ce) = self.re {
// (reuse lifetime rendering policy from ppaux.)
write!(fmt, "/{}", ty::ReScope(ce))?;
Expand Down
14 changes: 7 additions & 7 deletions src/test/mir-opt/validate_1.rs
Expand Up @@ -22,26 +22,26 @@ fn main() {
// START rustc.node4.EraseRegions.after.mir
// fn foo(_1: &ReErased mut i32) -> () {
// bb0: {
// Validate(Acquire, [_1@&ReFree(DefId { krate: CrateNum(0), node: DefIndex(3) => validate_1/8cd878b::foo[0] }, BrAnon(0)) mut i32]);
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(3) => validate_1/8cd878b::foo[0] }, BrAnon(0)) mut i32]);
// return;
// }
// }
// END rustc.node4.EraseRegions.after.mir
// START rustc.node11.EraseRegions.after.mir
// fn main() -> () {
// bb0: {
// Validate(Suspend(ReScope(Misc(NodeId(20)))), [_1@i32]);
// Validate(Suspend(ReScope(Misc(NodeId(20)))), [_1: i32]);
// _4 = &ReErased mut _1;
// Validate(Acquire, [(*_4)@i32/ReScope(Misc(NodeId(20)))]);
// Validate(Suspend(ReScope(Misc(NodeId(20)))), [(*_4)@i32/ReScope(Misc(NodeId(20)))]);
// Validate(Acquire, [(*_4): i32/ReScope(Misc(NodeId(20)))]);
// Validate(Suspend(ReScope(Misc(NodeId(20)))), [(*_4): i32/ReScope(Misc(NodeId(20)))]);
// _3 = &ReErased mut (*_4);
// Validate(Acquire, [(*_3)@i32/ReScope(Misc(NodeId(20)))]);
// Validate(Release, [_3@&ReScope(Misc(NodeId(20))) mut i32]);
// Validate(Acquire, [(*_3): i32/ReScope(Misc(NodeId(20)))]);
// Validate(Release, [_3: &ReScope(Misc(NodeId(20))) mut i32]);
// _2 = const foo(_3) -> bb1;
// }
//
// bb1: {
// Validate(Acquire, [_2@()]);
// Validate(Acquire, [_2: ()]);
// EndRegion(ReScope(Misc(NodeId(20))));
// return;
// }
Expand Down
4 changes: 2 additions & 2 deletions src/test/mir-opt/validate_2.rs
Expand Up @@ -19,9 +19,9 @@ fn main() {
// START rustc.node4.EraseRegions.after.mir
// fn main() -> () {
// bb1: {
// Validate(Release, [_2@std::boxed::Box<[i32; 3]>]);
// Validate(Release, [_2: std::boxed::Box<[i32; 3]>]);
// _1 = _2 as std::boxed::Box<[i32]> (Unsize);
// Validate(Acquire, [_1@std::boxed::Box<[i32]>]);
// Validate(Acquire, [_1: std::boxed::Box<[i32]>]);
// }
// }
// END rustc.node4.EraseRegions.after.mir
10 changes: 5 additions & 5 deletions src/test/mir-opt/validate_3.rs
Expand Up @@ -32,13 +32,13 @@ fn main() {
// fn main() -> () {
// let mut _5: &ReErased i32;
// bb0: {
// Validate(Suspend(ReScope(Misc(NodeId(46)))), [((*_2).0: i32)@i32/ReScope(Remainder(BlockRemainder { block: NodeId(18), first_statement_index: 3 })) (imm)]);
// Validate(Suspend(ReScope(Misc(NodeId(46)))), [((*_2).0: i32): i32/ReScope(Remainder(BlockRemainder { block: NodeId(18), first_statement_index: 3 })) (imm)]);
// _5 = &ReErased ((*_2).0: i32);
// Validate(Acquire, [(*_5)@i32/ReScope(Misc(NodeId(46))) (imm)]);
// Validate(Suspend(ReScope(Misc(NodeId(46)))), [(*_5)@i32/ReScope(Misc(NodeId(46))) (imm)]);
// Validate(Acquire, [(*_5): i32/ReScope(Misc(NodeId(46))) (imm)]);
// Validate(Suspend(ReScope(Misc(NodeId(46)))), [(*_5): i32/ReScope(Misc(NodeId(46))) (imm)]);
// _4 = &ReErased (*_5);
// Validate(Acquire, [(*_4)@i32/ReScope(Misc(NodeId(46))) (imm)]);
// Validate(Release, [_4@&ReScope(Misc(NodeId(46))) i32]);
// Validate(Acquire, [(*_4): i32/ReScope(Misc(NodeId(46))) (imm)]);
// Validate(Release, [_4: &ReScope(Misc(NodeId(46))) i32]);
// _3 = const foo(_4) -> bb1;
// }
// bb1: {
Expand Down

0 comments on commit 09cbe58

Please sign in to comment.