]> git.lizzy.rs Git - rust.git/blob - tests/ui/generic-associated-types/issue-91883.rs
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
[rust.git] / tests / ui / generic-associated-types / issue-91883.rs
1 use std::fmt::Debug;
2 use std::marker::PhantomData;
3
4 #[derive(Debug)]
5 pub struct TransactionImpl<'db> {
6     _marker: PhantomData<&'db ()>,
7 }
8
9 #[derive(Debug)]
10 pub struct CursorImpl<'txn> {
11     _marker: PhantomData<&'txn ()>,
12 }
13
14 pub trait Cursor<'txn> {}
15
16 pub trait Transaction<'db>: Send + Sync + Debug + Sized {
17     type Cursor<'tx>: Cursor<'tx>
18     where
19         'db: 'tx,
20         Self: 'tx;
21
22     fn cursor<'tx>(&'tx self) -> Result<Self::Cursor<'tx>, ()>
23     where
24         'db: 'tx;
25 }
26
27 impl<'tx> Cursor<'tx> for CursorImpl<'tx> {}
28
29 impl<'db> Transaction<'db> for TransactionImpl<'db> {
30     type Cursor<'tx> = CursorImpl<'tx>; //~ ERROR lifetime bound not satisfied
31
32     fn cursor<'tx>(&'tx self) -> Result<Self::Cursor<'tx>, ()>
33     where
34         'db: 'tx,
35     {
36         loop {}
37     }
38 }
39
40 fn main() {}