]>
Commit | Line | Data |
---|---|---|
0531ce1d | 1 | // Tests that default impls do not have to supply all items but regular impls do. |
7cac9316 | 2 | |
f035d41b | 3 | #![feature(specialization)] //~ WARN the feature `specialization` is incomplete |
7cac9316 XL |
4 | |
5 | trait Foo { | |
0531ce1d XL |
6 | fn foo_one(&self) -> &'static str; |
7 | fn foo_two(&self) -> &'static str; | |
b039eaaf | 8 | } |
85aaf69f | 9 | |
0531ce1d | 10 | struct MyStruct; |
b039eaaf | 11 | |
0531ce1d XL |
12 | default impl<T> Foo for T { |
13 | fn foo_one(&self) -> &'static str { | |
14 | "generic" | |
7cac9316 | 15 | } |
b039eaaf | 16 | } |
223e47cc | 17 | |
0531ce1d XL |
18 | impl Foo for MyStruct {} |
19 | //~^ ERROR not all trait items implemented, missing: `foo_two` [E0046] | |
7cac9316 | 20 | |
0531ce1d XL |
21 | fn main() { |
22 | println!("{}", MyStruct.foo_one()); | |
c34b1796 | 23 | } |