summaryrefslogtreecommitdiffstats
path: root/src/librustc_error_codes/error_codes/E0107.md
blob: bfe0d21f3129b227862af561c5f66dd025638c7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
This error means that an incorrect number of generic arguments were provided:

```compile_fail,E0107
struct Foo<T> { x: T }

struct Bar { x: Foo }             // error: wrong number of type arguments:
                                  //        expected 1, found 0
struct Baz<S, T> { x: Foo<S, T> } // error: wrong number of type arguments:
                                  //        expected 1, found 2

fn foo<T, U>(x: T, y: U) {}

fn main() {
    let x: bool = true;
    foo::<bool>(x);                 // error: wrong number of type arguments:
                                    //        expected 2, found 1
    foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments:
                                    //        expected 2, found 3
}

fn f() {}

fn main() {
    f::<'static>(); // error: wrong number of lifetime arguments:
                    //        expected 0, found 1
}
```