Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move metadata generation before analysis #64112

Closed
wants to merge 6 commits into from

Remove `Compiler::compile()`.

`Compiler::compile()` is different to all the other `Compiler` methods
because it lacks a `Queries` entry. It only has one call site, which is
in a test that doesn't need its specific characteristics.

This patch removes `Compile::compile()` and replaces the call to it in
the test with a call to `Compile::codegen_and_link()`, which is similar
enough for the test's purposes.
  • Loading branch information...
nnethercote committed Aug 30, 2019
commit 92a0cbd3c30ce26498739c8f18cba6ab0cd4e7f8
@@ -2,17 +2,17 @@ use crate::interface::{Compiler, Result};
use crate::passes::{self, BoxedResolver, ExpansionResult, BoxedGlobalCtxt, PluginInfo};

use rustc_incremental::DepGraphFuture;
use rustc::session::config::{OutputFilenames, OutputType};
use rustc::session::config::OutputFilenames;
use rustc::util::common::{time, ErrorReported};
use rustc::hir;
use rustc::hir::def_id::LOCAL_CRATE;
use rustc::ty::steal::Steal;
use rustc::dep_graph::DepGraph;
use std::any::Any;
use std::cell::{Ref, RefMut, RefCell};
use std::mem;
use std::rc::Rc;
use std::sync::mpsc;
use std::any::Any;
use std::mem;
use syntax::{self, ast};

/// Represent the result of a query.
@@ -268,21 +268,4 @@ impl Compiler {
Ok(())
})
}

pub fn compile(&self) -> Result<()> {
self.prepare_outputs()?;

if self.session().opts.output_types.contains_key(&OutputType::DepInfo)
&& self.session().opts.output_types.len() == 1
{
return Ok(())
}

self.global_ctxt()?;

// Drop AST after creating GlobalCtxt to free memory
mem::drop(self.expansion()?.take());

self.codegen_and_link().map(|_| ())
}
}
@@ -62,6 +62,6 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
};

interface::run_compiler(config, |compiler| {
compiler.compile().ok();
compiler.codegen_and_link().ok();
});
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.