-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add cfg Support for Distinguishing WASI Targets #125803
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
Comments
uhhh cc @alexcrichton @sunfishcode @yoshuawuyts |
|
oh. can someone add that to the platform support page? I don't see it on https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip2.html |
I've added For |
This commit sets the `target_env` key for the `wasm32-wasi{,p1,p1-threads}` targets to the string `"p1"`. This mirrors how the `wasm32-wasip2` target has `target_env = "p2"`. The intention of this is to more easily detect each target in downstream crates to enable adding custom code per-target. cc rust-lang#125803
…s, r=wesleywiser Add `target_env = "p1"` to the `wasm32-wasip1` target This commit sets the `target_env` key for the `wasm32-wasi{,p1,p1-threads}` targets to the string `"p1"`. This mirrors how the `wasm32-wasip2` target has `target_env = "p2"`. The intention of this is to more easily detect each target in downstream crates to enable adding custom code per-target. cc rust-lang#125803 <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> -->
Rollup merge of rust-lang#125869 - alexcrichton:add-p1-to-wasi-targets, r=wesleywiser Add `target_env = "p1"` to the `wasm32-wasip1` target This commit sets the `target_env` key for the `wasm32-wasi{,p1,p1-threads}` targets to the string `"p1"`. This mirrors how the `wasm32-wasip2` target has `target_env = "p2"`. The intention of this is to more easily detect each target in downstream crates to enable adding custom code per-target. cc rust-lang#125803 <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> -->
This seems to have been addressed to our current abilities. Thanks! |
WASI supports different features depending on whether it is p1 or p2. Additionally, p1-threads support threads. The problem is that we cannot determine these distinctions using cfg or similar mechanisms. In crates like tokio, it's impossible to create conditional compilation branches with cfg, such as 'this feature is not available in p1 but is supported in p2, so let's create a conditional branch.'
Therefore, I would like to request support for a method to distinguish WASI targets more precisely using cfg or a similar mechanism.
The text was updated successfully, but these errors were encountered: