@@ -140,6 +140,7 @@ struct CacheBuilder<'a, 'tcx> {
140
140
/// This field is used to prevent duplicated impl blocks.
141
141
impl_ids : DefIdMap < DefIdSet > ,
142
142
tcx : TyCtxt < ' tcx > ,
143
+ is_json_output : bool ,
143
144
}
144
145
145
146
impl Cache {
@@ -184,8 +185,13 @@ impl Cache {
184
185
}
185
186
186
187
let ( krate, mut impl_ids) = {
187
- let mut cache_builder =
188
- CacheBuilder { tcx, cache : & mut cx. cache , impl_ids : Default :: default ( ) } ;
188
+ let is_json_output = cx. is_json_output ( ) ;
189
+ let mut cache_builder = CacheBuilder {
190
+ tcx,
191
+ cache : & mut cx. cache ,
192
+ impl_ids : Default :: default ( ) ,
193
+ is_json_output,
194
+ } ;
189
195
krate = cache_builder. fold_crate ( krate) ;
190
196
( krate, cache_builder. impl_ids )
191
197
} ;
@@ -307,12 +313,13 @@ impl DocFolder for CacheBuilder<'_, '_> {
307
313
| clean:: ProcMacroItem ( ..)
308
314
| clean:: VariantItem ( ..) => {
309
315
use rustc_data_structures:: fx:: IndexEntry as Entry ;
310
- if !self . cache . stripped_mod
311
- && !matches ! (
312
- item. stability. map( |stab| stab. level) ,
313
- Some ( StabilityLevel :: Stable { allowed_through_unstable_modules: true , .. } )
314
- )
315
- {
316
+
317
+ let skip_because_unstable = matches ! (
318
+ item. stability. map( |stab| stab. level) ,
319
+ Some ( StabilityLevel :: Stable { allowed_through_unstable_modules: true , .. } )
320
+ ) ;
321
+
322
+ if ( !self . cache . stripped_mod && !skip_because_unstable) || self . is_json_output {
316
323
// Re-exported items mean that the same id can show up twice
317
324
// in the rustdoc ast that we're looking at. We know,
318
325
// however, that a re-exported item doesn't show up in the
0 commit comments