diff options
| author | Folkert de Vries <flokkievids@gmail.com> | 2025-07-23 13:26:30 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-23 13:26:30 +0000 |
| commit | 0231fa9adfdc4c03d122087a4400a8199b97a369 (patch) | |
| tree | e783ca2321426d54b49a031bc9e3ceda4f076375 /compiler/rustc_errors/src | |
| parent | 75fc5ceefb9dc46a1e0956143c98eb419ce2e3b5 (diff) | |
| parent | 8f0ffa8125f00af923098b30f390f6597b89d80d (diff) | |
| download | rust-0231fa9adfdc4c03d122087a4400a8199b97a369.tar.gz rust-0231fa9adfdc4c03d122087a4400a8199b97a369.zip | |
Merge pull request #1883 from Kobzol/pull
Rustc pull update
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 5746c28a2ab..96c7ba6ed27 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -1165,7 +1165,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { self.push_suggestion(CodeSuggestion { substitutions, msg: self.subdiagnostic_message_to_diagnostic_message(msg), - style: SuggestionStyle::ShowCode, + style: SuggestionStyle::ShowAlways, applicability, }); self @@ -1421,7 +1421,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { /// /// See `emit` and `delay_as_bug` for details. #[track_caller] - pub fn emit_unless(mut self, delay: bool) -> G::EmitResult { + pub fn emit_unless_delay(mut self, delay: bool) -> G::EmitResult { if delay { self.downgrade_to_delayed_bug(); } diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 2f398cea926..95400ac2ca3 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)?; @@ -3526,7 +3531,7 @@ pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool { // All the chars that differ in capitalization are confusable (above): let confusable = iter::zip(found.chars(), suggested.chars()) .filter(|(f, s)| f != s) - .all(|(f, s)| (ascii_confusables.contains(&f) || ascii_confusables.contains(&s))); + .all(|(f, s)| ascii_confusables.contains(&f) || ascii_confusables.contains(&s)); confusable && found.to_lowercase() == suggested.to_lowercase() // FIXME: We sometimes suggest the same thing we already have, which is a // bug, but be defensive against that here. |
