Crate rustc_feature

source ·
Expand description

Feature gates

This crate declares the set of past and present unstable features in the compiler. Feature gate checking itself is done in rustc_ast_passes/src/ at the moment.

Features are enabled in programs via the crate-level attributes of #![feature(...)] with a comma-separated list of features.

For the purpose of future feature-tracking, once a feature gate is added, even if it is stabilized or removed, do not remove it. Instead, move the symbol to the accepted or removed modules respectively.


accepted 🔒
List of the accepted feature gates.
active 🔒
List of the active feature gates.
Built-in attributes and cfg flag gating.
removed 🔒
List of the removed feature gates.


A template that the attribute input must match. Only top-level shape (#[attr] vs #[attr(...)] vs #[attr = ...]) is considered now.
A set of features to be used by later passes.


How to handle multiple duplicate attributes on the same item.


Those language feature has since been Accepted (it was once Active)
Represents active features that are currently being implemented or currently being considered for addition/removal.
Attributes that have a special meaning to rustc or rustdoc.
Some features are not allowed to be used together at the same time, if the two are present, produce an error.
Represents unstable features which have since been removed (it was once Active)
Represents stable features which have since been removed (it was once Accepted)



Find a gated cfg determined by the predicate which is given the cfg’s name.
Whether this builtin attribute is only used in the local crate. If so, it is not encoded in the crate metadata.
to_nonzero 🔒

Type Definitions