about summary refs log tree commit diff
path: root/tests/ui/async-await/higher-ranked-auto-trait-14.rs
blob: 5ed12cd6e38cb7a40a500e3d8161fc0c0f1400dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Repro for <https://github.com/rust-lang/rust/issues/124757#issue-2279603232>.
//@ edition: 2021
//@ revisions: assumptions no_assumptions
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
//@[assumptions] check-pass
//@[no_assumptions] known-bug: #110338

use std::collections::HashSet;
use std::future::Future;

trait MyTrait {
    fn blah(&self, x: impl Iterator<Item = u32>) -> impl Future<Output = ()> + Send;
}

fn foo<T: MyTrait + Send + Sync>(
    val: T,
    unique_x: HashSet<u32>,
) -> impl Future<Output = ()> + Send {
    let cached = HashSet::new();
    async move {
        let xs = unique_x.union(&cached)
            // .copied() // works
            .map(|x| *x) // error
            ;
        let blah = val.blah(xs.into_iter()).await;
    }
}

fn main() {}