fork/rust

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

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

master
363 B14 linesraw
1// run-rustfix
2
3use std::collections::HashMap;
4
5fn main() {
6    let tmp: Box<_>;
7    let mut buggy_map: HashMap<usize, &usize> = HashMap::new();
8    let binding = Box::new(1);
9    buggy_map.insert(42, &*binding); //~ ERROR temporary value dropped while borrowed
10
11    // but it is ok if we use a temporary
12    tmp = Box::new(2);
13    buggy_map.insert(43, &*tmp);
14}