diff options
| author | lcnr <rust@lcnr.de> | 2022-07-01 15:49:05 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2022-07-04 14:04:07 +0200 |
| commit | f475e880a4c6b2359ebaef88c844daede9c88fc9 (patch) | |
| tree | 66279465d17943029b726daa9c7bfd22dc38a832 /src/test/ui/inference | |
| parent | 7952d2ed8338796aa9b5f0da5a37c7dd8e936182 (diff) | |
| download | rust-f475e880a4c6b2359ebaef88c844daede9c88fc9.tar.gz rust-f475e880a4c6b2359ebaef88c844daede9c88fc9.zip | |
`InferSource::GenericArg`, check for contains
Diffstat (limited to 'src/test/ui/inference')
| -rw-r--r-- | src/test/ui/inference/cannot-infer-partial-try-return.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/inference/cannot-infer-partial-try-return.stderr | 15 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/test/ui/inference/cannot-infer-partial-try-return.rs b/src/test/ui/inference/cannot-infer-partial-try-return.rs index 976827a4478..b555697dc34 100644 --- a/src/test/ui/inference/cannot-infer-partial-try-return.rs +++ b/src/test/ui/inference/cannot-infer-partial-try-return.rs @@ -16,8 +16,8 @@ fn infallible() -> Result<(), std::convert::Infallible> { fn main() { let x = || -> Result<_, QualifiedError<_>> { - //~^ ERROR type annotations needed for `Result<(), QualifiedError<_>>` infallible()?; Ok(()) + //~^ ERROR type annotations needed }; } diff --git a/src/test/ui/inference/cannot-infer-partial-try-return.stderr b/src/test/ui/inference/cannot-infer-partial-try-return.stderr index c1e43f0b721..2a56aaa44fe 100644 --- a/src/test/ui/inference/cannot-infer-partial-try-return.stderr +++ b/src/test/ui/inference/cannot-infer-partial-try-return.stderr @@ -1,16 +1,15 @@ -error[E0282]: type annotations needed for `Result<(), QualifiedError<_>>` - --> $DIR/cannot-infer-partial-try-return.rs:18:13 +error[E0282]: type annotations needed + --> $DIR/cannot-infer-partial-try-return.rs:20:9 | -LL | let x = || -> Result<_, QualifiedError<_>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | LL | infallible()?; | ------------- type must be known at this point +LL | Ok(()) + | ^^ cannot infer type of the type parameter `E` declared on the enum `Result` | -help: try giving this closure an explicit return type +help: consider specifying the generic arguments | -LL | let x = || -> Result<(), QualifiedError<_>> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | Ok::<(), QualifiedError<_>>(()) + | +++++++++++++++++++++++++ error: aborting due to previous error |
