about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-02-02 19:13:36 +0000
committerbors <bors@rust-lang.org>2025-02-02 19:13:36 +0000
commit4a43094662727040d8522163f295b19d1aed0e49 (patch)
tree5dbc3cb92d5261afdc95f151fc328c7a4dd99a61 /compiler/rustc_errors/src
parent6c0de7f8fc6221a6e4d2b3232bbff5f3195f9b49 (diff)
parent961bf7ffa68bbba40b24402d2143cb16257d404c (diff)
downloadrust-4a43094662727040d8522163f295b19d1aed0e49.tar.gz
rust-4a43094662727040d8522163f295b19d1aed0e49.zip
Auto merge of #136448 - matthiaskrgr:rollup-pdim5di, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #134272 (Remove rustc_encodable_decodable feature)
 - #136283 (Update encode_utf16 to mention it is native endian)
 - #136394 (Clean up MonoItem::instantiation_mode)
 - #136402 (diagnostics: fix borrowck suggestions for if/while let conditionals)
 - #136415 (Highlight clarifying information in "expected/found" error)
 - #136422 (Convert two `rustc_middle::lint` functions to `Span` methods.)
 - #136434 (rustc_allowed_through_unstable_modules: require deprecation message)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index b96df814852..29a74ed3f4e 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -644,7 +644,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
         found_label: &dyn fmt::Display,
         found: DiagStyledString,
     ) -> &mut Self {
-        self.note_expected_found_extra(expected_label, expected, found_label, found, &"", &"")
+        self.note_expected_found_extra(
+            expected_label,
+            expected,
+            found_label,
+            found,
+            DiagStyledString::normal(""),
+            DiagStyledString::normal(""),
+        )
     }
 
     #[rustc_lint_diagnostics]
@@ -654,8 +661,8 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
         expected: DiagStyledString,
         found_label: &dyn fmt::Display,
         found: DiagStyledString,
-        expected_extra: &dyn fmt::Display,
-        found_extra: &dyn fmt::Display,
+        expected_extra: DiagStyledString,
+        found_extra: DiagStyledString,
     ) -> &mut Self {
         let expected_label = expected_label.to_string();
         let expected_label = if expected_label.is_empty() {
@@ -680,10 +687,13 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
             expected_label
         ))];
         msg.extend(expected.0);
-        msg.push(StringPart::normal(format!("`{expected_extra}\n")));
+        msg.push(StringPart::normal(format!("`")));
+        msg.extend(expected_extra.0);
+        msg.push(StringPart::normal(format!("\n")));
         msg.push(StringPart::normal(format!("{}{} `", " ".repeat(found_padding), found_label)));
         msg.extend(found.0);
-        msg.push(StringPart::normal(format!("`{found_extra}")));
+        msg.push(StringPart::normal(format!("`")));
+        msg.extend(found_extra.0);
 
         // For now, just attach these as notes.
         self.highlighted_note(msg);