Skip to content

Commit c423305

Browse files
committed
Motivate renumbering and avoid underflow.
1 parent 02424e4 commit c423305

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4258,7 +4258,9 @@ impl<'test> TestCx<'test> {
42584258
V0_BACK_REF_RE.replace_all(&normalized, V0_BACK_REF_PLACEHOLDER).into_owned();
42594259
}
42604260

4261-
// Normalize AllocId counter
4261+
// AllocId are numbered globally in a compilation session. This can lead to changes
4262+
// depending on the exact compilation flags and host architecture. Meanwhile, we want
4263+
// to keep them numbered, to see if the same id appears multiple times.
42624264
{
42634265
use std::fmt::Write;
42644266

@@ -4276,8 +4278,9 @@ impl<'test> TestCx<'test> {
42764278
// Complete with filler `─` to preserve the pretty-print.
42774279
if let Some(tail) = caps.get(3) {
42784280
ret.push_str(tail.as_str());
4279-
let diff = caps.get(0).unwrap().as_str().len() - ret.len();
4280-
for _ in 0..diff {
4281+
let orig_len = caps.get(0).unwrap().as_str().len();
4282+
let ret_len = ret.len();
4283+
for _ in orig_len..ret_len {
42814284
ret.push('─');
42824285
}
42834286
}

0 commit comments

Comments
 (0)