use rustc::hir::map as hir_map;
use rustc::lint;
use rustc::middle::{self, reachable, resolve_lifetime, stability};
-use rustc::middle::privacy::AccessLevels;
use rustc::ty::{self, AllArenas, Resolutions, TyCtxt};
use rustc::traits;
use rustc::util::common::{install_panic_hook, time, ErrorReported};
use rustc_codegen_utils::codegen_backend::CodegenBackend;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::stable_hasher::StableHasher;
-use rustc_data_structures::sync::{self, Lrc, Lock};
+use rustc_data_structures::sync::{self, Lock};
use rustc_incremental;
use rustc_metadata::creader::CrateLoader;
use rustc_metadata::cstore::{self, CStore};
/// Allows overriding default rustc query providers,
/// after `default_provide` has installed them.
- pub provide: Box<dyn Fn(&mut ty::query::Providers) + 'a>,
+ pub provide: Box<dyn Fn(&mut ty::query::Providers) + 'a + sync::Send>,
/// Same as `provide`, but only for non-local crates,
/// applied after `default_provide_extern`.
- pub provide_extern: Box<dyn Fn(&mut ty::query::Providers) + 'a>,
+ pub provide_extern: Box<dyn Fn(&mut ty::query::Providers) + 'a + sync::Send>,
}
impl<'a> CompileController<'a> {
pub fn basic() -> CompileController<'a> {
+ sync::assert_send::<Self>();
CompileController {
after_parse: PhaseController::basic(),
after_expand: PhaseController::basic(),
// If true then the compiler will try to run the callback even if the phase
// ends with an error. Note that this is not always possible.
pub run_callback_on_error: bool,
- pub callback: Box<dyn Fn(&mut CompileState) + 'a>,
+ pub callback: Box<dyn Fn(&mut CompileState) + 'a + sync::Send>,
}
impl<'a> PhaseController<'a> {
},
analysis: ty::CrateAnalysis {
- access_levels: Lrc::new(AccessLevels::default()),
- name: crate_name.to_string(),
glob_map: if resolver.make_glob_map {
Some(resolver.glob_map)
} else {
ast_validation::check_crate(sess, &krate)
});
- time(sess, "name resolution", || -> CompileResult {
+ time(sess, "name resolution", || {
resolver.resolve_crate(&krate);
- Ok(())
- })?;
+ });
// Needs to go *after* expansion to be able to check the results of macro expansion.
time(sess, "complete gated feature checking", || {
- sess.track_errors(|| {
- syntax::feature_gate::check_crate(
- &krate,
- &sess.parse_sess,
- &sess.features_untracked(),
- &attributes,
- sess.opts.unstable_features,
- );
- })
- })?;
+ syntax::feature_gate::check_crate(
+ &krate,
+ &sess.parse_sess,
+ &sess.features_untracked(),
+ &attributes,
+ sess.opts.unstable_features,
+ );
+ });
// Lower ast -> hir.
// First, we need to collect the dep_graph.
}
pub fn default_provide(providers: &mut ty::query::Providers) {
+ proc_macro_decls::provide(providers);
+ plugin::build::provide(providers);
hir::provide(providers);
borrowck::provide(providers);
mir::provide(providers);
typeck::provide(providers);
ty::provide(providers);
traits::provide(providers);
+ stability::provide(providers);
reachable::provide(providers);
rustc_passes::provide(providers);
rustc_traits::provide(providers);
sess: &'tcx Session,
cstore: &'tcx CStore,
hir_map: hir_map::Map<'tcx>,
- mut analysis: ty::CrateAnalysis,
+ analysis: ty::CrateAnalysis,
resolutions: Resolutions,
arenas: &'tcx mut AllArenas<'tcx>,
name: &str,
middle::entry::find_entry_point(sess, &hir_map, name)
});
- sess.plugin_registrar_fn
- .set(time(sess, "looking for plugin registrar", || {
- plugin::build::find_plugin_registrar(sess.diagnostic(), &hir_map)
- }));
- sess.proc_macro_decls_static
- .set(proc_macro_decls::find(&hir_map));
-
- time(sess, "loop checking", || loops::check_crate(sess, &hir_map));
-
let mut local_providers = ty::query::Providers::default();
default_provide(&mut local_providers);
codegen_backend.provide(&mut local_providers);
|tcx| {
// Do some initialization of the DepGraph that can only be done with the
// tcx available.
- rustc_incremental::dep_graph_tcx_init(tcx);
+ time(sess, "dep graph tcx init", || rustc_incremental::dep_graph_tcx_init(tcx));
+
+ time(sess, "looking for plugin registrar", || {
+ plugin::build::find_plugin_registrar(tcx)
+ });
+
+ time(sess, "looking for derive registrar", || {
+ proc_macro_decls::find(tcx)
+ });
+
+ time(sess, "loop checking", || loops::check_crate(tcx));
time(sess, "attribute checking", || {
hir::check_attr::check_crate(tcx)
rvalue_promotion::check_crate(tcx)
});
- analysis.access_levels =
- time(sess, "privacy checking", || rustc_privacy::check_crate(tcx));
+ time(sess, "privacy checking", || {
+ rustc_privacy::check_crate(tcx)
+ });
time(sess, "intrinsic checking", || {
middle::intrinsicck::check_crate(tcx)