about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/rustdoc-js/auxiliary/equivalent.rs15
-rw-r--r--tests/rustdoc-js/search-non-local-trait-impl.js9
-rw-r--r--tests/rustdoc-js/search-non-local-trait-impl.rs8
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/rustdoc-js/auxiliary/equivalent.rs b/tests/rustdoc-js/auxiliary/equivalent.rs
new file mode 100644
index 00000000000..a19b5a2d44d
--- /dev/null
+++ b/tests/rustdoc-js/auxiliary/equivalent.rs
@@ -0,0 +1,15 @@
+use std::borrow::Borrow;
+
+pub trait Equivalent<K: ?Sized> {
+    fn equivalent(&self, key: &K) -> bool;
+}
+
+impl<Q: ?Sized, K: ?Sized> Equivalent<K> for Q
+where
+    Q: Eq,
+    K: Borrow<Q>,
+{
+    fn equivalent(&self, key: &K) -> bool {
+        PartialEq::eq(self, key.borrow())
+    }
+}
diff --git a/tests/rustdoc-js/search-non-local-trait-impl.js b/tests/rustdoc-js/search-non-local-trait-impl.js
new file mode 100644
index 00000000000..9ebeceb69f9
--- /dev/null
+++ b/tests/rustdoc-js/search-non-local-trait-impl.js
@@ -0,0 +1,9 @@
+// exact-check
+
+// This test ensures that methods from blanket impls of not available foreign traits
+// don't show up in the search results.
+
+const EXPECTED = {
+    'query': 'equivalent',
+    'others': [],
+};
diff --git a/tests/rustdoc-js/search-non-local-trait-impl.rs b/tests/rustdoc-js/search-non-local-trait-impl.rs
new file mode 100644
index 00000000000..462b75b0b13
--- /dev/null
+++ b/tests/rustdoc-js/search-non-local-trait-impl.rs
@@ -0,0 +1,8 @@
+// aux-crate:priv:equivalent=equivalent.rs
+// compile-flags: -Zunstable-options --extern equivalent
+// edition:2018
+
+extern crate equivalent;
+
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub struct LayoutError;