diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-05-17 12:18:56 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-05-17 12:18:56 -0700 |
| commit | 65b731908abee2bb8b0af50d18567eb4abaa4ac2 (patch) | |
| tree | b8186a7dc7cc33edbe4080e85bf0b8883812b183 /src/test | |
| parent | 1962adea6ad9b992516ae56ad7f8c5bc33b951cb (diff) | |
| download | rust-65b731908abee2bb8b0af50d18567eb4abaa4ac2.tar.gz rust-65b731908abee2bb8b0af50d18567eb4abaa4ac2.zip | |
Explain that ? converts the error type using From
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/issues/issue-32709.stderr | 1 | ||||
| -rw-r--r-- | src/test/ui/try-block/try-block-bad-type.stderr | 1 | ||||
| -rw-r--r-- | src/test/ui/try-on-option.stderr | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr index 84cca5b20af..04b8c3aa353 100644 --- a/src/test/ui/issues/issue-32709.stderr +++ b/src/test/ui/issues/issue-32709.stderr @@ -4,6 +4,7 @@ error[E0277]: `?` couldn't convert the error to `()` LL | Err(5)?; | ^ the trait `std::convert::From<{integer}>` is not implemented for `()` | + = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = note: required by `std::convert::From::from` error: aborting due to previous error diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr index 7c7366df1dc..e1c2c6b675e 100644 --- a/src/test/ui/try-block/try-block-bad-type.stderr +++ b/src/test/ui/try-block/try-block-bad-type.stderr @@ -4,6 +4,7 @@ error[E0277]: `?` couldn't convert the error to `i32` LL | Err("")?; | ^ the trait `std::convert::From<&str>` is not implemented for `i32` | + = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = help: the following implementations were found: <i32 as std::convert::From<bool>> <i32 as std::convert::From<i16>> diff --git a/src/test/ui/try-on-option.stderr b/src/test/ui/try-on-option.stderr index 4465fbe14b7..db5046f8c15 100644 --- a/src/test/ui/try-on-option.stderr +++ b/src/test/ui/try-on-option.stderr @@ -4,6 +4,7 @@ error[E0277]: `?` couldn't convert the error to `()` LL | x?; | ^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()` | + = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = note: required by `std::convert::From::from` error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) |
