Let qualify_min_const_fn
deal with drop terminators
#12681
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #12677
The
method_accepts_droppable
check that was there seemed overly conservative.Accepting parameters that implement
Drop
should still be fine as long as the parameter isn't actually dropped, as is the case in the linked issue where the droppable is moved into the return place. This more accurate analysis ("is there adrop
terminator") is already done byqualify_min_const_fn
here, so I don't think this additional check is really necessary?Fixing the other, second case in the linked issue was only slightly more involved, since
Vec::new()
is a function call that has the ability to panic, so there must be adrop()
terminator for cleanup, however we should be able to freely ignore that. Const checking ignores cleanup blocks, so we should, too?r? @Jarcho
changelog: [
missing_const_for_fn
]: continue linting on fns with parameters implementingDrop
if they're not actually dropped