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.)

Source§

impl<Toggleability> Stability<Toggleability>

Source

pub fn in_cfg(&self) -> bool

Returns whether the feature can be used in cfg(target_feature) ever. (It might still be nightly-only even if this returns true, so make sure to also check requires_nightly.)

Source

pub fn requires_nightly(&self) -> Option<Symbol>

Returns the nightly feature that is required to toggle this target feature via #[target_feature]/-Ctarget-feature or to test it via cfg(target_feature). (For cfg we only care whether the feature is nightly or not, we don’t require the feature gate to actually be enabled when using a nightly compiler.)

Before calling this, ensure the feature is even permitted for this use:

  • for #[target_feature]/-Ctarget-feature, check allow_toggle()
  • for cfg(target_feature), check in_cfg

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

Trait Implementations

Source§

impl<Toggleability: Clone> Clone for Stability<Toggleability>

Source§

fn clone(&self) -> Stability<Toggleability>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Toggleability: Debug> Debug for Stability<Toggleability>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<CTX, Toggleability: HashStable<CTX>> HashStable<CTX> for Stability<Toggleability>

Source§

fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher)