未验证 提交 bf403272 编写于 作者: M Matthias Krüger 提交者: GitHub

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.
// 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();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册