diff options
| author | David Tolnay <dtolnay@gmail.com> | 2024-12-14 17:08:02 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2024-12-19 10:48:51 -0800 |
| commit | 7ee31ebd55f536a5fad9f31784cc85a6ec48ae74 (patch) | |
| tree | 8e4634d68102a4d7cdd259862d1681a928791a65 | |
| parent | ff65d62922631bd00af13b905fd3abd9c971ae27 (diff) | |
| download | rust-7ee31ebd55f536a5fad9f31784cc85a6ec48ae74.tar.gz rust-7ee31ebd55f536a5fad9f31784cc85a6ec48ae74.zip | |
Rename TyMethodItem -> RequiredMethodItem
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/clean/types.rs | 12 | ||||
| -rw-r--r-- | src/librustdoc/fold.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/formats/item_type.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/passes/propagate_stability.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/passes/stripper.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/visit.rs | 2 |
11 files changed, 24 insertions, 20 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 6dd6b139b1a..6b32d1896ea 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1239,7 +1239,7 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext } hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Required(names)) => { let m = clean_function(cx, sig, trait_item.generics, FunctionArgs::Names(names)); - TyMethodItem(m) + RequiredMethodItem(m) } hir::TraitItemKind::Type(bounds, Some(default)) => { 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 }; MethodItem(item, defaultness) } else { - TyMethodItem(item) + RequiredMethodItem(item) } } ty::AssocKind::Type => { diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index d48897799f9..ffd9caa0bca 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -671,7 +671,9 @@ impl Item { asyncness: hir::IsAsync::NotAsync, } } - ItemKind::FunctionItem(_) | ItemKind::MethodItem(_, _) | ItemKind::TyMethodItem(_) => { + ItemKind::FunctionItem(_) + | ItemKind::MethodItem(_, _) + | ItemKind::RequiredMethodItem(_) => { let def_id = self.def_id().unwrap(); build_fn_header(def_id, tcx, tcx.asyncness(def_id)) } @@ -706,7 +708,7 @@ impl Item { | ImplAssocConstItem(..) | AssocTypeItem(..) | RequiredAssocTypeItem(..) - | TyMethodItem(..) + | RequiredMethodItem(..) | MethodItem(..) => { let assoc_item = tcx.associated_item(def_id); let is_trait_item = match assoc_item.container { @@ -852,10 +854,10 @@ pub(crate) enum ItemKind { TraitAliasItem(TraitAlias), ImplItem(Box<Impl>), /// A required method in a trait declaration meaning it's only a function signature. - TyMethodItem(Box<Function>), + RequiredMethodItem(Box<Function>), /// A method in a trait impl or a provided method in a trait declaration. /// - /// Compared to [TyMethodItem], it also contains a method body. + /// Compared to [RequiredMethodItem], it also contains a method body. MethodItem(Box<Function>, Option<hir::Defaultness>), StructFieldItem(Type), VariantItem(Variant), @@ -909,7 +911,7 @@ impl ItemKind { | StaticItem(_) | ConstantItem(_) | TraitAliasItem(_) - | TyMethodItem(_) + | RequiredMethodItem(_) | MethodItem(_, _) | StructFieldItem(_) | ForeignFunctionItem(_, _) diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index a42c8c94fde..c03d16ad081 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -82,7 +82,7 @@ pub(crate) trait DocFolder: Sized { | StaticItem(_) | ConstantItem(..) | TraitAliasItem(_) - | TyMethodItem(_) + | RequiredMethodItem(_) | MethodItem(_, _) | StructFieldItem(_) | ForeignFunctionItem(..) diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 2ad8c832daf..b63122565c4 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -334,7 +334,7 @@ impl DocFolder for CacheBuilder<'_, '_> { clean::ExternCrateItem { .. } | clean::ImportItem(..) | clean::ImplItem(..) - | clean::TyMethodItem(..) + | clean::RequiredMethodItem(..) | clean::MethodItem(..) | clean::StructFieldItem(..) | clean::RequiredAssocConstItem(..) @@ -452,7 +452,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It // skip associated items in trait impls return; } - clean::TyMethodItem(..) + clean::RequiredMethodItem(..) | clean::RequiredAssocConstItem(..) | clean::RequiredAssocTypeItem(..) | clean::StructFieldItem(..) diff --git a/src/librustdoc/formats/item_type.rs b/src/librustdoc/formats/item_type.rs index f51292a5d5d..de6537e992f 100644 --- a/src/librustdoc/formats/item_type.rs +++ b/src/librustdoc/formats/item_type.rs @@ -88,7 +88,7 @@ impl<'a> From<&'a clean::Item> for ItemType { clean::ConstantItem(..) => ItemType::Constant, clean::TraitItem(..) => ItemType::Trait, clean::ImplItem(..) => ItemType::Impl, - clean::TyMethodItem(..) => ItemType::TyMethod, + clean::RequiredMethodItem(..) => ItemType::TyMethod, clean::MethodItem(..) => ItemType::Method, clean::StructFieldItem(..) => ItemType::StructField, clean::VariantItem(..) => ItemType::Variant, diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 2d75d1a4c0e..0628e074fbd 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1091,7 +1091,7 @@ fn render_assoc_item( ) { match &item.kind { clean::StrippedItem(..) => {} - clean::TyMethodItem(m) => { + clean::RequiredMethodItem(m) => { assoc_method(w, item, &m.generics, &m.decl, link, parent, cx, render_mode) } clean::MethodItem(m, _) => { @@ -1409,7 +1409,7 @@ fn render_deref_methods( fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) -> bool { let self_type_opt = match item.kind { clean::MethodItem(ref method, _) => method.decl.receiver_type(), - clean::TyMethodItem(ref method) => method.decl.receiver_type(), + clean::RequiredMethodItem(ref method) => method.decl.receiver_type(), _ => None, }; @@ -1685,7 +1685,7 @@ fn render_impl( write!(w, "<details class=\"toggle{method_toggle_class}\" open><summary>"); } match &item.kind { - clean::MethodItem(..) | clean::TyMethodItem(_) => { + clean::MethodItem(..) | clean::RequiredMethodItem(_) => { // Only render when the method is not static or we allow static methods if render_method_item { let id = cx.derive_id(format!("{item_type}.{name}")); @@ -1838,7 +1838,7 @@ fn render_impl( if !impl_.is_negative_trait_impl() { for trait_item in &impl_.items { match trait_item.kind { - clean::MethodItem(..) | clean::TyMethodItem(_) => methods.push(trait_item), + clean::MethodItem(..) | clean::RequiredMethodItem(_) => methods.push(trait_item), clean::RequiredAssocTypeItem(..) | clean::AssocTypeItem(..) => { assoc_types.push(trait_item) } diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 84bb8056e25..fe2e155c9ba 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -837,7 +837,7 @@ pub(crate) fn get_function_type_for_search( clean::ForeignFunctionItem(ref f, _) | clean::FunctionItem(ref f) | clean::MethodItem(ref f, _) - | clean::TyMethodItem(ref f) => { + | clean::RequiredMethodItem(ref f) => { get_fn_inputs_and_outputs(f, tcx, impl_or_trait_generics, cache) } _ => return None, diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index a6da40d4329..7c1d59390f9 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -319,7 +319,9 @@ fn from_clean_item(item: clean::Item, renderer: &JsonRenderer<'_>) -> ItemEnum { TraitItem(t) => ItemEnum::Trait((*t).into_json(renderer)), TraitAliasItem(t) => ItemEnum::TraitAlias(t.into_json(renderer)), MethodItem(m, _) => ItemEnum::Function(from_function(m, true, header.unwrap(), renderer)), - TyMethodItem(m) => ItemEnum::Function(from_function(m, false, header.unwrap(), renderer)), + RequiredMethodItem(m) => { + ItemEnum::Function(from_function(m, false, header.unwrap(), renderer)) + } ImplItem(i) => ItemEnum::Impl((*i).into_json(renderer)), StaticItem(s) => ItemEnum::Static(convert_static(s, rustc_hir::Safety::Safe, renderer)), ForeignStaticItem(s, safety) => ItemEnum::Static(convert_static(s, safety, renderer)), diff --git a/src/librustdoc/passes/propagate_stability.rs b/src/librustdoc/passes/propagate_stability.rs index 564d196dd01..c88f48c1ff1 100644 --- a/src/librustdoc/passes/propagate_stability.rs +++ b/src/librustdoc/passes/propagate_stability.rs @@ -67,7 +67,7 @@ impl DocFolder for StabilityPropagator<'_, '_> { // Don't inherit the parent's stability for these items, because they // are potentially accessible even if the parent is more unstable. ItemKind::ImplItem(..) - | ItemKind::TyMethodItem(..) + | ItemKind::RequiredMethodItem(..) | ItemKind::MethodItem(..) | ItemKind::RequiredAssocConstItem(..) | ItemKind::ProvidedAssocConstItem(..) diff --git a/src/librustdoc/passes/stripper.rs b/src/librustdoc/passes/stripper.rs index c992d8d9477..eedbbca0f8d 100644 --- a/src/librustdoc/passes/stripper.rs +++ b/src/librustdoc/passes/stripper.rs @@ -121,7 +121,7 @@ impl DocFolder for Stripper<'_, '_> { clean::ImplItem(..) => {} // tymethods etc. have no control over privacy - clean::TyMethodItem(..) + clean::RequiredMethodItem(..) | clean::RequiredAssocConstItem(..) | clean::RequiredAssocTypeItem(..) => {} diff --git a/src/librustdoc/visit.rs b/src/librustdoc/visit.rs index 293e1f3af4e..b8b619514aa 100644 --- a/src/librustdoc/visit.rs +++ b/src/librustdoc/visit.rs @@ -35,7 +35,7 @@ pub(crate) trait DocVisitor<'a>: Sized { | StaticItem(_) | ConstantItem(..) | TraitAliasItem(_) - | TyMethodItem(_) + | RequiredMethodItem(_) | MethodItem(_, _) | StructFieldItem(_) | ForeignFunctionItem(..) |
