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