about summary refs log tree commit diff
path: root/tests/rustdoc/primitive/primitive-reference.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc/primitive/primitive-reference.rs')
-rw-r--r--tests/rustdoc/primitive/primitive-reference.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/rustdoc/primitive/primitive-reference.rs b/tests/rustdoc/primitive/primitive-reference.rs
new file mode 100644
index 00000000000..bd6b2a32f75
--- /dev/null
+++ b/tests/rustdoc/primitive/primitive-reference.rs
@@ -0,0 +1,36 @@
+#![crate_name = "foo"]
+
+#![feature(rustc_attrs)]
+
+//@ has foo/index.html
+//@ has - '//h2[@id="primitives"]' 'Primitive Types'
+//@ has - '//a[@href="primitive.reference.html"]' 'reference'
+//@ has - '//div[@class="sidebar-elems"]//li/a' 'Primitive Types'
+//@ has - '//div[@class="sidebar-elems"]//li/a/@href' '#primitives'
+//@ has foo/primitive.reference.html
+//@ has - '//h1' 'Primitive Type reference'
+//@ has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
+
+// There should be only one implementation listed.
+//@ count - '//*[@class="impl"]' 1
+//@ has - '//*[@id="impl-Foo%3C%26A%3E-for-%26B"]/*[@class="code-header"]' \
+//        'impl<A, B> Foo<&A> for &B'
+#[rustc_doc_primitive = "reference"]
+/// this is a test!
+mod reference {}
+
+pub struct Bar;
+
+// This implementation should **not** show up.
+impl<T> From<&T> for Bar {
+    fn from(s: &T) -> Self {
+        Bar
+    }
+}
+
+pub trait Foo<T> {
+    fn stuff(&self, other: &T) {}
+}
+
+// This implementation should show up.
+impl<A, B> Foo<&A> for &B {}