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

@ -1042,13 +1042,15 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
}
hir::ExprKind::Closure(hir::Closure {
capture_clause: hir::CaptureBy::Ref,
body,
kind,
..
}) => {
let body = map.body(*body);
if !matches!(
body.coroutine_kind,
Some(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _))
kind,
hir::ClosureKind::Coroutine(
hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _),
_
)
) {
closure_span = Some(expr.span.shrink_to_lo());
}