diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-11-24 11:08:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-24 11:08:19 +0100 |
| commit | 728826fe00a8e652c88605388ffd50b443d0ac0b (patch) | |
| tree | 2953b43b58730289f316c7e6af7b65085443d6ab | |
| parent | 78fa111a48001abf372911b50d7d7ed25424d489 (diff) | |
| parent | 1931fb825bb18a4bf6f2af6e0249dcf72119c263 (diff) | |
| download | rust-728826fe00a8e652c88605388ffd50b443d0ac0b.tar.gz rust-728826fe00a8e652c88605388ffd50b443d0ac0b.zip | |
Rollup merge of #133371 - RalfJung:is_trivially_const_drop, r=compiler-errors
remove is_trivially_const_drop I'm not sure this still brings any perf benefits, so let's benchmark this. r? `@compiler-errors`
| -rw-r--r-- | clippy_utils/src/qualify_min_const_fn.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clippy_utils/src/qualify_min_const_fn.rs b/clippy_utils/src/qualify_min_const_fn.rs index 345c46f944a..3c9ea4bfaf4 100644 --- a/clippy_utils/src/qualify_min_const_fn.rs +++ b/clippy_utils/src/qualify_min_const_fn.rs @@ -404,12 +404,11 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx> // FIXME(const_trait_impl, fee1-dead) revert to const destruct once it works again #[expect(unused)] fn is_ty_const_destruct_unused<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>) -> bool { - // Avoid selecting for simple cases, such as builtin types. - if ty::util::is_trivially_const_drop(ty) { - return true; + // If this doesn't need drop at all, then don't select `~const Destruct`. + if !ty.needs_drop(tcx, body.typing_env(tcx)) { + return false; } - let (infcx, param_env) = tcx.infer_ctxt().build_with_typing_env(body.typing_env(tcx)); // FIXME(const_trait_impl) constness |
