Skip to content
Playground(another site)

bynk.generics.unknown_where_param

Error A method's where clause bounds a name that is not a type parameter of the method or of its receiver type.

A where clause bounds a type parameter, so it must name one: the function's own, or, for a method, its receiver type's. A name that is neither is usually a misspelling. Correct it, or declare the parameter in the brackets after the function's name. A bound that does not exist is bynk.generics.unknown_constraint.

Example

fn same[T](a: T) -> T where U: Eq { a } // ✗ `U` is not a parameter here
fn same[T](a: T) -> T where T: Eq { a } // ✓ bound a parameter that is declared

In the Book

See also

  • The grammar rule it governs: where_clause.
  • Every code in its category, Generics, on the diagnostic index.
  • bynk explain bynk.generics.unknown_where_param shows the same from the installed toolchain, without a network.