1
Fork 0

Switch to Symbol for item.name

This decreases the size of `Item` from 680 to 616 bytes. It also does a
lot less work since it no longer has to copy as much.
This commit is contained in:
Joshua Nelson 2020-12-14 19:30:36 -05:00
parent 89fc5034f4
commit a16904fecf
10 changed files with 78 additions and 45 deletions

View file

@ -1469,6 +1469,10 @@ impl Symbol {
self.0.as_u32()
}
pub fn is_empty(self) -> bool {
self == kw::Invalid
}
/// This method is supposed to be used in error messages, so it's expected to be
/// identical to printing the original identifier token written in source code
/// (`token_to_string`, `Ident::to_string`), except that symbols don't keep the rawness flag