@@ -5,7 +5,7 @@ use std::sync::Arc;
5
5
6
6
use rustc_data_structures:: fx:: FxHashSet ;
7
7
use rustc_hir:: def:: { DefKind , Res } ;
8
- use rustc_hir:: def_id:: { DefId , DefIdSet , LocalModDefId } ;
8
+ use rustc_hir:: def_id:: { DefId , DefIdSet , LocalDefId , LocalModDefId } ;
9
9
use rustc_hir:: Mutability ;
10
10
use rustc_metadata:: creader:: { CStore , LoadedMacro } ;
11
11
use rustc_middle:: ty:: fast_reject:: SimplifiedType ;
@@ -43,7 +43,7 @@ pub(crate) fn try_inline(
43
43
cx : & mut DocContext < ' _ > ,
44
44
res : Res ,
45
45
name : Symbol ,
46
- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
46
+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
47
47
visited : & mut DefIdSet ,
48
48
) -> Option < Vec < clean:: Item > > {
49
49
let did = res. opt_def_id ( ) ?;
@@ -157,7 +157,7 @@ pub(crate) fn try_inline(
157
157
kind,
158
158
did,
159
159
name,
160
- import_def_id. and_then ( |def_id| def_id . as_local ( ) ) ,
160
+ import_def_id,
161
161
None ,
162
162
) ;
163
163
// 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(
198
198
visited,
199
199
inlined_names,
200
200
Some ( & reexports) ,
201
- Some ( ( attrs, Some ( import. owner_id . def_id . to_def_id ( ) ) ) ) ,
201
+ Some ( ( attrs, Some ( import. owner_id . def_id ) ) ) ,
202
202
) ;
203
203
items. retain ( |item| {
204
204
if let Some ( name) = item. name {
@@ -372,7 +372,7 @@ fn build_type_alias(
372
372
pub ( crate ) fn build_impls (
373
373
cx : & mut DocContext < ' _ > ,
374
374
did : DefId ,
375
- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
375
+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
376
376
ret : & mut Vec < clean:: Item > ,
377
377
) {
378
378
let _prof_timer = cx. tcx . sess . prof . generic_activity ( "build_inherent_impls" ) ;
@@ -405,7 +405,7 @@ pub(crate) fn build_impls(
405
405
pub ( crate ) fn merge_attrs (
406
406
cx : & mut DocContext < ' _ > ,
407
407
old_attrs : & [ ast:: Attribute ] ,
408
- new_attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
408
+ new_attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
409
409
) -> ( clean:: Attributes , Option < Arc < clean:: cfg:: Cfg > > ) {
410
410
// NOTE: If we have additional attributes (from a re-export),
411
411
// always insert them first. This ensure that re-export
@@ -416,7 +416,7 @@ pub(crate) fn merge_attrs(
416
416
both. extend_from_slice ( old_attrs) ;
417
417
(
418
418
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 ( ) ) )
420
420
} else {
421
421
Attributes :: from_ast ( & both)
422
422
} ,
@@ -431,7 +431,7 @@ pub(crate) fn merge_attrs(
431
431
pub ( crate ) fn build_impl (
432
432
cx : & mut DocContext < ' _ > ,
433
433
did : DefId ,
434
- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
434
+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
435
435
ret : & mut Vec < clean:: Item > ,
436
436
) {
437
437
if !cx. inlined . insert ( did. into ( ) ) {
@@ -641,7 +641,7 @@ fn build_module_items(
641
641
visited : & mut DefIdSet ,
642
642
inlined_names : & mut FxHashSet < ( ItemType , Symbol ) > ,
643
643
allowed_def_ids : Option < & DefIdSet > ,
644
- attrs : Option < ( & [ ast:: Attribute ] , Option < DefId > ) > ,
644
+ attrs : Option < ( & [ ast:: Attribute ] , Option < LocalDefId > ) > ,
645
645
) -> Vec < clean:: Item > {
646
646
let mut items = Vec :: new ( ) ;
647
647
@@ -745,15 +745,15 @@ fn build_macro(
745
745
cx : & mut DocContext < ' _ > ,
746
746
def_id : DefId ,
747
747
name : Symbol ,
748
- import_def_id : Option < DefId > ,
748
+ import_def_id : Option < LocalDefId > ,
749
749
macro_kind : MacroKind ,
750
750
is_doc_hidden : bool ,
751
751
) -> clean:: ItemKind {
752
752
match CStore :: from_tcx ( cx. tcx ) . load_macro_untracked ( def_id, cx. tcx ) {
753
753
LoadedMacro :: MacroDef ( item_def, _) => match macro_kind {
754
754
MacroKind :: Bang => {
755
755
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) ) ;
757
757
clean:: MacroItem ( clean:: Macro {
758
758
source : utils:: display_macro_source (
759
759
cx,
0 commit comments