diff options
| author | bors <bors@rust-lang.org> | 2013-05-27 12:38:12 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-27 12:38:12 -0700 |
| commit | b0f3686515410c013f6cd12ce4fc5236e3dee3f2 (patch) | |
| tree | d8c26fa0f1db08519245c29c5c8d9775fa00cf73 /src/libsyntax/parse/token.rs | |
| parent | d98cc9995fb5c87230f57eeffb8061df25d85190 (diff) | |
| parent | 8f80323f09ef150efc5cf729100f99981afc96e1 (diff) | |
| download | rust-b0f3686515410c013f6cd12ce4fc5236e3dee3f2.tar.gz rust-b0f3686515410c013f6cd12ce4fc5236e3dee3f2.zip | |
auto merge of #6703 : sanxiyn/rust/allocation-lint, r=sanxiyn
Fix #6145. In particular, handle operator overloading.
Diffstat (limited to 'src/libsyntax/parse/token.rs')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 56b1ed5d5c7..c43924486e7 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -138,7 +138,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { OROR => ~"||", ANDAND => ~"&&", BINOP(op) => binop_to_str(op), - BINOPEQ(op) => binop_to_str(op) + ~"=", + BINOPEQ(op) => binop_to_str(op) + "=", /* Structural symbols */ AT => ~"@", @@ -163,7 +163,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { /* Literals */ LIT_INT(c, ast::ty_char) => { - ~"'" + char::escape_default(c as char) + ~"'" + ~"'" + char::escape_default(c as char) + "'" } LIT_INT(i, t) => { i.to_str() + ast_util::int_ty_to_str(t) @@ -175,18 +175,18 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { LIT_FLOAT(s, t) => { let mut body = copy *in.get(s); if body.ends_with(".") { - body = body + ~"0"; // `10.f` is not a float literal + body += "0"; // `10.f` is not a float literal } body + ast_util::float_ty_to_str(t) } LIT_FLOAT_UNSUFFIXED(s) => { let mut body = copy *in.get(s); if body.ends_with(".") { - body = body + ~"0"; // `10.f` is not a float literal + body += "0"; // `10.f` is not a float literal } body } - LIT_STR(s) => { ~"\"" + str::escape_default(*in.get(s)) + ~"\"" } + LIT_STR(s) => { ~"\"" + str::escape_default(*in.get(s)) + "\"" } /* Name components */ IDENT(s, _) => copy *in.get(s), |
