Skip to content

Support panic=abort without #[should_panic] from libtest #62318

Closed
@tmandry

Description

@tmandry

When a project wants to turn on panic=abort today, they are forced to choose between

  1. 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)
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions