File tree 3 files changed +35
-13
lines changed
src/librustc_error_codes/error_codes
3 files changed +35
-13
lines changed Original file line number Diff line number Diff line change 1
- A binary can only have one entry point, and by default that entry point is the
2
- function ` main() ` . If there are multiple such functions, please rename one.
1
+ More than one ` main ` function was found.
3
2
4
3
Erroneous code example:
5
4
@@ -14,3 +13,7 @@ fn main() { // error!
14
13
// ...
15
14
}
16
15
```
16
+
17
+ A binary can only have one entry point, and by default that entry point is the
18
+ ` main() ` function. If there are multiple instances of this function, please
19
+ rename one of them.
Original file line number Diff line number Diff line change 1
- A value was moved. However, its size was not known at compile time, and only
2
- values of a known size can be moved.
1
+ A value was moved whose size was not known at compile time.
3
2
4
3
Erroneous code example:
5
4
Original file line number Diff line number Diff line change 1
- This error means that an attempt was made to match a struct type enum
2
- variant as a non-struct type:
1
+ Something which is neither a tuple struct nor a tuple variant was used as a
2
+ pattern.
3
+
4
+ Erroneous code example:
3
5
4
6
``` compile_fail,E0164
5
- enum Foo { B { i: u32 } }
7
+ enum A {
8
+ B,
9
+ C,
10
+ }
11
+
12
+ impl A {
13
+ fn new() {}
14
+ }
6
15
7
- fn bar(foo: Foo) -> u32 {
16
+ fn bar(foo: A) {
8
17
match foo {
9
- Foo::B(i) => i, // error E0164
18
+ A::new() => (), // error!
19
+ _ => {}
10
20
}
11
21
}
12
22
```
13
23
14
- Try using ` {} ` instead:
24
+ This error means that an attempt was made to match something which is neither a
25
+ tuple struct nor a tuple variant. Only these two elements are allowed as a
26
+ pattern:
15
27
16
28
```
17
- enum Foo { B { i: u32 } }
29
+ enum A {
30
+ B,
31
+ C,
32
+ }
33
+
34
+ impl A {
35
+ fn new() {}
36
+ }
18
37
19
- fn bar(foo: Foo) -> u32 {
38
+ fn bar(foo: A) {
20
39
match foo {
21
- Foo::B{i} => i,
40
+ A::B => (), // ok!
41
+ _ => {}
22
42
}
23
43
}
24
44
```
You can’t perform that action at this time.
0 commit comments