]> git.proxmox.com Git - rustc.git/blob - src/test/ui/try-trait/try-operator-on-main.stderr
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / ui / try-trait / try-operator-on-main.stderr
1 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
2 --> $DIR/try-operator-on-main.rs:7:31
3 |
4 LL | fn main() {
5 | --------- this function should return `Result` or `Option` to accept `?`
6 LL | // error for a `Try` type on a non-`Try` fn
7 LL | std::fs::File::open("foo")?;
8 | ^ cannot use the `?` operator in a function that returns `()`
9 |
10 = help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()`
11
12 error[E0277]: the `?` operator can only be applied to values that implement `Try`
13 --> $DIR/try-operator-on-main.rs:10:5
14 |
15 LL | ()?;
16 | ^^^ the `?` operator cannot be applied to type `()`
17 |
18 = help: the trait `Try` is not implemented for `()`
19
20 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
21 --> $DIR/try-operator-on-main.rs:10:7
22 |
23 LL | fn main() {
24 | --------- this function should return `Result` or `Option` to accept `?`
25 ...
26 LL | ()?;
27 | ^ cannot use the `?` operator in a function that returns `()`
28 |
29 = help: the trait `FromResidual<_>` is not implemented for `()`
30
31 error[E0277]: the trait bound `(): Try` is not satisfied
32 --> $DIR/try-operator-on-main.rs:14:25
33 |
34 LL | try_trait_generic::<()>();
35 | ^^ the trait `Try` is not implemented for `()`
36 |
37 note: required by a bound in `try_trait_generic`
38 --> $DIR/try-operator-on-main.rs:17:25
39 |
40 LL | fn try_trait_generic<T: Try>() -> T {
41 | ^^^ required by this bound in `try_trait_generic`
42
43 error[E0277]: the `?` operator can only be applied to values that implement `Try`
44 --> $DIR/try-operator-on-main.rs:19:5
45 |
46 LL | ()?;
47 | ^^^ the `?` operator cannot be applied to type `()`
48 |
49 = help: the trait `Try` is not implemented for `()`
50
51 error: aborting due to 5 previous errors
52
53 For more information about this error, try `rustc --explain E0277`.