Skip to content

Commit ea1b803

Browse files
committed
Pass Queries by reference.
1 parent 18bb912 commit ea1b803

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/librustc_interface/queries.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<'comp> Queries<'comp> {
278278
})
279279
}
280280

281-
pub fn linker(self) -> Result<Linker> {
281+
pub fn linker(&self) -> Result<Linker> {
282282
let dep_graph = self.dep_graph()?;
283283
let prepare_outputs = self.prepare_outputs()?;
284284
let ongoing_codegen = self.ongoing_codegen()?;
@@ -288,7 +288,7 @@ impl<'comp> Queries<'comp> {
288288

289289
Ok(Linker {
290290
sess,
291-
dep_graph: dep_graph.take(),
291+
dep_graph: dep_graph.peek().clone(),
292292
prepare_outputs: prepare_outputs.take(),
293293
ongoing_codegen: ongoing_codegen.take(),
294294
codegen_backend,
@@ -316,11 +316,11 @@ impl Linker {
316316
}
317317

318318
impl Compiler {
319-
pub fn enter<'c, F, T>(&'c self, f: F) -> Result<T>
320-
where F: FnOnce(Queries<'c>) -> Result<T>
319+
pub fn enter<'c, F, T>(&'c self, f: F) -> T
320+
where F: for<'q> FnOnce(&'q Queries<'c>) -> T
321321
{
322322
let queries = Queries::new(&self);
323-
f(queries)
323+
f(&queries)
324324
}
325325

326326
// This method is different to all the other methods in `Compiler` because

src/librustdoc/core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
377377

378378
let global_ctxt = abort_on_err(queries.global_ctxt(), sess).take();
379379

380-
Ok((resolver, global_ctxt))
381-
}).unwrap();
380+
(resolver, global_ctxt)
381+
});
382382

383383
global_ctxt.enter(|tcx| {
384384
tcx.analysis(LOCAL_CRATE).ok();

0 commit comments

Comments
 (0)