diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-10-16 18:24:30 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-10-16 18:24:30 +0000 |
| commit | c423305d415cbeea5ac2460a4ba577f7d00a27cf (patch) | |
| tree | 95c000af2e8663f6c20c81757763f4088471bcb3 | |
| parent | 02424e4bc57344dc7436644f897b5500a1973242 (diff) | |
| download | rust-c423305d415cbeea5ac2460a4ba577f7d00a27cf.tar.gz rust-c423305d415cbeea5ac2460a4ba577f7d00a27cf.zip | |
Motivate renumbering and avoid underflow.
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 3982b789328..dfb5013850f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -4258,7 +4258,9 @@ impl<'test> TestCx<'test> { V0_BACK_REF_RE.replace_all(&normalized, V0_BACK_REF_PLACEHOLDER).into_owned(); } - // Normalize AllocId counter + // AllocId are numbered globally in a compilation session. This can lead to changes + // depending on the exact compilation flags and host architecture. Meanwhile, we want + // to keep them numbered, to see if the same id appears multiple times. { use std::fmt::Write; @@ -4276,8 +4278,9 @@ impl<'test> TestCx<'test> { // Complete with filler `─` to preserve the pretty-print. if let Some(tail) = caps.get(3) { ret.push_str(tail.as_str()); - let diff = caps.get(0).unwrap().as_str().len() - ret.len(); - for _ in 0..diff { + let orig_len = caps.get(0).unwrap().as_str().len(); + let ret_len = ret.len(); + for _ in orig_len..ret_len { ret.push('─'); } } |
