We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ab8f33 commit 668b954Copy full SHA for 668b954
tests/ui/coercion/closure-in-array.rs
@@ -0,0 +1,7 @@
1
+// Weakened closure sig inference by #140283.
2
+fn foo<F: FnOnce(&str) -> usize, const N: usize>(x: [F; N]) {}
3
+
4
+fn main() {
5
+ foo([|s| s.len()])
6
+ //~^ ERROR: type annotations needed
7
+}
tests/ui/coercion/closure-in-array.stderr
@@ -0,0 +1,14 @@
+error[E0282]: type annotations needed
+ --> $DIR/closure-in-array.rs:5:11
+ |
+LL | foo([|s| s.len()])
+ | ^ - type must be known at this point
+help: consider giving this closure parameter an explicit type
8
9
+LL | foo([|s: /* Type */| s.len()])
10
+ | ++++++++++++
11
12
+error: aborting due to 1 previous error
13
14
+For more information about this error, try `rustc --explain E0282`.
0 commit comments