-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add new doc(attribute = "...")
attribute
#142472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
bc61314
6ca69e1
477cdc9
10c8903
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,6 +211,23 @@ To do so, the `#[doc(keyword = "...")]` attribute is used. Example: | |
mod empty_mod {} | ||
``` | ||
|
||
### Document builtin attributes | ||
|
||
This is for Rust compiler internal use only. | ||
|
||
Rust builtin attributes are documented in the standard library (look for `repr` for example). | ||
|
||
To do so, the `#[doc(attribute = "...")]` attribute is used. Example: | ||
|
||
```rust | ||
#![feature(rustdoc_internals)] | ||
#![allow(internal_features)] | ||
|
||
/// Some documentation about the attribute. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we make sure this stays in sync with the compiler's view of attributes? Is the plan to keep this manual, or could we somehow generate this from for example rustc_attr_data_structures There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just like keywords: we can only check that the attribute is used on an existing one. If new ones are added, there is no check for that. We could add a tidy check for it though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that'd be nice |
||
#[doc(attribute = "repr")] | ||
mod empty_mod {} | ||
``` | ||
|
||
### Use the Rust logo as the crate logo | ||
|
||
This is for official Rust project use only. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sigh, I'll put the doc attribute high up on my todo list to get a proper parser... (this is fine for now)