Skip to content

Commit 728826f

Browse files
authored
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`
2 parents 78fa111 + 1931fb8 commit 728826f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,11 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>
404404
// FIXME(const_trait_impl, fee1-dead) revert to const destruct once it works again
405405
#[expect(unused)]
406406
fn is_ty_const_destruct_unused<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>) -> bool {
407-
// Avoid selecting for simple cases, such as builtin types.
408-
if ty::util::is_trivially_const_drop(ty) {
409-
return true;
407+
// If this doesn't need drop at all, then don't select `~const Destruct`.
408+
if !ty.needs_drop(tcx, body.typing_env(tcx)) {
409+
return false;
410410
}
411411

412-
413412
let (infcx, param_env) =
414413
tcx.infer_ctxt().build_with_typing_env(body.typing_env(tcx));
415414
// FIXME(const_trait_impl) constness

0 commit comments

Comments
 (0)