pub enum AttributeKind {
Show 13 variants
AllowConstFnUnstable(ThinVec<Symbol>),
AllowInternalUnstable(ThinVec<(Symbol, Span)>),
BodyStability {
stability: DefaultBodyStability,
span: Span,
},
Confusables {
symbols: ThinVec<Symbol>,
first_span: Span,
},
ConstStability {
stability: PartialConstStability,
span: Span,
},
ConstStabilityIndirect,
Deprecation {
deprecation: Deprecation,
span: Span,
},
Diagnostic(DiagnosticAttribute),
DocComment {
style: AttrStyle,
kind: CommentKind,
span: Span,
comment: Symbol,
},
MacroTransparency(Transparency),
Repr(ThinVec<(ReprAttr, Span)>),
RustcMacroEdition2021,
Stability {
stability: Stability,
span: Span,
},
}
Expand description
Represent parsed, built in, inert attributes.
That means attributes that are not actually ever expanded.
For more information on this, see the module docs on the rustc_attr_parsing
crate.
They’re instead used as markers, to guide the compilation process in various way in most every stage of the compiler.
These are kept around after the AST, into the HIR and further on.
The word “parsed” could be a little misleading here, because the parser already parses
attributes early on. However, the result, an ast::Attribute
is only parsed at a high level, still containing a token stream in many cases. That is
because the structure of the contents varies from attribute to attribute.
With a parsed attribute I mean that each attribute is processed individually into a
final structure, which on-site (the place where the attribute is useful for, think the
the place where must_use
is checked) little to no extra parsing or validating needs to
happen.
For more docs, look in rustc_attr_parsing
.
Variants§
AllowConstFnUnstable(ThinVec<Symbol>)
AllowInternalUnstable(ThinVec<(Symbol, Span)>)
BodyStability
Fields
stability: DefaultBodyStability
Confusables
ConstStability
Fields
stability: PartialConstStability
ConstStabilityIndirect
Deprecation
Diagnostic(DiagnosticAttribute)
DocComment
MacroTransparency(Transparency)
Repr(ThinVec<(ReprAttr, Span)>)
RustcMacroEdition2021
Stability
Trait Implementations§
Source§impl Clone for AttributeKind
impl Clone for AttributeKind
Source§fn clone(&self) -> AttributeKind
fn clone(&self) -> AttributeKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for AttributeKind
impl Debug for AttributeKind
Source§impl<__D> Decodable<__D> for AttributeKindwhere
__D: SpanDecoder,
impl<__D> Decodable<__D> for AttributeKindwhere
__D: SpanDecoder,
fn decode(__decoder: &mut __D) -> AttributeKind
Source§impl<__E> Encodable<__E> for AttributeKindwhere
__E: SpanEncoder,
impl<__E> Encodable<__E> for AttributeKindwhere
__E: SpanEncoder,
Source§impl<__CTX> HashStable<__CTX> for AttributeKindwhere
__CTX: HashStableContext,
impl<__CTX> HashStable<__CTX> for AttributeKindwhere
__CTX: HashStableContext,
fn hash_stable( &self, __hcx: &mut __CTX, __hasher: &mut StableHasher<SipHasher128>, )
Source§impl PrintAttribute for AttributeKind
impl PrintAttribute for AttributeKind
Source§fn should_render(&self) -> bool
fn should_render(&self) -> bool
fn print_attribute(&self, __p: &mut Printer)
Auto Trait Implementations§
impl DynSend for AttributeKind
impl DynSync for AttributeKind
impl Freeze for AttributeKind
impl RefUnwindSafe for AttributeKind
impl Send for AttributeKind
impl Sync for AttributeKind
impl Unpin for AttributeKind
impl UnwindSafe for AttributeKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
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: 32 bytes
Size for each variant:
AllowConstFnUnstable
: 16 bytesAllowInternalUnstable
: 16 bytesBodyStability
: 32 bytesConfusables
: 24 bytesConstStability
: 32 bytesConstStabilityIndirect
: 0 bytesDeprecation
: 28 bytesDiagnostic
: 5 bytesDocComment
: 20 bytesMacroTransparency
: 5 bytesRepr
: 16 bytesRustcMacroEdition2021
: 0 bytesStability
: 32 bytes