From 23189a8fb6b5d2c04f0a627c2ff651b95838e71b Mon Sep 17 00:00:00 2001 From: Hai-Hsin Date: Sat, 1 Jun 2024 21:11:01 +0800 Subject: [PATCH] macros: docs: only current_thread implements unhandled_panic for now --- tokio-macros/src/lib.rs | 6 +++--- tokio/tests/macros_test.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index 4cc1c402328..0ef745c9396 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -209,7 +209,7 @@ use proc_macro::TokenStream; /// [`Builder::unhandled_panic`]. /// /// ```ignore -/// #[tokio::main(unhandled_panic = "shutdown_runtime")] +/// #[tokio::main(flavor = "current_thread", unhandled_panic = "shutdown_runtime")] /// async fn main() { /// let _ = tokio::spawn(async { /// panic!("This panic will shutdown the runtime."); @@ -217,7 +217,7 @@ use proc_macro::TokenStream; /// } /// ``` /// -/// Equivalent code not using `#[tokio::test]` +/// Equivalent code not using `#[tokio::main]` /// /// ```ignore /// fn main() { @@ -468,7 +468,7 @@ pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream { /// [`Builder::unhandled_panic`]. /// /// ```ignore -/// #[tokio::test(unhandled_panic = "shutdown_runtime")] +/// #[tokio::test(flavor = "current_thread", unhandled_panic = "shutdown_runtime")] /// async fn my_test() { /// let _ = tokio::spawn(async { /// panic!("This panic will shutdown the runtime."); diff --git a/tokio/tests/macros_test.rs b/tokio/tests/macros_test.rs index cfb4d6c22f2..bed443cf293 100644 --- a/tokio/tests/macros_test.rs +++ b/tokio/tests/macros_test.rs @@ -98,7 +98,7 @@ pub mod issue_5243 { pub mod macro_rt_arg_unhandled_panic { use tokio_test::assert_err; - #[tokio::test(unhandled_panic = "shutdown_runtime")] + #[tokio::test(flavor = "current_thread", unhandled_panic = "shutdown_runtime")] #[should_panic] async fn unhandled_panic_shutdown_runtime() { let _ = tokio::spawn(async { @@ -107,7 +107,7 @@ pub mod macro_rt_arg_unhandled_panic { .await; } - #[tokio::test(unhandled_panic = "ignore")] + #[tokio::test(flavor = "current_thread", unhandled_panic = "ignore")] async fn unhandled_panic_ignore() { let rt = tokio::spawn(async { panic!("This panic should be forwarded to rt as an error.");