Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid Lrc<Box<dyn CodegenBackend>>. #112913

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ fn run_compiler(
return;
}
let should_stop =
print_crate_info(&***compiler.codegen_backend(), compiler.session(), false);
print_crate_info(&**compiler.codegen_backend(), compiler.session(), false);

if should_stop == Compilation::Stop {
return;
Expand All @@ -351,7 +351,7 @@ fn run_compiler(

interface::run_compiler(config, |compiler| {
let sess = compiler.session();
let should_stop = print_crate_info(&***compiler.codegen_backend(), sess, true)
let should_stop = print_crate_info(&**compiler.codegen_backend(), sess, true)
.and_then(|| list_metadata(sess, &*compiler.codegen_backend().metadata_loader()))
.and_then(|| try_process_rlink(sess, compiler));

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_interface/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub type Result<T> = result::Result<T, ErrorGuaranteed>;
/// Created by passing [`Config`] to [`run_compiler`].
pub struct Compiler {
pub(crate) sess: Lrc<Session>,
codegen_backend: Lrc<Box<dyn CodegenBackend>>,
codegen_backend: Lrc<dyn CodegenBackend>,
pub(crate) register_lints: Option<Box<dyn Fn(&Session, &mut LintStore) + Send + Sync>>,
pub(crate) override_queries: Option<fn(&Session, &mut Providers, &mut ExternProviders)>,
}
Expand All @@ -45,7 +45,7 @@ impl Compiler {
pub fn session(&self) -> &Lrc<Session> {
&self.sess
}
pub fn codegen_backend(&self) -> &Lrc<Box<dyn CodegenBackend>> {
pub fn codegen_backend(&self) -> &Lrc<dyn CodegenBackend> {
&self.codegen_backend
}
pub fn register_lints(&self) -> &Option<Box<dyn Fn(&Session, &mut LintStore) + Send + Sync>> {
Expand Down Expand Up @@ -318,7 +318,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se

let compiler = Compiler {
sess: Lrc::new(sess),
codegen_backend: Lrc::new(codegen_backend),
codegen_backend: Lrc::from(codegen_backend),
register_lints: config.register_lints,
override_queries: config.override_queries,
};
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_interface/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'tcx> Queries<'tcx> {
fn session(&self) -> &Lrc<Session> {
&self.compiler.sess
}
fn codegen_backend(&self) -> &Lrc<Box<dyn CodegenBackend>> {
fn codegen_backend(&self) -> &Lrc<dyn CodegenBackend> {
self.compiler.codegen_backend()
}

Expand Down Expand Up @@ -259,7 +259,7 @@ impl<'tcx> Queries<'tcx> {
// Hook for UI tests.
Self::check_for_rustc_errors_attr(tcx);

Ok(passes::start_codegen(&***self.codegen_backend(), tcx))
Ok(passes::start_codegen(&**self.codegen_backend(), tcx))
})
}

Expand Down Expand Up @@ -324,7 +324,7 @@ impl<'tcx> Queries<'tcx> {
pub struct Linker {
// compilation inputs
sess: Lrc<Session>,
codegen_backend: Lrc<Box<dyn CodegenBackend>>,
codegen_backend: Lrc<dyn CodegenBackend>,

// compilation outputs
dep_graph: DepGraph,
Expand Down