about summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-19 05:00:10 -0700
committerbors <bors@rust-lang.org>2016-04-19 05:00:10 -0700
commit478a33dabc4e6f2f501f476c79b56178d9df4f37 (patch)
treea3c02c01a6d1b0eefbb5e28a932e6968b8fc9b14 /src/librustdoc/html/format.rs
parente8c0aeb88ba1e12d0c0a1d0ed7b4a90b44460a29 (diff)
parent77b409a674f62e3be13ec9339b5c8272c9b5c0a9 (diff)
downloadrust-478a33dabc4e6f2f501f476c79b56178d9df4f37.tar.gz
rust-478a33dabc4e6f2f501f476c79b56178d9df4f37.zip
Auto merge of #33002 - mitaa:rdoc-cross-impls, r=alexcrichton
rustdoc: refine cross-crate impl inlining

This changes the current rule that impls within `doc(hidden)` modules aren't inlined, to only inlining impls where the implemented trait and type are reachable in documentation.

fixes #14586
fixes #31948

.. and also applies the reachability checking to cross-crate links.

fixes #28480

r? @alexcrichton
Diffstat (limited to 'src/librustdoc/html/format.rs')
-rw-r--r--src/librustdoc/html/format.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 1a228b4af8b..d4212bba590 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -24,6 +24,7 @@ use syntax::abi::Abi;
 use rustc::hir;
 
 use clean;
+use core::DocAccessLevels;
 use html::item_type::ItemType;
 use html::render;
 use html::render::{cache, CURRENT_LOCATION_KEY};
@@ -298,6 +299,9 @@ pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> {
     let mut url = if did.is_local() || cache.inlined.contains(&did) {
         repeat("../").take(loc.len()).collect::<String>()
     } 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(),