@@ -357,24 +357,27 @@ fails without recording a fatal error then we've encountered a compiler
357
357
bug and need to present an error.
358
358
*/
359
359
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();
363
365
match do task::try |move f| {
364
-
366
+ let ch = ch_capture.clone();
367
+ let ch_capture = ch.clone();
365
368
// The 'diagnostics emitter'. Every error, warning, etc. should
366
369
// go through this function.
367
370
let demitter = fn@(cmsp: Option<(@codemap::CodeMap, codemap::span)>,
368
371
msg: &str, lvl: diagnostic::level) {
369
372
if lvl == diagnostic::fatal {
370
- oldcomm:: send(ch, fatal);
373
+ ch_capture. send(fatal);
371
374
}
372
375
diagnostic::emit(cmsp, msg, lvl);
373
376
};
374
377
375
378
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); }
378
381
}
379
382
380
383
let _finally = finally { ch: ch };
@@ -384,7 +387,7 @@ pub fn monitor(+f: fn~(diagnostic::emitter)) {
384
387
result::Ok(_) => { /* fallthrough */ }
385
388
result::Err(_) => {
386
389
// Task failed without emitting a fatal diagnostic
387
- if oldcomm:: recv(p ) == done {
390
+ if p. recv() == done {
388
391
diagnostic::emit(
389
392
None,
390
393
diagnostic::ice_msg(~"unexpected failure"),
0 commit comments