-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
rustdoc: Use own logic to print #[repr(..)]
attributes in JSON output.
#138018
base: master
Are you sure you want to change the base?
Conversation
98cba84
to
67e9486
Compare
rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi Some changes occurred in tests/rustdoc-json |
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.
This looks really good! Thanks for the very thorough tests, it's appreciated.
Could you update the docs on Item::attribute
? After that and rebasing to bump the format version again, this should be good to merge.
// Rustdoc JSON *only* includes `#[repr(transparent)]` | ||
// if the transparency is public API: | ||
// - if a non-1-ZST field exists, it has to be public | ||
// - otherwise, all fields are 1-ZST and at least one of them is public |
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.
NIT: It'd be nice to cite where these rules come from: https://doc.rust-lang.org/nomicon/other-reprs.html#reprtransparent
@@ -30,7 +30,7 @@ pub type FxHashMap<K, V> = HashMap<K, V>; // re-export for use in src/librustdoc | |||
/// This integer is incremented with every breaking change to the API, | |||
/// and is returned along with the JSON blob as [`Crate::format_version`]. | |||
/// Consuming code should assert that this value matches the format version(s) that it supports. | |||
pub const FORMAT_VERSION: u32 = 40; | |||
pub const FORMAT_VERSION: u32 = 41; |
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.
Another PR currently in the queue is making this change: #138109 (comment)
Once that lands, you should rebase ontop of that, and then bump again.
Happy to do it, though I'm currently traveling for another week so it won't
be soon. I'd be thrilled to have this merged ASAP though, so if you'd like
to make the necessary changes and then merge, go for it. I don't care whose
name is on the commit :)
…On Tue, Mar 11, 2025, 4:55 PM Alona Enraght-Moony ***@***.***> wrote:
***@***.**** commented on this pull request.
This looks really good! Thanks for the very thorough tests, it's
appreciated.
Could you update the docs on Item::attribute? After that and rebasing to
bump the format version again, this should be good to merge.
------------------------------
In tests/rustdoc-json/attrs/repr_transparent.rs
<#138018 (comment)>:
> @@ -0,0 +1,35 @@
+#![no_std]
+
+// Rustdoc JSON *only* includes `#[repr(transparent)]`
+// if the transparency is public API:
+// - if a non-1-ZST field exists, it has to be public
+// - otherwise, all fields are 1-ZST and at least one of them is public
NIT: It'd be nice to cite where these rules come from:
https://doc.rust-lang.org/nomicon/other-reprs.html#reprtransparent
------------------------------
In src/rustdoc-json-types/lib.rs
<#138018 (comment)>:
> @@ -30,7 +30,7 @@ pub type FxHashMap<K, V> = HashMap<K, V>; // re-export for use in src/librustdoc
/// This integer is incremented with every breaking change to the API,
/// and is returned along with the JSON blob as [`Crate::format_version`].
/// Consuming code should assert that this value matches the format version(s) that it supports.
-pub const FORMAT_VERSION: u32 = 40;
+pub const FORMAT_VERSION: u32 = 41;
Another PR currently in the queue is making this change: #138109 (comment)
<#138109 (comment)>
Once that lands, you should rebase ontop of that, and then bump again.
—
Reply to this email directly, view it on GitHub
<#138018 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR5MSQMCSMYZWTJIBFBHC32T5SVVAVCNFSM6AAAAABYKTDHVCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMNZWGE4TONJSG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Switch away from
Debug
-like representation of#[repr(..)]
attributes, and start using rustdoc's own logic for pretty-printing#[repr(..)]
in rustdoc JSON.Part of addressing #137645 but not a complete solution for it.
r? @aDotInTheVoid