-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Multiple simultaneous target triples #10021
Comments
This is probably a duplicate of the following ticket: #8521 |
I have a similar situation and would find this feature very useful. I can temporarily change the target triple, but because rust-analyzer is never aware of both variants of the code, it can never give me a complete list of references to an item that is used in the two target-specific parts, or check both at once, which would be useful when I am trying to change the interface between the generic code and the target-specific code. (#8521 says it is specifically about two different workspaces, but I have only one workspace. Changing that is an idea I hadn't thought of, and I'm not yet sure whether it would improve the situation more than it complicates it, but regardless, rust-analyzer currently supports neither case.) |
For reference, I stumbled upon something vaguely resembling a workaround: I have an attribute proc-macro that just applies the appropriate EDIT: A similar result could probably be achieved by having a special cargo feature that r-a is configured to pass in, which disables the |
What makes this particularly hard to implement? My naive approach to fix this problem would be to run The current behaviour makes it really difficult to work on crates containing a lot of platform-specific code paths! |
I just noticed this seems to be valid now "rust-analyzer.check.targets": ["aarch64-apple-darwin", "x86_64-apple-darwin"]
|
but is it possible to say "whatever is the default/native target + wasm32-unknown-unknown" ? |
Does not appear so, no, but at least you probably arent changing your host target very often? This doesn't work well in workspaces where some crates only compile on some targets but not others though |
I work in a team; some of us are on different platforms and we would like to share the same editor configuration though, yeah, in our workspace some crates only compile on some targets but not others, so we would need crate-specific configuration here anyway |
It occurs to me that it might be useful for cargo/rustc to have a special target string that means "the host's target triple, whatever that is". That would finish this problem for r-a and also be useful in build tools that have reason to deal with mixed cross-compiling and not. |
I have a project that compiles to both
wasm32-unknown-unknown
and the host triple, with heavy use of#[cfg(target_arch = "wasm32")]
and
#[cfg(not(target_arch = "wasm32"))]
Right now, I can select one or the other target triple with
rust-analyzer.cargo.target
, but I miss errors and warnings from the other, and half of the code is dimmed out.It would be cool to be able to show a combined view of errors and warnings from both triples at the same time, and no code would need to be dimmed.
The text was updated successfully, but these errors were encountered: