This is because of a type mismatch between the associated type of some trait (e.g., `T::Bar`, where `T` implements `trait Quux { type Bar; }`) and another type `U` that is required to be equal to `T::Bar`, but is not. Examples follow. Here is a basic example: ```compile_fail,E0271 trait Trait { type AssociatedType; } fn foo(t: T) where T: Trait { println!("in foo"); } impl Trait for i8 { type AssociatedType = &'static str; } foo(3_i8); ``` Here is that same example again, with some explanatory comments: ```compile_fail,E0271 trait Trait { type AssociatedType; } fn foo(t: T) where T: Trait { // ~~~~~~~~ ~~~~~~~~~~~~~~~~~~ // | | // This says `foo` can | // only be used with | // some type that | // implements `Trait`. | // | // This says not only must // `T` be an impl of `Trait` // but also that the impl // must assign the type `u32` // to the associated type. println!("in foo"); } impl Trait for i8 { type AssociatedType = &'static str; } //~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // | | // `i8` does have | // implementation | // of `Trait`... | // ... but it is an implementation // that assigns `&'static str` to // the associated type. foo(3_i8); // Here, we invoke `foo` with an `i8`, which does not satisfy // the constraint `::AssociatedType=u32`, and // therefore the type-checker complains with this error code. ``` To avoid those issues, you have to make the types match correctly. So we can fix the previous examples like this: ``` // Basic Example: trait Trait { type AssociatedType; } fn foo(t: T) where T: Trait { println!("in foo"); } impl Trait for i8 { type AssociatedType = &'static str; } foo(3_i8); // For-Loop Example: let vs = vec![1, 2, 3, 4]; for v in &vs { match v { &1 => {} _ => {} } } ```