about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-02-02 16:06:16 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-02-02 16:09:39 +0000
commit6a566ee092cacf6e4b327e7fdbbb1003a514b820 (patch)
treee46f258d8007701a5bcb7bb8971288e39a6bea14 /compiler/rustc_errors/src
parent6556147d15f077dfc88dae22f3983b3598bce465 (diff)
downloadrust-6a566ee092cacf6e4b327e7fdbbb1003a514b820.tar.gz
rust-6a566ee092cacf6e4b327e7fdbbb1003a514b820.zip
Replace ParseSess::set_dcx with DiagCtxt::set_emitter
Replacing the error emitter doesn't accidentally clear the error count.
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index e64bb003dde..f30b6921cfb 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -712,6 +712,10 @@ impl DiagCtxt {
         inner.emitter = new_emitter;
     }
 
+    pub fn set_emitter(&self, emitter: Box<dyn Emitter + DynSend>) {
+        self.inner.borrow_mut().emitter = emitter;
+    }
+
     /// Translate `message` eagerly with `args` to `SubdiagMessage::Eager`.
     pub fn eagerly_translate<'a>(
         &self,