summaryrefslogtreecommitdiffstats
path: root/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs
blob: 6edfccaf7d17910b295c5e6d88bee70115e6078e (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
//! This test checks that we can't actually have an opaque type behind
//! a binder that references variables from that binder.

// edition: 2021

#![feature(type_alias_impl_trait)]

trait B {
    type C;
}

struct A;

impl<'a> B for &'a A {
    type C = Tait<'a>;
}

type Tait<'a> = impl std::fmt::Debug + 'a;

struct Terminator;

type Successors<'a> = impl std::fmt::Debug + 'a;

impl Terminator {
    fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> {
        f = g;
        //~^ ERROR mismatched types
        //~| ERROR item constrains opaque type that is not in its signature
    }
}

fn g(x: &()) -> &() {
    x
}

fn main() {}