switch new solver to directly inject opaque types

This commit is contained in:
lcnr 2024-05-06 16:19:32 +00:00
parent 24ee32cf70
commit 5714c1f364
2 changed files with 6 additions and 9 deletions

View file

@ -236,7 +236,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
normalization_nested_goals,
} = external_constraints.deref();
self.register_region_constraints(region_constraints);
self.register_new_opaque_types(param_env, opaque_types);
self.register_new_opaque_types(opaque_types);
(normalization_nested_goals.clone(), certainty)
}
@ -368,13 +368,10 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
assert!(region_constraints.member_constraints.is_empty());
}
fn register_new_opaque_types(
&mut self,
param_env: ty::ParamEnv<'tcx>,
opaque_types: &[(ty::OpaqueTypeKey<'tcx>, Ty<'tcx>)],
) {
fn register_new_opaque_types(&mut self, opaque_types: &[(ty::OpaqueTypeKey<'tcx>, Ty<'tcx>)]) {
for &(key, ty) in opaque_types {
self.insert_hidden_type(key, param_env, ty).unwrap();
let hidden_ty = ty::OpaqueHiddenType { ty, span: DUMMY_SP };
self.infcx.inject_new_hidden_type_unchecked(key, hidden_ty);
}
}
}

View file

@ -248,8 +248,8 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
};
for &(key, ty) in &input.predefined_opaques_in_body.opaque_types {
ecx.insert_hidden_type(key, input.goal.param_env, ty)
.expect("failed to prepopulate opaque types");
let hidden_ty = ty::OpaqueHiddenType { ty, span: DUMMY_SP };
ecx.infcx.inject_new_hidden_type_unchecked(key, hidden_ty);
}
if !ecx.nested_goals.is_empty() {