Skip to content

Commit bc45950

Browse files
Last DocContext/TyCtxt cleanup
1 parent 4b39934 commit bc45950

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

src/librustdoc/clean/mod.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ fn generate_item_with_correct_attrs(
184184
import_ids: &[LocalDefId],
185185
renamed: Option<Symbol>,
186186
) -> Item {
187-
let target_attrs = inline::load_attrs(cx.tcx, def_id);
187+
let tcx = cx.tcx;
188+
let target_attrs = inline::load_attrs(tcx, def_id);
188189
let attrs = if !import_ids.is_empty() {
189190
let mut attrs = Vec::with_capacity(import_ids.len());
190191
let mut is_inline = false;
@@ -196,11 +197,11 @@ fn generate_item_with_correct_attrs(
196197
// cfgs on the path up until the glob can be removed, and only cfgs on the globbed item
197198
// itself matter), for non-inlined re-exports see #85043.
198199
let import_is_inline = find_attr!(
199-
inline::load_attrs(cx.tcx, import_id.to_def_id()),
200+
inline::load_attrs(tcx, import_id.to_def_id()),
200201
Doc(d)
201202
if d.inline.first().is_some_and(|(inline, _)| *inline == DocInline::Inline)
202-
) || (is_glob_import(cx.tcx, import_id)
203-
&& (cx.document_hidden() || !cx.tcx.is_doc_hidden(def_id)));
203+
) || (is_glob_import(tcx, import_id)
204+
&& (cx.document_hidden() || !tcx.is_doc_hidden(def_id)));
204205
attrs.extend(get_all_import_attributes(cx, import_id, def_id, is_inline));
205206
is_inline = is_inline || import_is_inline;
206207
}
@@ -1458,15 +1459,15 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
14581459
bounds.retain(|b| {
14591460
// FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
14601461
// is shown and none of the new sizedness traits leak into documentation.
1461-
!b.is_meta_sized_bound(cx.tcx)
1462+
!b.is_meta_sized_bound(tcx)
14621463
});
14631464

14641465
// Our Sized/?Sized bound didn't get handled when creating the generics
14651466
// because we didn't actually get our whole set of bounds until just now
14661467
// (some of them may have come from the trait). If we do have a sized
14671468
// bound, we remove it, and if we don't then we add the `?Sized` bound
14681469
// at the end.
1469-
match bounds.iter().position(|b| b.is_sized_bound(cx.tcx)) {
1470+
match bounds.iter().position(|b| b.is_sized_bound(tcx)) {
14701471
Some(i) => {
14711472
bounds.remove(i);
14721473
}
@@ -1516,7 +1517,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
15161517
}
15171518
};
15181519

1519-
Item::from_def_id_and_parts(assoc_item.def_id, Some(assoc_item.name()), kind, cx.tcx)
1520+
Item::from_def_id_and_parts(assoc_item.def_id, Some(assoc_item.name()), kind, tcx)
15201521
}
15211522

15221523
fn first_non_private_clean_path<'tcx>(
@@ -2768,11 +2769,11 @@ fn clean_maybe_renamed_item<'tcx>(
27682769
) -> Vec<Item> {
27692770
use hir::ItemKind;
27702771
fn get_name(
2771-
cx: &DocContext<'_>,
2772+
tcx: TyCtxt<'_>,
27722773
item: &hir::Item<'_>,
27732774
renamed: Option<Symbol>,
27742775
) -> Option<Symbol> {
2775-
renamed.or_else(|| cx.tcx.hir_opt_name(item.hir_id()))
2776+
renamed.or_else(|| tcx.hir_opt_name(item.hir_id()))
27762777
}
27772778

27782779
let def_id = item.owner_id.to_def_id();
@@ -2789,7 +2790,7 @@ fn clean_maybe_renamed_item<'tcx>(
27892790
ItemKind::Use(path, kind) => {
27902791
return clean_use_statement(
27912792
item,
2792-
get_name(cx, item, renamed),
2793+
get_name(cx.tcx, item, renamed),
27932794
path,
27942795
kind,
27952796
cx,
@@ -2799,7 +2800,7 @@ fn clean_maybe_renamed_item<'tcx>(
27992800
_ => {}
28002801
}
28012802

2802-
let mut name = get_name(cx, item, renamed).unwrap();
2803+
let mut name = get_name(cx.tcx, item, renamed).unwrap();
28032804

28042805
let kind = match item.kind {
28052806
ItemKind::Static(mutability, _, ty, body_id) => StaticItem(Static {

0 commit comments

Comments
 (0)