//@ compile-flags: -Cdebuginfo=2 #![allow(sized_hierarchy_migration)] #![feature(sized_hierarchy)] // added to keep parameters unconstrained pub trait Functor: std::marker::PointeeSized { type With: Functor; } pub struct IdFunctor(T); impl Functor for IdFunctor { type With = IdFunctor; } impl Functor for Vec { type With = Vec ; } pub struct Compose(F1::With>) where F1: Functor + std::marker::PointeeSized, F2: Functor + std::marker::PointeeSized; impl Functor for Compose where F1: Functor + std::marker::PointeeSized, F2: Functor + std::marker::PointeeSized, { type With = F1::With> ; } pub enum Value where F: Functor + std::marker::PointeeSized, { SignedInt(*mut F::With), Array(*mut Value, ()>>), } fn main() { let x: Value> = Value::SignedInt(&mut IdFunctor(1)); }