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:
@@ -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))
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user