Stream: t-compiler/wg-rls-2.0

Topic: Usage for cross-compiling


simlay (Apr 26 2020 at 21:14, on Zulip):

Hey, so I'm interested in how to setup rust-analyzer for different targets. I've got .cargo/config to include
```target = "x86_64-apple-darwin"in the

matklad (Apr 26 2020 at 21:18, on Zulip):

That's a somewhat popular question recently: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Define.20a.20default.20target/near/195290371

matklad (Apr 26 2020 at 21:18, on Zulip):

I think it should be pretty easy to fix

matklad (Apr 26 2020 at 21:18, on Zulip):

(the linked discussion shows the places where the fix needs to be applied)

matklad (Apr 26 2020 at 21:19, on Zulip):

cc @Jonas Schievink I think you might be hitting this as well probably?

Jonas Schievink (Apr 26 2020 at 21:19, on Zulip):

Not at the moment, but it would be great to have indeed

matklad (Apr 26 2020 at 21:19, on Zulip):

(creating an issue with pointers to code would be appreciated :) )

simlay (Apr 26 2020 at 21:19, on Zulip):

oh nice. I'll create an issue.

Jonas Schievink (Apr 26 2020 at 21:20, on Zulip):

When I work on code that does require setting a target I usually just do cargo check --target xxx in some terminal

matklad (Apr 26 2020 at 21:21, on Zulip):

Yeah, I think it's important to understand that there are two issues here:

matklad (Apr 26 2020 at 21:22, on Zulip):

Although for the second bit I'd expect the [build] in .cargo/confgi to actually fix it....

matklad (Apr 26 2020 at 21:22, on Zulip):

Ahh, that might not be enough, becuase we also query rustc for this info, bypassing cargo

simlay (Apr 26 2020 at 21:23, on Zulip):

ah, yes that makes sense.

Jonas Schievink (Apr 26 2020 at 21:25, on Zulip):

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 #[cfg]s).

matklad (Apr 26 2020 at 21:26, on Zulip):

Would be fun to design a language in such a way that conditional compilation happens after name resolution and not before it D:

Jonas Schievink (Apr 26 2020 at 21:26, on Zulip):

...or in which you wouldn't have to implement a full language interpreter to offer correct completions

matklad (Apr 26 2020 at 21:27, on Zulip):

Well, implementing language interpreter is an easier task than conditional compilation

matklad (Apr 26 2020 at 21:27, on Zulip):

In a sense that constexpr and such have one precise answer

matklad (Apr 26 2020 at 21:28, on Zulip):

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

simlay (Apr 26 2020 at 21:50, on Zulip):

I submitted https://github.com/rust-analyzer/rust-analyzer/issues/4163 with relevant words and links

Last update: May 29 2020 at 17:40UTC