]> git.lizzy.rs Git - rust.git/blob - tests/ui/parser/default.rs
Rollup merge of #106707 - ehuss:remove-dupe-sha-1, r=Mark-Simulacrum
[rust.git] / tests / ui / parser / default.rs
1 // Test successful and unsuccessful parsing of the `default` contextual keyword
2
3 #![feature(specialization)]
4 //~^ WARN the feature `specialization` is incomplete
5
6 trait Foo {
7     fn foo<T: Default>() -> T;
8 }
9
10 impl Foo for u8 {
11     default fn foo<T: Default>() -> T {
12         T::default()
13     }
14 }
15
16 impl Foo for u16 {
17     pub default fn foo<T: Default>() -> T { //~ ERROR unnecessary visibility qualifier
18         T::default()
19     }
20 }
21
22 impl Foo for u32 { //~ ERROR not all trait items implemented, missing: `foo`
23     default pub fn foo<T: Default>() -> T { T::default() }
24     //~^ ERROR `default` is not followed by an item
25     //~| ERROR non-item in item list
26 }
27
28 fn main() {}