Skip to content
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

Ident and raw_identifiers #140

Closed
haraldh opened this issue Oct 26, 2018 · 1 comment
Closed

Ident and raw_identifiers #140

haraldh opened this issue Oct 26, 2018 · 1 comment

Comments

@haraldh
Copy link

haraldh commented Oct 26, 2018

Is this supposed to work with rust-1.30, with rust-lang/rust#53236 merged ??

extern crate proc_macro2;
use proc_macro2::{Ident, Span};

fn main() {
    let _tname = Ident::new("r#enum", Span::call_site());
}

gives:

thread 'main' panicked at '"r#enum" is not a valid Ident'
[…]
   7: proc_macro2::stable::validate_term
             at […]/proc-macro2-0.4.20/src/stable.rs:580
[…]
@dtolnay
Copy link
Owner

dtolnay commented Oct 26, 2018

I don't think so. You are going to need Ident::new_raw once stabilized. For now I would recommend using syn:

let _tname: proc_macro2::Ident = syn::parse_str("r#enum").unwrap();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants