This repository was archived by the owner on Apr 5, 2024. It is now read-only.
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Don't truncate Derefs if the data is not moved into the closure #52
Closed
Description
Both these examples currently truncate the capture to the root variable
fn box_mut() {
let mut s = Foo { x: 0 } ;
let px = &mut s;
let bx = Box::new(px);
let c = #[rustc_capture_analysis] move || bx.x += 10;
}
fn mut_box() {
let s = String::new();
let bx = Box::new(s);
let px = &mut bx;
let c = #[rustc_capture_analysis] move || px.truncate(0);
}