You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Initializer early exits schedule a drop before the binding receives its value #1112
Spec §2.4 gives destructors the value that goes out of scope; the control-flow rules also forbid dropping a value whose initialization was skipped.
Reproduction (core prelude):
fn exercise(stop: bool):
let text = if stop:
return
else:
f"owned {stop}"
print(text)
fn main:
exercise(false)
exercise(true)
On bd02ff27, with check --prelude=core --validate-all repro.w rejects fn sym221 stmt3: drop of _2 ... (Uninit). MIR emits the drop on the early-return edge before _2 receives a value. The same defect occurs in the compiler's ComptimeEvaluator.eval_toolfs_capability_method, where a failed binary-data initializer returns early.
LLDB stopped at MirBuilder.schedule_drop for sym221/local2. lower_let_binding calls it at 0x100904068, before lower_expr at 0x1009040a0 and assignment at 0x1009040c8. The source cause is scheduling at MirLower.w:5736 before evaluating the initializer.
Expected: initializer exits clean up values already constructed; the destination binding acquires cleanup only after initialization completes. No workaround is used. The repair and return/break/continue/goto/? allocator matrix are committed in the pending #1107 update; full native verification is still required. Debugger evidence is documented in docs/initializer-drop-debug.md.
Activity