Skip to content

Commit ed91b73

Browse files
committed
Simplify usage of UnsafeMessage::send
1 parent b0b0b25 commit ed91b73

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/driver/jit.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ unsafe impl Send for UnsafeMessage {}
4646

4747
impl UnsafeMessage {
4848
/// Send the message.
49-
fn send(self) -> Result<(), mpsc::SendError<UnsafeMessage>> {
49+
fn send(self) {
5050
thread_local! {
5151
/// The Sender owned by the local thread
5252
static LOCAL_MESSAGE_SENDER: mpsc::Sender<UnsafeMessage> =
@@ -55,7 +55,9 @@ impl UnsafeMessage {
5555
.lock().unwrap()
5656
.clone();
5757
}
58-
LOCAL_MESSAGE_SENDER.with(|sender| sender.send(self))
58+
LOCAL_MESSAGE_SENDER.with(|sender| {
59+
sender.send(self).expect("rustc thread hung up before lazy JIT request was sent")
60+
})
5961
}
6062
}
6163

@@ -231,9 +233,7 @@ extern "C" fn clif_jit_fn(
231233
) -> *const u8 {
232234
// send the JIT request to the rustc thread, with a channel for the response
233235
let (tx, rx) = mpsc::channel();
234-
UnsafeMessage::JitFn { instance_ptr, trampoline_ptr, tx }
235-
.send()
236-
.expect("rustc thread hung up before lazy JIT request was sent");
236+
UnsafeMessage::JitFn { instance_ptr, trampoline_ptr, tx }.send();
237237

238238
// block on JIT compilation result
239239
rx.recv().expect("rustc thread hung up before responding to sent lazy JIT request")

0 commit comments

Comments
 (0)