Skip to content

Commit d67bf60

Browse files
committed
chore: Improve how the other suggestions message gets rendered
1 parent 61b172a commit d67bf60

12 files changed

+25
-20
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,17 +2446,22 @@ impl HumanEmitter {
24462446
| DisplaySuggestion::Underline => row_num - 1,
24472447
DisplaySuggestion::None => row_num,
24482448
};
2449-
self.draw_col_separator_end(&mut buffer, row, max_line_num_len + 1);
2449+
if other_suggestions > 0 {
2450+
self.draw_col_separator_no_space(&mut buffer, row, max_line_num_len + 1);
2451+
} else {
2452+
self.draw_col_separator_end(&mut buffer, row, max_line_num_len + 1);
2453+
}
24502454
row_num = row + 1;
24512455
}
24522456
}
24532457
if other_suggestions > 0 {
2458+
self.draw_note_separator(&mut buffer, row_num, max_line_num_len + 1, false);
24542459
let msg = format!(
24552460
"and {} other candidate{}",
24562461
other_suggestions,
24572462
pluralize!(other_suggestions)
24582463
);
2459-
buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle);
2464+
buffer.append(row_num, &msg, Style::NoStyle);
24602465
}
24612466

24622467
emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message)?;

tests/ui/associated-types/associated-types-in-ambiguous-context.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ LL + type X = <CString as Deref>::Target;
4242
LL - type X = std::ops::Deref::Target;
4343
LL + type X = <IoSlice<'_> as Deref>::Target;
4444
|
45-
and N other candidates
45+
= and N other candidates
4646

4747
error[E0223]: ambiguous associated type
4848
--> $DIR/associated-types-in-ambiguous-context.rs:13:23

tests/ui/const-generics/issues/issue-82956.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL + use std::collections::btree_map::IntoIter;
1414
|
1515
LL + use std::collections::btree_set::IntoIter;
1616
|
17-
and 9 other candidates
17+
= and 9 other candidates
1818

1919
error: aborting due to 1 previous error
2020

tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LL + fn setup() -> Determine { Set }
1818
LL - fn setup() -> Set { Set }
1919
LL + fn setup() -> PutDown { Set }
2020
|
21-
and 3 other candidates
21+
= and 3 other candidates
2222

2323
error[E0425]: cannot find value `Set` in this scope
2424
--> $DIR/issue-56028-there-is-an-enum-variant.rs:9:21
@@ -36,7 +36,7 @@ LL + use Determine::Set;
3636
|
3737
LL + use PutDown::Set;
3838
|
39-
and 3 other candidates
39+
= and 3 other candidates
4040

4141
error: aborting due to 2 previous errors
4242

tests/ui/impl-trait/call_method_without_import.no_import.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ LL + use std::fmt::Display;
3030
|
3131
LL + use std::fmt::LowerExp;
3232
|
33-
and 5 other candidates
33+
= and 5 other candidates
3434

3535
error: aborting due to 2 previous errors
3636

tests/ui/imports/issue-56125.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LL + use ::issue_56125::issue_56125;
1818
LL - use empty::issue_56125;
1919
LL + use ::issue_56125::last_segment::issue_56125;
2020
|
21-
and 1 other candidate
21+
= and 1 other candidate
2222

2323
error[E0659]: `issue_56125` is ambiguous
2424
--> $DIR/issue-56125.rs:6:9

tests/ui/lint/use_suggestion_json.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ mod foo {
419419
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
420420
\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ use std::collections::hash_map::Iter;\u001b[0m
421421
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
422-
\u001b[0m and 9 other candidates\u001b[0m
422+
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0mand 9 other candidates\u001b[0m
423423

424424
"
425425
}

tests/ui/privacy/suggest-box-new.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ LL - x: (),
6363
LL - })),
6464
LL + wtf: Some(Box::new_in(_, _)),
6565
|
66-
and 12 other candidates
66+
= and 12 other candidates
6767
help: consider using the `Default` trait
6868
|
6969
LL - wtf: Some(Box(U {
@@ -118,7 +118,7 @@ LL + let _ = Box::new_zeroed();
118118
LL - let _ = Box {};
119119
LL + let _ = Box::new_in(_, _);
120120
|
121-
and 12 other candidates
121+
= and 12 other candidates
122122
help: consider using the `Default` trait
123123
|
124124
LL - let _ = Box {};

tests/ui/rust-2018/issue-52202-use-suggestions.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL + use std::collections::hash_map::Drain;
1414
|
1515
LL + use std::collections::hash_set::Drain;
1616
|
17-
and 3 other candidates
17+
= and 3 other candidates
1818

1919
error: aborting due to 1 previous error
2020

tests/ui/suggestions/multi-suggestion.ascii.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ LL - x: (),
6363
LL - })),
6464
LL + wtf: Some(Box::new_in(_, _)),
6565
|
66-
and 12 other candidates
66+
= and 12 other candidates
6767
help: consider using the `Default` trait
6868
|
6969
LL - wtf: Some(Box(U {
@@ -118,7 +118,7 @@ LL + let _ = Box::new_zeroed();
118118
LL - let _ = Box {};
119119
LL + let _ = Box::new_in(_, _);
120120
|
121-
and 12 other candidates
121+
= and 12 other candidates
122122
help: consider using the `Default` trait
123123
|
124124
LL - let _ = Box {};

0 commit comments

Comments
 (0)