]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/memleak_rc.rs
Add a custom ui test runner and move all tests to it
[rust.git] / tests / compile-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::rc::Rc;
6 use std::cell::RefCell;
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 }