about summary refs log tree commit diff
path: root/src/librustc_driver
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2014-12-06 18:34:37 -0800
committerAaron Turon <aturon@mozilla.com>2014-12-18 23:31:51 -0800
commit43ae4b3301cc0605839778ecf59effb32b752e33 (patch)
treeaa111f5adc1eaa1e996847e1437d1b1b40821ce0 /src/librustc_driver
parent14c1a103bc3f78721df1dc860a75a477c8275e3a (diff)
downloadrust-43ae4b3301cc0605839778ecf59effb32b752e33.tar.gz
rust-43ae4b3301cc0605839778ecf59effb32b752e33.zip
Fallout from new thread API
Diffstat (limited to 'src/librustc_driver')
-rw-r--r--src/librustc_driver/lib.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index b0f8b3bdbe7..ba5157932b6 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -55,7 +55,7 @@ use rustc::DIAGNOSTICS;
 use std::any::AnyRefExt;
 use std::io;
 use std::os;
-use std::task::TaskBuilder;
+use std::thread;
 
 use rustc::session::early_error;
 
@@ -475,18 +475,22 @@ pub fn monitor<F:FnOnce()+Send>(f: F) {
     static STACK_SIZE: uint = 32000000; // 32MB
 
     let (tx, rx) = channel();
-    let w = io::ChanWriter::new(tx);
+    let mut w = Some(io::ChanWriter::new(tx)); // option dance
     let mut r = io::ChanReader::new(rx);
 
-    let mut task = TaskBuilder::new().named("rustc").stderr(box w);
+    let mut cfg = thread::cfg().name("rustc".to_string());
 
     // FIXME: Hacks on hacks. If the env is trying to override the stack size
     // then *don't* set it explicitly.
     if os::getenv("RUST_MIN_STACK").is_none() {
-        task = task.stack_size(STACK_SIZE);
+        cfg = cfg.stack_size(STACK_SIZE);
     }
 
-    match task.try(f) {
+    let f = proc() {
+        std::io::stdio::set_stderr(box w.take().unwrap());
+        f()
+    };
+    match cfg.with_join(f).join() {
         Ok(()) => { /* fallthrough */ }
         Err(value) => {
             // Task panicked without emitting a fatal diagnostic
@@ -540,4 +544,3 @@ pub fn main() {
     let result = run(args);
     std::os::set_exit_status(result);
 }
-