]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/closure-no-fn-4.stderr
Rollup merge of #106763 - lenko-d:106659-Print_why_a_test_was_ignored_if_its_the_only...
[rust.git] / tests / ui / closures / closure-no-fn-4.stderr
1 error[E0308]: `match` arms have incompatible types
2   --> $DIR/closure-no-fn-4.rs:5:18
3    |
4 LL |       let _: fn(usize) -> usize = match true {
5    |  _________________________________-
6 LL | |         true => |a| a + 1,
7    | |                 --------- this is found to be of type `fn(usize) -> usize`
8 LL | |         false => |a| a - b,
9    | |                  ^^^^^^^^^ expected fn pointer, found closure
10 LL | |
11 LL | |     };
12    | |_____- `match` arms have incompatible types
13    |
14    = note: expected fn pointer `fn(usize) -> usize`
15                  found closure `[closure@$DIR/closure-no-fn-4.rs:5:18: 5:21]`
16 note: closures can only be coerced to `fn` types if they do not capture any variables
17   --> $DIR/closure-no-fn-4.rs:5:26
18    |
19 LL |         false => |a| a - b,
20    |                          ^ `b` captured here
21
22 error: aborting due to previous error
23
24 For more information about this error, try `rustc --explain E0308`.