Skip to content

Ident construction example is incorrect in the presence of raw identifiers #302

Open
@sfackler

Description

@sfackler

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: sfackler/rust-postgres#839.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions