Skip to content

Commit f7f44d5

Browse files
committed
---
yaml --- r: 92215 b: refs/heads/auto c: ebe8ac8 h: refs/heads/master i: 92213: 3f7775e 92211: 8b6f679 92207: 3fd8d8a v: v3
1 parent 726b949 commit f7f44d5

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
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: fdd6750570cf1434264a601fd2b749d7fe01dee8
16+
refs/heads/auto: ebe8ac88a7492679846827f374effff46b070278
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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)