File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ impl Symbol {
3333 /// Validates and normalizes before converting it to a symbol.
3434 pub ( crate ) fn new_ident ( string : & str , is_raw : bool ) -> Self {
3535 // Fast-path: check if this is a valid ASCII identifier
36- if Self :: is_valid_ascii_ident ( string. as_bytes ( ) ) {
36+ if Self :: is_valid_ascii_ident ( string. as_bytes ( ) ) || string == "$crate" {
3737 if is_raw && !Self :: can_be_raw ( string) {
3838 panic ! ( "`{}` cannot be a raw identifier" , string) ;
3939 }
@@ -79,7 +79,7 @@ impl Symbol {
7979 // Mimics the behavior of `Symbol::can_be_raw` from `rustc_span`
8080 fn can_be_raw ( string : & str ) -> bool {
8181 match string {
82- "_" | "super" | "self" | "Self" | "crate" => false ,
82+ "_" | "super" | "self" | "Self" | "crate" | "$crate" => false ,
8383 _ => true ,
8484 }
8585 }
You can’t perform that action at this time.
0 commit comments