@@ -5,7 +5,7 @@ use std::sync::Arc;
55
66use rustc_data_structures:: fx:: FxHashSet ;
77use rustc_hir:: def:: { DefKind , Res } ;
8- use rustc_hir:: def_id:: { DefId , DefIdSet , LocalModDefId } ;
8+ use rustc_hir:: def_id:: { DefId , DefIdSet , LocalDefId , LocalModDefId } ;
99use rustc_hir:: Mutability ;
1010use rustc_metadata:: creader:: { CStore , LoadedMacro } ;
1111use rustc_middle:: ty:: fast_reject:: SimplifiedType ;
@@ -43,7 +43,7 @@ pub(crate) fn try_inline(
4343 cx : & mut DocContext < ' _ > ,
4444 res : Res ,
4545 name : Symbol ,
46- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
46+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
4747 visited : & mut DefIdSet ,
4848) -> Option < Vec < clean:: Item > > {
4949 let did = res. opt_def_id ( ) ?;
@@ -157,7 +157,7 @@ pub(crate) fn try_inline(
157157 kind,
158158 did,
159159 name,
160- import_def_id. and_then ( |def_id| def_id . as_local ( ) ) ,
160+ import_def_id,
161161 None ,
162162 ) ;
163163 // The visibility needs to reflect the one from the reexport and not from the "source" DefId.
@@ -198,7 +198,7 @@ pub(crate) fn try_inline_glob(
198198 visited,
199199 inlined_names,
200200 Some ( & reexports) ,
201- Some ( ( attrs, Some ( import. owner_id . def_id . to_def_id ( ) ) ) ) ,
201+ Some ( ( attrs, Some ( import. owner_id . def_id ) ) ) ,
202202 ) ;
203203 items. retain ( |item| {
204204 if let Some ( name) = item. name {
@@ -372,7 +372,7 @@ fn build_type_alias(
372372pub ( crate ) fn build_impls (
373373 cx : & mut DocContext < ' _ > ,
374374 did : DefId ,
375- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
375+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
376376 ret : & mut Vec < clean:: Item > ,
377377) {
378378 let _prof_timer = cx. tcx . sess . prof . generic_activity ( "build_inherent_impls" ) ;
@@ -405,7 +405,7 @@ pub(crate) fn build_impls(
405405pub ( crate ) fn merge_attrs (
406406 cx : & mut DocContext < ' _ > ,
407407 old_attrs : & [ ast:: Attribute ] ,
408- new_attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
408+ new_attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
409409) -> ( clean:: Attributes , Option < Arc < clean:: cfg:: Cfg > > ) {
410410 // NOTE: If we have additional attributes (from a re-export),
411411 // always insert them first. This ensure that re-export
@@ -416,7 +416,7 @@ pub(crate) fn merge_attrs(
416416 both. extend_from_slice ( old_attrs) ;
417417 (
418418 if let Some ( item_id) = item_id {
419- Attributes :: from_ast_with_additional ( old_attrs, ( inner, item_id) )
419+ Attributes :: from_ast_with_additional ( old_attrs, ( inner, item_id. to_def_id ( ) ) )
420420 } else {
421421 Attributes :: from_ast ( & both)
422422 } ,
@@ -431,7 +431,7 @@ pub(crate) fn merge_attrs(
431431pub ( crate ) fn build_impl (
432432 cx : & mut DocContext < ' _ > ,
433433 did : DefId ,
434- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
434+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
435435 ret : & mut Vec < clean:: Item > ,
436436) {
437437 if !cx. inlined . insert ( did. into ( ) ) {
@@ -641,7 +641,7 @@ fn build_module_items(
641641 visited : & mut DefIdSet ,
642642 inlined_names : & mut FxHashSet < ( ItemType , Symbol ) > ,
643643 allowed_def_ids : Option < & DefIdSet > ,
644- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
644+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
645645) -> Vec < clean:: Item > {
646646 let mut items = Vec :: new ( ) ;
647647
@@ -745,15 +745,15 @@ fn build_macro(
745745 cx : & mut DocContext < ' _ > ,
746746 def_id : DefId ,
747747 name : Symbol ,
748- import_def_id : Option < DefId > ,
748+ import_def_id : Option < LocalDefId > ,
749749 macro_kind : MacroKind ,
750750 is_doc_hidden : bool ,
751751) -> clean:: ItemKind {
752752 match CStore :: from_tcx ( cx. tcx ) . load_macro_untracked ( def_id, cx. tcx ) {
753753 LoadedMacro :: MacroDef ( item_def, _) => match macro_kind {
754754 MacroKind :: Bang => {
755755 if let ast:: ItemKind :: MacroDef ( ref def) = item_def. kind {
756- let vis = cx. tcx . visibility ( import_def_id. unwrap_or ( def_id) ) ;
756+ let vis = cx. tcx . visibility ( import_def_id. map ( |d| d . to_def_id ( ) ) . unwrap_or ( def_id) ) ;
757757 clean:: MacroItem ( clean:: Macro {
758758 source : utils:: display_macro_source (
759759 cx,
0 commit comments