]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-36082.rs
Provide structured suggestion for dropped temp value
[rust.git] / src / test / ui / issues / issue-36082.rs
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 val: &_ = x.borrow().0;
10     //~^ ERROR temporary value dropped while borrowed [E0716]
11     //~| NOTE temporary value is freed at the end of this statement
12     //~| NOTE creates a temporary which is freed while still in use
13     //~| HELP consider using a `let` binding to create a longer lived value
14     println!("{}", val);
15     //~^ borrow later used here
16 }