about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2016-11-12 10:38:42 +0200
committerGitHub <noreply@github.com>2016-11-12 10:38:42 +0200
commitfb922772911704f1b30d046cef3f683eebf14dfd (patch)
tree66ad3cc14ba8390c2a55d87f7d283e775041f8e6 /src
parent220ff76e0b1b97c7deef11e320d0cb3b3032c73e (diff)
parent4ce4900218bd8378e08cd7d1d4c57e370c0949a0 (diff)
downloadrust-fb922772911704f1b30d046cef3f683eebf14dfd.tar.gz
rust-fb922772911704f1b30d046cef3f683eebf14dfd.zip
Rollup merge of #37692 - nbp:debug-lvalue-subslice, r=eddyb
Balance the debug output of Lvalue Subslice

The current debug output for Lvalue Subslice is not balanced and does not respect the comment[1], which indicates that we use `slice[from:-to] in Python terms.`.  In python terms slices which have a start but no end are written as `a[start:]`, so following the comment, I fixed the output accordingly.

Grep-ing over the sources, I did not found any test cases checking this subslice debug output.
Note, I have not yet tested this change yet, as I am still waiting for the end of LLVM compilation.

[1] https://manishearth.github.io/rust-internals-docs/rustc/mir/enum.ProjectionElem.html
Diffstat (limited to 'src')
-rw-r--r--src/librustc/mir/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 9d82006ac9f..b3cec6ec8ff 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -923,7 +923,7 @@ impl<'tcx> Debug for Lvalue<'tcx> {
                     ProjectionElem::ConstantIndex { offset, min_length, from_end: true } =>
                         write!(fmt, "{:?}[-{:?} of {:?}]", data.base, offset, min_length),
                     ProjectionElem::Subslice { from, to } if to == 0 =>
-                        write!(fmt, "{:?}[{:?}:", data.base, from),
+                        write!(fmt, "{:?}[{:?}:]", data.base, from),
                     ProjectionElem::Subslice { from, to } if from == 0 =>
                         write!(fmt, "{:?}[:-{:?}]", data.base, to),
                     ProjectionElem::Subslice { from, to } =>