diff options
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | Cargo.toml | 8 | ||||
-rw-r--r-- | Cargo.toml.orig | 8 | ||||
-rw-r--r-- | METADATA | 25 | ||||
-rw-r--r-- | src/entry.rs | 24 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/select.rs | 10 |
9 files changed, 43 insertions, 48 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index cd314c7..da31265 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "49eb26f159c839fb34f4ce964759692443ca1302" + "sha1": "66c62a4b74f9da7be3198bb7ac77d8d18967d51e" }, "path_in_vcs": "tokio-macros" }
\ No newline at end of file @@ -22,9 +22,9 @@ rust_proc_macro { name: "libtokio_macros", crate_name: "tokio_macros", cargo_env_compat: true, - cargo_pkg_version: "2.2.0", + cargo_pkg_version: "2.1.0", srcs: ["src/lib.rs"], - edition: "2021", + edition: "2018", rustlibs: [ "libproc_macro2", "libquote", diff --git a/CHANGELOG.md b/CHANGELOG.md index 3296139..e9d58db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,3 @@ -# 2.2.0 (November 19th, 2023) - -### Changed - -- use `::core` qualified imports instead of `::std` inside `tokio::test` macro ([#5973]) - -[#5973]: https://github.com/tokio-rs/tokio/pull/5973 - # 2.1.0 (April 25th, 2023) - macros: fix typo in `#[tokio::test]` docs ([#5636]) @@ -10,10 +10,10 @@ # See Cargo.toml.orig for the original contents. [package] -edition = "2021" -rust-version = "1.63" +edition = "2018" +rust-version = "1.56" name = "tokio-macros" -version = "2.2.0" +version = "2.1.0" authors = ["Tokio Contributors <team@tokio.rs>"] description = """ Tokio's proc macros. @@ -31,7 +31,7 @@ all-features = true proc-macro = true [dependencies.proc-macro2] -version = "1.0.60" +version = "1.0.7" [dependencies.quote] version = "1" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index ea9839c..4ca789d 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -4,9 +4,9 @@ name = "tokio-macros" # - Remove path dependencies # - Update CHANGELOG.md. # - Create "tokio-macros-1.x.y" git tag. -version = "2.2.0" -edition = "2021" -rust-version = "1.63" +version = "2.1.0" +edition = "2018" +rust-version = "1.56" authors = ["Tokio Contributors <team@tokio.rs>"] license = "MIT" repository = "https://github.com/tokio-rs/tokio" @@ -22,7 +22,7 @@ proc-macro = true [features] [dependencies] -proc-macro2 = "1.0.60" +proc-macro2 = "1.0.7" quote = "1" syn = { version = "2.0", features = ["full"] } @@ -1,20 +1,23 @@ # This project was upgraded with external_updater. -# Usage: tools/external_updater/updater.sh update external/rust/crates/tokio-macros -# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md +# Usage: tools/external_updater/updater.sh update rust/crates/tokio-macros +# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md name: "tokio-macros" description: "Tokio\'s proc macros." third_party { + url { + type: HOMEPAGE + value: "https://crates.io/crates/tokio-macros" + } + url { + type: ARCHIVE + value: "https://static.crates.io/crates/tokio-macros/tokio-macros-2.1.0.crate" + } + version: "2.1.0" license_type: NOTICE last_upgrade_date { - year: 2024 - month: 2 - day: 5 - } - homepage: "https://crates.io/crates/tokio-macros" - identifier { - type: "Archive" - value: "https://static.crates.io/crates/tokio-macros/tokio-macros-2.2.0.crate" - version: "2.2.0" + year: 2023 + month: 11 + day: 1 } } 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); } - }); + }) } } @@ -209,7 +209,7 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream { /// Marks async function to be executed by selected runtime. This macro helps set up a `Runtime` /// without requiring the user to use [Runtime](../tokio/runtime/struct.Runtime.html) or -/// [Builder](../tokio/runtime/struct.Builder.html) directly. +/// [Builder](../tokio/runtime/struct.builder.html) directly. /// /// ## Function arguments: /// diff --git a/src/select.rs b/src/select.rs index 324b8f9..dd491f8 100644 --- a/src/select.rs +++ b/src/select.rs @@ -73,27 +73,27 @@ fn clean_pattern(pat: &mut syn::Pat) { } } syn::Pat::Or(or) => { - for case in &mut or.cases { + for case in or.cases.iter_mut() { clean_pattern(case); } } syn::Pat::Slice(slice) => { - for elem in &mut slice.elems { + for elem in slice.elems.iter_mut() { clean_pattern(elem); } } syn::Pat::Struct(struct_pat) => { - for field in &mut struct_pat.fields { + for field in struct_pat.fields.iter_mut() { clean_pattern(&mut field.pat); } } syn::Pat::Tuple(tuple) => { - for elem in &mut tuple.elems { + for elem in tuple.elems.iter_mut() { clean_pattern(elem); } } syn::Pat::TupleStruct(tuple) => { - for elem in &mut tuple.elems { + for elem in tuple.elems.iter_mut() { clean_pattern(elem); } } |