This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,17 @@ impl<'a> DocFolder for Stripper<'a> {
8484 }
8585
8686 // handled in the `strip-priv-imports` pass
87- clean:: ExternCrateItem { .. } | clean:: ImportItem ( ..) => { }
87+ clean:: ExternCrateItem { .. } => { }
88+ clean:: ImportItem ( ref imp) => {
89+ // Because json doesn't inline imports from private modules, we need to mark
90+ // the imported item as retained so it's impls won't be stripped.i
91+ //
92+ // FIXME: Is it necessary to check for json output here: See
93+ // https://github.com/rust-lang/rust/pull/100325#discussion_r941495215
94+ if let Some ( did) = imp. source . did && self . is_json_output {
95+ self . retained . insert ( did. into ( ) ) ;
96+ }
97+ }
8898
8999 clean:: ImplItem ( ..) => { }
90100
Original file line number Diff line number Diff line change 1+ // https://github.com/rust-lang/rust/issues/100252
2+
3+ #![ feature( no_core) ]
4+ #![ no_core]
5+
6+ mod bar {
7+ // @set baz = import_from_private.json "$.index[*][?(@.kind=='struct')].id"
8+ pub struct Baz ;
9+ // @set impl = - "$.index[*][?(@.kind=='impl')].id"
10+ impl Baz {
11+ // @set doit = - "$.index[*][?(@.kind=='method')].id"
12+ pub fn doit ( ) { }
13+ }
14+ }
15+
16+ // @set import = - "$.index[*][?(@.kind=='import')].id"
17+ pub use bar:: Baz ;
18+
19+ // FIXME(adotinthevoid): Use hasexact once #99474 lands
20+
21+ // @has - "$.index[*][?(@.kind=='module')].inner.items[*]" $import
22+ // @is - "$.index[*][?(@.kind=='import')].inner.id" $baz
23+ // @has - "$.index[*][?(@.kind=='struct')].inner.impls[*]" $impl
24+ // @has - "$.index[*][?(@.kind=='impl')].inner.items[*]" $doit
You can’t perform that action at this time.
0 commit comments