Skip to content

Don't generate #[doc(hidden)] elements #34026

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,9 @@ impl Context {
self.render_redirect_pages = self.maybe_ignore_item(&item);
}

if item.is_mod() {
if item.attrs.list("doc").has_word("hidden") {
Ok(())
} else if item.is_mod() {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that the strip_hidden pass is supposed to be responsible for removing hidden items. Why is that pass not sufficient? Shouldn't the hidden items have been stripped by this point and not be seen here?

Copy link
Member Author

@GuillaumeGomez GuillaumeGomez Jun 2, 2016

Choose a reason for hiding this comment

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

Like I said, the pass only set them as hidden but still generates the files. This change prevents the creation of the files.

// modules are special because they add a namespace. We also need to
// recurse into the items of the module as well.
let name = item.name.as_ref().unwrap().to_string();
Expand Down
5 changes: 1 addition & 4 deletions src/librustdoc/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ pub fn strip_hidden(krate: clean::Crate) -> plugins::PluginResult {
debug!("found one in strip_hidden; removing");
// use a dedicated hidden item for given item type if any
match i.inner {
clean::StructFieldItem(..) | clean::ModuleItem(..) => {
return Strip(i).fold()
}
_ => return None,
_ => return Strip(i).fold(),
}
} else {
self.retained.insert(i.def_id);
Expand Down
15 changes: 0 additions & 15 deletions src/test/rustdoc/issue-15347.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/test/rustdoc/redirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ pub trait Foo {}
// @has redirect/index.html
// @has - '//code' 'pub use reexp_stripped::Bar'
// @has - '//code/a' 'Bar'
// @has reexp_stripped/hidden/struct.Bar.html
// @has - '//p/a' '../../reexp_stripped/struct.Bar.html'
// @has 'reexp_stripped/struct.Bar.html'
#[doc(no_inline)]
pub use reexp_stripped::Bar;
Expand Down