// run-pass #![allow(unused_variables)] pub trait Parameters { type SelfRef; } struct RP<'a> { _marker: std::marker::PhantomData<&'a ()> } struct BP; impl<'a> Parameters for RP<'a> { type SelfRef = &'a X>; } impl Parameters for BP { type SelfRef = Box>; } pub struct Y; pub enum X { Nothing, SameAgain(P::SelfRef, Y) } fn main() { let bnil: Box> = Box::new(X::Nothing); let bx: Box> = Box::new(X::SameAgain(bnil, Y)); let rnil: X = X::Nothing; let rx: X = X::SameAgain(&rnil, Y); }