about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-04-29 10:20:16 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-04-29 10:39:54 +0000
commita1c70590b26943370975dd04986739901a31f5db (patch)
tree4aeb49fa9d4e008e48de5340f5e1f9481bdef495 /compiler/rustc_trait_selection/src
parent923ca85a18e576ac0b132e6adf41541285f55ccc (diff)
downloadrust-a1c70590b26943370975dd04986739901a31f5db.tar.gz
rust-a1c70590b26943370975dd04986739901a31f5db.zip
Treat `ManuallyDrop` as `~const Destruct`
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/effects.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/effects.rs b/compiler/rustc_trait_selection/src/traits/effects.rs
index defbafac20b..1b5dcef2e59 100644
--- a/compiler/rustc_trait_selection/src/traits/effects.rs
+++ b/compiler/rustc_trait_selection/src/traits/effects.rs
@@ -252,6 +252,9 @@ fn evaluate_host_effect_for_destruct_goal<'tcx>(
     let self_ty = obligation.predicate.self_ty();
 
     let const_conditions = match *self_ty.kind() {
+        // `ManuallyDrop` is trivially `~const Destruct` as we do not run any drop glue on it.
+        ty::Adt(adt_def, _) if adt_def.is_manually_drop() => thin_vec![],
+
         // An ADT is `~const Destruct` only if all of the fields are,
         // *and* if there is a `Drop` impl, that `Drop` impl is also `~const`.
         ty::Adt(adt_def, args) => {