Skip to content

Bitflags reverses order of multiline doc comments #344

@davidv1992

Description

@davidv1992

When compiling code like

bitflags! {
    pub struct AdjustFlags: u32 {
        /// Add buf.time to the current time. If buf.status includes the ADJ_NANO flag, then buf.time.tv_usec is interpreted as a nanosecond value;
        /// otherwise it is interpreted as microseconds.
        ///
        /// The value of buf.time is the sum of its two fields, but the field buf.time.tv_usec must always be nonnegative.
        /// The following example shows how to normalize a timeval with nanosecond resolution.
        ///
        /// ```C
        /// while (buf.time.tv_usec < 0) {
        ///     buf.time.tv_sec  -= 1;
        ///     buf.time.tv_usec += 1000000000;
        /// }
        /// ```
        const SETOFFSET = libc::ADJ_SETOFFSET;
    }
}

The doc-comments order is reversed on compile, causing issues with generated docs and the doctest.

This bug only occurs on bitflags 2.2.0 and not on earlier versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions