Skip to content

Commit c567edd

Browse files
Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs
1 parent a204217 commit c567edd

File tree

91 files changed

+579
-101
lines changed

Some content is hidden

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

91 files changed

+579
-101
lines changed

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ fn suggest_ampmut<'tcx>(
14721472
}
14731473

14741474
fn is_closure_or_coroutine(ty: Ty<'_>) -> bool {
1475-
ty.is_closure() || ty.is_coroutine()
1475+
ty.is_closure() || ty.is_coroutine() || ty.is_coroutine_closure()
14761476
}
14771477

14781478
/// Given a field that needs to be mutable, returns a span where the " mut " could go.

compiler/rustc_borrowck/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13031303
// moved into the closure and subsequently used by the closure,
13041304
// in order to populate our used_mut set.
13051305
match **aggregate_kind {
1306-
AggregateKind::Closure(def_id, _) | AggregateKind::Coroutine(def_id, _) => {
1306+
AggregateKind::Closure(def_id, _)
1307+
| AggregateKind::CoroutineClosure(def_id, _)
1308+
| AggregateKind::Coroutine(def_id, _) => {
13071309
let def_id = def_id.expect_local();
13081310
let BorrowCheckResult { used_mut_upvars, .. } =
13091311
self.infcx.tcx.mir_borrowck(def_id);
@@ -1609,6 +1611,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16091611
| ty::FnPtr(_)
16101612
| ty::Dynamic(_, _, _)
16111613
| ty::Closure(_, _)
1614+
| ty::CoroutineClosure(_, _)
16121615
| ty::Coroutine(_, _)
16131616
| ty::CoroutineWitness(..)
16141617
| ty::Never
@@ -1633,7 +1636,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16331636
return;
16341637
}
16351638
}
1636-
ty::Closure(_, _) | ty::Coroutine(_, _) | ty::Tuple(_) => (),
1639+
ty::Closure(..)
1640+
| ty::CoroutineClosure(..)
1641+
| ty::Coroutine(_, _)
1642+
| ty::Tuple(_) => (),
16371643
ty::Bool
16381644
| ty::Char
16391645
| ty::Int(_)

compiler/rustc_borrowck/src/path_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub(crate) fn is_upvar_field_projection<'tcx>(
164164
match place_ref.last_projection() {
165165
Some((place_base, ProjectionElem::Field(field, _ty))) => {
166166
let base_ty = place_base.ty(body, tcx).ty;
167-
if (base_ty.is_closure() || base_ty.is_coroutine())
167+
if (base_ty.is_closure() || base_ty.is_coroutine() || base_ty.is_coroutine_closure())
168168
&& (!by_ref || upvars[field.index()].is_by_ref())
169169
{
170170
Some(field)

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,14 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
808808
}),
809809
};
810810
}
811+
ty::CoroutineClosure(_, args) => {
812+
return match args.as_coroutine_closure().upvar_tys().get(field.index()) {
813+
Some(&ty) => Ok(ty),
814+
None => Err(FieldAccessError::OutOfRange {
815+
field_count: args.as_coroutine_closure().upvar_tys().len(),
816+
}),
817+
};
818+
}
811819
ty::Coroutine(_, args) => {
812820
// Only prefix fields (upvars and current state) are
813821
// accessible without a variant index.
@@ -1875,6 +1883,14 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18751883
}),
18761884
}
18771885
}
1886+
AggregateKind::CoroutineClosure(_, args) => {
1887+
match args.as_coroutine_closure().upvar_tys().get(field_index.as_usize()) {
1888+
Some(ty) => Ok(*ty),
1889+
None => Err(FieldAccessError::OutOfRange {
1890+
field_count: args.as_coroutine_closure().upvar_tys().len(),
1891+
}),
1892+
}
1893+
}
18781894
AggregateKind::Array(ty) => Ok(ty),
18791895
AggregateKind::Tuple => {
18801896
unreachable!("This should have been covered in check_rvalues");
@@ -2478,6 +2494,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24782494
AggregateKind::Tuple => None,
24792495
AggregateKind::Closure(_, _) => None,
24802496
AggregateKind::Coroutine(_, _) => None,
2497+
AggregateKind::CoroutineClosure(_, _) => None,
24812498
},
24822499
}
24832500
}
@@ -2705,7 +2722,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
27052722
// desugaring. A closure gets desugared to a struct, and
27062723
// these extra requirements are basically like where
27072724
// clauses on the struct.
2708-
AggregateKind::Closure(def_id, args) | AggregateKind::Coroutine(def_id, args) => (
2725+
AggregateKind::Closure(def_id, args)
2726+
| AggregateKind::CoroutineClosure(def_id, args)
2727+
| AggregateKind::Coroutine(def_id, args) => (
27092728
def_id,
27102729
self.prove_closure_bounds(
27112730
tcx,
@@ -2754,10 +2773,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
27542773
let typeck_root_args = ty::GenericArgs::identity_for_item(tcx, typeck_root_def_id);
27552774

27562775
let parent_args = match tcx.def_kind(def_id) {
2757-
DefKind::Closure if tcx.is_coroutine(def_id.to_def_id()) => {
2758-
args.as_coroutine().parent_args()
2776+
DefKind::Closure => {
2777+
// FIXME(async_closures): It's kind of icky to access HIR here.
2778+
match tcx.hir_node_by_def_id(def_id).expect_closure().kind {
2779+
hir::ClosureKind::Closure => args.as_closure().parent_args(),
2780+
hir::ClosureKind::Coroutine(_) => args.as_coroutine().parent_args(),
2781+
hir::ClosureKind::CoroutineClosure(_) => {
2782+
args.as_coroutine_closure().parent_args()
2783+
}
2784+
}
27592785
}
2760-
DefKind::Closure => args.as_closure().parent_args(),
27612786
DefKind::InlineConst => args.as_inline_const().parent_args(),
27622787
other => bug!("unexpected item {:?}", other),
27632788
};

compiler/rustc_codegen_gcc/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLayout
8787
// FIXME(eddyb) producing readable type names for trait objects can result
8888
// in problematically distinct types due to HRTB and subtyping (see #47638).
8989
// ty::Dynamic(..) |
90-
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Coroutine(..) | ty::Str
90+
ty::Adt(..) | ty::Closure(..) | ty::CoroutineClosure(..) | ty::Foreign(..) | ty::Coroutine(..) | ty::Str
9191
if !cx.sess().fewer_names() =>
9292
{
9393
let mut name = with_no_trimmed_paths!(layout.ty.to_string());

compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn uncached_llvm_type<'a, 'tcx>(
3333
// FIXME(eddyb) producing readable type names for trait objects can result
3434
// in problematically distinct types due to HRTB and subtyping (see #47638).
3535
// ty::Dynamic(..) |
36-
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Coroutine(..) | ty::Str
36+
ty::Adt(..) | ty::Closure(..) | ty::CoroutineClosure(..) | ty::Foreign(..) | ty::Coroutine(..) | ty::Str
3737
// For performance reasons we use names only when emitting LLVM IR.
3838
if !cx.sess().fewer_names() =>
3939
{

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ fn push_debuginfo_type_name<'tcx>(
398398
// processing
399399
visited.remove(&t);
400400
}
401-
ty::Closure(def_id, args) | ty::Coroutine(def_id, args, ..) => {
401+
ty::Closure(def_id, args)
402+
| ty::CoroutineClosure(def_id, args)
403+
| ty::Coroutine(def_id, args, ..) => {
402404
// Name will be "{closure_env#0}<T1, T2, ...>", "{coroutine_env#0}<T1, T2, ...>", or
403405
// "{async_fn_env#0}<T1, T2, ...>", etc.
404406
// In the case of cpp-like debuginfo, the name additionally gets wrapped inside of
@@ -768,6 +770,8 @@ fn push_closure_or_coroutine_name<'tcx>(
768770

769771
// Truncate the args to the length of the above generics. This will cut off
770772
// anything closure- or coroutine-specific.
773+
// FIXME(async_closures): This is probably not going to be correct w.r.t.
774+
// multiple coroutine flavors. Maybe truncate to (parent + 1)?
771775
let args = args.truncate_to(tcx, generics);
772776
push_generic_params_internal(tcx, args, enclosing_fn_def_id, output, visited);
773777
}

compiler/rustc_const_eval/src/const_eval/valtrees.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
172172
| ty::Infer(_)
173173
// FIXME(oli-obk): we can probably encode closures just like structs
174174
| ty::Closure(..)
175+
| ty::CoroutineClosure(..)
175176
| ty::Coroutine(..)
176177
| ty::CoroutineWitness(..) => Err(ValTreeCreationError::NonSupportedType),
177178
}
@@ -301,6 +302,7 @@ pub fn valtree_to_const_value<'tcx>(
301302
| ty::Placeholder(..)
302303
| ty::Infer(_)
303304
| ty::Closure(..)
305+
| ty::CoroutineClosure(..)
304306
| ty::Coroutine(..)
305307
| ty::CoroutineWitness(..)
306308
| ty::FnPtr(_)

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
10071007
| ty::CoroutineWitness(..)
10081008
| ty::Array(..)
10091009
| ty::Closure(..)
1010+
| ty::CoroutineClosure(..)
10101011
| ty::Never
10111012
| ty::Error(_) => true,
10121013

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
8585
| ty::FnPtr(_)
8686
| ty::Dynamic(_, _, _)
8787
| ty::Closure(_, _)
88+
| ty::CoroutineClosure(_, _)
8889
| ty::Coroutine(_, _)
8990
| ty::CoroutineWitness(..)
9091
| ty::Never

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
644644
| ty::Str
645645
| ty::Dynamic(..)
646646
| ty::Closure(..)
647+
| ty::CoroutineClosure(..)
647648
| ty::Coroutine(..) => Ok(false),
648649
// Some types only occur during typechecking, they have no layout.
649650
// We should not see them here and we could not check them anyway.

compiler/rustc_const_eval/src/transform/validate.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
665665
};
666666
check_equal(self, location, f_ty);
667667
}
668+
ty::CoroutineClosure(_, args) => {
669+
let args = args.as_coroutine_closure();
670+
let Some(&f_ty) = args.upvar_tys().get(f.as_usize()) else {
671+
fail_out_of_bounds(self, location);
672+
return;
673+
};
674+
check_equal(self, location, f_ty);
675+
}
668676
&ty::Coroutine(def_id, args) => {
669677
let f_ty = if let Some(var) = parent_ty.variant_index {
670678
let gen_body = if def_id == self.body.source.def_id() {
@@ -861,6 +869,20 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
861869
}
862870
}
863871
}
872+
AggregateKind::CoroutineClosure(_, args) => {
873+
let upvars = args.as_coroutine_closure().upvar_tys();
874+
if upvars.len() != fields.len() {
875+
self.fail(
876+
location,
877+
"coroutine-closure has the wrong number of initialized fields",
878+
);
879+
}
880+
for (src, dest) in std::iter::zip(fields, upvars) {
881+
if !self.mir_assign_valid_types(src.ty(self.body, self.tcx), dest) {
882+
self.fail(location, "coroutine-closure field has the wrong type");
883+
}
884+
}
885+
}
864886
},
865887
Rvalue::Ref(_, BorrowKind::Fake, _) => {
866888
if self.mir_phase >= MirPhase::Runtime(RuntimePhase::Initial) {

compiler/rustc_const_eval/src/util/type_name.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
5151
| ty::FnDef(def_id, args)
5252
| ty::Alias(ty::Projection | ty::Opaque, ty::AliasTy { def_id, args, .. })
5353
| ty::Closure(def_id, args)
54+
| ty::CoroutineClosure(def_id, args)
5455
| ty::Coroutine(def_id, args) => self.print_def_path(def_id, args),
5556
ty::Foreign(def_id) => self.print_def_path(def_id, &[]),
5657

compiler/rustc_hir/src/hir.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3703,6 +3703,7 @@ impl<'hir> Node<'hir> {
37033703
expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;
37043704
expect_crate, &'hir Mod<'hir>, Node::Crate(n), n;
37053705
expect_infer, &'hir InferArg, Node::Infer(n), n;
3706+
expect_closure, &'hir Closure<'hir>, Node::Expr(Expr { kind: ExprKind::Closure(n), .. }), n;
37063707
}
37073708
}
37083709

compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ impl<'tcx> InherentCollect<'tcx> {
171171
}
172172
ty::FnDef(..)
173173
| ty::Closure(..)
174+
| ty::CoroutineClosure(..)
174175
| ty::Coroutine(..)
175176
| ty::CoroutineWitness(..)
176177
| ty::Bound(..)

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ fn do_orphan_check_impl<'tcx>(
244244
| ty::Tuple(..) => (LocalImpl::Allow, NonlocalImpl::DisallowOther),
245245

246246
ty::Closure(..)
247+
| ty::CoroutineClosure(..)
247248
| ty::Coroutine(..)
248249
| ty::CoroutineWitness(..)
249250
| ty::Bound(..)

compiler/rustc_hir_analysis/src/collect/generics_of.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,13 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
349349
ClosureKind::Coroutine(_) => {
350350
&["<resume_ty>", "<yield_ty>", "<return_ty>", "<witness>", "<upvars>"][..]
351351
}
352-
ClosureKind::CoroutineClosure(_) => todo!(),
352+
ClosureKind::CoroutineClosure(_) => &[
353+
"<closure_kind>",
354+
"<closure_signature_parts>",
355+
"<upvars>",
356+
"<bound_captures_by_ref>",
357+
"<witness>",
358+
][..],
353359
};
354360

355361
params.extend(dummy_args.iter().map(|&arg| ty::GenericParamDef {

compiler/rustc_hir_analysis/src/variance/constraints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
235235
// leaf type -- noop
236236
}
237237

238-
ty::FnDef(..) | ty::Coroutine(..) | ty::Closure(..) => {
239-
bug!("Unexpected closure type in variance computation");
238+
ty::FnDef(..) | ty::Coroutine(..) | ty::Closure(..) | ty::CoroutineClosure(..) => {
239+
bug!("Unexpected coroutine/closure type in variance computation");
240240
}
241241

242242
ty::Ref(region, ty, mutbl) => {

compiler/rustc_hir_typeck/src/callee.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
147147
// Check whether this is a call to a closure where we
148148
// haven't yet decided on whether the closure is fn vs
149149
// fnmut vs fnonce. If so, we have to defer further processing.
150-
if self.closure_kind(args).is_none() {
150+
if self.closure_kind(adjusted_ty).is_none() {
151151
let closure_sig = args.as_closure().sig();
152152
let closure_sig = self.instantiate_binder_with_fresh_vars(
153153
call_expr.span,
@@ -160,10 +160,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
160160
DeferredCallResolution {
161161
call_expr,
162162
callee_expr,
163-
adjusted_ty,
163+
closure_ty: adjusted_ty,
164164
adjustments,
165165
fn_sig: closure_sig,
166-
closure_args: args,
167166
},
168167
);
169168
return Some(CallStep::DeferredClosure(def_id, closure_sig));
@@ -886,10 +885,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
886885
pub struct DeferredCallResolution<'tcx> {
887886
call_expr: &'tcx hir::Expr<'tcx>,
888887
callee_expr: &'tcx hir::Expr<'tcx>,
889-
adjusted_ty: Ty<'tcx>,
888+
closure_ty: Ty<'tcx>,
890889
adjustments: Vec<Adjustment<'tcx>>,
891890
fn_sig: ty::FnSig<'tcx>,
892-
closure_args: GenericArgsRef<'tcx>,
893891
}
894892

895893
impl<'a, 'tcx> DeferredCallResolution<'tcx> {
@@ -898,10 +896,10 @@ impl<'a, 'tcx> DeferredCallResolution<'tcx> {
898896

899897
// we should not be invoked until the closure kind has been
900898
// determined by upvar inference
901-
assert!(fcx.closure_kind(self.closure_args).is_some());
899+
assert!(fcx.closure_kind(self.closure_ty).is_some());
902900

903901
// We may now know enough to figure out fn vs fnmut etc.
904-
match fcx.try_overloaded_call_traits(self.call_expr, self.adjusted_ty, None) {
902+
match fcx.try_overloaded_call_traits(self.call_expr, self.closure_ty, None) {
905903
Some((autoref, method_callee)) => {
906904
// One problem is that when we get here, we are going
907905
// to have a newly instantiated function signature

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
133133
| ty::FnDef(..)
134134
| ty::FnPtr(..)
135135
| ty::Closure(..)
136+
| ty::CoroutineClosure(..)
136137
| ty::Coroutine(..)
137138
| ty::Adt(..)
138139
| ty::Never

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5757
match ty.kind() {
5858
// Not all of these (e.g., unsafe fns) implement `FnOnce`,
5959
// so we look for these beforehand.
60+
// FIXME(async_closures): These don't impl `FnOnce` by default.
6061
ty::Closure(..) | ty::FnDef(..) | ty::FnPtr(_) => true,
6162
// If it's not a simple function, look for things which implement `FnOnce`.
6263
_ => {

compiler/rustc_hir_typeck/src/upvar.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
170170
) {
171171
// Extract the type of the closure.
172172
let ty = self.node_ty(closure_hir_id);
173-
let (closure_def_id, args) = match *ty.kind() {
174-
ty::Closure(def_id, args) => (def_id, UpvarArgs::Closure(args)),
175-
ty::Coroutine(def_id, args) => (def_id, UpvarArgs::Coroutine(args)),
173+
let (closure_def_id, args, infer_kind) = match *ty.kind() {
174+
ty::Closure(def_id, args) => {
175+
(def_id, UpvarArgs::Closure(args), self.closure_kind(ty).is_none())
176+
}
177+
ty::Coroutine(def_id, args) => (def_id, UpvarArgs::Coroutine(args), false),
176178
ty::Error(_) => {
177179
// #51714: skip analysis when we have already encountered type errors
178180
return;
@@ -188,12 +190,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
188190
};
189191
let closure_def_id = closure_def_id.expect_local();
190192

191-
let infer_kind = if let UpvarArgs::Closure(closure_args) = args {
192-
self.closure_kind(closure_args).is_none().then_some(closure_args)
193-
} else {
194-
None
195-
};
196-
197193
assert_eq!(self.tcx.hir().body_owner_def_id(body.id()), closure_def_id);
198194
let mut delegate = InferBorrowKind {
199195
closure_def_id,
@@ -308,10 +304,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
308304

309305
let before_feature_tys = self.final_upvar_tys(closure_def_id);
310306

311-
if let Some(closure_args) = infer_kind {
307+
if infer_kind {
312308
// Unify the (as yet unbound) type variable in the closure
313309
// args with the kind we inferred.
314-
let closure_kind_ty = closure_args.as_closure().kind_ty();
310+
let closure_kind_ty = match args {
311+
UpvarArgs::Closure(args) => args.as_closure().kind_ty(),
312+
UpvarArgs::CoroutineClosure(args) => args.as_coroutine_closure().kind_ty(),
313+
UpvarArgs::Coroutine(_) => unreachable!("coroutines don't have an inferred kind"),
314+
};
315315
self.demand_eqtype(
316316
span,
317317
Ty::from_closure_kind(self.tcx, closure_kind),

0 commit comments

Comments
 (0)