remove Error::is_runtime_startup accessor

This commit is contained in:
Sean McArthur
2019-01-03 11:07:09 -08:00
parent 59f57072ac
commit 0f4055f9ec
2 changed files with 15 additions and 28 deletions

View File

@@ -504,7 +504,7 @@ impl ClientHandle {
match spawn_rx.wait() {
Ok(Ok(())) => (),
Ok(Err(err)) => return Err(err),
Err(_canceled) => return Err(::error::runtime_startup()),
Err(_canceled) => event_loop_panicked(),
}
@@ -537,14 +537,7 @@ impl ClientHandle {
Either::B(future::ok(()))
};
let rx = rx.map_err(|_canceled| {
// The only possible reason there would be a Canceled error
// is if the thread running the event loop panicked. We could return
// an Err here, like a BrokenPipe, but the Client is not
// recoverable. Additionally, the panic in the other thread
// is not normal, and should likely be propagated.
panic!("event loop thread panicked");
});
let rx = rx.map_err(|_canceled| event_loop_panicked());
let fut = write.join(rx).map(|((), res)| res);
@@ -578,3 +571,14 @@ impl KeepCoreThreadAlive {
KeepCoreThreadAlive(None)
}
}
#[cold]
#[inline(never)]
fn event_loop_panicked() -> ! {
// The only possible reason there would be a Canceled error
// is if the thread running the event loop panicked. We could return
// an Err here, like a BrokenPipe, but the Client is not
// recoverable. Additionally, the panic in the other thread
// is not normal, and should likely be propagated.
panic!("event loop thread panicked");
}