This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
benchmarking v2 syntax is confusingly lax about return types, leading to confusion #13278
Closed
Labels
U2-some_time_soon
Issue is worth doing soon.
Z1-easy
Can be fixed primarily by duplicating and adapting code by an intermediate coder
The benchmarking v2 syntax allows any return type on benchmark function definitions. We should probably only be allowing
()
(blank return type) orResult<(), BenchmarkError>
in scenarios where the programmer wants to use the?
operator somewhere in the benchmark function body.After talking about this with @ggwpez we thought it would make sense to require a return type of
Result<(), BenchmarkError>
in scenarios where the programmer uses the?
operator within the function body, and also allow a blank()
return type. Any other return types on the benchmark function definitions would trigger a compiler error. Doing things this way will make the benchmark function defintion feel more like a real function and will make people more aware that they can use?
in these contexts (and avoid the confusing situation where someone writes?
and it compiles even though what appears to be the enclosing function def does not have aResult
orOption
return type).Open to any thoughts people may have, though!
The text was updated successfully, but these errors were encountered: