rust/tests/ui/inference/cannot-infer-partial-try-return.rs
2023-01-11 09:32:08 +00:00

24 lines
427 B
Rust

struct QualifiedError<E>(E);
impl<E, T> From<E> for QualifiedError<T>
where
E: std::error::Error,
T: From<E>,
{
fn from(e: E) -> QualifiedError<T> {
QualifiedError(e.into())
}
}
fn infallible() -> Result<(), std::convert::Infallible> {
Ok(())
}
fn main() {
let x = || -> Result<_, QualifiedError<_>> {
infallible()?;
Ok(())
//~^ ERROR type annotations needed
};
}