Skip to content

Aliasing rules are broken for closures #17403

Closed
@kvark

Description

@kvark

This compiles and runs:

let mut v = vec![0i];
let f = |i: uint| v.get_mut(i);
let x = f(0);
let y = f(0);
(*x,*y)

x and y are not supposed to live at the same time. Results in an UB (in a more complex case)
Rust:

rustc 0.12.0-nightly (af3889f 2014-09-18 21:20:38 +0000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions