about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-11-03 20:14:51 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-12-14 14:24:49 +0000
commit954cd79cedaf5463f47fbac9967e8f5513d033d5 (patch)
tree22a72168fca4ea7defb79ce293d754b4a6a2bd79 /compiler/rustc_middle
parent87802536f4abb1792994becc5bd66110fe5db8fa (diff)
downloadrust-954cd79cedaf5463f47fbac9967e8f5513d033d5.tar.gz
rust-954cd79cedaf5463f47fbac9967e8f5513d033d5.zip
Move GlobalCtxt::finish to TyCtxt
This allows us to call GlobalCtxt::finish exactly once.
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/context.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index db1a479f580..29cf2e874a8 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -1374,19 +1374,6 @@ impl<'tcx> GlobalCtxt<'tcx> {
 
         tls::enter_context(&icx, || f(icx.tcx))
     }
-
-    pub fn finish(&'tcx self) {
-        // We assume that no queries are run past here. If there are new queries
-        // after this point, they'll show up as "<unknown>" in self-profiling data.
-        self.enter(|tcx| tcx.alloc_self_profile_query_strings());
-
-        self.enter(|tcx| tcx.save_dep_graph());
-        self.enter(|tcx| tcx.query_key_hash_verify_all());
-
-        if let Err((path, error)) = self.dep_graph.finish_encoding() {
-            self.sess.dcx().emit_fatal(crate::error::FailedWritingFile { path: &path, error });
-        }
-    }
 }
 
 /// This is used to get a reference to a `GlobalCtxt` if one is available.
@@ -2120,6 +2107,19 @@ impl<'tcx> TyCtxt<'tcx> {
     pub fn local_opaque_ty_origin(self, def_id: LocalDefId) -> hir::OpaqueTyOrigin<LocalDefId> {
         self.hir().expect_opaque_ty(def_id).origin
     }
+
+    pub fn finish(self) {
+        // We assume that no queries are run past here. If there are new queries
+        // after this point, they'll show up as "<unknown>" in self-profiling data.
+        self.alloc_self_profile_query_strings();
+
+        self.save_dep_graph();
+        self.query_key_hash_verify_all();
+
+        if let Err((path, error)) = self.dep_graph.finish_encoding() {
+            self.sess.dcx().emit_fatal(crate::error::FailedWritingFile { path: &path, error });
+        }
+    }
 }
 
 macro_rules! nop_lift {