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
Bug: returning a large struct (Sema field) by value breaks generic lowering #577
Changing lower_module to move-through style — returning MirLowerOutput { mir_mod: MirModule, sema: Sema } (Sema is a multi-KB struct of Vecs/maps) — makes the built compiler emit spurious unknown type 'T' while lowering generic blanket-impl bodies in the embedded std, identical symptom to the DiagnosticList-handle bug. The in-function code is byte-identical; only the return type (and thus the sret/ABI path for a very large aggregate) changes, and the failure fires before the return is reached, pointing at a frame-layout or sret-related miscompile in the stage that built it.
Repro
At 2c8ba1a8: change fn lower_module(mut sema: Sema, ...) -> MirModule to return MirLowerOutput { mir_mod, sema }, update the single caller in Compilation.run_mir_lower, build stage2, then check the HashMap 4-liner from the sibling issue → unknown type 'T' in std/collections.w:21.
#564 shipped with the field-place box shape instead (MirLowerSemaBox in Compilation.w, commit 1f9ec56), which preserves the share semantics without the giant by-value return.
Related
Same latent-miscompile family as #568 and the DiagnosticList-handle issue.
Same root cause as #576 — see the full analysis there. There is no large-struct-return miscompile: the Sema-bearing return simply made the caller adopt the callee's diagnostics list, surfacing four genuine 'unknown type T' errors that lower_module has emitted into a discarded Sema copy on every compile since the blanket-impl skip predicate was left incomplete (fn_meta_tp_count only; missing the generic_fn_nodes check that codegen has). The validated fix is the lower_module skip-predicate completion; once it lands, the MirLowerOutput move-through shape from the #564 work is re-appliable and this issue can close alongside #576.
Closing as fixed on HEAD (verified by probe): a 24-field struct (incl. Vec + HashMap) returned by value from a generic method (Maker.make[T](self: &Maker[T]) -> Big) checks and runs correctly. The sret/classification concern doesn't reproduce at user level; the lower_module skip-predicate fix (MirLower.w:12429) covers the trigger.
Activity
ehartford commentedon Jun 13, 2026
Same root cause as #576 — see the full analysis there. There is no large-struct-return miscompile: the Sema-bearing return simply made the caller adopt the callee's diagnostics list, surfacing four genuine 'unknown type T' errors that lower_module has emitted into a discarded Sema copy on every compile since the blanket-impl skip predicate was left incomplete (fn_meta_tp_count only; missing the generic_fn_nodes check that codegen has). The validated fix is the lower_module skip-predicate completion; once it lands, the MirLowerOutput move-through shape from the #564 work is re-appliable and this issue can close alongside #576.
ehartford commentedon Jul 2, 2026
Closing as fixed on HEAD (verified by probe): a 24-field struct (incl. Vec + HashMap) returned by value from a generic method (
Maker.make[T](self: &Maker[T]) -> Big) checks and runs correctly. The sret/classification concern doesn't reproduce at user level; the lower_module skip-predicate fix (MirLower.w:12429) covers the trigger.