summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Maurer <mmaurer@google.com>2023-04-04 17:49:25 +0000
committerMatthew Maurer <mmaurer@google.com>2023-04-04 17:50:09 +0000
commit4497fb4f594cae6ec50103f81290e4856c9c35b4 (patch)
tree278cd717328a38239d72fb975fe34d3ead755cc3
parent497fba26c01c3bfb28224c17eff513e753f083fa (diff)
downloadasync-stream-impl-4497fb4f594cae6ec50103f81290e4856c9c35b4.tar.gz
Update to syn-2
Bug: 276463929 Test: mm Change-Id: Id10486e0cd7d2bbd98ec8a7b12d8884b7b927c3c
-rw-r--r--patches/syn-2.patch36
-rw-r--r--src/lib.rs6
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();
+ }
+ _ => {}
diff --git a/src/lib.rs b/src/lib.rs
index 7309648..d3aafa9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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();
}
_ => {}