Skip to content

Commit 761c4e3

Browse files
committed
fix: Only "close the window" when its the last annotated file
1 parent 4643d9a commit 761c4e3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,8 +1597,9 @@ impl HumanEmitter {
15971597
annotated_files.swap(0, pos);
15981598
}
15991599

1600+
let annotated_files_len = annotated_files.len();
16001601
// Print out the annotate source lines that correspond with the error
1601-
for annotated_file in annotated_files {
1602+
for (file_idx, annotated_file) in annotated_files.into_iter().enumerate() {
16021603
// we can't annotate anything if the source is unavailable.
16031604
if !should_show_source_code(
16041605
&self.ignored_directories_in_source_blocks,
@@ -1855,7 +1856,9 @@ impl HumanEmitter {
18551856
width_offset,
18561857
code_offset,
18571858
margin,
1858-
!is_cont && line_idx + 1 == annotated_file.lines.len(),
1859+
!is_cont
1860+
&& file_idx + 1 == annotated_files_len
1861+
&& line_idx + 1 == annotated_file.lines.len(),
18591862
);
18601863

18611864
let mut to_add = FxHashMap::default();

tests/ui/error-emitter/close_window.unicode.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0624]: method `method` is private
22
╭▸ $DIR/close_window.rs:9:7
33
44
LL │ s.method();
5-
╰╴ ━━━━━━ private method
5+
━━━━━━ private method
66
77
⸬ $DIR/auxiliary/close_window.rs:3:5
88

0 commit comments

Comments
 (0)