File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ pub trait Stream {
12+ type Item ;
13+ type Error ;
14+ }
15+
16+ pub trait ParseError < I > {
17+ type Output ;
18+ }
19+
20+ impl ParseError < char > for u32 {
21+ type Output = ( ) ;
22+ }
23+
24+ impl Stream for ( ) {
25+ type Item = char ;
26+ type Error = u32 ;
27+ }
28+
29+ pub struct Lex < ' a , I >
30+ where I : Stream ,
31+ I :: Error : ParseError < char > ,
32+ <<I as Stream >:: Error as ParseError < char > >:: Output : ' a
33+ {
34+ x : & ' a <I :: Error as ParseError < char > >:: Output
35+ }
36+
37+ pub struct Reserved < ' a , I > where
38+ I : Stream < Item =char > + ' a ,
39+ I :: Error : ParseError < I :: Item > ,
40+ // <<I as Stream>::Error as ParseError<char>>::Output: 'a // comment this to compile
41+
42+ {
43+ x : Lex < ' a , I >
44+ }
45+
46+ fn main ( ) {
47+ let r: Reserved < ( ) > = Reserved {
48+ x : Lex {
49+ x : & ( )
50+ }
51+ } ;
52+
53+ let _v = r. x . x ;
54+ }
You can’t perform that action at this time.
0 commit comments