rustdoc: split out trait implementer's notes from method docs #139855
Labels
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
needs-rfc
This change is large or controversial enough that it should have an RFC accepted before doing it.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
On mastodon, Simon Tatham alerted us to the problem that rustdoc will show the method docs from a trait on an implementation of that trait, which may contain parts geared towards implementers, not users of the trait.
There is currently no way to distinguish those in a way that would let rustdoc show the implementer's notes on the trait docs but not on trait implementations.
Since doc comments get lowered to attributes, the lowest common. denominator would be an attribute like
#[traitdoc = "..."]
that works like#[doc = "..."]
but is included by rustdoc only on the doc pages for the trait itself, not on the implementation docs.In addition, there could be a doc comment variant (perhaps
///^
and//!^
respectively) that lowers to#[traitdoc]
attributes. This might need an edition though. Alternatively, rust could pick up on an## Implementer's notes
section header instead and emit#[traitdoc]
instead of#[doc]
attributes for that whole section.Example
As an example, the PartialEq::ne method could be documented as follows (other methods and attributes have been removed for brevity):
Open questions:
impldoc
,trait_doc
,trait-doc
,impl-doc
.cc @GuillaumeGomez
The text was updated successfully, but these errors were encountered: