diff options
| author | Scott Schafer <schaferjscott@gmail.com> | 2025-07-03 15:47:15 -0600 |
|---|---|---|
| committer | Scott Schafer <schaferjscott@gmail.com> | 2025-08-26 15:15:17 -0600 |
| commit | 93d16c510066db062700e783a53461d45e5dbe4b (patch) | |
| tree | 448afbb982b58516cdea8d85b1976338dbd92c16 /compiler/rustc_errors/src | |
| parent | 8835ea854e9339ae83a35461c064a1b919872ca5 (diff) | |
| download | rust-93d16c510066db062700e783a53461d45e5dbe4b.tar.gz rust-93d16c510066db062700e783a53461d45e5dbe4b.zip | |
fix: Add col separator before secondary messages with no source
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 18ac03aa72f..bd3b81bca0c 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1591,6 +1591,9 @@ impl HumanEmitter { annotated_files.swap(0, pos); } + // An end column separator should be emitted when a file with with a + // source, is followed by one without a source + let mut col_sep_before_no_show_source = false; let annotated_files_len = annotated_files.len(); // Print out the annotate source lines that correspond with the error for (file_idx, annotated_file) in annotated_files.into_iter().enumerate() { @@ -1601,6 +1604,26 @@ impl HumanEmitter { &annotated_file.file, ) { if !self.short_message { + // Add an end column separator when a file without a source + // comes after one with a source + // ╭▸ $DIR/deriving-meta-unknown-trait.rs:1:10 + // │ + // LL │ #[derive(Eqr)] + // │ ━━━ + // ╰╴ (<- It prints *this* line) + // ╭▸ $SRC_DIR/core/src/cmp.rs:356:0 + // │ + // ╰╴note: similarly named derive macro `Eq` defined here + if col_sep_before_no_show_source { + let buffer_msg_line_offset = buffer.num_lines(); + self.draw_col_separator_end( + &mut buffer, + buffer_msg_line_offset, + max_line_num_len + 1, + ); + } + col_sep_before_no_show_source = false; + // We'll just print an unannotated message. for (annotation_id, line) in annotated_file.lines.iter().enumerate() { let mut annotations = line.annotations.clone(); @@ -1671,6 +1694,8 @@ impl HumanEmitter { } } continue; + } else { + col_sep_before_no_show_source = true; } // print out the span location and spacer before we print the annotated source |
