]> git.lizzy.rs Git - rust.git/blob - tests/ui/parser/kw-in-trait-bounds.rs
Rollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplett
[rust.git] / tests / ui / parser / kw-in-trait-bounds.rs
1 // edition:2018
2
3 fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
4 //~^ ERROR expected identifier, found keyword `fn`
5 //~| ERROR expected identifier, found keyword `fn`
6 //~| ERROR expected identifier, found keyword `fn`
7 //~| HELP use `Fn` to refer to the trait
8 //~| HELP use `Fn` to refer to the trait
9 //~| HELP use `Fn` to refer to the trait
10 where
11 G: fn(),
12     //~^ ERROR expected identifier, found keyword `fn`
13     //~| HELP use `Fn` to refer to the trait
14 {}
15
16 fn _g<A: struct, B>(_: impl struct, _: &dyn struct)
17 //~^ ERROR expected identifier, found keyword `struct`
18 //~| ERROR expected identifier, found keyword `struct`
19 //~| ERROR expected identifier, found keyword `struct`
20 //~| ERROR cannot find trait `r#struct` in this scope
21 //~| ERROR cannot find trait `r#struct` in this scope
22 //~| ERROR cannot find trait `r#struct` in this scope
23 //~| HELP  a trait with a similar name exists
24 //~| HELP  a trait with a similar name exists
25 //~| HELP  a trait with a similar name exists
26 //~| HELP  escape `struct` to use it as an identifier
27 //~| HELP  escape `struct` to use it as an identifier
28 //~| HELP  escape `struct` to use it as an identifier
29 where
30     B: struct,
31     //~^ ERROR expected identifier, found keyword `struct`
32     //~| ERROR cannot find trait `r#struct` in this scope
33     //~| HELP  a trait with a similar name exists
34     //~| HELP  escape `struct` to use it as an identifier
35 {}
36
37 trait Struct {}
38
39 fn main() {}