mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
runtime: use Park::Error: Debug for better panic messages (#3641)
This commit is contained in:
@@ -41,6 +41,7 @@ cfg_rt! {
|
||||
#[cfg(any(feature = "rt", feature = "sync"))]
|
||||
pub(crate) mod thread;
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -50,7 +51,7 @@ pub(crate) trait Park {
|
||||
type Unpark: Unpark;
|
||||
|
||||
/// Error returned by `park`
|
||||
type Error;
|
||||
type Error: Debug;
|
||||
|
||||
/// Gets a new `Unpark` handle associated with this `Park` instance.
|
||||
fn unpark(&self) -> Self::Unpark;
|
||||
|
||||
@@ -221,7 +221,7 @@ impl<P: Park> Inner<P> {
|
||||
Some(task) => crate::coop::budget(|| task.run()),
|
||||
None => {
|
||||
// Park until the thread is signaled
|
||||
scheduler.park.park().ok().expect("failed to park");
|
||||
scheduler.park.park().expect("failed to park");
|
||||
|
||||
// Try polling the `block_on` future next
|
||||
continue 'outer;
|
||||
@@ -234,7 +234,6 @@ impl<P: Park> Inner<P> {
|
||||
scheduler
|
||||
.park
|
||||
.park_timeout(Duration::from_millis(0))
|
||||
.ok()
|
||||
.expect("failed to park");
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user