1
Fork 0

Make ExprKind::Closure a struct variant.

This commit is contained in:
Camille GILLOT 2022-06-11 21:25:25 +02:00
parent fa68e73e99
commit 3039cfeb6a
75 changed files with 251 additions and 216 deletions

View file

@ -66,8 +66,8 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
// Figure out what primary body this item has.
let (body_id, return_ty_span, span_with_body) = match tcx.hir().get(id) {
Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(_, decl, body_id, _, _), .. }) => {
(*body_id, decl.output.span(), None)
Node::Expr(hir::Expr { kind: hir::ExprKind::Closure { fn_decl, body, .. }, .. }) => {
(*body, fn_decl.output.span(), None)
}
Node::Item(hir::Item {
kind: hir::ItemKind::Fn(hir::FnSig { decl, .. }, _, body_id),

View file

@ -418,7 +418,7 @@ impl<'tcx> Cx<'tcx> {
}
},
hir::ExprKind::Closure(..) => {
hir::ExprKind::Closure { .. } => {
let closure_ty = self.typeck_results().expr_ty(expr);
let (def_id, substs, movability) = match *closure_ty.kind() {
ty::Closure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs), None),