From 3560122bfc2c2d1901a7bfe71882e40b6228f68c Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 17 Nov 2023 08:05:56 +1100 Subject: Streamline `Queries::linker`. --- compiler/rustc_interface/src/queries.rs | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'compiler/rustc_interface/src') 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) -> Result { - 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, + }) }) } } -- cgit 1.4.1-3-g733a5