From 4ea7bc91cb88d01e3f4e5da9fe3707858613a51a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 1 Jun 2016 23:29:51 +0200 Subject: [PATCH] Don't generate #[doc(hidden)] elements --- src/librustdoc/html/render.rs | 4 +++- src/librustdoc/passes.rs | 5 +---- src/test/rustdoc/issue-15347.rs | 15 --------------- src/test/rustdoc/redirect.rs | 2 -- 4 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 src/test/rustdoc/issue-15347.rs diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 396f71173f834..acdb7a346d7f3 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -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() { // 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(); diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index 1980d1f9cc45f..67f479036c145 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -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); diff --git a/src/test/rustdoc/issue-15347.rs b/src/test/rustdoc/issue-15347.rs deleted file mode 100644 index 266a30891941d..0000000000000 --- a/src/test/rustdoc/issue-15347.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2105 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags:--no-defaults --passes collapse-docs --passes unindent-comments - -// @has issue_15347/fn.foo.html -#[doc(hidden)] -pub fn foo() {} diff --git a/src/test/rustdoc/redirect.rs b/src/test/rustdoc/redirect.rs index 98e66e8c024bd..e1daec5f5b916 100644 --- a/src/test/rustdoc/redirect.rs +++ b/src/test/rustdoc/redirect.rs @@ -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;