Skip to content

rustdoc: When rendering const values, show ADTs in addition to primitives. #87038

Open
@Aaron1011

Description

@Aaron1011

When rustdoc renders a const item, it will print the actual (evaluated) value for primitives. For example, https://doc.rust-lang.org/std/i32/constant.MAX.html:

const_val

It would be useful to do the same for ADT values (structs, enums, and unions). For example:

struct Foo { val: bool }
const fn make_foo() { Foo { val: true } }`
const FOO: Foo = make_foo()

would print something like:

Foo {
    val: true
}

on the page for FOO.

Metadata

Metadata

Assignees

Labels

A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions