about summary refs log tree commit diff
path: root/tests/ui/self/explicit-self-objects-uniq.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/self/explicit-self-objects-uniq.rs')
-rw-r--r--tests/ui/self/explicit-self-objects-uniq.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/self/explicit-self-objects-uniq.rs b/tests/ui/self/explicit-self-objects-uniq.rs
new file mode 100644
index 00000000000..250ea12e57c
--- /dev/null
+++ b/tests/ui/self/explicit-self-objects-uniq.rs
@@ -0,0 +1,21 @@
+// run-pass
+
+trait Foo {
+    fn f(self: Box<Self>);
+}
+
+struct S {
+    x: isize
+}
+
+impl Foo for S {
+    fn f(self: Box<S>) {
+        assert_eq!(self.x, 3);
+    }
+}
+
+pub fn main() {
+    let x = Box::new(S { x: 3 });
+    let y = x as Box<dyn Foo>;
+    y.f();
+}