]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/closure_cap_coerce_many_fail.stderr
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
[rust.git] / tests / ui / closures / closure_cap_coerce_many_fail.stderr
1 error[E0308]: `match` arms have incompatible types
2   --> $DIR/closure_cap_coerce_many_fail.rs:9:16
3    |
4 LL |       let _ = match "+" {
5    |  _____________-
6 LL | |         "+" => add,
7    | |                --- this is found to be of type `fn(i32, i32) -> i32 {add}`
8 LL | |         "-" => |a, b| (a - b + cap) as i32,
9    | |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found closure
10 LL | |         _ => unimplemented!(),
11 LL | |     };
12    | |_____- `match` arms have incompatible types
13    |
14    = note: expected fn item `fn(i32, i32) -> i32 {add}`
15               found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:22]`
16
17 error[E0308]: `match` arms have incompatible types
18   --> $DIR/closure_cap_coerce_many_fail.rs:18:16
19    |
20 LL |       let _ = match "+" {
21    |  _____________-
22 LL | |         "+" => |a, b| (a + b) as i32,
23    | |                ---------------------
24    | |                |
25    | |                the expected closure
26    | |                this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22]`
27 LL | |         "-" => |a, b| (a - b + cap) as i32,
28    | |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
29 LL | |         _ => unimplemented!(),
30 LL | |     };
31    | |_____- `match` arms have incompatible types
32    |
33    = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22]`
34               found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:22]`
35    = note: no two closures, even if identical, have the same type
36    = help: consider boxing your closure and/or using it as a trait object
37
38 error[E0308]: `match` arms have incompatible types
39   --> $DIR/closure_cap_coerce_many_fail.rs:27:16
40    |
41 LL |       let _ = match "+" {
42    |  _____________-
43 LL | |         "+" => |a, b| (a + b + cap) as i32,
44    | |                ---------------------------
45    | |                |
46    | |                the expected closure
47    | |                this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22]`
48 LL | |         "-" => |a, b| (a - b) as i32,
49    | |                ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
50 LL | |         _ => unimplemented!(),
51 LL | |     };
52    | |_____- `match` arms have incompatible types
53    |
54    = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22]`
55               found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:22]`
56    = note: no two closures, even if identical, have the same type
57    = help: consider boxing your closure and/or using it as a trait object
58
59 error[E0308]: `match` arms have incompatible types
60   --> $DIR/closure_cap_coerce_many_fail.rs:35:16
61    |
62 LL |       let _ = match "+" {
63    |  _____________-
64 LL | |         "+" => |a, b| (a + b + cap) as i32,
65    | |                ---------------------------
66    | |                |
67    | |                the expected closure
68    | |                this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22]`
69 LL | |         "-" => |a, b| (a - b + cap) as i32,
70    | |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
71 LL | |         _ => unimplemented!(),
72 LL | |     };
73    | |_____- `match` arms have incompatible types
74    |
75    = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22]`
76               found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:22]`
77    = note: no two closures, even if identical, have the same type
78    = help: consider boxing your closure and/or using it as a trait object
79
80 error: aborting due to 4 previous errors
81
82 For more information about this error, try `rustc --explain E0308`.