mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 12:39:31 +03:00
Pass Queries by reference.
This commit is contained in:
@@ -278,7 +278,7 @@ pub fn ongoing_codegen(&self) -> Result<&Query<Box<dyn Any>>> {
|
||||
})
|
||||
}
|
||||
|
||||
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 @@ pub fn linker(self) -> Result<Linker> {
|
||||
|
||||
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 @@ pub fn link(self) -> Result<()> {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user