rustc_metadata::rmeta::encoder

Function analyze_attr

Source
fn analyze_attr(attr: &Attribute, state: &mut AnalyzeAttrState<'_>) -> bool
Expand description

Returns whether an attribute needs to be recorded in metadata, that is, if it’s usable and useful in downstream crates. Local-only attributes are an obvious example, but some rustdoc-specific attributes can equally be of use while documenting the current crate only.

Removing these superfluous attributes speeds up compilation by making the metadata smaller.

Note: the is_exported parameter is used to cache whether the given DefId has a public visibility: this is a piece of data that can be computed once per defid, and not once per attribute. Some attributes would only be usable downstream if they are public.