]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-36082.fixed
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / issue-36082.fixed
1 // run-rustfix
2 use std::cell::RefCell;
3
4 fn main() {
5     let mut r = 0;
6     let s = 0;
7     let x = RefCell::new((&mut r,s));
8
9     let binding = x.borrow();
10     let val: &_ = binding.0;
11     //~^ ERROR temporary value dropped while borrowed [E0716]
12     //~| NOTE temporary value is freed at the end of this statement
13     //~| NOTE creates a temporary value which is freed while still in use
14     //~| HELP consider using a `let` binding to create a longer lived value
15     println!("{}", val);
16     //~^ borrow later used here
17 }