gcc/testsuite/rust/compile/traits11.rs
raw| 1 | #[lang = "sized"] |
| 2 | pub trait Sized {} |
| 3 | |
| 4 | struct Foo(i32); |
| 5 | |
| 6 | trait A { |
| 7 | const A: i32 = 123; |
| 8 | fn B(); |
| 9 | fn C(&self); |
| 10 | } |
| 11 | |
| 12 | trait B: A { |
| 13 | fn test(&self); |
| 14 | } |
| 15 | |
| 16 | pub fn main() { |
| 17 | let a; |
| 18 | a = Foo(123); |
| 19 | |
| 20 | let b: &dyn B = &a; |
| 21 | // { dg-error "trait bound is not object safe" "" { target *-*-* } .-1 } |
| 22 | } |