fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.2 KiB29 linesraw
1error[E0277]: `?` couldn't convert the error to `()`
2  --> $DIR/option-to-result.rs:5:6
3   |
4LL |     a?;
5   |      ^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()`
6   |
7   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
8   = note: required by `std::convert::From::from`
9help: consider converting the `Option<T>` into a `Result<T, _>` using `Option::ok_or` or `Option::ok_or_else`
10   |
11LL |     a.ok_or_else(|| /* error value */)?;
12   |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
14error[E0277]: `?` couldn't convert the error to `std::option::NoneError`
15  --> $DIR/option-to-result.rs:11:6
16   |
17LL |     a?;
18   |      ^ the trait `std::convert::From<i32>` is not implemented for `std::option::NoneError`
19   |
20   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
21   = note: required by `std::convert::From::from`
22help: consider converting the `Result<T, _>` into an `Option<T>` using `Result::ok`
23   |
24LL |     a.ok()?;
25   |      ^^^^^
26
27error: aborting due to 2 previous errors
28
29For more information about this error, try `rustc --explain E0277`.