summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/ufcs-object.rs
blob: 700488c22d6780606207df0103fcb415ce676d30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);
}