dtolnay / quote

Rust quasi-quoting
Apache License 2.0
1.32k stars 90 forks source link

By design? `<&str as quote::ToTokens>::into_token_stream()` produces different output from `proc_macro2::TokenStream::from_str()` #272

Closed Houtamelo closed 8 months ago

Houtamelo commented 8 months ago

Example case: This test does not pass due to panicking in the assertion.

#[test]
fn show_quote_bug() {
    let literal = r#"$player_name == "Alice""#;

    let from_quote = quote::ToTokens::into_token_stream(literal).to_string();
    let from_str = proc_macro2::TokenStream::from_str(literal).unwrap().to_string();

    assert_eq!(from_quote, from_str);
}
dtolnay commented 8 months ago

Yes, those are intentionally different operations.