Skip to content
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

Prevent feature information to be hidden if it's on the impl directly #79300

Merged
merged 1 commit into from
Nov 22, 2020

Conversation

GuillaumeGomez
Copy link
Member

Fixes #79279.

So when a #[doc(cfg...)] is used on a trait impl directly, it's not hidden by the toggle.

Screenshot from 2020-11-22 14-40-11

r? @jyn514

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 22, 2020
@jyn514 jyn514 added F-doc_cfg `#![feature(doc_cfg)]` T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 22, 2020
Comment on lines +2342 to +2346
if (hasClass(docblock, "stability") === false) {
addClass(docblock, "hidden-by-usual-hider");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does stability have to do with it? IIUC this is hiding it when you have #[unstable] in the source - why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's interesting in fact! Let me check that. If you're right, we're badly handling a few things in there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so "stability" groups a few things, including the feature attributes. Inside it, it is the "portability" class the important one. However, we don't generate items like "deprecated" on implementations as it seems. And even if we did, it'd make sense to print them, and since they're stored inside the stability element... For reference, it looks like this:

<div class="stability">
  <div class="stab portability">This is supported on <strong>non-crate feature <code>traits</code></strong> only.</div>
</div>

And deprecated looks like this:

<div class="stability">
  <div class="stab deprecated"><span class="emoji">👎</span> Deprecated</div>
</div>

And when you merge both:

<div class="stability">
  <div class="stab deprecated"><span class="emoji">👎</span> Deprecated</div>
  <div class="stab portability">This is supported on <strong>non-crate feature <code>traits</code></strong> only.</div>
</div>

So it kinda makes sense, however we should maybe rename the item class. What do you think about renaming it then? However, I'll do it in another PR to prevent mixing too much things.

Copy link
Member

@jyn514 jyn514 Nov 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Printing both, even on implementations, sounds like the right approach to me :) happy to wait for another cleanup PR.

@jyn514 jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 22, 2020
@jyn514
Copy link
Member

jyn514 commented Nov 22, 2020

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 22, 2020

📌 Commit 28a94a3 has been approved by jyn514

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 22, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 22, 2020
…laumeGomez

Rollup of 4 pull requests

Successful merges:

 - rust-lang#78670 (Remove FIXME comment in some incremental test suite)
 - rust-lang#79292 (Fix typo in doc comment for report_too_many_hashes)
 - rust-lang#79300 (Prevent feature information to be hidden if it's on the impl directly)
 - rust-lang#79302 (Add regression test for issue 73899)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 70a839f into rust-lang:master Nov 22, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 22, 2020
@GuillaumeGomez GuillaumeGomez deleted the hidden-feature-info branch November 22, 2020 19:36
@GuillaumeGomez GuillaumeGomez added the A-rustdoc-ui Area: rustdoc UI (generated HTML) label Nov 22, 2020
dtolnay added a commit to dtolnay/syn that referenced this pull request Nov 23, 2020
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 28, 2020
…jyn514

Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short`

Follow-up of rust-lang#79300

The point of this PR is to make the CSS class more accurate since it's not only about stability anymore.

r? `@jyn514`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 29, 2020
…jyn514

Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short`

Follow-up of rust-lang#79300

The point of this PR is to make the CSS class more accurate since it's not only about stability anymore.

r? ``@jyn514``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) F-doc_cfg `#![feature(doc_cfg)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent default display of doc(cfg(...)) on impls of empty traits
5 participants