aboutsummaryrefslogtreecommitdiff
path: root/src/entry.rs
diff options
context:
space:
mode:
authorJoshua Duong <joshuaduong@google.com>2024-02-06 17:42:39 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-02-06 17:42:39 +0000
commitbfcdd7eb0099cc06efb3ec463dce9b3c0c6ae35d (patch)
treece8f730fbe7661357823cb65ec27c8eae63cc186 /src/entry.rs
parentf1a2e97db8d03154e999b2b0c9c5cee9f0282095 (diff)
parent7840b9dedd40fbbd27effdf824e8734319f58ac1 (diff)
downloadtokio-macros-emu-34-2-dev.tar.gz
Revert "Upgrade tokio-macros to 2.2.0" am: 7840b9deddemu-34-2-dev
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/tokio-macros/+/2953667 Change-Id: I54b36fd931deafd4b61fd2849ef2c9bab18081aa Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'src/entry.rs')
-rw-r--r--src/entry.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/entry.rs b/src/entry.rs
index 3706026..edac530 100644
--- a/src/entry.rs
+++ b/src/entry.rs
@@ -126,22 +126,22 @@ impl Configuration {
}
fn build(&self) -> Result<FinalConfig, syn::Error> {
- use RuntimeFlavor as F;
-
let flavor = self.flavor.unwrap_or(self.default_flavor);
+ use RuntimeFlavor::*;
+
let worker_threads = match (flavor, self.worker_threads) {
- (F::CurrentThread, Some((_, worker_threads_span))) => {
+ (CurrentThread, Some((_, worker_threads_span))) => {
let msg = format!(
"The `worker_threads` option requires the `multi_thread` runtime flavor. Use `#[{}(flavor = \"multi_thread\")]`",
self.macro_name(),
);
return Err(syn::Error::new(worker_threads_span, msg));
}
- (F::CurrentThread, None) => None,
- (F::Threaded, worker_threads) if self.rt_multi_thread_available => {
+ (CurrentThread, None) => None,
+ (Threaded, worker_threads) if self.rt_multi_thread_available => {
worker_threads.map(|(val, _span)| val)
}
- (F::Threaded, _) => {
+ (Threaded, _) => {
let msg = if self.flavor.is_none() {
"The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled."
} else {
@@ -152,14 +152,14 @@ impl Configuration {
};
let start_paused = match (flavor, self.start_paused) {
- (F::Threaded, Some((_, start_paused_span))) => {
+ (Threaded, Some((_, start_paused_span))) => {
let msg = format!(
"The `start_paused` option requires the `current_thread` runtime flavor. Use `#[{}(flavor = \"current_thread\")]`",
self.macro_name(),
);
return Err(syn::Error::new(start_paused_span, msg));
}
- (F::CurrentThread, Some((start_paused, _))) => Some(start_paused),
+ (CurrentThread, Some((start_paused, _))) => Some(start_paused),
(_, None) => None,
};
@@ -354,10 +354,10 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
},
};
if let Some(v) = config.worker_threads {
- rt = quote_spanned! {last_stmt_start_span=> #rt.worker_threads(#v) };
+ rt = quote! { #rt.worker_threads(#v) };
}
if let Some(v) = config.start_paused {
- rt = quote_spanned! {last_stmt_start_span=> #rt.start_paused(#v) };
+ rt = quote! { #rt.start_paused(#v) };
}
let header = if is_test {
@@ -402,7 +402,7 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
quote! {
let body = async #body;
#crate_path::pin!(body);
- let body: ::core::pin::Pin<&mut dyn ::core::future::Future<Output = #output_type>> = body;
+ let body: ::std::pin::Pin<&mut dyn ::std::future::Future<Output = #output_type>> = body;
}
} else {
quote! {
@@ -586,6 +586,6 @@ impl ToTokens for Body<'_> {
for stmt in self.stmts {
stmt.to_tokens(tokens);
}
- });
+ })
}
}