3 use std::cell::RefCell;
5 struct S<'a>(i32, &'a RefCell<Vec<i32>>);
7 impl<'a> Drop for S<'a> {
9 self.1.borrow_mut().push(self.0);
13 fn test(drops: &RefCell<Vec<i32>>) {
20 *(&mut foo) = Some((S(0, drops), S(1, drops))); // Both S(0) and S(1) should be dropped
29 let drops = RefCell::new(Vec::new());
31 assert_eq!(*drops.borrow(), &[0, 1]);