Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Ms2ger opened this issue Jan 18, 2015 · 3 comments · Fixed by #21364
Closed

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

Ms2ger opened this issue Jan 18, 2015 · 3 comments · Fixed by #21364
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 18, 2015

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.
@Aatch Aatch added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Jan 18, 2015
@jdm
Copy link
Contributor

jdm commented Jan 18, 2015

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

@emberian
Copy link
Member

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.

@emberian emberian self-assigned this Jan 18, 2015
@emberian
Copy link
Member

(A workaround is to wrap the lhs in parens)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants