about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-05 02:21:13 +0000
committerbors <bors@rust-lang.org>2022-04-05 02:21:13 +0000
commita22cf2af0510b3ec4cbb19c3de11d3d8291349d9 (patch)
treef25421eaab99b5865f839a5315b36a834c632c74 /compiler/rustc_errors/src
parent60e50fc1cfe0bb693a5f4f93eb83ef70854531e3 (diff)
parentb3c3eda7284b33e772f9ffe4e2ac1ebd18241601 (diff)
downloadrust-a22cf2af0510b3ec4cbb19c3de11d3d8291349d9.tar.gz
rust-a22cf2af0510b3ec4cbb19c3de11d3d8291349d9.zip
Auto merge of #95662 - Dylan-DPC:rollup-fo7jsr6, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #91873 (Mention implementers of unsatisfied trait)
 - #95588 (explicitly distinguish pointer::addr and pointer::expose_addr)
 - #95603 (Fix late-bound ICE in `dyn` return type suggestion)
 - #95620 (interpret: remove MemoryExtra in favor of giving access to the Machine)
 - #95630 (Update `NonNull` pointer provenance methods' documentation)
 - #95631 (Refactor: remove unnecessary nested blocks)
 - #95642 (`CandidateSource::XCandidate` -> `CandidateSource::X`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 00ecbbbb93b..32c52a6a8a6 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -378,6 +378,12 @@ impl Diagnostic {
         self
     }
 
+    /// Add a help message attached to this diagnostic with a customizable highlighted message.
+    pub fn highlighted_help(&mut self, msg: Vec<(String, Style)>) -> &mut Self {
+        self.sub_with_highlights(Level::Help, msg, MultiSpan::new(), None);
+        self
+    }
+
     /// Prints the span with some help above it.
     /// This is like [`Diagnostic::help()`], but it gets its own span.
     pub fn span_help<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self {