Closed
Description
Minimal reproduction:
fn may_error() -> Result<(), ()> { unimplemented!() }
fn main() {
async {
may_error()?;
Ok(())
};
}
1.47.0 gives the following error:
error[E0282]: type annotations needed
--> src/main.rs:5:9
|
5 | may_error()?;
| ^^^^^^^^^^^^ cannot infer type
Nightly gives a marginally more useful error:
error[E0282]: type annotations needed
--> src/main.rs:5:20
|
5 | may_error()?;
| ^ cannot infer type
I would expect an explanation of what type precisely couldn't be inferred, along with a pointer to the containing async block as the thing whose type couldn't be inferred.
rustc --version --verbose
(for 1.47.0):
rustc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-unknown-linux-gnu
release: 1.47.0
LLVM version: 11.0
rustc --version --verbose
(for nightly):
rustc 1.49.0-nightly (c71248b70 2020-10-11)
binary: rustc
commit-hash: c71248b70870960af9993de4f31d3cba9bbce7e8
commit-date: 2020-10-11
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0
Metadata
Metadata
Assignees
Labels
Area: Async & AwaitArea: Messages for errors, warnings, and lintsArea: Type inferenceAsync-await issues that have been triaged during a working group meeting.Category: This is a bug.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Call for participation: Help is requested to fix this issue.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
Done