We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a90510 commit dcb20d7Copy full SHA for dcb20d7
1 file changed
proc_macro/src/bridge/symbol.rs
@@ -33,7 +33,7 @@ impl Symbol {
33
/// Validates and normalizes before converting it to a symbol.
34
pub(crate) fn new_ident(string: &str, is_raw: bool) -> Self {
35
// Fast-path: check if this is a valid ASCII identifier
36
- if Self::is_valid_ascii_ident(string.as_bytes()) {
+ if Self::is_valid_ascii_ident(string.as_bytes()) || string == "$crate" {
37
if is_raw && !Self::can_be_raw(string) {
38
panic!("`{}` cannot be a raw identifier", string);
39
}
@@ -79,7 +79,7 @@ impl Symbol {
79
// Mimics the behavior of `Symbol::can_be_raw` from `rustc_span`
80
fn can_be_raw(string: &str) -> bool {
81
match string {
82
- "_" | "super" | "self" | "Self" | "crate" => false,
+ "_" | "super" | "self" | "Self" | "crate" | "$crate" => false,
83
_ => true,
84
85
0 commit comments