Skip to content

Conversation

@SLUCHABLUB
Copy link
Contributor

When trying to cast a usize or isize using as to a type of potentially smaller size the cast_precision_loss would claim that the size of usize is "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 of usize and isize.

@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2025

r? @llogiq

rustbot has assigned @llogiq.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 4, 2025
@samueltardieu
Copy link
Member

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)

@SLUCHABLUB
Copy link
Contributor Author

Yes, something like that would be even better. I will look over it.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Jun 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@ada4a
Copy link
Contributor

ada4a commented Oct 11, 2025

Friendly ping from triage: @SLUCHABLUB do you still plan to work on this?

@rustbot

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Oct 12, 2025

Lintcheck changes for ff77a3e

Lint Added Removed Changed
clippy::cast_precision_loss 0 0 187

This comment will be updated if you push new changes

@SLUCHABLUB
Copy link
Contributor Author

Yes, sorry.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Oct 12, 2025
@ada4a
Copy link
Contributor

ada4a commented Oct 12, 2025

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..

@rustbot

This comment has been minimized.

Copy link
Contributor

@llogiq llogiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for both improving the message and simplifying the code.

View changes since this review

@llogiq
Copy link
Contributor

llogiq commented Nov 30, 2025

This looks good, just needs a rebase.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Nov 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 5, 2025

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.

@llogiq llogiq added this pull request to the merge queue Dec 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 5, 2025
@SLUCHABLUB
Copy link
Contributor Author

It seems that the 32-bit tests are failing. Is there a way for me to run (& bless) them on my 64 bit machine?

@llogiq
Copy link
Contributor

llogiq commented Dec 5, 2025

Yes, you could cross compile to x86. But I don't think we actually need to incur that complexity here.

@SLUCHABLUB
Copy link
Contributor Author

I think the 32-bit tests should pass now.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants