Skip to content

fn_to_numeric_cast_any: Do not warn cast to raw pointer #14109

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Jan 30, 2025

Fixes #12638

changelog: [fn_to_numeric_cast_any]: Fix false positive on a cast to raw pointer

@rustbot
Copy link
Collaborator

rustbot commented Jan 30, 2025

r? @Jarcho

rustbot has assigned @Jarcho.
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 Jan 30, 2025
@taiki-e taiki-e force-pushed the fn_to_numeric_cast_any branch 2 times, most recently from b87612e to 362e166 Compare January 30, 2025 14:53
Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

I wonder if this should just be renamed instead. How often would you want to find just the non-truncating casts, but not also want the pointer ones?

@rustbot

This comment has been minimized.

@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 Mar 31, 2025
@taiki-e taiki-e force-pushed the fn_to_numeric_cast_any branch from 362e166 to 2b053e5 Compare April 1, 2025 17:17
@taiki-e taiki-e force-pushed the fn_to_numeric_cast_any branch from 2b053e5 to a98d305 Compare April 1, 2025 17:21
@taiki-e
Copy link
Member Author

taiki-e commented Apr 1, 2025

I know of several code bases with use cases where to_ptr is valid and to_numeric is not. All such use cases I know, convert function pointers to raw pointers for using with AtomicPtr. e.g., memchr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fn_to_numeric_cast_any should not warn cast to pointer
4 participants