Skip to content

refactor(rustlantis): clarify ProjectionIter traversal invariant - #1157

Merged
nihalpasham merged 2 commits into
NVIDIA:mainfrom
uurl:fix/rustlantis-projection-iter-cycles
Aug 28, 2026
Merged

nihalpasham merged 2 commits into
NVIDIA:mainfrom
uurl:fix/rustlantis-projection-iter-cycles

Conversation

@uurl

@uurl uurl commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1156

Summary

Replace a stale ProjectionIter reference-cycle FIXME with documentation of
the traversal invariant that currently prevents the problem.

ProjectionIter::new() may start from any outgoing projection of the root,
including Deref, but subsequent traversal follows only
PlaceNode::subfield_edges.

subfield_edges contains structural projections created by add_place().
Reference edges created by set_ref() are added to the graph but are not added
to subfield_edges.

Therefore, reference cycles in PlaceGraph cannot currently be re-entered by
ProjectionIter.

Changes

  • Replace the stale reference-cycle FIXME with documentation of the actual
    traversal invariant.
  • Add a debug assertion that descendant subfield_edges do not contain
    Deref projections.
  • Preserve the existing traversal behavior.

Testing

cargo fmt --all -- --check
cargo test -p generate
cargo test --workspace
git diff --check

All Rustlantis workspace tests pass.

@uurl
uurl force-pushed the fix/rustlantis-projection-iter-cycles branch from ba0ee33 to a1c644f Compare August 23, 2026 18:38
@uurl uurl changed the title fix(fuzzer): make ProjectionIter cycle-safe refactor(fuzzer): clarify ProjectionIter traversal invariant Aug 23, 2026
@uurl uurl changed the title refactor(fuzzer): clarify ProjectionIter traversal invariant refactor(rustlantis): clarify ProjectionIter traversal invariant Aug 23, 2026
@nihalpasham nihalpasham added on-hold Paused: valid but deferred until a prerequisite decision or dependency resolves fuzzer Fuzzing infrastructure (rustlantis, difftest) refactor Internal restructuring with no behavior change labels Aug 24, 2026
@nihalpasham

nihalpasham commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

This PR is not blocked by a dependency or by the pointer-contract refactor; it remains open in normal review.

  • The change is limited to the ProjectionIter documentation and a debug assertion, and no semantic counterexample was found.
  • The PR body reports formatting, generator-package tests, workspace tests, and a clean diff. Those author-reported results still need independent reproduction on the exact head and current base, together with strict lint and hosted CI checks.
  • Until that verification is complete, the PR is not merge-ready.

The exact-head evidence requirements are described in the Discord acceptance criteria.

@nihalpasham nihalpasham removed the on-hold Paused: valid but deferred until a prerequisite decision or dependency resolves label Aug 24, 2026
@nihalpasham

nihalpasham commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

Verified the documented invariant on main, and it holds:

  • subfield_edges is written only by add_place's four structural arms
  • set_ref puts its Deref edge in the petgraph graph, never in subfield_edges
  • ProjectionIter follows only subfield_edges after the first hop

So cycles can't be re-entered, the FIXME was stale, and the debug_assert sits at the single point any future violating writer must pass. Upstream rustlantis still carries the same FIXME, so documenting it in the vendored copy is right. Closes #1156.

One thing I added at landing: a #[should_panic] test that injects a Deref into subfield_edges and proves the guard fires. CI is approved; we also rerun the nested fuzzer workspace tests, since root --workspace doesn't reach them.

Inject a Deref edge into a place node's subfield_edges (violating the
invariant documented on ProjectionIter) and drive the iterator across
it, checking that the debug_assert at the consumption point fires with
its message. Verified the test stops panicking when the assert is
neutered, so it exercises the guard itself.

Signed-off-by: nihalpasham <[email protected]>

@nihalpasham nihalpasham left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invariant verified on main, guard test added and neuter-checked; CI green. Merging.

@nihalpasham
nihalpasham merged commit 5847eee into NVIDIA:main Aug 28, 2026
51 checks passed
@uurl
uurl deleted the fix/rustlantis-projection-iter-cycles branch August 31, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fuzzer Fuzzing infrastructure (rustlantis, difftest) refactor Internal restructuring with no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rustlantis: clarify ProjectionIter reference-cycle invariant

2 participants