diff options
author | Matthew Maurer <mmaurer@google.com> | 2023-05-26 20:23:03 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-05-26 20:23:03 +0000 |
commit | a2ad5a30b1384932abd963df640bf372ba2250a6 (patch) | |
tree | 278cd717328a38239d72fb975fe34d3ead755cc3 | |
parent | eb2f621118244c2ed5029622c9bb7bf72cca6e98 (diff) | |
parent | 4497fb4f594cae6ec50103f81290e4856c9c35b4 (diff) | |
download | async-stream-impl-a2ad5a30b1384932abd963df640bf372ba2250a6.tar.gz |
Update to syn-2 am: 4497fb4f59
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/async-stream-impl/+/2522575
Change-Id: Iabe6bafe2807371604177fafcf47e8066a83f0d8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | patches/syn-2.patch | 36 | ||||
-rw-r--r-- | src/lib.rs | 6 |
2 files changed, 39 insertions, 3 deletions
diff --git a/patches/syn-2.patch b/patches/syn-2.patch new file mode 100644 index 0000000..7a8225c --- /dev/null +++ b/patches/syn-2.patch @@ -0,0 +1,36 @@ +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].path().is_ident("await_") { return; } let syn::ExprForLoop { @@ -161,7 +161,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 +281,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(); } _ => {} |