summaryrefslogtreecommitdiffstats
path: root/tokio/tests/rt_common.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2020-10-13 15:06:22 -0700
committerGitHub <noreply@github.com>2020-10-13 15:06:22 -0700
commit00b6127f2ed3125f8b305ab4fd9bb90e99762785 (patch)
treee43ba873fed9f2cc650b6b26cfb0422aabf1a9bd /tokio/tests/rt_common.rs
parenta249421abc44e768217427a68f5f5e23f9d1cbd5 (diff)
rt: switch `enter` to an RAII guard (#2954)
Diffstat (limited to 'tokio/tests/rt_common.rs')
-rw-r--r--tokio/tests/rt_common.rs22
1 files changed, 3 insertions, 19 deletions
diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs
index a4091616..74a94d5b 100644
--- a/tokio/tests/rt_common.rs
+++ b/tokio/tests/rt_common.rs
@@ -555,23 +555,6 @@ rt_test! {
}
#[test]
- fn spawn_blocking_after_shutdown() {
- let rt = rt();
- let handle = rt.clone();
-
- // Shutdown
- drop(rt);
-
- handle.enter(|| {
- let res = task::spawn_blocking(|| unreachable!());
-
- // Avoid using a tokio runtime
- let out = futures::executor::block_on(res);
- assert!(out.is_err());
- });
- }
-
- #[test]
fn always_active_parker() {
// This test it to show that we will always have
// an active parker even if we call block_on concurrently
@@ -713,9 +696,10 @@ rt_test! {
#[test]
fn enter_and_spawn() {
let rt = rt();
- let handle = rt.enter(|| {
+ let handle = {
+ let _enter = rt.enter();
tokio::spawn(async {})
- });
+ };
assert_ok!(rt.block_on(handle));
}