Skip to content

Commit 7ad0716

Browse files
committed
rustc: Convert to pipes
1 parent 02e907b commit 7ad0716

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/librustc/rustc.rc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -357,24 +357,27 @@ fails without recording a fatal error then we've encountered a compiler
357357
bug and need to present an error.
358358
*/
359359
pub fn monitor(+f: fn~(diagnostic::emitter)) {
360-
let p = oldcomm::Port();
361-
let ch = oldcomm::Chan(&p);
362-
360+
use core::pipes::*;
361+
use std::cell::Cell;
362+
let (p, ch) = stream();
363+
let ch = SharedChan(ch);
364+
let ch_capture = ch.clone();
363365
match do task::try |move f| {
364-
366+
let ch = ch_capture.clone();
367+
let ch_capture = ch.clone();
365368
// The 'diagnostics emitter'. Every error, warning, etc. should
366369
// go through this function.
367370
let demitter = fn@(cmsp: Option<(@codemap::CodeMap, codemap::span)>,
368371
msg: &str, lvl: diagnostic::level) {
369372
if lvl == diagnostic::fatal {
370-
oldcomm::send(ch, fatal);
373+
ch_capture.send(fatal);
371374
}
372375
diagnostic::emit(cmsp, msg, lvl);
373376
};
374377

375378
struct finally {
376-
ch: oldcomm::Chan<monitor_msg>,
377-
drop { oldcomm::send(self.ch, done); }
379+
ch: SharedChan<monitor_msg>,
380+
drop { self.ch.send(done); }
378381
}
379382

380383
let _finally = finally { ch: ch };
@@ -384,7 +387,7 @@ pub fn monitor(+f: fn~(diagnostic::emitter)) {
384387
result::Ok(_) => { /* fallthrough */ }
385388
result::Err(_) => {
386389
// Task failed without emitting a fatal diagnostic
387-
if oldcomm::recv(p) == done {
390+
if p.recv() == done {
388391
diagnostic::emit(
389392
None,
390393
diagnostic::ice_msg(~"unexpected failure"),

0 commit comments

Comments
 (0)