Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Wip
  • Loading branch information
JonathanBrouwer committed Dec 17, 2025
commit 320a7793d19e6a28bd862bd2baf8ec5b8bfe433f
14 changes: 9 additions & 5 deletions src/librustdoc/clean/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,12 +859,16 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
}
continue;
} else if !cfg_info.parent_is_doc_cfg
&& let Some(ident) = attr.ident()
&& matches!(ident.name, sym::cfg | sym::cfg_trace)
&& let Some(attr) = single(attr.meta_item_list()?)
&& let Ok(new_cfg) = Cfg::parse(&attr)
&& let hir::Attribute::Parsed(AttributeKind::CfgTrace(cfgs, _)) = attr

// && let Some(ident) = attr.ident()
// && matches!(ident.name, sym::cfg | sym::cfg_trace)
// && let Some(attr) = single(attr.meta_item_list()?)
// && let Ok(new_cfg) = Cfg::parse(&attr)
{
cfg_info.current_cfg &= new_cfg;
for new_cfg in cfgs {
cfg_info.current_cfg &= Cfg(new_cfg.clone());
}
}
}

Expand Down
10 changes: 3 additions & 7 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2673,15 +2673,11 @@ fn add_without_unwanted_attributes<'hir>(
import_parent,
));
}
hir::Attribute::Unparsed(..) => {
attrs.push((Cow::Borrowed(attr), import_parent));
}
// FIXME: make sure to exclude `#[cfg_trace]` here when it is ported to the new parsers
hir::Attribute::Parsed(parsed) => {
if
// If it's not a `cfg()` attribute, we keep it.
hir::Attribute::Parsed(AttributeKind::CfgTrace(..)) if !is_inline => {}
_ => {
attrs.push((Cow::Borrowed(attr), import_parent));
}
_ => {}
}
}
}
Expand Down