Crate rustc_attr_parsing

Source
Expand description

Functions and types dealing with attributes and meta items.

FIXME(Centril): For now being, much of the logic is still in rustc_ast::attr. The goal is to move the definition of MetaItem and things that don’t need to be in syntax to this crate.

Modules§

attributes 🔒
session_diagnostics 🔒
util

Structs§

Condition
ConstStability
Represents the #[rustc_const_unstable] and #[rustc_const_stable] attributes.
DefaultBodyStability
Represents the #[rustc_default_body_unstable] attribute.
Deprecation
PartialConstStability
Excludes const_stable_indirect. This is necessary because when -Zforce-unstable-if-unmarked is set, we need to encode standalone #[rustc_const_stable_indirect] attributes
RustcVersion
Stability
Represents the following attributes:

Enums§

DeprecatedSince
Release in which an API is deprecated.
DiagnosticAttribute
InlineAttr
InstructionSetAttr
IntType
OptimizeAttr
ReprAttr
StabilityLevel
The available stability levels.
StableSince
Rust release in which a feature is stabilized.
TransparencyError
UnstableReason

Constants§

VERSION_PLACEHOLDER
The version placeholder that recently stabilized features contain inside the since field of the #[stable] attribute.

Statics§

DEFAULT_LOCALE_RESOURCE
Raw content of Fluent resource for this crate, generated by fluent_messages macro, imported by rustc_driver to include all crates’ resources in one bundle.

Functions§

allow_internal_unstable
cfg_matches
Tests if a cfg-pattern matches the cfg set
eval_condition
Evaluate a cfg-like condition (with any and all), using eval to evaluate individual items.
find_body_stability
Collects stability info from rustc_default_body_unstable attributes in attrs. Returns None if no stability attributes are found.
find_const_stability
Collects stability info from rustc_const_stable/rustc_const_unstable/rustc_promotable attributes in attrs. Returns None if no stability attributes are found.
find_crate_name
find_deprecation
Finds the deprecation attribute. None if none exists.
find_repr_attrs
Parse #[repr(…)] forms.
find_stability
Collects stability info from stable/unstable/rustc_allowed_through_unstable_modules attributes in attrs. Returns None if no stability attributes are found.
find_transparency
is_builtin_attr
parse_alignment
parse_confusables
Read the content of a rustc_confusables attribute, and return the list of candidate names.
parse_repr_attr
parse_version
Parse a rustc version number written inside string literal in an attribute, like appears in since = "1.0.0". Suffixes like “-dev” and “-nightly” are not accepted in this position, unlike when parsing CFG_RELEASE.
rustc_allow_const_fn_unstable
unmarked_crate_const_stab
Calculates the const stability for a const function in a -Zforce-unstable-if-unmarked crate without the staged_api feature.