diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /src/librustdoc/json | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/librustdoc/json')
-rw-r--r-- | src/librustdoc/json/conversions.rs | 32 | ||||
-rw-r--r-- | src/librustdoc/json/mod.rs | 2 |
2 files changed, 18 insertions, 16 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 8673138f6..05f3e66b0 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -8,6 +8,7 @@ use std::fmt; use rustc_ast::ast; use rustc_hir::{def::CtorKind, def::DefKind, def_id::DefId}; +use rustc_metadata::rendered_const; use rustc_middle::ty::{self, TyCtxt}; use rustc_span::symbol::sym; use rustc_span::{Pos, Symbol}; @@ -15,7 +16,6 @@ use rustc_target::spec::abi::Abi as RustcAbi; use rustdoc_json_types::*; -use crate::clean::utils::print_const_expr; use crate::clean::{self, ItemId}; use crate::formats::item_type::ItemType; use crate::json::JsonRenderer; @@ -311,7 +311,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum { StaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)), ForeignStaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)), ForeignTypeItem => ItemEnum::ForeignType, - TypedefItem(t) => ItemEnum::Typedef(t.into_tcx(tcx)), + TypeAliasItem(t) => ItemEnum::TypeAlias(t.into_tcx(tcx)), OpaqueTyItem(t) => ItemEnum::OpaqueTy(t.into_tcx(tcx)), ConstantItem(c) => ItemEnum::Constant(c.into_tcx(tcx)), MacroItem(m) => ItemEnum::Macro(m.source), @@ -453,7 +453,7 @@ impl FromWithTcx<clean::GenericParamDefKind> for GenericParamDefKind { default: default.map(|x| (*x).into_tcx(tcx)), synthetic, }, - Const { ty, default } => GenericParamDefKind::Const { + Const { ty, default, is_host_effect: _ } => GenericParamDefKind::Const { type_: (*ty).into_tcx(tcx), default: default.map(|x| *x), }, @@ -491,12 +491,14 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate { default: default.map(|ty| (*ty).into_tcx(tcx)), synthetic, }, - clean::GenericParamDefKind::Const { ty, default } => { - GenericParamDefKind::Const { - type_: (*ty).into_tcx(tcx), - default: default.map(|d| *d), - } - } + clean::GenericParamDefKind::Const { + ty, + default, + is_host_effect: _, + } => GenericParamDefKind::Const { + type_: (*ty).into_tcx(tcx), + default: default.map(|d| *d), + }, }; GenericParamDef { name, kind } }) @@ -787,10 +789,10 @@ pub(crate) fn from_macro_kind(kind: rustc_span::hygiene::MacroKind) -> MacroKind } } -impl FromWithTcx<Box<clean::Typedef>> for Typedef { - fn from_tcx(typedef: Box<clean::Typedef>, tcx: TyCtxt<'_>) -> Self { - let clean::Typedef { type_, generics, item_type: _ } = *typedef; - Typedef { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) } +impl FromWithTcx<Box<clean::TypeAlias>> for TypeAlias { + fn from_tcx(type_alias: Box<clean::TypeAlias>, tcx: TyCtxt<'_>) -> Self { + let clean::TypeAlias { type_, generics, item_type: _, inner_type: _ } = *type_alias; + TypeAlias { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) } } } @@ -805,7 +807,7 @@ impl FromWithTcx<clean::Static> for Static { Static { type_: stat.type_.into_tcx(tcx), mutable: stat.mutability == ast::Mutability::Mut, - expr: stat.expr.map(|e| print_const_expr(tcx, e)).unwrap_or_default(), + expr: stat.expr.map(|e| rendered_const(tcx, e)).unwrap_or_default(), } } } @@ -827,7 +829,7 @@ impl FromWithTcx<ItemType> for ItemKind { Union => ItemKind::Union, Enum => ItemKind::Enum, Function | TyMethod | Method => ItemKind::Function, - Typedef => ItemKind::Typedef, + TypeAlias => ItemKind::TypeAlias, OpaqueTy => ItemKind::OpaqueTy, Static => ItemKind::Static, Constant => ItemKind::Constant, diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index cd791ce00..27e8a27ba 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -184,7 +184,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { | types::ItemEnum::Variant(_) | types::ItemEnum::TraitAlias(_) | types::ItemEnum::Impl(_) - | types::ItemEnum::Typedef(_) + | types::ItemEnum::TypeAlias(_) | types::ItemEnum::OpaqueTy(_) | types::ItemEnum::Constant(_) | types::ItemEnum::Static(_) |