Skip to content

rustc_public: Remove movability from RigidTy/AggregateKind::Coroutine #144392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions compiler/rustc_public/src/mir/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,7 @@ impl Rvalue {
)),
AggregateKind::Adt(def, _, ref args, _, _) => Ok(def.ty_with_args(args)),
AggregateKind::Closure(def, ref args) => Ok(Ty::new_closure(def, args.clone())),
AggregateKind::Coroutine(def, ref args, mov) => {
Ok(Ty::new_coroutine(def, args.clone(), mov))
}
AggregateKind::Coroutine(def, ref args) => Ok(Ty::new_coroutine(def, args.clone())),
AggregateKind::CoroutineClosure(def, ref args) => {
Ok(Ty::new_coroutine_closure(def, args.clone()))
}
Expand All @@ -674,8 +672,7 @@ pub enum AggregateKind {
Tuple,
Adt(AdtDef, VariantIdx, GenericArgs, Option<UserTypeAnnotationIndex>, Option<FieldIdx>),
Closure(ClosureDef, GenericArgs),
// FIXME(rustc_public): Movability here is redundant
Coroutine(CoroutineDef, GenericArgs, Movability),
Coroutine(CoroutineDef, GenericArgs),
CoroutineClosure(CoroutineClosureDef, GenericArgs),
RawPtr(Ty, Mutability),
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_public/src/mir/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ fn pretty_aggregate<W: Write>(
write!(writer, "{{closure@{}}}(", def.span().diagnostic())?;
")"
}
AggregateKind::Coroutine(def, _, _) => {
AggregateKind::Coroutine(def, _) => {
write!(writer, "{{coroutine@{}}}(", def.span().diagnostic())?;
")"
}
Expand Down
7 changes: 3 additions & 4 deletions compiler/rustc_public/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ impl Ty {
}

/// Create a new coroutine type.
pub fn new_coroutine(def: CoroutineDef, args: GenericArgs, mov: Movability) -> Ty {
Ty::from_rigid_kind(RigidTy::Coroutine(def, args, mov))
pub fn new_coroutine(def: CoroutineDef, args: GenericArgs) -> Ty {
Ty::from_rigid_kind(RigidTy::Coroutine(def, args))
}

/// Create a new closure type.
Expand Down Expand Up @@ -560,8 +560,7 @@ pub enum RigidTy {
FnDef(FnDef, GenericArgs),
FnPtr(PolyFnSig),
Closure(ClosureDef, GenericArgs),
// FIXME(rustc_public): Movability here is redundant
Coroutine(CoroutineDef, GenericArgs, Movability),
Coroutine(CoroutineDef, GenericArgs),
CoroutineClosure(CoroutineClosureDef, GenericArgs),
Dynamic(Vec<Binder<ExistentialPredicate>>, Region, DynKind),
Never,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_public/src/unstable/convert/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl RustcInternal for RigidTy {
RigidTy::Closure(def, args) => {
rustc_ty::TyKind::Closure(def.0.internal(tables, tcx), args.internal(tables, tcx))
}
RigidTy::Coroutine(def, args, _mov) => {
RigidTy::Coroutine(def, args) => {
rustc_ty::TyKind::Coroutine(def.0.internal(tables, tcx), args.internal(tables, tcx))
}
RigidTy::CoroutineClosure(def, args) => rustc_ty::TyKind::CoroutineClosure(
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_public/src/unstable/convert/stable/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ impl<'tcx> Stable<'tcx> for mir::AggregateKind<'tcx> {
crate::mir::AggregateKind::Coroutine(
tables.coroutine_def(*def_id),
generic_arg.stable(tables, cx),
cx.coroutine_movability(*def_id).stable(tables, cx),
)
}
mir::AggregateKind::CoroutineClosure(def_id, generic_args) => {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_public/src/unstable/convert/stable/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ impl<'tcx> Stable<'tcx> for ty::TyKind<'tcx> {
ty::Coroutine(def_id, generic_args) => TyKind::RigidTy(RigidTy::Coroutine(
tables.coroutine_def(*def_id),
generic_args.stable(tables, cx),
cx.coroutine_movability(*def_id).stable(tables, cx),
)),
ty::Never => TyKind::RigidTy(RigidTy::Never),
ty::Tuple(fields) => TyKind::RigidTy(RigidTy::Tuple(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_public/src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl Visitable for RigidTy {
}
RigidTy::Adt(_, args)
| RigidTy::Closure(_, args)
| RigidTy::Coroutine(_, args, _)
| RigidTy::Coroutine(_, args)
| RigidTy::CoroutineWitness(_, args)
| RigidTy::CoroutineClosure(_, args)
| RigidTy::FnDef(_, args) => args.visit(visitor),
Expand Down
Loading