about summary refs log tree commit diff
path: root/compiler
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
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')
-rw-r--r--compiler/rustc_errors/src/lib.rs4
-rw-r--r--compiler/rustc_session/src/parse.rs4
2 files changed, 4 insertions, 4 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,
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs
index b6b13a715ec..81ae06602cd 100644
--- a/compiler/rustc_session/src/parse.rs
+++ b/compiler/rustc_session/src/parse.rs
@@ -337,8 +337,4 @@ impl ParseSess {
     pub fn dcx(&self) -> DiagCtxtHandle<'_> {
         self.dcx.handle()
     }
-
-    pub fn set_dcx(&mut self, dcx: DiagCtxt) {
-        self.dcx = dcx;
-    }
 }