Skip to content

Commit 60bf83d

Browse files
authored
Rollup merge of #74977 - GuillaumeGomez:cleanup-e0741, r=pickfire
Clean up E0741 error explanation r? @Dylan-DPC
2 parents cfdf9d3 + 1a6730e commit 60bf83d

File tree

1 file changed

+8
-4
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+8
-4
lines changed

src/librustc_error_codes/error_codes/E0741.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
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;
910
struct 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.
1822
struct A;
1923
2024
struct B<const X: A>; // ok!

0 commit comments

Comments
 (0)