Fix handling of raw idents in proc-macro2 shim

This commit is contained in:
David Tolnay
2023-07-18 18:28:28 -07:00
parent eb3f2329af
commit 1ddb6c2fdb
2 changed files with 15 additions and 4 deletions
@@ -177,7 +177,11 @@ impl TokenMemory {
let len = buf.read_u16();
let repr = buf.read_str(len as usize);
let span = self.read_span(buf);
let ident = Ident::new(repr, span);
let ident = if let Some(repr) = repr.strip_prefix("r#") {
Ident::new_raw(repr, span)
} else {
Ident::new(repr, span)
};
trees.push(TokenTree::Ident(ident));
}
Kind::Punct(spacing) => {