]> git.lizzy.rs Git - rust.git/blob - src/test/ui/try-block/try-block-bad-type.stderr
Auto merge of #57714 - matthewjasper:wellformed-unreachable, r=pnkfelix
[rust.git] / src / test / ui / try-block / try-block-bad-type.stderr
1 error[E0277]: the trait bound `i32: std::convert::From<&str>` is not satisfied
2   --> $DIR/try-block-bad-type.rs:7:9
3    |
4 LL |         Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied
5    |         ^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32`
6    |
7    = help: the following implementations were found:
8              <i32 as std::convert::From<bool>>
9              <i32 as std::convert::From<core::num::NonZeroI32>>
10              <i32 as std::convert::From<i16>>
11              <i32 as std::convert::From<i8>>
12            and 2 others
13    = note: required by `std::convert::From::from`
14
15 error[E0271]: type mismatch resolving `<std::result::Result<i32, i32> as std::ops::Try>::Ok == &str`
16   --> $DIR/try-block-bad-type.rs:12:9
17    |
18 LL |         "" //~ ERROR type mismatch
19    |         ^^ expected i32, found &str
20    |
21    = note: expected type `i32`
22               found type `&str`
23
24 error[E0271]: type mismatch resolving `<std::result::Result<i32, i32> as std::ops::Try>::Ok == ()`
25   --> $DIR/try-block-bad-type.rs:15:39
26    |
27 LL |     let res: Result<i32, i32> = try { }; //~ ERROR type mismatch
28    |                                       ^ expected i32, found ()
29    |
30    = note: expected type `i32`
31               found type `()`
32
33 error[E0277]: the trait bound `(): std::ops::Try` is not satisfied
34   --> $DIR/try-block-bad-type.rs:17:23
35    |
36 LL |     let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not satisfied
37    |                       ^^^ the trait `std::ops::Try` is not implemented for `()`
38    |
39    = note: required by `std::ops::Try::from_ok`
40
41 error[E0277]: the trait bound `i32: std::ops::Try` is not satisfied
42   --> $DIR/try-block-bad-type.rs:19:24
43    |
44 LL |     let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied
45    |                        ^^^^^ the trait `std::ops::Try` is not implemented for `i32`
46    |
47    = note: required by `std::ops::Try::from_ok`
48
49 error: aborting due to 5 previous errors
50
51 Some errors occurred: E0271, E0277.
52 For more information about an error, try `rustc --explain E0271`.