blob: 9df01a4cf5b16e008f29f6d89da47c4f36c38bed [file] [log] [blame]
error[E0308]: mismatched types
--> $DIR/try-block-bad-type.rs:7:9
|
LL | Err("")?;
| ^^^^^^^^ expected `Result<u32, TryFromSliceError>`, found `Result<_, &str>`
|
= note: expected enum `Result<u32, TryFromSliceError>`
found enum `Result<_, &str>`
help: consider using `Result::expect` to unwrap the `Result<_, &str>` value, panicking if the value is a `Result::Err`
|
LL | Err("")?.expect("REASON");
| +++++++++++++++++
error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str`
--> $DIR/try-block-bad-type.rs:12:9
|
LL | ""
| ^^ expected `&str`, found `i32`
error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == ()`
--> $DIR/try-block-bad-type.rs:15:39
|
LL | let res: Result<i32, i32> = try { };
| ^ expected `()`, found `i32`
error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`)
--> $DIR/try-block-bad-type.rs:17:25
|
LL | let res: () = try { };
| ^ could not wrap the final value of the block as `()` doesn't implement `Try`
|
= help: the trait `Try` is not implemented for `()`
error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`)
--> $DIR/try-block-bad-type.rs:20:26
|
LL | let res: i32 = try { 5 };
| ^ could not wrap the final value of the block as `i32` doesn't implement `Try`
|
= help: the trait `Try` is not implemented for `i32`
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0271, E0277, E0308.
For more information about an error, try `rustc --explain E0271`.