Auto merge of #100803 - klensy:do-not-encode-preinterned-symbols, r=bjorn3
Symbols: do not write string values of preinterned symbols into compiled artifacts r? `@bjorn3` Followup for #98851 https://github.com/rust-lang/rust/pull/98851#issuecomment-1215606291
This commit is contained in:
commit
ebfc7aa531
6 changed files with 57 additions and 23 deletions
|
@ -1804,6 +1804,11 @@ impl Symbol {
|
|||
Symbol(SymbolIndex::from_u32(n))
|
||||
}
|
||||
|
||||
/// for use in Decoder only
|
||||
pub fn new_from_decoded(n: u32) -> Self {
|
||||
Self::new(n)
|
||||
}
|
||||
|
||||
/// Maps a string to its interned representation.
|
||||
pub fn intern(string: &str) -> Self {
|
||||
with_session_globals(|session_globals| session_globals.symbol_interner.intern(string))
|
||||
|
@ -2028,6 +2033,11 @@ impl Symbol {
|
|||
pub fn can_be_raw(self) -> bool {
|
||||
self != kw::Empty && self != kw::Underscore && !self.is_path_segment_keyword()
|
||||
}
|
||||
|
||||
/// Is this symbol was interned in compiler's `symbols!` macro
|
||||
pub fn is_preinterned(self) -> bool {
|
||||
self.as_u32() < PREINTERNED_SYMBOLS_COUNT
|
||||
}
|
||||
}
|
||||
|
||||
impl Ident {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue