Writing float::pow(int)
causes rustc to suggest using powf
, not powi
#101823
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
While trying to raise a float to an integer power, if the user tries to write
float.pow(int)
, rustc suggests usingpowf
, which then results in a type error. rustc then suggests casting the int to a float withas
. The correct fix would instead be to usepowi
.Given the following code: [playground]
The current output is:
When using the suggested fix, the output is:
Ideally the output should look like:
The ideal output provides a working fix, and is likely to be more correct to the user's intended function.
The text was updated successfully, but these errors were encountered: