diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-11 02:10:37 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-11 02:10:37 +0000 |
commit | a095c66d8a5411cd92fb15c901fe09699fdfae77 (patch) | |
tree | 4c6b7440f28edee5f0349a44ae8d9126881d9404 | |
parent | 37d34d9b345438eb4240204572426b981dfaadb3 (diff) | |
parent | 2a19cd3ec7c819464eda9e4ab34a62d64043a49e (diff) | |
download | async-stream-impl-android14-qpr2-s1-release.tar.gz |
Snap for 11084970 from 2a19cd3ec7c819464eda9e4ab34a62d64043a49e to 24Q1-releaseandroid-14.0.0_r37android-14.0.0_r36android-14.0.0_r35android-14.0.0_r34android-14.0.0_r33android-14.0.0_r32android-14.0.0_r31android-14.0.0_r30android-14.0.0_r29android14-qpr2-s5-releaseandroid14-qpr2-s4-releaseandroid14-qpr2-s3-releaseandroid14-qpr2-s2-releaseandroid14-qpr2-s1-releaseandroid14-qpr2-release
Change-Id: Icde46f8c9e4bc06fd482defd42aba6cca39d717d
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | Cargo.toml.orig | 6 | ||||
-rw-r--r-- | METADATA | 10 | ||||
-rw-r--r-- | cargo2android.json | 4 | ||||
-rw-r--r-- | cargo_embargo.json | 3 | ||||
-rw-r--r-- | patches/syn-2.patch | 36 | ||||
-rw-r--r-- | src/lib.rs | 16 |
9 files changed, 26 insertions, 61 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index f6454dd..a155cc9 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "bf41b9645fe39b8865da2f25edc286eb42d49ec8" + "sha1": "af904a02b5ec58472e17f4bfd6b4cb2a17a710f4" }, "path_in_vcs": "async-stream-impl" }
\ No newline at end of file @@ -1,4 +1,4 @@ -// This file is generated by cargo2android.py --config cargo2android.json. +// This file is generated by cargo_embargo. // Do not modify this file as changes will be overridden on upgrade. package { @@ -24,7 +24,7 @@ rust_proc_macro { name: "libasync_stream_impl", crate_name: "async_stream_impl", cargo_env_compat: true, - cargo_pkg_version: "0.3.4", + cargo_pkg_version: "0.3.5", srcs: ["src/lib.rs"], edition: "2018", rustlibs: [ @@ -11,9 +11,9 @@ [package] edition = "2018" -rust-version = "1.45" +rust-version = "1.56" name = "async-stream-impl" -version = "0.3.4" +version = "0.3.5" authors = ["Carl Lerche <me@carllerche.com>"] description = "proc macros for async-stream crate" license = "MIT" @@ -29,7 +29,7 @@ version = "1" version = "1" [dependencies.syn] -version = "1" +version = "2.0.2" features = [ "full", "visit-mut", diff --git a/Cargo.toml.orig b/Cargo.toml.orig index fc0a8e3..5c6be2f 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,8 +1,8 @@ [package] name = "async-stream-impl" -version = "0.3.4" +version = "0.3.5" edition = "2018" -rust-version = "1.45" +rust-version = "1.56" license = "MIT" authors = ["Carl Lerche <me@carllerche.com>"] description = "proc macros for async-stream crate" @@ -13,7 +13,7 @@ proc-macro = true [dependencies] proc-macro2 = "1" -syn = { version = "1", features = ["full", "visit-mut"] } +syn = { version = "2.0.2", features = ["full", "visit-mut"] } quote = "1" [dev-dependencies] @@ -1,6 +1,6 @@ # This project was upgraded with external_updater. # Usage: tools/external_updater/updater.sh update rust/crates/async-stream-impl -# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md +# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md name: "async-stream-impl" description: "proc macros for async-stream crate" @@ -11,13 +11,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/async-stream-impl/async-stream-impl-0.3.4.crate" + value: "https://static.crates.io/crates/async-stream-impl/async-stream-impl-0.3.5.crate" } - version: "0.3.4" + version: "0.3.5" license_type: NOTICE last_upgrade_date { year: 2023 - month: 3 - day: 2 + month: 11 + day: 10 } } diff --git a/cargo2android.json b/cargo2android.json deleted file mode 100644 index bf78496..0000000 --- a/cargo2android.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "device": true, - "run": true -}
\ No newline at end of file diff --git a/cargo_embargo.json b/cargo_embargo.json new file mode 100644 index 0000000..cb908d7 --- /dev/null +++ b/cargo_embargo.json @@ -0,0 +1,3 @@ +{ + "run_cargo": false +} diff --git a/patches/syn-2.patch b/patches/syn-2.patch deleted file mode 100644 index 7a8225c..0000000 --- a/patches/syn-2.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/src/lib.rs b/src/lib.rs -index 7309648..03fb529 100644 ---- a/src/lib.rs -+++ b/src/lib.rs -@@ -1,4 +1,3 @@ --extern crate proc_macro; - use proc_macro::TokenStream; - use proc_macro2::{Group, TokenStream as TokenStream2, TokenTree}; - use quote::quote; -@@ -148,7 +147,7 @@ impl VisitMut for Scrub<'_> { - syn::Expr::ForLoop(expr) => { - syn::visit_mut::visit_expr_for_loop_mut(self, expr); - // TODO: Should we allow other attributes? -- if expr.attrs.len() != 1 || !expr.attrs[0].path.is_ident("await") { -+ if expr.attrs.len() != 1 || !expr.attrs[0].path().is_ident("await_") { - return; - } - let syn::ExprForLoop { -@@ -161,7 +160,7 @@ impl VisitMut for Scrub<'_> { - } = expr; - - let attr = attrs.pop().unwrap(); -- if let Err(e) = syn::parse2::<syn::parse::Nothing>(attr.tokens) { -+ if let Err(e) = attr.meta.require_path_only() { - *i = syn::parse2(e.to_compile_error()).unwrap(); - return; - } -@@ -281,7 +280,7 @@ fn replace_for_await(input: impl IntoIterator<Item = TokenTree>) -> TokenStream2 - TokenTree::Ident(ident) => { - match input.peek() { - Some(TokenTree::Ident(next)) if ident == "for" && next == "await" => { -- tokens.extend(quote!(#[#next])); -+ tokens.extend(quote!(#[await_])); - let _ = input.next(); - } - _ => {} @@ -148,7 +148,7 @@ impl VisitMut for Scrub<'_> { syn::Expr::ForLoop(expr) => { syn::visit_mut::visit_expr_for_loop_mut(self, expr); // TODO: Should we allow other attributes? - if expr.attrs.len() != 1 || !expr.attrs[0].path().is_ident("await_") { + if expr.attrs.len() != 1 || !expr.attrs[0].meta.path().is_ident(AWAIT_ATTR_NAME) { return; } let syn::ExprForLoop { @@ -160,11 +160,7 @@ impl VisitMut for Scrub<'_> { .. } = expr; - let attr = attrs.pop().unwrap(); - if let Err(e) = attr.meta.require_path_only() { - *i = syn::parse2(e.to_compile_error()).unwrap(); - return; - } + attrs.pop().unwrap(); let crate_path = self.crate_path; *i = syn::parse_quote! {{ @@ -271,6 +267,10 @@ pub fn try_stream_inner(input: TokenStream) -> TokenStream { .into() } +// syn 2.0 wont parse `#[await] for x in xs {}` +// because `await` is a keyword, use `await_` instead +const AWAIT_ATTR_NAME: &str = "await_"; + /// Replace `for await` with `#[await] for`, which will be later transformed into a `next` loop. fn replace_for_await(input: impl IntoIterator<Item = TokenTree>) -> TokenStream2 { let mut input = input.into_iter().peekable(); @@ -281,7 +281,9 @@ fn replace_for_await(input: impl IntoIterator<Item = TokenTree>) -> TokenStream2 TokenTree::Ident(ident) => { match input.peek() { Some(TokenTree::Ident(next)) if ident == "for" && next == "await" => { - tokens.extend(quote!(#[await_])); + let next_span = next.span(); + let next = syn::Ident::new(AWAIT_ATTR_NAME, next_span); + tokens.extend(quote!(#[#next])); let _ = input.next(); } _ => {} |