diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-26 16:03:12 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-09-27 11:29:50 +0200 |
| commit | 77885fef2cd9a7f9daa4f95336f0cfdeb62b3016 (patch) | |
| tree | 65d6fa476ea49bafef412323035fb7b0e8f11906 /src | |
| parent | ef8b2a26caccba46584e4753c3091218d4a2e17d (diff) | |
| download | rust-77885fef2cd9a7f9daa4f95336f0cfdeb62b3016.tar.gz rust-77885fef2cd9a7f9daa4f95336f0cfdeb62b3016.zip | |
Improve code comments and extend tests for `doc_cfg` feature
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/types.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index c8e9f3dc479..8b8cf19d8e4 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -925,7 +925,8 @@ pub(crate) fn hir_attr_lists<'a, I: IntoIterator<Item = &'a hir::Attribute>>( /// This type keeps track of (doc) cfg information as we go down the item tree. #[derive(Clone, Debug)] pub(crate) struct CfgInfo { - /// List of `doc(auto_cfg(hide(...)))` cfgs. + /// List of currently active `doc(auto_cfg(hide(...)))` cfgs,minus currently active + /// `doc(auto_cfg(show(...)))` cfgs. hidden_cfg: FxHashSet<Cfg>, /// Current computed `cfg`. Each time we enter a new item, this field is updated as well while /// taking into account the `hidden_cfg` information. @@ -1181,7 +1182,8 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute> Some(Arc::new(cfg_info.current_cfg.clone())) } } else { - // Since we always want to collect all `cfg` items, we remove the hidden ones afterward. + // If `doc(auto_cfg)` feature is enabled, we want to collect all `cfg` items, we remove the + // hidden ones afterward. match cfg_info.current_cfg.strip_hidden(&cfg_info.hidden_cfg) { None | Some(Cfg::True) => None, Some(cfg) => Some(Arc::new(cfg)), |
