@@ -23,9 +23,9 @@ use rustc_middle::ty::fold::TypeFolder;
23
23
use rustc_middle:: ty:: subst:: { InternalSubsts , Subst } ;
24
24
use rustc_middle:: ty:: { self , AdtKind , Lift , Ty , TyCtxt } ;
25
25
use rustc_mir:: const_eval:: { is_const_fn, is_min_const_fn, is_unstable_const_fn} ;
26
- use rustc_span:: hygiene:: MacroKind ;
26
+ use rustc_span:: hygiene:: { AstPass , MacroKind } ;
27
27
use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
28
- use rustc_span:: { self , Pos } ;
28
+ use rustc_span:: { self , ExpnKind , Pos } ;
29
29
use rustc_typeck:: hir_ty_to_ty;
30
30
31
31
use std:: collections:: hash_map:: Entry ;
@@ -2231,6 +2231,13 @@ impl Clean<Vec<Item>> for doctree::ExternCrate<'_> {
2231
2231
2232
2232
impl Clean < Vec < Item > > for doctree:: Import < ' _ > {
2233
2233
fn clean ( & self , cx : & DocContext < ' _ > ) -> Vec < Item > {
2234
+ // We need this comparison because some imports (for std types for example)
2235
+ // are "inserted" as well but directly by the compiler and they should not be
2236
+ // taken into account.
2237
+ if self . span . ctxt ( ) . outer_expn_data ( ) . kind == ExpnKind :: AstPass ( AstPass :: StdImports ) {
2238
+ return Vec :: new ( ) ;
2239
+ }
2240
+
2234
2241
// We consider inlining the documentation of `pub use` statements, but we
2235
2242
// forcefully don't inline if this is not public or if the
2236
2243
// #[doc(no_inline)] attribute is present.
0 commit comments