Repository navigation
dv: add --rust-target for CPU target selection - #48
Closed
lifetruthuu wants to merge 1 commit into
Closed
lifetruthuu wants to merge 1 commit into
lifetruthuu wants to merge 1 commit into
Conversation
`--targets` selects packages; the CPU architecture was hard-coded to
`x86_64-unknown-none` in `VERIFICATION_RUST_TARGET`. Add a `--rust-target`
option and thread it through every place the constant was used, so a later
architecture can be verified without changing dv again.
- verus.rs: DEFAULT_RUST_TARGET, parse_rust_target, SUPPORTED_RUST_TARGETS
(accepted) and VALIDATED_RUST_TARGETS (x86 only). Experimental targets are
accepted with a warning.
- verus.rs: pass the triple to cargo-verus, dependency resolution, and the
cached dependency file, named {package}.{triple}.{release|debug}.deps.toml.
- doc.rs: use the triple for rustdoc --target and artifact lookup.
- count.rs: count --module selects the #[path] whose cfg(target_arch) matches
the target instead of always the first (x86) declaration.
- main.rs: --rust-target on verify, focus, build, doc, and count, defaulting
to x86. Unsupported triples are rejected at parse time.
Behavior is unchanged for the default target.
lifetruthuu
force-pushed
the
rust-target-option
branch
from
October 20, 2026 06:16
8963cdd to
1eb3fe8
Compare
Marsman1996
self-requested a review
October 20, 2026 06:19
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.
dv: add
--rust-targetfor CPU target selection--targetsselects packages; the CPU architecture was hard-coded tox86_64-unknown-noneinVERIFICATION_RUST_TARGET. This adds a--rust-target <TRIPLE>option and threads it through every place the constantwas used, so a later architecture can be verified without changing
dvagain.Changes
verus.rs: replace the constant withDEFAULT_RUST_TARGET(x86) and aparse_rust_targetvalidator. IntroduceSUPPORTED_RUST_TARGETS(accepted)and
VALIDATED_RUST_TARGETS(x86 only). Experimental targets are acceptedwith a warning that the build is expected to fail.
verus.rs: pass the triple tocargo-verus(--target), dependencyresolution, and the cached dependency file. The cache is named
{package}.{triple}.{release|debug}.deps.toml, so externs for one target orprofile are never reused for another.
doc.rs: use the triple for rustdoc--targetand for locating artifactsunder the triple-prefixed directories.
count.rs: use the triple to find cargo-verus dep-info.count --modulenowselects the
#[path]declaration whosecfg(target_arch)matches the target;previously it always picked the first declaration, the x86 arch module.
main.rs:--rust-targetonverify,focus,build,doc, andcount,defaulting to x86. Unsupported triples are rejected at parse time.
Behavior is unchanged for the default target: every command without the flag
builds and verifies exactly as before.
Compatibility
--targets/--target(doc package) meanings.--disasmstill readslibrary_path(), which ignores the triple. The flagis currently unused (
disassemble()has no caller), so this is not reachable.Tracked for when disassembly is wired up.
Verification
cargo test --lib --bin rust-dv: 11 + 6 passed. Four new tests cover thedefault target, rejection of an unsupported triple, cargo
--targetpropagation, and
count --moduletarget selection. Thecounttest waschecked by mutation: disabling the
cfgmatch makes it fail.rustfmt --checkon the changed files: clean.rust-dv count --module arch::irq --rust-target <triple>on the realostdtree resolves
x86,riscv, andloongarchto their ownirq.rs.rust-dv build --rust-target riscv64imac-unknown-none-elfand theloongarch64triple parse and reach theostdbuild. Both fail insideostdbecause of architecture code that is out of scope for this PR; they are
reported as experimental.
Known test issues, both present on the base commit and unrelated to this PR:
cargo test --test helper_tests:test_get_dependencyfails withNo targets found(it runs from thedvdirectory, which has no vostdworkspace). Not fixed here.
test_new_packagewritesverification/test-packageand inserts aworkspace = ...line at the top ofdv/Cargo.toml. Run it only in a cleancheckout, or revert those two changes afterwards. It was skipped for the
verification above.
Related issues: none.