Skip to main content

HasAttrs

Trait HasAttrs 

Source
pub trait HasAttrs<'tcx, Tcx> {
    // Required method
    fn get_attrs(self, tcx: &Tcx) -> &'tcx [Attribute];
}
Expand description

A trait for types that can provide a list of attributes given a TyCtxt.

It is an implementation detail of the find_attr! macro to be able to accept either a DefId, LocalDefId, OwnerId, or HirId. It is defined here with a generic Tcx because this crate can’t depend on rustc_middle. The concrete implementations are in rustc_middle.

Not to be confused with rustc_ast::ast_traits::HasAttrs.

Required Methods§

Source

fn get_attrs(self, tcx: &Tcx) -> &'tcx [Attribute]

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§