// run-pass pub trait Stream { type Item; type Error; } pub trait ParseError { type Output; } impl ParseError for u32 { type Output = (); } impl Stream for () { type Item = char; type Error = u32; } pub struct Lex<'a, I> where I: Stream, I::Error: ParseError, <::Error as ParseError>::Output: 'a { x: &'a >::Output } pub struct Reserved<'a, I> where I: Stream + 'a, I::Error: ParseError, <::Error as ParseError>::Output: 'a { x: Lex<'a, I> } fn main() { let r: Reserved<()> = Reserved { x: Lex { x: &() } }; let _v = r.x.x; }