Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit c90a5b2

Browse files
committed
rustdoc-json: Rename typedef to type alias
1 parent 062d247 commit c90a5b2

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

src/librustdoc/html/render/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ struct AllTypes {
235235
traits: FxHashSet<ItemEntry>,
236236
macros: FxHashSet<ItemEntry>,
237237
functions: FxHashSet<ItemEntry>,
238-
typedefs: FxHashSet<ItemEntry>,
238+
type_aliases: FxHashSet<ItemEntry>,
239239
opaque_tys: FxHashSet<ItemEntry>,
240240
statics: FxHashSet<ItemEntry>,
241241
constants: FxHashSet<ItemEntry>,
@@ -255,7 +255,7 @@ impl AllTypes {
255255
traits: new_set(100),
256256
macros: new_set(100),
257257
functions: new_set(100),
258-
typedefs: new_set(100),
258+
type_aliases: new_set(100),
259259
opaque_tys: new_set(100),
260260
statics: new_set(100),
261261
constants: new_set(100),
@@ -279,7 +279,7 @@ impl AllTypes {
279279
ItemType::Trait => self.traits.insert(ItemEntry::new(new_url, name)),
280280
ItemType::Macro => self.macros.insert(ItemEntry::new(new_url, name)),
281281
ItemType::Function => self.functions.insert(ItemEntry::new(new_url, name)),
282-
ItemType::TypeAlias => self.typedefs.insert(ItemEntry::new(new_url, name)),
282+
ItemType::TypeAlias => self.type_aliases.insert(ItemEntry::new(new_url, name)),
283283
ItemType::OpaqueTy => self.opaque_tys.insert(ItemEntry::new(new_url, name)),
284284
ItemType::Static => self.statics.insert(ItemEntry::new(new_url, name)),
285285
ItemType::Constant => self.constants.insert(ItemEntry::new(new_url, name)),
@@ -317,7 +317,7 @@ impl AllTypes {
317317
if !self.functions.is_empty() {
318318
sections.insert(ItemSection::Functions);
319319
}
320-
if !self.typedefs.is_empty() {
320+
if !self.type_aliases.is_empty() {
321321
sections.insert(ItemSection::TypeAliases);
322322
}
323323
if !self.opaque_tys.is_empty() {
@@ -374,7 +374,7 @@ impl AllTypes {
374374
print_entries(f, &self.attribute_macros, ItemSection::AttributeMacros);
375375
print_entries(f, &self.derive_macros, ItemSection::DeriveMacros);
376376
print_entries(f, &self.functions, ItemSection::Functions);
377-
print_entries(f, &self.typedefs, ItemSection::TypeAliases);
377+
print_entries(f, &self.type_aliases, ItemSection::TypeAliases);
378378
print_entries(f, &self.trait_aliases, ItemSection::TraitAliases);
379379
print_entries(f, &self.opaque_tys, ItemSection::OpaqueTypes);
380380
print_entries(f, &self.statics, ItemSection::Statics);

src/librustdoc/json/conversions.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
311311
StaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)),
312312
ForeignStaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)),
313313
ForeignTypeItem => ItemEnum::ForeignType,
314-
TypeAliasItem(t) => ItemEnum::Typedef(t.into_tcx(tcx)),
314+
TypeAliasItem(t) => ItemEnum::TypeAlias(t.into_tcx(tcx)),
315315
OpaqueTyItem(t) => ItemEnum::OpaqueTy(t.into_tcx(tcx)),
316316
ConstantItem(c) => ItemEnum::Constant(c.into_tcx(tcx)),
317317
MacroItem(m) => ItemEnum::Macro(m.source),
@@ -787,10 +787,10 @@ pub(crate) fn from_macro_kind(kind: rustc_span::hygiene::MacroKind) -> MacroKind
787787
}
788788
}
789789

790-
impl FromWithTcx<Box<clean::TypeAlias>> for Typedef {
791-
fn from_tcx(typedef: Box<clean::TypeAlias>, tcx: TyCtxt<'_>) -> Self {
792-
let clean::TypeAlias { type_, generics, item_type: _ } = *typedef;
793-
Typedef { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) }
790+
impl FromWithTcx<Box<clean::TypeAlias>> for TypeAlias {
791+
fn from_tcx(type_alias: Box<clean::TypeAlias>, tcx: TyCtxt<'_>) -> Self {
792+
let clean::TypeAlias { type_, generics, item_type: _ } = *type_alias;
793+
TypeAlias { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) }
794794
}
795795
}
796796

@@ -827,7 +827,7 @@ impl FromWithTcx<ItemType> for ItemKind {
827827
Union => ItemKind::Union,
828828
Enum => ItemKind::Enum,
829829
Function | TyMethod | Method => ItemKind::Function,
830-
TypeAlias => ItemKind::Typedef,
830+
TypeAlias => ItemKind::TypeAlias,
831831
OpaqueTy => ItemKind::OpaqueTy,
832832
Static => ItemKind::Static,
833833
Constant => ItemKind::Constant,

src/librustdoc/json/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
184184
| types::ItemEnum::Variant(_)
185185
| types::ItemEnum::TraitAlias(_)
186186
| types::ItemEnum::Impl(_)
187-
| types::ItemEnum::Typedef(_)
187+
| types::ItemEnum::TypeAlias(_)
188188
| types::ItemEnum::OpaqueTy(_)
189189
| types::ItemEnum::Constant(_)
190190
| types::ItemEnum::Static(_)

src/rustdoc-json-types/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
88
use std::path::PathBuf;
99

1010
/// rustdoc format-version.
11-
pub const FORMAT_VERSION: u32 = 26;
11+
pub const FORMAT_VERSION: u32 = 27;
1212

1313
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
1414
/// about the language items in the local crate, as well as info about external items to allow
@@ -203,7 +203,7 @@ pub enum ItemKind {
203203
Enum,
204204
Variant,
205205
Function,
206-
Typedef,
206+
TypeAlias,
207207
OpaqueTy,
208208
Constant,
209209
Trait,
@@ -242,7 +242,7 @@ pub enum ItemEnum {
242242
TraitAlias(TraitAlias),
243243
Impl(Impl),
244244

245-
Typedef(Typedef),
245+
TypeAlias(TypeAlias),
246246
OpaqueTy(OpaqueTy),
247247
Constant(Constant),
248248

@@ -696,7 +696,7 @@ pub enum MacroKind {
696696
}
697697

698698
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
699-
pub struct Typedef {
699+
pub struct TypeAlias {
700700
#[serde(rename = "type")]
701701
pub type_: Type,
702702
pub generics: Generics,

src/tools/jsondoclint/src/item_kind.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl Kind {
148148
ItemEnum::Trait(_) => Trait,
149149
ItemEnum::TraitAlias(_) => TraitAlias,
150150
ItemEnum::Impl(_) => Impl,
151-
ItemEnum::Typedef(_) => Typedef,
151+
ItemEnum::TypeAlias(_) => Typedef,
152152
ItemEnum::OpaqueTy(_) => OpaqueTy,
153153
ItemEnum::Constant(_) => Constant,
154154
ItemEnum::Static(_) => Static,
@@ -186,7 +186,7 @@ impl Kind {
186186
ItemKind::StructField => StructField,
187187
ItemKind::Trait => Trait,
188188
ItemKind::TraitAlias => TraitAlias,
189-
ItemKind::Typedef => Typedef,
189+
ItemKind::TypeAlias => Typedef,
190190
ItemKind::Union => Union,
191191
ItemKind::Variant => Variant,
192192
}

src/tools/jsondoclint/src/validator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustdoc_json_types::{
55
Constant, Crate, DynTrait, Enum, FnDecl, Function, FunctionPointer, GenericArg, GenericArgs,
66
GenericBound, GenericParamDef, Generics, Id, Impl, Import, ItemEnum, ItemSummary, Module,
77
OpaqueTy, Path, Primitive, ProcMacro, Static, Struct, StructKind, Term, Trait, TraitAlias,
8-
Type, TypeBinding, TypeBindingKind, Typedef, Union, Variant, VariantKind, WherePredicate,
8+
Type, TypeAlias, TypeBinding, TypeBindingKind, Union, Variant, VariantKind, WherePredicate,
99
};
1010
use serde_json::Value;
1111

@@ -99,7 +99,7 @@ impl<'a> Validator<'a> {
9999
ItemEnum::Trait(x) => self.check_trait(x, id),
100100
ItemEnum::TraitAlias(x) => self.check_trait_alias(x),
101101
ItemEnum::Impl(x) => self.check_impl(x, id),
102-
ItemEnum::Typedef(x) => self.check_typedef(x),
102+
ItemEnum::TypeAlias(x) => self.check_typedef(x),
103103
ItemEnum::OpaqueTy(x) => self.check_opaque_ty(x),
104104
ItemEnum::Constant(x) => self.check_constant(x),
105105
ItemEnum::Static(x) => self.check_static(x),
@@ -221,7 +221,7 @@ impl<'a> Validator<'a> {
221221
}
222222
}
223223

224-
fn check_typedef(&mut self, x: &'a Typedef) {
224+
fn check_typedef(&mut self, x: &'a TypeAlias) {
225225
self.check_generics(&x.generics);
226226
self.check_type(&x.type_);
227227
}

0 commit comments

Comments
 (0)