about summary refs log tree commit diff
path: root/src/librustdoc/formats/cache.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-12 23:08:30 +0000
committerbors <bors@rust-lang.org>2025-01-12 23:08:30 +0000
commite7ad3ae331bf2716389c10e01612e201a7f98c8d (patch)
treefba1893a621dc7f495dd66d6bde0557061bf3d06 /src/librustdoc/formats/cache.rs
parent48a426eca9df23b24b3559e545cf88dee61d4de9 (diff)
parent223a7c12373034817eab620005397edd65b66ef8 (diff)
downloadrust-e7ad3ae331bf2716389c10e01612e201a7f98c8d.tar.gz
rust-e7ad3ae331bf2716389c10e01612e201a7f98c8d.zip
Auto merge of #135420 - GuillaumeGomez:rollup-93vepka, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #135348 (rustdoc-json: Include items in stripped modules in `Crate::paths`.)
 - #135365 (Update the explanation for why we use box_new in vec!)
 - #135383 (De-abstract tagged ptr and make it covariant)
 - #135401 (Remove some empty expected files to fix blessing)
 - #135406 (Update unstable lint docs to include required feature attributes)
 - #135407 (Deny various clippy lints)
 - #135411 (run_make_support: add `#![warn(unreachable_pub)]`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/formats/cache.rs')
-rw-r--r--src/librustdoc/formats/cache.rs23
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