File tree 4 files changed +9
-8
lines changed
4 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ impl<'self> CheckLoanCtxt<'self> {
232
232
self . bccx. span_err(
233
233
new_loan. span,
234
234
fmt ! ( "cannot borrow `%s` as %s because \
235
- it is also borrowed as %s"
235
+ it is also borrowed as %s",
236
236
self . bccx. loan_path_to_str( new_loan. loan_path) ,
237
237
self . bccx. mut_to_str( new_loan. mutbl) ,
238
238
self . bccx. mut_to_str( old_loan. mutbl) ) ) ;
@@ -320,7 +320,7 @@ impl<'self> CheckLoanCtxt<'self> {
320
320
// Otherwise, just a plain error.
321
321
self . bccx. span_err(
322
322
expr. span,
323
- fmt!( "cannot assign to %s %s"
323
+ fmt!( "cannot assign to %s %s",
324
324
cmt. mutbl. to_user_str( ) ,
325
325
self . bccx. cmt_to_str( cmt) ) ) ;
326
326
return ;
Original file line number Diff line number Diff line change @@ -357,15 +357,16 @@ pub fn get_single_str_from_tts(cx: @ExtCtxt,
357
357
}
358
358
}
359
359
360
- pub fn get_exprs_from_tts ( cx : @ExtCtxt , tts : & [ ast:: token_tree ] )
361
- -> ~[ @ast:: expr ] {
360
+ pub fn get_exprs_from_tts ( cx : @ExtCtxt ,
361
+ sp : span ,
362
+ tts : & [ ast:: token_tree ] ) -> ~[ @ast:: expr ] {
362
363
let p = parse:: new_parser_from_tts ( cx. parse_sess ( ) ,
363
364
cx. cfg ( ) ,
364
365
tts. to_owned ( ) ) ;
365
366
let mut es = ~[ ] ;
366
367
while * p. token != token:: EOF {
367
- if es. len ( ) != 0 {
368
- p . eat ( & token:: COMMA ) ;
368
+ if es. len ( ) != 0 && !p . eat ( & token :: COMMA ) {
369
+ cx . span_fatal ( sp , "expected token: `,`" ) ;
369
370
}
370
371
es. push ( p. parse_expr ( ) ) ;
371
372
}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use ext::build::AstBuilder;
18
18
19
19
pub fn expand_syntax_ext ( cx : @ExtCtxt , sp : span , tts : & [ ast:: token_tree ] ) -> base:: MacResult {
20
20
// Gather all argument expressions
21
- let exprs = get_exprs_from_tts ( cx, tts) ;
21
+ let exprs = get_exprs_from_tts ( cx, sp , tts) ;
22
22
let mut bytes = ~[ ] ;
23
23
24
24
for exprs . iter( ) . advance |expr| {
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ use parse::token::{str_to_ident};
26
26
27
27
pub fn expand_syntax_ext ( cx : @ExtCtxt , sp : span , tts : & [ ast:: token_tree ] )
28
28
-> base:: MacResult {
29
- let args = get_exprs_from_tts ( cx, tts) ;
29
+ let args = get_exprs_from_tts ( cx, sp , tts) ;
30
30
if args. len ( ) == 0 {
31
31
cx. span_fatal ( sp, "fmt! takes at least 1 argument." ) ;
32
32
}
You can’t perform that action at this time.
0 commit comments