Skip to content

feat(cli): list Rust to Zig target mappings - #521

Open
1998LJ wants to merge 1 commit into
rust-cross:mainfrom
1998LJ:feat/519-list-target-mappings
Open

1998LJ wants to merge 1 commit into
rust-cross:mainfrom
1998LJ:feat/519-list-target-mappings

Conversation

@1998LJ

@1998LJ 1998LJ commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses #519.

  • Add cargo zigbuild --list-target-mappings, listing the installed Rust toolchain's target triples alongside the Zig triples generated by the existing linker mapping logic for the detected Zig version.
  • Sort and deduplicate mappings, skip targets without a supported translation, and run without a Cargo project or any compilation.
  • Document the command and its scope (translations, not a guarantee that the SDK/stdlib needed for a cross-build is installed).
  • Add mapping tests for version-dependent x86/macOS behavior, CLI argument parsing, end-to-end output, and rustc errors.

Validation

  • cargo test --locked: passes (all library, CLI, and integration tests).
  • cargo fmt --all -- --check: passes.
  • cargo clippy --all-targets --all-features --locked -- -D warnings -A clippy::useless_conversion -A clippy::useless_borrows_in_formatting -A clippy::chunks_exact_to_as_chunks: passes; the three allowed lint groups originate in existing code with the local Rust 1.99 toolchain.
  • Smoke-tested output with Rust 1.99.1 and Zig 0.17.0 conversion rules; 142 mappings emitted.

The implementation and tests were prepared with AI coding assistance and verified locally.

Signed-off-by: 1998LJ wenjinjia4@gmail.com

Add `cargo zigbuild --list-target-mappings`, using the existing linker
mapping logic and the installed Rust/Zig toolchain versions to show the
available target translations without compiling a project. Document the
new command and test CLI output, error handling, sorting and version
changes.

Refs rust-cross#519.

Signed-off-by: 1998LJ <wenjinjia4@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant