about summary refs log tree commit diff
diff options
context:
space:
mode:
authorScott Schafer <schaferjscott@gmail.com>2025-07-01 19:09:45 -0600
committerScott Schafer <schaferjscott@gmail.com>2025-07-10 08:00:20 -0600
commitd67bf6095a9a3f278a223a20b316c235360c1c90 (patch)
tree801e27abcc1c5d3ffaf928abe42aaa990fbac9c3
parent61b172a34c94108d013a2d352901b4a5a06ad9ee (diff)
downloadrust-d67bf6095a9a3f278a223a20b316c235360c1c90.tar.gz
rust-d67bf6095a9a3f278a223a20b316c235360c1c90.zip
chore: Improve how the other suggestions message gets rendered
-rw-r--r--compiler/rustc_errors/src/emitter.rs9
-rw-r--r--tests/ui/associated-types/associated-types-in-ambiguous-context.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-82956.stderr2
-rw-r--r--tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr4
-rw-r--r--tests/ui/impl-trait/call_method_without_import.no_import.stderr2
-rw-r--r--tests/ui/imports/issue-56125.stderr2
-rw-r--r--tests/ui/lint/use_suggestion_json.stderr2
-rw-r--r--tests/ui/privacy/suggest-box-new.stderr4
-rw-r--r--tests/ui/rust-2018/issue-52202-use-suggestions.stderr2
-rw-r--r--tests/ui/suggestions/multi-suggestion.ascii.stderr4
-rw-r--r--tests/ui/suggestions/multi-suggestion.unicode.stderr8
-rw-r--r--tests/ui/suggestions/too-many-field-suggestions.stderr4
12 files changed, 25 insertions, 20 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 2f398cea926..1b581f93736 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -2446,17 +2446,22 @@ impl HumanEmitter {
                     | DisplaySuggestion::Underline => row_num - 1,
                     DisplaySuggestion::None => row_num,
                 };
-                self.draw_col_separator_end(&mut buffer, row, max_line_num_len + 1);
+                if other_suggestions > 0 {
+                    self.draw_col_separator_no_space(&mut buffer, row, max_line_num_len + 1);
+                } else {
+                    self.draw_col_separator_end(&mut buffer, row, max_line_num_len + 1);
+                }
                 row_num = row + 1;
             }
         }
         if other_suggestions > 0 {
+            self.draw_note_separator(&mut buffer, row_num, max_line_num_len + 1, false);
             let msg = format!(
                 "and {} other candidate{}",
                 other_suggestions,
                 pluralize!(other_suggestions)
             );
-            buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle);
+            buffer.append(row_num, &msg, Style::NoStyle);
         }
 
         emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message)?;
diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
index a7647cf26aa..71a1360cb5a 100644
--- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
+++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
@@ -42,7 +42,7 @@ LL + type X = <CString as Deref>::Target;
 LL - type X = std::ops::Deref::Target;
 LL + type X = <IoSlice<'_> as Deref>::Target;
    |
-     and N other candidates
+   = and N other candidates
 
 error[E0223]: ambiguous associated type
   --> $DIR/associated-types-in-ambiguous-context.rs:13:23
diff --git a/tests/ui/const-generics/issues/issue-82956.stderr b/tests/ui/const-generics/issues/issue-82956.stderr
index 5e380eea81c..fd93e5122a5 100644
--- a/tests/ui/const-generics/issues/issue-82956.stderr
+++ b/tests/ui/const-generics/issues/issue-82956.stderr
@@ -14,7 +14,7 @@ LL + use std::collections::btree_map::IntoIter;
    |
 LL + use std::collections::btree_set::IntoIter;
    |
-     and 9 other candidates
+   = and 9 other candidates
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
index 927f9e842e6..12965800a02 100644
--- a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
+++ b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
@@ -18,7 +18,7 @@ LL + fn setup() -> Determine { Set }
 LL - fn setup() -> Set { Set }
 LL + fn setup() -> PutDown { Set }
    |
-     and 3 other candidates
+   = and 3 other candidates
 
 error[E0425]: cannot find value `Set` in this scope
   --> $DIR/issue-56028-there-is-an-enum-variant.rs:9:21
@@ -36,7 +36,7 @@ LL + use Determine::Set;
    |
 LL + use PutDown::Set;
    |
-     and 3 other candidates
+   = and 3 other candidates
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/impl-trait/call_method_without_import.no_import.stderr b/tests/ui/impl-trait/call_method_without_import.no_import.stderr
index 72982b695bb..e59409ea27e 100644
--- a/tests/ui/impl-trait/call_method_without_import.no_import.stderr
+++ b/tests/ui/impl-trait/call_method_without_import.no_import.stderr
@@ -30,7 +30,7 @@ LL + use std::fmt::Display;
    |
 LL + use std::fmt::LowerExp;
    |
-     and 5 other candidates
+   = and 5 other candidates
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/imports/issue-56125.stderr b/tests/ui/imports/issue-56125.stderr
index 81336d51df4..371130facf9 100644
--- a/tests/ui/imports/issue-56125.stderr
+++ b/tests/ui/imports/issue-56125.stderr
@@ -18,7 +18,7 @@ LL +     use ::issue_56125::issue_56125;
 LL -     use empty::issue_56125;
 LL +     use ::issue_56125::last_segment::issue_56125;
    |
-     and 1 other candidate
+   = and 1 other candidate
 
 error[E0659]: `issue_56125` is ambiguous
   --> $DIR/issue-56125.rs:6:9
diff --git a/tests/ui/lint/use_suggestion_json.stderr b/tests/ui/lint/use_suggestion_json.stderr
index 0d4304e2e2e..558c2260fce 100644
--- a/tests/ui/lint/use_suggestion_json.stderr
+++ b/tests/ui/lint/use_suggestion_json.stderr
@@ -419,7 +419,7 @@ mod foo {
 \u001b[0m   \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
 \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
 \u001b[0m   \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
-\u001b[0m     and 9 other candidates\u001b[0m
+\u001b[0m   \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0mand 9 other candidates\u001b[0m
 
 "
 }
diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr
index b651348de29..6c47b52c9de 100644
--- a/tests/ui/privacy/suggest-box-new.stderr
+++ b/tests/ui/privacy/suggest-box-new.stderr
@@ -63,7 +63,7 @@ LL -             x: (),
 LL -         })),
 LL +         wtf: Some(Box::new_in(_, _)),
    |
-     and 12 other candidates
+   = and 12 other candidates
 help: consider using the `Default` trait
    |
 LL -         wtf: Some(Box(U {
@@ -118,7 +118,7 @@ LL +     let _ = Box::new_zeroed();
 LL -     let _ = Box {};
 LL +     let _ = Box::new_in(_, _);
    |
-     and 12 other candidates
+   = and 12 other candidates
 help: consider using the `Default` trait
    |
 LL -     let _ = Box {};
diff --git a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr
index ee1a336ea98..0eb1d46637b 100644
--- a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr
+++ b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr
@@ -14,7 +14,7 @@ LL + use std::collections::hash_map::Drain;
    |
 LL + use std::collections::hash_set::Drain;
    |
-     and 3 other candidates
+   = and 3 other candidates
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/suggestions/multi-suggestion.ascii.stderr b/tests/ui/suggestions/multi-suggestion.ascii.stderr
index b6c7b9ed6df..f2a146fbd52 100644
--- a/tests/ui/suggestions/multi-suggestion.ascii.stderr
+++ b/tests/ui/suggestions/multi-suggestion.ascii.stderr
@@ -63,7 +63,7 @@ LL -             x: (),
 LL -         })),
 LL +         wtf: Some(Box::new_in(_, _)),
    |
-     and 12 other candidates
+   = and 12 other candidates
 help: consider using the `Default` trait
    |
 LL -         wtf: Some(Box(U {
@@ -118,7 +118,7 @@ LL +     let _ = Box::new_zeroed();
 LL -     let _ = Box {};
 LL +     let _ = Box::new_in(_, _);
    |
-     and 12 other candidates
+   = and 12 other candidates
 help: consider using the `Default` trait
    |
 LL -     let _ = Box {};
diff --git a/tests/ui/suggestions/multi-suggestion.unicode.stderr b/tests/ui/suggestions/multi-suggestion.unicode.stderr
index e0933606de0..69df481579b 100644
--- a/tests/ui/suggestions/multi-suggestion.unicode.stderr
+++ b/tests/ui/suggestions/multi-suggestion.unicode.stderr
@@ -62,8 +62,8 @@ LL -             wtf: None,
 LL -             x: (),
 LL -         })),
 LL +         wtf: Some(Box::new_in(_, _)),
-   ╰╴
-     and 12 other candidates
+   │
+   ╰ and 12 other candidates
 help: consider using the `Default` trait
    ╭╴
 LL -         wtf: Some(Box(U {
@@ -117,8 +117,8 @@ LL +     let _ = Box::new_zeroed();
    ├╴
 LL -     let _ = Box {};
 LL +     let _ = Box::new_in(_, _);
-   ╰╴
-     and 12 other candidates
+   │
+   ╰ and 12 other candidates
 help: consider using the `Default` trait
    ╭╴
 LL -     let _ = Box {};
diff --git a/tests/ui/suggestions/too-many-field-suggestions.stderr b/tests/ui/suggestions/too-many-field-suggestions.stderr
index ac5c8cb60cc..0cb0c8bec07 100644
--- a/tests/ui/suggestions/too-many-field-suggestions.stderr
+++ b/tests/ui/suggestions/too-many-field-suggestions.stderr
@@ -17,7 +17,7 @@ LL |     t.a2.bar();
    |       +++
 LL |     t.a3.bar();
    |       +++
-     and 6 other candidates
+   = and 6 other candidates
 
 error[E0609]: no field `field` on type `Thing`
   --> $DIR/too-many-field-suggestions.rs:26:7
@@ -35,7 +35,7 @@ LL |     t.a2.field;
    |       +++
 LL |     t.a3.field;
    |       +++
-     and 6 other candidates
+   = and 6 other candidates
 
 error: aborting due to 2 previous errors