summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /compiler/rustc_interface/src
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/interface.rs23
-rw-r--r--compiler/rustc_interface/src/passes.rs100
-rw-r--r--compiler/rustc_interface/src/queries.rs150
-rw-r--r--compiler/rustc_interface/src/tests.rs3
-rw-r--r--compiler/rustc_interface/src/util.rs5
5 files changed, 137 insertions, 144 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs
index 953c2e4b8..5b417e008 100644
--- a/compiler/rustc_interface/src/interface.rs
+++ b/compiler/rustc_interface/src/interface.rs
@@ -59,11 +59,6 @@ impl Compiler {
}
}
-#[allow(rustc::bad_opt_access)]
-pub fn set_thread_safe_mode(sopts: &config::UnstableOptions) {
- rustc_data_structures::sync::set_dyn_thread_safe_mode(sopts.threads > 1);
-}
-
/// Converts strings provided as `--cfg [cfgspec]` into a `crate_cfg`.
pub fn parse_cfgspecs(
handler: &EarlyErrorHandler,
@@ -190,7 +185,8 @@ pub fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -> Check
ExpectedValues::Some(FxHashSet::default())
});
- let ExpectedValues::Some(expected_values) = expected_values else {
+ let ExpectedValues::Some(expected_values) = expected_values
+ else {
bug!("`expected_values` should be a list a values")
};
@@ -255,6 +251,7 @@ pub struct Config {
pub input: Input,
pub output_dir: Option<PathBuf>,
pub output_file: Option<OutFileName>,
+ pub ice_file: Option<PathBuf>,
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
pub locale_resources: &'static [&'static str],
@@ -288,6 +285,10 @@ pub struct Config {
#[allow(rustc::bad_opt_access)]
pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Send) -> R {
trace!("run_compiler");
+
+ // Set parallel mode before thread pool creation, which will create `Lock`s.
+ rustc_data_structures::sync::set_dyn_thread_safe_mode(config.opts.unstable_opts.threads > 1);
+
util::run_in_thread_pool_with_globals(
config.opts.edition,
config.opts.unstable_opts.threads,
@@ -315,6 +316,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
config.lint_caps,
config.make_codegen_backend,
registry.clone(),
+ config.ice_file,
);
if let Some(parse_sess_created) = config.parse_sess_created {
@@ -346,7 +348,11 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
)
}
-pub fn try_print_query_stack(handler: &Handler, num_frames: Option<usize>) {
+pub fn try_print_query_stack(
+ handler: &Handler,
+ num_frames: Option<usize>,
+ file: Option<std::fs::File>,
+) {
eprintln!("query stack during panic:");
// Be careful relying on global state here: this code is called from
@@ -358,7 +364,8 @@ pub fn try_print_query_stack(handler: &Handler, num_frames: Option<usize>) {
QueryCtxt::new(icx.tcx),
icx.query,
handler,
- num_frames
+ num_frames,
+ file,
))
} else {
0
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 6b3facd04..18a669175 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -11,6 +11,7 @@ use rustc_data_structures::steal::Steal;
use rustc_data_structures::sync::{Lrc, OnceCell, WorkerLocal};
use rustc_errors::PResult;
use rustc_expand::base::{ExtCtxt, LintStoreExpand};
+use rustc_feature::Features;
use rustc_fs_util::try_canonicalize;
use rustc_hir::def_id::{StableCrateId, LOCAL_CRATE};
use rustc_lint::{unerased_lint_store, BufferedEarlyLint, EarlyCheckNode, LintStore};
@@ -72,43 +73,16 @@ fn count_nodes(krate: &ast::Crate) -> usize {
counter.count
}
-pub fn register_plugins<'a>(
- sess: &'a Session,
- metadata_loader: &'a dyn MetadataLoader,
- register_lints: impl Fn(&Session, &mut LintStore),
+pub(crate) fn create_lint_store(
+ sess: &Session,
+ metadata_loader: &dyn MetadataLoader,
+ register_lints: Option<impl Fn(&Session, &mut LintStore)>,
pre_configured_attrs: &[ast::Attribute],
- crate_name: Symbol,
-) -> Result<LintStore> {
- // these need to be set "early" so that expansion sees `quote` if enabled.
- let features = rustc_expand::config::features(sess, pre_configured_attrs);
- sess.init_features(features);
-
- let crate_types = util::collect_crate_types(sess, pre_configured_attrs);
- sess.init_crate_types(crate_types);
-
- let stable_crate_id = StableCrateId::new(
- 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)?;
-
- if sess.opts.incremental.is_some() {
- sess.time("incr_comp_garbage_collect_session_directories", || {
- if let Err(e) = rustc_incremental::garbage_collect_session_directories(sess) {
- warn!(
- "Error while trying to garbage collect incremental \
- compilation cache directory: {}",
- e
- );
- }
- });
- }
-
+) -> LintStore {
let mut lint_store = rustc_lint::new_lint_store(sess.enable_internal_lints());
- register_lints(sess, &mut lint_store);
+ if let Some(register_lints) = register_lints {
+ register_lints(sess, &mut lint_store);
+ }
let registrars = sess.time("plugin_loading", || {
plugin::load::load_plugins(sess, metadata_loader, pre_configured_attrs)
@@ -120,11 +94,12 @@ pub fn register_plugins<'a>(
}
});
- Ok(lint_store)
+ lint_store
}
fn pre_expansion_lint<'a>(
sess: &Session,
+ features: &Features,
lint_store: &LintStore,
registered_tools: &RegisteredTools,
check_node: impl EarlyCheckNode<'a>,
@@ -134,6 +109,7 @@ fn pre_expansion_lint<'a>(
|| {
rustc_lint::check_ast_node(
sess,
+ features,
true,
lint_store,
registered_tools,
@@ -152,13 +128,14 @@ impl LintStoreExpand for LintStoreExpandImpl<'_> {
fn pre_expansion_lint(
&self,
sess: &Session,
+ features: &Features,
registered_tools: &RegisteredTools,
node_id: ast::NodeId,
attrs: &[ast::Attribute],
items: &[rustc_ast::ptr::P<ast::Item>],
name: Symbol,
) {
- pre_expansion_lint(sess, self.0, registered_tools, (node_id, attrs, items), name);
+ pre_expansion_lint(sess, features, self.0, registered_tools, (node_id, attrs, items), name);
}
}
@@ -174,10 +151,18 @@ fn configure_and_expand(
) -> ast::Crate {
let tcx = resolver.tcx();
let sess = tcx.sess;
+ let features = tcx.features();
let lint_store = unerased_lint_store(tcx);
let crate_name = tcx.crate_name(LOCAL_CRATE);
let lint_check_node = (&krate, pre_configured_attrs);
- pre_expansion_lint(sess, lint_store, tcx.registered_tools(()), lint_check_node, crate_name);
+ pre_expansion_lint(
+ sess,
+ features,
+ lint_store,
+ tcx.registered_tools(()),
+ lint_check_node,
+ crate_name,
+ );
rustc_builtin_macros::register_builtin_macros(resolver);
let num_standard_library_imports = sess.time("crate_injection", || {
@@ -186,6 +171,7 @@ fn configure_and_expand(
pre_configured_attrs,
resolver,
sess,
+ features,
)
});
@@ -225,16 +211,15 @@ fn configure_and_expand(
}
// Create the config for macro expansion
- let features = sess.features_untracked();
let recursion_limit = get_recursion_limit(pre_configured_attrs, sess);
let cfg = rustc_expand::expand::ExpansionConfig {
- features: Some(features),
+ crate_name: crate_name.to_string(),
+ features,
recursion_limit,
trace_mac: sess.opts.unstable_opts.trace_macros,
should_test: sess.is_test_crate(),
span_debug: sess.opts.unstable_opts.span_debug,
proc_macro_backtrace: sess.opts.unstable_opts.proc_macro_backtrace,
- ..rustc_expand::expand::ExpansionConfig::default(crate_name.to_string())
};
let lint_store = LintStoreExpandImpl(lint_store);
@@ -268,14 +253,19 @@ fn configure_and_expand(
});
sess.time("maybe_building_test_harness", || {
- rustc_builtin_macros::test_harness::inject(&mut krate, sess, resolver)
+ rustc_builtin_macros::test_harness::inject(&mut krate, sess, features, resolver)
});
let has_proc_macro_decls = sess.time("AST_validation", || {
- rustc_ast_passes::ast_validation::check_crate(sess, &krate, resolver.lint_buffer())
+ rustc_ast_passes::ast_validation::check_crate(
+ sess,
+ features,
+ &krate,
+ resolver.lint_buffer(),
+ )
});
- let crate_types = sess.crate_types();
+ let crate_types = tcx.crate_types();
let is_executable_crate = crate_types.contains(&CrateType::Executable);
let is_proc_macro_crate = crate_types.contains(&CrateType::ProcMacro);
@@ -297,6 +287,7 @@ fn configure_and_expand(
rustc_builtin_macros::proc_macro_harness::inject(
&mut krate,
sess,
+ features,
resolver,
is_proc_macro_crate,
has_proc_macro_decls,
@@ -327,7 +318,7 @@ fn early_lint_checks(tcx: TyCtxt<'_>, (): ()) {
// Needs to go *after* expansion to be able to check the results of macro expansion.
sess.time("complete_gated_feature_checking", || {
- rustc_ast_passes::feature_gate::check_crate(&krate, sess);
+ rustc_ast_passes::feature_gate::check_crate(&krate, sess, tcx.features());
});
// Add all buffered lints from the `ParseSess` to the `Session`.
@@ -356,6 +347,7 @@ fn early_lint_checks(tcx: TyCtxt<'_>, (): ()) {
let lint_store = unerased_lint_store(tcx);
rustc_lint::check_ast_node(
sess,
+ tcx.features(),
false,
lint_store,
tcx.registered_tools(()),
@@ -367,11 +359,12 @@ fn early_lint_checks(tcx: TyCtxt<'_>, (): ()) {
// Returns all the paths that correspond to generated files.
fn generated_output_paths(
- sess: &Session,
+ tcx: TyCtxt<'_>,
outputs: &OutputFilenames,
exact_name: bool,
crate_name: Symbol,
) -> Vec<PathBuf> {
+ let sess = tcx.sess;
let mut out_filenames = Vec::new();
for output_type in sess.opts.output_types.keys() {
let out_filename = outputs.path(*output_type);
@@ -380,7 +373,7 @@ fn generated_output_paths(
// If the filename has been overridden using `-o`, it will not be modified
// by appending `.rlib`, `.exe`, etc., so we can skip this transformation.
OutputType::Exe if !exact_name => {
- for crate_type in sess.crate_types().iter() {
+ for crate_type in tcx.crate_types().iter() {
let p = filename_for_input(sess, *crate_type, crate_name, outputs);
out_filenames.push(p.as_path().to_path_buf());
}
@@ -613,7 +606,7 @@ fn output_filenames(tcx: TyCtxt<'_>, (): ()) -> Arc<OutputFilenames> {
let outputs = util::build_output_filenames(&krate.attrs, sess);
let output_paths =
- generated_output_paths(sess, &outputs, sess.io.output_file.is_some(), crate_name);
+ generated_output_paths(tcx, &outputs, sess.io.output_file.is_some(), crate_name);
// Ensure the source file isn't accidentally overwritten during compilation.
if let Some(ref input_path) = sess.io.input.opt_path() {
@@ -691,6 +684,8 @@ pub static DEFAULT_EXTERN_QUERY_PROVIDERS: LazyLock<ExternProviders> = LazyLock:
pub fn create_global_ctxt<'tcx>(
compiler: &'tcx Compiler,
+ crate_types: Vec<CrateType>,
+ stable_crate_id: StableCrateId,
lint_store: Lrc<LintStore>,
dep_graph: DepGraph,
untracked: Untracked,
@@ -723,6 +718,8 @@ pub fn create_global_ctxt<'tcx>(
gcx_cell.get_or_init(move || {
TyCtxt::create_global_ctxt(
sess,
+ crate_types,
+ stable_crate_id,
lint_store,
arena,
hir_arena,
@@ -846,10 +843,11 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
},
{
sess.time("lint_checking", || {
- rustc_lint::check_crate(tcx, || {
- rustc_lint::BuiltinCombinedLateLintPass::new()
- });
+ rustc_lint::check_crate(tcx);
});
+ },
+ {
+ tcx.ensure().clashing_extern_declarations(());
}
);
},
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs
index 8c4cdc669..fc71c6c7e 100644
--- a/compiler/rustc_interface/src/queries.rs
+++ b/compiler/rustc_interface/src/queries.rs
@@ -1,23 +1,21 @@
use crate::errors::{FailedWritingFile, RustcErrorFatal, RustcErrorUnexpectedAnnotation};
use crate::interface::{Compiler, Result};
-use crate::passes;
+use crate::{passes, util};
use rustc_ast as ast;
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::CodegenResults;
-use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::steal::Steal;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::{AppendOnlyIndexVec, Lrc, OnceCell, RwLock, WorkerLocal};
-use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE};
+use rustc_hir::def_id::{StableCrateId, CRATE_DEF_ID, LOCAL_CRATE};
use rustc_hir::definitions::Definitions;
use rustc_incremental::DepGraphFuture;
-use rustc_lint::LintStore;
use rustc_metadata::creader::CStore;
use rustc_middle::arena::Arena;
use rustc_middle::dep_graph::DepGraph;
use rustc_middle::ty::{GlobalCtxt, TyCtxt};
-use rustc_session::config::{self, OutputFilenames, OutputType};
+use rustc_session::config::{self, CrateType, OutputFilenames, OutputType};
use rustc_session::cstore::Untracked;
use rustc_session::{output::find_crate_name, Session};
use rustc_span::symbol::sym;
@@ -85,12 +83,8 @@ pub struct Queries<'tcx> {
arena: WorkerLocal<Arena<'tcx>>,
hir_arena: WorkerLocal<rustc_hir::Arena<'tcx>>,
- dep_graph_future: Query<Option<DepGraphFuture>>,
parse: Query<ast::Crate>,
pre_configure: Query<(ast::Crate, ast::AttrVec)>,
- crate_name: Query<Symbol>,
- register_plugins: Query<(ast::Crate, ast::AttrVec, Lrc<LintStore>)>,
- dep_graph: Query<DepGraph>,
// This just points to what's in `gcx_cell`.
gcx: Query<&'tcx GlobalCtxt<'tcx>>,
}
@@ -102,12 +96,8 @@ impl<'tcx> Queries<'tcx> {
gcx_cell: OnceCell::new(),
arena: WorkerLocal::new(|_| Arena::default()),
hir_arena: WorkerLocal::new(|_| rustc_hir::Arena::default()),
- dep_graph_future: Default::default(),
parse: Default::default(),
pre_configure: Default::default(),
- crate_name: Default::default(),
- register_plugins: Default::default(),
- dep_graph: Default::default(),
gcx: Default::default(),
}
}
@@ -119,13 +109,6 @@ impl<'tcx> Queries<'tcx> {
self.compiler.codegen_backend()
}
- fn dep_graph_future(&self) -> Result<QueryResult<'_, Option<DepGraphFuture>>> {
- self.dep_graph_future.compute(|| {
- let sess = self.session();
- Ok(sess.opts.build_dep_graph().then(|| rustc_incremental::load_dep_graph(sess)))
- })
- }
-
pub fn parse(&self) -> Result<QueryResult<'_, ast::Crate>> {
self.parse
.compute(|| passes::parse(self.session()).map_err(|mut parse_error| parse_error.emit()))
@@ -148,75 +131,73 @@ impl<'tcx> Queries<'tcx> {
})
}
- pub fn register_plugins(
+ fn dep_graph_future(
&self,
- ) -> Result<QueryResult<'_, (ast::Crate, ast::AttrVec, Lrc<LintStore>)>> {
- self.register_plugins.compute(|| {
- let crate_name = *self.crate_name()?.borrow();
- let (krate, pre_configured_attrs) = self.pre_configure()?.steal();
-
- let empty: &(dyn Fn(&Session, &mut LintStore) + Sync + Send) = &|_, _| {};
- let lint_store = passes::register_plugins(
- self.session(),
- &*self.codegen_backend().metadata_loader(),
- self.compiler.register_lints.as_deref().unwrap_or_else(|| empty),
- &pre_configured_attrs,
- crate_name,
- )?;
-
- // Compute the dependency graph (in the background). We want to do
- // this as early as possible, to give the DepGraph maximum time to
- // load before dep_graph() is called, but it also can't happen
- // until after rustc_incremental::prepare_session_directory() is
- // called, which happens within passes::register_plugins().
- self.dep_graph_future().ok();
+ crate_name: Symbol,
+ stable_crate_id: StableCrateId,
+ ) -> Result<Option<DepGraphFuture>> {
+ let sess = self.session();
+
+ // `load_dep_graph` can only be called after `prepare_session_directory`.
+ rustc_incremental::prepare_session_directory(sess, crate_name, stable_crate_id)?;
+ let res = sess.opts.build_dep_graph().then(|| rustc_incremental::load_dep_graph(sess));
+
+ if sess.opts.incremental.is_some() {
+ sess.time("incr_comp_garbage_collect_session_directories", || {
+ if let Err(e) = rustc_incremental::garbage_collect_session_directories(sess) {
+ warn!(
+ "Error while trying to garbage collect incremental \
+ compilation cache directory: {}",
+ e
+ );
+ }
+ });
+ }
- Ok((krate, pre_configured_attrs, Lrc::new(lint_store)))
- })
+ Ok(res)
}
- fn crate_name(&self) -> Result<QueryResult<'_, Symbol>> {
- self.crate_name.compute(|| {
- Ok({
- let pre_configure_result = self.pre_configure()?;
- let (_, pre_configured_attrs) = &*pre_configure_result.borrow();
- // parse `#[crate_name]` even if `--crate-name` was passed, to make sure it matches.
- find_crate_name(self.session(), pre_configured_attrs)
+ fn dep_graph(&self, dep_graph_future: Option<DepGraphFuture>) -> DepGraph {
+ dep_graph_future
+ .and_then(|future| {
+ let sess = self.session();
+ let (prev_graph, prev_work_products) =
+ sess.time("blocked_on_dep_graph_loading", || future.open().open(sess));
+ rustc_incremental::build_dep_graph(sess, prev_graph, prev_work_products)
})
- })
- }
-
- fn dep_graph(&self) -> Result<QueryResult<'_, DepGraph>> {
- self.dep_graph.compute(|| {
- let sess = self.session();
- let future_opt = self.dep_graph_future()?.steal();
- let dep_graph = future_opt
- .and_then(|future| {
- let (prev_graph, mut prev_work_products) =
- sess.time("blocked_on_dep_graph_loading", || future.open().open(sess));
- // Convert from UnordMap to FxIndexMap by sorting
- let prev_work_product_ids =
- prev_work_products.items().map(|x| *x.0).into_sorted_stable_ord();
- let prev_work_products = prev_work_product_ids
- .into_iter()
- .map(|x| (x, prev_work_products.remove(&x).unwrap()))
- .collect::<FxIndexMap<_, _>>();
- rustc_incremental::build_dep_graph(sess, prev_graph, prev_work_products)
- })
- .unwrap_or_else(DepGraph::new_disabled);
- Ok(dep_graph)
- })
+ .unwrap_or_else(DepGraph::new_disabled)
}
pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, &'tcx GlobalCtxt<'tcx>>> {
self.gcx.compute(|| {
- let crate_name = *self.crate_name()?.borrow();
- let (krate, pre_configured_attrs, lint_store) = self.register_plugins()?.steal();
-
let sess = self.session();
+ let (krate, pre_configured_attrs) = self.pre_configure()?.steal();
+
+ // parse `#[crate_name]` even if `--crate-name` was passed, to make sure it matches.
+ let crate_name = find_crate_name(sess, &pre_configured_attrs);
+ let crate_types = util::collect_crate_types(sess, &pre_configured_attrs);
+ let stable_crate_id = StableCrateId::new(
+ crate_name,
+ crate_types.contains(&CrateType::Executable),
+ sess.opts.cg.metadata.clone(),
+ sess.cfg_version,
+ );
- let cstore = RwLock::new(Box::new(CStore::new(sess)) as _);
- let definitions = RwLock::new(Definitions::new(sess.local_stable_crate_id()));
+ // Compute the dependency graph (in the background). We want to do this as early as
+ // possible, to give the DepGraph maximum time to load before `dep_graph` is called.
+ let dep_graph_future = self.dep_graph_future(crate_name, stable_crate_id)?;
+
+ let lint_store = Lrc::new(passes::create_lint_store(
+ sess,
+ &*self.codegen_backend().metadata_loader(),
+ self.compiler.register_lints.as_deref(),
+ &pre_configured_attrs,
+ ));
+ let cstore = RwLock::new(Box::new(CStore::new(
+ self.codegen_backend().metadata_loader(),
+ stable_crate_id,
+ )) as _);
+ let definitions = RwLock::new(Definitions::new(stable_crate_id));
let source_span = AppendOnlyIndexVec::new();
let _id = source_span.push(krate.spans.inner_span);
debug_assert_eq!(_id, CRATE_DEF_ID);
@@ -224,8 +205,10 @@ impl<'tcx> Queries<'tcx> {
let qcx = passes::create_global_ctxt(
self.compiler,
+ crate_types,
+ stable_crate_id,
lint_store,
- self.dep_graph()?.steal(),
+ self.dep_graph(dep_graph_future),
untracked,
&self.gcx_cell,
&self.arena,
@@ -237,11 +220,10 @@ impl<'tcx> Queries<'tcx> {
feed.crate_name(crate_name);
let feed = tcx.feed_unit_query();
- feed.crate_for_resolver(tcx.arena.alloc(Steal::new((krate, pre_configured_attrs))));
- feed.metadata_loader(
- tcx.arena.alloc(Steal::new(self.codegen_backend().metadata_loader())),
+ feed.features_query(
+ tcx.arena.alloc(rustc_expand::config::features(sess, &pre_configured_attrs)),
);
- feed.features_query(tcx.sess.features_untracked());
+ feed.crate_for_resolver(tcx.arena.alloc(Steal::new((krate, pre_configured_attrs))));
});
Ok(qcx)
})
@@ -303,7 +285,7 @@ impl<'tcx> Queries<'tcx> {
let (crate_hash, prepare_outputs, dep_graph) = self.global_ctxt()?.enter(|tcx| {
(
- if tcx.sess.needs_crate_hash() { Some(tcx.crate_hash(LOCAL_CRATE)) } else { None },
+ if tcx.needs_crate_hash() { Some(tcx.crate_hash(LOCAL_CRATE)) } else { None },
tcx.output_filenames(()).clone(),
tcx.dep_graph.clone(),
)
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs
index 09141afd1..e3d66d183 100644
--- a/compiler/rustc_interface/src/tests.rs
+++ b/compiler/rustc_interface/src/tests.rs
@@ -67,6 +67,7 @@ fn mk_session(handler: &mut EarlyErrorHandler, matches: getopts::Matches) -> (Se
None,
None,
"",
+ None,
);
(sess, cfg)
}
@@ -714,6 +715,7 @@ fn test_unstable_options_tracking_hash() {
untracked!(perf_stats, true);
// `pre_link_arg` is omitted because it just forwards to `pre_link_args`.
untracked!(pre_link_args, vec![String::from("abc"), String::from("def")]);
+ untracked!(print_codegen_stats, true);
untracked!(print_llvm_passes, true);
untracked!(print_mono_items, Some(String::from("abc")));
untracked!(print_type_sizes, true);
@@ -738,6 +740,7 @@ fn test_unstable_options_tracking_hash() {
untracked!(unstable_options, true);
untracked!(validate_mir, true);
untracked!(verbose, true);
+ untracked!(write_long_types_to_disk, false);
// tidy-alphabetical-end
macro_rules! tracked {
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs
index 035ea2414..ad35dbbc8 100644
--- a/compiler/rustc_interface/src/util.rs
+++ b/compiler/rustc_interface/src/util.rs
@@ -70,6 +70,7 @@ pub fn create_session(
Box<dyn FnOnce(&config::Options) -> Box<dyn CodegenBackend> + Send>,
>,
descriptions: Registry,
+ ice_file: Option<PathBuf>,
) -> (Session, Box<dyn CodegenBackend>) {
let codegen_backend = if let Some(make_codegen_backend) = make_codegen_backend {
make_codegen_backend(&sopts)
@@ -111,6 +112,7 @@ pub fn create_session(
file_loader,
target_override,
rustc_version_str().unwrap_or("unknown"),
+ ice_file,
);
codegen_backend.init(&sess);
@@ -517,7 +519,8 @@ fn multiple_output_types_to_stdout(
output_types: &OutputTypes,
single_output_file_is_stdout: bool,
) -> bool {
- if atty::is(atty::Stream::Stdout) {
+ use std::io::IsTerminal;
+ if std::io::stdout().is_terminal() {
// If stdout is a tty, check if multiple text output types are
// specified by `--emit foo=- --emit bar=-` or `-o - --emit foo,bar`
let named_text_types = output_types