gcc/testsuite/rust/compile/auto_traits2.rs
raw| 1 | #![feature(optin_builtin_traits)] |
| 2 | |
| 3 | pub unsafe auto trait Send {} |
| 4 | #[lang = "sync"] |
| 5 | pub unsafe auto trait Sync {} |
| 6 | |
| 7 | trait A { |
| 8 | fn a_method(&self) {} |
| 9 | } |
| 10 | |
| 11 | fn foo(a: &(dyn A + Send + Sync)) { |
| 12 | a.a_method(); |
| 13 | } |
| 14 | |
| 15 | struct S; |
| 16 | |
| 17 | impl A for S { |
| 18 | fn a_method(&self) {} // { dg-warning "unused name" } |
| 19 | } |
| 20 | |
| 21 | fn main() { |
| 22 | let s = S; |
| 23 | |
| 24 | foo(&s); |
| 25 | } |