Hey, so I'm interested in how to setup rust-analyzer for different targets. I've got
.cargo/config to include
[build] target = "x86_64-apple-darwin"
but it doesn't seem to result in rest-analyzer working on the correct target. Is there a github issue for this maybe?
That's a somewhat popular question recently: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Define.20a.20default.20target/near/195290371
I think it should be pretty easy to fix
(the linked discussion shows the places where the fix needs to be applied)
cc @Jonas Schievink I think you might be hitting this as well probably?
Not at the moment, but it would be great to have indeed
(creating an issue with pointers to code would be appreciated :) )
oh nice. I'll create an issue.
When I work on code that does require setting a target I usually just do
cargo check --target xxx in some terminal
Yeah, I think it's important to understand that there are two issues here:
cargo check(and this is possible to tweak today via settings)
cfgwe use to analyze code (and this I think, is unconditionally host today)
Although for the second bit I'd expect the
.cargo/confgi to actually fix it....
Ahh, that might not be enough, becuase we also query rustc for this info, bypassing cargo
ah, yes that makes sense.
Would be fun to treat
#[cfg] like where clauses: When in a function, assume that all
#[cfg]s "in scope" are available (ie. on the function or on its containing items/modules) and provide IDE features based on that (enabling any items with a subset of these
Would be fun to design a language in such a way that conditional compilation happens after name resolution and not before it D:
...or in which you wouldn't have to implement a full language interpreter to offer correct completions
Well, implementing language interpreter is an easier task than conditional compilation
In a sense that constexpr and such have one precise answer
With cross-compilation, you sorta-kinda need to merge analysis results from diffierent sets of enabled cfgs, and that is a problem which is much fuzzier
I submitted https://github.com/rust-analyzer/rust-analyzer/issues/4163 with relevant words and links