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