-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Lint against calling intrinsics that have stable or safe wrappers #2997
Comments
I started working on a fix. |
Ping me (either here or on Twitter or Reddit) if you need anything, and feel free to share your progress even when not finished. |
@okuhn Hey were you able to make progress on this issue? If you are not able to work on it then please let me know and I can take over. Thanks! |
@krishna-veerareddy I would recommend that you should go ahead if you are interested in working on this. |
Have you guys got anything done? I'm thinking of giving this one a go. I checked the documentation and the intrinsics module is quite regularly documented, so I'll probably use a Python script to scrape the pages and check which functions have safe alternatives linked. Having that list, the rest should be quite easy, right? Just checking paths in expressions. Let me know if anyone's working on this or if you have some tips for me! |
I noticed that it is pointing to the same link when I was reading rust-lang/rust-clippy#2997
@cauebs I noticed that the link dtolnay pointed out is even pointing to the same link. Not sure if scraping from python side would be a good idea since it may be outdated later on. I wonder if the rustdoc team can help on this. Let me ping @jyn514 first. But if we want to make it easier, a macro to indicate stable alternative may be easier than scraping from html text I believe. |
If you want this to be automated, you'll need an attribute on it anyway for rustdoc to understand it. At that point I think it makes more sense to just add |
Fix intrinsic size_of stable link I noticed that it is pointing to the same link when I was reading rust-lang/rust-clippy#2997
Fix intrinsic size_of stable link I noticed that it is pointing to the same link when I was reading rust-lang/rust-clippy#2997
Working on it. |
There are some intrinsics that there should be no reason to call. For example
core::intrinsics::size_of
. This intrinsic is exposed by the safe functioncore::mem::size_of
which should always be called instead.I would like to suggest a Clippy lint that notices calls to no-reason-to-call intrinsics and recommends the right stable or safe wrapper to call instead.
The text was updated successfully, but these errors were encountered: