summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-type-bounds/fn-apit.rs
blob: 3c9f511338f6965bf5ed40ab181caa721d47b505 (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
50
51
52
53
54
55
56
57
58
59
// run-pass
// aux-build:fn-aux.rs

#![allow(unused)]
#![feature(associated_type_bounds)]

extern crate fn_aux;

use fn_aux::*;

fn apit_bound(beta: impl Beta<Gamma: Alpha>) -> usize {
    desugared_bound(beta)
}

fn apit_bound_region(beta: impl Beta<Gamma: 'static>) -> usize {
    desugared_bound_region(beta)
}

fn apit_bound_multi(
    beta: impl Copy + Beta<Gamma: Alpha + 'static + Delta>
) -> usize {
    desugared_bound_multi(beta)
}

fn apit_bound_region_forall(
    beta: impl Beta<Gamma: Copy + for<'a> Epsilon<'a>>
) -> usize {
    desugared_bound_region_forall(beta)
}

fn apit_bound_region_forall2(
    beta: impl Beta<Gamma: Copy + for<'a> Epsilon<'a, Zeta: Eta>>
) -> usize {
    desugared_bound_region_forall2(beta)
}

fn apit_bound_nested(
    beta: impl Beta<Gamma: Copy + Alpha + Beta<Gamma: Delta>>
) -> usize {
    desugared_bound_nested(beta)
}

fn apit_bound_nested2(
    beta: impl Beta<Gamma = impl Copy + Alpha + Beta<Gamma: Delta>>
) -> usize {
    desugared_bound_nested(beta)
}

fn main() {
    let beta = BetaType;
    let _gamma = beta.gamma();

    assert_eq!(42, apit_bound(beta));
    assert_eq!(24, apit_bound_region(beta));
    assert_eq!(42 + 24 + 1337, apit_bound_multi(beta));
    assert_eq!(7331 * 2, apit_bound_region_forall(beta));
    assert_eq!(42 + 1337, apit_bound_nested(beta));
    assert_eq!(42 + 1337, apit_bound_nested2(beta));
}