Skip to content

Commit a2e0f39

Browse files
committed
---
yaml --- r: 94193 b: refs/heads/try c: ebe8ac8 h: refs/heads/master i: 94191: 016c732 v: v3
1 parent 53991b5 commit a2e0f39

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: fdd6750570cf1434264a601fd2b749d7fe01dee8
5+
refs/heads/try: ebe8ac88a7492679846827f374effff46b070278
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustdoc/html/render.rs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ use std::io::File;
4646
use std::os;
4747
use std::str;
4848
use std::task;
49-
use std::unstable::finally::Finally;
5049
use std::vec;
5150

5251
use extra::arc::RWArc;
@@ -642,6 +641,22 @@ impl<'self> Cache {
642641
}
643642
}
644643

644+
enum Progress {
645+
JobNew,
646+
JobDone,
647+
}
648+
649+
/// A helper object to unconditionally send a value on a chanel.
650+
struct ChannelGuard {
651+
channel: SharedChan<Progress>,
652+
}
653+
654+
impl Drop for ChannelGuard {
655+
fn drop(&mut self) {
656+
self.channel.send(JobDone)
657+
}
658+
}
659+
645660
impl Context {
646661
/// Recurse in the directory structure and change the "root path" to make
647662
/// sure it always points to the top (relatively)
@@ -674,8 +689,6 @@ impl Context {
674689
Die,
675690
Process(Context, clean::Item),
676691
}
677-
enum Progress { JobNew, JobDone }
678-
679692
let workers = match os::getenv("RUSTDOC_WORKERS") {
680693
Some(s) => {
681694
match from_str::<uint>(s) {
@@ -725,16 +738,15 @@ impl Context {
725738
match port.recv() {
726739
Process(cx, item) => {
727740
let mut cx = cx;
728-
let item = Cell::new(item);
729-
(|| {
730-
cx.item(item.take(), |cx, item| {
731-
prog_chan.send(JobNew);
732-
chan.send(Process(cx.clone(), item));
733-
})
734-
}).finally(|| {
735-
// If we fail, everything else should still get
736-
// completed
737-
prog_chan.send(JobDone);
741+
742+
// If we fail, everything else should still get
743+
// completed.
744+
let _guard = ChannelGuard {
745+
channel: prog_chan.clone(),
746+
};
747+
cx.item(item, |cx, item| {
748+
prog_chan.send(JobNew);
749+
chan.send(Process(cx.clone(), item));
738750
})
739751
}
740752
Die => break,

0 commit comments

Comments
 (0)