From ef2da4a49b95ff83c232c04c3df1e02244cedd82 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 13 Aug 2023 11:30:48 +0000 Subject: [PATCH 1/5] Remove reached_eof from ParseSess It was only ever set in a function which isn't called anywhere. --- compiler/rustc_parse/src/lexer/mod.rs | 1 - compiler/rustc_parse/src/parser/mod.rs | 13 ------------- compiler/rustc_passes/src/entry.rs | 6 ------ compiler/rustc_session/src/parse.rs | 5 +---- 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index 1931ee5e528dd..a375a1d69cdea 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -74,7 +74,6 @@ pub(crate) fn parse_token_trees<'a>( // because the delimiter mismatch is more likely to be the root cause of error let mut buffer = Vec::with_capacity(1); - // Not using `emit_unclosed_delims` to use `db.buffer` for unmatched in unmatched_delims { if let Some(err) = make_unclosed_delims_error(unmatched, &sess) { err.buffer(&mut buffer); diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index c5b46b809b1b1..ce4d4a605510b 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -29,7 +29,6 @@ use rustc_ast::{Async, AttrArgs, AttrArgsEq, Expr, ExprKind, Mutability, StrLit} use rustc_ast::{HasAttrs, HasTokens, Unsafe, Visibility, VisibilityKind}; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::sync::Ordering; use rustc_errors::PResult; use rustc_errors::{ Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError, IntoDiagnostic, MultiSpan, @@ -1455,18 +1454,6 @@ pub(crate) fn make_unclosed_delims_error( Some(err) } -pub fn emit_unclosed_delims(unclosed_delims: &mut Vec, sess: &ParseSess) { - let _ = sess.reached_eof.fetch_or( - unclosed_delims.iter().any(|unmatched_delim| unmatched_delim.found_delim.is_none()), - Ordering::Relaxed, - ); - for unmatched in unclosed_delims.drain(..) { - if let Some(mut e) = make_unclosed_delims_error(unmatched, sess) { - e.emit(); - } - } -} - /// A helper struct used when building an `AttrTokenStream` from /// a `LazyAttrTokenStream`. Both delimiter and non-delimited tokens /// are stored as `FlatToken::Token`. A vector of `FlatToken`s diff --git a/compiler/rustc_passes/src/entry.rs b/compiler/rustc_passes/src/entry.rs index 6a29159e91787..4f71704b8853d 100644 --- a/compiler/rustc_passes/src/entry.rs +++ b/compiler/rustc_passes/src/entry.rs @@ -187,12 +187,6 @@ fn sigpipe(tcx: TyCtxt<'_>, def_id: DefId) -> u8 { fn no_main_err(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) { let sp = tcx.def_span(CRATE_DEF_ID); - if tcx.sess.parse_sess.reached_eof.load(rustc_data_structures::sync::Ordering::Relaxed) { - // There's an unclosed brace that made the parser reach `Eof`, we shouldn't complain about - // the missing `fn main()` then as it might have been hidden inside an unclosed block. - tcx.sess.delay_span_bug(sp, "`main` not found, but expected unclosed brace error"); - return; - } // There is no main function. let mut has_filename = true; diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index bca49981668ec..1cf63e9b7ba74 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -8,7 +8,7 @@ use crate::lint::{ }; use rustc_ast::node_id::NodeId; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; -use rustc_data_structures::sync::{AppendOnlyVec, AtomicBool, Lock, Lrc}; +use rustc_data_structures::sync::{AppendOnlyVec, Lock, Lrc}; use rustc_errors::{emitter::SilentEmitter, Handler}; use rustc_errors::{ fallback_fluent_bundle, Diagnostic, DiagnosticBuilder, DiagnosticId, DiagnosticMessage, @@ -204,8 +204,6 @@ pub struct ParseSess { pub ambiguous_block_expr_parse: Lock>, pub gated_spans: GatedSpans, pub symbol_gallery: SymbolGallery, - /// The parser has reached `Eof` due to an unclosed brace. Used to silence unnecessary errors. - pub reached_eof: AtomicBool, /// Environment variables accessed during the build and their values when they exist. pub env_depinfo: Lock)>>, /// File paths accessed during the build. @@ -242,7 +240,6 @@ impl ParseSess { ambiguous_block_expr_parse: Lock::new(FxHashMap::default()), gated_spans: GatedSpans::default(), symbol_gallery: SymbolGallery::default(), - reached_eof: AtomicBool::new(false), env_depinfo: Default::default(), file_depinfo: Default::default(), assume_incomplete_release: false, From 4a6de8e0dd6d6bf805160fca11ed661c00a5c310 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:27:44 +0000 Subject: [PATCH 2/5] Inline queries for crate_name, crate_types and stable_crate_id All of them are not exported from rustc_interface and used only during global_ctxt(). Inlining them makes it easier to follow the order of queries and slightly reduces line count. --- compiler/rustc_interface/src/queries.rs | 64 ++++++++----------------- 1 file changed, 19 insertions(+), 45 deletions(-) diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 5d38cf770a2f2..18d85f0746fcc 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -86,9 +86,6 @@ pub struct Queries<'tcx> { parse: Query, pre_configure: Query<(ast::Crate, ast::AttrVec)>, - crate_name: Query, - crate_types: Query>, - stable_crate_id: Query, // This just points to what's in `gcx_cell`. gcx: Query<&'tcx GlobalCtxt<'tcx>>, } @@ -102,9 +99,6 @@ impl<'tcx> Queries<'tcx> { hir_arena: WorkerLocal::new(|_| rustc_hir::Arena::default()), parse: Default::default(), pre_configure: Default::default(), - crate_name: Default::default(), - crate_types: Default::default(), - stable_crate_id: Default::default(), gcx: Default::default(), } } @@ -138,39 +132,12 @@ impl<'tcx> Queries<'tcx> { }) } - fn crate_name(&self) -> Result> { - self.crate_name.compute(|| { - 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. - Ok(find_crate_name(self.session(), pre_configured_attrs)) - }) - } - - fn crate_types(&self) -> Result>> { - self.crate_types.compute(|| { - let pre_configure_result = self.pre_configure()?; - let (_, pre_configured_attrs) = &*pre_configure_result.borrow(); - Ok(util::collect_crate_types(&self.session(), &pre_configured_attrs)) - }) - } - - fn stable_crate_id(&self) -> Result> { - self.stable_crate_id.compute(|| { - let sess = self.session(); - Ok(StableCrateId::new( - *self.crate_name()?.borrow(), - self.crate_types()?.borrow().contains(&CrateType::Executable), - sess.opts.cg.metadata.clone(), - sess.cfg_version, - )) - }) - } - - fn dep_graph_future(&self) -> Result> { + fn dep_graph_future( + &self, + crate_name: Symbol, + stable_crate_id: StableCrateId, + ) -> Result> { let sess = self.session(); - let crate_name = *self.crate_name()?.borrow(); - let stable_crate_id = *self.stable_crate_id()?.borrow(); // `load_dep_graph` can only be called after `prepare_session_directory`. rustc_incremental::prepare_session_directory(sess, crate_name, stable_crate_id)?; @@ -211,16 +178,23 @@ impl<'tcx> Queries<'tcx> { pub fn global_ctxt(&'tcx self) -> Result>> { self.gcx.compute(|| { + 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(self.session(), &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, + ); + // 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()?; + let dep_graph_future = self.dep_graph_future(crate_name, stable_crate_id)?; - let crate_name = self.crate_name()?.steal(); - let crate_types = self.crate_types()?.steal(); - let stable_crate_id = self.stable_crate_id()?.steal(); - let (krate, pre_configured_attrs) = self.pre_configure()?.steal(); - - let sess = self.session(); let lint_store = Lrc::new(passes::create_lint_store( sess, &*self.codegen_backend().metadata_loader(), From 980143b50c627fc36ef15a2dc25f44f33cbd6bac Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 13 Aug 2023 16:07:41 +0000 Subject: [PATCH 3/5] Pass WorkProductMap to build_dep_graph instead of FxIndexMap Constructing an FxIndexMap is useless work as the iteration order never matters. --- compiler/rustc_incremental/src/persist/load.rs | 4 +--- compiler/rustc_incremental/src/persist/save.rs | 8 +++++--- compiler/rustc_interface/src/queries.rs | 10 +--------- compiler/rustc_middle/src/dep_graph/mod.rs | 2 +- compiler/rustc_query_system/src/dep_graph/graph.rs | 10 ++++++---- compiler/rustc_query_system/src/dep_graph/mod.rs | 2 +- 6 files changed, 15 insertions(+), 21 deletions(-) diff --git a/compiler/rustc_incremental/src/persist/load.rs b/compiler/rustc_incremental/src/persist/load.rs index bb479b5bdccda..8d67f69256879 100644 --- a/compiler/rustc_incremental/src/persist/load.rs +++ b/compiler/rustc_incremental/src/persist/load.rs @@ -3,7 +3,7 @@ use crate::errors; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::unord::UnordMap; -use rustc_middle::dep_graph::{SerializedDepGraph, WorkProduct, WorkProductId}; +use rustc_middle::dep_graph::{SerializedDepGraph, WorkProductMap}; use rustc_middle::query::on_disk_cache::OnDiskCache; use rustc_serialize::opaque::MemDecoder; use rustc_serialize::Decodable; @@ -16,8 +16,6 @@ use super::file_format; use super::fs::*; use super::work_product; -type WorkProductMap = UnordMap; - #[derive(Debug)] /// Represents the result of an attempt to load incremental compilation data. pub enum LoadResult { diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs index bfaa52f9c8134..0cfaf5837742e 100644 --- a/compiler/rustc_incremental/src/persist/save.rs +++ b/compiler/rustc_incremental/src/persist/save.rs @@ -1,7 +1,9 @@ use crate::errors; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::sync::join; -use rustc_middle::dep_graph::{DepGraph, SerializedDepGraph, WorkProduct, WorkProductId}; +use rustc_middle::dep_graph::{ + DepGraph, SerializedDepGraph, WorkProduct, WorkProductId, WorkProductMap, +}; use rustc_middle::ty::TyCtxt; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; use rustc_serialize::Encodable as RustcEncodable; @@ -101,7 +103,7 @@ pub fn save_work_product_index( // deleted during invalidation. Some object files don't change their // content, they are just not needed anymore. let previous_work_products = dep_graph.previous_work_products(); - for (id, wp) in previous_work_products.iter() { + for (id, wp) in previous_work_products.to_sorted_stable_ord().iter() { if !new_work_products.contains_key(id) { work_product::delete_workproduct_files(sess, wp); debug_assert!( @@ -146,7 +148,7 @@ fn encode_query_cache(tcx: TyCtxt<'_>, encoder: FileEncoder) -> FileEncodeResult pub fn build_dep_graph( sess: &Session, prev_graph: SerializedDepGraph, - prev_work_products: FxIndexMap, + prev_work_products: WorkProductMap, ) -> Option { if sess.opts.incremental.is_none() { // No incremental compilation. diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 18d85f0746fcc..a20a99b611e29 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -5,7 +5,6 @@ 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}; @@ -162,15 +161,8 @@ impl<'tcx> Queries<'tcx> { dep_graph_future .and_then(|future| { let sess = self.session(); - let (prev_graph, mut prev_work_products) = + let (prev_graph, 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::>(); rustc_incremental::build_dep_graph(sess, prev_graph, prev_work_products) }) .unwrap_or_else(DepGraph::new_disabled) diff --git a/compiler/rustc_middle/src/dep_graph/mod.rs b/compiler/rustc_middle/src/dep_graph/mod.rs index 3ad9b0d79e794..f79ce08b8aed4 100644 --- a/compiler/rustc_middle/src/dep_graph/mod.rs +++ b/compiler/rustc_middle/src/dep_graph/mod.rs @@ -8,7 +8,7 @@ mod dep_node; pub use rustc_query_system::dep_graph::{ debug::DepNodeFilter, hash_result, DepContext, DepNodeColor, DepNodeIndex, - SerializedDepNodeIndex, WorkProduct, WorkProductId, + SerializedDepNodeIndex, WorkProduct, WorkProductId, WorkProductMap, }; pub use dep_node::{label_strs, DepKind, DepNode, DepNodeExt}; diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 3803f7eca0a29..30422ea110264 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -1,5 +1,5 @@ use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::profiling::{EventId, QueryInvocationId, SelfProfilerRef}; use rustc_data_structures::sharded::{self, Sharded}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; @@ -93,7 +93,7 @@ pub struct DepGraphData { /// things available to us. If we find that they are not dirty, we /// load the path to the file storing those work-products here into /// this map. We can later look for and extract that data. - previous_work_products: FxIndexMap, + previous_work_products: WorkProductMap, dep_node_debug: Lock, String>>, @@ -116,7 +116,7 @@ impl DepGraph { pub fn new( profiler: &SelfProfilerRef, prev_graph: SerializedDepGraph, - prev_work_products: FxIndexMap, + prev_work_products: WorkProductMap, encoder: FileEncoder, record_graph: bool, record_stats: bool, @@ -688,7 +688,7 @@ impl DepGraph { /// Access the map of work-products created during the cached run. Only /// used during saving of the dep-graph. - pub fn previous_work_products(&self) -> &FxIndexMap { + pub fn previous_work_products(&self) -> &WorkProductMap { &self.data.as_ref().unwrap().previous_work_products } @@ -1051,6 +1051,8 @@ pub struct WorkProduct { pub saved_files: UnordMap, } +pub type WorkProductMap = UnordMap; + // Index type for `DepNodeData`'s edges. rustc_index::newtype_index! { struct EdgeIndex {} diff --git a/compiler/rustc_query_system/src/dep_graph/mod.rs b/compiler/rustc_query_system/src/dep_graph/mod.rs index 40e7131987fab..0fd9e35d6dc8d 100644 --- a/compiler/rustc_query_system/src/dep_graph/mod.rs +++ b/compiler/rustc_query_system/src/dep_graph/mod.rs @@ -7,7 +7,7 @@ mod serialized; pub use dep_node::{DepKindStruct, DepNode, DepNodeParams, WorkProductId}; pub use graph::{ hash_result, DepGraph, DepGraphData, DepNodeColor, DepNodeIndex, TaskDeps, TaskDepsRef, - WorkProduct, + WorkProduct, WorkProductMap, }; pub use query::DepGraphQuery; pub use serialized::{SerializedDepGraph, SerializedDepNodeIndex}; From c6247387b4f3795df71866178fab5af1f2253dd6 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 13 Aug 2023 16:35:09 +0000 Subject: [PATCH 4/5] Remove metadata_loader query It is only used by CrateLoader. We can store the metadata loader in CStore instead which CrateLoader has access to. --- compiler/rustc_interface/src/queries.rs | 8 ++++---- compiler/rustc_metadata/src/creader.rs | 16 +++++++++++----- compiler/rustc_middle/src/arena.rs | 1 - compiler/rustc_middle/src/query/mod.rs | 6 ------ 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index a20a99b611e29..6b4a451cd7b31 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -193,7 +193,10 @@ impl<'tcx> Queries<'tcx> { self.compiler.register_lints.as_deref(), &pre_configured_attrs, )); - let cstore = RwLock::new(Box::new(CStore::new(stable_crate_id)) as _); + 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); @@ -221,9 +224,6 @@ impl<'tcx> Queries<'tcx> { tcx.arena.alloc(rustc_expand::config::features(sess, &pre_configured_attrs)), ); 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())), - ); }); Ok(qcx) }) diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 3c76f9a8e52c9..fce80ab37dd1b 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -15,8 +15,9 @@ use rustc_hir::definitions::Definitions; use rustc_index::IndexVec; use rustc_middle::ty::TyCtxt; use rustc_session::config::{self, CrateType, ExternLocation}; -use rustc_session::cstore::ExternCrateSource; -use rustc_session::cstore::{CrateDepKind, CrateSource, ExternCrate}; +use rustc_session::cstore::{ + CrateDepKind, CrateSource, ExternCrate, ExternCrateSource, MetadataLoaderDyn, +}; use rustc_session::lint; use rustc_session::output::validate_crate_name; use rustc_session::search_paths::PathKind; @@ -33,6 +34,8 @@ use std::time::Duration; use std::{cmp, env, iter}; pub struct CStore { + metadata_loader: Box, + metas: IndexVec>>, injected_panic_runtime: Option, /// This crate needs an allocator and either provides it itself, or finds it in a dependency. @@ -261,10 +264,14 @@ impl CStore { } } - pub fn new(local_stable_crate_id: StableCrateId) -> CStore { + pub fn new( + metadata_loader: Box, + local_stable_crate_id: StableCrateId, + ) -> CStore { let mut stable_crate_ids = StableCrateIdMap::default(); stable_crate_ids.insert(local_stable_crate_id, LOCAL_CRATE); CStore { + metadata_loader, // We add an empty entry for LOCAL_CRATE (which maps to zero) in // order to make array indices in `metas` match with the // corresponding `CrateNum`. This first entry will always remain @@ -538,10 +545,9 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { (LoadResult::Previous(cnum), None) } else { info!("falling back to a load"); - let metadata_loader = self.tcx.metadata_loader(()).borrow(); let mut locator = CrateLocator::new( self.sess, - &**metadata_loader, + &*self.cstore.metadata_loader, name, // The all loop is because `--crate-type=rlib --crate-type=rlib` is // legal and produces both inside this type. diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index b056ae420abac..952c796f52e76 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -40,7 +40,6 @@ macro_rules! arena_types { rustc_data_structures::sync::Lrc, )>, [] output_filenames: std::sync::Arc, - [] metadata_loader: rustc_data_structures::steal::Steal>, [] crate_for_resolver: rustc_data_structures::steal::Steal<(rustc_ast::Crate, rustc_ast::AttrVec)>, [] resolutions: rustc_middle::ty::ResolverGlobalCtxt, [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult, diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 52a18c99edb53..5af77c6c4cb7c 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -2096,12 +2096,6 @@ rustc_queries! { desc { "looking up enabled feature gates" } } - query metadata_loader((): ()) -> &'tcx Steal> { - feedable - no_hash - desc { "raw operations for metadata file access" } - } - query crate_for_resolver((): ()) -> &'tcx Steal<(rustc_ast::Crate, rustc_ast::AttrVec)> { feedable no_hash From 223c43b154690d6368a26faa1dfc68d9a70cb5a0 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:16:51 +0000 Subject: [PATCH 5/5] Fix review comment --- compiler/rustc_interface/src/queries.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 6b4a451cd7b31..fc71c6c7e9aa6 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -174,7 +174,7 @@ impl<'tcx> Queries<'tcx> { 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(self.session(), &pre_configured_attrs); + 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,