fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.4 KiB34 linesraw
1error[E0308]: mismatched types
2  --> $DIR/issue-24036.rs:3:9
3   |
4LL |     let mut x = |c| c + 1;
5   |                 --------- the expected closure
6LL |     x = |c| c + 1;
7   |         ^^^^^^^^^ expected closure, found a different closure
8   |
9   = note: expected closure `[closure@$DIR/issue-24036.rs:2:17: 2:26]`
10              found closure `[closure@$DIR/issue-24036.rs:3:9: 3:18]`
11   = note: no two closures, even if identical, have the same type
12   = help: consider boxing your closure and/or using it as a trait object
13
14error[E0308]: `match` arms have incompatible types
15  --> $DIR/issue-24036.rs:10:14
16   |
17LL |       let x = match 1usize {
18   |  _____________-
19LL | |         1 => |c| c + 1,
20   | |              --------- this is found to be of type `[closure@$DIR/issue-24036.rs:9:14: 9:23]`
21LL | |         2 => |c| c - 1,
22   | |              ^^^^^^^^^ expected closure, found a different closure
23LL | |         _ => |c| c - 1
24LL | |     };
25   | |_____- `match` arms have incompatible types
26   |
27   = note: expected type `[closure@$DIR/issue-24036.rs:9:14: 9:23]`
28           found closure `[closure@$DIR/issue-24036.rs:10:14: 10:23]`
29   = note: no two closures, even if identical, have the same type
30   = help: consider boxing your closure and/or using it as a trait object
31
32error: aborting due to 2 previous errors
33
34For more information about this error, try `rustc --explain E0308`.