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 when putting a println! after non-break infinite loop in a library's function #16010

Closed
allan-simon opened this issue Jul 26, 2014 · 3 comments · Fixed by #16568
Closed
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@allan-simon
Copy link

The minimal code to reproduce the bug

#![crate_name = "xmpp"]
#![crate_type = "lib"]

pub fn handle() {
    loop { }
    println!("we close");
}

the stack trace i got

https://gist.github.com/allan-simon/5a689088c8c46e2843d0

Note:

  • it does compile correctly if we replace the function by "main" and compile it as a normal software
  • it does compile correctly if we replace the println! by a let a = 42u
@lifthrasiir
Copy link
Contributor

An expand-minimalized example:

#![crate_type = "lib"]

pub fn handle() {
    fail!();
    match () { // this match is mandatory, curiously.
        _ => {
            static FOO: () = (); 
        }
    }
}

Sounds like that the symbol for the static item (and possibly others) gets eliminated when the item is placed in the unreachable block. Normally this is not a bad thing, but it breaks down when the item has to be placed in the metadata anyhow.

@ghost
Copy link

ghost commented Aug 13, 2014

Seems like this'd have been fixed in #16452.

@alexcrichton
Copy link
Member

Flagging as needstest (one wasn't checked in with that PR)

bors added a commit that referenced this issue Aug 18, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 11, 2023
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
Development

Successfully merging a pull request may close this issue.

3 participants