“Expected type parameter” error in the constructor of a generic struct
Here’s a reproduction of your error: struct Foo<T> { val: T, } impl<T> Foo<T> { fn new() -> Self { Foo { val: true } } } fn main() {} The problem arises because you tried to lie to the compiler. This code: impl<T> Foo<T> { fn new() -> Self { /* … */ } … Read more