Allow drivers to supply a list of extra symbols to intern
This commit is contained in:
parent
87e60a7d28
commit
f740326216
23 changed files with 115 additions and 58 deletions
|
@ -45,7 +45,7 @@ const TAG_EXPN_DATA: u8 = 1;
|
|||
// Tags for encoding Symbol's
|
||||
const SYMBOL_STR: u8 = 0;
|
||||
const SYMBOL_OFFSET: u8 = 1;
|
||||
const SYMBOL_PREINTERNED: u8 = 2;
|
||||
const SYMBOL_PREDEFINED: u8 = 2;
|
||||
|
||||
/// Provides an interface to incremental compilation data cached from the
|
||||
/// previous compilation session. This data will eventually include the results
|
||||
|
@ -673,9 +673,9 @@ impl<'a, 'tcx> SpanDecoder for CacheDecoder<'a, 'tcx> {
|
|||
Symbol::intern(s)
|
||||
})
|
||||
}
|
||||
SYMBOL_PREINTERNED => {
|
||||
SYMBOL_PREDEFINED => {
|
||||
let symbol_index = self.read_u32();
|
||||
Symbol::new_from_decoded(symbol_index)
|
||||
Symbol::new(symbol_index)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
@ -891,9 +891,9 @@ impl<'a, 'tcx> SpanEncoder for CacheEncoder<'a, 'tcx> {
|
|||
|
||||
// copy&paste impl from rustc_metadata
|
||||
fn encode_symbol(&mut self, symbol: Symbol) {
|
||||
// if symbol preinterned, emit tag and symbol index
|
||||
if symbol.is_preinterned() {
|
||||
self.encoder.emit_u8(SYMBOL_PREINTERNED);
|
||||
// if symbol predefined, emit tag and symbol index
|
||||
if symbol.is_predefined() {
|
||||
self.encoder.emit_u8(SYMBOL_PREDEFINED);
|
||||
self.encoder.emit_u32(symbol.as_u32());
|
||||
} else {
|
||||
// otherwise write it as string or as offset to it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue