Rustdoc: maybe don't display #[repr(C)] sometimes #66401
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
C-bug
Category: This is a bug.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
If a struct has some public fields and some non-public fields,
// some fields omitted
is displayed at the end of the declaration shown by rustdoc. Rustdoc also shows attributes on the declaration, such as#[repr(C)]
.This is actively misleading for
#[repr(C)]
types. If a private type is before any public types, then the struct as displayed suggests that the public fields are at the prefix of the struct, and thus have defined offsets smaller than where they actually are.Example:
There are two obvious potential solutions:
// some fields omitted
in the correct place(s) among public fields for#[repr(C)]
types, or#[repr(C)]
for types with some fields omitted.The text was updated successfully, but these errors were encountered: