summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/issue-63154-normalize.rs
blob: 484c12879d33ae50849aac68476ab450c04a3540 (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
// Regression test for rust-lang/rust#63154
//
// Before, we would ICE after failing to normalize the destination type
// when checking call destinations and also when checking MIR
// assignment statements.

// check-pass

trait HasAssocType {
    type Inner;
}

impl HasAssocType for () {
    type Inner = ();
}

trait Tr<I, T>: Fn(I) -> Option<T> {}
impl<I, T, Q: Fn(I) -> Option<T>> Tr<I, T> for Q {}

fn f<T: HasAssocType>() -> impl Tr<T, T::Inner> {
    |_| None
}

fn g<T, Y>(f: impl Tr<T, Y>) -> impl Tr<T, Y> {
    f
}

fn h() {
    g(f())(());
}

fn main() {
    h();
}