2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2015-01-13 09:17:07 -05:00
|
|
|
// Test that when you use ufcs form to invoke a trait method (on a
|
|
|
|
// trait object) everything works fine.
|
|
|
|
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2015-01-13 09:17:07 -05:00
|
|
|
trait Foo {
|
|
|
|
fn test(&self) -> i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo for i32 {
|
|
|
|
fn test(&self) -> i32 { *self }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2019-05-28 14:47:21 -04:00
|
|
|
let a: &dyn Foo = &22;
|
2015-01-13 09:17:07 -05:00
|
|
|
assert_eq!(Foo::test(a), 22);
|
|
|
|
}
|