Reputation: 4163
Are all attributes in Rust implemented as Macros? Or some native attributes are created specially by the compiler/language and does not use the Macros mechanism?
If there are attributes not created via Macros, how do I identify them?
Upvotes: 3
Views: 241
Reputation: 70970
There are many attributes that are not macros and are treated specifically by the compiler. Examples: #[cfg]
(although this one can be considered as a macro, even if not implemented as one), #[repr]
, #[doc]
, #[allow(...)]
/#[warn(...)]
/#[deny(...)]
/#[forbid(...)]
, and many more.
I don't know a way to identify such attributes except to look at the list of builtin macro attributes and see if they're there.
Upvotes: 2