Skip to content

Commit fb92277

Browse files
authored
Rollup merge of rust-lang#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
2 parents 220ff76 + 4ce4900 commit fb92277

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ impl<'tcx> Debug for Lvalue<'tcx> {
923923
ProjectionElem::ConstantIndex { offset, min_length, from_end: true } =>
924924
write!(fmt, "{:?}[-{:?} of {:?}]", data.base, offset, min_length),
925925
ProjectionElem::Subslice { from, to } if to == 0 =>
926-
write!(fmt, "{:?}[{:?}:", data.base, from),
926+
write!(fmt, "{:?}[{:?}:]", data.base, from),
927927
ProjectionElem::Subslice { from, to } if from == 0 =>
928928
write!(fmt, "{:?}[:-{:?}]", data.base, to),
929929
ProjectionElem::Subslice { from, to } =>

0 commit comments

Comments
 (0)