@@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHashSet;
7
7
use rustc_hir as hir;
8
8
use rustc_hir:: def:: { DefKind , Res } ;
9
9
use rustc_hir:: def_id:: { DefId , CRATE_DEF_INDEX } ;
10
- use rustc_hir:: Mutability ;
10
+ use rustc_hir:: { HirId , Mutability } ;
11
11
use rustc_metadata:: creader:: LoadedMacro ;
12
12
use rustc_middle:: ty:: { self , TyCtxt } ;
13
13
use rustc_mir:: const_eval:: is_min_const_fn;
@@ -122,7 +122,8 @@ crate fn try_inline(
122
122
} ;
123
123
124
124
let target_attrs = load_attrs ( cx, did) ;
125
- let attrs = box merge_attrs ( cx, Some ( parent_module) , target_attrs, attrs_clone, did. is_local ( ) ) ;
125
+ let local_item = DocContext :: as_local_hir_id ( cx. tcx , did) ;
126
+ let attrs = box merge_attrs ( cx, Some ( parent_module) , target_attrs, attrs_clone, local_item) ;
126
127
127
128
cx. inlined . insert ( did) ;
128
129
let what_rustc_thinks = clean:: Item :: from_def_id_and_parts ( did, Some ( name) , kind, cx) ;
@@ -290,22 +291,22 @@ fn merge_attrs(
290
291
parent_module : Option < DefId > ,
291
292
old_attrs : Attrs < ' _ > ,
292
293
new_attrs : Option < Attrs < ' _ > > ,
293
- local : bool ,
294
+ item : Option < HirId > ,
294
295
) -> clean:: Attributes {
295
296
// NOTE: If we have additional attributes (from a re-export),
296
297
// always insert them first. This ensure that re-export
297
298
// doc comments show up before the original doc comments
298
299
// when we render them.
299
300
if let Some ( inner) = new_attrs {
300
301
if let Some ( new_id) = parent_module {
301
- Attributes :: from_ast ( cx. tcx , old_attrs, Some ( ( inner, new_id) ) , local )
302
+ Attributes :: from_ast ( cx. tcx , old_attrs, Some ( ( inner, new_id) ) , item )
302
303
} else {
303
304
let mut both = inner. to_vec ( ) ;
304
305
both. extend_from_slice ( old_attrs) ;
305
- clean_attrs ( & both, local , cx)
306
+ clean_attrs ( & both, item , cx)
306
307
}
307
308
} else {
308
- clean_attrs ( old_attrs, local , cx)
309
+ clean_attrs ( old_attrs, item , cx)
309
310
}
310
311
}
311
312
@@ -416,8 +417,8 @@ crate fn build_impl(
416
417
417
418
debug ! ( "build_impl: impl {:?} for {:?}" , trait_. def_id( ) , for_. def_id( ) ) ;
418
419
419
- let attrs =
420
- box merge_attrs ( cx, parent_module. into ( ) , load_attrs ( cx, did) , attrs, did . is_local ( ) ) ;
420
+ let local_item = DocContext :: as_local_hir_id ( tcx , did ) ;
421
+ let attrs = box merge_attrs ( cx, parent_module. into ( ) , load_attrs ( cx, did) , attrs, local_item ) ;
421
422
debug ! ( "merged_attrs={:?}" , attrs) ;
422
423
423
424
ret. push ( clean:: Item :: from_def_id_and_attrs_and_parts (
0 commit comments