2 type Cursor<'a>: DocCursor<'a>;
3 //~^ ERROR: missing required bound on `Cursor`
5 fn cursor(&self) -> Self::Cursor<'_>;
10 impl Document for DocumentImpl {
11 type Cursor<'a> = DocCursorImpl<'a>;
13 fn cursor(&self) -> Self::Cursor<'_> {
14 DocCursorImpl { document: &self }
18 trait DocCursor<'a> {}
20 struct DocCursorImpl<'a> {
21 document: &'a DocumentImpl,
24 impl<'a> DocCursor<'a> for DocCursorImpl<'a> {}
26 struct Lexer<'d, Cursor>
28 Cursor: DocCursor<'d>,
31 _phantom: std::marker::PhantomData<&'d ()>,
34 impl<'d, Cursor> Lexer<'d, Cursor>
36 Cursor: DocCursor<'d>,
38 pub fn from<Doc>(document: &'d Doc) -> Lexer<'d, Cursor>
40 Doc: Document<Cursor<'d> = Cursor>,
42 Lexer { cursor: document.cursor(), _phantom: std::marker::PhantomData }
46 fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'_>> {
47 //~^ ERROR `'_` cannot be used here [E0637]
48 //~| ERROR: missing lifetime specifier
53 let doc = create_doc();
54 let lexer: Lexer<'_, DocCursorImpl<'_>> = Lexer::from(&doc);