Store a single copy of the error registry in DiagCtxt

And pass this to the individual emitters when necessary.
This commit is contained in:
bjorn3 2024-11-09 18:30:13 +00:00
parent ea6f5cbd2f
commit 030545d8c3
9 changed files with 67 additions and 46 deletions

View file

@ -441,7 +441,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
temps_dir,
},
bundle,
config.registry.clone(),
config.registry,
locale_resources,
config.lint_caps,
target,
@ -499,7 +499,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
// If `f` panics, `finish_diagnostics` will run during
// unwinding because of the `defer`.
let sess_abort_guard = defer(|| {
compiler.sess.finish_diagnostics(&config.registry);
compiler.sess.finish_diagnostics();
});
let res = f(&compiler);