When a project wants to turn on panic=abort today, they are forced to choose between
- Re-compiling their whole project with
panic=unwind for the purpose of running tests (this not only creates longer build times, but also changes the behavior of code between testing and production)
- Using a custom test harness (either ad-hoc which requries changes the source code for tests, or by using custom_test_harness which is unstable)
Neither of these solutions are great. One solution that might be palatable is to support compiling panic=abort from libtest, but not support #[should_panic] tests in this mode. This could be advertised with an explicit error message anytime a test with #[should_panic] is run. Later, these could be supported as "death tests" as discussed in #32512.
In Fuchsia we'd really like to switch to panic=abort, and this is the main thing preventing us from doing so.
cc @cramertj @petrhosek
When a project wants to turn on
panic=aborttoday, they are forced to choose betweenpanic=unwindfor the purpose of running tests (this not only creates longer build times, but also changes the behavior of code between testing and production)Neither of these solutions are great. One solution that might be palatable is to support compiling
panic=abortfrom libtest, but not support#[should_panic]tests in this mode. This could be advertised with an explicit error message anytime a test with#[should_panic]is run. Later, these could be supported as "death tests" as discussed in #32512.In Fuchsia we'd really like to switch to
panic=abort, and this is the main thing preventing us from doing so.cc @cramertj @petrhosek