]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/memleak_rc.rs
Rollup merge of #101642 - SkiFire13:fix-inplace-collection-leak, r=the8472
[rust.git] / src / tools / miri / tests / fail / memleak_rc.rs
1 //@error-pattern: the evaluated program leaked memory
2 //@stderr-per-bitwidth
3 //@normalize-stderr-test: ".*│.*" -> "$$stripped$$"
4
5 use std::cell::RefCell;
6 use std::rc::Rc;
7
8 struct Dummy(Rc<RefCell<Option<Dummy>>>);
9
10 fn main() {
11     let x = Dummy(Rc::new(RefCell::new(None)));
12     let y = Dummy(x.0.clone());
13     *x.0.borrow_mut() = Some(y);
14 }