Rollup merge of #114079 - compiler-errors:closure-upvars, r=oli-obk

Use `upvar_tys` in more places, make it return a list

Just a cleanup that fell out of a PR that I was gonna write, but that PR kinda got stuck.
This commit is contained in:
Nilstrieb 2023-08-02 13:46:54 +02:00 committed by GitHub
commit 46f6b05eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 66 additions and 78 deletions

View file

@ -2169,7 +2169,8 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
let all = args
.as_generator()
.upvar_tys()
.chain(iter::once(args.as_generator().witness()))
.iter()
.chain([args.as_generator().witness()])
.collect::<Vec<_>>();
Where(obligation.predicate.rebind(all))
}
@ -2210,7 +2211,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
// Not yet resolved.
Ambiguous
} else {
Where(obligation.predicate.rebind(args.as_closure().upvar_tys().collect()))
Where(obligation.predicate.rebind(args.as_closure().upvar_tys().to_vec()))
}
}