fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
927 B24 linesraw
1error[E0308]: `match` arms have incompatible types
2  --> $DIR/closure-no-fn-4.rs:5:18
3   |
4LL |       let _: fn(usize) -> usize = match true {
5   |  _________________________________-
6LL | |         true => |a| a + 1,
7   | |                 --------- this is found to be of type `fn(usize) -> usize`
8LL | |         false => |a| a - b,
9   | |                  ^^^^^^^^^ expected fn pointer, found closure
10LL | |
11LL | |     };
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}`
16note: 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   |
19LL |         false => |a| a - b,
20   |                          ^ `b` captured here
21
22error: aborting due to previous error
23
24For more information about this error, try `rustc --explain E0308`.