pub fn rustc_cfg(key: &str)
Expand description
The rustc-cfg
instruction tells Cargo to pass the given value to the
--cfg
flag
to the compiler. This may be used for compile-time detection of features to
enable conditional compilation.
Note that this does not affect Cargo’s dependency resolution. This cannot be used to enable an optional dependency, or enable other Cargo features.
Be aware that Cargo features use the form feature="foo"
. cfg
values
passed with this flag are not restricted to that form, and may provide just
a single identifier, or any arbitrary key/value pair. For example, emitting
cargo:rustc-cfg=abc
will then allow code to use #[cfg(abc)]
(note the
lack of feature=
). Or an arbitrary key/value pair may be used with an =
symbol like cargo:rustc-cfg=my_component="foo"
. The key should be a Rust
identifier, the value should be a string.