Skip to content

Commit e42b624

Browse files
committed
fix two distinct builds issues (one noted by try, another caught during local build).
1 parent 520cfbf commit e42b624

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libsyntax/ext/format.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use codemap::{Span, respan};
1616
use ext::base::*;
1717
use ext::base;
1818
use ext::build::AstBuilder;
19-
use fold::Folder;
2019
use fmt_macros as parse;
2120
use fold::Folder;
2221
use parse::token::special_idents;
@@ -636,6 +635,7 @@ pub fn ensure_not_fmt_string_literal<'cx>(cx: &'cx mut ExtCtxt,
636635
sp: Span,
637636
tts: &[ast::TokenTree])
638637
-> Box<base::MacResult+'cx> {
638+
use fold::Folder;
639639
let takes_two_args = |cx: &ExtCtxt, rest| {
640640
cx.span_err(sp, &format!("`ensure_not_fmt_string_literal!` \
641641
takes 2 arguments, {}", rest));
@@ -644,8 +644,8 @@ pub fn ensure_not_fmt_string_literal<'cx>(cx: &'cx mut ExtCtxt,
644644
let mut p = cx.new_parser_from_tts(tts);
645645
if p.token == token::Eof { return takes_two_args(cx, "given 0"); }
646646
let arg1 = cx.expander().fold_expr(p.parse_expr());
647-
if p.token != token::Comma { return takes_two_args(cx, "comma-separated"); }
648-
p.bump();
647+
if p.token == token::Eof { return takes_two_args(cx, "given 1"); }
648+
if !panictry!(p.eat(&token::Comma)) { return takes_two_args(cx, "comma-separated"); }
649649
if p.token == token::Eof { return takes_two_args(cx, "given 1"); }
650650
let arg2 = cx.expander().fold_expr(p.parse_expr());
651651
if p.token != token::Eof {

0 commit comments

Comments
 (0)