Upgrade async-stream-impl to 0.3.5 am: 4ab16ea170 am: 7d5d7eb3f0

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/async-stream-impl/+/2826131

Change-Id: Ice5bbba10fefc20c3db262247aaba18046427bba
Signed-off-by: Automerger Merge Worker <[email protected]>
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
diff --git a/Android.bp b/Android.bp
index 0516029..35cc88d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -24,7 +24,7 @@
     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: [
diff --git a/Cargo.toml b/Cargo.toml
index 4b74dfb..51f8dd0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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 <[email protected]>"]
 description = "proc macros for async-stream crate"
 license = "MIT"
@@ -29,7 +29,7 @@
 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 <[email protected]>"]
 description = "proc macros for async-stream crate"
@@ -13,7 +13,7 @@
 
 [dependencies]
 proc-macro2 = "1"
-syn = { version = "1", features = ["full", "visit-mut"] }
+syn = { version = "2.0.2", features = ["full", "visit-mut"] }
 quote = "1"
 
 [dev-dependencies]
diff --git a/METADATA b/METADATA
index 7fb5079..935ce70 100644
--- a/METADATA
+++ b/METADATA
@@ -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 @@
   }
   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/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();
-                     }
-                     _ => {}
diff --git a/src/lib.rs b/src/lib.rs
index d3aafa9..8a9561b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -148,7 +148,7 @@
             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 @@
                     ..
                 } = 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 @@
     .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 @@
             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();
                     }
                     _ => {}