rust - Unresolved name `thread::scoped` in an elementary program -


why compilation failure in elementary program?

use std::thread;  fn main() {     in 1..10 {         let _ = thread::scoped( move || {             println!("hello thread {}", i);         });     } } 

i try build program , get:

src/main.rs:5:17: 5:36 error: unresolved name `thread::scoped` src/main.rs:5         let _ = thread::scoped( move || {                               ^~~~~~~~~~~~~~~ 

why?

the version of rust use:

$ rustc --version rustc 1.0.0-nightly (170c4399e 2015-01-14 00:41:55 +0000) 

the problem indeed version of rustc. after upgrade program compiled:

   compiling examples v0.0.1 (file:///home/igor/rust/projects/examples) src/main.rs:1:5: 1:16 warning: unused import, #[warn(unused_imports)] on default src/main.rs:1 use std::thread;                   ^~~~~~~~~~~ 

the warning disappeared after removed use:

fn main() {     in 1..10 {         let _ = thread::scoped( move || {             println!("hello thread {}", i);         });     } } 

(thank you, huon-dbaupp , dogbert, help).


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -