Skip to content

Commit d92b9ae

Browse files
committed
syntax: Print suffixed token literals correctly
Previously, literals "1i" were printed as "1". This fixes the numeric-method-autoexport test for pretty printing.
1 parent 1581fb8 commit d92b9ae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libsyntax/ast_util.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ pub fn int_ty_to_str(t: IntTy, val: Option<i64>, mode: SuffixMode) -> StrBuf {
153153
};
154154

155155
match val {
156+
// cast to a u64 so we can correctly print INT64_MIN. All integral types
157+
// are parsed as u64, so we wouldn't want to print an extra negative
158+
// sign.
156159
Some(n) => format!("{}{}", n as u64, s).to_strbuf(),
157160
None => s.to_strbuf()
158161
}

0 commit comments

Comments
 (0)