Skip to content

Commit

Permalink
Rollup merge of #113568 - ferrocene:pa-spurious-weak-lang-item-2, r=b…
Browse files Browse the repository at this point in the history
…-naber

Fix spurious test failure with `panic=abort`

Description on why it happens and why the fix should work is in the code comments.
  • Loading branch information
matthiaskrgr committed Aug 7, 2023
2 parents 139b49b + 409d994 commit bf40327
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/ui/panic-handler/weak-lang-item-2.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// run-pass
// aux-build:weak-lang-items.rs

// ignore-emscripten no threads support
// pretty-expanded FIXME #23616

extern crate weak_lang_items as other;

use std::thread;

fn main() {
let _ = thread::spawn(move|| {
other::foo()
});
// The goal of the test is just to make sure other::foo() is referenced at link time. Since
// the function panics, to prevent it from running we gate it behind an always-false `if` that
// is not going to be optimized away.
if std::hint::black_box(false) {
other::foo();
}
}

0 comments on commit bf40327

Please sign in to comment.