diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/impl-trait/opaque-cast-field-access-in-future.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.rs b/tests/ui/impl-trait/opaque-cast-field-access-in-future.rs new file mode 100644 index 000000000..3e3bc09a6 --- /dev/null +++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.rs @@ -0,0 +1,27 @@ +// edition: 2021 + +use std::future::Future; + +async fn bop() { + fold(run(), |mut foo| async move { + &mut foo.bar; + }) +} + +fn fold<Fut, F, U>(_: Foo<U>, f: F) +where + F: FnMut(Foo<U>) -> Fut, +{ + loop {} +} + +struct Foo<F> { + bar: Vec<F>, +} + +fn run() -> Foo<impl Future<Output = ()>> { + //~^ ERROR type annotations needed + loop {} +} + +fn main() {} |