mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
Make tokio::run panic if called from inside tokio::run (#646)
This is implemented by creating an `Enter` instance from within `run`. This patch also introduces `Enter::block_on`. Fixes #504
This commit is contained in:
committed by
Carl Lerche
parent
85f8522536
commit
98d23b8b29
@@ -390,3 +390,15 @@ mod from_block_on_all {
|
||||
test(|f| { tokio::spawn(f); })
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_in_run() {
|
||||
use std::panic;
|
||||
|
||||
tokio::run(lazy(|| {
|
||||
panic::catch_unwind(|| {
|
||||
tokio::run(lazy(|| { Ok::<(), ()>(()) }))
|
||||
}).unwrap_err();
|
||||
Ok::<(), ()>(())
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user