Skip to content

Commit 45c9775

Browse files
committed
A couple of small cleanups
1 parent a702729 commit 45c9775

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

compiler/rustc_interface/src/queries.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,7 @@ impl<'tcx> Queries<'tcx> {
245245
self.prepare_outputs.compute(|| {
246246
let expansion_result = self.expansion()?;
247247
let (krate, boxed_resolver, _) = &*expansion_result.peek();
248-
let crate_name = self.crate_name()?;
249-
let crate_name = crate_name.peek();
248+
let crate_name = self.crate_name()?.peek();
250249
passes::prepare_outputs(
251250
self.session(),
252251
self.compiler,
@@ -343,32 +342,36 @@ impl<'tcx> Queries<'tcx> {
343342
}
344343

345344
pub fn linker(&'tcx self) -> Result<Linker> {
346-
let dep_graph = self.dep_graph()?;
347-
let prepare_outputs = self.prepare_outputs()?;
348-
let crate_hash = self.global_ctxt()?.peek_mut().enter(|tcx| tcx.crate_hash(LOCAL_CRATE));
349-
let ongoing_codegen = self.ongoing_codegen()?;
350-
351345
let sess = self.session().clone();
352346
let codegen_backend = self.codegen_backend().clone();
353347

348+
let dep_graph = self.dep_graph()?.peek().clone();
349+
let prepare_outputs = self.prepare_outputs()?.take();
350+
let crate_hash = self.global_ctxt()?.peek_mut().enter(|tcx| tcx.crate_hash(LOCAL_CRATE));
351+
let ongoing_codegen = self.ongoing_codegen()?.take();
352+
354353
Ok(Linker {
355354
sess,
356-
dep_graph: dep_graph.peek().clone(),
357-
prepare_outputs: prepare_outputs.take(),
358-
crate_hash,
359-
ongoing_codegen: ongoing_codegen.take(),
360355
codegen_backend,
356+
357+
dep_graph,
358+
prepare_outputs,
359+
crate_hash,
360+
ongoing_codegen,
361361
})
362362
}
363363
}
364364

365365
pub struct Linker {
366+
// compilation inputs
366367
sess: Lrc<Session>,
368+
codegen_backend: Lrc<Box<dyn CodegenBackend>>,
369+
370+
// compilation outputs
367371
dep_graph: DepGraph,
368372
prepare_outputs: OutputFilenames,
369373
crate_hash: Svh,
370374
ongoing_codegen: Box<dyn Any>,
371-
codegen_backend: Lrc<Box<dyn CodegenBackend>>,
372375
}
373376

374377
impl Linker {

0 commit comments

Comments
 (0)