]> git.lizzy.rs Git - rust.git/blob - src/test/ui/try-on-option-diagnostics.stderr
Mark __msan_track_origins as an exported symbol for LTO
[rust.git] / src / test / ui / try-on-option-diagnostics.stderr
1 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
2   --> $DIR/try-on-option-diagnostics.rs:7:5
3    |
4 LL | / fn a_function() -> u32 {
5 LL | |     let x: Option<u32> = None;
6 LL | |     x?;
7    | |     ^^ cannot use the `?` operator in a function that returns `u32`
8 LL | |     22
9 LL | | }
10    | |_- this function should return `Result` or `Option` to accept `?`
11    |
12    = help: the trait `std::ops::Try` is not implemented for `u32`
13    = note: required by `std::ops::Try::from_error`
14
15 error[E0277]: the `?` operator can only be used in a closure that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
16   --> $DIR/try-on-option-diagnostics.rs:14:9
17    |
18 LL |       let a_closure = || {
19    |  _____________________-
20 LL | |         let x: Option<u32> = None;
21 LL | |         x?;
22    | |         ^^ cannot use the `?` operator in a closure that returns `{integer}`
23 LL | |         22
24 LL | |     };
25    | |_____- this function should return `Result` or `Option` to accept `?`
26    |
27    = help: the trait `std::ops::Try` is not implemented for `{integer}`
28    = note: required by `std::ops::Try::from_error`
29
30 error: aborting due to 2 previous errors
31
32 For more information about this error, try `rustc --explain E0277`.