]> git.proxmox.com Git - rustc.git/blame - src/test/ui/traits/ufcs-trait-object.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / traits / ufcs-trait-object.rs
CommitLineData
b7449926 1// run-pass
85aaf69f
SL
2// Test that when you use ufcs form to invoke a trait method (on a
3// trait object) everything works fine.
223e47cc 4
c34b1796 5
85aaf69f
SL
6trait Foo {
7 fn test(&self) -> i32;
8}
223e47cc 9
85aaf69f
SL
10impl Foo for i32 {
11 fn test(&self) -> i32 { *self }
12}
223e47cc
LB
13
14fn main() {
dc9dc135 15 let a: &dyn Foo = &22;
85aaf69f 16 assert_eq!(Foo::test(a), 22);
223e47cc 17}