-
Notifications
You must be signed in to change notification settings - Fork 13.5k
WIP: rustdoc-json: Structured attributes #142936
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?
WIP: rustdoc-json: Structured attributes #142936
Conversation
r? @notriddle rustbot has assigned @notriddle. Use |
rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing |
Awesome alona! I'll take a proper look tomorrow <3 |
The job Click to see the possible cause of the failure (guessed by this bot)
|
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.
I like this!
In the near term cargo-semver-checks will have to internally re-stringify the attributes just for code compatibility with prior rustdoc JSON versions. But I look forward to the day when I can rip all that out and enjoy the structured form instead!
/// | ||
/// This doesn't include: | ||
/// - `#[doc = "Doc Comment"]` or `/// Doc comment`. These are in [`Item::docs`] instead. | ||
/// - `#[depricate]`. These are in [`Item::deprecation`] instead. |
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.
/// - `#[depricate]`. These are in [`Item::deprecation`] instead. | |
/// - `#[deprecated]`. These are in [`Item::deprecation`] instead. |
/// constant, and may change without bumping the format version. If you rely | ||
/// on an attibute here, please open an issue about adding a new variant for | ||
/// that attr. | ||
Other(String), |
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.
Would love to break out #[target_feature]
out of Other
as well, since the upcoming cargo-semver-checks version is going to lint it.
/// `#[repr]` | ||
Repr(AttributeRepr), |
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 noting for myself later that we'll need to also represent cases like #[repr(i8)]
on enums, and #[repr(packed(N))]
/ #[repr(align(N))]
.
I saw the // FIXME: This is wildly insufficient
comment already so I know it's already on your radar too. I just wanted a reminder to have another look at this before it merges.
☔ The latest upstream changes (presumably #142929) made this pull request unmergeable. Please resolve the merge conflicts. |
Implements #141358.
This has 2 primary benefits.
FORMAT_VERSION
. CC @jdonszelmann @JonathanBrouwer.(Over time, as the attribute refractor continues, I expect we'll add new things to
rustdoc_json_types::Attribute
. But this can be done separately to the rustc changes).Todo before merging:
#[repr]
.