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 60 61 62 63 64 65
|
// run-pass
// aux-build:fn-aux.rs
#![feature(associated_type_bounds)]
#![allow(dead_code)]
extern crate fn_aux;
use fn_aux::*;
// ATB, APIT + Wrap:
struct Wrap<T>(T);
fn wrap_apit_bound(beta: Wrap<impl Beta<Gamma: Alpha>>) -> usize {
desugared_bound(beta.0)
}
fn wrap_apit_bound_region(beta: Wrap<impl Beta<Gamma: 'static>>) -> usize {
desugared_bound_region(beta.0)
}
fn wrap_apit_bound_multi(
beta: Wrap<impl Copy + Beta<Gamma: Alpha + 'static + Delta>>
) -> usize {
desugared_bound_multi(beta.0)
}
fn wrap_apit_bound_region_forall(
beta: Wrap<impl Beta<Gamma: Copy + for<'a> Epsilon<'a>>>
) -> usize {
desugared_bound_region_forall(beta.0)
}
fn wrap_apit_bound_region_forall2(
beta: Wrap<impl Beta<Gamma: Copy + for<'a> Epsilon<'a, Zeta: Eta>>>
) -> usize {
desugared_bound_region_forall2(beta.0)
}
fn wrap_apit_bound_nested(
beta: Wrap<impl Beta<Gamma: Copy + Alpha + Beta<Gamma: Delta>>>
) -> usize {
desugared_bound_nested(beta.0)
}
fn wrap_apit_bound_nested2(
beta: Wrap<impl Beta<Gamma = impl Copy + Alpha + Beta<Gamma: Delta>>>
) -> usize {
desugared_bound_nested(beta.0)
}
fn main() {
let beta = BetaType;
let _gamma = beta.gamma();
assert_eq!(42, wrap_apit_bound(Wrap(beta)));
assert_eq!(24, wrap_apit_bound_region(Wrap(beta)));
assert_eq!(42 + 24 + 1337, wrap_apit_bound_multi(Wrap(beta)));
assert_eq!(7331 * 2, wrap_apit_bound_region_forall(Wrap(beta)));
// FIXME: requires lazy normalization.
// assert_eq!(7331 * 2, wrap_apit_bound_region_forall2(Wrap(beta)));
assert_eq!(42 + 1337, wrap_apit_bound_nested(Wrap(beta)));
assert_eq!(42 + 1337, wrap_apit_bound_nested2(Wrap(beta)));
}
|