diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-10 20:16:51 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-13 17:24:08 -0700 |
| commit | 042c8ae40e0bb642263d8b891ef7a0d4e81fe819 (patch) | |
| tree | 295aff8b5b6d876551a956fdf5e565a448b9dda9 /src/libsyntax/parse | |
| parent | 12375304524ffe732752f5a29551c2caf0b14b4f (diff) | |
| download | rust-042c8ae40e0bb642263d8b891ef7a0d4e81fe819.tar.gz rust-042c8ae40e0bb642263d8b891ef7a0d4e81fe819.zip | |
syntax: Fix printing INT64_MIN
Integers are always parsed as a u64 in libsyntax, but they're stored as i64. The parser and pretty printer both printed an i64 instead of u64, sometimes introducing an extra negative sign.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 3888ed6b8d1..68ce8cb2bc1 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -203,9 +203,11 @@ pub fn to_str(t: &Token) -> StrBuf { res.push_char('\''); res } - LIT_INT(i, t) => ast_util::int_ty_to_str(t, Some(i)), - LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u)), - LIT_INT_UNSUFFIXED(i) => { i.to_str().to_strbuf() } + LIT_INT(i, t) => ast_util::int_ty_to_str(t, Some(i), + ast_util::ForceSuffix), + LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u), + ast_util::ForceSuffix), + LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_strbuf() } LIT_FLOAT(s, t) => { let mut body = StrBuf::from_str(get_ident(s).get()); if body.as_slice().ends_with(".") { |
