Pass Queries by reference.

This commit is contained in:
Camille GILLOT 2019-11-25 17:25:47 +01:00
parent 18bb912984
commit ea1b8039ad
2 changed files with 7 additions and 7 deletions

View file

@ -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()?;
@ -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,
@ -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

View file

@ -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();