Conversation
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>
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
PR SummaryLow Risk Overview That registration step can fail while generating Drop/panic_destruct lowering for captured variables; previously those failures were ignored and lowering could continue without the expected generated destruct impl. Reviewed by Cursor Bugbot for commit 8c48467. Bugbot is set up for automated code reviews on this repo. Configure here. |

Summary
Propagates the error returned by
add_capture_destruct_implinstead of silently discarding it. The result was previously bound to_and ignored; it is now mapped toLoweringFlowError::Failedand propagated with?.Type of change
Please check one:
Why is this change needed?
add_capture_destruct_implcan return an error, but the previous code discarded it withlet _ = .... This meant that failures during closure capture destructor registration were silently swallowed, potentially allowing lowering to continue in an invalid state.What was the behavior or documentation before?
Errors from
add_capture_destruct_implwere ignored entirely, so any failure in that call had no effect on the lowering pipeline.What is the behavior or documentation after?
Errors from
add_capture_destruct_implare now mapped toLoweringFlowError::Failedand propagated via?, ensuring that failures are correctly surfaced during closure lowering.Related issue or discussion (if any)
Additional context
This is a correctness fix in the closure lowering path. The change is minimal but important for ensuring error handling is not accidentally bypassed.