Skip to content

Commit

Permalink
Rollup merge of rust-lang#117439 - lcnr:prepopulate-earlier, r=compil…
Browse files Browse the repository at this point in the history
…er-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 rust-lang#117278 and once we stop allowing the definition of new opaques in MIR typeck

r? `@compiler-errors`
  • Loading branch information
matthiaskrgr authored Oct 31, 2023
2 parents 290daf9 + 078144e commit 86d69f9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 86d69f9

Please sign in to comment.