diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-12-11 21:48:33 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-12-12 23:36:27 +0000 |
| commit | 49a22a4245bd6dfd3646a6658e0f90a2ab0657ad (patch) | |
| tree | 1036e015884bebbf0a5c139fe7adedb9f83de7e1 /compiler/rustc_errors/src | |
| parent | 65a54a7f277b30ebeeacb5b303804fa8ffb5c922 (diff) | |
| download | rust-49a22a4245bd6dfd3646a6658e0f90a2ab0657ad.tar.gz rust-49a22a4245bd6dfd3646a6658e0f90a2ab0657ad.zip | |
Filter empty lines, comments and delimiters from previous to last multiline span rendering
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 9595790d574..04b18b92a0c 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -3064,7 +3064,11 @@ impl FileWithAnnotatedLines { add_annotation_to_file(&mut output, Lrc::clone(&file), line, ann.as_line()); } let line_end = ann.line_end - 1; - if middle < line_end { + let end_is_empty = file.get_line(line_end - 1).map_or(false, |s| { + let s = s.trim(); + ["", "{", "}", "(", ")", "[", "]"].contains(&s) || s.starts_with("//") + }); + if middle < line_end && !end_is_empty { add_annotation_to_file(&mut output, Lrc::clone(&file), line_end, ann.as_line()); } } else { |
