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

Rustdoc reports non accessable items in blocks with --document-private-items, even with #[doc(hidden)] #106373

Closed
aDotInTheVoid opened this issue Jan 2, 2023 · 1 comment · Fixed by #107000
Labels
regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@aDotInTheVoid
Copy link
Member

#![allow(unused_macros, dead_code)]

#[doc(hidden)]
const _: () = {
    macro_rules! stry {
        () => {};
    }

    struct ShouldBeHidden;

    impl Bar for Foo {
        fn bar(&self) {
            struct SHouldAlsoBeHidden;
        }
    }
};

pub struct Foo;

pub trait Bar {
    fn bar(&self);
}

Produces with rustdoc +nightly src/lib.rs --document-private-items

image

which erroniously includes stry, ShouldBeHidden, and ShouldAlsoBeHidden.

Stable (1.66.0) gets this right

image

It's debatable what the semantics of --document-private-items should be for items in blocks without #[doc(hidden)] 1, but here, we're just wrong.

We also can't just ignore all items in #[doc(hidden)] blocks, as this would break a load of users, eg serde.

Zulip Discussion

Probably, caused by #104889, cc @GuillaumeGomez

Footnotes

  1. FWIW, I think they should still be hidden, as their not accessible outside the block.

@aDotInTheVoid aDotInTheVoid added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 2, 2023
@GuillaumeGomez
Copy link
Member

Tricky indeed. I see two ways of handling this problem:

  1. Hide all items inside the block: if we pick this way, then how to unhide items which are declared into a block like this if you only want to hide the "block owner" and not the items in the block.
  2. Keep the current behaviour and only hide items which have #[doc(hidden)] and their direct children, therefore excluding blocks since they're not children of the item.

@jyn514 jyn514 added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Jan 16, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jan 16, 2023
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jan 18, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 20, 2023
…iddle

rustdoc: Revert rust-lang#104889

Reverts rust-lang#104889.

I don't think I'll be able to finish rust-lang#107000 on time unfortunately so to prevent rust-lang#106373, better to revert it and to make it into the next release.

r? `@notriddle`
@bors bors closed this as completed in 6c991b0 Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants