]> git.proxmox.com Git - rustc.git/blob - tests/ui/associated-types/issue-54467.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / associated-types / issue-54467.rs
1 // run-pass
2
3 pub trait Stream {
4 type Item;
5 type Error;
6 }
7
8 pub trait ParseError<I> {
9 type Output;
10 }
11
12 impl ParseError<char> for u32 {
13 type Output = ();
14 }
15
16 impl Stream for () {
17 type Item = char;
18 type Error = u32;
19 }
20
21 pub struct Lex<'a, I>
22 where I: Stream,
23 I::Error: ParseError<char>,
24 <<I as Stream>::Error as ParseError<char>>::Output: 'a
25 {
26 x: &'a <I::Error as ParseError<char>>::Output
27 }
28
29 pub struct Reserved<'a, I> where
30 I: Stream<Item=char> + 'a,
31 I::Error: ParseError<I::Item>,
32 <<I as Stream>::Error as ParseError<char>>::Output: 'a
33
34 {
35 x: Lex<'a, I>
36 }
37
38 fn main() {
39 let r: Reserved<()> = Reserved {
40 x: Lex {
41 x: &()
42 }
43 };
44
45 let _v = r.x.x;
46 }