diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index bac0231d61a1..9c70e47a0430 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -2423,7 +2423,7 @@ E0323: r##" An associated const was implemented when another trait item was expected. Erroneous code example: -```Rust +``` trait Foo { type N; } @@ -2440,7 +2440,7 @@ impl Foo for Bar { To fix this error, please check you didn't misspell the associated const name or you did implement the good trait item. Example: -```Rust +``` struct Bar; trait Foo { @@ -2462,6 +2462,45 @@ impl Foo for Bar { ``` "##, +E0324: r##" +A method was implemented when another trait item was expected. Erroneous +code example: + +``` +struct Bar; + +trait Foo { + const N : u32; + + fn M(); +} + +impl Foo for Bar { + fn N() {} + // error: item `N` is an associated method, which doesn't match its + // trait `` +} +``` + +To fix this error, please check you didn't misspell the method name. Example: + +``` +struct Bar; + +trait Foo { + const N : u32; + + fn M(); +} + +impl Foo for Bar { + const N : u32 = 0; + + fn M() {} // ok! +} +``` +"##, + E0326: r##" The types of any associated constants in a trait implementation must match the types in the trait definition. This error indicates that there was a mismatch.