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: Split out rustdoc pass to strip private imports #32055

Merged
merged 1 commit into from
Mar 6, 2016

Conversation

mitaa
Copy link
Contributor

@mitaa mitaa commented Mar 5, 2016

@mitaa
Copy link
Contributor Author

mitaa commented Mar 5, 2016

cc @SimonSapin

@mitaa mitaa force-pushed the rdoc-strip-priv-imports branch 2 times, most recently from 9d8f63e to 745c7cf Compare March 5, 2016 10:20
impl fold::DocFolder for ImportStripper {
fn fold_item(&mut self, i: Item) -> Option<Item> {
match i.inner {
clean::ExternCrateItem(..) |
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also test visibility, right? #31362 made pub extern crate meaningful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the pattern guard on the next line should take care of that (?) 😃

Or do you mean a rustdoc test? I've added one since there doesn't appear to be any rustdoc test for pub extern crate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind, I read this code too quickly and didn’t realize these two lines are the same match arm :)

@SimonSapin
Copy link
Contributor

Nice! This should make pages like http://doc.servo.org/servo/index.html#reexports much less noisy. Thanks @mitaa!

@mitaa
Copy link
Contributor Author

mitaa commented Mar 6, 2016

r? @alexcrichton

(highfive might be awake again)

@alexcrichton
Copy link
Member

@bors: r+ 688e522

Thanks!

@bors
Copy link
Contributor

bors commented Mar 6, 2016

⌛ Testing commit 688e522 with merge 72d588a...

@alexcrichton alexcrichton self-assigned this Mar 6, 2016
@bors bors merged commit 688e522 into rust-lang:master Mar 6, 2016
@mitaa mitaa deleted the rdoc-strip-priv-imports branch March 6, 2016 19:08
@@ -106,7 +106,7 @@ pub fn strip_private(mut krate: clean::Crate) -> plugins::PluginResult {
retained: &mut retained,
access_levels: &access_levels,
};
krate = stripper.fold_crate(krate);
krate = ImportStripper.fold_crate(stripper.fold_crate(krate));
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that this change hit Nightly I’m trying it out but I’m surprised to not see strip-priv-imports listed in the default passes in rustdoc --passes list. As far as I understand it’s indeed not a default pass, but this line makes it implied by strip-private. This is not exactly wrong, but at least confusing.

Maybe add “, implies strip-priv-imports” should be added to the description for strip-private in src/librustdoc/lib.rs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think that'd be a good idea. I'll submit a PR later if you or someone else hasn't by then.

SimonSapin added a commit to servo/servo that referenced this pull request Mar 7, 2016
rust-lang/rust#32055

This will make e.g. http://doc.servo.org/servo/index.html#reexports
stop listing `extern crate` and `use` statements that don’t have `pub`.
bors-servo pushed a commit to servo/servo that referenced this pull request Mar 7, 2016
Use rustdoc’s new `--passes strip-priv-imports` flag.

rust-lang/rust#32055

This will make e.g. http://doc.servo.org/servo/index.html#reexports stop listing `extern crate` and `use` statements that don’t have `pub`.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9894)
<!-- Reviewable:end -->
bors-servo pushed a commit to servo/servo that referenced this pull request Mar 8, 2016
Use rustdoc’s new `--passes strip-priv-imports` flag.

rust-lang/rust#32055

This will make e.g. http://doc.servo.org/servo/index.html#reexports stop listing `extern crate` and `use` statements that don’t have `pub`.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9894)
<!-- Reviewable:end -->
bors-servo pushed a commit to servo/servo that referenced this pull request Mar 8, 2016
Use rustdoc’s new `--passes strip-priv-imports` flag.

rust-lang/rust#32055

This will make e.g. http://doc.servo.org/servo/index.html#reexports stop listing `extern crate` and `use` statements that don’t have `pub`.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9894)
<!-- Reviewable:end -->
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 1, 2019
…flag (from servo:strip-priv-imports); r=Ms2ger

rust-lang/rust#32055

This will make e.g. http://doc.servo.org/servo/index.html#reexports stop listing `extern crate` and `use` statements that don’t have `pub`.

Source-Repo: https://github.com/servo/servo
Source-Revision: 1453f438256afe92b0f79980c984824aac4afeae

UltraBlame original commit: 8429d073276a3daeb5d4403ad44274bc39113092
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…flag (from servo:strip-priv-imports); r=Ms2ger

rust-lang/rust#32055

This will make e.g. http://doc.servo.org/servo/index.html#reexports stop listing `extern crate` and `use` statements that don’t have `pub`.

Source-Repo: https://github.com/servo/servo
Source-Revision: 1453f438256afe92b0f79980c984824aac4afeae

UltraBlame original commit: 8429d073276a3daeb5d4403ad44274bc39113092
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
…flag (from servo:strip-priv-imports); r=Ms2ger

rust-lang/rust#32055

This will make e.g. http://doc.servo.org/servo/index.html#reexports stop listing `extern crate` and `use` statements that don’t have `pub`.

Source-Repo: https://github.com/servo/servo
Source-Revision: 1453f438256afe92b0f79980c984824aac4afeae

UltraBlame original commit: 8429d073276a3daeb5d4403ad44274bc39113092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have rustdoc document private items, except use and extern crate
4 participants