Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define target compatibilities in Cargo.toml #8645

Closed
mankinskin opened this issue Aug 24, 2020 · 1 comment
Closed

Define target compatibilities in Cargo.toml #8645

mankinskin opened this issue Aug 24, 2020 · 1 comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@mankinskin
Copy link

mankinskin commented Aug 24, 2020

Problem:
It is difficult to recognize what targets a crate is compatible with. With WASM coming about, it has become more important to know if a crate is WASM-compatible or not, i.e. builds and runs on a wasm32 architecture. One has to try building the crate for the target manually, and if there are issues one needs to find the dependency which may be causing incompatibility by recursing down the dependency tree, following the compiler errors.

Solution:

[build]
targets = [
    "wasm32-unknown-unknown",
    "wasm32-wasi",
    "x86_64-unknown-linux-gnu",
    "i586-pc-windows-msvc",
]
  • Allow crate authors to define compatible targets in the crate configuration
  • check those targets when publishing the crate
  • let cargo make a suggestion to add a target to the list, after target has been checked successfully
  • check the compatible targets of dependencies and point out compatibility conflicts

This would make the compatibility visible in the crate, and make it easier to find compatibility issues.
Another idea is to show the compatible targets in the documentation on docs.rs, to make it even easier to see what targets a crate can be run on.

@mankinskin mankinskin added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Aug 24, 2020
@mankinskin mankinskin changed the title Define multiple targets Define target compatibility in Cargo.toml Aug 24, 2020
@mankinskin mankinskin changed the title Define target compatibility in Cargo.toml Define target compatibilities in Cargo.toml Aug 24, 2020
@ehuss
Copy link
Contributor

ehuss commented Aug 24, 2020

This looks like a duplicate of #6179. Would you mind adding this as a comment over there? The discussion there is a little focused on workspaces, but I think getting all the different use cases together would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants