1 // This is just checking that we still reject code where temp values
2 // are borrowing values for longer than they will be around.
4 // Compare to run-pass/issue-23338-params-outlive-temps-of-body.rs
6 use std::cell::RefCell;
8 fn foo(x: RefCell<String>) -> String {
12 //~^^ ERROR `y` does not live long enough
14 fn foo2(x: RefCell<String>) -> String {
19 //~^^ ERROR `y` does not live long enough
24 let r = RefCell::new(format!("data"));
25 assert_eq!(foo(r), "data");
26 let r = RefCell::new(format!("data"));
27 assert_eq!(foo2(r), "data");