about summary refs log tree commit diff
path: root/compiler/rustc_errors
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-08-06 18:36:43 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-08-06 19:09:52 +0000
commit034b73ba54f8221c97f70828d7bd529d64b8fe8f (patch)
tree3cf9b86d17f21243122b597409ee7f1e2b63347a /compiler/rustc_errors
parent5e26c8d3c925f3b923328f452b6d8a8bdd0675fc (diff)
downloadrust-034b73ba54f8221c97f70828d7bd529d64b8fe8f.tar.gz
rust-034b73ba54f8221c97f70828d7bd529d64b8fe8f.zip
fix test
Diffstat (limited to 'compiler/rustc_errors')
-rw-r--r--compiler/rustc_errors/src/emitter.rs8
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