Function rustdoc::clean::add_without_unwanted_attributes

source ·
fn add_without_unwanted_attributes<'hir>(
    attrs: &mut Vec<(Cow<'hir, Attribute>, Option<DefId>)>,
    new_attrs: &'hir [Attribute],
    is_inline: bool,
    import_parent: Option<DefId>
)
Expand description

When inlining items, we merge their attributes (and all the reexports attributes too) with the final reexport. For example:

#[doc(hidden, cfg(feature = "foo"))]
pub struct Foo;

#[doc(cfg(feature = "bar"))]
#[doc(hidden, no_inline)]
pub use Foo as Foo1;

#[doc(inline)]
pub use Foo2 as Bar;
Run

So Bar at the end will have both cfg(feature = "..."). However, we don’t want to merge all attributes so we filter out the following ones:

  • doc(inline)
  • doc(no_inline)
  • doc(hidden)