Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was just looking into fixing #231, but it doesn't seem like the current setup is well suited to criterion benchmarks (which I think has become the preferred method?). Specifically, when delegating to
_rust_test_common
, the criterion code doesn't seem to run at all because criterion wants to disable the test harness in favor of its ownmain
.Since this rule doesn't currently work, it's unlikely anyone depends on it. I propose we repurpose
rust_benchmark
to simply warn when the compilation mode != "opt" and delegate to a rust_binary with--bench
which is more in line with how criterion expects to be invoked.This strategy can optionally be made to work for the nightly
#[bench]
attribute by passing the--test
flag to rustc to generate the test harness. This is enabled with thetest_harness = True
option.A test was added using criterion to prevent future bit-rot.