fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) 2 --> $DIR/try-on-option-diagnostics.rs:7:6 3 | 4LL | fn a_function() -> u32 { 5 | ---------------------- this function should return `Result` or `Option` to accept `?` 6LL | let x: Option<u32> = None; 7LL | x?; 8 | ^ cannot use the `?` operator in a function that returns `u32` 9 | 10 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32` 11 12error[E0277]: the `?` operator can only be used in a closure that returns `Result` or `Option` (or another type that implements `FromResidual`) 13 --> $DIR/try-on-option-diagnostics.rs:14:10 14 | 15LL | let a_closure = || { 16 | -- this function should return `Result` or `Option` to accept `?` 17LL | let x: Option<u32> = None; 18LL | x?; 19 | ^ cannot use the `?` operator in a closure that returns `{integer}` 20 | 21 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}` 22 23error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `FromResidual`) 24 --> $DIR/try-on-option-diagnostics.rs:26:14 25 | 26LL | fn a_method() { 27 | ------------- this function should return `Result` or `Option` to accept `?` 28LL | let x: Option<u32> = None; 29LL | x?; 30 | ^ cannot use the `?` operator in a method that returns `()` 31 | 32 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `()` 33 34error[E0277]: the `?` operator can only be used in a trait method that returns `Result` or `Option` (or another type that implements `FromResidual`) 35 --> $DIR/try-on-option-diagnostics.rs:39:14 36 | 37LL | fn a_trait_method() { 38 | ------------------- this function should return `Result` or `Option` to accept `?` 39LL | let x: Option<u32> = None; 40LL | x?; 41 | ^ cannot use the `?` operator in a trait method that returns `()` 42 | 43 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `()` 44 45error: aborting due to 4 previous errors 46 47For more information about this error, try `rustc --explain E0277`.