|
| 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 type `fn(i32, i32) -> i32 {add}` |
| 15 | + found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:43 cap:_]` |
| 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 | + | | --------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]` |
| 24 | +LL | | "-" => |a, b| (a - b + cap) as i32, |
| 25 | + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure |
| 26 | +LL | | _ => unimplemented!(), |
| 27 | +LL | | }; |
| 28 | + | |_____- `match` arms have incompatible types |
| 29 | + | |
| 30 | + = note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]` |
| 31 | + found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:43 cap:_]` |
| 32 | + = note: no two closures, even if identical, have the same type |
| 33 | + = help: consider boxing your closure and/or using it as a trait object |
| 34 | + |
| 35 | +error[E0308]: `match` arms have incompatible types |
| 36 | + --> $DIR/closure_cap_coerce_many_fail.rs:27:16 |
| 37 | + | |
| 38 | +LL | let _ = match "+" { |
| 39 | + | _____________- |
| 40 | +LL | | "+" => |a, b| (a + b + cap) as i32, |
| 41 | + | | --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43 cap:_]` |
| 42 | +LL | | "-" => |a, b| (a - b) as i32, |
| 43 | + | | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure |
| 44 | +LL | | _ => unimplemented!(), |
| 45 | +LL | | }; |
| 46 | + | |_____- `match` arms have incompatible types |
| 47 | + | |
| 48 | + = note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43 cap:_]` |
| 49 | + found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:37]` |
| 50 | + = note: no two closures, even if identical, have the same type |
| 51 | + = help: consider boxing your closure and/or using it as a trait object |
| 52 | + |
| 53 | +error[E0308]: `match` arms have incompatible types |
| 54 | + --> $DIR/closure_cap_coerce_many_fail.rs:35:16 |
| 55 | + | |
| 56 | +LL | let _ = match "+" { |
| 57 | + | _____________- |
| 58 | +LL | | "+" => |a, b| (a + b + cap) as i32, |
| 59 | + | | --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43 cap:_]` |
| 60 | +LL | | "-" => |a, b| (a - b + cap) as i32, |
| 61 | + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure |
| 62 | +LL | | _ => unimplemented!(), |
| 63 | +LL | | }; |
| 64 | + | |_____- `match` arms have incompatible types |
| 65 | + | |
| 66 | + = note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43 cap:_]` |
| 67 | + found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:43 cap:_]` |
| 68 | + = note: no two closures, even if identical, have the same type |
| 69 | + = help: consider boxing your closure and/or using it as a trait object |
| 70 | + |
| 71 | +error: aborting due to 4 previous errors |
| 72 | + |
| 73 | +For more information about this error, try `rustc --explain E0308`. |
0 commit comments