New lint: nonnull_unchecked_on_box_ptr#17336
Conversation
|
r? @Jarcho rustbot has assigned @Jarcho. Use Why was this reviewer chosen?The reviewer was selected based on:
|
31e604e to
d5ef013
Compare
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot label lint-nominated |
|
This lint has been nominated for inclusion. |
|
Note: this implementation will need to be updated to suggest Box::from_non_null (rust-lang/rust#130364) once that is merged. |
|
@Jarcho How does this look? |
|
I suggest |
|
Lintcheck changes for 8842d46
This comment will be updated if you push new changes |
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
698355c to
25f3a7e
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot squash |
|
Oh, this isn't bors, forgot |
96e70a6 to
05132ba
Compare
This comment has been minimized.
This comment has been minimized.
05132ba to
3a1e8f6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3a1e8f6 to
8842d46
Compare
|
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. |
|
You'll need to import traits using |
View all comments
changelog: [
nonnull_unchecked_on_box_ptr]: implement new lintNow that
NonNull::from_mutis stable, we can check and suggest a fix against a common pattern: usingunsafe { NonNull::new_unchecked(Box::into_raw(x)) }instead ofNonNull::from_mut(Box::leak(x)). This was first mentioned in this comment..stderrfile)cargo testpasses locallycargo dev update_lintscargo dev fmt