about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve/trait_goals.rs
diff options
context:
space:
mode:
authorzetanumbers <dariasukhonina@gmail.com>2024-02-13 12:31:41 +0300
committerDaria Sukhonina <dariasukhonina@gmail.com>2024-04-16 20:45:07 +0300
commit24a24ec6ba24bfe5e0980d22f585c98a608ec701 (patch)
tree0f0eeced9b28d8c0cef3325886775aa27607dd67 /compiler/rustc_trait_selection/src/solve/trait_goals.rs
parent1dea922ea6e74f99a0e97de5cdb8174e4dea0444 (diff)
downloadrust-24a24ec6ba24bfe5e0980d22f585c98a608ec701.tar.gz
rust-24a24ec6ba24bfe5e0980d22f585c98a608ec701.zip
Add simple async drop glue generation
Explainer: https://zetanumbers.github.io/book/async-drop-design.html

https://github.com/rust-lang/rust/pull/121801
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve/trait_goals.rs')
-rw-r--r--compiler/rustc_trait_selection/src/solve/trait_goals.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs
index e522339358a..ed76ea74f08 100644
--- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs
+++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs
@@ -544,6 +544,18 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
         ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
     }
 
+    fn consider_builtin_async_destruct_candidate(
+        ecx: &mut EvalCtxt<'_, 'tcx>,
+        goal: Goal<'tcx, Self>,
+    ) -> QueryResult<'tcx> {
+        if goal.predicate.polarity != ty::PredicatePolarity::Positive {
+            return Err(NoSolution);
+        }
+
+        // `AsyncDestruct` is automatically implemented for every type.
+        ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
+    }
+
     fn consider_builtin_destruct_candidate(
         ecx: &mut EvalCtxt<'_, 'tcx>,
         goal: Goal<'tcx, Self>,