syntax: Print suffixed token literals correctly

Previously, literals "1i" were printed as "1". This fixes the
numeric-method-autoexport test for pretty printing.
This commit is contained in:
Alex Crichton 2014-05-10 21:57:49 -07:00
parent 1581fb8d6f
commit d92b9ae716

View File

@ -153,6 +153,9 @@ pub fn int_ty_to_str(t: IntTy, val: Option<i64>, mode: SuffixMode) -> StrBuf {
};
match val {
// cast to a u64 so we can correctly print INT64_MIN. All integral types
// are parsed as u64, so we wouldn't want to print an extra negative
// sign.
Some(n) => format!("{}{}", n as u64, s).to_strbuf(),
None => s.to_strbuf()
}