@@ -2437,8 +2437,8 @@ impl Foo for Bar {
2437
2437
}
2438
2438
```
2439
2439
2440
- To fix this error, please check you didn't misspell the associated const
2441
- name or you did implement the good trait item. Example:
2440
+ To fix this error, please verify you didn't misspell the associated
2441
+ const name or you did implement the good trait item. Example:
2442
2442
2443
2443
```
2444
2444
struct Bar;
@@ -2482,14 +2482,14 @@ impl Foo for Bar {
2482
2482
}
2483
2483
```
2484
2484
2485
- To fix this error, please check you didn't misspell the method name. Example:
2485
+ To fix this error, please verify you didn't misspell the method name. Example:
2486
2486
2487
2487
```
2488
2488
struct Bar;
2489
2489
2490
2490
trait Foo {
2491
2491
const N : u32;
2492
-
2492
+
2493
2493
fn M();
2494
2494
}
2495
2495
@@ -2501,6 +2501,50 @@ impl Foo for Bar {
2501
2501
```
2502
2502
"## ,
2503
2503
2504
+ E0325 : r##"
2505
+ An associated type was implemented when another trait item was expected.
2506
+ Erroneous code example:
2507
+
2508
+ ```
2509
+ struct Bar;
2510
+
2511
+ trait Foo {
2512
+ const N : u32;
2513
+ }
2514
+
2515
+ impl Foo for Bar {
2516
+ type N = u32;
2517
+ // error: item `N` is an associated type, which doesn't match its
2518
+ // trait `<Bar as Foo>`
2519
+ }
2520
+ ```
2521
+
2522
+ To fix this error, please verify you didn't misspell the associated type name
2523
+ and that your trait item implementation corresponds to the trait definition.
2524
+ Example:
2525
+
2526
+ ```
2527
+ struct Bar;
2528
+
2529
+ trait Foo {
2530
+ type N;
2531
+ }
2532
+
2533
+ impl Foo for Bar {
2534
+ type N = u32; // ok!
2535
+ }
2536
+
2537
+ //or:
2538
+ trait Foo {
2539
+ const N : u32;
2540
+ }
2541
+
2542
+ impl Foo for Bar {
2543
+ const N : u32 = 0; // ok!
2544
+ }
2545
+ ```
2546
+ "## ,
2547
+
2504
2548
E0326 : r##"
2505
2549
The types of any associated constants in a trait implementation must match the
2506
2550
types in the trait definition. This error indicates that there was a mismatch.
@@ -2872,8 +2916,6 @@ register_diagnostics! {
2872
2916
E0319 , // trait impls for defaulted traits allowed just for structs/enums
2873
2917
E0320 , // recursive overflow during dropck
2874
2918
E0321 , // extended coherence rules for defaulted traits violated
2875
- E0324 , // implemented a method when another trait item expected
2876
- E0325 , // implemented an associated type when another trait item expected
2877
2919
E0328 , // cannot implement Unsize explicitly
2878
2920
E0329 , // associated const depends on type parameter or Self.
2879
2921
E0370 , // discriminant overflow
0 commit comments