about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-10 21:57:49 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-13 17:24:08 -0700
commitd92b9ae7164a73e7c9e44a229d0e1eddbe8121cf (patch)
treef741b04f9b14c946901a266087e5c7fc58795648 /src/libsyntax
parent1581fb8d6f17d8e58589ee880d4c946e60c95b20 (diff)
downloadrust-d92b9ae7164a73e7c9e44a229d0e1eddbe8121cf.tar.gz
rust-d92b9ae7164a73e7c9e44a229d0e1eddbe8121cf.zip
syntax: Print suffixed token literals correctly
Previously, literals "1i" were printed as "1". This fixes the
numeric-method-autoexport test for pretty printing.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_util.rs3
1 files changed, 3 insertions, 0 deletions
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<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()
     }