Closed
Description
use std::future::Future;
pub trait Bound {}
pub struct Error;
impl Bound for Error {}
pub struct Wrap;
impl<T: Bound> From<T> for Wrap {
fn from(input: T) -> Self {
Wrap
}
}
impl<T: Into<Wrap>> From<T> for Error {
fn from(input: T) -> Self {
Error
}
}
fn fail() -> impl Future<Output = Result<(), Error>> {
async move {
let a: Result<(), Error> = Ok(());
let a: () = a?;
Ok(())
}
}
This fails with type annotations required: cannot resolve Error: std::convert::From<Error>
(E0283) instead of the expected conflicting implementations of trait std::convert::From<Error> for type Error
(E0119). Changing fail
to
fn fail() -> Result<(), Error> {
let a: Result<(), Error> = Ok(());
let a: () = a?;
Ok(())
}
i.e. eliminating the async block leads to the expected error message being produced.
Metadata
Metadata
Assignees
Labels
Area: Async & AwaitArea: Messages for errors, warnings, and lintsAsync-await issues that are part of the "polish" areaAsync-await issues that have been triaged during a working group meeting.Category: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint that should be reworked.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
Done