runtime: use Park::Error: Debug for better panic messages (#3641)

This commit is contained in:
Geoffry Song
2021-04-08 20:30:43 +02:00
committed by GitHub
parent 5513b6b825
commit 1d5655272b
2 changed files with 3 additions and 3 deletions
+2 -1
View File
@@ -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;
+1 -2
View File
@@ -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");
}
})