Function version_check::supports_feature[][src]

pub fn supports_feature(feature: &str) -> Option<bool>
Expand description

Checks whether the running or installed rustc supports feature.

Returns true iff is_feature_flaggable() returns true and the feature is not disabled via exclusion in allow-features via RUSTFLAGS or CARGO_ENCODED_RUSTFLAGS. If the version could not be determined, returns None.

Example

use version_check as rustc;

if let Some(true) = rustc::supports_feature("doc_cfg") {
   println!("cargo:rustc-cfg=has_doc_cfg");
}