@@ -132,25 +132,31 @@ pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<
132
132
});
133
133
134
134
let kind = ModuleItem(Module { items, span });
135
- generate_item_with_correct_attrs(cx, kind, doc.def_id, doc.name, doc.import_id, doc.renamed)
135
+ generate_item_with_correct_attrs(
136
+ cx,
137
+ kind,
138
+ doc.def_id.to_def_id(),
139
+ doc.name,
140
+ doc.import_id,
141
+ doc.renamed,
142
+ )
136
143
}
137
144
138
145
fn generate_item_with_correct_attrs(
139
146
cx: &mut DocContext<'_>,
140
147
kind: ItemKind,
141
- local_def_id: LocalDefId ,
148
+ def_id: DefId ,
142
149
name: Symbol,
143
150
import_id: Option<LocalDefId>,
144
151
renamed: Option<Symbol>,
145
152
) -> Item {
146
- let def_id = local_def_id.to_def_id();
147
153
let target_attrs = inline::load_attrs(cx, def_id);
148
154
let attrs = if let Some(import_id) = import_id {
149
155
let is_inline = inline::load_attrs(cx, import_id.to_def_id())
150
156
.lists(sym::doc)
151
157
.get_word_attr(sym::inline)
152
158
.is_some();
153
- let mut attrs = get_all_import_attributes(cx, import_id, local_def_id , is_inline);
159
+ let mut attrs = get_all_import_attributes(cx, import_id, def_id , is_inline);
154
160
add_without_unwanted_attributes(&mut attrs, target_attrs, is_inline, None);
155
161
attrs
156
162
} else {
@@ -2308,10 +2314,10 @@ fn clean_bare_fn_ty<'tcx>(
2308
2314
pub(crate) fn reexport_chain<'tcx>(
2309
2315
tcx: TyCtxt<'tcx>,
2310
2316
import_def_id: LocalDefId,
2311
- target_def_id: LocalDefId ,
2317
+ target_def_id: DefId ,
2312
2318
) -> &'tcx [Reexport] {
2313
2319
for child in tcx.module_children_local(tcx.local_parent(import_def_id)) {
2314
- if child.res.opt_def_id() == Some(target_def_id.to_def_id() )
2320
+ if child.res.opt_def_id() == Some(target_def_id)
2315
2321
&& child.reexport_chain.first().and_then(|r| r.id()) == Some(import_def_id.to_def_id())
2316
2322
{
2317
2323
return &child.reexport_chain;
@@ -2324,7 +2330,7 @@ pub(crate) fn reexport_chain<'tcx>(
2324
2330
fn get_all_import_attributes<'hir>(
2325
2331
cx: &mut DocContext<'hir>,
2326
2332
import_def_id: LocalDefId,
2327
- target_def_id: LocalDefId ,
2333
+ target_def_id: DefId ,
2328
2334
is_inline: bool,
2329
2335
) -> Vec<(Cow<'hir, ast::Attribute>, Option<DefId>)> {
2330
2336
let mut attrs = Vec::new();
@@ -2541,7 +2547,7 @@ fn clean_maybe_renamed_item<'tcx>(
2541
2547
vec![generate_item_with_correct_attrs(
2542
2548
cx,
2543
2549
kind,
2544
- item.owner_id.def_id,
2550
+ item.owner_id.def_id.to_def_id() ,
2545
2551
name,
2546
2552
import_id,
2547
2553
renamed,
@@ -2694,6 +2700,7 @@ fn clean_use_statement_inner<'tcx>(
2694
2700
let inline_attr = attrs.lists(sym::doc).get_word_attr(sym::inline);
2695
2701
let pub_underscore = visibility.is_public() && name == kw::Underscore;
2696
2702
let current_mod = cx.tcx.parent_module_from_def_id(import.owner_id.def_id);
2703
+ let import_def_id = import.owner_id.def_id.to_def_id();
2697
2704
2698
2705
// The parent of the module in which this import resides. This
2699
2706
// is the same as `current_mod` if that's already the top
@@ -2744,9 +2751,14 @@ fn clean_use_statement_inner<'tcx>(
2744
2751
let inner = if kind == hir::UseKind::Glob {
2745
2752
if !denied {
2746
2753
let mut visited = DefIdSet::default();
2747
- if let Some(items) =
2748
- inline::try_inline_glob(cx, path.res, current_mod, &mut visited, inlined_names)
2749
- {
2754
+ if let Some(items) = inline::try_inline_glob(
2755
+ cx,
2756
+ path.res,
2757
+ current_mod,
2758
+ &mut visited,
2759
+ inlined_names,
2760
+ import,
2761
+ ) {
2750
2762
return items;
2751
2763
}
2752
2764
}
@@ -2762,7 +2774,6 @@ fn clean_use_statement_inner<'tcx>(
2762
2774
denied = true;
2763
2775
}
2764
2776
if !denied {
2765
- let import_def_id = import.owner_id.to_def_id();
2766
2777
if let Some(mut items) = inline::try_inline(
2767
2778
cx,
2768
2779
path.res,
@@ -2782,7 +2793,7 @@ fn clean_use_statement_inner<'tcx>(
2782
2793
Import::new_simple(name, resolve_use_source(cx, path), true)
2783
2794
};
2784
2795
2785
- vec![Item::from_def_id_and_parts(import.owner_id.to_def_id() , None, ImportItem(inner), cx)]
2796
+ vec![Item::from_def_id_and_parts(import_def_id , None, ImportItem(inner), cx)]
2786
2797
}
2787
2798
2788
2799
fn clean_maybe_renamed_foreign_item<'tcx>(
0 commit comments