summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorScott Schafer <schaferjscott@gmail.com>2025-07-22 07:55:31 -0600
committerScott Schafer <schaferjscott@gmail.com>2025-07-31 00:25:09 -0600
commit761c4e308ca17c1d6d893c7d512f579728b1552f (patch)
tree8760f4fd29338df3408eb98277e4c85650511f8e /compiler
parent4643d9ad6d09631b663c4f6879103b4d399b1cd8 (diff)
downloadrust-761c4e308ca17c1d6d893c7d512f579728b1552f.tar.gz
rust-761c4e308ca17c1d6d893c7d512f579728b1552f.zip
fix: Only "close the window" when its the last annotated file
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_errors/src/emitter.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 46a4a186824..3fe525df94f 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -1597,8 +1597,9 @@ impl HumanEmitter {
             annotated_files.swap(0, pos);
         }
 
+        let annotated_files_len = annotated_files.len();
         // Print out the annotate source lines that correspond with the error
-        for annotated_file in annotated_files {
+        for (file_idx, annotated_file) in annotated_files.into_iter().enumerate() {
             // we can't annotate anything if the source is unavailable.
             if !should_show_source_code(
                 &self.ignored_directories_in_source_blocks,
@@ -1855,7 +1856,9 @@ impl HumanEmitter {
                         width_offset,
                         code_offset,
                         margin,
-                        !is_cont && line_idx + 1 == annotated_file.lines.len(),
+                        !is_cont
+                            && file_idx + 1 == annotated_files_len
+                            && line_idx + 1 == annotated_file.lines.len(),
                     );
 
                     let mut to_add = FxHashMap::default();