diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-17 08:05:56 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-17 17:14:17 +1100 |
| commit | 3560122bfc2c2d1901a7bfe71882e40b6228f68c (patch) | |
| tree | e105d9b831f5a526f1047d3a5ad4f176dc5a73f3 /compiler/rustc_interface/src | |
| parent | 4770d910934dbc94616a681e9a50fd237a4ba5fc (diff) | |
| download | rust-3560122bfc2c2d1901a7bfe71882e40b6228f68c.tar.gz rust-3560122bfc2c2d1901a7bfe71882e40b6228f68c.zip | |
Streamline `Queries::linker`.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index ace5ec732fb..c30ff6c4831 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -236,25 +236,19 @@ impl<'tcx> Queries<'tcx> { } pub fn linker(&'tcx self, ongoing_codegen: Box<dyn Any>) -> Result<Linker> { - let sess = self.session().clone(); - let codegen_backend = self.codegen_backend().clone(); - - let (crate_hash, prepare_outputs, dep_graph) = self.global_ctxt()?.enter(|tcx| { - ( - if tcx.needs_crate_hash() { Some(tcx.crate_hash(LOCAL_CRATE)) } else { None }, - tcx.output_filenames(()).clone(), - tcx.dep_graph.clone(), - ) - }); - - Ok(Linker { - sess, - codegen_backend, - - dep_graph, - prepare_outputs, - crate_hash, - ongoing_codegen, + self.global_ctxt()?.enter(|tcx| { + Ok(Linker { + sess: self.session().clone(), + codegen_backend: self.codegen_backend().clone(), + dep_graph: tcx.dep_graph.clone(), + prepare_outputs: tcx.output_filenames(()).clone(), + crate_hash: if tcx.needs_crate_hash() { + Some(tcx.crate_hash(LOCAL_CRATE)) + } else { + None + }, + ongoing_codegen, + }) }) } } |
