Stream: t-compiler/rust-analyzer

Topic: example required feature


Manmeet Mann (Jan 01 2021 at 09:14, on Zulip):
[[example]]
name = "example"
required-features = ["a/some_feature"]

this doesn't enable a's some_feature in examples/example.rs

Manmeet Mann (Jan 01 2021 at 09:20, on Zulip):

please help me decide a title for issue

bjorn3 (Jan 01 2021 at 09:26, on Zulip):

required-features doesn't cause features to be enabled. Instead it skips building the respective target when the features are not enabled. https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-required-features-field

bjorn3 (Jan 01 2021 at 09:27, on Zulip):

@Manmeet Mann ^

Manmeet Mann (Jan 01 2021 at 09:27, on Zulip):

I have also enabled rust-analyzer.cargo.allFeatures :shrug:

Manmeet Mann (Jan 01 2021 at 09:28, on Zulip):

so atleast I should not get any errors

bjorn3 (Jan 01 2021 at 09:28, on Zulip):

That only enables the features of the current crate.

Manmeet Mann (Jan 01 2021 at 09:28, on Zulip):

and you got a bit late :( https://github.com/rust-analyzer/rust-analyzer/issues/7118
but feel free to close

Manmeet Mann (Jan 01 2021 at 09:29, on Zulip):

I do feel that something should be done regarding this, like skipping the example

bjorn3 (Jan 01 2021 at 09:30, on Zulip):

Yeah, I guess it can be kept open.

Last update: Jul 29 2021 at 09:45UTC