Skip to content

ICE with name conflict in macro #8851

Closed
@darkf

Description

@darkf

With the following test code:

enum T {
        A(int),
        B(float)
}

macro_rules! test(
        ($e:expr) => (
                fn foo(t:T) -> int {
                        match t {
                                A(y) => $e,
                                B(y) => $e
                        }
                }
        )
)

test!(10 + (y as int))

fn main() {
        foo(A(20));
}

You get an ICE:

x.rs:10:6: 10:7 warning: unused variable: `y` [-W unused-variable (default)]
x.rs:10                                 A(y) => $e,
                                          ^
error: internal compiler error: trans_local_var: no llval for local/arg 62 found

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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