File tree 2 files changed +48
-2
lines changed
2 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -445,8 +445,11 @@ impl EmitterWriter {
445
445
&& next. has_label ( ) ) // multiline start/end, move it to a new line
446
446
|| ( annotation. has_label ( ) // so as not to overlap the orizontal lines.
447
447
&& next. takes_space ( ) )
448
- || ( annotation. takes_space ( )
449
- && next. takes_space ( ) )
448
+ || ( annotation. takes_space ( ) && next. takes_space ( ) )
449
+ || ( overlaps ( next, annotation, l)
450
+ && next. end_col <= annotation. end_col
451
+ && next. has_label ( )
452
+ && p == 0 ) // Avoid #42595.
450
453
{
451
454
// This annotation needs a new line in the output.
452
455
p += 1 ;
Original file line number Diff line number Diff line change @@ -735,6 +735,49 @@ error: foo
735
735
"# ) ;
736
736
}
737
737
738
+ #[ test]
739
+ fn multiple_labels_secondary_without_message_3 ( ) {
740
+ test_harness ( r#"
741
+ fn foo() {
742
+ a bc d
743
+ }
744
+ "# ,
745
+ vec ! [
746
+ SpanLabel {
747
+ start: Position {
748
+ string: "a" ,
749
+ count: 1 ,
750
+ } ,
751
+ end: Position {
752
+ string: "b" ,
753
+ count: 1 ,
754
+ } ,
755
+ label: "`a` is a good letter" ,
756
+ } ,
757
+ SpanLabel {
758
+ start: Position {
759
+ string: "c" ,
760
+ count: 1 ,
761
+ } ,
762
+ end: Position {
763
+ string: "d" ,
764
+ count: 1 ,
765
+ } ,
766
+ label: "" ,
767
+ } ,
768
+ ] ,
769
+ r#"
770
+ error: foo
771
+ --> test.rs:3:3
772
+ |
773
+ 3 | a bc d
774
+ | ^^^^----
775
+ | |
776
+ | `a` is a good letter
777
+
778
+ "# ) ;
779
+ }
780
+
738
781
#[ test]
739
782
fn multiple_labels_without_message ( ) {
740
783
test_harness ( r#"
You can’t perform that action at this time.
0 commit comments