diff options
| author | Scott Olson <scott@solson.me> | 2016-01-01 00:39:02 -0600 |
|---|---|---|
| committer | Scott Olson <scott@solson.me> | 2016-01-04 16:11:33 -0600 |
| commit | 6a33221ea54ad4a496c06f5d93fb1e32c8076454 (patch) | |
| tree | bc039344427670ab5ffb06c02f7b540f663fe47c | |
| parent | 522354415ea4f4c9bfbaddee249a367b173df1af (diff) | |
| download | rust-6a33221ea54ad4a496c06f5d93fb1e32c8076454.tar.gz rust-6a33221ea54ad4a496c06f5d93fb1e32c8076454.zip | |
Improve pretty-printing of references in MIR.
| -rw-r--r-- | src/librustc/mir/repr.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs index 56cd7432a73..9a5f675ad4b 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::*; |
