1 // It might be intuitive for a user coming from languages like Java
2 // to declare a method directly in a struct's definition. Make sure
3 // rustc can give a helpful suggestion.
4 // Suggested in issue #76421
10 //~^ ERROR functions are not allowed in struct definitions
11 //~| HELP unlike in C++, Java, and C#, functions are declared in `impl` blocks
12 //~| HELP see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information
19 //~^ ERROR functions are not allowed in union definitions
20 //~| HELP unlike in C++, Java, and C#, functions are declared in `impl` blocks
21 //~| HELP see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information
28 //~^ ERROR functions are not allowed in enum definitions
29 //~| HELP unlike in C++, Java, and C#, functions are declared in `impl` blocks
30 //~| HELP see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information
31 //~| HELP enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`