2020-12-28 23:10:13 -06:00
|
|
|
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<_>> {
|
2022-02-14 06:25:26 -06:00
|
|
|
infallible()?;
|
2020-12-28 23:10:13 -06:00
|
|
|
Ok(())
|
2022-07-01 08:49:05 -05:00
|
|
|
//~^ ERROR type annotations needed
|
2020-12-28 23:10:13 -06:00
|
|
|
};
|
|
|
|
}
|