about summary refs log tree commit diff
path: root/tests/ui/async-await/higher-ranked-normalize-assumptions-2.rs
blob: 410d4e503b7c242e6c411e80138e27750f0c0c25 (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
30
31
32
33
34
35
36
37
38
//@ revisions: stock hr
//@[hr] compile-flags: -Zhigher-ranked-assumptions
//@ edition: 2024
//@ check-pass

// Test that we don't normalize the higher-ranked assumptions of an auto trait goal
// unless we have `-Zhigher-ranked-assumptions`, since obligations that result from
// this normalization may lead to higher-ranked lifetime errors when the flag is not
// enabled.

// Regression test for <https://github.com/rust-lang/rust/issues/147244>.

pub fn a() -> impl Future + Send {
    async {
        let queries = core::iter::empty().map(Thing::f);
        b(queries).await;
    }
}

async fn b(queries: impl IntoIterator) {
    c(queries).await;
}

fn c<'a, I>(_queries: I) -> impl Future
where
    I: IntoIterator,
    I::IntoIter: 'a,
{
    async {}
}

pub struct Thing<'a>(pub &'a ());

impl Thing<'_> {
    fn f(_: &Self) {}
}

fn main() {}