Stream: t-compiler/rust-analyzer

Topic: Detect via cfg


Diggsey (Oct 09 2020 at 18:18, on Zulip):

Is there a way to detect RA via a cfg() statement?

Diggsey (Oct 09 2020 at 18:18, on Zulip):

I would like to hide some use statements that cause problems for RA

Jonas Schievink [he/him] (Oct 09 2020 at 18:19, on Zulip):

No

Jonas Schievink [he/him] (Oct 09 2020 at 18:19, on Zulip):

Which ones cause issues?

Diggsey (Oct 09 2020 at 18:19, on Zulip):

I have two crate features which are mutually exclusive

Diggsey (Oct 09 2020 at 18:20, on Zulip):

and I want that to be an error if a downstream crate tries to enable both features, but I don't want RA to complain about it whilst I'm developing the crate

Lukas Wirth (Oct 09 2020 at 18:21, on Zulip):

You could do something like that once https://github.com/rust-analyzer/rust-analyzer/pull/6099 lands I think

Lukas Wirth (Oct 09 2020 at 18:21, on Zulip):

By having RA always set a specific env var

Laurențiu (Oct 09 2020 at 18:22, on Zulip):

rust-analyzer.cargo.allFeatures is disabled these days, shouldn't it avoid that issue?

Hmm.

Diggsey (Oct 09 2020 at 18:22, on Zulip):

I would still like RA to run on both features though

Diggsey (Oct 09 2020 at 18:22, on Zulip):

I just want to disable the conflicting use statement

Diggsey (Oct 09 2020 at 18:25, on Zulip):

I suppose I could add a feature for RA

Diggsey (Oct 09 2020 at 18:25, on Zulip):

and cfg on that

matklad (Oct 12 2020 at 10:22, on Zulip):

Yeah, adding a feature is the way to go.

matklad (Oct 12 2020 at 10:23, on Zulip):

Should have designed the language such that cfg-ing happens during monomorphisation, but that ship has sailed :)

matklad (Oct 12 2020 at 11:06, on Zulip):

(deleted)

Last update: Jul 26 2021 at 13:00UTC