Skip to content

Commit 7ee31eb

Browse files
committed
Rename TyMethodItem -> RequiredMethodItem
1 parent ff65d62 commit 7ee31eb

File tree

11 files changed

+24
-20
lines changed

11 files changed

+24
-20
lines changed

src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
12391239
}
12401240
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Required(names)) => {
12411241
let m = clean_function(cx, sig, trait_item.generics, FunctionArgs::Names(names));
1242-
TyMethodItem(m)
1242+
RequiredMethodItem(m)
12431243
}
12441244
hir::TraitItemKind::Type(bounds, Some(default)) => {
12451245
let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx));
@@ -1376,7 +1376,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
13761376
};
13771377
MethodItem(item, defaultness)
13781378
} else {
1379-
TyMethodItem(item)
1379+
RequiredMethodItem(item)
13801380
}
13811381
}
13821382
ty::AssocKind::Type => {

src/librustdoc/clean/types.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,9 @@ impl Item {
671671
asyncness: hir::IsAsync::NotAsync,
672672
}
673673
}
674-
ItemKind::FunctionItem(_) | ItemKind::MethodItem(_, _) | ItemKind::TyMethodItem(_) => {
674+
ItemKind::FunctionItem(_)
675+
| ItemKind::MethodItem(_, _)
676+
| ItemKind::RequiredMethodItem(_) => {
675677
let def_id = self.def_id().unwrap();
676678
build_fn_header(def_id, tcx, tcx.asyncness(def_id))
677679
}
@@ -706,7 +708,7 @@ impl Item {
706708
| ImplAssocConstItem(..)
707709
| AssocTypeItem(..)
708710
| RequiredAssocTypeItem(..)
709-
| TyMethodItem(..)
711+
| RequiredMethodItem(..)
710712
| MethodItem(..) => {
711713
let assoc_item = tcx.associated_item(def_id);
712714
let is_trait_item = match assoc_item.container {
@@ -852,10 +854,10 @@ pub(crate) enum ItemKind {
852854
TraitAliasItem(TraitAlias),
853855
ImplItem(Box<Impl>),
854856
/// A required method in a trait declaration meaning it's only a function signature.
855-
TyMethodItem(Box<Function>),
857+
RequiredMethodItem(Box<Function>),
856858
/// A method in a trait impl or a provided method in a trait declaration.
857859
///
858-
/// Compared to [TyMethodItem], it also contains a method body.
860+
/// Compared to [RequiredMethodItem], it also contains a method body.
859861
MethodItem(Box<Function>, Option<hir::Defaultness>),
860862
StructFieldItem(Type),
861863
VariantItem(Variant),
@@ -909,7 +911,7 @@ impl ItemKind {
909911
| StaticItem(_)
910912
| ConstantItem(_)
911913
| TraitAliasItem(_)
912-
| TyMethodItem(_)
914+
| RequiredMethodItem(_)
913915
| MethodItem(_, _)
914916
| StructFieldItem(_)
915917
| ForeignFunctionItem(_, _)

src/librustdoc/fold.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub(crate) trait DocFolder: Sized {
8282
| StaticItem(_)
8383
| ConstantItem(..)
8484
| TraitAliasItem(_)
85-
| TyMethodItem(_)
85+
| RequiredMethodItem(_)
8686
| MethodItem(_, _)
8787
| StructFieldItem(_)
8888
| ForeignFunctionItem(..)

src/librustdoc/formats/cache.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ impl DocFolder for CacheBuilder<'_, '_> {
334334
clean::ExternCrateItem { .. }
335335
| clean::ImportItem(..)
336336
| clean::ImplItem(..)
337-
| clean::TyMethodItem(..)
337+
| clean::RequiredMethodItem(..)
338338
| clean::MethodItem(..)
339339
| clean::StructFieldItem(..)
340340
| clean::RequiredAssocConstItem(..)
@@ -452,7 +452,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
452452
// skip associated items in trait impls
453453
return;
454454
}
455-
clean::TyMethodItem(..)
455+
clean::RequiredMethodItem(..)
456456
| clean::RequiredAssocConstItem(..)
457457
| clean::RequiredAssocTypeItem(..)
458458
| clean::StructFieldItem(..)

src/librustdoc/formats/item_type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl<'a> From<&'a clean::Item> for ItemType {
8888
clean::ConstantItem(..) => ItemType::Constant,
8989
clean::TraitItem(..) => ItemType::Trait,
9090
clean::ImplItem(..) => ItemType::Impl,
91-
clean::TyMethodItem(..) => ItemType::TyMethod,
91+
clean::RequiredMethodItem(..) => ItemType::TyMethod,
9292
clean::MethodItem(..) => ItemType::Method,
9393
clean::StructFieldItem(..) => ItemType::StructField,
9494
clean::VariantItem(..) => ItemType::Variant,

src/librustdoc/html/render/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ fn render_assoc_item(
10911091
) {
10921092
match &item.kind {
10931093
clean::StrippedItem(..) => {}
1094-
clean::TyMethodItem(m) => {
1094+
clean::RequiredMethodItem(m) => {
10951095
assoc_method(w, item, &m.generics, &m.decl, link, parent, cx, render_mode)
10961096
}
10971097
clean::MethodItem(m, _) => {
@@ -1409,7 +1409,7 @@ fn render_deref_methods(
14091409
fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) -> bool {
14101410
let self_type_opt = match item.kind {
14111411
clean::MethodItem(ref method, _) => method.decl.receiver_type(),
1412-
clean::TyMethodItem(ref method) => method.decl.receiver_type(),
1412+
clean::RequiredMethodItem(ref method) => method.decl.receiver_type(),
14131413
_ => None,
14141414
};
14151415

@@ -1685,7 +1685,7 @@ fn render_impl(
16851685
write!(w, "<details class=\"toggle{method_toggle_class}\" open><summary>");
16861686
}
16871687
match &item.kind {
1688-
clean::MethodItem(..) | clean::TyMethodItem(_) => {
1688+
clean::MethodItem(..) | clean::RequiredMethodItem(_) => {
16891689
// Only render when the method is not static or we allow static methods
16901690
if render_method_item {
16911691
let id = cx.derive_id(format!("{item_type}.{name}"));
@@ -1838,7 +1838,7 @@ fn render_impl(
18381838
if !impl_.is_negative_trait_impl() {
18391839
for trait_item in &impl_.items {
18401840
match trait_item.kind {
1841-
clean::MethodItem(..) | clean::TyMethodItem(_) => methods.push(trait_item),
1841+
clean::MethodItem(..) | clean::RequiredMethodItem(_) => methods.push(trait_item),
18421842
clean::RequiredAssocTypeItem(..) | clean::AssocTypeItem(..) => {
18431843
assoc_types.push(trait_item)
18441844
}

src/librustdoc/html/render/search_index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ pub(crate) fn get_function_type_for_search(
837837
clean::ForeignFunctionItem(ref f, _)
838838
| clean::FunctionItem(ref f)
839839
| clean::MethodItem(ref f, _)
840-
| clean::TyMethodItem(ref f) => {
840+
| clean::RequiredMethodItem(ref f) => {
841841
get_fn_inputs_and_outputs(f, tcx, impl_or_trait_generics, cache)
842842
}
843843
_ => return None,

src/librustdoc/json/conversions.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ fn from_clean_item(item: clean::Item, renderer: &JsonRenderer<'_>) -> ItemEnum {
319319
TraitItem(t) => ItemEnum::Trait((*t).into_json(renderer)),
320320
TraitAliasItem(t) => ItemEnum::TraitAlias(t.into_json(renderer)),
321321
MethodItem(m, _) => ItemEnum::Function(from_function(m, true, header.unwrap(), renderer)),
322-
TyMethodItem(m) => ItemEnum::Function(from_function(m, false, header.unwrap(), renderer)),
322+
RequiredMethodItem(m) => {
323+
ItemEnum::Function(from_function(m, false, header.unwrap(), renderer))
324+
}
323325
ImplItem(i) => ItemEnum::Impl((*i).into_json(renderer)),
324326
StaticItem(s) => ItemEnum::Static(convert_static(s, rustc_hir::Safety::Safe, renderer)),
325327
ForeignStaticItem(s, safety) => ItemEnum::Static(convert_static(s, safety, renderer)),

src/librustdoc/passes/propagate_stability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl DocFolder for StabilityPropagator<'_, '_> {
6767
// Don't inherit the parent's stability for these items, because they
6868
// are potentially accessible even if the parent is more unstable.
6969
ItemKind::ImplItem(..)
70-
| ItemKind::TyMethodItem(..)
70+
| ItemKind::RequiredMethodItem(..)
7171
| ItemKind::MethodItem(..)
7272
| ItemKind::RequiredAssocConstItem(..)
7373
| ItemKind::ProvidedAssocConstItem(..)

src/librustdoc/passes/stripper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl DocFolder for Stripper<'_, '_> {
121121
clean::ImplItem(..) => {}
122122

123123
// tymethods etc. have no control over privacy
124-
clean::TyMethodItem(..)
124+
clean::RequiredMethodItem(..)
125125
| clean::RequiredAssocConstItem(..)
126126
| clean::RequiredAssocTypeItem(..) => {}
127127

src/librustdoc/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(crate) trait DocVisitor<'a>: Sized {
3535
| StaticItem(_)
3636
| ConstantItem(..)
3737
| TraitAliasItem(_)
38-
| TyMethodItem(_)
38+
| RequiredMethodItem(_)
3939
| MethodItem(_, _)
4040
| StructFieldItem(_)
4141
| ForeignFunctionItem(..)

0 commit comments

Comments
 (0)