@@ -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 ;
@@ -42,7 +42,7 @@ pub(crate) fn try_inline(
4242 cx : & mut DocContext < ' _ > ,
4343 res : Res ,
4444 name : Symbol ,
45- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
45+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
4646 visited : & mut DefIdSet ,
4747) -> Option < Vec < clean:: Item > > {
4848 let did = res. opt_def_id ( ) ?;
@@ -156,7 +156,7 @@ pub(crate) fn try_inline(
156156 kind,
157157 did,
158158 name,
159- import_def_id. and_then ( |def_id| def_id . as_local ( ) ) ,
159+ import_def_id,
160160 None ,
161161 ) ;
162162 // The visibility needs to reflect the one from the reexport and not from the "source" DefId.
@@ -197,7 +197,7 @@ pub(crate) fn try_inline_glob(
197197 visited,
198198 inlined_names,
199199 Some ( & reexports) ,
200- Some ( ( attrs, Some ( import. owner_id . def_id . to_def_id ( ) ) ) ) ,
200+ Some ( ( attrs, Some ( import. owner_id . def_id ) ) ) ,
201201 ) ;
202202 items. retain ( |item| {
203203 if let Some ( name) = item. name {
@@ -371,7 +371,7 @@ fn build_type_alias(
371371pub ( crate ) fn build_impls (
372372 cx : & mut DocContext < ' _ > ,
373373 did : DefId ,
374- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
374+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
375375 ret : & mut Vec < clean:: Item > ,
376376) {
377377 let _prof_timer = cx. tcx . sess . prof . generic_activity ( "build_inherent_impls" ) ;
@@ -404,7 +404,7 @@ pub(crate) fn build_impls(
404404pub ( crate ) fn merge_attrs (
405405 cx : & mut DocContext < ' _ > ,
406406 old_attrs : & [ ast:: Attribute ] ,
407- new_attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
407+ new_attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
408408) -> ( clean:: Attributes , Option < Arc < clean:: cfg:: Cfg > > ) {
409409 // NOTE: If we have additional attributes (from a re-export),
410410 // always insert them first. This ensure that re-export
@@ -415,7 +415,7 @@ pub(crate) fn merge_attrs(
415415 both. extend_from_slice ( old_attrs) ;
416416 (
417417 if let Some ( item_id) = item_id {
418- Attributes :: from_ast_with_additional ( old_attrs, ( inner, item_id) )
418+ Attributes :: from_ast_with_additional ( old_attrs, ( inner, item_id. to_def_id ( ) ) )
419419 } else {
420420 Attributes :: from_ast ( & both)
421421 } ,
@@ -430,7 +430,7 @@ pub(crate) fn merge_attrs(
430430pub ( crate ) fn build_impl (
431431 cx : & mut DocContext < ' _ > ,
432432 did : DefId ,
433- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
433+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
434434 ret : & mut Vec < clean:: Item > ,
435435) {
436436 if !cx. inlined . insert ( did. into ( ) ) {
@@ -640,7 +640,7 @@ fn build_module_items(
640640 visited : & mut DefIdSet ,
641641 inlined_names : & mut FxHashSet < ( ItemType , Symbol ) > ,
642642 allowed_def_ids : Option < & DefIdSet > ,
643- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
643+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
644644) -> Vec < clean:: Item > {
645645 let mut items = Vec :: new ( ) ;
646646
@@ -744,15 +744,15 @@ fn build_macro(
744744 cx : & mut DocContext < ' _ > ,
745745 def_id : DefId ,
746746 name : Symbol ,
747- import_def_id : Option < DefId > ,
747+ import_def_id : Option < LocalDefId > ,
748748 macro_kind : MacroKind ,
749749 is_doc_hidden : bool ,
750750) -> clean:: ItemKind {
751751 match CStore :: from_tcx ( cx. tcx ) . load_macro_untracked ( def_id, cx. tcx ) {
752752 LoadedMacro :: MacroDef ( item_def, _) => match macro_kind {
753753 MacroKind :: Bang => {
754754 if let ast:: ItemKind :: MacroDef ( ref def) = item_def. kind {
755- let vis = cx. tcx . visibility ( import_def_id. unwrap_or ( def_id) ) ;
755+ let vis = cx. tcx . visibility ( import_def_id. map ( |d| d . to_def_id ( ) ) . unwrap_or ( def_id) ) ;
756756 clean:: MacroItem ( clean:: Macro {
757757 source : utils:: display_macro_source (
758758 cx,
0 commit comments