-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Lint unannotated transmutes #1660
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
Comments
related: #715 |
The first of these rules seems super useful, and I came to request. The second doesn't seem so useful. Once you have annotated both types, the requirement to put it in its own function is reduced. |
My reasoning for the second part is that you should have dedicated functions for these transmutes that are marked as either safe or unsafe depending on the situation, and use those instead of the transmutes directly. |
@clarfon I have that for some functions, but not others - sometimes exposing that function would make the invariants I'd like to encode harder. Not that your request is unreasonable, just that I'd want to turn on the first lint, and off the second, so they can be treated independently. |
That's very fair, I'd agree with making them separate lints. Curiously, do you have any examples of cases where it makes sense to not have the second? |
I have a structure that reads:
Where the pointer wrapper For the moment I encode that with:
The transumute both pulls out the field and converts it, which is a nice single atomic operation. Whereas casting any arbitrary |
Restablecer facebook |
Hey @croker89, was your comment added on purpose here? :) To me, it's not clear what you mean |
|
|
I'm thinking of something where you have to either have:
unsafe
block.The text was updated successfully, but these errors were encountered: