Skip to content

Commit

Permalink
macros: docs: only current_thread implements unhandled_panic for now
Browse files Browse the repository at this point in the history
  • Loading branch information
name1e5s committed Jun 2, 2024
1 parent 9290e24 commit 23189a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tokio-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ 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.");
/// }).await;
/// }
/// ```
///
/// Equivalent code not using `#[tokio::test]`
/// Equivalent code not using `#[tokio::main]`
///
/// ```ignore
/// fn main() {
Expand Down Expand Up @@ -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.");
Expand Down
4 changes: 2 additions & 2 deletions tokio/tests/macros_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.");
Expand Down

0 comments on commit 23189a8

Please sign in to comment.