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 should not generate docs for hidden methods. #34025

Closed
BenTheElder opened this issue Jun 1, 2016 · 14 comments
Closed

Rustdoc should not generate docs for hidden methods. #34025

BenTheElder opened this issue Jun 1, 2016 · 14 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@BenTheElder
Copy link

See previous discussion here: #34023 (comment)

rustdoc seems to be building files for methods marked #[doc(hidden)] in rust 1.9.0 and nightly but not in 1.8.0, observed with code generated when building opencv-rust.
It seems that these methods should be ignored.

@GuillaumeGomez
Copy link
Member

Could you provide a short example on which I could easily please? As far as I can tell, #[doc(hidden)] items aren't generated.

@GuillaumeGomez
Copy link
Member

Also, I made a patch which is supposed to fix this. Can you test it please?

make check-stage1-rustdocck && cd src/librustdoc/ && ../../x86.../stage1/bin/rustdoc [path of the crate you want to generate] -o [output dir]

@BenTheElder
Copy link
Author

I will take a look at doing both of these in a moment when I get back to a
computer, I think the test case needs to include! the code.
On Jun 1, 2016 17:33, "Guillaume Gomez" notifications@github.com wrote:

Also, I made a patch
https://github.com/GuillaumeGomez/rust/tree/doc_hidden which is
supposed to fix this. Can you test it please?

make check-stage1-rustdocck && cd src/librustdoc/ && ../../x86.../stage1/bin/rustdoc [path of the crate you want to generate] -o [output dir]


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#34025 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AA4Bq_n5gNDJxBS72ir1jouWrOwFPHXNks5qHfqhgaJpZM4Ir70m
.

@GuillaumeGomez
Copy link
Member

If you prefer that I test it, I'll need a short example like I said. So either way, I'm waiting. 😉

@BenTheElder
Copy link
Author

So far I haven't managed to trigger it outside of that project, If i get a usable test case I'll post it.
In the mean time I'm also going to start building your patch to test with. Thank you for the quick responses by the way!

@BenTheElder
Copy link
Author

I think I've got a nice small test case now, I'll post it to github in a moment but the gist is:

~/dev/docs_test_case$ tree .
.
├── Cargo.lock
├── Cargo.toml
└── src
    ├── lib.rs
    └── no_doc.rs

lib.rs:

#[doc(hidden)] pub mod sys {
    include!("./no_doc.rs");
}

no_doc.rs:

extern "C" {
#[doc(hidden)] pub fn cv_calib3d_cv_solvePnPRansac_InputArray_objectPoints_InputArray_imagePoints_InputArray_cameraMatrix_InputArray_distCoeffs_OutputArray_rvec_OutputArray_tvec_bool_useExtrinsicGuess_int_iterationsCount_float_reprojectionError_int_minInliersCount_OutputArray_inliers_int_flags();
}

@BenTheElder
Copy link
Author

Test case is here: https://github.com/BenTheElder/docs_test_case

@GuillaumeGomez
Copy link
Member

Thanks! Testing my patch.

@GuillaumeGomez
Copy link
Member

It doesn't work. But now I know what to look! :)

@BenTheElder
Copy link
Author

Of course! Thanks for looking.
The patch was still building for me but I'd be happy to try any future
patches as well.
On Jun 1, 2016 18:10, "Guillaume Gomez" notifications@github.com wrote:

It doesn't work. But now I know what to look! :)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#34025 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AA4Bq5AXSKSYeFVek3hCQUszxN4FCG-5ks5qHgNKgaJpZM4Ir70m
.

@GuillaumeGomez
Copy link
Member

@BenTheElder: Take a look to the PR linked.

@BenTheElder
Copy link
Author

Thanks, pulling your fix now to test.
On Jun 1, 2016 19:08, "Guillaume Gomez" notifications@github.com wrote:

@BenTheElder https://github.com/BenTheElder: Take a look to the PR
linked.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#34025 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AA4Bq3tMBdhuBko_OA0_euEQbtO47yWmks5qHhDugaJpZM4Ir70m
.

@BenTheElder
Copy link
Author

I think the PR works, i did:

git checkout doc_hidden
./configure
make check-stage1-rustdocck -j 12
 cd src/librustdoc/
../../x86_64-unknown-linux-gnu/stage1/bin/rustdoc ~/dev/docs_test_case/src/lib.rs

Which seems to produce the expected page in ./doc/lib/index.hml with no methods.

@steveklabnik steveklabnik changed the title [rustdoc] Rustdoc should not generate docs for hidden methods. Rustdoc should not generate docs for hidden methods. Jun 6, 2016
@steveklabnik steveklabnik added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 6, 2016
@GuillaumeGomez
Copy link
Member

Should be fixed by #34045.

bors added a commit that referenced this issue Jun 12, 2016
rustdoc: Don't generate empty files for stripped items

We need to traverse stripped modules to generate redirect pages, but we shouldn't generate
anything else for them.

This now renders the file contents to a Vec before writing it to a file in one go. I think
that's probably a better strategy anyway.

Fixes: #34025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants