about summary refs log tree commit diff
path: root/tests/ui/implied-bounds/impl-implied-bounds-compatibility.rs
blob: 5e3d21eb26ad7bd80404736f5b1fc3a24e3b15ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::cell::RefCell;

pub struct MessageListeners<'a> {
    listeners: RefCell<Vec<Box<dyn FnMut(()) + 'a>>>,
}

pub trait MessageListenersInterface {
    fn listeners<'c>(&'c self) -> &'c MessageListeners<'c>;
}

impl<'a> MessageListenersInterface for MessageListeners<'a> {
    fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> {
        //~^ ERROR in type `&'a MessageListeners<'_>`, reference has a longer lifetime than the data it references
        self
    }
}

fn main() {}