fork/rust
git clone https://git.julia.blue/fork/rust
4fb7144ed15
1.43.0
1error[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 | 4LL | / fn a_function() -> u32 { 5LL | | let x: Option<u32> = None; 6LL | | x?; 7 | | ^^ cannot use the `?` operator in a function that returns `u32` 8LL | | 22 9LL | | } 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 15error[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 | 18LL | let a_closure = || { 19 | _____________________- 20LL | | let x: Option<u32> = None; 21LL | | x?; 22 | | ^^ cannot use the `?` operator in a closure that returns `{integer}` 23LL | | 22 24LL | | }; 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 30error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `std::ops::Try`) 31 --> $DIR/try-on-option-diagnostics.rs:26:13 32 | 33LL | / fn a_method() { 34LL | | let x: Option<u32> = None; 35LL | | x?; 36 | | ^^ cannot use the `?` operator in a method that returns `()` 37LL | | } 38 | |_________- this function should return `Result` or `Option` to accept `?` 39 | 40 = help: the trait `std::ops::Try` is not implemented for `()` 41 = note: required by `std::ops::Try::from_error` 42 43error[E0277]: the `?` operator can only be used in a trait method that returns `Result` or `Option` (or another type that implements `std::ops::Try`) 44 --> $DIR/try-on-option-diagnostics.rs:39:13 45 | 46LL | / fn a_trait_method() { 47LL | | let x: Option<u32> = None; 48LL | | x?; 49 | | ^^ cannot use the `?` operator in a trait method that returns `()` 50LL | | } 51 | |_________- this function should return `Result` or `Option` to accept `?` 52 | 53 = help: the trait `std::ops::Try` is not implemented for `()` 54 = note: required by `std::ops::Try::from_error` 55 56error: aborting due to 4 previous errors 57 58For more information about this error, try `rustc --explain E0277`.