diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-07-01 00:35:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-01 00:35:07 +0200 |
| commit | 00efc94a6c206ca294cb5eae988c49f5c12733a4 (patch) | |
| tree | bf76fffe21d7a678635b37170aa76c3fd16f37c4 | |
| parent | e1165300e82bd43c7af794ffc8c3ffcf963e3eb1 (diff) | |
| parent | 115cfda6c2de05cb48b11cf01146b4c612899810 (diff) | |
| download | rust-00efc94a6c206ca294cb5eae988c49f5c12733a4.tar.gz rust-00efc94a6c206ca294cb5eae988c49f5c12733a4.zip | |
Rollup merge of #113189 - Zalathar:trim-end, r=ozkanonur
compiletest: Only trim the end of process output
As of #94196, compiletest automatically trims process stderr/stdout output before printing it, to make failure info more compact.
This causes the first line of `run-coverage` output to be displayed incorrectly, because it uses leading whitespace to align line numbers.
Trimming only the end of the output string should still have the intended effect (e.g. removing trailing newlines), without causing problems for output that deliberately uses leading whitespace on the first line.
## Before
```
--- stdout -------------------------------
1| 1|fn main() { //
2| 1| let num = 9;
3| 1| while num >= 10 {
4| 0| }
5| 1|}
------------------------------------------
stderr: none
```
## After
```
--- stdout -------------------------------
1| 1|fn main() { //
2| 1| let num = 9;
3| 1| while num >= 10 {
4| 0| }
5| 1|}
------------------------------------------
stderr: none
```
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 8bdc2d65d27..fddfbac78d5 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -4374,7 +4374,7 @@ impl ProcRes { pub fn print_info(&self) { fn render(name: &str, contents: &str) -> String { let contents = json::extract_rendered(contents); - let contents = contents.trim(); + let contents = contents.trim_end(); if contents.is_empty() { format!("{name}: none") } else { |
