trait To {
// This is a typo, the return type should be `<Dst as From<Self>>::Output`
- fn to<Dst: From<Self>>(self) -> <Dst as From<Self>>::Dst {
- //~^ error: the trait `core::kinds::Sized` is not implemented
- From::from(self)
+ fn to<Dst: From<Self>>(
+ self
+ //~^ error: the trait `core::kinds::Sized` is not implemented
+ ) ->
+ <Dst as From<Self>>::Dst
+ //~^ error: the trait `core::kinds::Sized` is not implemented
+ {
+ From::from(
+ //~^ error: the trait `core::kinds::Sized` is not implemented
+ self
+ )
}
}
}
trait To {
- fn to<Dst>(self) -> <Dst as From<Self>>::Result where Dst: From<Self> {
- From::from(self) //~error: type annotations required
+ fn to<Dst>(
+ self //~ error: the trait `core::kinds::Sized` is not implemented
+ ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
+ From::from( //~ error: the trait `core::kinds::Sized` is not implemented
+ self
+ )
}
}
extern crate log;
extern crate libc;
-use std::comm::channel;
+use std::sync::mpsc::channel;
use std::io::net::tcp::{TcpListener, TcpStream};
use std::io::{Acceptor, Listener};
use std::thread::{Builder, Thread};
let (tx, rx) = channel();
Thread::spawn(move || -> () {
let mut listener = TcpListener::bind("127.0.0.1:0").unwrap();
- tx.send(listener.socket_name().unwrap());
+ tx.send(listener.socket_name().unwrap()).unwrap();
let mut acceptor = listener.listen();
loop {
let mut stream = match acceptor.accept() {
stream.write(&[2]);
}
}).detach();
- let addr = rx.recv();
+ let addr = rx.recv().unwarp();
let (tx, rx) = channel();
for _ in range(0u, 1000) {
},
Err(e) => debug!("{}", e)
}
- tx.send(());
+ tx.send(()).unwrap();
}).detach();
}
// server just runs infinitely.
drop(tx);
for _ in range(0u, 1000) {
- rx.recv();
+ rx.recv().unwrap();
}
unsafe { libc::exit(0) }
}