From d92b9ae7164a73e7c9e44a229d0e1eddbe8121cf Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 10 May 2014 21:57:49 -0700 Subject: [PATCH] syntax: Print suffixed token literals correctly Previously, literals "1i" were printed as "1". This fixes the numeric-method-autoexport test for pretty printing. --- src/libsyntax/ast_util.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 74fc43e521b..fb69e440b2f 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -153,6 +153,9 @@ pub fn int_ty_to_str(t: IntTy, val: Option, 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() }