We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
extern crate syn; #[macro_use] extern crate quote; use quote::ToTokens; fn main() { println!("{:?}", syn::parse_str::<syn::Expr>("false").unwrap().into_tokens().into_iter().next().unwrap()); println!("{:?}", quote!(false).into_iter().next().unwrap()); }
output:
$ cargo run Compiling syn_test_0 v0.1.0 (file:///home/mlayzell/Code/syn_test_0) Finished dev [unoptimized + debuginfo] target(s) in 0.97 secs Running `target/debug/syn_test_0` TokenTree { span: Span, kind: Term(Term("false")) } TokenTree { span: Span, kind: Literal(Literal("false")) }
From @dtolnay and I talking on IRC, the correct output is Term and not Literal.
The text was updated successfully, but these errors were encountered:
Running the same thing in a proc macro with proc-macro2/nightly they are both Term, so I guess that is the right answer.
#[proc_macro] pub fn bug(_input: TokenStream) -> TokenStream { println!("{:?}", syn::parse_str::<syn::Expr>("false").unwrap().into_tokens().into_iter().next().unwrap()); println!("{:?}", quote!(false).into_iter().next().unwrap()); TokenStream::empty() }
TokenTree { span: Span(Span { lo: BytePos(5829957), hi: BytePos(5829962), ctxt: #0 }), kind: Term(Term(false)) } TokenTree { span: Span(Span { lo: BytePos(118), hi: BytePos(133), ctxt: #3 }), kind: Term(Term(false)) }
Sorry, something went wrong.
This is actually a bug in proc_macro2 so closing in favour of dtolnay/proc-macro2#51
No branches or pull requests
output:
From @dtolnay and I talking on IRC, the correct output is Term and not Literal.
The text was updated successfully, but these errors were encountered: