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 {
33
33
/// Validates and normalizes before converting it to a symbol.
34
34
pub ( crate ) fn new_ident ( string : & str , is_raw : bool ) -> Self {
35
35
// 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" {
37
37
if is_raw && !Self :: can_be_raw ( string) {
38
38
panic ! ( "`{}` cannot be a raw identifier" , string) ;
39
39
}
@@ -79,7 +79,7 @@ impl Symbol {
79
79
// Mimics the behavior of `Symbol::can_be_raw` from `rustc_span`
80
80
fn can_be_raw ( string : & str ) -> bool {
81
81
match string {
82
- "_" | "super" | "self" | "Self" | "crate" => false ,
82
+ "_" | "super" | "self" | "Self" | "crate" | "$crate" => false ,
83
83
_ => true ,
84
84
}
85
85
}
You can’t perform that action at this time.
0 commit comments