File tree 2 files changed +35
-1
lines changed
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> {
84
84
}
85
85
86
86
// 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
+ }
88
98
89
99
clean:: ImplItem ( ..) => { }
90
100
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