Skip to content

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

Closed

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.

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
    on Jan 18, 2015
  2. jdm commented on Jan 18, 2015

    @jdm
    Contributor

    Presumably we're getting a TtSequence here. @cmr is this just something we should have a better error for?

  3. emberian commented on Jan 18, 2015

    @emberian
    Contributor

    Nope, this isn't a legitimate error. I just didn't find a case where this could happen, so I didn't handle it. I'll fix it.

  4. self-assigned this
    on Jan 18, 2015
  5. emberian commented on Jan 18, 2015

    @emberian
    Contributor

    (A workaround is to wrap the lhs in parens)

  6. added a commit that references this issue on Jan 20, 2015
    ffd8cb7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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