]> git.proxmox.com Git - rustc.git/blob - src/test/ui/option-to-result.stderr
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / option-to-result.stderr
1 error[E0277]: `?` couldn't convert the error to `()`
2 --> $DIR/option-to-result.rs:5:6
3 |
4 LL | fn test_result() -> Result<(),()> {
5 | ------------- expected `()` because of this
6 LL | let a:Option<()> = Some(());
7 LL | a?;
8 | ^ the trait `From<NoneError>` is not implemented for `()`
9 |
10 = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
11 = note: required by `from`
12 help: consider converting the `Option<T>` into a `Result<T, _>` using `Option::ok_or` or `Option::ok_or_else`
13 |
14 LL | a.ok_or_else(|| /* error value */)?;
15 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16
17 error[E0277]: `?` couldn't convert the error to `NoneError`
18 --> $DIR/option-to-result.rs:11:6
19 |
20 LL | fn test_option() -> Option<i32>{
21 | ----------- expected `NoneError` because of this
22 LL | let a:Result<i32, i32> = Ok(5);
23 LL | a?;
24 | ^ the trait `From<i32>` is not implemented for `NoneError`
25 |
26 = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
27 = note: required by `from`
28 help: consider converting the `Result<T, _>` into an `Option<T>` using `Result::ok`
29 |
30 LL | a.ok()?;
31 | ^^^^^
32
33 error: aborting due to 2 previous errors
34
35 For more information about this error, try `rustc --explain E0277`.