Maintain highlighting in note and help even when they have a span
This commit is contained in:
@@ -741,6 +741,16 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
|
||||
self
|
||||
}
|
||||
|
||||
#[rustc_lint_diagnostics]
|
||||
pub fn highlighted_span_note(
|
||||
&mut self,
|
||||
span: impl Into<MultiSpan>,
|
||||
msg: Vec<StringPart>,
|
||||
) -> &mut Self {
|
||||
self.sub_with_highlights(Level::Note, msg, span.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// This is like [`Diag::note()`], but it's only printed once.
|
||||
#[rustc_lint_diagnostics]
|
||||
pub fn note_once(&mut self, msg: impl Into<SubdiagMessage>) -> &mut Self {
|
||||
@@ -815,6 +825,17 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Add a help message attached to this diagnostic with a customizable highlighted message.
|
||||
#[rustc_lint_diagnostics]
|
||||
pub fn highlighted_span_help(
|
||||
&mut self,
|
||||
span: impl Into<MultiSpan>,
|
||||
msg: Vec<StringPart>,
|
||||
) -> &mut Self {
|
||||
self.sub_with_highlights(Level::Help, msg, span.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// Prints the span with some help above it.
|
||||
/// This is like [`Diag::help()`], but it gets its own span.
|
||||
#[rustc_lint_diagnostics]
|
||||
|
||||
Reference in New Issue
Block a user