diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-05-09 11:54:47 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-05-10 15:59:12 +1000 |
| commit | c2cae7bbc3880ec2874b32756c7c5dc52997a552 (patch) | |
| tree | 13959efb8eba8a2d02d968dbd12562498b71a3c5 /src/libsyntax_pos | |
| parent | 8c465b4efab9dec55434193acacf0a10e83c3ae0 (diff) | |
| download | rust-c2cae7bbc3880ec2874b32756c7c5dc52997a552.tar.gz rust-c2cae7bbc3880ec2874b32756c7c5dc52997a552.zip | |
Avoid recursion in de-gensym functions.
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 107cf8360c4..e8472e1b9f1 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -492,7 +492,7 @@ impl Interner { if (symbol.0.as_usize()) < self.strings.len() { symbol } else { - self.interned(self.gensyms[(SymbolIndex::MAX_AS_U32 - symbol.0.as_u32()) as usize]) + self.gensyms[(SymbolIndex::MAX_AS_U32 - symbol.0.as_u32()) as usize] } } @@ -513,7 +513,10 @@ impl Interner { pub fn get(&self, symbol: Symbol) -> &str { match self.strings.get(symbol.0.as_usize()) { Some(string) => string, - None => self.get(self.gensyms[(SymbolIndex::MAX_AS_U32 - symbol.0.as_u32()) as usize]), + None => { + let symbol = self.gensyms[(SymbolIndex::MAX_AS_U32 - symbol.0.as_u32()) as usize]; + self.strings[symbol.0.as_usize()] + } } } } |
