-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(deps): Update to syn 2 #12
Conversation
fn visit_receiver(&mut self, _: &'ast syn::Receiver) { | ||
// Do nothing: explicitly ignore any receiver type. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, the built-in visit_receiver
is called which then calls visit_type
on the receiver type (leading to unwanted Clone
bounds which break some tests). Syn 1.0 didn't call visit_type on receivers (I'm a little confused because the receiver type is implicit, but it seems to be represented as if the type is explicit when parsing).
let (expr, expanded) = self.custom_fold_expr(expr); | ||
Stmt::Expr(expr, if expanded { None } else { semi }) | ||
} | ||
Stmt::Macro(macro_stmt) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stmt::Macro
was added in syn 2, so we need to check that too. I turn it into an expr to reuse the above logic but we could try to parse the macro etc directly here too.
}; | ||
|
||
let input = items.tokens.to_token_stream(); | ||
let result = syn::parse2::<syn::TypeTraitObject>(input); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tokens no longer include parens by the looks of it, so can parse directly into the target and remove the BoundsStruct
type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!!
cargo test
passes everything andcargo fmt
is happy. I added some basic CI to run this automatically but it probably needs enabling :)