Skip to content

Commit 6611118

Browse files
committed
fix: Only show one origin for multiline annotations with no source
1 parent ea7fded commit 6611118

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ impl AnnotateSnippetEmitter {
633633
report.push(std::mem::replace(&mut group, Group::with_level(level.clone())));
634634
}
635635

636-
if !line_tracker.contains(&lo.line) {
636+
if !line_tracker.contains(&lo.line) && (i == 0 || hi.line <= lo.line) {
637637
line_tracker.push(lo.line);
638638
// ╭▸ $SRC_DIR/core/src/option.rs:594:0 (<- It adds *this*)
639639
// ⸬ $SRC_DIR/core/src/option.rs:602:4

tests/ui/typeck/typeck_type_placeholder_item.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ note: method `filter` is not const because trait `Iterator` is not const
688688
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
689689
|
690690
= note: this trait is not const
691-
::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
692691
::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
693692
|
694693
= note: this method is not const
@@ -704,7 +703,6 @@ note: method `map` is not const because trait `Iterator` is not const
704703
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
705704
|
706705
= note: this trait is not const
707-
::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
708706
::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
709707
|
710708
= note: this method is not const

0 commit comments

Comments
 (0)