]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/traits/ufcs-object.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / test / ui / traits / ufcs-object.rs
diff --git a/src/test/ui/traits/ufcs-object.rs b/src/test/ui/traits/ufcs-object.rs
new file mode 100644 (file)
index 0000000..700488c
--- /dev/null
@@ -0,0 +1,17 @@
+// run-pass
+// Test that when you use ufcs form to invoke a trait method (on a
+// trait object) everything works fine.
+
+
+trait Foo {
+    fn test(&self) -> i32;
+}
+
+impl Foo for i32 {
+    fn test(&self) -> i32 { *self }
+}
+
+fn main() {
+    let a: &dyn Foo = &22;
+    assert_eq!(Foo::test(a), 22);
+}