about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-15 18:40:50 +0000
committerbors <bors@rust-lang.org>2020-12-15 18:40:50 +0000
commitf76ecd0668fcdb289456cdc72a39ad15467cc454 (patch)
tree31e2a2ba4a3bde47d30275b20fff826fa4749f59 /compiler
parente15ec667cee92d47c64fc903227b2fdb81f9e530 (diff)
parenta16904fecf0ad1c46f9c11c6b193bdbb6421bf17 (diff)
downloadrust-f76ecd0668fcdb289456cdc72a39ad15467cc454.tar.gz
rust-f76ecd0668fcdb289456cdc72a39ad15467cc454.zip
Auto merge of #80044 - jyn514:smaller-name, r=GuillaumeGomez
[rustdoc] 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.

Helps with #79103.

r? `@GuillaumeGomez`
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_span/src/symbol.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index b60d466c3a7..f61a32a0f79 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -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