W3cubDocs

/Rust

Error code E0326

An implementation of a trait doesn't match the type constraint.

Erroneous code example:

#![allow(unused)]
fn main() {
trait Foo {
    const BAR: bool;
}

struct Bar;

impl Foo for Bar {
    const BAR: u32 = 5; // error, expected bool, found u32
}
}

The types of any associated constants in a trait implementation must match the types in the trait definition.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0326.html