Skip to content

Commit

Permalink
Pass Queries by reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Nov 25, 2019
1 parent 18bb912 commit ea1b803
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/librustc_interface/queries.rs
Expand Up @@ -278,7 +278,7 @@ impl<'comp> Queries<'comp> {
})
}

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

Ok(Linker {
sess,
dep_graph: dep_graph.take(),
dep_graph: dep_graph.peek().clone(),
prepare_outputs: prepare_outputs.take(),
ongoing_codegen: ongoing_codegen.take(),
codegen_backend,
Expand Down Expand Up @@ -316,11 +316,11 @@ impl Linker {
}

impl Compiler {
pub fn enter<'c, F, T>(&'c self, f: F) -> Result<T>
where F: FnOnce(Queries<'c>) -> Result<T>
pub fn enter<'c, F, T>(&'c self, f: F) -> T
where F: for<'q> FnOnce(&'q Queries<'c>) -> T
{
let queries = Queries::new(&self);
f(queries)
f(&queries)
}

// This method is different to all the other methods in `Compiler` because
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/core.rs
Expand Up @@ -377,8 +377,8 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt

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

Ok((resolver, global_ctxt))
}).unwrap();
(resolver, global_ctxt)
});

global_ctxt.enter(|tcx| {
tcx.analysis(LOCAL_CRATE).ok();
Expand Down

0 comments on commit ea1b803

Please sign in to comment.