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.
Implementations§
Source§impl<Toggleability> Stability<Toggleability>
impl<Toggleability> Stability<Toggleability>
Sourcepub fn in_cfg(&self) -> bool
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
.)
Sourcepub fn requires_nightly(&self) -> Option<Symbol>
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
, checkallow_toggle()
- for
cfg(target_feature)
, checkin_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 bytesUnstable
: 36 bytesForbidden
: 20 bytes