summaryrefslogtreecommitdiffstats
path: root/src/test/ui/try-trait/bad-interconversion.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
commit2ff14448863ac1a1dd9533461708e29aae170c2d (patch)
tree85b9fea2bbfe3f06473cfa381eed11f273b57c5c /src/test/ui/try-trait/bad-interconversion.stderr
parentAdding debian version 1.64.0+dfsg1-1. (diff)
downloadrustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz
rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/try-trait/bad-interconversion.stderr')
-rw-r--r--src/test/ui/try-trait/bad-interconversion.stderr75
1 files changed, 29 insertions, 46 deletions
diff --git a/src/test/ui/try-trait/bad-interconversion.stderr b/src/test/ui/try-trait/bad-interconversion.stderr
index 1dbf3ebdf..27e6a603a 100644
--- a/src/test/ui/try-trait/bad-interconversion.stderr
+++ b/src/test/ui/try-trait/bad-interconversion.stderr
@@ -17,18 +17,15 @@ LL | Ok(Err(123_i32)?)
<f64 as From<i32>>
<f64 as From<i8>>
and 67 others
- = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, i32>>` for `Result<u64, u8>`
+ = note: required for `Result<u64, u8>` to implement `FromResidual<Result<Infallible, i32>>`
error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result`
--> $DIR/bad-interconversion.rs:11:12
|
-LL | / fn option_to_result() -> Result<u64, String> {
-LL | | Some(3)?;
- | | ^ use `.ok_or(...)?` to provide an error compatible with `Result<u64, String>`
-LL | |
-LL | | Ok(10)
-LL | | }
- | |_- this function returns a `Result`
+LL | fn option_to_result() -> Result<u64, String> {
+ | -------------------------------------------- this function returns a `Result`
+LL | Some(3)?;
+ | ^ use `.ok_or(...)?` to provide an error compatible with `Result<u64, String>`
|
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `Result<u64, String>`
= help: the following other types implement trait `FromResidual<R>`:
@@ -38,12 +35,10 @@ LL | | }
error[E0277]: the `?` operator can only be used on `Result`s in a function that returns `Result`
--> $DIR/bad-interconversion.rs:17:31
|
-LL | / fn control_flow_to_result() -> Result<u64, String> {
-LL | | Ok(ControlFlow::Break(123)?)
- | | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Result<u64, String>`
-LL | |
-LL | | }
- | |_- this function returns a `Result`
+LL | fn control_flow_to_result() -> Result<u64, String> {
+ | -------------------------------------------------- this function returns a `Result`
+LL | Ok(ControlFlow::Break(123)?)
+ | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Result<u64, String>`
|
= help: the trait `FromResidual<ControlFlow<{integer}, Infallible>>` is not implemented for `Result<u64, String>`
= help: the following other types implement trait `FromResidual<R>`:
@@ -53,12 +48,10 @@ LL | | }
error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option`
--> $DIR/bad-interconversion.rs:22:22
|
-LL | / fn result_to_option() -> Option<u16> {
-LL | | Some(Err("hello")?)
- | | ^ use `.ok()?` if you want to discard the `Result<Infallible, &str>` error information
-LL | |
-LL | | }
- | |_- this function returns an `Option`
+LL | fn result_to_option() -> Option<u16> {
+ | ------------------------------------ this function returns an `Option`
+LL | Some(Err("hello")?)
+ | ^ use `.ok()?` if you want to discard the `Result<Infallible, &str>` error information
|
= help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `Option<u16>`
= help: the following other types implement trait `FromResidual<R>`:
@@ -68,12 +61,10 @@ LL | | }
error[E0277]: the `?` operator can only be used on `Option`s in a function that returns `Option`
--> $DIR/bad-interconversion.rs:27:33
|
-LL | / fn control_flow_to_option() -> Option<u64> {
-LL | | Some(ControlFlow::Break(123)?)
- | | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Option<u64>`
-LL | |
-LL | | }
- | |_- this function returns an `Option`
+LL | fn control_flow_to_option() -> Option<u64> {
+ | ------------------------------------------ this function returns an `Option`
+LL | Some(ControlFlow::Break(123)?)
+ | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Option<u64>`
|
= help: the trait `FromResidual<ControlFlow<{integer}, Infallible>>` is not implemented for `Option<u64>`
= help: the following other types implement trait `FromResidual<R>`:
@@ -83,12 +74,10 @@ LL | | }
error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
--> $DIR/bad-interconversion.rs:32:39
|
-LL | / fn result_to_control_flow() -> ControlFlow<String> {
-LL | | ControlFlow::Continue(Err("hello")?)
- | | ^ this `?` produces `Result<Infallible, &str>`, which is incompatible with `ControlFlow<String>`
-LL | |
-LL | | }
- | |_- this function returns a `ControlFlow`
+LL | fn result_to_control_flow() -> ControlFlow<String> {
+ | -------------------------------------------------- this function returns a `ControlFlow`
+LL | ControlFlow::Continue(Err("hello")?)
+ | ^ this `?` produces `Result<Infallible, &str>`, which is incompatible with `ControlFlow<String>`
|
= help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `ControlFlow<String>`
= help: the trait `FromResidual` is implemented for `ControlFlow<B, C>`
@@ -96,13 +85,10 @@ LL | | }
error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
--> $DIR/bad-interconversion.rs:37:12
|
-LL | / fn option_to_control_flow() -> ControlFlow<u64> {
-LL | | Some(3)?;
- | | ^ this `?` produces `Option<Infallible>`, which is incompatible with `ControlFlow<u64>`
-LL | |
-LL | | ControlFlow::Break(10)
-LL | | }
- | |_- this function returns a `ControlFlow`
+LL | fn option_to_control_flow() -> ControlFlow<u64> {
+ | ----------------------------------------------- this function returns a `ControlFlow`
+LL | Some(3)?;
+ | ^ this `?` produces `Option<Infallible>`, which is incompatible with `ControlFlow<u64>`
|
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `ControlFlow<u64>`
= help: the trait `FromResidual` is implemented for `ControlFlow<B, C>`
@@ -110,13 +96,10 @@ LL | | }
error[E0277]: the `?` operator in a function that returns `ControlFlow<B, _>` can only be used on other `ControlFlow<B, _>`s (with the same Break type)
--> $DIR/bad-interconversion.rs:43:29
|
-LL | / fn control_flow_to_control_flow() -> ControlFlow<i64> {
-LL | | ControlFlow::Break(4_u8)?;
- | | ^ this `?` produces `ControlFlow<u8, Infallible>`, which is incompatible with `ControlFlow<i64>`
-LL | |
-LL | | ControlFlow::Continue(())
-LL | | }
- | |_- this function returns a `ControlFlow`
+LL | fn control_flow_to_control_flow() -> ControlFlow<i64> {
+ | ----------------------------------------------------- this function returns a `ControlFlow`
+LL | ControlFlow::Break(4_u8)?;
+ | ^ this `?` produces `ControlFlow<u8, Infallible>`, which is incompatible with `ControlFlow<i64>`
|
= help: the trait `FromResidual<ControlFlow<u8, Infallible>>` is not implemented for `ControlFlow<i64>`
= note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow`