dtolnay / quote

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

How to build path of two idents? #279

Open obsoleszenz opened 2 months ago

obsoleszenz commented 2 months ago

I want to create a Foo::Bartoken stream and am currently trying it like this:


let foo = format_ident!("Foo");
let bar = format_ident!("Bar");
quote! {
  #foo::#bar
}

but this results in a token stream of `Foo :: Bar` which the compiler doesn't accept. 
Odilf commented 1 day ago

You can do it with format_ident