This test code (playpen):
use std::fmt::{Display, Formatter, Error};
struct MyLocalType;
type MyResult = Result<MyLocalType, String>;
impl Display for MyResult {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
f.write_str("some test string")
}
}
fn main() {
let r: MyResult = Ok(MyLocalType);
println!("{}" , r);
}
Produces this error message:
<anon>:7:1: 11:2 error: the impl does not reference any types defined in this crate; only traits defined in the current crate can be implemented for arbitrary types [E0117]
<anon>:7 impl Display for MyResult {
<anon>:8 fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
<anon>:9 f.write_str("some test string")
<anon>:10 }
<anon>:11 }
This code successfully compiled in the January version of Rust; how can I implement it now?