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 with name conflict in macro #8851

Closed
darkf opened this issue Aug 29, 2013 · 3 comments · Fixed by #11012
Closed

ICE with name conflict in macro #8851

darkf opened this issue Aug 29, 2013 · 3 comments · Fixed by #11012
Labels
A-syntaxext Area: Syntax extensions E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@darkf
Copy link
Contributor

darkf commented Aug 29, 2013

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
@jdm
Copy link
Contributor

jdm commented Aug 29, 2013

Looks quite similar to #7911, which is probably #6000.

@sanxiyn
Copy link
Member

sanxiyn commented Dec 16, 2013

After updating for removal of float and feature-gating of macros, I don't get ICE any more.

#[feature(macro_rules)];

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

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));
}

@huonw
Copy link
Member

huonw commented Dec 16, 2013

Almost certainly fixed by #9088.

bors added a commit that referenced this issue Dec 18, 2013
alexcrichton added a commit that referenced this issue Dec 19, 2013
Closes #5806
Closes #5950
Closes #7178
Closes #8259
Closes #8578
Closes #8851
Closes #9129
Closes #10412
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 4, 2022
feat(lint): impl lint about use first() instead of get(0)

close rust-lang#8851

This PR adds new lint about considering replacing .get(0) with .first().

Thank you in advance.

changelog: adds new lint [`get_first`] to consider replacing .get(0) with .first()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntaxext Area: Syntax extensions E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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