Skip to content

Rustdoc should support inline or same-line doc comments for enums #920

@felixc

Description

@felixc

Currently if you use the common documentation pattern:

enum Foo {
    Bar,  /// Bar is a value
    Baz,  /// This foo is a baz
    Quux
}

rustdoc will apply the documentation strings to the wrong values (specifically, to the next value after the intended one). Fortunately an error is generated if the last entry in the enum is documented (Quux in this example), but it's also fairly common for the last value to be something like Unknown or Invalid that may not be documented.

It would be nice if this same-line documentation style were supported, as it makes a lot of sense for simple enum values that only have short docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.T-rustdocRelevant to rustdoc team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions