Skip to content

Commit 537aac5

Browse files
committedDec 25, 2023
Remove movability from TyKind::Coroutine
1 parent 71696e5 commit 537aac5

File tree

84 files changed

+212
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+212
-220
lines changed
 

‎compiler/rustc_borrowck/src/diagnostics/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
370370
ty::Array(ty, _) | ty::Slice(ty) => {
371371
self.describe_field_from_ty(ty, field, variant_index, including_tuple_field)
372372
}
373-
ty::Closure(def_id, _) | ty::Coroutine(def_id, _, _) => {
373+
ty::Closure(def_id, _) | ty::Coroutine(def_id, _) => {
374374
// We won't be borrowck'ing here if the closure came from another crate,
375375
// so it's safe to call `expect_local`.
376376
//
@@ -783,8 +783,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
783783

784784
debug!("move_spans: moved_place={:?} location={:?} stmt={:?}", moved_place, location, stmt);
785785
if let StatementKind::Assign(box (_, Rvalue::Aggregate(kind, places))) = &stmt.kind
786-
&& let AggregateKind::Closure(def_id, _) | AggregateKind::Coroutine(def_id, _, _) =
787-
**kind
786+
&& let AggregateKind::Closure(def_id, _) | AggregateKind::Coroutine(def_id, _) = **kind
788787
{
789788
debug!("move_spans: def_id={:?} places={:?}", def_id, places);
790789
let def_id = def_id.expect_local();
@@ -919,7 +918,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
919918
if let StatementKind::Assign(box (_, Rvalue::Aggregate(kind, places))) = &stmt.kind {
920919
let (&def_id, is_coroutine) = match kind {
921920
box AggregateKind::Closure(def_id, _) => (def_id, false),
922-
box AggregateKind::Coroutine(def_id, _, _) => (def_id, true),
921+
box AggregateKind::Coroutine(def_id, _) => (def_id, true),
923922
_ => continue,
924923
};
925924
let def_id = def_id.expect_local();

‎compiler/rustc_borrowck/src/lib.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,12 @@ fn do_mir_borrowck<'tcx>(
274274
// The first argument is the coroutine type passed by value
275275
if let Some(local) = body.local_decls.raw.get(1)
276276
// Get the interior types and args which typeck computed
277-
&& let ty::Coroutine(_, _, hir::Movability::Static) = local.ty.kind()
277+
&& let ty::Coroutine(def_id, _) = *local.ty.kind()
278+
&& tcx.movability(def_id) == hir::Movability::Movable
278279
{
279-
false
280-
} else {
281280
true
281+
} else {
282+
false
282283
};
283284

284285
for (idx, move_data) in promoted_move_data {
@@ -1306,7 +1307,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13061307
// moved into the closure and subsequently used by the closure,
13071308
// in order to populate our used_mut set.
13081309
match **aggregate_kind {
1309-
AggregateKind::Closure(def_id, _) | AggregateKind::Coroutine(def_id, _, _) => {
1310+
AggregateKind::Closure(def_id, _) | AggregateKind::Coroutine(def_id, _) => {
13101311
let def_id = def_id.expect_local();
13111312
let BorrowCheckResult { used_mut_upvars, .. } =
13121313
self.infcx.tcx.mir_borrowck(def_id);
@@ -1612,7 +1613,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16121613
| ty::FnPtr(_)
16131614
| ty::Dynamic(_, _, _)
16141615
| ty::Closure(_, _)
1615-
| ty::Coroutine(_, _, _)
1616+
| ty::Coroutine(_, _)
16161617
| ty::CoroutineWitness(..)
16171618
| ty::Never
16181619
| ty::Tuple(_)
@@ -1636,7 +1637,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16361637
return;
16371638
}
16381639
}
1639-
ty::Closure(_, _) | ty::Coroutine(_, _, _) | ty::Tuple(_) => (),
1640+
ty::Closure(_, _) | ty::Coroutine(_, _) | ty::Tuple(_) => (),
16401641
ty::Bool
16411642
| ty::Char
16421643
| ty::Int(_)

0 commit comments

Comments
 (0)