]>
Commit | Line | Data |
---|---|---|
9346a6ac AL |
1 | // Test that we give suitable error messages when the user attempts to |
2 | // impl a trait `Trait` for its own object type. | |
3 | ||
0731742a XL |
4 | // revisions: old re |
5 | ||
6 | #![cfg_attr(re, feature(re_rebalance_coherence))] | |
7 | ||
9346a6ac AL |
8 | trait Foo { fn dummy(&self) { } } |
9 | trait Bar: Foo { } | |
10 | trait Baz: Bar { } | |
11 | ||
62682a34 | 12 | // Supertraits of Baz are not legal: |
dc9dc135 | 13 | impl Foo for dyn Baz { } |
0731742a XL |
14 | //[old]~^ ERROR E0371 |
15 | //[re]~^^ ERROR E0371 | |
dc9dc135 | 16 | impl Bar for dyn Baz { } |
0731742a XL |
17 | //[old]~^ ERROR E0371 |
18 | //[re]~^^ ERROR E0371 | |
dc9dc135 | 19 | impl Baz for dyn Baz { } |
0731742a XL |
20 | //[old]~^ ERROR E0371 |
21 | //[re]~^^ ERROR E0371 | |
9346a6ac AL |
22 | |
23 | // But other random traits are: | |
24 | trait Other { } | |
dc9dc135 | 25 | impl Other for dyn Baz { } // OK, Other not a supertrait of Baz |
9346a6ac | 26 | |
9346a6ac | 27 | fn main() { } |