Repository navigation
fix(mir-importer): lower tuple array constants with rustc layout - #383
Merged
nihalpasham merged 5 commits intoJul 23, 2026
Merged
Conversation
nihalpasham
force-pushed
the
codex/upstream-tuple-array-constants
branch
from
July 22, 2026 08:47
7cdd563 to
858b9cc
Compare
nihalpasham
force-pushed
the
codex/upstream-tuple-array-constants
branch
from
July 23, 2026 10:30
858b9cc to
fe7240d
Compare
Collaborator
|
Thanks for the PR I layered maintainer commits on top:
Validated: 804 importer and 209 mir-lower tests, the expanded array_constants example on an RTX 5090 (including a |
Signed-off-by: nik <[email protected]>
Use rustc's exact array sizes and tuple offsets, cross-check the translated tuple layout, decode non-empty all-ZST tuples through their aggregate path, and reject pointer relocations before byte lowering. Strengthen runtime, LLVM-shape, and diagnostic coverage while preserving current struct and enum constant handling. Signed-off-by: nihalp <[email protected]>
Signed-off-by: nihalp <[email protected]>
Restore the established primitive and nested-array boundary for pointer-to-array constants, and reject direct tuple pointer relocations before byte decoding can fabricate an address. Add focused unit and end-to-end diagnostics coverage without widening supported aggregate forms. Signed-off-by: nihalp <[email protected]>
opt with plain -O2 keeps the external over-aligned helper, which owns the align-32 spill; once the middle-end internalizes non-root helpers, opt inlines it into check_array_constants and GlobalDCE deletes the definition, so extracting the helper symbol finds nothing. Pick the function that actually survives in each artifact and assert the spill shapes there. The unoptimized-IR assertions keep using the helper symbol, which always exists there.
nihalpasham
force-pushed
the
codex/upstream-tuple-array-constants
branch
from
July 23, 2026 11:24
fe7240d to
5ce84c6
Compare
viktoriavikulya
left a comment
There was a problem hiding this comment.
Tested locally and it works. Consider extracting the retry logic into a shared utility — we have similar code in the auth module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #382.
Summary
MIR import now materializes byte-backed array constants whose elements are supported tuples. Array stride and tuple field positions come from rustc layout, while pointer-bearing allocations remain explicitly unsupported rather than being reconstructed from relocation placeholder bytes.
What changed
Layout-aware aggregate decoding
Correctness and safety hardening
Known separate limitations
Testing
cargo oxide fmt --check-D warningsclippy formir-importer,array_constants, anderror_tuple_array_provenance.mir-importertests and error-example status synchronization.sm_86) optimized and no-opt execution: all 24 threads passed.Checklist
upstream/main