dtolnay / dtolnay/proc-macro2

Ident construction example is incorrect in the presence of raw identifiers

Open
#302 1 comment 0 reactions 0 assignees View on GitHub
docs
Dominant language
Rust
Stars
934
Forks
135
PR merge metrics
No merged PRs in 30d

Description

The documentation for `Ident` has an example of how to make an ident with a name derived from another: https://docs.rs/proc-macro2/1.0.32/proc_macro2/struct.Ident.html#examples by just interpolating with `format!()`. However, it appears that if the original ident was raw, the output is invalid and unparseable: https://github.com/sfackler/rust-postgres/issues/839.

Is there any way of handling this properly other than something like `format!("__{}", ident.to_string().strip_prefix("r#"))`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.