Remove movability from TyKind::Coroutine
This commit is contained in:
parent
f4d794ea0b
commit
fcb42b42d6
84 changed files with 212 additions and 220 deletions
|
@ -387,8 +387,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
closure_id,
|
||||
args,
|
||||
ref upvars,
|
||||
movability,
|
||||
ref fake_reads,
|
||||
movability: _,
|
||||
}) => {
|
||||
// Convert the closure fake reads, if any, from `ExprRef` to mir `Place`
|
||||
// and push the fake reads.
|
||||
|
@ -474,10 +474,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
|
||||
let result = match args {
|
||||
UpvarArgs::Coroutine(args) => {
|
||||
// We implicitly set the discriminant to 0. See
|
||||
// librustc_mir/transform/deaggregator.rs for details.
|
||||
let movability = movability.unwrap();
|
||||
Box::new(AggregateKind::Coroutine(closure_id.to_def_id(), args, movability))
|
||||
Box::new(AggregateKind::Coroutine(closure_id.to_def_id(), args))
|
||||
}
|
||||
UpvarArgs::Closure(args) => {
|
||||
Box::new(AggregateKind::Closure(closure_id.to_def_id(), args))
|
||||
|
|
|
@ -646,7 +646,7 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
|
|||
}
|
||||
DefKind::Closure if coroutine_kind.is_some() => {
|
||||
let coroutine_ty = tcx.type_of(def_id).instantiate_identity();
|
||||
let ty::Coroutine(_, args, _) = coroutine_ty.kind() else {
|
||||
let ty::Coroutine(_, args) = coroutine_ty.kind() else {
|
||||
bug!("expected type of coroutine-like closure to be a coroutine")
|
||||
};
|
||||
let args = args.as_coroutine();
|
||||
|
@ -813,7 +813,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
|
||||
let upvar_args = match closure_ty.kind() {
|
||||
ty::Closure(_, args) => ty::UpvarArgs::Closure(args),
|
||||
ty::Coroutine(_, args, _) => ty::UpvarArgs::Coroutine(args),
|
||||
ty::Coroutine(_, args) => ty::UpvarArgs::Coroutine(args),
|
||||
_ => return,
|
||||
};
|
||||
|
||||
|
|
|
@ -552,8 +552,8 @@ impl<'tcx> Cx<'tcx> {
|
|||
let closure_ty = self.typeck_results().expr_ty(expr);
|
||||
let (def_id, args, movability) = match *closure_ty.kind() {
|
||||
ty::Closure(def_id, args) => (def_id, UpvarArgs::Closure(args), None),
|
||||
ty::Coroutine(def_id, args, movability) => {
|
||||
(def_id, UpvarArgs::Coroutine(args), Some(movability))
|
||||
ty::Coroutine(def_id, args) => {
|
||||
(def_id, UpvarArgs::Coroutine(args), Some(tcx.movability(def_id)))
|
||||
}
|
||||
_ => {
|
||||
span_bug!(expr.span, "closure expr w/o closure type: {:?}", closure_ty);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue