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);
|
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)
|
self.inner.borrow_mut().span_bug(span, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ impl Handler {
|
||||||
pub fn span_delayed_bug(
|
pub fn span_delayed_bug(
|
||||||
&self,
|
&self,
|
||||||
sp: impl Into<MultiSpan>,
|
sp: impl Into<MultiSpan>,
|
||||||
msg: impl Into<String>,
|
msg: impl Into<DiagnosticMessage>,
|
||||||
) -> ErrorGuaranteed {
|
) -> ErrorGuaranteed {
|
||||||
let mut inner = self.inner.borrow_mut();
|
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()
|
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
|
// 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());
|
let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg);
|
||||||
diagnostic.set_span(sp.into());
|
diagnostic.set_span(sp);
|
||||||
inner.emit_diagnostic(&mut diagnostic).unwrap()
|
inner.emit_diagnostic(&mut diagnostic).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,8 +1589,8 @@ impl HandlerInner {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn span_bug(&mut self, sp: impl Into<MultiSpan>, msg: impl Into<String>) -> ! {
|
fn span_bug(&mut self, sp: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! {
|
||||||
self.emit_diagnostic(Diagnostic::new(Bug, msg.into()).set_span(sp));
|
self.emit_diagnostic(Diagnostic::new(Bug, msg).set_span(sp));
|
||||||
panic::panic_any(ExplicitBug);
|
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>) {
|
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
||||||
self.sess.diagnostic().span_err(sp, msg);
|
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);
|
self.sess.diagnostic().span_bug(sp, msg);
|
||||||
}
|
}
|
||||||
pub fn trace_macros_diag(&mut self) {
|
pub fn trace_macros_diag(&mut self) {
|
||||||
|
|
|
@ -15,7 +15,9 @@ use hir::def::DefKind;
|
||||||
use polonius_engine::Atom;
|
use polonius_engine::Atom;
|
||||||
use rustc_data_structures::captures::Captures;
|
use rustc_data_structures::captures::Captures;
|
||||||
use rustc_data_structures::intern::Interned;
|
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 as hir;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_hir::LangItem;
|
use rustc_hir::LangItem;
|
||||||
|
@ -2005,7 +2007,7 @@ impl<'tcx> Ty<'tcx> {
|
||||||
pub fn new_error_with_message<S: Into<MultiSpan>>(
|
pub fn new_error_with_message<S: Into<MultiSpan>>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
span: S,
|
span: S,
|
||||||
msg: impl Into<String>,
|
msg: impl Into<DiagnosticMessage>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let reported = tcx.sess.span_delayed_bug(span, msg);
|
let reported = tcx.sess.span_delayed_bug(span, msg);
|
||||||
Ty::new(tcx, Error(reported))
|
Ty::new(tcx, Error(reported))
|
||||||
|
|
|
@ -249,8 +249,8 @@ impl<'a> Parser<'a> {
|
||||||
self.diagnostic().struct_span_err(sp, m)
|
self.diagnostic().struct_span_err(sp, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, m: impl Into<String>) -> ! {
|
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) -> ! {
|
||||||
self.diagnostic().span_bug(sp, m)
|
self.diagnostic().span_bug(sp, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn diagnostic(&self) -> &'a Handler {
|
pub(super) fn diagnostic(&self) -> &'a Handler {
|
||||||
|
|
|
@ -632,7 +632,7 @@ impl Session {
|
||||||
pub fn span_delayed_bug<S: Into<MultiSpan>>(
|
pub fn span_delayed_bug<S: Into<MultiSpan>>(
|
||||||
&self,
|
&self,
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: impl Into<String>,
|
msg: impl Into<DiagnosticMessage>,
|
||||||
) -> ErrorGuaranteed {
|
) -> ErrorGuaranteed {
|
||||||
self.diagnostic().span_delayed_bug(sp, msg)
|
self.diagnostic().span_delayed_bug(sp, msg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue