diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-08-06 18:36:43 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-08-06 19:09:52 +0000 |
| commit | 034b73ba54f8221c97f70828d7bd529d64b8fe8f (patch) | |
| tree | 3cf9b86d17f21243122b597409ee7f1e2b63347a /compiler/rustc_errors | |
| parent | 5e26c8d3c925f3b923328f452b6d8a8bdd0675fc (diff) | |
| download | rust-034b73ba54f8221c97f70828d7bd529d64b8fe8f.tar.gz rust-034b73ba54f8221c97f70828d7bd529d64b8fe8f.zip | |
fix test
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 8df3b685829..88ed3128164 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1365,6 +1365,14 @@ impl HumanEmitter { ); line += 1; } + // We add lines above, but if the last line has no explicit newline (which would + // yield an empty line), then we revert one line up to continue with the next + // styled text chunk on the same line as the last one from the prior one. Otherwise + // every `text` would appear on their own line (because even though they didn't end + // in '\n', they advanced `line` by one). + if line > 0 { + line -= 1; + } } if self.short_message { let labels = msp |
