use rustc_expand::base::ExtCtxt;
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_incremental;
+use rustc_lint::LintStore;
use rustc_mir as mir;
+use rustc_mir_build as mir_build;
use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str};
-use rustc_passes::{self, ast_validation, hir_stats, layout_test};
+use rustc_passes::{self, hir_stats, layout_test};
use rustc_plugin_impl as plugin;
use rustc_privacy;
use rustc_resolve::{Resolver, ResolverArenas};
use rustc_span::FileName;
use rustc_traits;
use rustc_typeck as typeck;
-use syntax::early_buffered_lints::BufferedEarlyLint;
use syntax::mut_visit::MutVisitor;
use syntax::util::node_count::NodeCounter;
use syntax::{self, ast, visit};
}
if let Some(ref s) = sess.opts.debugging_opts.show_span {
- syntax::show_span::run(sess.diagnostic(), s, &krate);
+ rustc_ast_passes::show_span::run(sess.diagnostic(), s, &krate);
}
if sess.opts.debugging_opts.hir_stats {
/// Returns `None` if we're aborting after handling -W help.
pub fn configure_and_expand(
sess: Lrc<Session>,
- lint_store: Lrc<lint::LintStore>,
+ lint_store: Lrc<LintStore>,
metadata_loader: Box<MetadataLoaderDyn>,
krate: ast::Crate,
crate_name: &str,
pub fn register_plugins<'a>(
sess: &'a Session,
metadata_loader: &'a dyn MetadataLoader,
- register_lints: impl Fn(&Session, &mut lint::LintStore),
+ register_lints: impl Fn(&Session, &mut LintStore),
mut krate: ast::Crate,
crate_name: &str,
-) -> Result<(ast::Crate, Lrc<lint::LintStore>)> {
+) -> Result<(ast::Crate, Lrc<LintStore>)> {
krate = sess.time("attributes_injection", || {
rustc_builtin_macros::cmdline_attrs::inject(
krate,
fn configure_and_expand_inner<'a>(
sess: &'a Session,
- lint_store: &'a lint::LintStore,
+ lint_store: &'a LintStore,
mut krate: ast::Crate,
crate_name: &str,
resolver_arenas: &'a ResolverArenas<'a>,
}
let has_proc_macro_decls = sess.time("AST_validation", || {
- ast_validation::check_crate(sess, &krate, &mut resolver.lint_buffer())
+ rustc_ast_passes::ast_validation::check_crate(sess, &krate, &mut resolver.lint_buffer())
});
let crate_types = sess.crate_types.borrow();
// Needs to go *after* expansion to be able to check the results of macro expansion.
sess.time("complete_gated_feature_checking", || {
- syntax::feature_gate::check_crate(
+ rustc_ast_passes::feature_gate::check_crate(
&krate,
&sess.parse_sess,
&sess.features_untracked(),
// Add all buffered lints from the `ParseSess` to the `Session`.
sess.parse_sess.buffered_lints.with_lock(|buffered_lints| {
info!("{} parse sess buffered_lints", buffered_lints.len());
- for BufferedEarlyLint { id, span, msg, lint_id } in buffered_lints.drain(..) {
- resolver.lint_buffer().buffer_lint(lint_id, id, span, &msg);
+ for early_lint in buffered_lints.drain(..) {
+ resolver.lint_buffer().add_early_lint(early_lint);
}
});
pub fn lower_to_hir<'res, 'tcx>(
sess: &'tcx Session,
- lint_store: &lint::LintStore,
+ lint_store: &LintStore,
resolver: &'res mut Resolver<'_>,
dep_graph: &'res DepGraph,
krate: &'res ast::Crate,
boxed_resolver: &Steal<Rc<RefCell<BoxedResolver>>>,
crate_name: &str,
) -> Result<OutputFilenames> {
+ let _timer = sess.timer("prepare_outputs");
+
// FIXME: rustdoc passes &[] instead of &krate.attrs here
let outputs = util::build_output_filenames(
&compiler.input,
plugin::build::provide(providers);
rustc::hir::provide(providers);
mir::provide(providers);
+ mir_build::provide(providers);
rustc_privacy::provide(providers);
typeck::provide(providers);
ty::provide(providers);
rustc_passes::provide(providers);
rustc_resolve::provide(providers);
rustc_traits::provide(providers);
+ rustc_ty::provide(providers);
rustc_metadata::provide(providers);
rustc_lint::provide(providers);
rustc_codegen_utils::provide(providers);
pub fn create_global_ctxt<'tcx>(
compiler: &'tcx Compiler,
- lint_store: Lrc<lint::LintStore>,
+ lint_store: Lrc<LintStore>,
hir_forest: &'tcx map::Forest<'tcx>,
mut resolver_outputs: ResolverOutputs,
outputs: OutputFilenames,
callback(sess, &mut local_providers, &mut extern_providers);
}
- let gcx = global_ctxt.init_locking(|| {
- TyCtxt::create_global_ctxt(
- sess,
- lint_store,
- local_providers,
- extern_providers,
- &all_arenas,
- arena,
- resolver_outputs,
- hir_map,
- query_result_on_disk_cache,
- &crate_name,
- &outputs,
- )
+ let gcx = sess.time("setup_global_ctxt", || {
+ global_ctxt.init_locking(|| {
+ TyCtxt::create_global_ctxt(
+ sess,
+ lint_store,
+ local_providers,
+ extern_providers,
+ &all_arenas,
+ arena,
+ resolver_outputs,
+ hir_map,
+ query_result_on_disk_cache,
+ &crate_name,
+ &outputs,
+ )
+ })
});
// Do some initialization of the DepGraph that can only be done with the tcx available.