rustdoc: use anonymous constant for primitives/keywords/attribute docs - #160288
rustdoc: use anonymous constant for primitives/keywords/attribute docs#160288mejrs wants to merge 1 commit into
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in GUI tests. These commits modify Please ensure that if you've changed the output:
cc @obi1kenobi |
This comment has been minimized.
This comment has been minimized.
Should be |
Hmm, I did not pass |
|
Without |
6b28e2e to
c8a3129
Compare
Right, but I changed std to use anon consts so that should have errored . Maybe I don't quite understand how rustdoc interacts with bootstrapping. Or In just missed it before, we don't have that many private root modules in std actually. Regardless it works :) |
This comment has been minimized.
This comment has been minimized.
c8a3129 to
82a5915
Compare
This comment has been minimized.
This comment has been minimized.
82a5915 to
e94ce09
Compare
This comment has been minimized.
This comment has been minimized.
e94ce09 to
a72e4e8
Compare
This comment has been minimized.
This comment has been minimized.
a72e4e8 to
51866cf
Compare
This comment has been minimized.
This comment has been minimized.
| if let Some(ItemKind::Const(ident, _gen, _ty, _rhs)) = item_kind | ||
| && ident.name == kw::Underscore | ||
| { | ||
| } else { |
There was a problem hiding this comment.
Let's use the power of matches! =D
| if let Some(ItemKind::Const(ident, _gen, _ty, _rhs)) = item_kind | |
| && ident.name == kw::Underscore | |
| { | |
| } else { | |
| if !matches!(item_kind, ItemKind::(ident, ..) if ident.name == kw::Underscore) { |
There was a problem hiding this comment.
I think the old code is much clearer actually. Having a guard in the matches and then negating it is way more confusing IMO.
|
Please add a regression test documenting private items when these attributes (on consts) are used to ensure the const are not visible (you did it for json already, so that's a good start :3). |
51866cf to
8b18212
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
8b18212 to
18a8ce6
Compare
|
(Force pushed to remove some useless checks for "this fake module doesn't show up in html")
Aren't In attribute parsing, we check that doc(attr/kw) can only be on constants named
But that's to test that these prim/kw/attr fake items themselves never end up in rustdoc-json, it was never only about the modules. |
For context: #t-rustdoc > hiding fake_item modules. @ 💬
r? @GuillaumeGomez
I've rendered the standard library docs and prims/kws/attrs all show up as normal.
However I could not figure out how to run some of the tests, so this may be a bit of CI-debugging for me :(