Skip to content

Commit

Permalink
Touch up new_raw workaround comment
Browse files Browse the repository at this point in the history
This comment was copied verbatim from quote but that code was
substantially different. They started with a string _including_ the r#
prefix, and then used &id[2..] to obtain an unraw version of it, which
is what "unraw" in the comment refers to. The code in proc-macro2 is
doing the opposite.
  • Loading branch information
dtolnay committed Jun 20, 2022
1 parent 3191e5e commit c08b24a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,9 +699,9 @@ impl Ident {
#[cfg(no_ident_new_raw)]
Span::Compiler(s) => {
let _ = proc_macro::Ident::new(string, s);
// At this point, the identifier is raw, and the unraw-ed version of it was
// successfully converted into an identifier. Try to produce a valid raw
// identifier by running the `TokenStream` parser, and unwrapping the first
// At this point the un-r#-prefixed string is known to be a
// valid identifier. Try to produce a valid raw identifier by
// running the `TokenStream` parser, and unwrapping the first
// token as an `Ident`.
let raw_prefixed = format!("r#{}", string);
if let Ok(ts) = raw_prefixed.parse::<proc_macro::TokenStream>() {
Expand Down

0 comments on commit c08b24a

Please sign in to comment.