Skip to content

Commit

Permalink
Improve pretty-printing of references in MIR.
Browse files Browse the repository at this point in the history
  • Loading branch information
solson committed Jan 4, 2016
1 parent 5223544 commit 6a33221
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/librustc/mir/repr.rs
Expand Up @@ -721,7 +721,6 @@ impl<'tcx> Debug for Rvalue<'tcx> {
match *self {
Use(ref lvalue) => write!(fmt, "{:?}", lvalue),
Repeat(ref a, ref b) => write!(fmt, "[{:?}; {:?}]", a, b),
Ref(ref a, bk, ref b) => write!(fmt, "&{:?} {:?} {:?}", a, bk, b),
Len(ref a) => write!(fmt, "Len({:?})", a),
Cast(ref kind, ref lv, ref ty) => write!(fmt, "{:?} as {:?} ({:?})", lv, ty, kind),
BinaryOp(ref op, ref a, ref b) => write!(fmt, "{:?}({:?}, {:?})", op, a, b),
Expand All @@ -731,6 +730,14 @@ impl<'tcx> Debug for Rvalue<'tcx> {
Slice { ref input, from_start, from_end } =>
write!(fmt, "{:?}[{:?}..-{:?}]", input, from_start, from_end),

Ref(_, borrow_kind, ref lv) => {
let kind_str = match borrow_kind {
BorrowKind::Shared => "",
BorrowKind::Mut | BorrowKind::Unique => "mut ",
};
write!(fmt, "&{}{:?}", kind_str, lv)
}

Aggregate(ref kind, ref lvs) => {
use self::AggregateKind::*;

Expand Down

0 comments on commit 6a33221

Please sign in to comment.