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
Codegen trap: .Some(v.get(0)) with v: &Vec[T] returning Option[&T] — the call result local is typed unit and aggregated into the Option #933
with check passes. with build exits 133 (SIGTRAP) inside llvm::DataLayout::getTypeSizeInBits — the compiler itself, even though f is never called. Same with Vec[str] / Option[&str].
Not triggered by any of: .None; .Some(s) from a &str parameter; returning v.get(0) directly as &T; or binding first (let s = v.get(0) then .Some(s)).
The call node inside the variant constructor's argument gets no Sema expression type when the expected payload is &T (a let in between records one), so MirLower's temp for the call result defaults to unit and codegen asks LLVM to size a void payload. Two defects: the Sema typing hole for NK_ENUM_VARIANT arguments checked against an expected &T payload, and the silent unit default in MirLower where an untyped call result should be a loud phase bug (§No Silent Fallbacks).
Found while building the #925 acceptance matrix; a fixture defining this shape trapped the compiler before main ran.
Sema's .Variant(args) shorthand branch recorded the enum type from the expected type and returned without checking the payload arguments, so a generic-method-call payload (v.get(0) on &Vec[T]) never got an instantiated type; MirLower defaulted the call result to unit, aggregated a void payload into the Option, and LLVM trapped sizing it. check_variant_shorthand_args now checks each payload against the variant's payload types with check_expr_with_expected, exactly as the bare Variant(args) call path does, on both the expected-type and the variant-lookup paths. As a consequence .Some(v.get(0).no_such()) is a real diagnostic instead of an abort.
lower_call now fails loudly (phase bug naming the call) when a call result has no type at all, instead of lowering it as unit.
Found and fixed on the way: the shorthand's MIR lowering never applied Sema's recorded adjustments, so .Some(v.get(0)) into Option[i32] compiled but stored the view's address and read back 0. It now applies them in lower_call_arg's order (auto-reference, contextual copy, auto-deref).
Fixtures: err_variant_shorthand_payload_checked, behav_variant_shorthand_generic_payload (view, owned, str, and auto-referenced payloads). Battery with audits green; reseeded.
Activity
Sema: `for x in vec.iter()` binds the same element type MirLower lowe…
Sema/MirLower: `.Variant(args)` checks and lowers its payloads like a…
ehartford commentedon Sep 2, 2026
Fixed in 784b429. Two defects, as filed:
.Variant(args)shorthand branch recorded the enum type from the expected type and returned without checking the payload arguments, so a generic-method-call payload (v.get(0)on&Vec[T]) never got an instantiated type; MirLower defaulted the call result to unit, aggregated a void payload into the Option, and LLVM trapped sizing it.check_variant_shorthand_argsnow checks each payload against the variant's payload types withcheck_expr_with_expected, exactly as the bareVariant(args)call path does, on both the expected-type and the variant-lookup paths. As a consequence.Some(v.get(0).no_such())is a real diagnostic instead of an abort.lower_callnow fails loudly (phase bug naming the call) when a call result has no type at all, instead of lowering it as unit.Found and fixed on the way: the shorthand's MIR lowering never applied Sema's recorded adjustments, so
.Some(v.get(0))intoOption[i32]compiled but stored the view's address and read back 0. It now applies them inlower_call_arg's order (auto-reference, contextual copy, auto-deref).Fixtures:
err_variant_shorthand_payload_checked,behav_variant_shorthand_generic_payload(view, owned, str, and auto-referenced payloads). Battery with audits green; reseeded.Sema/MIR: a place against a `&T` enum payload borrows — `Some(ctx)` f…
Sema/MIR: a place against a `&T` enum payload borrows — `Some(ctx)` f…
Sema/MIR: a place against a `&T` enum payload borrows — `Some(ctx)` f…
Sema/MIR: a place against a `&T` enum payload borrows — `Some(ctx)` f…
MIR: a constructor payload borrows where Sema recorded the borrow, an…
Sema/MIR: a place against a `&T` enum payload borrows — `Some(ctx)` f…
MIR: a constructor payload borrows where Sema recorded the borrow, an…
Spec-ruled fixes: Some(place) borrows for Option[&T], module globals …