-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
A-featuresArea: features — conditional compilationArea: features — conditional compilation
Description
Cargo should allow writing:
[package]
# ...
[features]
a = []
[example]
src = "examples/example-that-uses-a.rs"
features = ["a"]example-that-uses-a would only be compiled if you call cargo test --features "a".
More formally, examples should have the possibiliy to declare a list of features that must be enabled for this example to be compiled.
The motivation is to avoid having to write ugly code like this one.
Newcomers often copy-paste a library's examples to get started, and don't necessarly understand what the #![cfg(feature)] thing is and that they shouldn't copy it.
dilawar
Metadata
Metadata
Assignees
Labels
A-featuresArea: features — conditional compilationArea: features — conditional compilation