Trait rustc_ast::ast_traits::HasAttrs
source · pub trait HasAttrs {
const SUPPORTS_CUSTOM_INNER_ATTRS: bool;
fn attrs(&self) -> &[Attribute];
fn visit_attrs(&mut self, f: impl FnOnce(&mut AttrVec));
}
Expand description
A trait for AST nodes having (or not having) attributes.
Required Associated Constants
This is true
if this HasAttrs
might support ‘custom’ (proc-macro) inner
attributes. Attributes like #![cfg]
and #![cfg_attr]
are not
considered ‘custom’ attributes.
If this is false
, then this HasAttrs
definitely does
not support ‘custom’ inner attributes, which enables some optimizations
during token collection.