Skip to content

Commit e8833aa

Browse files
Wip
1 parent b1cb9c7 commit e8833aa

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/librustdoc/clean/cfg.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -859,12 +859,16 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
859859
}
860860
continue;
861861
} else if !cfg_info.parent_is_doc_cfg
862-
&& let Some(ident) = attr.ident()
863-
&& matches!(ident.name, sym::cfg | sym::cfg_trace)
864-
&& let Some(attr) = single(attr.meta_item_list()?)
865-
&& let Ok(new_cfg) = Cfg::parse(&attr)
862+
&& let hir::Attribute::Parsed(AttributeKind::CfgTrace(cfgs, _)) = attr
863+
864+
// && let Some(ident) = attr.ident()
865+
// && matches!(ident.name, sym::cfg | sym::cfg_trace)
866+
// && let Some(attr) = single(attr.meta_item_list()?)
867+
// && let Ok(new_cfg) = Cfg::parse(&attr)
866868
{
867-
cfg_info.current_cfg &= new_cfg;
869+
for new_cfg in cfgs {
870+
cfg_info.current_cfg &= Cfg(new_cfg.clone());
871+
}
868872
}
869873
}
870874

src/librustdoc/clean/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,15 +2679,11 @@ fn add_without_unwanted_attributes<'hir>(
26792679
import_parent,
26802680
));
26812681
}
2682-
hir::Attribute::Unparsed(..) => {
2683-
attrs.push((Cow::Borrowed(attr), import_parent));
2684-
}
2685-
// FIXME: make sure to exclude `#[cfg_trace]` here when it is ported to the new parsers
2686-
hir::Attribute::Parsed(parsed) => {
2687-
if
2682+
// If it's not a `cfg()` attribute, we keep it.
2683+
hir::Attribute::Parsed(AttributeKind::CfgTrace(..)) => {}
2684+
_ => {
26882685
attrs.push((Cow::Borrowed(attr), import_parent));
26892686
}
2690-
_ => {}
26912687
}
26922688
}
26932689
}

0 commit comments

Comments
 (0)