-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add empty impl blocks if they have documentation #90905
Conversation
This comment has been minimized.
This comment has been minimized.
b1b5389
to
52c86d5
Compare
Every time I run |
Sorry, I likely won't be able to review this for some time. r? @jyn514 |
r? @jsha |
You need to use |
@GuillaumeGomez why did you add a warning note to the documentation? It seems like unnecessary clutter, you can already see it's empty just by looking at it. |
Can you explain this a little more? Why was the existing test framework insufficient? How would #89676 have helped? |
Absolutely, just the force of habit. :)
Because I found that this suggestion made sense. But we can talk more about it if you think it's not useful. (cc @jsha too)
Sure, I needed to count the number of items with this text. Currently we can't count how many items have this text, only how many items have this attribute or how many items with this XPath exist. With #89676, I could have used the |
src/librustdoc/html/render/mod.rs
Outdated
@@ -1634,6 +1634,18 @@ fn render_impl( | |||
} | |||
|
|||
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) { | |||
if render_mode == RenderMode::Normal |
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.
Hmm, shouldn't it be impossible for render_mode
to be RenderMode::Deref
and for trait.is_some()
to be true at the same time, since the recursive deref check only documents inherent impls? Why check both?
I wonder if we could combine those somehow maybe? Or maybe it makes more sense to show traits that the deref target implements 🤔
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.
It's already checked just a few lines above so completely unneeded, you're absolutely right.
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.
As for showing the traits on the Deref types, I think it would just be too much information (or we will need to think how to display them). But that's for another time. 😄 Maybe open an issue so we can talk about it later on?
52c86d5
to
f518d89
Compare
Updated! |
☔ The latest upstream changes (presumably #92099) made this pull request unmergeable. Please resolve the merge conflicts. |
f518d89
to
65e4288
Compare
Earlier, @jyn514 said:
and @GuillaumeGomez replied:
I see a 👍🏻 from @jyn514 on the linked comment so I'm taking that as agreement that the warning for empty impl blocks is a good idea. |
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.
It's not clear to me why a new kind of matcher in the test infrastructure is needed. Can you explain that more?
It's because the current XPath support is very bad. You can't do: |
2eebfbd
to
4511d24
Compare
Updated! |
☔ The latest upstream changes (presumably #97433) made this pull request unmergeable. Please resolve the merge conflicts. |
4511d24
to
eca12e3
Compare
Updated! |
@bors r+ rollup |
Weird, didn't work. @bors=jsha rollup |
And I failed the command of course. ^^' @bors r=jsha rollup |
📌 Commit eca12e3 has been approved by |
…=jsha Add empty impl blocks if they have documentation Fixes rust-lang#90866. The update for the test script is needed to count the number of impl blocks we have with only the struct. To be noted that with rust-lang#89676 merged, it wouldn't be needed (I don't know what is the status of it btw. cc `@Mark-Simulacrum).` It looks like this: ![Screenshot from 2021-11-14 16-51-28](https://user-images.githubusercontent.com/3050060/141689100-e57123c0-bf50-4c42-adf5-d991e169a0e4.png) cc `@jyn514` r? `@camelid`
…=jsha Add empty impl blocks if they have documentation Fixes rust-lang#90866. The update for the test script is needed to count the number of impl blocks we have with only the struct. To be noted that with rust-lang#89676 merged, it wouldn't be needed (I don't know what is the status of it btw. cc ``@Mark-Simulacrum).`` It looks like this: ![Screenshot from 2021-11-14 16-51-28](https://user-images.githubusercontent.com/3050060/141689100-e57123c0-bf50-4c42-adf5-d991e169a0e4.png) cc ``@jyn514`` r? ``@camelid``
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#90905 (Add empty impl blocks if they have documentation) - rust-lang#97683 (Fail gracefully when encountering an HRTB in APIT. ) - rust-lang#97721 (Do `suggest_await_before_try` with infer variables in self, and clean up binders) - rust-lang#97752 (typo: `-Zcodegen-backend=llvm -Cpasses=list` should work now) - rust-lang#97759 (Suggest adding `{}` for `'label: non_block_expr`) - rust-lang#97764 (use strict provenance APIs) - rust-lang#97765 (Restore a test that was intended to test `as` cast to ptr) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #90866.
The update for the test script is needed to count the number of impl blocks we have with only the struct. To be noted that with #89676 merged, it wouldn't be needed (I don't know what is the status of it btw. cc @Mark-Simulacrum).
It looks like this:
cc @jyn514
r? @camelid