- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.8k
          Fix an incorrect error message regarding the size of usize and isize in cast_precision_loss.
          #14966
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| Shouldn't we give a better error message? (and use "may cause" since on 16 bit usize platforms this is fine) For example: casting `usize` to `f32` may cause a loss of precision (`usize` can be as large as 64 bits wide depending of the target architecture, but `f32`'s mantissa is only 23 bits wide) | 
| Yes, something like that would be even better. I will look over it. @rustbot author | 
| Reminder, once the PR becomes ready for a review, use  | 
| Friendly ping from triage: @SLUCHABLUB do you still plan to work on this? | 
| This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. | 
| Lintcheck changes for 5656dc4 
 This comment will be updated if you push new changes | 
| Yes, sorry. @rustbot ready | 
| No need to apologize! I try to phrase these in a way that doesn't come off as indicting, but I don't always succeed.. | 
When trying to cast a
usizeorisizeusingasto a type of potentially smaller size thecast_precision_losswould claim that the size ofusizeis "32 or 64 bits". It is now corrected to "16, 32, or 64 bits".changelog: [
cast_precision_loss]: fix the error messages claim regarding the size ofusizeandisize.