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