Skip to content

Commit bf40327

Browse files
authored
Rollup merge of #113568 - ferrocene:pa-spurious-weak-lang-item-2, r=b-naber
Fix spurious test failure with `panic=abort` Description on why it happens and why the fix should work is in the code comments.
2 parents 139b49b + 409d994 commit bf40327

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: tests/ui/panic-handler/weak-lang-item-2.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// run-pass
22
// aux-build:weak-lang-items.rs
33

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

76
extern crate weak_lang_items as other;
87

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

0 commit comments

Comments
 (0)