Skip to content

Commit c91c1dd

Browse files
Wip
1 parent 6223d71 commit c91c1dd

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
@@ -2673,14 +2673,12 @@ fn add_without_unwanted_attributes<'hir>(
26732673
import_parent,
26742674
));
26752675
}
2676-
hir::Attribute::Unparsed(normal) if let [ident] = &*normal.path.segments => {
2677-
if is_inline || ident.name != sym::cfg_trace {
2678-
// If it's not a `cfg()` attribute, we keep it.
2679-
attrs.push((Cow::Borrowed(attr), import_parent));
2680-
}
2676+
hir::Attribute::Unparsed(..) => {
2677+
attrs.push((Cow::Borrowed(attr), import_parent));
26812678
}
26822679
// FIXME: make sure to exclude `#[cfg_trace]` here when it is ported to the new parsers
2683-
hir::Attribute::Parsed(..) => {
2680+
hir::Attribute::Parsed(parsed) => {
2681+
if
26842682
attrs.push((Cow::Borrowed(attr), import_parent));
26852683
}
26862684
_ => {}

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)