@@ -170,9 +170,11 @@ pub fn transcribe(
170
170
}
171
171
172
172
LockstepIterSize :: Contradiction ( ref msg) => {
173
- // This should never happen because the macro parser should generate
174
- // properly-sized matches for all meta-vars.
175
- cx. span_bug ( seq. span ( ) , & msg[ ..] ) ;
173
+ // FIXME: this really ought to be caught at macro definition time... It
174
+ // happens when two meta-variables are used in the same repetition in a
175
+ // sequence, but they come from different sequence matchers and repeat
176
+ // different amounts.
177
+ cx. span_fatal ( seq. span ( ) , & msg[ ..] ) ;
176
178
}
177
179
178
180
LockstepIterSize :: Constraint ( len, _) => {
@@ -187,9 +189,10 @@ pub fn transcribe(
187
189
// Is the repetition empty?
188
190
if len == 0 {
189
191
if seq. op == quoted:: KleeneOp :: OneOrMore {
190
- // This should be impossible because the macro parser would not
191
- // match the given macro arm.
192
- cx. span_bug ( sp. entire ( ) , "this must repeat at least once" ) ;
192
+ // FIXME: this really ought to be caught at macro definition
193
+ // time... It happens when the Kleene operator in the matcher and
194
+ // the body for the same meta-variable do not match.
195
+ cx. span_fatal ( sp. entire ( ) , "this must repeat at least once" ) ;
193
196
}
194
197
} else {
195
198
// 0 is the initial counter (we have done 0 repretitions so far). `len`
@@ -327,8 +330,7 @@ impl LockstepIterSize {
327
330
LockstepIterSize :: Constraint ( r_len, _) if l_len == r_len => self ,
328
331
LockstepIterSize :: Constraint ( r_len, r_id) => {
329
332
let msg = format ! (
330
- "inconsistent lockstep iteration: \
331
- '{}' has {} items, but '{}' has {}",
333
+ "meta-variable `{}` repeats {} times, but `{}` repeats {} times" ,
332
334
l_id, l_len, r_id, r_len
333
335
) ;
334
336
LockstepIterSize :: Contradiction ( msg)
0 commit comments