Introduce DiagCtxt::struct_bug
.
This makes `DiagCtxt::bug` look like the other similar functions.
This commit is contained in:
parent
9ed87336b0
commit
072c157d68
2 changed files with 10 additions and 1 deletions
|
@ -961,6 +961,13 @@ impl DiagCtxt {
|
||||||
DiagnosticBuilder::new(self, Level::Note, msg)
|
DiagnosticBuilder::new(self, Level::Note, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Construct a builder at the `Bug` level with the `msg`.
|
||||||
|
#[rustc_lint_diagnostics]
|
||||||
|
#[track_caller]
|
||||||
|
pub fn struct_bug(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, BugAbort> {
|
||||||
|
DiagnosticBuilder::new(self, Level::Bug, msg)
|
||||||
|
}
|
||||||
|
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn span_fatal(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! {
|
pub fn span_fatal(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! {
|
||||||
|
@ -1104,8 +1111,9 @@ impl DiagCtxt {
|
||||||
self.struct_note(msg).emit()
|
self.struct_note(msg).emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rustc_lint_diagnostics]
|
||||||
pub fn bug(&self, msg: impl Into<DiagnosticMessage>) -> ! {
|
pub fn bug(&self, msg: impl Into<DiagnosticMessage>) -> ! {
|
||||||
DiagnosticBuilder::<BugAbort>::new(self, Bug, msg).emit()
|
self.struct_bug(msg).emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -1159,6 +1159,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
// Fixme: does this result in errors?
|
// Fixme: does this result in errors?
|
||||||
self.expansions.clear();
|
self.expansions.clear();
|
||||||
}
|
}
|
||||||
|
#[rustc_lint_diagnostics]
|
||||||
pub fn bug(&self, msg: &'static str) -> ! {
|
pub fn bug(&self, msg: &'static str) -> ! {
|
||||||
self.sess.dcx().bug(msg);
|
self.sess.dcx().bug(msg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue