diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-27 03:26:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-27 03:26:13 +0200 |
| commit | c95bcbc9d5db498b572909bdcc56e684ceece68a (patch) | |
| tree | 75931a16e227fced8b9fde5491e8d2a14b71096e /src/test | |
| parent | 89aff5f33e1b28093e881e812b670672f724d8aa (diff) | |
| parent | be90f90810438eed6f0090acfb4d29a787a43c1e (diff) | |
Rollup merge of #71409 - estebank:point-at-ret-question-mark-op, r=petrochenkov
Point at the return type on `.into()` failure caused by `?` Fix #35946.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/issues/issue-32709.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/option-to-result.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/try-on-option.stderr | 3 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr index 04b8c3aa353..af272633f21 100644 --- a/src/test/ui/issues/issue-32709.stderr +++ b/src/test/ui/issues/issue-32709.stderr @@ -1,6 +1,8 @@ error[E0277]: `?` couldn't convert the error to `()` --> $DIR/issue-32709.rs:4:11 | +LL | fn a() -> Result<i32, ()> { + | --------------- expected `()` because of this LL | Err(5)?; | ^ the trait `std::convert::From<{integer}>` is not implemented for `()` | diff --git a/src/test/ui/option-to-result.stderr b/src/test/ui/option-to-result.stderr index f673ef7fc1e..5fa06778389 100644 --- a/src/test/ui/option-to-result.stderr +++ b/src/test/ui/option-to-result.stderr @@ -1,6 +1,9 @@ error[E0277]: `?` couldn't convert the error to `()` --> $DIR/option-to-result.rs:5:6 | +LL | fn test_result() -> Result<(),()> { + | ------------- expected `()` because of this +LL | let a:Option<()> = Some(()); LL | a?; | ^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()` | @@ -14,6 +17,9 @@ LL | a.ok_or_else(|| /* error value */)?; error[E0277]: `?` couldn't convert the error to `std::option::NoneError` --> $DIR/option-to-result.rs:11:6 | +LL | fn test_option() -> Option<i32>{ + | ----------- expected `std::option::NoneError` because of this +LL | let a:Result<i32, i32> = Ok(5); LL | a?; | ^ the trait `std::convert::From<i32>` is not implemented for `std::option::NoneError` | diff --git a/src/test/ui/try-on-option.stderr b/src/test/ui/try-on-option.stderr index 7a4bb75967b..33ca58bf7fe 100644 --- a/src/test/ui/try-on-option.stderr +++ b/src/test/ui/try-on-option.stderr @@ -1,6 +1,9 @@ error[E0277]: `?` couldn't convert the error to `()` --> $DIR/try-on-option.rs:7:6 | +LL | fn foo() -> Result<u32, ()> { + | --------------- expected `()` because of this +LL | let x: Option<u32> = None; LL | x?; | ^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()` | |
