pub struct AutoCfg { /* private fields */ }
Expand description

Helper to detect compiler features for cfg output in build scripts.

Implementations

Create a new AutoCfg instance.

Common errors
  • rustc can’t be executed, from RUSTC or in the PATH.
  • The version output from rustc can’t be parsed.
  • OUT_DIR is not set in the environment, or is not a writable directory.

Create a new AutoCfg instance with the specified output directory.

Common errors
  • rustc can’t be executed, from RUSTC or in the PATH.
  • The version output from rustc can’t be parsed.
  • dir is not a writable directory.

Test whether the current rustc reports a version greater than or equal to “major.minor”.

Sets a cfg value of the form rustc_major_minor, like rustc_1_29, if the current rustc is at least that version.

Tests whether the given sysroot crate can be used.

The test code is subject to change, but currently looks like:

extern crate CRATE as probe;

Emits a config value has_CRATE if probe_sysroot_crate returns true.

Tests whether the given path can be used.

The test code is subject to change, but currently looks like:

pub use PATH;

Emits a config value has_PATH if probe_path returns true.

Any non-identifier characters in the path will be replaced with _ in the generated config value.

Emits the given cfg value if probe_path returns true.

Tests whether the given trait can be used.

The test code is subject to change, but currently looks like:

pub trait Probe: TRAIT + Sized {}

Emits a config value has_TRAIT if probe_trait returns true.

Any non-identifier characters in the trait name will be replaced with _ in the generated config value.

Emits the given cfg value if probe_trait returns true.

Tests whether the given type can be used.

The test code is subject to change, but currently looks like:

pub type Probe = TYPE;

Emits a config value has_TYPE if probe_type returns true.

Any non-identifier characters in the type name will be replaced with _ in the generated config value.

Emits the given cfg value if probe_type returns true.

Tests whether the given expression can be used.

The test code is subject to change, but currently looks like:

pub fn probe() { let _ = EXPR; }

Emits the given cfg value if probe_expression returns true.

Tests whether the given constant expression can be used.

The test code is subject to change, but currently looks like:

pub const PROBE: () = ((), EXPR).0;

Emits the given cfg value if probe_constant returns true.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.