Skip to content

Mutably capturing in a closure doesn't count as a borrow #11302

Closed
@alexcrichton

Description

@alexcrichton

The compiler accepts this code when it definitely shouldn't

 fn foo() {                       
     let mut a = ~[];             
     let push = |b: &mut ~[int]| {
         a.push(b[0]);            
     };                           
     push(&mut a);                
 }                                

cc @nikomatsakis

Nominating (although this is probably a dupe of an existing issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions