]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-type-bounds/fn-apit.rs
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
[rust.git] / src / test / ui / associated-type-bounds / fn-apit.rs
1 // run-pass
2 // aux-build:fn-aux.rs
3
4 #![allow(unused)]
5 #![feature(associated_type_bounds)]
6
7 extern crate fn_aux;
8
9 use fn_aux::*;
10
11 fn apit_bound(beta: impl Beta<Gamma: Alpha>) -> usize {
12     desugared_bound(beta)
13 }
14
15 fn apit_bound_region(beta: impl Beta<Gamma: 'static>) -> usize {
16     desugared_bound_region(beta)
17 }
18
19 fn apit_bound_multi(
20     beta: impl Copy + Beta<Gamma: Alpha + 'static + Delta>
21 ) -> usize {
22     desugared_bound_multi(beta)
23 }
24
25 fn apit_bound_region_forall(
26     beta: impl Beta<Gamma: Copy + for<'a> Epsilon<'a>>
27 ) -> usize {
28     desugared_bound_region_forall(beta)
29 }
30
31 fn apit_bound_region_forall2(
32     beta: impl Beta<Gamma: Copy + for<'a> Epsilon<'a, Zeta: Eta>>
33 ) -> usize {
34     desugared_bound_region_forall2(beta)
35 }
36
37 fn apit_bound_nested(
38     beta: impl Beta<Gamma: Copy + Alpha + Beta<Gamma: Delta>>
39 ) -> usize {
40     desugared_bound_nested(beta)
41 }
42
43 fn apit_bound_nested2(
44     beta: impl Beta<Gamma = impl Copy + Alpha + Beta<Gamma: Delta>>
45 ) -> usize {
46     desugared_bound_nested(beta)
47 }
48
49 fn main() {
50     let beta = BetaType;
51     let _gamma = beta.gamma();
52
53     assert_eq!(42, apit_bound(beta));
54     assert_eq!(24, apit_bound_region(beta));
55     assert_eq!(42 + 24 + 1337, apit_bound_multi(beta));
56     assert_eq!(7331 * 2, apit_bound_region_forall(beta));
57     assert_eq!(42 + 1337, apit_bound_nested(beta));
58     assert_eq!(42 + 1337, apit_bound_nested2(beta));
59 }