about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-01-10 14:41:46 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-01-15 13:43:09 +0100
commitfd4a88f3098ab1b20267716102d49c8a43d151d8 (patch)
treeafc01bbe19075311b2cbbc156e153e37b821838e
parent12f029b7eecc01a38fbeec0eebe9041aa1bab7a5 (diff)
downloadrust-fd4a88f3098ab1b20267716102d49c8a43d151d8.tar.gz
rust-fd4a88f3098ab1b20267716102d49c8a43d151d8.zip
Add test for typedef deref
-rw-r--r--src/test/rustdoc/deref-typedef.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/rustdoc/deref-typedef.rs b/src/test/rustdoc/deref-typedef.rs
new file mode 100644
index 00000000000..b2dc20a5030
--- /dev/null
+++ b/src/test/rustdoc/deref-typedef.rs
@@ -0,0 +1,19 @@
+#![crate_name = "foo"]
+
+// @has 'foo/struct.Bar.html'
+// @has '-' '//*[@id="deref-methods"]' 'Methods from Deref<Target = FooB>'
+// @has '-' '//*[@class="impl-items"]//*[@id="method.happy"]' 'pub fn happy(&self)'
+// @has '-' '//*[@class="sidebar-title"]' 'Methods from Deref<Target=FooB>'
+// @has '-' '//*[@class="sidebar-links"]/a[@href="#method.happy"]' 'happy'
+pub struct FooA;
+pub type FooB = FooA;
+
+impl FooA {
+    pub fn happy(&self) {}
+}
+
+pub struct Bar;
+impl std::ops::Deref for Bar {
+    type Target = FooB;
+    fn deref(&self) -> &FooB { unimplemented!() }
+}