diff options
| author | Alona Enraght-Moony <code@alona.page> | 2025-01-10 22:42:53 +0000 |
|---|---|---|
| committer | Alona Enraght-Moony <code@alona.page> | 2025-01-10 23:51:45 +0000 |
| commit | 1fe3331899906fed89750b85a25b9dee5e88fa0e (patch) | |
| tree | fc140b15c0dfa734b205313f0af1165c7c45d7c3 /src | |
| parent | 97ada592c060daee132b473a27dc0f59a82060d6 (diff) | |
| download | rust-1fe3331899906fed89750b85a25b9dee5e88fa0e.tar.gz rust-1fe3331899906fed89750b85a25b9dee5e88fa0e.zip | |
rustdoc-json: Include items in stripped modules in `Crate::paths`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 7a95d33723e..cbb3ce6abe6 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -140,6 +140,7 @@ struct CacheBuilder<'a, 'tcx> { /// This field is used to prevent duplicated impl blocks. impl_ids: DefIdMap<DefIdSet>, tcx: TyCtxt<'tcx>, + is_json_output: bool, } impl Cache { @@ -184,8 +185,13 @@ impl Cache { } let (krate, mut impl_ids) = { - let mut cache_builder = - CacheBuilder { tcx, cache: &mut cx.cache, impl_ids: Default::default() }; + let is_json_output = cx.is_json_output(); + let mut cache_builder = CacheBuilder { + tcx, + cache: &mut cx.cache, + impl_ids: Default::default(), + is_json_output, + }; krate = cache_builder.fold_crate(krate); (krate, cache_builder.impl_ids) }; @@ -307,12 +313,13 @@ impl DocFolder for CacheBuilder<'_, '_> { | clean::ProcMacroItem(..) | clean::VariantItem(..) => { use rustc_data_structures::fx::IndexEntry as Entry; - if !self.cache.stripped_mod - && !matches!( - item.stability.map(|stab| stab.level), - Some(StabilityLevel::Stable { allowed_through_unstable_modules: true, .. }) - ) - { + + let skip_because_unstable = matches!( + item.stability.map(|stab| stab.level), + Some(StabilityLevel::Stable { allowed_through_unstable_modules: true, .. }) + ); + + if (!self.cache.stripped_mod && !skip_because_unstable) || self.is_json_output { // Re-exported items mean that the same id can show up twice // in the rustdoc ast that we're looking at. We know, // however, that a re-exported item doesn't show up in the |
