diff options
Diffstat (limited to 'tests/ui/dropck/coroutine-liveness-2.rs')
-rw-r--r-- | tests/ui/dropck/coroutine-liveness-2.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/dropck/coroutine-liveness-2.rs b/tests/ui/dropck/coroutine-liveness-2.rs new file mode 100644 index 000000000..416a073c6 --- /dev/null +++ b/tests/ui/dropck/coroutine-liveness-2.rs @@ -0,0 +1,23 @@ +// check-pass +// edition: 2021 + +// regression test found while working on #117134. +use std::future; + +fn main() { + let mut recv = future::ready(()); + let _combined_fut = async { + let _ = || read(&mut recv); + }; + + let _uwu = (String::new(), _combined_fut); + // Dropping a coroutine as part of a more complex + // types should not add unnecessary liveness + // constraints. + + drop(recv); +} + +fn read<F: future::Future>(_: &mut F) -> F::Output { + todo!() +} |