1
Fork 0

Make closures carry their own ClosureKind, rather than deducing what it is from movability

This commit is contained in:
Michael Goulet 2023-12-22 21:29:12 +00:00
parent 981fc6e174
commit 909dd864f1
20 changed files with 338 additions and 326 deletions

View file

@ -1551,10 +1551,14 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
fn coroutine_kind(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<hir::CoroutineKind> {
match tcx.hir_node_by_def_id(def_id) {
Node::Expr(&rustc_hir::Expr {
kind: rustc_hir::ExprKind::Closure(&rustc_hir::Closure { body, .. }),
Node::Expr(&hir::Expr {
kind:
hir::ExprKind::Closure(&rustc_hir::Closure {
kind: hir::ClosureKind::Coroutine(kind, _),
..
}),
..
}) => tcx.hir().body(body).coroutine_kind(),
}) => Some(kind),
_ => None,
}
}