1 An incorrect number of generic arguments were provided.
3 Erroneous code example:
8 struct Bar { x: Foo } // error: wrong number of type arguments:
10 struct Baz<S, T> { x: Foo<S, T> } // error: wrong number of type arguments:
11 // expected 1, found 2
13 fn foo<T, U>(x: T, y: U) {}
18 foo::<bool>(x); // error: wrong number of type arguments:
19 // expected 2, found 1
20 foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments:
21 // expected 2, found 3
22 f::<'static>(); // error: wrong number of lifetime arguments
23 // expected 0, found 1
27 When using/declaring an item with generic arguments, you must provide the exact
31 struct Foo<T> { x: T }
33 struct Bar<T> { x: Foo<T> } // ok!
34 struct Baz<S, T> { x: Foo<S>, y: Foo<T> } // ok!
36 fn foo<T, U>(x: T, y: U) {}
41 foo::<bool, u32>(x, 12); // ok!