@@ -2232,6 +2232,12 @@ impl Clean<Vec<Item>> for doctree::ExternCrate<'_> {
2232
2232
2233
2233
impl Clean < Vec < Item > > for doctree:: Import < ' _ > {
2234
2234
fn clean ( & self , cx : & DocContext < ' _ > ) -> Vec < Item > {
2235
+ // We need this comparison because some imports (for std types for example)
2236
+ // are "inserted" as well but directly by the compiler and they should not be
2237
+ // taken into account.
2238
+ if self . span . is_dummy ( ) {
2239
+ return Vec :: new ( ) ;
2240
+ }
2235
2241
// We consider inlining the documentation of `pub use` statements, but we
2236
2242
// forcefully don't inline if this is not public or if the
2237
2243
// #[doc(no_inline)] attribute is present.
@@ -2254,11 +2260,20 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
2254
2260
let inner = if self . glob {
2255
2261
if !denied {
2256
2262
let mut visited = FxHashSet :: default ( ) ;
2257
- if let Some ( items) = inline:: try_inline_glob ( cx, path. res , & mut visited) {
2263
+ if let Some ( mut items) = inline:: try_inline_glob ( cx, path. res , & mut visited) {
2264
+ items. push ( Item {
2265
+ name : None ,
2266
+ attrs : self . attrs . clean ( cx) ,
2267
+ source : self . span . clean ( cx) ,
2268
+ def_id : cx. tcx . hir ( ) . local_def_id ( self . id ) . to_def_id ( ) ,
2269
+ visibility : self . vis . clean ( cx) ,
2270
+ stability : None ,
2271
+ deprecation : None ,
2272
+ inner : ImportItem ( Import :: Glob ( resolve_use_source ( cx, path) ) ) ,
2273
+ } ) ;
2258
2274
return items;
2259
2275
}
2260
2276
}
2261
-
2262
2277
Import :: Glob ( resolve_use_source ( cx, path) )
2263
2278
} else {
2264
2279
let name = self . name ;
@@ -2273,14 +2288,28 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
2273
2288
}
2274
2289
if !denied {
2275
2290
let mut visited = FxHashSet :: default ( ) ;
2276
- if let Some ( items) = inline:: try_inline (
2291
+
2292
+ if let Some ( mut items) = inline:: try_inline (
2277
2293
cx,
2278
2294
cx. tcx . parent_module ( self . id ) . to_def_id ( ) ,
2279
2295
path. res ,
2280
2296
name,
2281
2297
Some ( self . attrs ) ,
2282
2298
& mut visited,
2283
2299
) {
2300
+ items. push ( Item {
2301
+ name : None ,
2302
+ attrs : self . attrs . clean ( cx) ,
2303
+ source : self . span . clean ( cx) ,
2304
+ def_id : cx. tcx . hir ( ) . local_def_id ( self . id ) . to_def_id ( ) ,
2305
+ visibility : self . vis . clean ( cx) ,
2306
+ stability : None ,
2307
+ deprecation : None ,
2308
+ inner : ImportItem ( Import :: Simple (
2309
+ self . name . clean ( cx) ,
2310
+ resolve_use_source ( cx, path) ,
2311
+ ) ) ,
2312
+ } ) ;
2284
2313
return items;
2285
2314
}
2286
2315
}
0 commit comments