From 6a566ee092cacf6e4b327e7fdbbb1003a514b820 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:06:16 +0000 Subject: Replace ParseSess::set_dcx with DiagCtxt::set_emitter Replacing the error emitter doesn't accidentally clear the error count. --- compiler/rustc_errors/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/rustc_errors/src') 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) { + self.inner.borrow_mut().emitter = emitter; + } + /// Translate `message` eagerly with `args` to `SubdiagMessage::Eager`. pub fn eagerly_translate<'a>( &self, -- cgit 1.4.1-3-g733a5