Closed
Description
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.
Metadata
Metadata
Assignees
Labels
Area: `#[test]` / the `test` libraryCategory: A feature request, i.e: not implemented / a PR.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.