diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index d4212bba590..26d82ccea5b 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -291,17 +291,19 @@ impl fmt::Display for clean::Path {
pub fn href(did: DefId) -> Option<(String, ItemType, Vec)> {
let cache = cache();
+ if !did.is_local() && !cache.access_levels.is_doc_reachable(did) {
+ return None
+ }
+
let loc = CURRENT_LOCATION_KEY.with(|l| l.borrow().clone());
let &(ref fqp, shortty) = match cache.paths.get(&did) {
Some(p) => p,
None => return None,
};
+
let mut url = if did.is_local() || cache.inlined.contains(&did) {
repeat("../").take(loc.len()).collect::()
} else {
- if !cache.access_levels.is_doc_reachable(did) {
- return None
- }
match cache.extern_locations[&did.krate] {
(_, render::Remote(ref s)) => s.to_string(),
(_, render::Local) => repeat("../").take(loc.len()).collect(),
diff --git a/src/test/auxiliary/rustdoc-hidden.rs b/src/test/auxiliary/rustdoc-hidden.rs
new file mode 100644
index 00000000000..aae3eb84fb5
--- /dev/null
+++ b/src/test/auxiliary/rustdoc-hidden.rs
@@ -0,0 +1,14 @@
+// Copyright 2016 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.
+
+#[doc(hidden)]
+pub struct Foo;
+
+pub struct Bar;
diff --git a/src/test/rustdoc/inline_cross/inline_hidden.rs b/src/test/rustdoc/inline_cross/inline_hidden.rs
new file mode 100644
index 00000000000..c59b5afd1c4
--- /dev/null
+++ b/src/test/rustdoc/inline_cross/inline_hidden.rs
@@ -0,0 +1,22 @@
+// Copyright 2016 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.
+
+// aux-build:rustdoc-hidden.rs
+// build-aux-docs
+// ignore-cross-compile
+
+extern crate rustdoc_hidden;
+
+#[doc(no_inline)]
+pub use rustdoc_hidden::Foo;
+
+// @has inline_hidden/fn.foo.html
+// @!has - '//a/@title' 'Foo'
+pub fn foo(_: Foo) {}