diff options
| author | bors <bors@rust-lang.org> | 2018-04-18 14:44:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-04-18 14:44:54 +0000 |
| commit | 3dfda165259bf6beefab31bf8708bdf3ec505fe0 (patch) | |
| tree | fc39639749811c041d34696e7117d83dfc7642ed /src/libsyntax/parse | |
| parent | 65d201f7d682ad921ac6e67ac07f922aa63a8ce4 (diff) | |
| parent | 4d34bfd00a57f8a8bdb60ec3f908c5d4256f8a9a (diff) | |
| download | rust-3dfda165259bf6beefab31bf8708bdf3ec505fe0.tar.gz rust-3dfda165259bf6beefab31bf8708bdf3ec505fe0.zip | |
Auto merge of #49993 - nnethercote:shrink-Token, r=alexcrichton
Change the hashcounts in raw `Lit` variants from usize to u16. This reduces the size of `Token` from 32 bytes to 24 bytes on 64-bit platforms.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index cb3323c7eca..22a0261d8c6 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -133,12 +133,12 @@ impl<'a> StringReader<'a> { Ok(ret_val) } - fn fail_unterminated_raw_string(&self, pos: BytePos, hash_count: usize) { + fn fail_unterminated_raw_string(&self, pos: BytePos, hash_count: u16) { let mut err = self.struct_span_fatal(pos, pos, "unterminated raw string"); err.span_label(self.mk_sp(pos, pos), "unterminated raw string"); if hash_count > 0 { err.note(&format!("this raw string should be terminated with `\"{}`", - "#".repeat(hash_count))); + "#".repeat(hash_count as usize))); } err.emit(); FatalError.raise(); @@ -1439,7 +1439,7 @@ impl<'a> StringReader<'a> { 'r' => { let start_bpos = self.pos; self.bump(); - let mut hash_count = 0; + let mut hash_count: u16 = 0; while self.ch_is('#') { self.bump(); hash_count += 1; diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 0913ed86147..2688a1adb56 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -72,9 +72,9 @@ pub enum Lit { Integer(ast::Name), Float(ast::Name), Str_(ast::Name), - StrRaw(ast::Name, usize), /* raw str delimited by n hash symbols */ + StrRaw(ast::Name, u16), /* raw str delimited by n hash symbols */ ByteStr(ast::Name), - ByteStrRaw(ast::Name, usize), /* raw byte str delimited by n hash symbols */ + ByteStrRaw(ast::Name, u16), /* raw byte str delimited by n hash symbols */ } impl Lit { |
