I can't get cargo bench --tests passing while cargo test passes just fine.
cargo bench --tests
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
error: An unknown error occurred
The code is basically as follows here:
#[bench]
pub fn my_benchmark(b: &mut Bencher) {
// setup test ...
// ...
b.iter(|| {
tested_function();
});
let result = tested_function();
assert_eq!(result == true);
}
}
I'm following the recommendations from Benchmark tests.
I'd appreciate some pointer explaining why cargo bench and cargo test can behave differently here.