about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-12-18 17:05:01 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-19 09:52:19 +1100
commit072c157d680a0838b25bf1d7cb33c373945dc6db (patch)
treea55db49444f2f43593228f0af5b74aa4b32fce67 /compiler/rustc_errors/src
parent9ed87336b07d26776470218e316e2df5bc9f4112 (diff)
downloadrust-072c157d680a0838b25bf1d7cb33c373945dc6db.tar.gz
rust-072c157d680a0838b25bf1d7cb33c373945dc6db.zip
Introduce `DiagCtxt::struct_bug`.
This makes `DiagCtxt::bug` look like the other similar functions.
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index 93813458718..ae086153647 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -961,6 +961,13 @@ impl DiagCtxt {
         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]
     #[track_caller]
     pub fn span_fatal(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! {
@@ -1104,8 +1111,9 @@ impl DiagCtxt {
         self.struct_note(msg).emit()
     }
 
+    #[rustc_lint_diagnostics]
     pub fn bug(&self, msg: impl Into<DiagnosticMessage>) -> ! {
-        DiagnosticBuilder::<BugAbort>::new(self, Bug, msg).emit()
+        self.struct_bug(msg).emit()
     }
 
     #[inline]