summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generics/issue-94923.rs
blob: d337a5dffc934116d1c490f8520c980318e728cc (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
39
40
41
42
43
44
45
46
47
48
49
// run-pass
// regression test for issue #94923
// min-llvm-version: 15.0.0
// compile-flags: -C opt-level=3

fn f0<T>(mut x: usize) -> usize {
    for _ in 0..1000 {
        x *= 123;
        x %= 99
    }
    x + 321 // function composition is not just longer iteration
}

fn f1<T>(x: usize) -> usize {
    f0::<(i8, T)>(f0::<(u8, T)>(x))
}

fn f2<T>(x: usize) -> usize {
    f1::<(i8, T)>(f1::<(u8, T)>(x))
}

fn f3<T>(x: usize) -> usize {
    f2::<(i8, T)>(f2::<(u8, T)>(x))
}

fn f4<T>(x: usize) -> usize {
    f3::<(i8, T)>(f3::<(u8, T)>(x))
}

fn f5<T>(x: usize) -> usize {
    f4::<(i8, T)>(f4::<(u8, T)>(x))
}

fn f6<T>(x: usize) -> usize {
    f5::<(i8, T)>(f5::<(u8, T)>(x))
}

fn f7<T>(x: usize) -> usize {
    f6::<(i8, T)>(f6::<(u8, T)>(x))
}

fn f8<T>(x: usize) -> usize {
    f7::<(i8, T)>(f7::<(u8, T)>(x))
}

fn main() {
    let y = f8::<()>(1);
    assert_eq!(y, 348);
}