File tree 3 files changed +21
-14
lines changed
src/librustc_error_codes/error_codes
3 files changed +21
-14
lines changed Original file line number Diff line number Diff line change 1
- This error indicates that the compiler was unable to sensibly evaluate a
2
- constant expression that had to be evaluated. Attempting to divide by 0
3
- or causing integer overflow are two ways to induce this error. For example:
1
+ A constant value failed to get evaluated.
2
+
3
+ Erroneous code example:
4
4
5
5
``` compile_fail,E0080
6
6
enum Enum {
7
7
X = (1 << 500),
8
- Y = (1 / 0)
8
+ Y = (1 / 0),
9
9
}
10
10
```
11
11
12
+ This error indicates that the compiler was unable to sensibly evaluate a
13
+ constant expression that had to be evaluated. Attempting to divide by 0
14
+ or causing an integer overflow are two ways to induce this error.
15
+
12
16
Ensure that the expressions given can be evaluated as the desired integer type.
13
17
See the FFI section of the Reference for more information about using a custom
14
18
integer type:
Original file line number Diff line number Diff line change 1
- Enum discriminants are used to differentiate enum variants stored in memory .
2
- This error indicates that the same value was used for two or more variants,
3
- making them impossible to tell apart.
1
+ A discrimant value is present more than once .
2
+
3
+ Erroneous code example:
4
4
5
5
``` compile_fail,E0081
6
- // Bad.
7
6
enum Enum {
8
7
P = 3,
9
- X = 3,
8
+ X = 3, // error!
10
9
Y = 5,
11
10
}
12
11
```
13
12
13
+ Enum discriminants are used to differentiate enum variants stored in memory.
14
+ This error indicates that the same value was used for two or more variants,
15
+ making it impossible to distinguish them.
16
+
14
17
```
15
- // Good.
16
18
enum Enum {
17
19
P,
18
- X = 3,
20
+ X = 3, // ok!
19
21
Y = 5,
20
22
}
21
23
```
@@ -27,7 +29,7 @@ variants.
27
29
``` compile_fail,E0081
28
30
enum Bad {
29
31
X,
30
- Y = 0
32
+ Y = 0, // error!
31
33
}
32
34
```
33
35
Original file line number Diff line number Diff line change 1
- You gave an unnecessary type or const parameter in a type alias. Erroneous
2
- code example:
1
+ An unnecessary type or const parameter was given in a type alias.
2
+
3
+ Erroneous code example:
3
4
4
5
``` compile_fail,E0091
5
6
type Foo<T> = u32; // error: type parameter `T` is unused
You can’t perform that action at this time.
0 commit comments