Skip to content
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
rust-lang/rust
#86995
@arora-aman

Description

@arora-aman

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions