Skip to content

Commit

Permalink
add test for rust-lang#54467
Browse files Browse the repository at this point in the history
  • Loading branch information
arielb1 committed Oct 6, 2018
1 parent 9694749 commit e954510
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/test/run-pass/issue-54467.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

pub trait Stream {
type Item;
type Error;
}

pub trait ParseError<I> {
type Output;
}

impl ParseError<char> for u32 {
type Output = ();
}

impl Stream for () {
type Item = char;
type Error = u32;
}

pub struct Lex<'a, I>
where I: Stream,
I::Error: ParseError<char>,
<<I as Stream>::Error as ParseError<char>>::Output: 'a
{
x: &'a <I::Error as ParseError<char>>::Output
}

pub struct Reserved<'a, I> where
I: Stream<Item=char> + 'a,
I::Error: ParseError<I::Item>,
// <<I as Stream>::Error as ParseError<char>>::Output: 'a // comment this to compile

{
x: Lex<'a, I>
}

fn main() {
let r: Reserved<()> = Reserved {
x: Lex {
x: &()
}
};

let _v = r.x.x;
}

0 comments on commit e954510

Please sign in to comment.