Skip to content
ZOLO / TE482 Type · error

trait type arguments are incompatible with the required witness

The concrete type implements the requested trait name, but with different type arguments. Trait witnesses are exact — implementing `Sink<str>` does not prove `Sink<int>`.

Why this fires

The concrete type implements the requested trait name, but with different type arguments. Trait witnesses are exact: implementing Sink<str> does not prove Sink<int>.

trait Sink<T> { fn push(self, value: T) }
struct Log {}
impl Sink<str> for Log { fn push(self, value: str) {} }

fn write_int<S>(sink: S) where S: Sink<int> {}
write_int(Log {})
//        ^ error[TE482]: found Sink<str>, required Sink<int>

Fix it

Pass a type with the exact required witness, change the generic bound, or add a non-overlapping implementation for the required arguments when the semantics are valid.

See also

  • TE820 — trait is not implemented at all.
  • TE480 — associated type bound failure.
  • specs/gradual-type-precision.html.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br