Sitelet https://github.com/starkware-libs/cairo/commit/8c48467e7c9c5875ef9e8d1c49ca8b2c7cf015a4
Skip to content

Commit 8c48467

Browse files
committed
fix(lowering): propagate destruct-impl error in closure lowering
lower_expr_closure discarded the Maybe<()> from add_capture_destruct_impl via `let _ =`, so a DB/inference failure (which already emits a diagnostic via `?` internally) was silently swallowed and lowering continued as if the capture's destruct impl had been generated. Propagate it with .map_err(LoweringFlowError::Failed)? to match every other add_* call site. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3ce5806 commit 8c48467

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

  • crates/cairo-lang-lowering/src/lower

‎crates/cairo-lang-lowering/src/lower/mod.rs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,12 +2149,8 @@ fn lower_expr_closure<'db>(
21492149
let (capture_var_usage, closure_info) = builder.capture(ctx, usage, expr);
21502150
let closure_variable = LoweredExpr::AtVariable(capture_var_usage);
21512151
let closure_ty = extract_matches!(expr.ty.long(ctx.db), TypeLongId::Closure);
2152-
let _ = add_capture_destruct_impl(
2153-
ctx,
2154-
capture_var_usage,
2155-
&closure_info,
2156-
closure_ty.params_location,
2157-
);
2152+
add_capture_destruct_impl(ctx, capture_var_usage, &closure_info, closure_ty.params_location)
2153+
.map_err(LoweringFlowError::Failed)?;
21582154
add_closure_call_function(
21592155
ctx,
21602156
expr,

0 commit comments

Comments
 (0)