diff options
| author | bors <bors@rust-lang.org> | 2013-05-03 20:48:37 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-03 20:48:37 -0700 |
| commit | 821979f9282decc1ba92391249140f49a7102319 (patch) | |
| tree | c9add4ca454dbbb344a14913a07433411bbc3131 | |
| parent | 5bf7e8bb50a948bdcef3575930928a9a37fbccc2 (diff) | |
| parent | 2e3e0c0892d6fc9d20374d31db994eee4d083366 (diff) | |
| download | rust-821979f9282decc1ba92391249140f49a7102319.tar.gz rust-821979f9282decc1ba92391249140f49a7102319.zip | |
auto merge of #6219 : dotdash/rust/fmt, r=graydon
Only the first portion has to be owned, as it acts as the buffer for the constructed string. The remaining strings can be static.
| -rw-r--r-- | src/libsyntax/ext/fmt.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 62641279f88..e9eebe5b2ac 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -273,15 +273,13 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span, match pc { /* Raw strings get appended via str::push_str */ PieceString(s) => { - let portion = mk_uniq_str(cx, fmt_sp, s); - /* If this is the first portion, then initialize the local buffer with it directly. If it's actually the only piece, then there's no need for it to be mutable */ if i == 0 { - stms.push(mk_local(cx, fmt_sp, npieces > 1, ident, portion)); + stms.push(mk_local(cx, fmt_sp, npieces > 1, ident, mk_uniq_str(cx, fmt_sp, s))); } else { - let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), portion]; + let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), mk_base_str(cx, fmt_sp, s)]; let call = mk_call_global(cx, fmt_sp, ~[str_ident, push_ident], |
