Move CodegenBackend
out of Linker
.
It can easily be passed in. And that removes the single clone of `Compiler::codegen_backend`, which means it no longer needs to be `Lrc`.
This commit is contained in:
parent
de91b6d249
commit
aed8e1f3b6
4 changed files with 17 additions and 26 deletions
|
@ -39,7 +39,7 @@ pub type Result<T> = result::Result<T, ErrorGuaranteed>;
|
|||
/// Created by passing [`Config`] to [`run_compiler`].
|
||||
pub struct Compiler {
|
||||
pub(crate) sess: Session,
|
||||
codegen_backend: Lrc<dyn CodegenBackend>,
|
||||
codegen_backend: Box<dyn CodegenBackend>,
|
||||
pub(crate) override_queries: Option<fn(&Session, &mut Providers)>,
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,8 @@ impl Compiler {
|
|||
pub fn session(&self) -> &Session {
|
||||
&self.sess
|
||||
}
|
||||
pub fn codegen_backend(&self) -> &Lrc<dyn CodegenBackend> {
|
||||
&self.codegen_backend
|
||||
pub fn codegen_backend(&self) -> &dyn CodegenBackend {
|
||||
&*self.codegen_backend
|
||||
}
|
||||
pub fn build_output_filenames(
|
||||
&self,
|
||||
|
@ -491,11 +491,8 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
|
|||
}
|
||||
sess.lint_store = Some(Lrc::new(lint_store));
|
||||
|
||||
let compiler = Compiler {
|
||||
sess,
|
||||
codegen_backend: Lrc::from(codegen_backend),
|
||||
override_queries: config.override_queries,
|
||||
};
|
||||
let compiler =
|
||||
Compiler { sess, codegen_backend, override_queries: config.override_queries };
|
||||
|
||||
rustc_span::set_source_map(compiler.sess.parse_sess.clone_source_map(), move || {
|
||||
let r = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue