Description
openedon Oct 11, 2022
Problem
The panic
setting is ignored for benchmarks since (by default) they link libtest
which is compiled with panic = "unwind"
. This would otherwise lead to confusing errors at link time when "abort"
is used (#3166, #3175).
However, it is possible to disable the default harness for a benchmark (which means libtest
is no longer linked):
[[bench]]
name = "my_bench"
harness = false
(this is common when using external benchmarking frameworks such as criterion)
The ability to disable unwinding when benchmarking is useful since the inclusion of unwinding machinery can affect performance.
Proposed Solution
Allow panic = "abort"
when harness = false
.
Cargo currently always prints a warning when the bench
profile contains panic = "abort"
. With this proposal that warning would only be printed when building/running a benchmark where the setting is ignored. (Note: currently running a benchmark with a different profile, e.g. cargo bench --profile release
that has panic = "abort"
will ignore the panic setting but not print any warning)
Notes
No response
Metadata
Assignees
Labels
Type
Projects
Status
No status