]> git.proxmox.com Git - rustc.git/blame - src/test/ui/try-block/try-block-bad-type.stderr
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / ui / try-block / try-block-bad-type.stderr
CommitLineData
6a06907d 1error[E0277]: `?` couldn't convert the error to `TryFromSliceError`
48663c56 2 --> $DIR/try-block-bad-type.rs:7:16
b7449926 3 |
532ac7d7 4LL | Err("")?;
6a06907d 5 | ^ the trait `From<&str>` is not implemented for `TryFromSliceError`
b7449926 6 |
48663c56 7 = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
04454e1e 8 = help: the trait `From<Infallible>` is implemented for `TryFromSliceError`
f2b60f7d 9 = note: required for `Result<u32, TryFromSliceError>` to implement `FromResidual<Result<Infallible, &str>>`
b7449926 10
17df50a5 11error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str`
0731742a 12 --> $DIR/try-block-bad-type.rs:12:9
b7449926 13 |
532ac7d7 14LL | ""
60c5eb7d 15 | ^^ expected `i32`, found `&str`
b7449926 16
17df50a5 17error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == ()`
0731742a 18 --> $DIR/try-block-bad-type.rs:15:39
b7449926 19 |
532ac7d7 20LL | let res: Result<i32, i32> = try { };
60c5eb7d 21 | ^ expected `i32`, found `()`
b7449926 22
17df50a5 23error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`)
29967ef6 24 --> $DIR/try-block-bad-type.rs:17:25
b7449926 25 |
532ac7d7 26LL | let res: () = try { };
17df50a5 27 | ^ could not wrap the final value of the block as `()` doesn't implement `Try`
b7449926 28 |
17df50a5 29 = help: the trait `Try` is not implemented for `()`
b7449926 30
17df50a5
XL
31error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`)
32 --> $DIR/try-block-bad-type.rs:20:26
b7449926 33 |
532ac7d7 34LL | let res: i32 = try { 5 };
17df50a5 35 | ^ could not wrap the final value of the block as `i32` doesn't implement `Try`
b7449926 36 |
17df50a5 37 = help: the trait `Try` is not implemented for `i32`
b7449926 38
17df50a5 39error: aborting due to 5 previous errors
b7449926 40
48663c56 41Some errors have detailed explanations: E0271, E0277.
b7449926 42For more information about an error, try `rustc --explain E0271`.