about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-08-06 00:41:52 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-08-06 00:41:52 +0200
commit4fb29f9fd2758a5c07328fc12aa771bb239f9450 (patch)
tree77f4a0ebac86d98257877d5aa3f42f177bb0f4ff
parentd89bf91b2d804a773f9c56cdbfcfe25cf573c848 (diff)
downloadrust-4fb29f9fd2758a5c07328fc12aa771bb239f9450.tar.gz
rust-4fb29f9fd2758a5c07328fc12aa771bb239f9450.zip
Add test for DerefMut methods
-rw-r--r--src/test/rustdoc/deref-mut-methods.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/rustdoc/deref-mut-methods.rs b/src/test/rustdoc/deref-mut-methods.rs
new file mode 100644
index 00000000000..0e27fc90b69
--- /dev/null
+++ b/src/test/rustdoc/deref-mut-methods.rs
@@ -0,0 +1,29 @@
+#![crate_name = "foo"]
+
+use std::ops;
+
+pub struct Foo;
+
+impl Foo {
+    pub fn foo(&mut self) {}
+}
+
+// @has foo/struct.Bar.html
+// @has - '//div[@class="sidebar-links"]/a[@href="#method.foo"]' 'foo'
+pub struct Bar {
+    foo: Foo,
+}
+
+impl ops::Deref for Bar {
+    type Target = Foo;
+
+    fn deref(&self) -> &Foo {
+        &self.foo
+    }
+}
+
+impl ops::DerefMut for Bar {
+    fn deref_mut(&mut self) -> &mut Foo {
+        &mut self.foo
+    }
+}