Skip to content

Commit

Permalink
Rollup merge of rust-lang#33313 - birkenfeld:depgraph-panic, r=nikoma…
Browse files Browse the repository at this point in the history
…tsakis

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.
  • Loading branch information
steveklabnik committed May 7, 2016
2 parents ba6678c + e3f1312 commit 1d0a607
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustc/dep_graph/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ pub fn main(swap_in: Receiver<Vec<DepMessage>>,
DepMessage::Query => query_out.send(edges.query()).unwrap(),
}
}
swap_out.send(messages).unwrap();
if let Err(_) = swap_out.send(messages) {
// the receiver must have been dropped already
break;
}
}
}

0 comments on commit 1d0a607

Please sign in to comment.