From 042c8ae40e0bb642263d8b891ef7a0d4e81fe819 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 10 May 2014 20:16:51 -0700 Subject: 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. --- src/libsyntax/parse/token.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libsyntax/parse') 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(".") { -- cgit 1.4.1-3-g733a5