Change msg: impl Into<String>
for bug diagnostics.
To `msg: impl Into<DiagnosticMessage>`, like all the other diagnostics. For consistency.
This commit is contained in:
parent
e3b7ecc1ef
commit
19d28a4f28
5 changed files with 15 additions and 13 deletions
|
@ -1033,7 +1033,7 @@ impl Handler {
|
|||
self.emit_diag_at_span(Diagnostic::new_with_code(Warning(None), Some(code), msg), span);
|
||||
}
|
||||
|
||||
pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: impl Into<String>) -> ! {
|
||||
pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! {
|
||||
self.inner.borrow_mut().span_bug(span, msg)
|
||||
}
|
||||
|
||||
|
@ -1045,7 +1045,7 @@ impl Handler {
|
|||
pub fn span_delayed_bug(
|
||||
&self,
|
||||
sp: impl Into<MultiSpan>,
|
||||
msg: impl Into<String>,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
) -> ErrorGuaranteed {
|
||||
let mut inner = self.inner.borrow_mut();
|
||||
|
||||
|
@ -1056,10 +1056,10 @@ impl Handler {
|
|||
inner.err_count + inner.lint_err_count + inner.delayed_bug_count() + 1 >= c.get()
|
||||
}) {
|
||||
// FIXME: don't abort here if report_delayed_bugs is off
|
||||
inner.span_bug(sp, msg.into());
|
||||
inner.span_bug(sp, msg);
|
||||
}
|
||||
let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg.into());
|
||||
diagnostic.set_span(sp.into());
|
||||
let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg);
|
||||
diagnostic.set_span(sp);
|
||||
inner.emit_diagnostic(&mut diagnostic).unwrap()
|
||||
}
|
||||
|
||||
|
@ -1589,8 +1589,8 @@ impl HandlerInner {
|
|||
}
|
||||
|
||||
#[track_caller]
|
||||
fn span_bug(&mut self, sp: impl Into<MultiSpan>, msg: impl Into<String>) -> ! {
|
||||
self.emit_diagnostic(Diagnostic::new(Bug, msg.into()).set_span(sp));
|
||||
fn span_bug(&mut self, sp: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! {
|
||||
self.emit_diagnostic(Diagnostic::new(Bug, msg).set_span(sp));
|
||||
panic::panic_any(ExplicitBug);
|
||||
}
|
||||
|
||||
|
|
|
@ -1145,7 +1145,7 @@ impl<'a> ExtCtxt<'a> {
|
|||
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
||||
self.sess.diagnostic().span_err(sp, msg);
|
||||
}
|
||||
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<String>) -> ! {
|
||||
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) -> ! {
|
||||
self.sess.diagnostic().span_bug(sp, msg);
|
||||
}
|
||||
pub fn trace_macros_diag(&mut self) {
|
||||
|
|
|
@ -15,7 +15,9 @@ use hir::def::DefKind;
|
|||
use polonius_engine::Atom;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_errors::{DiagnosticArgValue, ErrorGuaranteed, IntoDiagnosticArg, MultiSpan};
|
||||
use rustc_errors::{
|
||||
DiagnosticArgValue, DiagnosticMessage, ErrorGuaranteed, IntoDiagnosticArg, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::LangItem;
|
||||
|
@ -2005,7 +2007,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
pub fn new_error_with_message<S: Into<MultiSpan>>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
span: S,
|
||||
msg: impl Into<String>,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
) -> Ty<'tcx> {
|
||||
let reported = tcx.sess.span_delayed_bug(span, msg);
|
||||
Ty::new(tcx, Error(reported))
|
||||
|
|
|
@ -249,8 +249,8 @@ impl<'a> Parser<'a> {
|
|||
self.diagnostic().struct_span_err(sp, m)
|
||||
}
|
||||
|
||||
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, m: impl Into<String>) -> ! {
|
||||
self.diagnostic().span_bug(sp, m)
|
||||
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) -> ! {
|
||||
self.diagnostic().span_bug(sp, msg)
|
||||
}
|
||||
|
||||
pub(super) fn diagnostic(&self) -> &'a Handler {
|
||||
|
|
|
@ -632,7 +632,7 @@ impl Session {
|
|||
pub fn span_delayed_bug<S: Into<MultiSpan>>(
|
||||
&self,
|
||||
sp: S,
|
||||
msg: impl Into<String>,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
) -> ErrorGuaranteed {
|
||||
self.diagnostic().span_delayed_bug(sp, msg)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue