-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
rustdoc doesn't render non-trivial built-in Sized impls (and calls Sized impls auto trait impls) #149467
Copy link
Copy link
Open
Labels
A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsC-bugCategory: This is a bug.Category: This is a bug.S-blockedStatus: Blocked on something else such as an RFC or other implementation work.Status: Blocked on something else such as an RFC or other implementation work.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsC-bugCategory: This is a bug.Category: This is a bug.S-blockedStatus: Blocked on something else such as an RFC or other implementation work.Status: Blocked on something else such as an RFC or other implementation work.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Since #78181, we leverage our auto trait impl synthesizer to render negative impls of
Sizedfor types that don't implementSized. Contrary to actual auto traits, we intentionally never render any positiveSizedimpls, only negative ones or none at all. Most ADTs are unconditionallySized, so it makes sense to omit these to avoid unnecessary visual clutter and to reduce page size.Quick aside:
Sizedis not an auto trait, so ideally syntheticSizedimpls wouldn't appear under a section titled Auto Trait Implementations but instead under one titled Built-in Trait Implementations (modulo bikeshedding).I take issue with the fact that we don't render "non-trivial" built-in
Sizedimpls. Why bother? Well,Sizedis fundamental (so making a typeSizedis a breaking change) and under which conditions the last field of a struct isSizedis technically part of the public API and should thus be accessible in rustdoc-generated docs.If rustdoc@main doesn't render a
Sizedimpl for certain generic types, they are either unconditionally or conditionally sized but sadly no further information is provided. Consider these examples:struct Type<X: ?Sized>Type<T>Sizedfor all typesT? holds if body is e.g.,(Box<T>)Type<T>SizediffTisSizedfor all typesT? holds if body is e.g.,(T)struct Type<X: Deref>Sizediff<T as Deref>::TargetisSizedfor all typesT?struct Type<X: ?Sized, Y: ?Sized>Potential CON: Could increase the artifact size for certain (a lot of?) crates. Rn it's unclear to me how bad the fallout would be. Needs to be investigated.