fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.3 KiB39 linesraw
1error: functions are not allowed in struct definitions
2  --> $DIR/struct-fn-in-definition.rs:9:5
3   |
4LL | struct S {
5   |        - while parsing this struct
6...
7LL |     fn foo() {}
8   |     ^^^^^^^^^^^
9   |
10   = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks
11   = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information
12
13error: functions are not allowed in union definitions
14  --> $DIR/struct-fn-in-definition.rs:18:5
15   |
16LL | union U {
17   |       - while parsing this union
18...
19LL |     fn foo() {}
20   |     ^^^^^^^^^^^
21   |
22   = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks
23   = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information
24
25error: functions are not allowed in enum definitions
26  --> $DIR/struct-fn-in-definition.rs:27:5
27   |
28LL | enum E {
29   |      - while parsing this enum
30...
31LL |     fn foo() {}
32   |     ^^^^^^^^^^^
33   |
34   = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks
35   = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information
36   = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`
37
38error: aborting due to 3 previous errors
39