Skip to content

Commit d54b424

Browse files
committed
body_env
1 parent a76ecbb commit d54b424

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

middle_end/flambda2/from_lambda/closure_conversion.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,10 @@ let close_let acc env id user_visible defining_expr
729729
| None -> body acc body_env
730730
| Some (Prim ((Nullary Begin_region | Unary (End_region, _)), _))
731731
when not (Flambda_features.stack_allocation_enabled ()) ->
732-
body acc env
732+
(* We use [body_env] to ensure the region variables are still in the
733+
environment, to avoid lookup errors, even though the [Let] won't be
734+
generated. *)
735+
body acc body_env
733736
| Some defining_expr -> (
734737
let body_env =
735738
match defining_expr with

0 commit comments

Comments
 (0)