about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-10-31 19:03:22 +0100
committerGitHub <noreply@github.com>2023-10-31 19:03:22 +0100
commit86d69f998710dd523e013d8593aa92b941ab6d54 (patch)
treee6eedefbd26b1c16c0e5c3ff4c548142fae81882
parent290daf93181a5c0acd5bc16a016bf3e2be551cfe (diff)
parent078144e3e893ef1e52eb6bfa909777ece444dedf (diff)
downloadrust-86d69f998710dd523e013d8593aa92b941ab6d54.tar.gz
rust-86d69f998710dd523e013d8593aa92b941ab6d54.zip
Rollup merge of #117439 - lcnr:prepopulate-earlier, r=compiler-errors
prepopulate opaque ty storage before using it

doesn't have any significant impact rn afaict, as we freely define new opaque types during MIR typeck.

It will be relevant with #117278 and once we stop allowing the definition of new opaques in MIR typeck

r? `@compiler-errors`
-rw-r--r--compiler/rustc_borrowck/src/type_check/mod.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index 8477686d4f5..9f30d9d8ba1 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -188,11 +188,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
         &mut borrowck_context,
     );
 
-    // FIXME(-Ztrait-solver=next): A bit dubious that we're only registering
-    // predefined opaques in the typeck root.
-    if infcx.next_trait_solver() && !infcx.tcx.is_typeck_child(body.source.def_id()) {
-        checker.register_predefined_opaques_in_new_solver();
-    }
+    checker.check_user_type_annotations();
 
     let mut verifier = TypeVerifier::new(&mut checker, promoted);
     verifier.visit_body(&body);
@@ -1021,7 +1017,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
             borrowck_context,
             reported_errors: Default::default(),
         };
-        checker.check_user_type_annotations();
+
+        // FIXME(-Ztrait-solver=next): A bit dubious that we're only registering
+        // predefined opaques in the typeck root.
+        if infcx.next_trait_solver() && !infcx.tcx.is_typeck_child(body.source.def_id()) {
+            checker.register_predefined_opaques_in_new_solver();
+        }
+
         checker
     }