Merge pull request #7227 from alexcrichton/issue-7218
Fix compiling empty fmt! strings
This commit is contained in:
commit
df166bae1f
@ -249,6 +249,11 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
|
||||
}
|
||||
}
|
||||
|
||||
/* Short circuit an easy case up front (won't work otherwise) */
|
||||
if pieces.len() == 0 {
|
||||
return cx.expr_str_uniq(args[0].span, @"");
|
||||
}
|
||||
|
||||
let fmt_sp = args[0].span;
|
||||
let mut n = 0u;
|
||||
let nargs = args.len();
|
||||
|
@ -58,6 +58,9 @@ fn part1() {
|
||||
test(fmt!("%x", 0xffffffff_u), ~"ffffffff");
|
||||
test(fmt!("%o", 0xffffffff_u), ~"37777777777");
|
||||
test(fmt!("%t", 0xffffffff_u), ~"11111111111111111111111111111111");
|
||||
|
||||
// Don't result in a compilation error
|
||||
test(fmt!(""), ~"");
|
||||
}
|
||||
fn part2() {
|
||||
// Widths
|
||||
|
Loading…
x
Reference in New Issue
Block a user