1
Fork 0

Rollup merge of #120746 - compiler-errors:kind-ty, r=oli-obk

Record coroutine kind in coroutine generics

Oops, added a new substitution (the "kind" ty) to coroutines but forgot to record it in the `generics_of`. I'm surprised I left this out of the coroutine-closure PR -- I thought I made this change; I possibly rebased it out by accident.

Fixes #120732

r? oli-obk
This commit is contained in:
Guillaume Boisseau 2024-02-07 18:24:46 +01:00 committed by GitHub
commit b715d9303e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 4 deletions

View file

@ -765,7 +765,14 @@ fn polymorphize<'tcx>(
let def_id = instance.def_id();
let upvars_ty = match tcx.type_of(def_id).skip_binder().kind() {
ty::Closure(..) => Some(args.as_closure().tupled_upvars_ty()),
ty::Coroutine(..) => Some(args.as_coroutine().tupled_upvars_ty()),
ty::Coroutine(..) => {
assert_eq!(
args.as_coroutine().kind_ty(),
tcx.types.unit,
"polymorphization does not support coroutines from async closures"
);
Some(args.as_coroutine().tupled_upvars_ty())
}
_ => None,
};
let has_upvars = upvars_ty.is_some_and(|ty| !ty.tuple_fields().is_empty());