@@ -170,9 +170,11 @@ pub fn transcribe(
170170 }
171171
172172 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[ ..] ) ;
176178 }
177179
178180 LockstepIterSize :: Constraint ( len, _) => {
@@ -187,9 +189,10 @@ pub fn transcribe(
187189 // Is the repetition empty?
188190 if len == 0 {
189191 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" ) ;
193196 }
194197 } else {
195198 // 0 is the initial counter (we have done 0 repretitions so far). `len`
@@ -327,8 +330,7 @@ impl LockstepIterSize {
327330 LockstepIterSize :: Constraint ( r_len, _) if l_len == r_len => self ,
328331 LockstepIterSize :: Constraint ( r_len, r_id) => {
329332 let msg = format ! (
330- "inconsistent lockstep iteration: \
331- '{}' has {} items, but '{}' has {}",
333+ "meta-variable `{}` repeats {} times, but `{}` repeats {} times" ,
332334 l_id, l_len, r_id, r_len
333335 ) ;
334336 LockstepIterSize :: Contradiction ( msg)
0 commit comments