pub enum SyntheticAttr {
CfgTrace(CfgEntry),
CfgAttrTrace,
}Expand description
Synthetic attributes are inserted by the compiler. They cannot be written in source code, and so cannot be pretty-printed by the AST pretty printer (because its output should be valid Rust code). They receive special treatment because they must not affect observable language behaviour: they are invisible to proc macros and are unable to re-enter the parser.
Variants§
CfgTrace(CfgEntry)
This synthetic attribute is added by the compiler when a cfg attribute is expanded so that
subsequent code can tell that conditional compilation occurred. A #[cfg(pred)] with a
true predicate is replaced by a synthetic CfgTrace attribute that records the parsed
predicate. A #[cfg(pred)] with a false predicate leaves no trace because there is no node
left to annotate.
The attribute is used for some diagnostics, by rustdoc (for detecting feature usage), and by some clippy lints.
CfgAttrTrace
This synthetic attribute is added by the compiler when a cfg_attr attribute is expanded so
that subsequent code can tell that conditional compilation occurred. A #[cfg_attr(pred, attrs)] is replaced by a synthetic CfgAttrTrace attribute whether the predicate
evaluated true or not (or even failed to parse). The pred and attrs are not recorded
because they are not needed.
The attribute is used by some clippy lints.
Trait Implementations§
Source§impl Clone for SyntheticAttr
impl Clone for SyntheticAttr
Source§fn clone(&self) -> SyntheticAttr
fn clone(&self) -> SyntheticAttr
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyntheticAttr
impl Debug for SyntheticAttr
Source§impl<__D: SpanDecoder> Decodable<__D> for SyntheticAttr
impl<__D: SpanDecoder> Decodable<__D> for SyntheticAttr
Source§impl<__E: SpanEncoder> Encodable<__E> for SyntheticAttr
impl<__E: SpanEncoder> Encodable<__E> for SyntheticAttr
Source§impl<V: MutVisitor> MutVisitable<V> for SyntheticAttr
impl<V: MutVisitor> MutVisitable<V> for SyntheticAttr
Source§impl StableHash for SyntheticAttr
impl StableHash for SyntheticAttr
fn stable_hash<__Hcx: StableHashCtxt>( &self, __hcx: &mut __Hcx, __hasher: &mut StableHasher, )
Auto Trait Implementations§
impl DynSend for SyntheticAttr
impl DynSync for SyntheticAttr
impl Freeze for SyntheticAttr
impl RefUnwindSafe for SyntheticAttr
impl Send for SyntheticAttr
impl Sync for SyntheticAttr
impl Unpin for SyntheticAttr
impl UnsafeUnpin for SyntheticAttr
impl UnwindSafe for SyntheticAttr
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> 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<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>
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: 24 bytes
Size for each variant:
CfgTrace: 24 bytesCfgAttrTrace: 0 bytes