From 6a33221ea54ad4a496c06f5d93fb1e32c8076454 Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Fri, 1 Jan 2016 00:39:02 -0600 Subject: [PATCH] Improve pretty-printing of references in MIR. --- src/librustc/mir/repr.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs index 56cd7432a73af..9a5f675ad4b9b 100644 --- a/src/librustc/mir/repr.rs +++ b/src/librustc/mir/repr.rs @@ -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), @@ -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::*;