Rename TyAssocTypeItem -> RequiredAssocTypeItem
This commit is contained in:
parent
6bdfd12ee9
commit
ff65d62922
14 changed files with 25 additions and 23 deletions
|
|
@ -1259,7 +1259,7 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
|
|||
hir::TraitItemKind::Type(bounds, None) => {
|
||||
let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx));
|
||||
let bounds = bounds.iter().filter_map(|x| clean_generic_bound(x, cx)).collect();
|
||||
TyAssocTypeItem(generics, bounds)
|
||||
RequiredAssocTypeItem(generics, bounds)
|
||||
}
|
||||
};
|
||||
Item::from_def_id_and_parts(local_did, Some(trait_item.ident.name), inner, cx)
|
||||
|
|
@ -1493,7 +1493,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
|
|||
bounds,
|
||||
)
|
||||
} else {
|
||||
TyAssocTypeItem(generics, bounds)
|
||||
RequiredAssocTypeItem(generics, bounds)
|
||||
}
|
||||
} else {
|
||||
AssocTypeItem(
|
||||
|
|
|
|||
|
|
@ -547,8 +547,8 @@ impl Item {
|
|||
pub(crate) fn is_associated_type(&self) -> bool {
|
||||
matches!(self.kind, AssocTypeItem(..) | StrippedItem(box AssocTypeItem(..)))
|
||||
}
|
||||
pub(crate) fn is_ty_associated_type(&self) -> bool {
|
||||
matches!(self.kind, TyAssocTypeItem(..) | StrippedItem(box TyAssocTypeItem(..)))
|
||||
pub(crate) fn is_required_associated_type(&self) -> bool {
|
||||
matches!(self.kind, RequiredAssocTypeItem(..) | StrippedItem(box RequiredAssocTypeItem(..)))
|
||||
}
|
||||
pub(crate) fn is_associated_const(&self) -> bool {
|
||||
matches!(self.kind, ProvidedAssocConstItem(..) | ImplAssocConstItem(..) | StrippedItem(box (ProvidedAssocConstItem(..) | ImplAssocConstItem(..))))
|
||||
|
|
@ -705,7 +705,7 @@ impl Item {
|
|||
| ProvidedAssocConstItem(..)
|
||||
| ImplAssocConstItem(..)
|
||||
| AssocTypeItem(..)
|
||||
| TyAssocTypeItem(..)
|
||||
| RequiredAssocTypeItem(..)
|
||||
| TyMethodItem(..)
|
||||
| MethodItem(..) => {
|
||||
let assoc_item = tcx.associated_item(def_id);
|
||||
|
|
@ -878,7 +878,7 @@ pub(crate) enum ItemKind {
|
|||
/// A required associated type in a trait declaration.
|
||||
///
|
||||
/// The bounds may be non-empty if there is a `where` clause.
|
||||
TyAssocTypeItem(Generics, Vec<GenericBound>),
|
||||
RequiredAssocTypeItem(Generics, Vec<GenericBound>),
|
||||
/// An associated type in a trait impl or a provided one in a trait declaration.
|
||||
AssocTypeItem(Box<TypeAlias>, Vec<GenericBound>),
|
||||
/// An item that has been stripped by a rustdoc pass
|
||||
|
|
@ -921,7 +921,7 @@ impl ItemKind {
|
|||
| RequiredAssocConstItem(..)
|
||||
| ProvidedAssocConstItem(..)
|
||||
| ImplAssocConstItem(..)
|
||||
| TyAssocTypeItem(..)
|
||||
| RequiredAssocTypeItem(..)
|
||||
| AssocTypeItem(..)
|
||||
| StrippedItem(_)
|
||||
| KeywordItem => [].iter(),
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ pub(crate) trait DocFolder: Sized {
|
|||
| RequiredAssocConstItem(..)
|
||||
| ProvidedAssocConstItem(..)
|
||||
| ImplAssocConstItem(..)
|
||||
| TyAssocTypeItem(..)
|
||||
| RequiredAssocTypeItem(..)
|
||||
| AssocTypeItem(..)
|
||||
| KeywordItem => kind,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ impl DocFolder for CacheBuilder<'_, '_> {
|
|||
| clean::RequiredAssocConstItem(..)
|
||||
| clean::ProvidedAssocConstItem(..)
|
||||
| clean::ImplAssocConstItem(..)
|
||||
| clean::TyAssocTypeItem(..)
|
||||
| clean::RequiredAssocTypeItem(..)
|
||||
| clean::AssocTypeItem(..)
|
||||
| clean::StrippedItem(..)
|
||||
| clean::KeywordItem => {
|
||||
|
|
@ -454,7 +454,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
|
|||
}
|
||||
clean::TyMethodItem(..)
|
||||
| clean::RequiredAssocConstItem(..)
|
||||
| clean::TyAssocTypeItem(..)
|
||||
| clean::RequiredAssocTypeItem(..)
|
||||
| clean::StructFieldItem(..)
|
||||
| clean::VariantItem(..) => {
|
||||
// Don't index if containing module is stripped (i.e., private),
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ impl<'a> From<&'a clean::Item> for ItemType {
|
|||
clean::RequiredAssocConstItem(..)
|
||||
| clean::ProvidedAssocConstItem(..)
|
||||
| clean::ImplAssocConstItem(..) => ItemType::AssocConst,
|
||||
clean::TyAssocTypeItem(..) | clean::AssocTypeItem(..) => ItemType::AssocType,
|
||||
clean::RequiredAssocTypeItem(..) | clean::AssocTypeItem(..) => ItemType::AssocType,
|
||||
clean::ForeignTypeItem => ItemType::ForeignType,
|
||||
clean::KeywordItem => ItemType::Keyword,
|
||||
clean::TraitAliasItem(..) => ItemType::TraitAlias,
|
||||
|
|
|
|||
|
|
@ -1127,7 +1127,7 @@ fn render_assoc_item(
|
|||
if parent == ItemType::Trait { 4 } else { 0 },
|
||||
cx,
|
||||
),
|
||||
clean::TyAssocTypeItem(ref generics, ref bounds) => assoc_type(
|
||||
clean::RequiredAssocTypeItem(ref generics, ref bounds) => assoc_type(
|
||||
w,
|
||||
item,
|
||||
generics,
|
||||
|
|
@ -1763,7 +1763,7 @@ fn render_impl(
|
|||
);
|
||||
w.write_str("</h4></section>");
|
||||
}
|
||||
clean::TyAssocTypeItem(ref generics, ref bounds) => {
|
||||
clean::RequiredAssocTypeItem(ref generics, ref bounds) => {
|
||||
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}\">");
|
||||
|
|
@ -1839,7 +1839,7 @@ fn render_impl(
|
|||
for trait_item in &impl_.items {
|
||||
match trait_item.kind {
|
||||
clean::MethodItem(..) | clean::TyMethodItem(_) => methods.push(trait_item),
|
||||
clean::TyAssocTypeItem(..) | clean::AssocTypeItem(..) => {
|
||||
clean::RequiredAssocTypeItem(..) | clean::AssocTypeItem(..) => {
|
||||
assoc_types.push(trait_item)
|
||||
}
|
||||
clean::RequiredAssocConstItem(..)
|
||||
|
|
|
|||
|
|
@ -651,7 +651,8 @@ fn item_function(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, f: &clean::
|
|||
fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Trait) {
|
||||
let tcx = cx.tcx();
|
||||
let bounds = bounds(&t.bounds, false, cx);
|
||||
let required_types = t.items.iter().filter(|m| m.is_ty_associated_type()).collect::<Vec<_>>();
|
||||
let required_types =
|
||||
t.items.iter().filter(|m| m.is_required_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_required_associated_const()).collect::<Vec<_>>();
|
||||
|
|
|
|||
|
|
@ -1207,10 +1207,11 @@ fn simplify_fn_type<'a, 'tcx>(
|
|||
&& let Type::Path { path } = arg
|
||||
&& let def_id = path.def_id()
|
||||
&& let Some(trait_) = cache.traits.get(&def_id)
|
||||
&& trait_.items.iter().any(|at| at.is_ty_associated_type())
|
||||
&& trait_.items.iter().any(|at| at.is_required_associated_type())
|
||||
{
|
||||
for assoc_ty in &trait_.items {
|
||||
if let clean::ItemKind::TyAssocTypeItem(_generics, bounds) = &assoc_ty.kind
|
||||
if let clean::ItemKind::RequiredAssocTypeItem(_generics, bounds) =
|
||||
&assoc_ty.kind
|
||||
&& let Some(name) = assoc_ty.name
|
||||
{
|
||||
let idx = -isize::try_from(rgen.len() + 1).unwrap();
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ fn sidebar_trait<'a>(
|
|||
res
|
||||
}
|
||||
|
||||
let req_assoc = filter_items(&t.items, |m| m.is_ty_associated_type(), "associatedtype");
|
||||
let req_assoc = filter_items(&t.items, |m| m.is_required_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_required_associated_const(), "associatedconstant");
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ fn from_clean_item(item: clean::Item, renderer: &JsonRenderer<'_>) -> ItemEnum {
|
|||
type_: ci.type_.into_json(renderer),
|
||||
value: Some(ci.kind.expr(renderer.tcx)),
|
||||
},
|
||||
TyAssocTypeItem(g, b) => ItemEnum::AssocType {
|
||||
RequiredAssocTypeItem(g, b) => ItemEnum::AssocType {
|
||||
generics: g.into_json(renderer),
|
||||
bounds: b.into_json(renderer),
|
||||
type_: None,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -
|
|||
| clean::RequiredAssocConstItem(..)
|
||||
| clean::ProvidedAssocConstItem(..)
|
||||
| clean::ImplAssocConstItem(..)
|
||||
| clean::TyAssocTypeItem(..)
|
||||
| clean::RequiredAssocTypeItem(..)
|
||||
// check for trait impl
|
||||
| clean::ImplItem(box clean::Impl { trait_: Some(_), .. })
|
||||
)
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ impl DocFolder for StabilityPropagator<'_, '_> {
|
|||
| ItemKind::RequiredAssocConstItem(..)
|
||||
| ItemKind::ProvidedAssocConstItem(..)
|
||||
| ItemKind::ImplAssocConstItem(..)
|
||||
| ItemKind::TyAssocTypeItem(..)
|
||||
| ItemKind::RequiredAssocTypeItem(..)
|
||||
| ItemKind::AssocTypeItem(..)
|
||||
| ItemKind::PrimitiveItem(..)
|
||||
| ItemKind::KeywordItem => own_stability,
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ impl DocFolder for Stripper<'_, '_> {
|
|||
// tymethods etc. have no control over privacy
|
||||
clean::TyMethodItem(..)
|
||||
| clean::RequiredAssocConstItem(..)
|
||||
| clean::TyAssocTypeItem(..) => {}
|
||||
| clean::RequiredAssocTypeItem(..) => {}
|
||||
|
||||
// Proc-macros are always public
|
||||
clean::ProcMacroItem(..) => {}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub(crate) trait DocVisitor<'a>: Sized {
|
|||
| RequiredAssocConstItem(..)
|
||||
| ProvidedAssocConstItem(..)
|
||||
| ImplAssocConstItem(..)
|
||||
| TyAssocTypeItem(..)
|
||||
| RequiredAssocTypeItem(..)
|
||||
| AssocTypeItem(..)
|
||||
| KeywordItem => {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue