#Communicate build targets to rust analyzer

6 messages · Page 1 of 1 (latest)

junior sable
#

I'm writing something that requires a different implementation between windows and Linux. I'm writing the code on Linux but i have windows-msvc and linux-gnu set as targets. Is there any way to communicate this to rust analyzer so that it stops highlighting the sections of code that are just for windows? (i.e. labled with #[cfg(target_os = "windows")])

mighty cradle
#

I believe you want to configure with
rust-analyzer.check.targets = list of all target triples you want to check on

junior sable
#

thats mostly worked thanks! I also have some conditional dependencies and the LSP doesn't seem to be picking the windows ones up, any idea?

mighty cradle
#

hmm, that sounds odd, no idea

#

I haven't actually worked with that config myself though, and perhaps r-a doesn't actually combine the analysis info from the two checks?

junior sable
#

oh, what's actually even weirder is that it removes the inactive code warning in one place but later on in the same file it's still there