about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/suggestions/fn-needing-specified-return-type-param.rs5
-rw-r--r--src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr11
2 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/fn-needing-specified-return-type-param.rs b/src/test/ui/suggestions/fn-needing-specified-return-type-param.rs
new file mode 100644
index 00000000000..2f140f823af
--- /dev/null
+++ b/src/test/ui/suggestions/fn-needing-specified-return-type-param.rs
@@ -0,0 +1,5 @@
+fn f<A>() -> A { unimplemented!() }
+fn foo() {
+    let _ = f; //~ ERROR type annotations needed for `fn() -> A`
+}
+fn main() {}
diff --git a/src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr b/src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr
new file mode 100644
index 00000000000..b59a3818e70
--- /dev/null
+++ b/src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr
@@ -0,0 +1,11 @@
+error[E0282]: type annotations needed for `fn() -> A`
+  --> $DIR/fn-needing-specified-return-type-param.rs:3:13
+   |
+LL |     let _ = f;
+   |         -   ^ cannot infer type for type parameter `A` declared on the function `f`
+   |         |
+   |         consider giving this pattern the explicit type `fn() -> A`, where the type parameter `A` is specified
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.