@@ -169,17 +169,17 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
169
169
let mut best_fail_msg = "internal error: ran no matchers" . to_string ( ) ;
170
170
171
171
for ( i, lhs) in lhses. iter ( ) . enumerate ( ) { // try each arm's matchers
172
- let lhs_tt = match * lhs {
173
- TokenTree :: Delimited ( _, ref delim) => & delim. tts [ ..] ,
174
- _ => panic ! ( cx. span_fatal( sp, "malformed macro lhs" ) )
175
- } ;
172
+ let lhs_tt = match * lhs {
173
+ TokenTree :: Delimited ( _, ref delim) => & delim. tts [ ..] ,
174
+ _ => panic ! ( cx. span_fatal( sp, "malformed macro lhs" ) )
175
+ } ;
176
176
177
- match TokenTree :: parse ( cx, lhs_tt, arg) {
178
- Success ( named_matches) => {
177
+ match TokenTree :: parse ( cx, lhs_tt, arg) {
178
+ Success ( named_matches) => {
179
179
let rhs = match rhses[ i] {
180
- // ignore delimiters
181
- TokenTree :: Delimited ( _, ref delimed) => delimed. tts . clone ( ) ,
182
- _ => panic ! ( cx. span_fatal( sp, "macro rhs must be delimited" ) ) ,
180
+ // ignore delimiters
181
+ TokenTree :: Delimited ( _, ref delimed) => delimed. tts . clone ( ) ,
182
+ _ => panic ! ( cx. span_fatal( sp, "macro rhs must be delimited" ) ) ,
183
183
} ;
184
184
// rhs has holes ( `$id` and `$(...)` that need filled)
185
185
let trncbr = new_tt_reader ( & cx. parse_sess ( ) . span_diagnostic ,
@@ -199,15 +199,15 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
199
199
site_span : sp,
200
200
macro_ident : name
201
201
} )
202
- }
203
- Failure ( sp, ref msg) => if sp. lo >= best_fail_spot. lo {
202
+ }
203
+ Failure ( sp, ref msg) => if sp. lo >= best_fail_spot. lo {
204
204
best_fail_spot = sp;
205
205
best_fail_msg = ( * msg) . clone ( ) ;
206
- } ,
207
- Error ( err_sp, ref msg) => {
206
+ } ,
207
+ Error ( err_sp, ref msg) => {
208
208
panic ! ( cx. span_fatal( err_sp. substitute_dummy( sp) , & msg[ ..] ) )
209
- }
210
209
}
210
+ }
211
211
}
212
212
213
213
panic ! ( cx. span_fatal( best_fail_spot. substitute_dummy( sp) , & best_fail_msg[ ..] ) ) ;
@@ -310,14 +310,14 @@ fn check_lhs_nt_follows(cx: &mut ExtCtxt, lhs: &TokenTree, sp: Span) {
310
310
// lhs is going to be like TokenTree::Delimited(...), where the
311
311
// entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens.
312
312
match lhs {
313
- & TokenTree :: Delimited ( _, ref tts) => {
314
- check_matcher ( cx, tts. tts . iter ( ) , & Eof ) ;
315
- } ,
316
- tt @ & TokenTree :: Sequence ( ..) => {
317
- check_matcher ( cx, Some ( tt) . into_iter ( ) , & Eof ) ;
318
- } ,
319
- _ => cx. span_err ( sp, "Invalid macro matcher; matchers must be contained \
320
- in balanced delimiters or a repetition indicator")
313
+ & TokenTree :: Delimited ( _, ref tts) => {
314
+ check_matcher ( cx, tts. tts . iter ( ) , & Eof ) ;
315
+ } ,
316
+ tt @ & TokenTree :: Sequence ( ..) => {
317
+ check_matcher ( cx, Some ( tt) . into_iter ( ) , & Eof ) ;
318
+ } ,
319
+ _ => cx. span_err ( sp, "Invalid macro matcher; matchers must be contained \
320
+ in balanced delimiters or a repetition indicator")
321
321
} ;
322
322
// we don't abort on errors on rejection, the driver will do that for us
323
323
// after parsing/expansion. we can report every error in every macro this way.
0 commit comments