summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_interface/src/passes.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /compiler/rustc_interface/src/passes.rs
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_interface/src/passes.rs')
-rw-r--r--compiler/rustc_interface/src/passes.rs54
1 files changed, 22 insertions, 32 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 0e4e20c7c..42d8d2280 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -17,13 +17,12 @@ use rustc_lint::{unerased_lint_store, BufferedEarlyLint, EarlyCheckNode, LintSto
use rustc_metadata::creader::CStore;
use rustc_middle::arena::Arena;
use rustc_middle::dep_graph::DepGraph;
-use rustc_middle::ty::query::{ExternProviders, Providers};
+use rustc_middle::query::{ExternProviders, Providers};
use rustc_middle::ty::{self, GlobalCtxt, RegisteredTools, TyCtxt};
use rustc_mir_build as mir_build;
use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str, validate_attr};
use rustc_passes::{self, hir_stats, layout_test};
use rustc_plugin_impl as plugin;
-use rustc_query_impl::{OnDiskCache, Queries as TcxQueries};
use rustc_resolve::Resolver;
use rustc_session::config::{CrateType, Input, OutputFilenames, OutputType};
use rustc_session::cstore::{MetadataLoader, Untracked};
@@ -90,6 +89,7 @@ pub fn register_plugins<'a>(
crate_name,
sess.crate_types().contains(&CrateType::Executable),
sess.opts.cg.metadata.clone(),
+ sess.cfg_version,
);
sess.stable_crate_id.set(stable_crate_id).expect("not yet initialized");
rustc_incremental::prepare_session_directory(sess, crate_name, stable_crate_id)?;
@@ -487,6 +487,11 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
files.push(normalize_path(profile_sample.as_path().to_path_buf()));
}
+ // Debugger visualizer files
+ for debugger_visualizer in tcx.debugger_visualizers(LOCAL_CRATE) {
+ files.push(normalize_path(debugger_visualizer.path.clone().unwrap()));
+ }
+
if sess.binary_dep_depinfo() {
if let Some(ref backend) = sess.opts.unstable_opts.codegen_backend {
if backend.contains('.') {
@@ -669,7 +674,6 @@ pub fn create_global_ctxt<'tcx>(
lint_store: Lrc<LintStore>,
dep_graph: DepGraph,
untracked: Untracked,
- queries: &'tcx OnceCell<TcxQueries<'tcx>>,
gcx_cell: &'tcx OnceCell<GlobalCtxt<'tcx>>,
arena: &'tcx WorkerLocal<Arena<'tcx>>,
hir_arena: &'tcx WorkerLocal<rustc_hir::Arena<'tcx>>,
@@ -693,9 +697,7 @@ pub fn create_global_ctxt<'tcx>(
callback(sess, &mut local_providers, &mut extern_providers);
}
- let queries = queries.get_or_init(|| {
- TcxQueries::new(local_providers, extern_providers, query_result_on_disk_cache)
- });
+ let incremental = dep_graph.is_fully_enabled();
sess.time("setup_global_ctxt", || {
gcx_cell.get_or_init(move || {
@@ -706,9 +708,13 @@ pub fn create_global_ctxt<'tcx>(
hir_arena,
untracked,
dep_graph,
- queries.on_disk_cache.as_ref().map(OnDiskCache::as_dyn),
- queries.as_dyn(),
rustc_query_impl::query_callbacks(arena),
+ rustc_query_impl::query_system(
+ local_providers,
+ extern_providers,
+ query_result_on_disk_cache,
+ incremental,
+ ),
)
})
})
@@ -761,27 +767,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
// passes are timed inside typeck
rustc_hir_analysis::check_crate(tcx)?;
- sess.time("misc_checking_2", || {
- parallel!(
- {
- sess.time("match_checking", || {
- tcx.hir().par_body_owners(|def_id| tcx.ensure().check_match(def_id))
- });
- },
- {
- sess.time("liveness_checking", || {
- tcx.hir().par_body_owners(|def_id| {
- // this must run before MIR dump, because
- // "not all control paths return a value" is reported here.
- //
- // maybe move the check to a MIR pass?
- tcx.ensure().check_liveness(def_id.to_def_id());
- });
- });
- }
- );
- });
-
sess.time("MIR_borrow_checking", || {
tcx.hir().par_body_owners(|def_id| tcx.ensure().mir_borrowck(def_id));
});
@@ -794,9 +779,14 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
}
tcx.ensure().has_ffi_unwind_calls(def_id);
- if tcx.hir().body_const_context(def_id).is_some() {
- tcx.ensure()
- .mir_drops_elaborated_and_const_checked(ty::WithOptConstParam::unknown(def_id));
+ // If we need to codegen, ensure that we emit all errors from
+ // `mir_drops_elaborated_and_const_checked` now, to avoid discovering
+ // them later during codegen.
+ if tcx.sess.opts.output_types.should_codegen()
+ || tcx.hir().body_const_context(def_id).is_some()
+ {
+ tcx.ensure().mir_drops_elaborated_and_const_checked(def_id);
+ tcx.ensure().unused_generic_params(ty::InstanceDef::Item(def_id.to_def_id()));
}
}
});