Skip to content

Commit

Permalink
runtime: use Park::Error: Debug for better panic messages (#3641)
Browse files Browse the repository at this point in the history
  • Loading branch information
goffrie committed Apr 8, 2021
1 parent 5513b6b commit 1d56552
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tokio/src/park/mod.rs
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions tokio/src/runtime/basic_scheduler.rs
Expand Up @@ -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;
Expand All @@ -234,7 +234,6 @@ impl<P: Park> Inner<P> {
scheduler
.park
.park_timeout(Duration::from_millis(0))
.ok()
.expect("failed to park");
}
})
Expand Down

0 comments on commit 1d56552

Please sign in to comment.