Explain tests and setting cfgs
This commit is contained in:
@@ -205,6 +205,10 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {
|
||||
ins_none!(sym::overflow_checks);
|
||||
}
|
||||
|
||||
// We insert a cfg for the name of session's panic strategy.
|
||||
// Since the ImmediateAbort strategy is new, it also sets cfg(panic="abort"), so that code
|
||||
// which is trying to detect whether unwinding is enabled by checking for cfg(panic="abort")
|
||||
// does not need to be updated.
|
||||
ins_sym!(sym::panic, sess.panic_strategy().desc_symbol());
|
||||
if sess.panic_strategy() == PanicStrategy::ImmediateAbort {
|
||||
ins_sym!(sym::panic, PanicStrategy::Abort.desc_symbol());
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
// This is a codegen test which checks that when code is compiled with panic=immediate-abort,
|
||||
// we get a `tail call void @llvm.trap()` in user code instead of a call into the standard
|
||||
// library's panic formatting code (such as panic_fmt) or one of the numerous panic outlining shims
|
||||
// (such as slice_index_fail).
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use run_make_support::{cargo, llvm_filecheck, path, rfs, target};
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
// This test ensures we are able to compile and link a simple binary with panic=immediate-abort.
|
||||
// The test panic-immediate-abort-codegen checks that panic strategy produces the desired codegen,
|
||||
// but is based on compiling a library crate (which is the norm for codegen tests because it is
|
||||
// cleaner and more portable). So this test ensures that we didn't mix up a cfg or a compiler
|
||||
// implementation detail in a way that makes panic=immediate-abort encounter errors at link time.
|
||||
|
||||
//@ needs-target-std
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
Reference in New Issue
Block a user