@@ -56,13 +56,10 @@ impl<'a, 'tcx> DocFolder for Stripper<'a, 'tcx> {
56
56
| clean:: TraitItem ( ..)
57
57
| clean:: FunctionItem ( ..)
58
58
| clean:: VariantItem ( ..)
59
- | clean:: MethodItem ( ..)
60
59
| clean:: ForeignFunctionItem ( ..)
61
60
| clean:: ForeignStaticItem ( ..)
62
61
| clean:: ConstantItem ( ..)
63
62
| clean:: UnionItem ( ..)
64
- | clean:: AssocConstItem ( ..)
65
- | clean:: AssocTypeItem ( ..)
66
63
| clean:: TraitAliasItem ( ..)
67
64
| clean:: MacroItem ( ..)
68
65
| clean:: ForeignTypeItem => {
@@ -80,6 +77,16 @@ impl<'a, 'tcx> DocFolder for Stripper<'a, 'tcx> {
80
77
}
81
78
}
82
79
80
+ clean:: MethodItem ( ..) | clean:: AssocConstItem ( ..) | clean:: AssocTypeItem ( ..) => {
81
+ let item_id = i. item_id ;
82
+ if item_id. is_local ( )
83
+ && !self . effective_visibilities . is_reachable ( self . tcx , item_id. expect_def_id ( ) )
84
+ {
85
+ debug ! ( "Stripper: stripping {:?} {:?}" , i. type_( ) , i. name) ;
86
+ return None ;
87
+ }
88
+ }
89
+
83
90
clean:: StructFieldItem ( ..) => {
84
91
if i. visibility ( self . tcx ) != Some ( Visibility :: Public ) {
85
92
return Some ( strip_item ( i) ) ;
@@ -192,16 +199,16 @@ impl<'a> DocFolder for ImplStripper<'a, '_> {
192
199
&& imp. items . iter ( ) . all ( |i| {
193
200
let item_id = i. item_id ;
194
201
item_id. is_local ( )
195
- && !is_item_reachable (
196
- self . tcx ,
197
- self . is_json_output ,
198
- & self . cache . effective_visibilities ,
199
- item_id,
200
- )
202
+ && !self
203
+ . cache
204
+ . effective_visibilities
205
+ . is_reachable ( self . tcx , item_id. expect_def_id ( ) )
201
206
} )
202
207
{
208
+ debug ! ( "ImplStripper: no public item; removing {imp:?}" ) ;
203
209
return None ;
204
210
} else if imp. items . is_empty ( ) && i. doc_value ( ) . is_empty ( ) {
211
+ debug ! ( "ImplStripper: no item and no doc; removing {imp:?}" ) ;
205
212
return None ;
206
213
}
207
214
}
@@ -212,21 +219,21 @@ impl<'a> DocFolder for ImplStripper<'a, '_> {
212
219
&& !imp. for_ . is_assoc_ty ( )
213
220
&& !self . should_keep_impl ( & i, did)
214
221
{
215
- debug ! ( "ImplStripper: impl item for stripped type; removing" ) ;
222
+ debug ! ( "ImplStripper: impl item for stripped type; removing {imp:?} " ) ;
216
223
return None ;
217
224
}
218
225
if let Some ( did) = imp. trait_ . as_ref ( ) . map ( |t| t. def_id ( ) )
219
226
&& !self . should_keep_impl ( & i, did)
220
227
{
221
- debug ! ( "ImplStripper: impl item for stripped trait; removing" ) ;
228
+ debug ! ( "ImplStripper: impl item for stripped trait; removing {imp:?} " ) ;
222
229
return None ;
223
230
}
224
231
if let Some ( generics) = imp. trait_ . as_ref ( ) . and_then ( |t| t. generics ( ) ) {
225
232
for typaram in generics {
226
233
if let Some ( did) = typaram. def_id ( self . cache )
227
234
&& !self . should_keep_impl ( & i, did)
228
235
{
229
- debug ! ( "ImplStripper: stripped item in trait's generics; removing impl " ) ;
236
+ debug ! ( "ImplStripper: stripped item in trait's generics; removing {imp:?} " ) ;
230
237
return None ;
231
238
}
232
239
}
0 commit comments