rust-clippy/tests
bors 38d12a9bc0 Auto merge of #12681 - y21:issue12677, r=Jarcho
Let `qualify_min_const_fn` deal with drop terminators

Fixes #12677

The `method_accepts_droppable` check that was there seemed overly conservative.
> Returns true if any of the method parameters is a type that implements `Drop`.
> The method can't be made const then, because `drop` can't be const-evaluated.

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 a `drop` terminator") is already done by `qualify_min_const_fn` [here](f5e250180c/clippy_utils/src/qualify_min_const_fn.rs (L298)), 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 a `drop()` terminator for cleanup, however we should be able to freely ignore that. [Const checking ignores cleanup blocks](https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/transform/check_consts/check.rs#L382-L388), so we should, too?

r? `@Jarcho`

----

changelog: [`missing_const_for_fn`]: continue linting on fns with parameters implementing `Drop` if they're not actually dropped
2024-06-11 22:38:52 +00:00
..
test_utils
ui Auto merge of #12681 - y21:issue12677, r=Jarcho 2024-06-11 22:38:52 +00:00
ui-cargo Merge commit '2efebd2f0c03dabbe5c3ad7b4ebfbd99238d1fb2' into clippy-subtree-update 2024-05-21 10:39:30 -07:00
ui-internal Merge remote-tracking branch 'upstream/master' into rustup 2024-05-30 09:44:14 +02:00
ui-toml Auto merge of #10632 - Alexendoo:needless-maybe-sized, r=Jarcho 2024-06-05 20:11:03 +00:00
workspace_test
check-fmt.rs
clippy.toml
compile-test.rs Merge commit '20b085d500dfba5afe0869707bf357af3afe20be' into clippy-subtree-update 2024-05-02 17:26:44 +02:00
dogfood.rs
headers.rs
integration.rs
lint_message_convention.rs
missing-test-files.rs
versioncheck.rs
workspace.rs