Skip to content

Stop using TokenStream::from_str to implement syn::parse_str #444

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

Closed
dtolnay opened this issue Jun 18, 2018 · 1 comment
Closed

Stop using TokenStream::from_str to implement syn::parse_str #444

dtolnay opened this issue Jun 18, 2018 · 1 comment
Milestone

Comments

@dtolnay
Copy link
Owner

dtolnay commented Jun 18, 2018

The FromStr impl has bizarre hygiene behavior because it was stabilized back in Rust 1.15.0. Instead we should have syn::parse_str do something more like LitStr::parse by respanning the input to a reasonable span, probably Span::call_site().

I believe the bizarreness is tracked in rust-lang/rust#50050 -- the spans produced by FromStr are intended to be "copy and paste hygiene" but are somehow not actually.

@alexcrichton

@dtolnay
Copy link
Owner Author

dtolnay commented Jul 22, 2018

This has been obviated upstream by rust-lang/rust#51762.

@dtolnay dtolnay closed this as completed Jul 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant