Skip to content

Commit b1cb9c7

Browse files
Wip
1 parent ce57a19 commit b1cb9c7

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,14 +2679,12 @@ fn add_without_unwanted_attributes<'hir>(
26792679
import_parent,
26802680
));
26812681
}
2682-
hir::Attribute::Unparsed(normal) if let [ident] = &*normal.path.segments => {
2683-
if is_inline || ident.name != sym::cfg_trace {
2684-
// If it's not a `cfg()` attribute, we keep it.
2685-
attrs.push((Cow::Borrowed(attr), import_parent));
2686-
}
2682+
hir::Attribute::Unparsed(..) => {
2683+
attrs.push((Cow::Borrowed(attr), import_parent));
26872684
}
26882685
// FIXME: make sure to exclude `#[cfg_trace]` here when it is ported to the new parsers
2689-
hir::Attribute::Parsed(..) => {
2686+
hir::Attribute::Parsed(parsed) => {
2687+
if
26902688
attrs.push((Cow::Borrowed(attr), import_parent));
26912689
}
26922690
_ => {}

src/librustdoc/passes/propagate_doc_cfg.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use rustc_hir::Attribute;
44
use rustc_hir::attrs::{AttributeKind, DocAttribute};
5-
use rustc_span::symbol::sym;
65

76
use crate::clean::inline::{load_attrs, merge_attrs};
87
use crate::clean::{CfgInfo, Crate, Item, ItemKind};
@@ -39,10 +38,7 @@ fn add_only_cfg_attributes(attrs: &mut Vec<Attribute>, new_attrs: &[Attribute])
3938
let mut new_attr = DocAttribute::default();
4039
new_attr.cfg = d.cfg.clone();
4140
attrs.push(Attribute::Parsed(AttributeKind::Doc(Box::new(new_attr))));
42-
} else if let Attribute::Unparsed(normal) = attr
43-
&& let [ident] = &*normal.path.segments
44-
&& ident.name == sym::cfg_trace
45-
{
41+
} else if let Attribute::Parsed(AttributeKind::CfgTrace(..)) = attr {
4642
// If it's a `cfg()` attribute, we keep it.
4743
attrs.push(attr.clone());
4844
}

0 commit comments

Comments
 (0)