Repository navigation
fix(rustlantis): validate place projections against LocalDecls - #1263
Merged
nihalpasham merged 2 commits intoSep 18, 2026
Merged
nihalpasham merged 2 commits into
nihalpasham merged 2 commits into
Conversation
nightly-2026-08-28, pinned in NVIDIA#1201, removed the `box_patterns` feature, so the vendored `mir` crate fails with E0557 and neither `generate` nor `tools/mir_generator.py` builds. Nothing in the crate uses box patterns. The rustlantis workspace is not built in CI, so the break went unnoticed. Signed-off-by: sachin <sachinsharma3191@gmail.com>
`Place::from_projected` and `Place::project` now validate against the body's `LocalDecls` and return a `ProjectionError`, so a malformed chain fails where the generator builds it rather than in the emitted custom MIR, where rustc rejects it (or ICEs on a bad downcast) and `run_seed.py` records a backend COMPILE_FAIL. - `Index` must name a declared `usize` local. - Projection type rules live in `TyId::project_one`, shared by `projected_ty` and construction: deref of a pointer, tuple/struct field bounds, `Field` only on structs, array (constant) indexing, and `DowncastField` variant/field bounds and stored field type. - `PlacePath::to_place` and `PlaceSelector::into_iter_place` take the current body's `LocalDecls`; `to_place` panics on an invalid path. - `project` leaves the place unchanged on error. Generated programs are byte-identical to before for the sampled seeds. Tests cover the `to_place` path (non-usize and undeclared index locals, plus a valid control) and each rejection in `mir`. Signed-off-by: sachin <sachinsharma3191@gmail.com>
nihalpasham
force-pushed
the
fix/1160-rustlantis-place-validation
branch
from
September 18, 2026 03:49
47efb61 to
21d460f
Compare
nihalpasham
reviewed
Sep 18, 2026
Collaborator
There was a problem hiding this comment.
I kept the validation against the body's actual local declarations and rebased and signed the contributor commits.
The projection rules have one owner, and a failed extension leaves the original place unchanged. All 38 affected workspace tests pass; disabling index-local validation makes both generator-path regressions fail. Seeds 0–199 also stay byte-identical under both configs. Existing vendored lint warnings remain.
This addresses #1160 as defensive validation: it catches malformed generator state earlier, without claiming an existing generated miscompile. #1262 is the build prerequisite.
Checked at 21d460fe. Hosted CI also passes on this head.
nihalpasham
approved these changes
Sep 18, 2026
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.
What this adds
Rustlantis now checks projection chains when it constructs a place. An invalid array index or field path is reported by the generator, before it can become a misleading backend compilation failure.
This is defensive hardening. No existing generated seed has been shown to require it.
What changed
LocalDecls, including the existence andusizetype of index locals.Verification
Checked at
21d460fe:usizecontrol passes with validation enabled.The workspace test run excludes
difftest, whose external compiler/Miri configurations are separate. Existing vendored Clippy and rustdoc warnings remain; strict Clippy stops in unchangedabi/src/size.rs.Closes #1160 as defensive construction validation. Depends on #1262.