-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Implementing Drop leads to SIGILL: Illegal instruction in tests but not in normal run #82850
Comments
I'm getting the same result (plus backtrace and 2 panic messages) with |
I'm able to reproduce with the steps provided. I think this is an artifact of how output is captured. If you run |
Copying and pasting their example directly into the playground and just clicking "test" without changing any settings at all seems to give the |
This issue is bothering me too. To be clear the real annoyance here isnt that a sigill occurs, its that we cant see the tracktraces and panic messages when doing It occurs on any double panic, so a simpler way to reproduce this is: struct PanicOnDrop {
}
impl Drop for PanicOnDrop {
fn drop(&mut self) {
panic!("dropped");
}
}
fn main() {
let _panic_on_drop = PanicOnDrop { };
panic!("first panic!");
}
#[cfg(test)]
mod tests {
use main;
#[test]
fn foo() {
main();
}
} As mentioned by ehuss |
I just hit this issue debugging a flaky CI failure in one of my tests. It's very unfortunate that the backtrace is lost in this case. Could libtest be installing a panic hook that bypasses output capturing if the panic is going to lead to an abort? |
I tried this code:
running this with
cargo run
works fine. I get an assertion failure because 1 isn't 2.But when I run
cargo test
I expected to see this happen:
assertion failure because 1 isn't 2
Instead, this happened:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: