Handle $crate special case

This commit is contained in:
David Tolnay 2023-07-19 16:32:59 -07:00
parent 6c0e838a7c
commit 7e8f978ca9
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -78,6 +78,8 @@ pub fn load(buf: &mut InputBuffer) -> TokenStream {
let repr = buf.read_str(len as usize);
let ident = if let Some(repr) = repr.strip_prefix("r#") {
proc_macro2::Ident::new_raw(repr, proc_macro2::Span::call_site())
} else if repr == "$crate" {
proc_macro2::Ident::new("crate", proc_macro2::Span::call_site())
} else {
proc_macro2::Ident::new(repr, proc_macro2::Span::call_site())
};