about summary refs log tree commit diff
path: root/src/test/auxiliary
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/test/auxiliary
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/test/auxiliary')
-rw-r--r--src/test/auxiliary/rustdoc-hidden-sig.rs22
-rw-r--r--src/test/auxiliary/rustdoc-nonreachable-impls.rs44
2 files changed, 66 insertions, 0 deletions
diff --git a/src/test/auxiliary/rustdoc-hidden-sig.rs b/src/test/auxiliary/rustdoc-hidden-sig.rs
new file mode 100644
index 00000000000..e2bc153ce0d
--- /dev/null
+++ b/src/test/auxiliary/rustdoc-hidden-sig.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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct Bar;
+
+impl Bar {
+    pub fn bar(_: u8) -> hidden::Hidden {
+        hidden::Hidden
+    }
+}
+
+#[doc(hidden)]
+pub mod hidden {
+    pub struct Hidden;
+}
diff --git a/src/test/auxiliary/rustdoc-nonreachable-impls.rs b/src/test/auxiliary/rustdoc-nonreachable-impls.rs
new file mode 100644
index 00000000000..22a311d5797
--- /dev/null
+++ b/src/test/auxiliary/rustdoc-nonreachable-impls.rs
@@ -0,0 +1,44 @@
+// 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct Foo;
+
+pub trait Woof {}
+pub trait Bark {}
+
+mod private {
+    // should be shown
+    impl ::Woof for ::Foo {}
+
+    pub trait Bar {}
+    pub struct Wibble;
+
+    // these should not be shown
+    impl Bar for ::Foo {}
+    impl Bar for Wibble {}
+    impl ::Bark for Wibble {}
+    impl ::Woof for Wibble {}
+}
+
+#[doc(hidden)]
+pub mod hidden {
+    // should be shown
+    impl ::Bark for ::Foo {}
+
+    pub trait Qux {}
+    pub struct Wobble;
+
+
+    // these should only be shown if they're reexported correctly
+    impl Qux for ::Foo {}
+    impl Qux for Wobble {}
+    impl ::Bark for Wobble {}
+    impl ::Woof for Wobble {}
+}