Skip to content
ZOLO / TE305 Type · error

associated type contract is incomplete or invalid

Compiler diagnostic TE305: associated type contract is incomplete or invalid.

Why this fires

An implementation omits a required associated type, defines it more than once, names an associated type the trait does not declare, or supplies a type that fails the associated type's bounds.

trait Source {
    type Item
    fn next(self) -> Self::Item
}

struct Values {}
impl Source for Values {
//   ^^^^^^ error[TE305]: missing associated type `Item`
    fn next(self) -> int { 0 }
}

Fix it

Define every associated type without a default exactly once, using the spelling from the trait. The selected concrete type must implement all declared associated bounds.

impl Source for Values {
    type Item = int
    fn next(self) -> int { 0 }
}

See also

  • TE304 — a method signature is incompatible.
  • TE825 — a required method is missing.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en