merge DefKind::Coroutine into DefKind::Closure
This commit is contained in:
@@ -638,6 +638,14 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
|
||||
);
|
||||
(sig.inputs().to_vec(), sig.output(), None)
|
||||
}
|
||||
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 { bug!() };
|
||||
let args = args.as_coroutine();
|
||||
let yield_ty = args.yield_ty();
|
||||
let return_ty = args.return_ty();
|
||||
(vec![coroutine_ty, args.resume_ty()], return_ty, Some(yield_ty))
|
||||
}
|
||||
DefKind::Closure => {
|
||||
let closure_ty = tcx.type_of(def_id).instantiate_identity();
|
||||
let ty::Closure(_, args) = closure_ty.kind() else { bug!() };
|
||||
@@ -650,14 +658,6 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
|
||||
};
|
||||
([self_ty].into_iter().chain(sig.inputs().to_vec()).collect(), sig.output(), None)
|
||||
}
|
||||
DefKind::Coroutine => {
|
||||
let coroutine_ty = tcx.type_of(def_id).instantiate_identity();
|
||||
let ty::Coroutine(_, args, _) = coroutine_ty.kind() else { bug!() };
|
||||
let args = args.as_coroutine();
|
||||
let yield_ty = args.yield_ty();
|
||||
let return_ty = args.return_ty();
|
||||
(vec![coroutine_ty, args.resume_ty()], return_ty, Some(yield_ty))
|
||||
}
|
||||
dk => bug!("{:?} is not a body: {:?}", def_id, dk),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user