diff options
| author | Boxy <supbscripter@gmail.com> | 2024-06-04 07:01:40 +0100 |
|---|---|---|
| committer | Boxy <supbscripter@gmail.com> | 2024-06-05 22:25:42 +0100 |
| commit | 432c11feb6ddfffe6d1d111624ac86386b2fe751 (patch) | |
| tree | 545ef0e8b37ceacbc127fb81fbb17eee1407a8db /src/librustdoc/clean/inline.rs | |
| parent | 60a5bebbe591f228bf83f3c48f5f60fe87dedaad (diff) | |
| download | rust-432c11feb6ddfffe6d1d111624ac86386b2fe751.tar.gz rust-432c11feb6ddfffe6d1d111624ac86386b2fe751.zip | |
Remove `Type` from rustdoc `Const`
Diffstat (limited to 'src/librustdoc/clean/inline.rs')
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index c7366ce1a68..0024e246ef0 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -130,7 +130,10 @@ pub(crate) fn try_inline( } Res::Def(DefKind::Const, did) => { record_extern_fqn(cx, did, ItemType::Constant); - cx.with_param_env(did, |cx| clean::ConstantItem(build_const(cx, did))) + cx.with_param_env(did, |cx| { + let (generics, ty, ct) = build_const_item(cx, did); + clean::ConstantItem(generics, Box::new(ty), ct) + }) } Res::Def(DefKind::Macro(kind), did) => { let is_doc_hidden = cx.tcx.is_doc_hidden(did) @@ -717,21 +720,20 @@ pub(crate) fn print_inlined_const(tcx: TyCtxt<'_>, did: DefId) -> String { } } -fn build_const(cx: &mut DocContext<'_>, def_id: DefId) -> clean::Constant { +fn build_const_item( + cx: &mut DocContext<'_>, + def_id: DefId, +) -> (clean::Generics, clean::Type, clean::Constant) { let mut generics = clean_ty_generics(cx, cx.tcx.generics_of(def_id), cx.tcx.explicit_predicates_of(def_id)); clean::simplify::move_bounds_to_generic_parameters(&mut generics); - - clean::Constant { - type_: Box::new(clean_middle_ty( - ty::Binder::dummy(cx.tcx.type_of(def_id).instantiate_identity()), - cx, - Some(def_id), - None, - )), - generics, - kind: clean::ConstantKind::Extern { def_id }, - } + let ty = clean_middle_ty( + ty::Binder::dummy(cx.tcx.type_of(def_id).instantiate_identity()), + cx, + None, + None, + ); + (generics, ty, clean::Constant { kind: clean::ConstantKind::Extern { def_id } }) } fn build_static(cx: &mut DocContext<'_>, did: DefId, mutable: bool) -> clean::Static { |
