Adopt the Polonius-enabled nightly and retire the -Z directive - #577
Adopt the Polonius-enabled nightly and retire the -Z directive#577leynos wants to merge 1 commit into
Conversation
|
Warning Your free Security trial is over. An organization admin can activate billing to continue. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Reviewer's GuideMoves the pinned Rust toolchain to a Polonius-default nightly and removes all Sequence diagram for UI harness dependency discoverysequenceDiagram
participant Harness as UI test harness
participant Cargo as Cargo 1.99
participant Rustc as rustc fixture compiler
Harness->>Cargo: cargo metadata/build with JSON messages
Cargo-->>Harness: compiler-artifact loadable filenames
Harness->>Harness: profile_dir(executable_path)
Harness->>Rustc: Compile fixture with -L dependency=parent_directories
Rustc-->>Harness: Fixture result
Flow diagram for the toolchain contract safeguardflowchart TD
Start[Build configuration] --> Channel[Read pinned channel]
Channel --> ValidChannel{Dated nightly >= 2026-08-04?}
ValidChannel -- No --> Fail[Contract test fails]
ValidChannel -- Yes --> Scan[Scan Makefile, Cargo config, and workflows]
Scan --> Directive{-Zpolonius directive found?}
Directive -- Yes --> Fail
Directive -- No --> Pass[Policy accepted]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Bump the pinned toolchain from nightly-2026-06-25 to nightly-2026-08-13. Nightlies dated 2026-08-04 and later run the Polonius alpha analysis by default, so the dated pin now carries the borrow-checker requirement on its own and every `-Zpolonius=next` directive is redundant. Remove the flag plumbing wholesale rather than leave it inert. The directive is being retired upstream, and a build that restates it is a build that can silently drop it: - delete `.cargo/config.toml`, whose only purpose was carrying the flag; - drop the Makefile's `POLONIUS_FLAGS` variable and its uses, leaving `kani-full` and the binary-build recipe setting no `RUSTFLAGS` at all; - drop the flag from the dev-fast Cargo fragment and from the four workflows' `with.rustflags` inputs; - drop it from the documented registry-install command. Invert the contract test accordingly: `polonius_toolchain_contract` now requires the pinned channel to be a dated nightly at or after 2026-08-04 and fails if any build configuration reintroduces a `-Zpolonius` directive, instead of asserting the flag is present everywhere. Fix the fallout the newer toolchain surfaces, at the source rather than by suppression: - Cargo 1.99 no longer creates `target/debug/deps/`, running integration tests from `<profile>/build/<pkg>/<hash>/out/` and giving every crate its own directory. Teach the `netsuke` binary locator to derive the profile directory from either layout, and teach the two UI-fixture harnesses to collect the parent of every loadable artefact Cargo reports. The latter must accept proc-macro dynamic libraries as well as rlibs: a shared `deps/` used to pick them up for free, so an rlib-only filter went unnoticed until each crate got its own directory. - Satisfy clippy's new `assert_is_empty` and `chunks_exact_to_as_chunks` lints. - Split `test_support/src/netsuke.rs`, which grew past the module line cap, into a parent module and a `locator` submodule. Kani's supporting nightly (2025-11-21 for 0.67.0) predates the Polonius default, so `make kani-full` borrow-checks under NLL. That is harmless while no `POLONIUS(...)` sites exist; the guide and migration notes record the gap and say to move Kani forward rather than reinstate the directive. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
d828eff to
f1923cd
Compare
Summary
This branch moves the pinned Rust toolchain from
nightly-2026-06-25tonightly-2026-08-13and removes every instruction that passed a-Zpoloniusdirective to Cargo. Nightlies dated 2026-08-04 and later run thePolonius alpha analysis by default, so the dated pin now carries the
borrow-checker requirement on its own and the directive is redundant.
The plumbing is removed wholesale rather than left inert. The directive is
being retired upstream, and a build that restates it is a build that can
silently drop it — the failure mode the old contract test existed to catch.
ADR-006's decision is unchanged; only the mechanism that implements it is.
Review walkthrough
Start with the two files that define the new policy:
— the bumped pin, and the comment explaining that the channel is now the
whole mechanism.
— the amended Decision section. It records what the retired plumbing was
and why it existed, so the removal reads as a supersession rather than a
gap.
Then the inverted contract, which is the safeguard against regression:
— the test no longer asserts the flag is present everywhere. It now
requires the pinned channel to be a dated nightly at or after 2026-08-04,
and fails if any build-configuration surface reintroduces a
-Zpoloniusdirective.
Then the removals themselves, which are mechanical:
.cargo/config.tomlis deleted; carrying the flag was its only purpose.—
POLONIUS_FLAGSis gone.kani-fulland the binary-build recipe now setno
RUSTFLAGSat all, so only the lint gates set it, and only to denywarnings.
and the four workflows'
with.rustflagsinputs.— the rewritten "Toolchain and borrow checker" section, and the
shared-action contract
below it.
Finish with the fallout the newer toolchain surfaced, which is the least
obvious part of the branch. Cargo 1.99 no longer creates
target/debug/deps/:it runs integration tests from
<profile>/build/<pkg>/<hash>/out/and givesevery crate its own directory.
—
profile_dirderives the profile directory from either executablelayout. This module is new only in the sense that it was split out of
test_support/src/netsuke.rs, which had grown past the module line cap.and
tests/command_env_ui_tests.rs
— both UI-fixture harnesses now collect the parent directory of every
loadable artefact Cargo reports. Note that this must accept proc-macro
dynamic libraries as well as rlibs: a shared
deps/directory used to pickproc macros up as a side effect, so an rlib-only filter went unnoticed
until each crate got its own directory, at which point dependents failed
with
E0463.Two clippy lints new to this nightly are fixed at the source rather than
suppressed:
assert_is_emptyintests/ir_tests.rs,
src/graph_view/tests.rs
and
src/status_timing_tests.rs,
and
chunks_exact_to_as_chunksinsrc/hex_property_tests.rs.
Validation
All four gates run on the bumped toolchain, sequentially, from a clean tree:
The Polonius default was verified empirically rather than taken from the
compiler's
-Z helptext, which still reportsdefault: no. The classicNLL problem case #3 — a conditional early return of a borrow from a map —
compiles with no flag on
nightly-2026-08-13and is rejected onnightly-2026-06-25.Notes
which for 0.67.0 is
nightly-2025-11-21— earlier than the Poloniusdefault. Under the retired flag,
make kani-fullpassed-Zpolonius=nextthrough
RUSTFLAGSand so got the analysis; it no longer does. This isharmless today because the tree has no
POLONIUS(...)-tagged sites, but itis a real gap. Both
docs/polonius.md
and the developers' guide record it, and say to move Kani forward rather
than reinstate the directive.
-Zpolonius=legacyis not an NLL fallback. It was checked: it acceptsthe same programs as the default. Classifying a new borrow-centric API
against NLL now means compiling it on a pre-2026-08-04 nightly, which
docs/polonius.md
states.
CHANGELOG.mdis unchanged. The repository follows Common Changelogand keeps no
Unreleasedsection; the existing Polonius entry sits underthe released
0.1.0-beta1heading and describes what that release did.Recording this change is left to the next release cut, when the version
heading exists.
RUSTFLAGScontract model was simplified. Every recipe that stillsets
RUSTFLAGSdoes so for one reason — to deny warnings whileconditionally preserving an inherited value — so the per-case
WarningPolicyandInheritancePolicyfields had no remaining variantsand were removed. A recipe needing a different policy will fail the
assertions rather than pass silently, which is the signal to reintroduce
them.
References
Summary by Sourcery
Adopt the Polonius-enabled nightly as the sole borrow-checker configuration and update tooling, tests, and documentation for the new compiler behavior.
Bug Fixes:
Enhancements:
Build:
CI:
Documentation:
Tests:
Chores: