Probe cargo for -Z json-target-spec support instead of guessing from the version - #12726
Open
athei wants to merge 1 commit into
Open
Probe cargo for -Z json-target-spec support instead of guessing from the version#12726athei wants to merge 1 commit into
athei wants to merge 1 commit into
Conversation
…the version
Both PolkaVM build paths compile against a `.json` target spec produced by
polkavm-linker and have to decide whether to pass cargo `-Z json-target-spec`:
newer cargo requires the flag, older cargo rejects it as unknown.
Both decided by comparing a version against 1.95 -- the fixture builder against
the *rustc* version, wasm-builder against the cargo version. Neither works. The
flag landed partway through the 1.95 cycle, so a nightly from early in that cycle
reports 1.95 from both binaries while its cargo does not know the flag yet:
rustc 1.95.0-nightly (474276961 2026-01-26)
cargo 1.95.0-nightly (efcd9f586 2026-01-23)
error: unknown `-Z` flag specified: json-target-spec
Ask cargo which unstable flags it accepts instead of inferring it from a version.
athei
force-pushed
the
at/fixtures-json-target-spec
branch
from
July 22, 2026 18:15
41bde5a to
158f93f
Compare
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.
Both PolkaVM build paths compile against a
.jsontarget spec produced bypolkavm-linker,so both have to decide whether to pass cargo
-Z json-target-spec: newer cargo requires theflag for a JSON target, older cargo rejects it as unknown.
Both decided by comparing a version against 1.95.
pallet-revive-fixturescompared therustcversion to gate acargoflag — the wrong binary entirely.wasm-buildercomparedthe cargo version, which looks right but is not sufficient either: the flag landed partway
through the 1.95 cycle, so a nightly from early in that cycle reports 1.95 from both
binaries while its cargo does not know the flag yet:
That is exactly the toolchain in our CI image (
ci-unified:bullseye-1.93.0-2026-01-27), soany job that builds the fixtures on nightly fails:
This is what breaks
check-semveron PRs that touchpallet-revive-fixtures(it is one ofthe few jobs running nightly rather than the pinned stable, because rustdoc JSON is
nightly-only). It was not hit before because no other PR makes
parity-publishrebuild thatcrate, and
wasm-buildernever hit it because its JSON-target path only runs forSUBSTRATE_RUNTIME_TARGET=riscv.Since no version comparison can express "does this cargo accept this flag", ask cargo:
While here, the fixture builder had one more flag on the wrong oracle: a single rustc-version
bool drove both
-Cpanic=immediate-abort(a rustc flag) and the-Zbuild-std-features=panic_immediate_abortfallback (a cargo flag). Those are now separate,each gated on the version of the binary that parses it.
wasm-builderneeded no such change:its
CargoCommand::versionalready comes fromcargo --version, and the rustc version isonly used for the "Using rustc version:" printout.
Testing
nightly-2026-01-27— the CI toolchain — theunknown -Z flagerror is gone.cargo test -p pallet-revive --lib tests::pvm: 137 passed, 0 failed.