From 034b73ba54f8221c97f70828d7bd529d64b8fe8f Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Tue, 6 Aug 2024 18:36:43 +0000 Subject: fix test --- compiler/rustc_errors/src/emitter.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/rustc_errors/src') 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 -- cgit 1.4.1-3-g733a5