rust/tests/rustdoc/auxiliary
bors be581d9f82 Auto merge of #116142 - GuillaumeGomez:enum-variant-display, r=fmease
[rustdoc] Show enum discrimant if it is a C-like variant

Fixes https://github.com/rust-lang/rust/issues/101337.

We currently display values for associated constant items in traits:

![image](https://github.com/rust-lang/rust/assets/3050060/03e566ec-c670-47b4-8ca2-b982baa7a0f4)

And we also display constant values like [here](file:///home/imperio/rust/rust/build/x86_64-unknown-linux-gnu/doc/std/f32/consts/constant.E.html).

I think that for coherency, we should display values of C-like enum variants.

With this change, it looks like this:

![image](https://github.com/rust-lang/rust/assets/3050060/b53fbbe0-bdb1-4289-8537-f2dd4988e9ac)

As for the display of the constant value itself, I used what we already have to keep coherency.

We display the C-like variants value in the following scenario:
 1. It is a C-like variant with a value set => all the time
 2. It is a C-like variant without a value set: All other variants are C-like variants and at least one them has its value set.

Here is the result in code:

```rust
// Ax and Bx value will be displayed.
enum A {
    Ax = 12,
    Bx,
}

// Ax and Bx value will not be displayed
enum B {
    Ax,
    Bx,
}

// Bx value will not be displayed
enum C {
    Ax(u32),
    Bx,
}

// Bx value will not be displayed, Cx value will be displayed.
#[repr(u32)]
enum D {
    Ax(u32),
    Bx,
    Cx = 12,
}
```

r? `@notriddle`
2023-10-09 13:18:47 +00:00
..
alias-reexport2.rs Add rustdoc tests for lazy_type_alias 2023-06-21 13:45:00 +02:00
alias-reexport.rs Add rustdoc tests for lazy_type_alias 2023-06-21 13:45:00 +02:00
all-item-types.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
async-trait-dep.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
auto-traits.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
cross_crate_generic_typedef.rs rustdoc: handle typedef inner type when doing cross-crate inlining 2023-08-26 00:15:02 +02:00
cross-crate-hidden-assoc-trait-items.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
cross-crate-hidden-impl-parameter.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
elided-lifetime.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
empty.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
enum-primitive.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
enum-variant.rs Add cross-crate C-like variant test 2023-10-07 14:37:47 +02:00
extern-impl-trait.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
extern-links.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
external-cross-doc.md Move /src/test to /tests 2023-01-11 09:32:08 +00:00
external-cross.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
external-doc.md Move /src/test to /tests 2023-01-11 09:32:08 +00:00
external-macro-src.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
html_root.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
incoherent-impl-types.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
inline-default-methods.rs rustdoc: trait bound formatting 2023-02-04 19:10:04 +01:00
issue-13698.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-15318.rs Update tests for rustc_doc_primitive 2023-03-30 22:56:52 +02:00
issue-17476.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-19190-3.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-20646.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-20727.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-21092.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-22025.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-26606-macro.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-28927-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-28927-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-29584.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-30109-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-34274.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-36031.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-40936.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-46727.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-48414.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-53689.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-57180.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-61592.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-73061.rs Split out a separate feature gate for impl trait in associated types 2023-04-12 16:17:31 +00:00
issue-85454.rs rustdoc: remove unnecessary wrapper div.item-decl from HTML 2023-01-30 11:06:18 -07:00
issue-86620-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-98697-reexport-with-anonymous-lifetime.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-99221-aux.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-99734-aux.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-100204-aux.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-113982-doc_auto_cfg-reexport-foreign.rs Add regression test for #113982 2023-07-24 16:32:06 +02:00
jump-to-def-res-err-handling-aux.rs Fix regression for private in public 2023-07-26 15:29:45 +02:00
macro_pub_in_module.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
masked.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mod-stackoverflow.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
no_html_root.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
normalize-assoc-item.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
primitive-doc.rs Update tests for rustc_doc_primitive 2023-03-30 22:56:52 +02:00
primitive-reexport.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
pub-extern-crate.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
pub-use-extern-macros.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
real_gimli.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
realcore.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
reexp-stripped.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
reexport-check.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
reexport-doc-aux.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
reexports.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc-default-impl.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc-extern-default-method.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc-extern-method.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc-ffi.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc-impl-parts-crosscrate.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
source_code.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
source-code-bar.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
src-links-external.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
trait-alias-mention.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
trait-visibility.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unit-return.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unstable-trait.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
variant-struct.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00