Rename TyAssocConstItem -> RequiredAssocConstItem
This commit is contained in:
parent
85641f729f
commit
57e1a47dc4
13 changed files with 29 additions and 22 deletions
|
@ -1229,7 +1229,7 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
|
|||
})),
|
||||
hir::TraitItemKind::Const(ty, None) => {
|
||||
let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx));
|
||||
TyAssocConstItem(generics, Box::new(clean_ty(ty, cx)))
|
||||
RequiredAssocConstItem(generics, Box::new(clean_ty(ty, cx)))
|
||||
}
|
||||
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(body)) => {
|
||||
let m = clean_function(cx, sig, trait_item.generics, FunctionArgs::Body(body));
|
||||
|
@ -1331,7 +1331,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
|
|||
type_: ty,
|
||||
}))
|
||||
} else {
|
||||
TyAssocConstItem(generics, Box::new(ty))
|
||||
RequiredAssocConstItem(generics, Box::new(ty))
|
||||
}
|
||||
}
|
||||
ty::AssocKind::Fn => {
|
||||
|
|
|
@ -553,8 +553,8 @@ impl Item {
|
|||
pub(crate) fn is_associated_const(&self) -> bool {
|
||||
matches!(self.kind, AssocConstItem(..) | StrippedItem(box AssocConstItem(..)))
|
||||
}
|
||||
pub(crate) fn is_ty_associated_const(&self) -> bool {
|
||||
matches!(self.kind, TyAssocConstItem(..) | StrippedItem(box TyAssocConstItem(..)))
|
||||
pub(crate) fn is_required_associated_const(&self) -> bool {
|
||||
matches!(self.kind, RequiredAssocConstItem(..) | StrippedItem(box RequiredAssocConstItem(..)))
|
||||
}
|
||||
pub(crate) fn is_method(&self) -> bool {
|
||||
self.type_() == ItemType::Method
|
||||
|
@ -701,8 +701,12 @@ impl Item {
|
|||
// Variants always inherit visibility
|
||||
VariantItem(..) | ImplItem(..) => return None,
|
||||
// Trait items inherit the trait's visibility
|
||||
AssocConstItem(..) | TyAssocConstItem(..) | AssocTypeItem(..) | TyAssocTypeItem(..)
|
||||
| TyMethodItem(..) | MethodItem(..) => {
|
||||
AssocConstItem(..)
|
||||
| RequiredAssocConstItem(..)
|
||||
| AssocTypeItem(..)
|
||||
| TyAssocTypeItem(..)
|
||||
| TyMethodItem(..)
|
||||
| MethodItem(..) => {
|
||||
let assoc_item = tcx.associated_item(def_id);
|
||||
let is_trait_item = match assoc_item.container {
|
||||
ty::AssocItemContainer::Trait => true,
|
||||
|
@ -864,7 +868,7 @@ pub(crate) enum ItemKind {
|
|||
ProcMacroItem(ProcMacro),
|
||||
PrimitiveItem(PrimitiveType),
|
||||
/// A required associated constant in a trait declaration.
|
||||
TyAssocConstItem(Generics, Box<Type>),
|
||||
RequiredAssocConstItem(Generics, Box<Type>),
|
||||
ConstantItem(Box<Constant>),
|
||||
/// An associated constant in a trait impl or a provided one in a trait declaration.
|
||||
AssocConstItem(Box<Constant>),
|
||||
|
@ -911,7 +915,7 @@ impl ItemKind {
|
|||
| MacroItem(_)
|
||||
| ProcMacroItem(_)
|
||||
| PrimitiveItem(_)
|
||||
| TyAssocConstItem(..)
|
||||
| RequiredAssocConstItem(..)
|
||||
| AssocConstItem(..)
|
||||
| TyAssocTypeItem(..)
|
||||
| AssocTypeItem(..)
|
||||
|
|
|
@ -91,7 +91,7 @@ pub(crate) trait DocFolder: Sized {
|
|||
| MacroItem(_)
|
||||
| ProcMacroItem(_)
|
||||
| PrimitiveItem(_)
|
||||
| TyAssocConstItem(..)
|
||||
| RequiredAssocConstItem(..)
|
||||
| AssocConstItem(..)
|
||||
| TyAssocTypeItem(..)
|
||||
| AssocTypeItem(..)
|
||||
|
|
|
@ -337,7 +337,7 @@ impl DocFolder for CacheBuilder<'_, '_> {
|
|||
| clean::TyMethodItem(..)
|
||||
| clean::MethodItem(..)
|
||||
| clean::StructFieldItem(..)
|
||||
| clean::TyAssocConstItem(..)
|
||||
| clean::RequiredAssocConstItem(..)
|
||||
| clean::AssocConstItem(..)
|
||||
| clean::TyAssocTypeItem(..)
|
||||
| clean::AssocTypeItem(..)
|
||||
|
@ -450,7 +450,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
|
|||
return;
|
||||
}
|
||||
clean::TyMethodItem(..)
|
||||
| clean::TyAssocConstItem(..)
|
||||
| clean::RequiredAssocConstItem(..)
|
||||
| clean::TyAssocTypeItem(..)
|
||||
| clean::StructFieldItem(..)
|
||||
| clean::VariantItem(..) => {
|
||||
|
|
|
@ -96,7 +96,7 @@ impl<'a> From<&'a clean::Item> for ItemType {
|
|||
clean::ForeignStaticItem(..) => ItemType::Static, // no ForeignStatic
|
||||
clean::MacroItem(..) => ItemType::Macro,
|
||||
clean::PrimitiveItem(..) => ItemType::Primitive,
|
||||
clean::TyAssocConstItem(..) | clean::AssocConstItem(..) => ItemType::AssocConst,
|
||||
clean::RequiredAssocConstItem(..) | clean::AssocConstItem(..) => ItemType::AssocConst,
|
||||
clean::TyAssocTypeItem(..) | clean::AssocTypeItem(..) => ItemType::AssocType,
|
||||
clean::ForeignTypeItem => ItemType::ForeignType,
|
||||
clean::KeywordItem => ItemType::Keyword,
|
||||
|
|
|
@ -1081,7 +1081,7 @@ fn render_assoc_item(
|
|||
clean::MethodItem(m, _) => {
|
||||
assoc_method(w, item, &m.generics, &m.decl, link, parent, cx, render_mode)
|
||||
}
|
||||
clean::TyAssocConstItem(generics, ty) => assoc_const(
|
||||
clean::RequiredAssocConstItem(generics, ty) => assoc_const(
|
||||
w,
|
||||
item,
|
||||
generics,
|
||||
|
@ -1689,7 +1689,7 @@ fn render_impl(
|
|||
w.write_str("</h4></section>");
|
||||
}
|
||||
}
|
||||
clean::TyAssocConstItem(ref generics, ref ty) => {
|
||||
clean::RequiredAssocConstItem(ref generics, ref ty) => {
|
||||
let source_id = format!("{item_type}.{name}");
|
||||
let id = cx.derive_id(&source_id);
|
||||
write!(w, "<section id=\"{id}\" class=\"{item_type}{in_trait_class}\">");
|
||||
|
@ -1812,7 +1812,7 @@ fn render_impl(
|
|||
clean::TyAssocTypeItem(..) | clean::AssocTypeItem(..) => {
|
||||
assoc_types.push(trait_item)
|
||||
}
|
||||
clean::TyAssocConstItem(..) | clean::AssocConstItem(_) => {
|
||||
clean::RequiredAssocConstItem(..) | clean::AssocConstItem(_) => {
|
||||
// We render it directly since they're supposed to come first.
|
||||
doc_impl_item(
|
||||
&mut default_impl_items,
|
||||
|
|
|
@ -653,7 +653,8 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
|
|||
let bounds = bounds(&t.bounds, false, cx);
|
||||
let required_types = t.items.iter().filter(|m| m.is_ty_associated_type()).collect::<Vec<_>>();
|
||||
let provided_types = t.items.iter().filter(|m| m.is_associated_type()).collect::<Vec<_>>();
|
||||
let required_consts = t.items.iter().filter(|m| m.is_ty_associated_const()).collect::<Vec<_>>();
|
||||
let required_consts =
|
||||
t.items.iter().filter(|m| m.is_required_associated_const()).collect::<Vec<_>>();
|
||||
let provided_consts = t.items.iter().filter(|m| m.is_associated_const()).collect::<Vec<_>>();
|
||||
let required_methods = t.items.iter().filter(|m| m.is_ty_method()).collect::<Vec<_>>();
|
||||
let provided_methods = t.items.iter().filter(|m| m.is_method()).collect::<Vec<_>>();
|
||||
|
|
|
@ -285,7 +285,7 @@ fn sidebar_trait<'a>(
|
|||
let req_assoc = filter_items(&t.items, |m| m.is_ty_associated_type(), "associatedtype");
|
||||
let prov_assoc = filter_items(&t.items, |m| m.is_associated_type(), "associatedtype");
|
||||
let req_assoc_const =
|
||||
filter_items(&t.items, |m| m.is_ty_associated_const(), "associatedconstant");
|
||||
filter_items(&t.items, |m| m.is_required_associated_const(), "associatedconstant");
|
||||
let prov_assoc_const =
|
||||
filter_items(&t.items, |m| m.is_associated_const(), "associatedconstant");
|
||||
let req_method = filter_items(&t.items, |m| m.is_ty_method(), "tymethod");
|
||||
|
|
|
@ -339,7 +339,7 @@ fn from_clean_item(item: clean::Item, renderer: &JsonRenderer<'_>) -> ItemEnum {
|
|||
})
|
||||
}
|
||||
// FIXME(generic_const_items): Add support for generic associated consts.
|
||||
TyAssocConstItem(_generics, ty) => {
|
||||
RequiredAssocConstItem(_generics, ty) => {
|
||||
ItemEnum::AssocConst { type_: (*ty).into_json(renderer), value: None }
|
||||
}
|
||||
// FIXME(generic_const_items): Add support for generic associated consts.
|
||||
|
|
|
@ -74,7 +74,7 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -
|
|||
| clean::ForeignTypeItem
|
||||
| clean::AssocConstItem(..)
|
||||
| clean::AssocTypeItem(..)
|
||||
| clean::TyAssocConstItem(..)
|
||||
| clean::RequiredAssocConstItem(..)
|
||||
| clean::TyAssocTypeItem(..)
|
||||
// check for trait impl
|
||||
| clean::ImplItem(box clean::Impl { trait_: Some(_), .. })
|
||||
|
|
|
@ -69,7 +69,7 @@ impl DocFolder for StabilityPropagator<'_, '_> {
|
|||
ItemKind::ImplItem(..)
|
||||
| ItemKind::TyMethodItem(..)
|
||||
| ItemKind::MethodItem(..)
|
||||
| ItemKind::TyAssocConstItem(..)
|
||||
| ItemKind::RequiredAssocConstItem(..)
|
||||
| ItemKind::AssocConstItem(..)
|
||||
| ItemKind::TyAssocTypeItem(..)
|
||||
| ItemKind::AssocTypeItem(..)
|
||||
|
|
|
@ -118,7 +118,9 @@ impl DocFolder for Stripper<'_, '_> {
|
|||
clean::ImplItem(..) => {}
|
||||
|
||||
// tymethods etc. have no control over privacy
|
||||
clean::TyMethodItem(..) | clean::TyAssocConstItem(..) | clean::TyAssocTypeItem(..) => {}
|
||||
clean::TyMethodItem(..)
|
||||
| clean::RequiredAssocConstItem(..)
|
||||
| clean::TyAssocTypeItem(..) => {}
|
||||
|
||||
// Proc-macros are always public
|
||||
clean::ProcMacroItem(..) => {}
|
||||
|
|
|
@ -44,7 +44,7 @@ pub(crate) trait DocVisitor<'a>: Sized {
|
|||
| MacroItem(_)
|
||||
| ProcMacroItem(_)
|
||||
| PrimitiveItem(_)
|
||||
| TyAssocConstItem(..)
|
||||
| RequiredAssocConstItem(..)
|
||||
| AssocConstItem(..)
|
||||
| TyAssocTypeItem(..)
|
||||
| AssocTypeItem(..)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue