Remove render_span
args from Diagnostic::{sub,sub_with_highlight}
.
They're always `None`.
This commit is contained in:
parent
824667f753
commit
125337bd68
2 changed files with 15 additions and 27 deletions
|
@ -425,7 +425,7 @@ impl Diagnostic {
|
||||||
/// Add a note attached to this diagnostic.
|
/// Add a note attached to this diagnostic.
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
pub fn note(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
pub fn note(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
||||||
self.sub(Level::Note, msg, MultiSpan::new(), None);
|
self.sub(Level::Note, msg, MultiSpan::new());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,14 +433,14 @@ impl Diagnostic {
|
||||||
&mut self,
|
&mut self,
|
||||||
msg: Vec<(M, Style)>,
|
msg: Vec<(M, Style)>,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.sub_with_highlights(Level::Note, msg, MultiSpan::new(), None);
|
self.sub_with_highlights(Level::Note, msg, MultiSpan::new());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prints the span with a note above it.
|
/// Prints the span with a note above it.
|
||||||
/// This is like [`Diagnostic::note()`], but it gets its own span.
|
/// This is like [`Diagnostic::note()`], but it gets its own span.
|
||||||
pub fn note_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
pub fn note_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
||||||
self.sub(Level::OnceNote, msg, MultiSpan::new(), None);
|
self.sub(Level::OnceNote, msg, MultiSpan::new());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ impl Diagnostic {
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: impl Into<SubdiagnosticMessage>,
|
msg: impl Into<SubdiagnosticMessage>,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.sub(Level::Note, msg, sp.into(), None);
|
self.sub(Level::Note, msg, sp.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,14 +463,14 @@ impl Diagnostic {
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: impl Into<SubdiagnosticMessage>,
|
msg: impl Into<SubdiagnosticMessage>,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.sub(Level::OnceNote, msg, sp.into(), None);
|
self.sub(Level::OnceNote, msg, sp.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a warning attached to this diagnostic.
|
/// Add a warning attached to this diagnostic.
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
pub fn warn(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
pub fn warn(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
||||||
self.sub(Level::Warning(None), msg, MultiSpan::new(), None);
|
self.sub(Level::Warning(None), msg, MultiSpan::new());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,27 +482,27 @@ impl Diagnostic {
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: impl Into<SubdiagnosticMessage>,
|
msg: impl Into<SubdiagnosticMessage>,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.sub(Level::Warning(None), msg, sp.into(), None);
|
self.sub(Level::Warning(None), msg, sp.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a help message attached to this diagnostic.
|
/// Add a help message attached to this diagnostic.
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
pub fn help(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
pub fn help(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
||||||
self.sub(Level::Help, msg, MultiSpan::new(), None);
|
self.sub(Level::Help, msg, MultiSpan::new());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prints the span with a help above it.
|
/// Prints the span with a help above it.
|
||||||
/// This is like [`Diagnostic::help()`], but it gets its own span.
|
/// This is like [`Diagnostic::help()`], but it gets its own span.
|
||||||
pub fn help_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
pub fn help_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
|
||||||
self.sub(Level::OnceHelp, msg, MultiSpan::new(), None);
|
self.sub(Level::OnceHelp, msg, MultiSpan::new());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a help message attached to this diagnostic with a customizable highlighted message.
|
/// 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 {
|
pub fn highlighted_help(&mut self, msg: Vec<(String, Style)>) -> &mut Self {
|
||||||
self.sub_with_highlights(Level::Help, msg, MultiSpan::new(), None);
|
self.sub_with_highlights(Level::Help, msg, MultiSpan::new());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ impl Diagnostic {
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: impl Into<SubdiagnosticMessage>,
|
msg: impl Into<SubdiagnosticMessage>,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.sub(Level::Help, msg, sp.into(), None);
|
self.sub(Level::Help, msg, sp.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,13 +952,7 @@ impl Diagnostic {
|
||||||
/// public methods above.
|
/// public methods above.
|
||||||
///
|
///
|
||||||
/// Used by `proc_macro_server` for implementing `server::Diagnostic`.
|
/// Used by `proc_macro_server` for implementing `server::Diagnostic`.
|
||||||
pub fn sub(
|
pub fn sub(&mut self, level: Level, message: impl Into<SubdiagnosticMessage>, span: MultiSpan) {
|
||||||
&mut self,
|
|
||||||
level: Level,
|
|
||||||
message: impl Into<SubdiagnosticMessage>,
|
|
||||||
span: MultiSpan,
|
|
||||||
render_span: Option<MultiSpan>,
|
|
||||||
) {
|
|
||||||
let sub = SubDiagnostic {
|
let sub = SubDiagnostic {
|
||||||
level,
|
level,
|
||||||
messages: vec![(
|
messages: vec![(
|
||||||
|
@ -966,7 +960,7 @@ impl Diagnostic {
|
||||||
Style::NoStyle,
|
Style::NoStyle,
|
||||||
)],
|
)],
|
||||||
span,
|
span,
|
||||||
render_span,
|
render_span: None,
|
||||||
};
|
};
|
||||||
self.children.push(sub);
|
self.children.push(sub);
|
||||||
}
|
}
|
||||||
|
@ -978,13 +972,12 @@ impl Diagnostic {
|
||||||
level: Level,
|
level: Level,
|
||||||
messages: Vec<(M, Style)>,
|
messages: Vec<(M, Style)>,
|
||||||
span: MultiSpan,
|
span: MultiSpan,
|
||||||
render_span: Option<MultiSpan>,
|
|
||||||
) {
|
) {
|
||||||
let messages = messages
|
let messages = messages
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|m| (self.subdiagnostic_message_to_diagnostic_message(m.0), m.1))
|
.map(|m| (self.subdiagnostic_message_to_diagnostic_message(m.0), m.1))
|
||||||
.collect();
|
.collect();
|
||||||
let sub = SubDiagnostic { level, messages, span, render_span };
|
let sub = SubDiagnostic { level, messages, span, render_span: None };
|
||||||
self.children.push(sub);
|
self.children.push(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -499,12 +499,7 @@ impl server::FreeFunctions for Rustc<'_, '_> {
|
||||||
rustc_errors::Diagnostic::new(diagnostic.level.to_internal(), diagnostic.message);
|
rustc_errors::Diagnostic::new(diagnostic.level.to_internal(), diagnostic.message);
|
||||||
diag.set_span(MultiSpan::from_spans(diagnostic.spans));
|
diag.set_span(MultiSpan::from_spans(diagnostic.spans));
|
||||||
for child in diagnostic.children {
|
for child in diagnostic.children {
|
||||||
diag.sub(
|
diag.sub(child.level.to_internal(), child.message, MultiSpan::from_spans(child.spans));
|
||||||
child.level.to_internal(),
|
|
||||||
child.message,
|
|
||||||
MultiSpan::from_spans(child.spans),
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
self.sess().dcx.emit_diagnostic(diag);
|
self.sess().dcx.emit_diagnostic(diag);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue