]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_errors/diagnostic_builder.rs
Don't run MIR passes on constructor shims
[rust.git] / src / librustc_errors / diagnostic_builder.rs
index f74dcd6070c70f6005b4bd541affa541f7abc871..31f697a724a0357385bfb81487c7684c32f84041 100644 (file)
@@ -100,6 +100,18 @@ pub fn emit(&mut self) {
         self.cancel();
     }
 
+    /// Emit the diagnostic unless `delay` is true,
+    /// in which case the emission will be delayed as a bug.
+    ///
+    /// See `emit` and `delay_as_bug` for details.
+    pub fn emit_unless(&mut self, delay: bool) {
+        if delay {
+            self.delay_as_bug()
+        } else {
+            self.emit()
+        }
+    }
+
     /// Buffers the diagnostic for later emission, unless handler
     /// has disabled such buffering.
     pub fn buffer(mut self, buffered_diagnostics: &mut Vec<Diagnostic>) {