about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-15 01:31:56 +0000
committerbors <bors@rust-lang.org>2023-08-15 01:31:56 +0000
commitffaa32b7b646c208f20c827655bb98ff9868852e (patch)
treea631a0e56dcd1d809cdf5ae2ff1c8451ecbb6537
parent3276b29ddbe080946d3a4813c13ce1785c2f1c30 (diff)
parent223c43b154690d6368a26faa1dfc68d9a70cb5a0 (diff)
downloadrust-ffaa32b7b646c208f20c827655bb98ff9868852e.tar.gz
rust-ffaa32b7b646c208f20c827655bb98ff9868852e.zip
Auto merge of #114803 - bjorn3:less_session_mutable_state, r=fee1-dead
Couple of global state and driver refactors

* Remove some unused global mutable state
* Remove a couple of unnecessary queries (both driver and `TyCtxt` queries)
* Remove an unnecessary use of `FxIndexMap`
-rw-r--r--compiler/rustc_incremental/src/persist/load.rs4
-rw-r--r--compiler/rustc_incremental/src/persist/save.rs8
-rw-r--r--compiler/rustc_interface/src/queries.rs82
-rw-r--r--compiler/rustc_metadata/src/creader.rs16
-rw-r--r--compiler/rustc_middle/src/arena.rs1
-rw-r--r--compiler/rustc_middle/src/dep_graph/mod.rs2
-rw-r--r--compiler/rustc_middle/src/query/mod.rs6
-rw-r--r--compiler/rustc_parse/src/lexer/mod.rs1
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs13
-rw-r--r--compiler/rustc_passes/src/entry.rs6
-rw-r--r--compiler/rustc_query_system/src/dep_graph/graph.rs10
-rw-r--r--compiler/rustc_query_system/src/dep_graph/mod.rs2
-rw-r--r--compiler/rustc_session/src/parse.rs5
13 files changed, 50 insertions, 106 deletions
diff --git a/compiler/rustc_incremental/src/persist/load.rs b/compiler/rustc_incremental/src/persist/load.rs
index bb479b5bdcc..8d67f692568 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<WorkProductId, WorkProduct>;
-
 #[derive(Debug)]
 /// Represents the result of an attempt to load incremental compilation data.
 pub enum LoadResult<T> {
diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs
index bfaa52f9c81..0cfaf583774 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<WorkProductId, WorkProduct>,
+    prev_work_products: WorkProductMap,
 ) -> Option<DepGraph> {
     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 5d38cf770a2..fc71c6c7e9a 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};
@@ -86,9 +85,6 @@ pub struct Queries<'tcx> {
 
     parse: Query<ast::Crate>,
     pre_configure: Query<(ast::Crate, ast::AttrVec)>,
-    crate_name: Query<Symbol>,
-    crate_types: Query<Vec<CrateType>>,
-    stable_crate_id: Query<StableCrateId>,
     // This just points to what's in `gcx_cell`.
     gcx: Query<&'tcx GlobalCtxt<'tcx>>,
 }
@@ -102,9 +98,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 +131,12 @@ impl<'tcx> Queries<'tcx> {
         })
     }
 
-    fn crate_name(&self) -> Result<QueryResult<'_, Symbol>> {
-        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<QueryResult<'_, Vec<CrateType>>> {
-        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<QueryResult<'_, StableCrateId>> {
-        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<Option<DepGraphFuture>> {
+    fn dep_graph_future(
+        &self,
+        crate_name: Symbol,
+        stable_crate_id: StableCrateId,
+    ) -> Result<Option<DepGraphFuture>> {
         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)?;
@@ -195,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::<FxIndexMap<_, _>>();
                 rustc_incremental::build_dep_graph(sess, prev_graph, prev_work_products)
             })
             .unwrap_or_else(DepGraph::new_disabled)
@@ -211,23 +170,33 @@ impl<'tcx> Queries<'tcx> {
 
     pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, &'tcx GlobalCtxt<'tcx>>> {
         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(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,
+            );
+
             // 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 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 dep_graph_future = self.dep_graph_future(crate_name, stable_crate_id)?;
 
-            let sess = self.session();
             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(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);
@@ -255,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 3c76f9a8e52..fce80ab37dd 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<MetadataLoaderDyn>,
+
     metas: IndexVec<CrateNum, Option<Box<CrateMetadata>>>,
     injected_panic_runtime: Option<CrateNum>,
     /// 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<MetadataLoaderDyn>,
+        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 b056ae420ab..952c796f52e 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<rustc_ast::Crate>,
             )>,
             [] output_filenames: std::sync::Arc<rustc_session::config::OutputFilenames>,
-            [] metadata_loader: rustc_data_structures::steal::Steal<Box<rustc_session::cstore::MetadataLoaderDyn>>,
             [] 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/dep_graph/mod.rs b/compiler/rustc_middle/src/dep_graph/mod.rs
index 3ad9b0d79e7..f79ce08b8ae 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_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 52a18c99edb..5af77c6c4cb 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<Box<rustc_session::cstore::MetadataLoaderDyn>> {
-        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
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs
index 1931ee5e528..a375a1d69cd 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 c5b46b809b1..ce4d4a60551 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<UnmatchedDelim>, 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 6a29159e917..4f71704b885 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_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs
index 3803f7eca0a..30422ea1102 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<K: DepKind> {
     /// 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<WorkProductId, WorkProduct>,
+    previous_work_products: WorkProductMap,
 
     dep_node_debug: Lock<FxHashMap<DepNode<K>, String>>,
 
@@ -116,7 +116,7 @@ impl<K: DepKind> DepGraph<K> {
     pub fn new(
         profiler: &SelfProfilerRef,
         prev_graph: SerializedDepGraph<K>,
-        prev_work_products: FxIndexMap<WorkProductId, WorkProduct>,
+        prev_work_products: WorkProductMap,
         encoder: FileEncoder,
         record_graph: bool,
         record_stats: bool,
@@ -688,7 +688,7 @@ impl<K: DepKind> DepGraph<K> {
 
     /// 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<WorkProductId, WorkProduct> {
+    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<String, String>,
 }
 
+pub type WorkProductMap = UnordMap<WorkProductId, WorkProduct>;
+
 // 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 40e7131987f..0fd9e35d6dc 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};
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs
index bca49981668..1cf63e9b7ba 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<FxHashMap<Span, Span>>,
     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<FxHashSet<(Symbol, Option<Symbol>)>>,
     /// 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,