]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/default.rs
Auto merge of #57118 - Zoxc:query-stats, r=wesleywiser
[rust.git] / src / test / ui / parser / default.rs
1 // compile-flags: -Z parse-only
2
3 // Test successful and unsuccessful parsing of the `default` contextual keyword
4
5 trait Foo {
6     fn foo<T: Default>() -> T;
7 }
8
9 impl Foo for u8 {
10     default fn foo<T: Default>() -> T {
11         T::default()
12     }
13 }
14
15 impl Foo for u16 {
16     pub default fn foo<T: Default>() -> T {
17         T::default()
18     }
19 }
20
21 impl Foo for u32 {
22     default pub fn foo<T: Default>() -> T { T::default() } //~ ERROR expected one of
23 }
24
25 fn main() {}