Extend dropping_{references,copy_types} lints to drop_in_place - #160229
Extend dropping_{references,copy_types} lints to drop_in_place#160229Urgau wants to merge 3 commits into
dropping_{references,copy_types} lints to drop_in_place#160229Conversation
|
r? @mu001999 rustbot has assigned @mu001999. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
1380cb0 to
27c8128
Compare
|
@traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
| /// The `dropping_references` lint checks for calls to `std::mem::drop` with a reference | ||
| /// instead of an owned value. | ||
| /// The `dropping_references` lint checks for calls to `std::mem::drop` | ||
| /// and `std::ptr::drop_in_place` with a reference instead of an owned value. |
There was a problem hiding this comment.
nit: might want to rephrase this because passing a reference to drop_in_place is an ordinary and expected thing to do. Maybe "where the dropped type is a reference" or something?
There was a problem hiding this comment.
Thanks. Went with your proposed wording.
|
Personally I think this doesn't need FCP. The intent of this lint is to catch trying to drop things where that doesn't do anything, and how that drop is spelled doesn't matter to me. @rfcbot reviewed |
27c8128 to
5d882cb
Compare
|
This PR was rebased onto a different main 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. |
|
Pondering: thinking about the intent I described above made me think of |
We could, we even already have the lint for it |
|
As suggested I've also extended the |
This PR extends the
dropping_{references,copy_types}lints to also check for calls tostd::ptr::drop_in_placeand<*mut _>::drop_in_place.It also extends the
undropped_manually_dropslint.Fixes #160127
cc @theemathas