Skip to content

Commit ccdd6fe

Browse files
---
yaml --- r: 232648 b: refs/heads/try c: 6715ec8 h: refs/heads/master v: v3
1 parent bda57d8 commit ccdd6fe

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 8ef395fb7fba3b38e4b6aa4ff0d4b0db1524ee47
4+
refs/heads/try: 6715ec8da01816f1b3d0a0e47c88ff47d1559b4f
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_typeck/diagnostics.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2419,6 +2419,49 @@ for types as needed by the compiler, and it is currently disallowed to
24192419
explicitly implement it for a type.
24202420
"##,
24212421

2422+
E0323: r##"
2423+
An associated const was implemented when another trait item was expected.
2424+
Erroneous code example:
2425+
2426+
```Rust
2427+
trait Foo {
2428+
type N;
2429+
}
2430+
2431+
struct Bar;
2432+
2433+
impl Foo for Bar {
2434+
const N : u32 = 0;
2435+
// error: item `N` is an associated const, which doesn't match its
2436+
// trait `<Bar as Foo>`
2437+
}
2438+
```
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:
2442+
2443+
```Rust
2444+
struct Bar;
2445+
2446+
trait Foo {
2447+
type N;
2448+
}
2449+
2450+
impl Foo for Bar {
2451+
type N = u32; // ok!
2452+
}
2453+
2454+
// or:
2455+
trait Foo {
2456+
const N : u32;
2457+
}
2458+
2459+
impl Foo for Bar {
2460+
const N : u32 = 0; // ok!
2461+
}
2462+
```
2463+
"##,
2464+
24222465
E0326: r##"
24232466
The types of any associated constants in a trait implementation must match the
24242467
types in the trait definition. This error indicates that there was a mismatch.
@@ -2790,7 +2833,6 @@ register_diagnostics! {
27902833
E0319, // trait impls for defaulted traits allowed just for structs/enums
27912834
E0320, // recursive overflow during dropck
27922835
E0321, // extended coherence rules for defaulted traits violated
2793-
E0323, // implemented an associated const when another trait item expected
27942836
E0324, // implemented a method when another trait item expected
27952837
E0325, // implemented an associated type when another trait item expected
27962838
E0328, // cannot implement Unsize explicitly

0 commit comments

Comments
 (0)