clean up ADT sized constraint computation

This commit is contained in:
Lukas Markeffsky 2024-03-13 23:33:45 +01:00
parent 0e7e1bfdbc
commit 8ad94111ad
8 changed files with 90 additions and 92 deletions

View file

@ -2120,11 +2120,9 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
ty::Adt(def, args) => {
let sized_crit = def.sized_constraint(self.tcx());
// (*) binder moved here
Where(
obligation
.predicate
.rebind(sized_crit.iter_instantiated(self.tcx(), args).collect()),
)
Where(obligation.predicate.rebind(
sized_crit.map_or_else(Vec::new, |ty| vec![ty.instantiate(self.tcx(), args)]),
))
}
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) => None,