File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 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:
34
45``` compile_fail,E0741
56#![feature(const_generics)]
@@ -9,12 +10,15 @@ struct A;
910struct B<const X: A>; // error!
1011```
1112
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 ` :
1317
1418```
1519#![feature(const_generics)]
1620
17- #[derive(PartialEq, Eq)]
21+ #[derive(PartialEq, Eq)] // We derive both traits here.
1822struct A;
1923
2024struct B<const X: A>; // ok!
You can’t perform that action at this time.
0 commit comments