1 use std::cell::RefCell;
5 let c = RefCell::new(vec![]);
6 c.push(Box::new(|| y = 0));
7 c.push(Box::new(|| y = 0));
8 //~^ ERROR cannot borrow `y` as mutable more than once at a time
13 let c = RefCell::new(vec![]);
15 Push::push(&c, Box::new(|| y = 0));
16 Push::push(&c, Box::new(|| y = 0));
17 //~^ ERROR cannot borrow `y` as mutable more than once at a time
21 fn push<'f: 'c>(&self, push: Box<dyn FnMut() + 'f>);
24 impl<'c> Push<'c> for RefCell<Vec<Box<dyn FnMut() + 'c>>> {
25 fn push<'f: 'c>(&self, fun: Box<dyn FnMut() + 'f>) {
26 self.borrow_mut().push(fun)