Closed
Description
The following test should successfully compile but does not:
/// A trait for types that can be converted from a given error type `E`.
pub trait FromError<E> {
/// Perform the conversion.
fn from_error(err: E) -> Self;
}
// Any type is convertable from itself
impl<E> FromError<E> for E {
fn from_error(err: E) -> E {
err
}
}
fn test() -> Result<(), ()> {
Err(FromError::from_error(()))
}
fn main() {
let result = (|| Err(FromError::from_error(())))();
let foo: () = result.unwrap();
}
Fix forthcoming.