]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/impl-1.rs
Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini
[rust.git] / tests / ui / traits / impl-1.rs
1 // Test calling methods on an impl for a bare trait. This test checks that the
2 // trait impl is only applied to a trait object, not concrete types which implement
3 // the trait.
4
5 trait T {}
6
7 impl<'a> dyn T + 'a {
8     fn foo(&self) {}
9 }
10
11 impl T for i32 {}
12
13 fn main() {
14     let x = &42i32;
15     x.foo(); //~ERROR: no method named `foo` found
16 }