@@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHashSet;
77use rustc_hir as hir;
88use rustc_hir:: def:: { DefKind , Res } ;
99use rustc_hir:: def_id:: { DefId , CRATE_DEF_INDEX } ;
10- use rustc_hir:: Mutability ;
10+ use rustc_hir:: { HirId , Mutability } ;
1111use rustc_metadata:: creader:: LoadedMacro ;
1212use rustc_middle:: ty:: { self , TyCtxt } ;
1313use rustc_mir:: const_eval:: is_min_const_fn;
@@ -122,7 +122,8 @@ crate fn try_inline(
122122 } ;
123123
124124 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) ;
126127
127128 cx. inlined . insert ( did) ;
128129 let what_rustc_thinks = clean:: Item :: from_def_id_and_parts ( did, Some ( name) , kind, cx) ;
@@ -290,22 +291,22 @@ fn merge_attrs(
290291 parent_module : Option < DefId > ,
291292 old_attrs : Attrs < ' _ > ,
292293 new_attrs : Option < Attrs < ' _ > > ,
293- local : bool ,
294+ item : Option < HirId > ,
294295) -> clean:: Attributes {
295296 // NOTE: If we have additional attributes (from a re-export),
296297 // always insert them first. This ensure that re-export
297298 // doc comments show up before the original doc comments
298299 // when we render them.
299300 if let Some ( inner) = new_attrs {
300301 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 )
302303 } else {
303304 let mut both = inner. to_vec ( ) ;
304305 both. extend_from_slice ( old_attrs) ;
305- clean_attrs ( & both, local , cx)
306+ clean_attrs ( & both, item , cx)
306307 }
307308 } else {
308- clean_attrs ( old_attrs, local , cx)
309+ clean_attrs ( old_attrs, item , cx)
309310 }
310311}
311312
@@ -416,8 +417,8 @@ crate fn build_impl(
416417
417418 debug ! ( "build_impl: impl {:?} for {:?}" , trait_. def_id( ) , for_. def_id( ) ) ;
418419
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 ) ;
421422 debug ! ( "merged_attrs={:?}" , attrs) ;
422423
423424 ret. push ( clean:: Item :: from_def_id_and_attrs_and_parts (
0 commit comments