rust/tests/ui/async-await/higher-ranked-auto-trait-14.rs
David Wood c50aebba78
trait_sel: don't require predicates of aliases hold
No longer require that we prove that the predicates of aliases hold when
checking the well-formedness of the alias. This permits more uses of GATs
and changes the output of yet more tests.
2025-10-15 09:35:05 +01:00

28 lines
737 B
Rust

// Repro for <https://github.com/rust-lang/rust/issues/124757#issue-2279603232>.
//@ check-pass
//@ edition: 2021
//@ revisions: assumptions no_assumptions
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
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() {}