Macros§
Attribute Macros§
- extension
- Derive an extension trait for a given impl block. The trait name goes into the parenthesized args of the macro, for greppability. For example:
Derive Macros§
- Decodable
- Decodable_
NoContext - Diagnostic
- Encodable
- Encodable_
NoContext - Hash
Stable - Hash
Stable_ Generic - Hash
Stable_ NoContext HashStable
implementation that has noHashStableContext
bound and which addswhere
bounds forHashStable
based off of fields and not generics. This is suitable for use in crates likerustc_type_ir
.- Lift
- Lint
Diagnostic - Metadata
Decodable - Metadata
Encodable - Print
Attribute - Derives
PrintAttribute
forAttributeKind
. This macro is pretty specific torustc_attr_data_structures
and likely not that useful in other places. It’s deriving something close toDebug
without printing some extraenous things like spans. - Subdiagnostic
- TryFrom
U32 - Derives
TryFrom<u32>
for the annotatedenum
, which must have no fields. Each variant maps to the value it would produce under anas u32
cast. - TyDecodable
- TyEncodable
- Type
Foldable - Derives
TypeFoldable
for the annotatedstruct
orenum
(union
is not supported). - Type
Visitable - Derives
TypeVisitable
for the annotatedstruct
orenum
(union
is not supported).