summary refs log tree commit diff
path: root/src/test/ui/try-operator-on-main.stderr
blob: 9a2052f72835d8850696c9a96c7a104e614d948b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
  --> $DIR/try-operator-on-main.rs:9:5
   |
LL |     std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()`
   |
   = help: the trait `std::ops::Try` is not implemented for `()`
   = note: required by `std::ops::Try::from_error`

error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
  --> $DIR/try-operator-on-main.rs:12:5
   |
LL |     ()?; //~ ERROR the `?` operator can only
   |     ^^^ the `?` operator cannot be applied to type `()`
   |
   = help: the trait `std::ops::Try` is not implemented for `()`
   = note: required by `std::ops::Try::into_result`

error[E0277]: the trait bound `(): std::ops::Try` is not satisfied
  --> $DIR/try-operator-on-main.rs:15:5
   |
LL |     try_trait_generic::<()>(); //~ ERROR the trait bound
   |     ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()`
   |
note: required by `try_trait_generic`
  --> $DIR/try-operator-on-main.rs:20:1
   |
LL | fn try_trait_generic<T: Try>() -> T {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
  --> $DIR/try-operator-on-main.rs:22:5
   |
LL |     ()?; //~ ERROR the `?` operator can only
   |     ^^^ the `?` operator cannot be applied to type `()`
   |
   = help: the trait `std::ops::Try` is not implemented for `()`
   = note: required by `std::ops::Try::into_result`

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0277`.