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

Visually mark 👻hidden👻 items with document-hidden-items #122495

Merged
merged 7 commits into from
Mar 15, 2024

Conversation

Manishearth
Copy link
Member

Fixes #122485

This adds a 👻 in the item list (much like the 🔒 used for private items), and also shows #[doc(hidden)] in the code view, where pub(crate) etc gets shown for private items.

This does not do anything for enum variants, if people have ideas. I think we can just show the attribute.

@Manishearth Manishearth requested a review from jsha March 14, 2024 13:46
@rustbot
Copy link
Collaborator

rustbot commented Mar 14, 2024

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented Mar 14, 2024

Some changes occurred in src/librustdoc/clean/types.rs

cc @camelid

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 14, 2024
@Manishearth
Copy link
Member Author

Here's what it looks like:

image
image
image

@rust-log-analyzer

This comment has been minimized.

Some(ty::Visibility::Restricted(_)) => {
"<span title=\"Restricted Visibility\">&nbsp;🔒</span> "
if myitem.is_doc_hidden() {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the condition reversed here? Also, if the item is both hidden and private, should we show that it is private?

Copy link
Member Author

Choose a reason for hiding this comment

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

oops. fixed. And yes, I think we should show both, though really hidden+private doesn't make sense.

Copy link
Member

Choose a reason for hiding this comment

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

Then what's the use case of showing both?

Copy link
Member Author

Choose a reason for hiding this comment

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

There's not a large use case, but it may make sense for crates that more regularly use --document-private-items.

Copy link
Member

Choose a reason for hiding this comment

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

Well, we can always change it afterwards if we change our minds about it.

Copy link
Member

Choose a reason for hiding this comment

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

(I meant it's fine to leave it as is)

@GuillaumeGomez
Copy link
Member

Another question I have about unicode: the rendering of the emoji seems different between github and rustdoc output. Will it change depending on the font installed (ie, the web browser/OS)? If so we should maybe use an image instead.

@Manishearth
Copy link
Member Author

@GuillaumeGomez we already use emoji for private items and other things.

rustdoc ships with its fonts, it should be fine.

@GuillaumeGomez
Copy link
Member

Ok, code changes look good to me. I have a few reservations about the display of #[doc(hidden)] though. Currently, we don't display the lock on an associated private item (like methods or constants), but instead pub(crate). Adding an attribute information on an associated item like this seems a bit weird to me (mostly because it's inlined I think).

Should we:

  1. Keep it as is?
  2. Put the attribute on its own line?
  3. Use the ghost emoji with alt information?
  4. Display it like an item information (the rectangle where we put unstable information for example)?

@Manishearth
Copy link
Member Author

@GuillaumeGomez I think doc(hidden) is simialr to pub(crate) here, I'm showing the ghost where private items shows a lock, and the code where private items shows a privacy indicator. I think the uniformity is nice.

@GuillaumeGomez
Copy link
Member

It's still bugging me to have the inlined attribute. Do you mind asking the rest of the team about it? If I'm the only one having an issue with this, let's merge it.

@GuillaumeGomez
Copy link
Member

Let's merge it then!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 15, 2024

📌 Commit 9718144 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@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-review Status: Awaiting review from the assignee but also interested parties. labels Mar 15, 2024
@tgross35
Copy link
Contributor

Maybe something like adding a // hidden 👻 comment after the trait items would work? I think something later on that line or on a separate preceding line would look nicer since it keeps alignment.

Could you add screenshots of what the above modules currently look like, if you have them handy? Just to better see the difference

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 15, 2024
…meGomez

Visually mark 👻hidden👻 items with document-hidden-items

Fixes rust-lang#122485

This adds a 👻 in the item list (much like the 🔒 used for private items), and also shows `#[doc(hidden)]` in the code view, where `pub(crate)` etc gets shown for private items.

This does not do anything for enum variants, if people have ideas. I think we can just show the attribute.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 15, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#122254 (Detect calls to .clone() on T: !Clone types on borrowck errors)
 - rust-lang#122495 (Visually mark 👻hidden👻 items with document-hidden-items)
 - rust-lang#122543 (Add `#![rustc_never_type_mode = "..."]` crate-level attribute to allow experimenting)
 - rust-lang#122560 (Safe Transmute: Use 'not yet supported', not 'unspecified' in errors)
 - rust-lang#122562 (Mention labelled blocks in `break` docs)
 - rust-lang#122563 (CI: cache PR CI Docker builds)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 57f2104 into rust-lang:master Mar 15, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 15, 2024
Rollup merge of rust-lang#122495 - Manishearth:rustdoc-👻👻👻, r=GuillaumeGomez

Visually mark 👻hidden👻 items with document-hidden-items

Fixes rust-lang#122485

This adds a 👻 in the item list (much like the 🔒 used for private items), and also shows `#[doc(hidden)]` in the code view, where `pub(crate)` etc gets shown for private items.

This does not do anything for enum variants, if people have ideas. I think we can just show the attribute.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

document-hidden-items should show when items are hidden
7 participants