File tree 1 file changed +8
-4
lines changed
src/librustc_error_codes/error_codes
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
- Only structural-match types (that is, types that derive ` PartialEq ` and ` Eq ` )
2
- may be used as the types of const generic parameters.
1
+ A non-structural-match type was used as the type of a const generic parameter.
2
+
3
+ Erroneous code example:
3
4
4
5
``` compile_fail,E0741
5
6
#![feature(const_generics)]
@@ -9,12 +10,15 @@ struct A;
9
10
struct B<const X: A>; // error!
10
11
```
11
12
12
- To fix this example, we derive ` PartialEq ` and ` Eq ` .
13
+ Only structural-match types (that is, types that derive ` PartialEq ` and ` Eq ` )
14
+ may be used as the types of const generic parameters.
15
+
16
+ To fix the previous code example, we derive ` PartialEq ` and ` Eq ` :
13
17
14
18
```
15
19
#![feature(const_generics)]
16
20
17
- #[derive(PartialEq, Eq)]
21
+ #[derive(PartialEq, Eq)] // We derive both traits here.
18
22
struct A;
19
23
20
24
struct B<const X: A>; // ok!
You can’t perform that action at this time.
0 commit comments