Rollup merge of #84464 - jyn514:type-kind, r=CraftSpider
rustdoc: Get rid of `clean::TypeKind` It does exactly the same thing as ItemType.
This commit is contained in:
commit
e25c5e2c25
@ -15,7 +15,7 @@ use rustc_span::hygiene::MacroKind;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::clean::{self, Attributes, GetDefId, ToSource, TypeKind};
|
||||
use crate::clean::{self, Attributes, GetDefId, ToSource};
|
||||
use crate::core::DocContext;
|
||||
use crate::formats::item_type::ItemType;
|
||||
|
||||
@ -56,36 +56,36 @@ crate fn try_inline(
|
||||
|
||||
let kind = match res {
|
||||
Res::Def(DefKind::Trait, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Trait);
|
||||
record_extern_fqn(cx, did, ItemType::Trait);
|
||||
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
|
||||
clean::TraitItem(build_external_trait(cx, did))
|
||||
}
|
||||
Res::Def(DefKind::Fn, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Function);
|
||||
record_extern_fqn(cx, did, ItemType::Function);
|
||||
clean::FunctionItem(build_external_function(cx, did))
|
||||
}
|
||||
Res::Def(DefKind::Struct, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Struct);
|
||||
record_extern_fqn(cx, did, ItemType::Struct);
|
||||
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
|
||||
clean::StructItem(build_struct(cx, did))
|
||||
}
|
||||
Res::Def(DefKind::Union, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Union);
|
||||
record_extern_fqn(cx, did, ItemType::Union);
|
||||
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
|
||||
clean::UnionItem(build_union(cx, did))
|
||||
}
|
||||
Res::Def(DefKind::TyAlias, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Typedef);
|
||||
record_extern_fqn(cx, did, ItemType::Typedef);
|
||||
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
|
||||
clean::TypedefItem(build_type_alias(cx, did), false)
|
||||
}
|
||||
Res::Def(DefKind::Enum, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Enum);
|
||||
record_extern_fqn(cx, did, ItemType::Enum);
|
||||
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
|
||||
clean::EnumItem(build_enum(cx, did))
|
||||
}
|
||||
Res::Def(DefKind::ForeignTy, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Foreign);
|
||||
record_extern_fqn(cx, did, ItemType::ForeignType);
|
||||
build_impls(cx, Some(parent_module), did, attrs, &mut ret);
|
||||
clean::ForeignTypeItem
|
||||
}
|
||||
@ -95,24 +95,24 @@ crate fn try_inline(
|
||||
// their constructors.
|
||||
Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..) => return Some(Vec::new()),
|
||||
Res::Def(DefKind::Mod, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Module);
|
||||
record_extern_fqn(cx, did, ItemType::Module);
|
||||
clean::ModuleItem(build_module(cx, did, visited))
|
||||
}
|
||||
Res::Def(DefKind::Static, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Static);
|
||||
record_extern_fqn(cx, did, ItemType::Static);
|
||||
clean::StaticItem(build_static(cx, did, cx.tcx.is_mutable_static(did)))
|
||||
}
|
||||
Res::Def(DefKind::Const, did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Const);
|
||||
record_extern_fqn(cx, did, ItemType::Constant);
|
||||
clean::ConstantItem(build_const(cx, did))
|
||||
}
|
||||
Res::Def(DefKind::Macro(kind), did) => {
|
||||
let mac = build_macro(cx, did, name);
|
||||
|
||||
let type_kind = match kind {
|
||||
MacroKind::Bang => TypeKind::Macro,
|
||||
MacroKind::Attr => TypeKind::Attr,
|
||||
MacroKind::Derive => TypeKind::Derive,
|
||||
MacroKind::Bang => ItemType::Macro,
|
||||
MacroKind::Attr => ItemType::ProcAttribute,
|
||||
MacroKind::Derive => ItemType::ProcDerive,
|
||||
};
|
||||
record_extern_fqn(cx, did, type_kind);
|
||||
mac
|
||||
@ -157,7 +157,7 @@ crate fn load_attrs<'hir>(cx: &DocContext<'hir>, did: DefId) -> Attrs<'hir> {
|
||||
///
|
||||
/// These names are used later on by HTML rendering to generate things like
|
||||
/// source links back to the original item.
|
||||
crate fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: clean::TypeKind) {
|
||||
crate fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemType) {
|
||||
let crate_name = cx.tcx.crate_name(did.krate).to_string();
|
||||
|
||||
let relative = cx.tcx.def_path(did).data.into_iter().filter_map(|elem| {
|
||||
@ -165,7 +165,7 @@ crate fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: clean::Typ
|
||||
let s = elem.data.to_string();
|
||||
if !s.is_empty() { Some(s) } else { None }
|
||||
});
|
||||
let fqn = if let clean::TypeKind::Macro = kind {
|
||||
let fqn = if let ItemType::Macro = kind {
|
||||
// Check to see if it is a macro 2.0 or built-in macro
|
||||
if matches!(
|
||||
cx.enter_resolver(|r| r.cstore().load_macro_untracked(did, cx.sess())),
|
||||
|
@ -36,6 +36,7 @@ use std::{mem, vec};
|
||||
|
||||
use crate::core::{self, DocContext, ImplTraitParam};
|
||||
use crate::doctree;
|
||||
use crate::formats::item_type::ItemType;
|
||||
|
||||
use utils::*;
|
||||
|
||||
@ -154,7 +155,7 @@ impl Clean<GenericBound> for hir::GenericBound<'_> {
|
||||
impl Clean<Type> for (ty::TraitRef<'_>, &[TypeBinding]) {
|
||||
fn clean(&self, cx: &mut DocContext<'_>) -> Type {
|
||||
let (trait_ref, bounds) = *self;
|
||||
inline::record_extern_fqn(cx, trait_ref.def_id, TypeKind::Trait);
|
||||
inline::record_extern_fqn(cx, trait_ref.def_id, ItemType::Trait);
|
||||
let path = external_path(
|
||||
cx,
|
||||
cx.tcx.item_name(trait_ref.def_id),
|
||||
@ -909,12 +910,6 @@ impl Clean<PolyTrait> for hir::PolyTraitRef<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<TypeKind> for hir::def::DefKind {
|
||||
fn clean(&self, _: &mut DocContext<'_>) -> TypeKind {
|
||||
(*self).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<Item> for hir::TraitItem<'_> {
|
||||
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
|
||||
let local_did = self.def_id.to_def_id();
|
||||
@ -1449,16 +1444,16 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
||||
ty::Adt(def, substs) => {
|
||||
let did = def.did;
|
||||
let kind = match def.adt_kind() {
|
||||
AdtKind::Struct => TypeKind::Struct,
|
||||
AdtKind::Union => TypeKind::Union,
|
||||
AdtKind::Enum => TypeKind::Enum,
|
||||
AdtKind::Struct => ItemType::Struct,
|
||||
AdtKind::Union => ItemType::Union,
|
||||
AdtKind::Enum => ItemType::Enum,
|
||||
};
|
||||
inline::record_extern_fqn(cx, did, kind);
|
||||
let path = external_path(cx, cx.tcx.item_name(did), None, false, vec![], substs);
|
||||
ResolvedPath { path, param_names: None, did, is_generic: false }
|
||||
}
|
||||
ty::Foreign(did) => {
|
||||
inline::record_extern_fqn(cx, did, TypeKind::Foreign);
|
||||
inline::record_extern_fqn(cx, did, ItemType::ForeignType);
|
||||
let path = external_path(
|
||||
cx,
|
||||
cx.tcx.item_name(did),
|
||||
@ -1483,7 +1478,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
||||
_ => cx.tcx.intern_substs(&[]),
|
||||
};
|
||||
|
||||
inline::record_extern_fqn(cx, did, TypeKind::Trait);
|
||||
inline::record_extern_fqn(cx, did, ItemType::Trait);
|
||||
|
||||
let mut param_names = vec![];
|
||||
if let Some(b) = reg.clean(cx) {
|
||||
@ -1493,7 +1488,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
||||
let empty = cx.tcx.intern_substs(&[]);
|
||||
let path =
|
||||
external_path(cx, cx.tcx.item_name(did), Some(did), false, vec![], empty);
|
||||
inline::record_extern_fqn(cx, did, TypeKind::Trait);
|
||||
inline::record_extern_fqn(cx, did, ItemType::Trait);
|
||||
let bound = GenericBound::TraitBound(
|
||||
PolyTrait {
|
||||
trait_: ResolvedPath {
|
||||
|
@ -1099,7 +1099,7 @@ impl GenericBound {
|
||||
let did = cx.tcx.require_lang_item(LangItem::Sized, None);
|
||||
let empty = cx.tcx.intern_substs(&[]);
|
||||
let path = external_path(cx, cx.tcx.item_name(did), Some(did), false, vec![], empty);
|
||||
inline::record_extern_fqn(cx, did, TypeKind::Trait);
|
||||
inline::record_extern_fqn(cx, did, ItemType::Trait);
|
||||
GenericBound::TraitBound(
|
||||
PolyTrait {
|
||||
trait_: ResolvedPath { path, param_names: None, did, is_generic: false },
|
||||
@ -1438,62 +1438,6 @@ crate enum PrimitiveType {
|
||||
Never,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Copy, Debug)]
|
||||
crate enum TypeKind {
|
||||
Enum,
|
||||
Function,
|
||||
Module,
|
||||
Const,
|
||||
Static,
|
||||
Struct,
|
||||
Union,
|
||||
Trait,
|
||||
Typedef,
|
||||
Foreign,
|
||||
Macro,
|
||||
Attr,
|
||||
Derive,
|
||||
TraitAlias,
|
||||
Primitive,
|
||||
}
|
||||
|
||||
impl From<hir::def::DefKind> for TypeKind {
|
||||
fn from(other: hir::def::DefKind) -> Self {
|
||||
match other {
|
||||
hir::def::DefKind::Enum => Self::Enum,
|
||||
hir::def::DefKind::Fn => Self::Function,
|
||||
hir::def::DefKind::Mod => Self::Module,
|
||||
hir::def::DefKind::Const => Self::Const,
|
||||
hir::def::DefKind::Static => Self::Static,
|
||||
hir::def::DefKind::Struct => Self::Struct,
|
||||
hir::def::DefKind::Union => Self::Union,
|
||||
hir::def::DefKind::Trait => Self::Trait,
|
||||
hir::def::DefKind::TyAlias => Self::Typedef,
|
||||
hir::def::DefKind::TraitAlias => Self::TraitAlias,
|
||||
hir::def::DefKind::Macro(_) => Self::Macro,
|
||||
hir::def::DefKind::ForeignTy
|
||||
| hir::def::DefKind::Variant
|
||||
| hir::def::DefKind::AssocTy
|
||||
| hir::def::DefKind::TyParam
|
||||
| hir::def::DefKind::ConstParam
|
||||
| hir::def::DefKind::Ctor(..)
|
||||
| hir::def::DefKind::AssocFn
|
||||
| hir::def::DefKind::AssocConst
|
||||
| hir::def::DefKind::ExternCrate
|
||||
| hir::def::DefKind::Use
|
||||
| hir::def::DefKind::ForeignMod
|
||||
| hir::def::DefKind::AnonConst
|
||||
| hir::def::DefKind::OpaqueTy
|
||||
| hir::def::DefKind::Field
|
||||
| hir::def::DefKind::LifetimeParam
|
||||
| hir::def::DefKind::GlobalAsm
|
||||
| hir::def::DefKind::Impl
|
||||
| hir::def::DefKind::Closure
|
||||
| hir::def::DefKind::Generator => Self::Foreign,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
crate trait GetDefId {
|
||||
/// Use this method to get the [`DefId`] of a [`clean`] AST node.
|
||||
/// This will return [`None`] when called on a primitive [`clean::Type`].
|
||||
|
@ -3,9 +3,9 @@ use crate::clean::blanket_impl::BlanketImplFinder;
|
||||
use crate::clean::{
|
||||
inline, Clean, Crate, Generic, GenericArg, GenericArgs, ImportSource, Item, ItemKind, Lifetime,
|
||||
MacroKind, Path, PathSegment, Primitive, PrimitiveType, ResolvedPath, Type, TypeBinding,
|
||||
TypeKind,
|
||||
};
|
||||
use crate::core::DocContext;
|
||||
use crate::formats::item_type::ItemType;
|
||||
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
@ -435,29 +435,29 @@ crate fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId {
|
||||
debug!("register_res({:?})", res);
|
||||
|
||||
let (did, kind) = match res {
|
||||
Res::Def(DefKind::Fn, i) => (i, TypeKind::Function),
|
||||
Res::Def(DefKind::TyAlias, i) => (i, TypeKind::Typedef),
|
||||
Res::Def(DefKind::Enum, i) => (i, TypeKind::Enum),
|
||||
Res::Def(DefKind::Trait, i) => (i, TypeKind::Trait),
|
||||
Res::Def(DefKind::Fn, i) => (i, ItemType::Function),
|
||||
Res::Def(DefKind::TyAlias, i) => (i, ItemType::Typedef),
|
||||
Res::Def(DefKind::Enum, i) => (i, ItemType::Enum),
|
||||
Res::Def(DefKind::Trait, i) => (i, ItemType::Trait),
|
||||
Res::Def(DefKind::AssocTy | DefKind::AssocFn | DefKind::AssocConst, i) => {
|
||||
(cx.tcx.parent(i).unwrap(), TypeKind::Trait)
|
||||
(cx.tcx.parent(i).unwrap(), ItemType::Trait)
|
||||
}
|
||||
Res::Def(DefKind::Struct, i) => (i, TypeKind::Struct),
|
||||
Res::Def(DefKind::Union, i) => (i, TypeKind::Union),
|
||||
Res::Def(DefKind::Mod, i) => (i, TypeKind::Module),
|
||||
Res::Def(DefKind::ForeignTy, i) => (i, TypeKind::Foreign),
|
||||
Res::Def(DefKind::Const, i) => (i, TypeKind::Const),
|
||||
Res::Def(DefKind::Static, i) => (i, TypeKind::Static),
|
||||
Res::Def(DefKind::Struct, i) => (i, ItemType::Struct),
|
||||
Res::Def(DefKind::Union, i) => (i, ItemType::Union),
|
||||
Res::Def(DefKind::Mod, i) => (i, ItemType::Module),
|
||||
Res::Def(DefKind::ForeignTy, i) => (i, ItemType::ForeignType),
|
||||
Res::Def(DefKind::Const, i) => (i, ItemType::Constant),
|
||||
Res::Def(DefKind::Static, i) => (i, ItemType::Static),
|
||||
Res::Def(DefKind::Variant, i) => {
|
||||
(cx.tcx.parent(i).expect("cannot get parent def id"), TypeKind::Enum)
|
||||
(cx.tcx.parent(i).expect("cannot get parent def id"), ItemType::Enum)
|
||||
}
|
||||
Res::Def(DefKind::Macro(mac_kind), i) => match mac_kind {
|
||||
MacroKind::Bang => (i, TypeKind::Macro),
|
||||
MacroKind::Attr => (i, TypeKind::Attr),
|
||||
MacroKind::Derive => (i, TypeKind::Derive),
|
||||
MacroKind::Bang => (i, ItemType::Macro),
|
||||
MacroKind::Attr => (i, ItemType::ProcAttribute),
|
||||
MacroKind::Derive => (i, ItemType::ProcDerive),
|
||||
},
|
||||
Res::Def(DefKind::TraitAlias, i) => (i, TypeKind::TraitAlias),
|
||||
Res::SelfTy(Some(def_id), _) => (def_id, TypeKind::Trait),
|
||||
Res::Def(DefKind::TraitAlias, i) => (i, ItemType::TraitAlias),
|
||||
Res::SelfTy(Some(def_id), _) => (def_id, ItemType::Trait),
|
||||
Res::SelfTy(_, Some((impl_def_id, _))) => return impl_def_id,
|
||||
_ => return res.def_id(),
|
||||
};
|
||||
@ -465,7 +465,7 @@ crate fn register_res(cx: &mut DocContext<'_>, res: Res) -> DefId {
|
||||
return did;
|
||||
}
|
||||
inline::record_extern_fqn(cx, did, kind);
|
||||
if let TypeKind::Trait = kind {
|
||||
if let ItemType::Trait = kind {
|
||||
inline::record_extern_trait(cx, did);
|
||||
}
|
||||
did
|
||||
|
@ -4,6 +4,7 @@ use std::fmt;
|
||||
|
||||
use serde::{Serialize, Serializer};
|
||||
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_span::hygiene::MacroKind;
|
||||
|
||||
use crate::clean;
|
||||
@ -19,7 +20,7 @@ use crate::clean;
|
||||
/// module headings. If you are adding to this enum and want to ensure that the sidebar also prints
|
||||
/// a heading, edit the listing in `html/render.rs`, function `sidebar_module`. This uses an
|
||||
/// ordering based on a helper function inside `item_module`, in the same file.
|
||||
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord)]
|
||||
#[derive(Copy, PartialEq, Eq, Hash, Clone, Debug, PartialOrd, Ord)]
|
||||
crate enum ItemType {
|
||||
Module = 0,
|
||||
ExternCrate = 1,
|
||||
@ -102,24 +103,43 @@ impl<'a> From<&'a clean::Item> for ItemType {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<clean::TypeKind> for ItemType {
|
||||
fn from(kind: clean::TypeKind) -> ItemType {
|
||||
match kind {
|
||||
clean::TypeKind::Struct => ItemType::Struct,
|
||||
clean::TypeKind::Union => ItemType::Union,
|
||||
clean::TypeKind::Enum => ItemType::Enum,
|
||||
clean::TypeKind::Function => ItemType::Function,
|
||||
clean::TypeKind::Trait => ItemType::Trait,
|
||||
clean::TypeKind::Module => ItemType::Module,
|
||||
clean::TypeKind::Static => ItemType::Static,
|
||||
clean::TypeKind::Const => ItemType::Constant,
|
||||
clean::TypeKind::Typedef => ItemType::Typedef,
|
||||
clean::TypeKind::Foreign => ItemType::ForeignType,
|
||||
clean::TypeKind::Macro => ItemType::Macro,
|
||||
clean::TypeKind::Attr => ItemType::ProcAttribute,
|
||||
clean::TypeKind::Derive => ItemType::ProcDerive,
|
||||
clean::TypeKind::TraitAlias => ItemType::TraitAlias,
|
||||
clean::TypeKind::Primitive => ItemType::Primitive,
|
||||
impl From<DefKind> for ItemType {
|
||||
fn from(other: DefKind) -> Self {
|
||||
match other {
|
||||
DefKind::Enum => Self::Enum,
|
||||
DefKind::Fn => Self::Function,
|
||||
DefKind::Mod => Self::Module,
|
||||
DefKind::Const => Self::Constant,
|
||||
DefKind::Static => Self::Static,
|
||||
DefKind::Struct => Self::Struct,
|
||||
DefKind::Union => Self::Union,
|
||||
DefKind::Trait => Self::Trait,
|
||||
DefKind::TyAlias => Self::Typedef,
|
||||
DefKind::TraitAlias => Self::TraitAlias,
|
||||
DefKind::Macro(kind) => match kind {
|
||||
MacroKind::Bang => ItemType::Macro,
|
||||
MacroKind::Attr => ItemType::ProcAttribute,
|
||||
MacroKind::Derive => ItemType::ProcDerive,
|
||||
},
|
||||
DefKind::ForeignTy
|
||||
| DefKind::Variant
|
||||
| DefKind::AssocTy
|
||||
| DefKind::TyParam
|
||||
| DefKind::ConstParam
|
||||
| DefKind::Ctor(..)
|
||||
| DefKind::AssocFn
|
||||
| DefKind::AssocConst
|
||||
| DefKind::ExternCrate
|
||||
| DefKind::Use
|
||||
| DefKind::ForeignMod
|
||||
| DefKind::AnonConst
|
||||
| DefKind::OpaqueTy
|
||||
| DefKind::Field
|
||||
| DefKind::LifetimeParam
|
||||
| DefKind::GlobalAsm
|
||||
| DefKind::Impl
|
||||
| DefKind::Closure
|
||||
| DefKind::Generator => Self::ForeignType,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use rustc_span::symbol::{sym, Symbol};
|
||||
use serde::ser::{Serialize, SerializeStruct, Serializer};
|
||||
|
||||
use crate::clean::types::{
|
||||
FnDecl, FnRetTy, GenericBound, Generics, GetDefId, Type, TypeKind, WherePredicate,
|
||||
FnDecl, FnRetTy, GenericBound, Generics, GetDefId, Type, WherePredicate,
|
||||
};
|
||||
use crate::clean::{self, AttributesExt};
|
||||
use crate::formats::cache::Cache;
|
||||
@ -316,15 +316,15 @@ crate fn get_real_types<'tcx>(
|
||||
arg: &Type,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
recurse: i32,
|
||||
res: &mut FxHashSet<(Type, TypeKind)>,
|
||||
res: &mut FxHashSet<(Type, ItemType)>,
|
||||
) -> usize {
|
||||
fn insert(res: &mut FxHashSet<(Type, TypeKind)>, tcx: TyCtxt<'_>, ty: Type) -> usize {
|
||||
fn insert(res: &mut FxHashSet<(Type, ItemType)>, tcx: TyCtxt<'_>, ty: Type) -> usize {
|
||||
if let Some(kind) = ty.def_id().map(|did| tcx.def_kind(did).into()) {
|
||||
res.insert((ty, kind));
|
||||
1
|
||||
} else if ty.is_primitive() {
|
||||
// This is a primitive, let's store it as such.
|
||||
res.insert((ty, TypeKind::Primitive));
|
||||
res.insert((ty, ItemType::Primitive));
|
||||
1
|
||||
} else {
|
||||
0
|
||||
@ -394,7 +394,7 @@ crate fn get_all_types<'tcx>(
|
||||
generics: &Generics,
|
||||
decl: &FnDecl,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
) -> (Vec<(Type, TypeKind)>, Vec<(Type, TypeKind)>) {
|
||||
) -> (Vec<(Type, ItemType)>, Vec<(Type, ItemType)>) {
|
||||
let mut all_types = FxHashSet::default();
|
||||
for arg in decl.inputs.values.iter() {
|
||||
if arg.type_.is_self_type() {
|
||||
|
@ -54,7 +54,7 @@ use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use serde::ser::SerializeSeq;
|
||||
use serde::{Serialize, Serializer};
|
||||
|
||||
use crate::clean::{self, GetDefId, RenderedLink, SelfTy, TypeKind};
|
||||
use crate::clean::{self, GetDefId, RenderedLink, SelfTy};
|
||||
use crate::docfs::PathError;
|
||||
use crate::error::Error;
|
||||
use crate::formats::cache::Cache;
|
||||
@ -182,11 +182,11 @@ impl Serialize for IndexItemFunctionType {
|
||||
#[derive(Debug)]
|
||||
crate struct TypeWithKind {
|
||||
ty: RenderType,
|
||||
kind: TypeKind,
|
||||
kind: ItemType,
|
||||
}
|
||||
|
||||
impl From<(RenderType, TypeKind)> for TypeWithKind {
|
||||
fn from(x: (RenderType, TypeKind)) -> TypeWithKind {
|
||||
impl From<(RenderType, ItemType)> for TypeWithKind {
|
||||
fn from(x: (RenderType, ItemType)) -> TypeWithKind {
|
||||
TypeWithKind { ty: x.0, kind: x.1 }
|
||||
}
|
||||
}
|
||||
@ -196,7 +196,7 @@ impl Serialize for TypeWithKind {
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
(&self.ty.name, ItemType::from(self.kind)).serialize(serializer)
|
||||
(&self.ty.name, self.kind).serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user