rustc_target::target_features

Type Alias StabilityComputed

Source
pub type StabilityComputed = Stability<AllowToggleComputed>;
Expand description

Stability where allow_toggle has already been computed.

Aliased Type§

enum StabilityComputed {
    Stable {
        allow_toggle: AllowToggleComputed,
    },
    Unstable {
        nightly_feature: Symbol,
        allow_toggle: AllowToggleComputed,
    },
    Forbidden {
        reason: &'static str,
    },
}

Variants§

§

Stable

This target feature is stable, it can be used in #[target_feature] and #[cfg(target_feature)].

Fields

§allow_toggle: AllowToggleComputed

When enabling/disabling the feature via -Ctarget-feature or #[target_feature], determine if that is allowed.

§

Unstable

This target feature is unstable. It is only present in #[cfg(target_feature)] on nightly and using it in #[target_feature] requires enabling the given nightly feature.

Fields

§nightly_feature: Symbol

This must be a language feature, or else rustc will ICE when reporting a missing feature gate!

§allow_toggle: AllowToggleComputed

See Stable::allow_toggle comment above.

§

Forbidden

This feature can not be set via -Ctarget-feature or #[target_feature], it can only be set in the target spec. It is never set in cfg(target_feature). Used in particular for features that change the floating-point ABI.

Fields

§reason: &'static str

Implementations§

Source§

impl StabilityComputed

Source

pub fn toggle_allowed(&self, enable: bool) -> Result<(), &'static str>

Returns whether the feature may be toggled via #[target_feature] or -Ctarget-feature. (It might still be nightly-only even if this returns true, so make sure to also check requires_nightly.)

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 40 bytes

Size for each variant:

  • Stable: 36 bytes
  • Unstable: 36 bytes
  • Forbidden: 20 bytes