Skip to content

ICE: wrong-structured lhs for follow check with macro #21350

Closed
@Ms2ger

Description

@Ms2ger

Fiddling with some code from JeanSprouts on IRC,

fn main() {
    macro_rules! dispatch(

                    $($id:expr, $name:ident, $parser:expr, $conda:ident, $condb:expr),+
             => {
                    general_dispatch!(
                            id,
                            start,
                            size,

                            $(
                            ($id, $name, {
                                    header.$name = match $parser.0 {
                                            $conda if $condb => $conda,
                                            _ => {
                                                    return Err(ParserError::Incompatible);
                                            },
                                    }
                            }),
                            )+
                    )
            }
    );

    dispatch!(
            (0x4286, EBMLVersion,       try!(self.parse_uint(size)), n, n == 1),
            (0x42F7, EBMLReadVersion,   try!(self.parse_uint(size)), n, n == 1),
            (0x42F2, EBMLMaxIDLength,   try!(self.parse_uint(size)), n, n == 4),
            (0x42F3, EBMLMaxSizeLength, try!(self.parse_uint(size)), n, n == 8),
            (0x4282, DocType,              try!(self.parse_string(size)), s, s == "matroska"),
            (0x4287, DocTypeVersion,       try!(self.parse_uint(size)), n, n <= 2),
            (0x4285, DocTypeReadVersion,   try!(self.parse_uint(size)), n, n <= 2)
    );


}

failed on playpen with:

<anon>:2:5: 23:7 error: internal compiler error: wrong-structured lhs for follow check
<anon>:2     macro_rules! dispatch(
<anon>:3             
<anon>:4                     $($id:expr, $name:ident, $parser:expr, $conda:ident, $condb:expr),+
<anon>:5              => {
<anon>:6                     general_dispatch!(
<anon>:7                             id,
         ...
note: the compiler unexpectedly panicked. this is a bug.

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions