summaryrefslogtreecommitdiffstats
path: root/src/test/ui/type/type-check/unknown_type_for_closure.stderr
blob: 9ae97f390d3e4bcb04fb13431c64092f8fc4051e (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
28
29
30
31
32
33
34
35
36
37
error[E0282]: type annotations needed
  --> $DIR/unknown_type_for_closure.rs:2:13
   |
LL |     let x = |b: Vec<_>| {};
   |             ^^^^^^^^^^^^^^ cannot infer type for struct `Vec<_>`

error[E0282]: type annotations needed
  --> $DIR/unknown_type_for_closure.rs:6:14
   |
LL |     let x = |_| {};
   |              ^
   |
help: consider giving this closure parameter an explicit type
   |
LL |     let x = |_: _| {};
   |               +++

error[E0282]: type annotations needed
  --> $DIR/unknown_type_for_closure.rs:10:14
   |
LL |     let x = |k: _| {};
   |              ^ cannot infer type

error[E0282]: type annotations needed
  --> $DIR/unknown_type_for_closure.rs:14:28
   |
LL |     let x = || -> Vec<_> { Vec::new() };
   |                            ^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Vec`
   |
help: consider specifying the generic argument
   |
LL |     let x = || -> Vec<_> { Vec::<T>::new() };
   |                               +++++

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0282`.