eagerly compute sub_relations again

This commit is contained in:
lcnr
2025-08-27 10:03:47 +02:00
parent f099b241e2
commit 67965f817d
15 changed files with 152 additions and 111 deletions

View File

@@ -126,13 +126,12 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
}
ty::PredicateKind::Subtype(ty::SubtypePredicate { a, b, .. })
| ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) => {
if self.shallow_resolve(a).is_ty_var() && self.shallow_resolve(b).is_ty_var() {
// FIXME: We also need to register a subtype relation between these vars
// when those are added, and if they aren't in the same sub root then
// we should mark this goal as `has_changed`.
Some(Certainty::AMBIGUOUS)
} else {
None
match (self.shallow_resolve(a).kind(), self.shallow_resolve(b).kind()) {
(&ty::Infer(ty::TyVar(a_vid)), &ty::Infer(ty::TyVar(b_vid))) => {
self.sub_ty_vids_raw(a_vid, b_vid);
Some(Certainty::AMBIGUOUS)
}
_ => None,
}
}
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, _)) => {