diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-10 21:57:49 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-13 17:24:08 -0700 |
| commit | d92b9ae7164a73e7c9e44a229d0e1eddbe8121cf (patch) | |
| tree | f741b04f9b14c946901a266087e5c7fc58795648 /src/libsyntax | |
| parent | 1581fb8d6f17d8e58589ee880d4c946e60c95b20 (diff) | |
| download | rust-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.rs | 3 |
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() } |
