Try not to make obligations in handle_opaque_type

This commit is contained in:
Michael Goulet
2024-06-07 11:51:03 -04:00
parent 4efb13b0c2
commit e4be97cfe7
6 changed files with 74 additions and 91 deletions

View File

@@ -21,11 +21,12 @@ impl<'tcx> InferCtxt<'tcx> {
obligations: &mut Vec<PredicateObligation<'tcx>>,
) -> Ty<'tcx> {
debug_assert!(!self.next_trait_solver());
let def_id = projection_ty.def_id;
let ty_var = self.next_ty_var(self.tcx.def_span(def_id));
let projection = ty::Binder::dummy(ty::PredicateKind::Clause(ty::ClauseKind::Projection(
ty::ProjectionPredicate { projection_term: projection_ty.into(), term: ty_var.into() },
)));
let ty_var = self.next_ty_var(self.tcx.def_span(projection_ty.def_id));
let projection =
ty::PredicateKind::Clause(ty::ClauseKind::Projection(ty::ProjectionPredicate {
projection_term: projection_ty.into(),
term: ty_var.into(),
}));
let obligation =
Obligation::with_depth(self.tcx, cause, recursion_depth, param_env, projection);
obligations.push(obligation);