-
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?
Add new doc(attribute = "...")
attribute
#142472
Conversation
r? @notriddle rustbot has assigned @notriddle. Use |
rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi Some changes occurred in compiler/rustc_passes/src/check_attr.rs Some changes occurred in HTML/CSS/JS. |
This comment has been minimized.
This comment has been minimized.
1ab0dc7
to
e2fd7f7
Compare
This comment has been minimized.
This comment has been minimized.
cc: @ehuss you might want to make sure the reference documents this too? Unsure whether this is interesting to you but just to be safe |
if is_keyword { "keyword" } else { "attribute " } | ||
} | ||
|
||
let value = match meta.value_str() { |
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)
#![feature(rustdoc_internals)] | ||
#![allow(internal_features)] | ||
|
||
/// Some documentation about the attribute. |
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.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
that'd be nice
e2fd7f7
to
a0fb9d0
Compare
These commits modify Please ensure that if you've changed the output:
|
This comment has been minimized.
This comment has been minimized.
a0fb9d0
to
14b0aa7
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #142335) made this pull request unmergeable. Please resolve the merge conflicts. |
4a47724
to
094ed61
Compare
This comment has been minimized.
This comment has been minimized.
…_primitive`, `is_keyword` and `is_attribute` methods
094ed61
to
10c8903
Compare
Ok, hopefully this time I didn't forget yet another different check I didn't use in years. T_T |
Yeay! \o/ |
Fixes #141123.
The implementation and purpose of this new
#[doc(attribute = "...")]
attribute is very close to#[doc(keyword = "...")]
. Which means that luckily for us, most of the code needed was already in place and @Noratrieb nicely wrote a first draft that helped me implement this new attribute very fast.Now with all this said, there is one thing I didn't do yet: adding a
rustdoc-js-std
test. I added GUI tests with search results for attributes so should be fine but I still plan on adding one for it once documentation for builtin attributes will be written into the core/std libs.You can test it here.
cc @Noratrieb @Veykril