Skip to content

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

@dtolnay

Description

@dtolnay

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions