diff --git a/Cargo.toml b/Cargo.toml index cd87a6f..eec7205 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ travis-ci = { repository = "alexcrichton/cc-rs" } appveyor = { repository = "alexcrichton/cc-rs" } [dependencies] -rayon = { version = "0.9", optional = true } +rayon = { version = "1.0", optional = true } [features] parallel = ["rayon"] diff --git a/src/lib.rs b/src/lib.rs index d5c125c..8f2b6d2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -897,13 +897,13 @@ impl Build { fn compile_objects(&self, objs: &[Object]) -> Result<(), Error> { use self::rayon::prelude::*; - let mut cfg = rayon::Configuration::new(); + let mut builder = rayon::ThreadPoolBuilder::new(); if let Ok(amt) = env::var("NUM_JOBS") { if let Ok(amt) = amt.parse() { - cfg = cfg.num_threads(amt); + builder = builder.num_threads(amt); } } - drop(rayon::initialize(cfg)); + drop(builder.build_global()); let results: Mutex>> = Mutex::new(Vec::new());