diff options
Diffstat (limited to 'tests/ui/traits/ufcs-object.rs')
| -rw-r--r-- | tests/ui/traits/ufcs-object.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/traits/ufcs-object.rs b/tests/ui/traits/ufcs-object.rs new file mode 100644 index 00000000000..700488c22d6 --- /dev/null +++ b/tests/ui/traits/ufcs-object.rs @@ -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); +} |
