rustdoc: Rename clean
items from typedef to type alias
This commit is contained in:
parent
ea9e442222
commit
062d247cd7
13 changed files with 52 additions and 48 deletions
|
@ -80,9 +80,9 @@ pub(crate) fn try_inline(
|
||||||
clean::UnionItem(build_union(cx, did))
|
clean::UnionItem(build_union(cx, did))
|
||||||
}
|
}
|
||||||
Res::Def(DefKind::TyAlias { .. }, did) => {
|
Res::Def(DefKind::TyAlias { .. }, did) => {
|
||||||
record_extern_fqn(cx, did, ItemType::Typedef);
|
record_extern_fqn(cx, did, ItemType::TypeAlias);
|
||||||
build_impls(cx, did, attrs_without_docs, &mut ret);
|
build_impls(cx, did, attrs_without_docs, &mut ret);
|
||||||
clean::TypedefItem(build_type_alias(cx, did))
|
clean::TypeAliasItem(build_type_alias(cx, did))
|
||||||
}
|
}
|
||||||
Res::Def(DefKind::Enum, did) => {
|
Res::Def(DefKind::Enum, did) => {
|
||||||
record_extern_fqn(cx, did, ItemType::Enum);
|
record_extern_fqn(cx, did, ItemType::Enum);
|
||||||
|
@ -287,7 +287,7 @@ fn build_union(cx: &mut DocContext<'_>, did: DefId) -> clean::Union {
|
||||||
clean::Union { generics, fields }
|
clean::Union { generics, fields }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> Box<clean::Typedef> {
|
fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> Box<clean::TypeAlias> {
|
||||||
let predicates = cx.tcx.explicit_predicates_of(did);
|
let predicates = cx.tcx.explicit_predicates_of(did);
|
||||||
let type_ = clean_middle_ty(
|
let type_ = clean_middle_ty(
|
||||||
ty::Binder::dummy(cx.tcx.type_of(did).instantiate_identity()),
|
ty::Binder::dummy(cx.tcx.type_of(did).instantiate_identity()),
|
||||||
|
@ -296,7 +296,7 @@ fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> Box<clean::Typedef>
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
Box::new(clean::Typedef {
|
Box::new(clean::TypeAlias {
|
||||||
type_,
|
type_,
|
||||||
generics: clean_ty_generics(cx, cx.tcx.generics_of(did), predicates),
|
generics: clean_ty_generics(cx, cx.tcx.generics_of(did), predicates),
|
||||||
item_type: None,
|
item_type: None,
|
||||||
|
|
|
@ -1219,7 +1219,7 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
AssocTypeItem(
|
AssocTypeItem(
|
||||||
Box::new(Typedef {
|
Box::new(TypeAlias {
|
||||||
type_: clean_ty(default, cx),
|
type_: clean_ty(default, cx),
|
||||||
generics,
|
generics,
|
||||||
item_type: Some(item_type),
|
item_type: Some(item_type),
|
||||||
|
@ -1264,7 +1264,7 @@ pub(crate) fn clean_impl_item<'tcx>(
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
AssocTypeItem(
|
AssocTypeItem(
|
||||||
Box::new(Typedef { type_, generics, item_type: Some(item_type) }),
|
Box::new(TypeAlias { type_, generics, item_type: Some(item_type) }),
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1461,7 +1461,7 @@ pub(crate) fn clean_middle_assoc_item<'tcx>(
|
||||||
|
|
||||||
if tcx.defaultness(assoc_item.def_id).has_value() {
|
if tcx.defaultness(assoc_item.def_id).has_value() {
|
||||||
AssocTypeItem(
|
AssocTypeItem(
|
||||||
Box::new(Typedef {
|
Box::new(TypeAlias {
|
||||||
type_: clean_middle_ty(
|
type_: clean_middle_ty(
|
||||||
ty::Binder::dummy(
|
ty::Binder::dummy(
|
||||||
tcx.type_of(assoc_item.def_id).instantiate_identity(),
|
tcx.type_of(assoc_item.def_id).instantiate_identity(),
|
||||||
|
@ -1480,7 +1480,7 @@ pub(crate) fn clean_middle_assoc_item<'tcx>(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AssocTypeItem(
|
AssocTypeItem(
|
||||||
Box::new(Typedef {
|
Box::new(TypeAlias {
|
||||||
type_: clean_middle_ty(
|
type_: clean_middle_ty(
|
||||||
ty::Binder::dummy(
|
ty::Binder::dummy(
|
||||||
tcx.type_of(assoc_item.def_id).instantiate_identity(),
|
tcx.type_of(assoc_item.def_id).instantiate_identity(),
|
||||||
|
@ -2617,7 +2617,11 @@ fn clean_maybe_renamed_item<'tcx>(
|
||||||
cx.current_type_aliases.remove(&def_id);
|
cx.current_type_aliases.remove(&def_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TypedefItem(Box::new(Typedef { type_: rustdoc_ty, generics, item_type: Some(ty) }))
|
TypeAliasItem(Box::new(TypeAlias {
|
||||||
|
type_: rustdoc_ty,
|
||||||
|
generics,
|
||||||
|
item_type: Some(ty),
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
ItemKind::Enum(ref def, generics) => EnumItem(Enum {
|
ItemKind::Enum(ref def, generics) => EnumItem(Enum {
|
||||||
variants: def.variants.iter().map(|v| clean_variant(v, cx)).collect(),
|
variants: def.variants.iter().map(|v| clean_variant(v, cx)).collect(),
|
||||||
|
|
|
@ -530,8 +530,8 @@ impl Item {
|
||||||
pub(crate) fn is_ty_method(&self) -> bool {
|
pub(crate) fn is_ty_method(&self) -> bool {
|
||||||
self.type_() == ItemType::TyMethod
|
self.type_() == ItemType::TyMethod
|
||||||
}
|
}
|
||||||
pub(crate) fn is_typedef(&self) -> bool {
|
pub(crate) fn is_type_alias(&self) -> bool {
|
||||||
self.type_() == ItemType::Typedef
|
self.type_() == ItemType::TypeAlias
|
||||||
}
|
}
|
||||||
pub(crate) fn is_primitive(&self) -> bool {
|
pub(crate) fn is_primitive(&self) -> bool {
|
||||||
self.type_() == ItemType::Primitive
|
self.type_() == ItemType::Primitive
|
||||||
|
@ -799,7 +799,7 @@ pub(crate) enum ItemKind {
|
||||||
EnumItem(Enum),
|
EnumItem(Enum),
|
||||||
FunctionItem(Box<Function>),
|
FunctionItem(Box<Function>),
|
||||||
ModuleItem(Module),
|
ModuleItem(Module),
|
||||||
TypedefItem(Box<Typedef>),
|
TypeAliasItem(Box<TypeAlias>),
|
||||||
OpaqueTyItem(OpaqueTy),
|
OpaqueTyItem(OpaqueTy),
|
||||||
StaticItem(Static),
|
StaticItem(Static),
|
||||||
ConstantItem(Constant),
|
ConstantItem(Constant),
|
||||||
|
@ -832,7 +832,7 @@ pub(crate) enum ItemKind {
|
||||||
/// The bounds may be non-empty if there is a `where` clause.
|
/// The bounds may be non-empty if there is a `where` clause.
|
||||||
TyAssocTypeItem(Generics, Vec<GenericBound>),
|
TyAssocTypeItem(Generics, Vec<GenericBound>),
|
||||||
/// An associated type in a trait impl or a provided one in a trait declaration.
|
/// An associated type in a trait impl or a provided one in a trait declaration.
|
||||||
AssocTypeItem(Box<Typedef>, Vec<GenericBound>),
|
AssocTypeItem(Box<TypeAlias>, Vec<GenericBound>),
|
||||||
/// An item that has been stripped by a rustdoc pass
|
/// An item that has been stripped by a rustdoc pass
|
||||||
StrippedItem(Box<ItemKind>),
|
StrippedItem(Box<ItemKind>),
|
||||||
KeywordItem,
|
KeywordItem,
|
||||||
|
@ -857,7 +857,7 @@ impl ItemKind {
|
||||||
ExternCrateItem { .. }
|
ExternCrateItem { .. }
|
||||||
| ImportItem(_)
|
| ImportItem(_)
|
||||||
| FunctionItem(_)
|
| FunctionItem(_)
|
||||||
| TypedefItem(_)
|
| TypeAliasItem(_)
|
||||||
| OpaqueTyItem(_)
|
| OpaqueTyItem(_)
|
||||||
| StaticItem(_)
|
| StaticItem(_)
|
||||||
| ConstantItem(_)
|
| ConstantItem(_)
|
||||||
|
@ -891,7 +891,7 @@ impl ItemKind {
|
||||||
| ModuleItem(_)
|
| ModuleItem(_)
|
||||||
| ExternCrateItem { .. }
|
| ExternCrateItem { .. }
|
||||||
| FunctionItem(_)
|
| FunctionItem(_)
|
||||||
| TypedefItem(_)
|
| TypeAliasItem(_)
|
||||||
| OpaqueTyItem(_)
|
| OpaqueTyItem(_)
|
||||||
| StaticItem(_)
|
| StaticItem(_)
|
||||||
| ConstantItem(_)
|
| ConstantItem(_)
|
||||||
|
@ -2230,7 +2230,7 @@ pub(crate) struct PathSegment {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) struct Typedef {
|
pub(crate) struct TypeAlias {
|
||||||
pub(crate) type_: Type,
|
pub(crate) type_: Type,
|
||||||
pub(crate) generics: Generics,
|
pub(crate) generics: Generics,
|
||||||
/// `type_` can come from either the HIR or from metadata. If it comes from HIR, it may be a type
|
/// `type_` can come from either the HIR or from metadata. If it comes from HIR, it may be a type
|
||||||
|
|
|
@ -55,7 +55,7 @@ pub(crate) trait DocFolder: Sized {
|
||||||
ExternCrateItem { src: _ }
|
ExternCrateItem { src: _ }
|
||||||
| ImportItem(_)
|
| ImportItem(_)
|
||||||
| FunctionItem(_)
|
| FunctionItem(_)
|
||||||
| TypedefItem(_)
|
| TypeAliasItem(_)
|
||||||
| OpaqueTyItem(_)
|
| OpaqueTyItem(_)
|
||||||
| StaticItem(_)
|
| StaticItem(_)
|
||||||
| ConstantItem(_)
|
| ConstantItem(_)
|
||||||
|
|
|
@ -389,7 +389,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
||||||
match *item.kind {
|
match *item.kind {
|
||||||
clean::StructItem(..)
|
clean::StructItem(..)
|
||||||
| clean::EnumItem(..)
|
| clean::EnumItem(..)
|
||||||
| clean::TypedefItem(..)
|
| clean::TypeAliasItem(..)
|
||||||
| clean::TraitItem(..)
|
| clean::TraitItem(..)
|
||||||
| clean::TraitAliasItem(..)
|
| clean::TraitAliasItem(..)
|
||||||
| clean::FunctionItem(..)
|
| clean::FunctionItem(..)
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub(crate) enum ItemType {
|
||||||
Struct = 3,
|
Struct = 3,
|
||||||
Enum = 4,
|
Enum = 4,
|
||||||
Function = 5,
|
Function = 5,
|
||||||
Typedef = 6,
|
TypeAlias = 6,
|
||||||
Static = 7,
|
Static = 7,
|
||||||
Trait = 8,
|
Trait = 8,
|
||||||
Impl = 9,
|
Impl = 9,
|
||||||
|
@ -75,7 +75,7 @@ impl<'a> From<&'a clean::Item> for ItemType {
|
||||||
clean::UnionItem(..) => ItemType::Union,
|
clean::UnionItem(..) => ItemType::Union,
|
||||||
clean::EnumItem(..) => ItemType::Enum,
|
clean::EnumItem(..) => ItemType::Enum,
|
||||||
clean::FunctionItem(..) => ItemType::Function,
|
clean::FunctionItem(..) => ItemType::Function,
|
||||||
clean::TypedefItem(..) => ItemType::Typedef,
|
clean::TypeAliasItem(..) => ItemType::TypeAlias,
|
||||||
clean::OpaqueTyItem(..) => ItemType::OpaqueTy,
|
clean::OpaqueTyItem(..) => ItemType::OpaqueTy,
|
||||||
clean::StaticItem(..) => ItemType::Static,
|
clean::StaticItem(..) => ItemType::Static,
|
||||||
clean::ConstantItem(..) => ItemType::Constant,
|
clean::ConstantItem(..) => ItemType::Constant,
|
||||||
|
@ -115,7 +115,7 @@ impl From<DefKind> for ItemType {
|
||||||
DefKind::Struct => Self::Struct,
|
DefKind::Struct => Self::Struct,
|
||||||
DefKind::Union => Self::Union,
|
DefKind::Union => Self::Union,
|
||||||
DefKind::Trait => Self::Trait,
|
DefKind::Trait => Self::Trait,
|
||||||
DefKind::TyAlias { .. } => Self::Typedef,
|
DefKind::TyAlias { .. } => Self::TypeAlias,
|
||||||
DefKind::TraitAlias => Self::TraitAlias,
|
DefKind::TraitAlias => Self::TraitAlias,
|
||||||
DefKind::Macro(kind) => match kind {
|
DefKind::Macro(kind) => match kind {
|
||||||
MacroKind::Bang => ItemType::Macro,
|
MacroKind::Bang => ItemType::Macro,
|
||||||
|
@ -156,7 +156,7 @@ impl ItemType {
|
||||||
ItemType::Union => "union",
|
ItemType::Union => "union",
|
||||||
ItemType::Enum => "enum",
|
ItemType::Enum => "enum",
|
||||||
ItemType::Function => "fn",
|
ItemType::Function => "fn",
|
||||||
ItemType::Typedef => "type",
|
ItemType::TypeAlias => "type",
|
||||||
ItemType::Static => "static",
|
ItemType::Static => "static",
|
||||||
ItemType::Trait => "trait",
|
ItemType::Trait => "trait",
|
||||||
ItemType::Impl => "impl",
|
ItemType::Impl => "impl",
|
||||||
|
|
|
@ -279,7 +279,7 @@ impl AllTypes {
|
||||||
ItemType::Trait => self.traits.insert(ItemEntry::new(new_url, name)),
|
ItemType::Trait => self.traits.insert(ItemEntry::new(new_url, name)),
|
||||||
ItemType::Macro => self.macros.insert(ItemEntry::new(new_url, name)),
|
ItemType::Macro => self.macros.insert(ItemEntry::new(new_url, name)),
|
||||||
ItemType::Function => self.functions.insert(ItemEntry::new(new_url, name)),
|
ItemType::Function => self.functions.insert(ItemEntry::new(new_url, name)),
|
||||||
ItemType::Typedef => self.typedefs.insert(ItemEntry::new(new_url, name)),
|
ItemType::TypeAlias => self.typedefs.insert(ItemEntry::new(new_url, name)),
|
||||||
ItemType::OpaqueTy => self.opaque_tys.insert(ItemEntry::new(new_url, name)),
|
ItemType::OpaqueTy => self.opaque_tys.insert(ItemEntry::new(new_url, name)),
|
||||||
ItemType::Static => self.statics.insert(ItemEntry::new(new_url, name)),
|
ItemType::Static => self.statics.insert(ItemEntry::new(new_url, name)),
|
||||||
ItemType::Constant => self.constants.insert(ItemEntry::new(new_url, name)),
|
ItemType::Constant => self.constants.insert(ItemEntry::new(new_url, name)),
|
||||||
|
@ -318,7 +318,7 @@ impl AllTypes {
|
||||||
sections.insert(ItemSection::Functions);
|
sections.insert(ItemSection::Functions);
|
||||||
}
|
}
|
||||||
if !self.typedefs.is_empty() {
|
if !self.typedefs.is_empty() {
|
||||||
sections.insert(ItemSection::TypeDefinitions);
|
sections.insert(ItemSection::TypeAliases);
|
||||||
}
|
}
|
||||||
if !self.opaque_tys.is_empty() {
|
if !self.opaque_tys.is_empty() {
|
||||||
sections.insert(ItemSection::OpaqueTypes);
|
sections.insert(ItemSection::OpaqueTypes);
|
||||||
|
@ -374,7 +374,7 @@ impl AllTypes {
|
||||||
print_entries(f, &self.attribute_macros, ItemSection::AttributeMacros);
|
print_entries(f, &self.attribute_macros, ItemSection::AttributeMacros);
|
||||||
print_entries(f, &self.derive_macros, ItemSection::DeriveMacros);
|
print_entries(f, &self.derive_macros, ItemSection::DeriveMacros);
|
||||||
print_entries(f, &self.functions, ItemSection::Functions);
|
print_entries(f, &self.functions, ItemSection::Functions);
|
||||||
print_entries(f, &self.typedefs, ItemSection::TypeDefinitions);
|
print_entries(f, &self.typedefs, ItemSection::TypeAliases);
|
||||||
print_entries(f, &self.trait_aliases, ItemSection::TraitAliases);
|
print_entries(f, &self.trait_aliases, ItemSection::TraitAliases);
|
||||||
print_entries(f, &self.opaque_tys, ItemSection::OpaqueTypes);
|
print_entries(f, &self.opaque_tys, ItemSection::OpaqueTypes);
|
||||||
print_entries(f, &self.statics, ItemSection::Statics);
|
print_entries(f, &self.statics, ItemSection::Statics);
|
||||||
|
@ -1237,7 +1237,7 @@ fn render_deref_methods(
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|item| match *item.kind {
|
.find_map(|item| match *item.kind {
|
||||||
clean::AssocTypeItem(box ref t, _) => Some(match *t {
|
clean::AssocTypeItem(box ref t, _) => Some(match *t {
|
||||||
clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_),
|
clean::TypeAlias { item_type: Some(ref type_), .. } => (type_, &t.type_),
|
||||||
_ => (&t.type_, &t.type_),
|
_ => (&t.type_, &t.type_),
|
||||||
}),
|
}),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -2035,7 +2035,7 @@ pub(crate) enum ItemSection {
|
||||||
Statics,
|
Statics,
|
||||||
Traits,
|
Traits,
|
||||||
Functions,
|
Functions,
|
||||||
TypeDefinitions,
|
TypeAliases,
|
||||||
Unions,
|
Unions,
|
||||||
Implementations,
|
Implementations,
|
||||||
TypeMethods,
|
TypeMethods,
|
||||||
|
@ -2067,7 +2067,7 @@ impl ItemSection {
|
||||||
Statics,
|
Statics,
|
||||||
Traits,
|
Traits,
|
||||||
Functions,
|
Functions,
|
||||||
TypeDefinitions,
|
TypeAliases,
|
||||||
Unions,
|
Unions,
|
||||||
Implementations,
|
Implementations,
|
||||||
TypeMethods,
|
TypeMethods,
|
||||||
|
@ -2093,7 +2093,7 @@ impl ItemSection {
|
||||||
Self::Unions => "unions",
|
Self::Unions => "unions",
|
||||||
Self::Enums => "enums",
|
Self::Enums => "enums",
|
||||||
Self::Functions => "functions",
|
Self::Functions => "functions",
|
||||||
Self::TypeDefinitions => "types",
|
Self::TypeAliases => "types",
|
||||||
Self::Statics => "statics",
|
Self::Statics => "statics",
|
||||||
Self::Constants => "constants",
|
Self::Constants => "constants",
|
||||||
Self::Traits => "traits",
|
Self::Traits => "traits",
|
||||||
|
@ -2123,7 +2123,7 @@ impl ItemSection {
|
||||||
Self::Unions => "Unions",
|
Self::Unions => "Unions",
|
||||||
Self::Enums => "Enums",
|
Self::Enums => "Enums",
|
||||||
Self::Functions => "Functions",
|
Self::Functions => "Functions",
|
||||||
Self::TypeDefinitions => "Type Aliases",
|
Self::TypeAliases => "Type Aliases",
|
||||||
Self::Statics => "Statics",
|
Self::Statics => "Statics",
|
||||||
Self::Constants => "Constants",
|
Self::Constants => "Constants",
|
||||||
Self::Traits => "Traits",
|
Self::Traits => "Traits",
|
||||||
|
@ -2154,7 +2154,7 @@ fn item_ty_to_section(ty: ItemType) -> ItemSection {
|
||||||
ItemType::Union => ItemSection::Unions,
|
ItemType::Union => ItemSection::Unions,
|
||||||
ItemType::Enum => ItemSection::Enums,
|
ItemType::Enum => ItemSection::Enums,
|
||||||
ItemType::Function => ItemSection::Functions,
|
ItemType::Function => ItemSection::Functions,
|
||||||
ItemType::Typedef => ItemSection::TypeDefinitions,
|
ItemType::TypeAlias => ItemSection::TypeAliases,
|
||||||
ItemType::Static => ItemSection::Statics,
|
ItemType::Static => ItemSection::Statics,
|
||||||
ItemType::Constant => ItemSection::Constants,
|
ItemType::Constant => ItemSection::Constants,
|
||||||
ItemType::Trait => ItemSection::Traits,
|
ItemType::Trait => ItemSection::Traits,
|
||||||
|
|
|
@ -198,7 +198,7 @@ pub(super) fn print_item(
|
||||||
clean::StructItem(..) => "Struct ",
|
clean::StructItem(..) => "Struct ",
|
||||||
clean::UnionItem(..) => "Union ",
|
clean::UnionItem(..) => "Union ",
|
||||||
clean::EnumItem(..) => "Enum ",
|
clean::EnumItem(..) => "Enum ",
|
||||||
clean::TypedefItem(..) => "Type Alias ",
|
clean::TypeAliasItem(..) => "Type Alias ",
|
||||||
clean::MacroItem(..) => "Macro ",
|
clean::MacroItem(..) => "Macro ",
|
||||||
clean::ProcMacroItem(ref mac) => match mac.kind {
|
clean::ProcMacroItem(ref mac) => match mac.kind {
|
||||||
MacroKind::Bang => "Macro ",
|
MacroKind::Bang => "Macro ",
|
||||||
|
@ -273,7 +273,7 @@ pub(super) fn print_item(
|
||||||
clean::StructItem(ref s) => item_struct(buf, cx, item, s),
|
clean::StructItem(ref s) => item_struct(buf, cx, item, s),
|
||||||
clean::UnionItem(ref s) => item_union(buf, cx, item, s),
|
clean::UnionItem(ref s) => item_union(buf, cx, item, s),
|
||||||
clean::EnumItem(ref e) => item_enum(buf, cx, item, e),
|
clean::EnumItem(ref e) => item_enum(buf, cx, item, e),
|
||||||
clean::TypedefItem(ref t) => item_typedef(buf, cx, item, t),
|
clean::TypeAliasItem(ref t) => item_type_alias(buf, cx, item, t),
|
||||||
clean::MacroItem(ref m) => item_macro(buf, cx, item, m),
|
clean::MacroItem(ref m) => item_macro(buf, cx, item, m),
|
||||||
clean::ProcMacroItem(ref m) => item_proc_macro(buf, cx, item, m),
|
clean::ProcMacroItem(ref m) => item_proc_macro(buf, cx, item, m),
|
||||||
clean::PrimitiveItem(_) => item_primitive(buf, cx, item),
|
clean::PrimitiveItem(_) => item_primitive(buf, cx, item),
|
||||||
|
@ -343,7 +343,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
|
||||||
ItemType::Static => 8,
|
ItemType::Static => 8,
|
||||||
ItemType::Trait => 9,
|
ItemType::Trait => 9,
|
||||||
ItemType::Function => 10,
|
ItemType::Function => 10,
|
||||||
ItemType::Typedef => 12,
|
ItemType::TypeAlias => 12,
|
||||||
ItemType::Union => 13,
|
ItemType::Union => 13,
|
||||||
_ => 14 + ty as u8,
|
_ => 14 + ty as u8,
|
||||||
}
|
}
|
||||||
|
@ -1217,8 +1217,8 @@ fn item_opaque_ty(
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_typedef(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean::Typedef) {
|
fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean::TypeAlias) {
|
||||||
fn write_content(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Typedef) {
|
fn write_content(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::TypeAlias) {
|
||||||
wrap_item(w, |w| {
|
wrap_item(w, |w| {
|
||||||
write!(
|
write!(
|
||||||
w,
|
w,
|
||||||
|
|
|
@ -82,7 +82,7 @@ pub(super) fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buf
|
||||||
clean::PrimitiveItem(_) => sidebar_primitive(cx, it),
|
clean::PrimitiveItem(_) => sidebar_primitive(cx, it),
|
||||||
clean::UnionItem(ref u) => sidebar_union(cx, it, u),
|
clean::UnionItem(ref u) => sidebar_union(cx, it, u),
|
||||||
clean::EnumItem(ref e) => sidebar_enum(cx, it, e),
|
clean::EnumItem(ref e) => sidebar_enum(cx, it, e),
|
||||||
clean::TypedefItem(_) => sidebar_typedef(cx, it),
|
clean::TypeAliasItem(_) => sidebar_type_alias(cx, it),
|
||||||
clean::ModuleItem(ref m) => vec![sidebar_module(&m.items)],
|
clean::ModuleItem(ref m) => vec![sidebar_module(&m.items)],
|
||||||
clean::ForeignTypeItem => sidebar_foreign_type(cx, it),
|
clean::ForeignTypeItem => sidebar_foreign_type(cx, it),
|
||||||
_ => vec![],
|
_ => vec![],
|
||||||
|
@ -100,7 +100,7 @@ pub(super) fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buf
|
||||||
|| it.is_union()
|
|| it.is_union()
|
||||||
|| it.is_enum()
|
|| it.is_enum()
|
||||||
|| it.is_mod()
|
|| it.is_mod()
|
||||||
|| it.is_typedef()
|
|| it.is_type_alias()
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
match *it.kind {
|
match *it.kind {
|
||||||
|
@ -230,7 +230,7 @@ fn sidebar_primitive<'a>(cx: &'a Context<'_>, it: &'a clean::Item) -> Vec<LinkBl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sidebar_typedef<'a>(cx: &'a Context<'_>, it: &'a clean::Item) -> Vec<LinkBlock<'a>> {
|
fn sidebar_type_alias<'a>(cx: &'a Context<'_>, it: &'a clean::Item) -> Vec<LinkBlock<'a>> {
|
||||||
let mut items = vec![];
|
let mut items = vec![];
|
||||||
sidebar_assoc_items(cx, it, &mut items);
|
sidebar_assoc_items(cx, it, &mut items);
|
||||||
items
|
items
|
||||||
|
@ -334,7 +334,7 @@ fn sidebar_deref_methods<'a>(
|
||||||
if let Some((target, real_target)) =
|
if let Some((target, real_target)) =
|
||||||
impl_.inner_impl().items.iter().find_map(|item| match *item.kind {
|
impl_.inner_impl().items.iter().find_map(|item| match *item.kind {
|
||||||
clean::AssocTypeItem(box ref t, _) => Some(match *t {
|
clean::AssocTypeItem(box ref t, _) => Some(match *t {
|
||||||
clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_),
|
clean::TypeAlias { item_type: Some(ref type_), .. } => (type_, &t.type_),
|
||||||
_ => (&t.type_, &t.type_),
|
_ => (&t.type_, &t.type_),
|
||||||
}),
|
}),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
|
@ -311,7 +311,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
|
||||||
StaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)),
|
StaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)),
|
||||||
ForeignStaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)),
|
ForeignStaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)),
|
||||||
ForeignTypeItem => ItemEnum::ForeignType,
|
ForeignTypeItem => ItemEnum::ForeignType,
|
||||||
TypedefItem(t) => ItemEnum::Typedef(t.into_tcx(tcx)),
|
TypeAliasItem(t) => ItemEnum::Typedef(t.into_tcx(tcx)),
|
||||||
OpaqueTyItem(t) => ItemEnum::OpaqueTy(t.into_tcx(tcx)),
|
OpaqueTyItem(t) => ItemEnum::OpaqueTy(t.into_tcx(tcx)),
|
||||||
ConstantItem(c) => ItemEnum::Constant(c.into_tcx(tcx)),
|
ConstantItem(c) => ItemEnum::Constant(c.into_tcx(tcx)),
|
||||||
MacroItem(m) => ItemEnum::Macro(m.source),
|
MacroItem(m) => ItemEnum::Macro(m.source),
|
||||||
|
@ -787,9 +787,9 @@ pub(crate) fn from_macro_kind(kind: rustc_span::hygiene::MacroKind) -> MacroKind
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromWithTcx<Box<clean::Typedef>> for Typedef {
|
impl FromWithTcx<Box<clean::TypeAlias>> for Typedef {
|
||||||
fn from_tcx(typedef: Box<clean::Typedef>, tcx: TyCtxt<'_>) -> Self {
|
fn from_tcx(typedef: Box<clean::TypeAlias>, tcx: TyCtxt<'_>) -> Self {
|
||||||
let clean::Typedef { type_, generics, item_type: _ } = *typedef;
|
let clean::TypeAlias { type_, generics, item_type: _ } = *typedef;
|
||||||
Typedef { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) }
|
Typedef { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -827,7 +827,7 @@ impl FromWithTcx<ItemType> for ItemKind {
|
||||||
Union => ItemKind::Union,
|
Union => ItemKind::Union,
|
||||||
Enum => ItemKind::Enum,
|
Enum => ItemKind::Enum,
|
||||||
Function | TyMethod | Method => ItemKind::Function,
|
Function | TyMethod | Method => ItemKind::Function,
|
||||||
Typedef => ItemKind::Typedef,
|
TypeAlias => ItemKind::Typedef,
|
||||||
OpaqueTy => ItemKind::OpaqueTy,
|
OpaqueTy => ItemKind::OpaqueTy,
|
||||||
Static => ItemKind::Static,
|
Static => ItemKind::Static,
|
||||||
Constant => ItemKind::Constant,
|
Constant => ItemKind::Constant,
|
||||||
|
|
|
@ -60,7 +60,7 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -
|
||||||
| clean::VariantItem(_)
|
| clean::VariantItem(_)
|
||||||
| clean::AssocConstItem(..)
|
| clean::AssocConstItem(..)
|
||||||
| clean::AssocTypeItem(..)
|
| clean::AssocTypeItem(..)
|
||||||
| clean::TypedefItem(_)
|
| clean::TypeAliasItem(_)
|
||||||
| clean::StaticItem(_)
|
| clean::StaticItem(_)
|
||||||
| clean::ConstantItem(_)
|
| clean::ConstantItem(_)
|
||||||
| clean::ExternCrateItem { .. }
|
| clean::ExternCrateItem { .. }
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl<'a, 'tcx> DocFolder for Stripper<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
// These items can all get re-exported
|
// These items can all get re-exported
|
||||||
clean::OpaqueTyItem(..)
|
clean::OpaqueTyItem(..)
|
||||||
| clean::TypedefItem(..)
|
| clean::TypeAliasItem(..)
|
||||||
| clean::StaticItem(..)
|
| clean::StaticItem(..)
|
||||||
| clean::StructItem(..)
|
| clean::StructItem(..)
|
||||||
| clean::EnumItem(..)
|
| clean::EnumItem(..)
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub(crate) trait DocVisitor: Sized {
|
||||||
ExternCrateItem { src: _ }
|
ExternCrateItem { src: _ }
|
||||||
| ImportItem(_)
|
| ImportItem(_)
|
||||||
| FunctionItem(_)
|
| FunctionItem(_)
|
||||||
| TypedefItem(_)
|
| TypeAliasItem(_)
|
||||||
| OpaqueTyItem(_)
|
| OpaqueTyItem(_)
|
||||||
| StaticItem(_)
|
| StaticItem(_)
|
||||||
| ConstantItem(_)
|
| ConstantItem(_)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue