about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-08-13 04:11:22 +0000
committerbors <bors@rust-lang.org>2014-08-13 04:11:22 +0000
commit6291781592ff079fc1e84f4b8be5684d2a52b8bd (patch)
tree4aaf32a3a7f2782a8d95513d3fcea0368518ab4e /src/rustllvm/RustWrapper.cpp
parentee87234eed95d6077247bee5416339ce2652b599 (diff)
parentf1799fdfcae806988bd7104870da56c7596af8ac (diff)
downloadrust-6291781592ff079fc1e84f4b8be5684d2a52b8bd.tar.gz
rust-6291781592ff079fc1e84f4b8be5684d2a52b8bd.zip
auto merge of #16460 : pcwalton/rust/borrowck-closure-issue, r=nikomatsakis
This fixes borrow checking for closures. Code like this will break:

    struct Foo {
        x: int,
    }

    pub fn main() {
        let mut this = &mut Foo {
            x: 1,
        };
        let r = || {
            let p = &this.x;
            &mut this.x;
        };
        r()
    }

Change this code to not take multiple mutable references to the same value. For
example:

    struct Foo {
        x: int,
    }

    pub fn main() {
        let mut this = &mut Foo {
            x: 1,
        };
        let r = || {
            &mut this.x;
        };
        r()
    }

Closes #16361.

[breaking-change]

r? @nikomatsakis
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions