fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
523 B17 linesraw
1// run-rustfix
2use std::cell::RefCell;
3
4fn 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}