syn
syn copied to clipboard
Failure when parsing anonymous parameters
This snippet of code from dtoa
fails parsing with syn
1.0.13:
pub trait Floating {
fn write<W: io::Write>(self, W) -> io::Result<usize>;
}
Giving the error Error("expected `:`")
. This is valid code in edition 2015, edition 2018 has made it a hard error, here's a playground which compiles successfully with the code, and shows the error from syn
.
I have also locally tested defining an identity proc-macro-attribute
which attempts to parse whatever it's applied to as an syn::Item
. That also fails with the same error message.
See-also #733. Recent versions of syn
don't handle parsing edition 2015-only code.
Version 0.13.0 is also out-of-date, the latest version is 1.0.13.
Whoops, I meant 1.0.13.
If syn
isn’t planning to support edition 2015 code it would be good to note that somewhere. I did take a quick look through the docs to try and figure out if it was a purposeful omission.
Closing as a duplicate of #733. I don't plan to change how this is parsed.
Regarding documentation, I am skeptical that this would come up often enough to be worth dedicating documentation to.