diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/try-block/try-block-bad-type.stderr | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/try-block/try-block-bad-type.stderr | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr new file mode 100644 index 000000000..f9906713f --- /dev/null +++ b/src/test/ui/try-block/try-block-bad-type.stderr @@ -0,0 +1,42 @@ +error[E0277]: `?` couldn't convert the error to `TryFromSliceError` + --> $DIR/try-block-bad-type.rs:7:16 + | +LL | Err("")?; + | ^ the trait `From<&str>` is not implemented for `TryFromSliceError` + | + = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait + = help: the trait `From<Infallible>` is implemented for `TryFromSliceError` + = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, &str>>` for `Result<u32, TryFromSliceError>` + +error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str` + --> $DIR/try-block-bad-type.rs:12:9 + | +LL | "" + | ^^ expected `i32`, found `&str` + +error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == ()` + --> $DIR/try-block-bad-type.rs:15:39 + | +LL | let res: Result<i32, i32> = try { }; + | ^ expected `i32`, found `()` + +error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`) + --> $DIR/try-block-bad-type.rs:17:25 + | +LL | let res: () = try { }; + | ^ could not wrap the final value of the block as `()` doesn't implement `Try` + | + = help: the trait `Try` is not implemented for `()` + +error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`) + --> $DIR/try-block-bad-type.rs:20:26 + | +LL | let res: i32 = try { 5 }; + | ^ could not wrap the final value of the block as `i32` doesn't implement `Try` + | + = help: the trait `Try` is not implemented for `i32` + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. |