summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs
blob: e51508d684f9cc5a11ae9a77028e03982ebf1b31 (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: old next
//[old] check-pass

// Currently always fails to generalize the outer alias, even if it
// is treated as rigid by `alias-relate`.
//[next] compile-flags: -Znext-solver
//[next] known-bug: trait-system-refactor-initiative#8
#![crate_type = "lib"]
#![allow(unused)]
trait Unnormalizable {
    type Assoc;
}

trait Id<T> {
    type Id;
}
impl<T, U> Id<T> for U {
    type Id = U;
}

struct Inv<T>(*mut T);

fn unconstrained<T>() -> T {
    todo!()
}

fn create<T, U: Unnormalizable>(
    x: &U,
) -> (Inv<T>, Inv<<<U as Id<T>>::Id as Unnormalizable>::Assoc>) {
    todo!()
}

fn foo<T: Unnormalizable>() {
    let q = unconstrained();
    let (mut x, y) = create::<_, _>(&q);
    x = y;
    drop::<T>(q);
}