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.
This commit is contained in:
bors
2018-04-18 14:44:54 +00:00
7 changed files with 19 additions and 14 deletions

View File

@@ -234,11 +234,11 @@ pub fn token_to_string(tok: &Token) -> String {
token::Integer(c) => c.to_string(),
token::Str_(s) => format!("\"{}\"", s),
token::StrRaw(s, n) => format!("r{delim}\"{string}\"{delim}",
delim=repeat("#", n),
delim=repeat("#", n as usize),
string=s),
token::ByteStr(v) => format!("b\"{}\"", v),
token::ByteStrRaw(s, n) => format!("br{delim}\"{string}\"{delim}",
delim=repeat("#", n),
delim=repeat("#", n as usize),
string=s),
};
@@ -660,7 +660,7 @@ pub trait PrintState<'a> {
}
ast::StrStyle::Raw(n) => {
(format!("r{delim}\"{string}\"{delim}",
delim=repeat("#", n),
delim=repeat("#", n as usize),
string=st))
}
};