diff options
| author | bors <bors@rust-lang.org> | 2022-12-29 19:40:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-29 19:40:06 +0000 |
| commit | ad8ae0504c54bc2bd8306abfcfe8546c1bb16a49 (patch) | |
| tree | f86627123dc427614f56aca1c7cfd2c221bb7b34 /compiler/rustc_errors/src | |
| parent | e37ff7e71a087fcd799d3e59bcd63e3732d351d3 (diff) | |
| parent | 65fb70304a758db5696f20f077bdb1c2620fc31c (diff) | |
| download | rust-ad8ae0504c54bc2bd8306abfcfe8546c1bb16a49.tar.gz rust-ad8ae0504c54bc2bd8306abfcfe8546c1bb16a49.zip | |
Auto merge of #106266 - matthiaskrgr:rollup-cxrdbzy, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #104531 (Provide a better error and a suggestion for `Fn` traits with lifetime params) - #105899 (`./x doc library --open` opens `std`) - #106190 (Account for multiple multiline spans with empty padding) - #106202 (Trim more paths in obligation types) - #106234 (rustdoc: simplify settings, help, and copy button CSS by not reusing) - #106236 (docs/test: add docs and a UI test for `E0514` and `E0519`) - #106259 (Update Clippy) - #106260 (Fix index out of bounds issues in rustdoc) - #106263 (Formatter should not try to format non-Rust files) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index e2a0e436fd5..0ca200abe19 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -845,7 +845,10 @@ impl EmitterWriter { // 3 | | // 4 | | } // | |_^ test - if let [ann] = &line.annotations[..] { + let mut buffer_ops = vec![]; + let mut annotations = vec![]; + let mut short_start = true; + for ann in &line.annotations { if let AnnotationType::MultilineStart(depth) = ann.annotation_type { if source_string.chars().take(ann.start_col).all(|c| c.is_whitespace()) { let style = if ann.is_primary { @@ -853,10 +856,23 @@ impl EmitterWriter { } else { Style::UnderlineSecondary }; - buffer.putc(line_offset, width_offset + depth - 1, '/', style); - return vec![(depth, style)]; + annotations.push((depth, style)); + buffer_ops.push((line_offset, width_offset + depth - 1, '/', style)); + } else { + short_start = false; + break; } + } else if let AnnotationType::MultilineLine(_) = ann.annotation_type { + } else { + short_start = false; + break; + } + } + if short_start { + for (y, x, c, s) in buffer_ops { + buffer.putc(y, x, c, s); } + return annotations; } // We want to display like this: |
