|
1 | | -error[E0277]: `?` couldn't convert the error to `TryFromSliceError` |
2 | | - --> $DIR/try-block-bad-type.rs:7:16 |
| 1 | +error[E0308]: mismatched types |
| 2 | + --> $DIR/try-block-bad-type.rs:7:9 |
3 | 3 | | |
4 | 4 | LL | Err("")?; |
5 | | - | -------^ the trait `From<&str>` is not implemented for `TryFromSliceError` |
6 | | - | | |
7 | | - | this can't be annotated with `?` because it has type `Result<_, &str>` |
8 | | - | |
9 | | - = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait |
10 | | -help: the trait `From<&str>` is not implemented for `TryFromSliceError` |
11 | | - but trait `From<Infallible>` is implemented for it |
12 | | - --> $SRC_DIR/core/src/array/mod.rs:LL:COL |
13 | | - = help: for that trait implementation, expected `Infallible`, found `&str` |
| 5 | + | ^^^^^^^^ expected `Result<u32, TryFromSliceError>`, found `Result<_, &str>` |
| 6 | + | |
| 7 | + = note: expected enum `Result<u32, TryFromSliceError>` |
| 8 | + found enum `Result<_, &str>` |
| 9 | +help: consider using `Result::expect` to unwrap the `Result<_, &str>` value, panicking if the value is a `Result::Err` |
| 10 | + | |
| 11 | +LL | Err("")?.expect("REASON"); |
| 12 | + | +++++++++++++++++ |
14 | 13 |
|
15 | 14 | error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str` |
16 | 15 | --> $DIR/try-block-bad-type.rs:12:9 |
@@ -42,5 +41,5 @@ LL | let res: i32 = try { 5 }; |
42 | 41 |
|
43 | 42 | error: aborting due to 5 previous errors |
44 | 43 |
|
45 | | -Some errors have detailed explanations: E0271, E0277. |
| 44 | +Some errors have detailed explanations: E0271, E0277, E0308. |
46 | 45 | For more information about an error, try `rustc --explain E0271`. |
0 commit comments