summaryrefslogtreecommitdiffstats
path: root/src/test/ui/type/type-check/unknown_type_for_closure.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/type/type-check/unknown_type_for_closure.stderr')
-rw-r--r--src/test/ui/type/type-check/unknown_type_for_closure.stderr37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.stderr b/src/test/ui/type/type-check/unknown_type_for_closure.stderr
new file mode 100644
index 000000000..9ae97f390
--- /dev/null
+++ b/src/test/ui/type/type-check/unknown_type_for_closure.stderr
@@ -0,0 +1,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`.