-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New lint: unsound_collection_transmute
#4592
Conversation
bbc8562
to
2f430ef
Compare
@JohnTitor Thanks, I included your suggestions. |
2f430ef
to
e59d8a0
Compare
Oops, it appears I needed another rebase. |
362d51c
to
017fb60
Compare
r? @flip1995 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impl LGTM. I think the fmttest
should have triggered here, but maybe it didn't since some formatting errors are in the if_chain!
macro. 🤔
]); | ||
|
||
// used to check for UNSOUND_COLLECTION_TRANSMUTE | ||
static COLLECTIONS: &[&[&str]] = &[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also include LinkedList
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. Transmuting might be admissible IF the alignment&size of the target type is lower or equal to that of the source type, the list isn't modified and either leaked or transmuted back to the original type afterwards. But this hasn't yet been specified by the unsafe WG, so I wouldn't bet on it. In any event, I'm erring on the side of least false positives here.
r? @JohnTitor |
017fb60
to
dea836a
Compare
dea836a
to
27fa2b7
Compare
rebased. |
Thanks! @bors r+ |
📌 Commit 27fa2b7 has been approved by |
New lint: `unsound_collection_transmute` changelog: Add `unsound_collection_transmute` lint This fixes #4515
💔 Test failed - status-appveyor |
It appears appveyor failed because it was missing rustfmt? |
Not missing. But on windows rustfmt interpreted |
New lint: `unsound_collection_transmute` changelog: Add `unsound_collection_transmute` lint This fixes #4515
☀️ Test successful - checks-travis, status-appveyor |
changelog: Add
unsound_collection_transmute
lintThis fixes #4515