mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
23 lines
427 B
Rust
23 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
|
|
};
|
|
}
|