Skip to content

ICE: unreachable code in check_static.rs is actually reachable. #18118

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

Closed
pnkfelix opened this issue Oct 17, 2014 · 2 comments · Fixed by #18324
Closed

ICE: unreachable code in check_static.rs is actually reachable. #18118

pnkfelix opened this issue Oct 17, 2014 · 2 comments · Fixed by #18324
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@pnkfelix
Copy link
Member

There is an ICE from the check_static pass, due to a match that has a bunch of cases that lead to unreachable!. I think this particular case is the mc::cat_local.

here is the test case (this code is meant to be rejected, but not ICE):

pub fn main() {
    static x : int = 3i;
    let y = {
        static z: Box<&'static int> = {
            let p = x;
            let a = &p;
            box a
        };
        z
    };
}

playpen link

@pnkfelix
Copy link
Member Author

Simpler test case:

pub fn main() {
    static z: &'static int = {
        let p = 3;
        &p
    };
}

bors added a commit that referenced this issue Oct 19, 2014
…atic, r=thestinger

Check for borrow of local variable introduced within static block.

(Rather than ICE on it.)

Fix #18118.
@pnkfelix
Copy link
Member Author

reopen with a needstest to address @alexcrichton comment

@pnkfelix pnkfelix reopened this Oct 21, 2014
@pnkfelix pnkfelix added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
1 participant