Closed
Description
use std::thread;
fn main() {
thread::Thread::spawn(move || {
loop { // Remove the loop and everything works fine.
println!("hello");
}
// This gives you:
//
// type_inf.rs:4:5: 4:26 error: unable to infer enough type information about `_`; type annotations required
// type_inf.rs:4 thread::Thread::spawn(move || {
// ^~~~~~~~~~~~~~~~~~~~~
// error: aborting due to previous error
// Uncomment the `()` below, and the error changes to a warning:
//
// type_inf.rs:8:9: 9:6 warning: unreachable expression, #[warn(unreachable_code)] on by default
// type_inf.rs:8 ()
// type_inf.rs:9 }).detach();
// ()
}).detach();
}
$ rustc --version
rustc 0.13.0-nightly (39d7402 2015-01-01 15:51:08 +0000)