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

Allow cfg(target="..") #63217

Open
newpavlov opened this issue Aug 2, 2019 · 3 comments
Open

Allow cfg(target="..") #63217

newpavlov opened this issue Aug 2, 2019 · 3 comments
Labels
A-cross Area: Cross compilation C-feature-request Category: A feature request, i.e: not implemented / a PR. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@newpavlov
Copy link
Contributor

Looks like right now it's impossible to match on target triplet directly in cfg expressions. Example (compile to WASM). Is it intentional?

@jonas-schievink jonas-schievink added A-cross Area: Cross compilation C-feature-request Category: A feature request, i.e: not implemented / a PR. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Aug 2, 2019
@Centril
Copy link
Contributor

Centril commented Aug 2, 2019

This issue description is rather vague; it would be good to elaborate on what exactly you want.

@newpavlov
Copy link
Contributor Author

I want the following code to give a compilation error when compiled for wasm32-unknown-unknown target:

#[cfg(target = "wasm32-unknown-unknown")]
compile_error!("foo");

Meaning target = "<target_triplet>" should evaluate to true when code is compiled for the specified target. Right now IIUC it's simply ignored and always evaluated to false.

@newpavlov
Copy link
Contributor Author

Am I correct that for implementing this feature I will need to add the following changes:

Or have I missed something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross Area: Cross compilation C-feature-request Category: A feature request, i.e: not implemented / a PR. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants