Skip to content

Commit 2f30df7

Browse files
committed
tokio-macros: Stabilize LocalRuntime
1 parent 925c614 commit 2f30df7

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

tokio-macros/src/entry.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,7 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
421421
},
422422
};
423423

424-
let mut checks = vec![];
425-
let mut errors = vec![];
426-
427424
let build = if let RuntimeFlavor::Local = config.flavor {
428-
checks.push(quote! { tokio_unstable });
429-
errors.push("The local runtime flavor is only available when `tokio_unstable` is set.");
430425
quote_spanned! {last_stmt_start_span=> build_local(Default::default())}
431426
} else {
432427
quote_spanned! {last_stmt_start_span=> build()}
@@ -451,23 +446,10 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
451446
quote! {}
452447
};
453448

454-
let do_checks: TokenStream = checks
455-
.iter()
456-
.zip(&errors)
457-
.map(|(check, error)| {
458-
quote! {
459-
#[cfg(not(#check))]
460-
compile_error!(#error);
461-
}
462-
})
463-
.collect();
464-
465449
let body_ident = quote! { body };
466450
// This explicit `return` is intentional. See tokio-rs/tokio#4636
467451
let last_block = quote_spanned! {last_stmt_end_span=>
468-
#do_checks
469452

470-
#[cfg(all(#(#checks),*))]
471453
#[allow(clippy::expect_used, clippy::diverging_sub_expression, clippy::needless_return)]
472454
{
473455
return #rt
@@ -477,10 +459,6 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
477459
.block_on(#body_ident);
478460
}
479461

480-
#[cfg(not(all(#(#checks),*)))]
481-
{
482-
panic!("fell through checks")
483-
}
484462
};
485463

486464
let body = input.body();

tokio-macros/src/lib.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,11 @@ use proc_macro::TokenStream;
7878
///
7979
/// ## Local
8080
///
81-
/// [Unstable API][unstable] only.
82-
///
8381
/// To use the [local runtime], the macro can be configured using
8482
///
8583
/// ```rust
86-
/// # #[cfg(tokio_unstable)]
8784
/// #[tokio::main(flavor = "local")]
8885
/// # async fn main() {}
89-
/// # #[cfg(not(tokio_unstable))]
90-
/// # fn main() {}
9186
/// ```
9287
///
9388
/// # Function arguments
@@ -146,25 +141,19 @@ use proc_macro::TokenStream;
146141
///
147142
/// ## Using the local runtime
148143
///
149-
/// Available in the [unstable API][unstable] only.
150-
///
151144
/// The [local runtime] is similar to the current-thread runtime but
152145
/// supports [`task::spawn_local`](../tokio/task/fn.spawn_local.html).
153146
///
154147
/// ```rust
155-
/// # #[cfg(tokio_unstable)]
156148
/// #[tokio::main(flavor = "local")]
157149
/// async fn main() {
158150
/// println!("Hello world");
159151
/// }
160-
/// # #[cfg(not(tokio_unstable))]
161-
/// # fn main() {}
162152
/// ```
163153
///
164154
/// Equivalent code not using `#[tokio::main]`
165155
///
166156
/// ```rust
167-
/// # #[cfg(tokio_unstable)]
168157
/// fn main() {
169158
/// tokio::runtime::Builder::new_current_thread()
170159
/// .enable_all()
@@ -174,8 +163,6 @@ use proc_macro::TokenStream;
174163
/// println!("Hello world");
175164
/// })
176165
/// }
177-
/// # #[cfg(not(tokio_unstable))]
178-
/// # fn main() {}
179166
/// ```
180167
///
181168
///

0 commit comments

Comments
 (0)