Skip to content

Commit e3f1312

Browse files
committed
dep_graph: avoid panicking in thread when channel closed
On my system, when the processor is already loaded, and I try to run the test suite, e.g. compile-fail/dep-graph-assoc-type-trans.rs fails because of undecodable JSON. Running the compiler manually, I can see that the dep graph thread panics (and puts non-JSON on stderr) while `send`ing on `swap_out`, presumably because the other end has already quit. I think that in this case, we can just gracefully exit the thread.
1 parent 2a815a2 commit e3f1312

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/librustc/dep_graph/thread.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ pub fn main(swap_in: Receiver<Vec<DepMessage>>,
176176
DepMessage::Query => query_out.send(edges.query()).unwrap(),
177177
}
178178
}
179-
swap_out.send(messages).unwrap();
179+
if let Err(_) = swap_out.send(messages) {
180+
// the receiver must have been dropped already
181+
break;
182+
}
180183
}
181184
}

0 commit comments

Comments
 (0)