Skip to content

Commit def6ec0

Browse files
committed
Auto merge of #124662 - zetanumbers:needs_async_drop, r=oli-obk
Implement `needs_async_drop` in rustc and optimize async drop glue This PR expands on #121801 and implements `Ty::needs_async_drop` which works almost exactly the same as `Ty::needs_drop`, which is needed for #123948. Also made compiler's async drop code to look more like compiler's regular drop code, which enabled me to write an optimization where types which do not use `AsyncDrop` can simply forward async drop glue to `drop_in_place`. This made size of the async block from the [async_drop test](https://github.com/zetanumbers/rust/blob/67980dd6fb11917d23d01a19c2cf4cfc3978aac8/tests/ui/async-await/async-drop.rs) to decrease by 12%.
2 parents 62fbca9 + 4a2d23e commit def6ec0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/pass/async-drop.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
//@revisions: stack tree
22
//@compile-flags: -Zmiri-strict-provenance
33
//@[tree]compile-flags: -Zmiri-tree-borrows
4+
5+
// WARNING: If you would ever want to modify this test,
6+
// please consider modifying rustc's async drop test at
7+
// `tests/ui/async-await/async-drop.rs`.
8+
49
#![feature(async_drop, impl_trait_in_assoc_type, noop_waker, async_closure)]
510
#![allow(incomplete_features, dead_code)]
611

0 commit comments

Comments
 (0)