diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-08-12 14:25:41 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-08-12 14:30:05 -0700 |
| commit | f1799fdfcae806988bd7104870da56c7596af8ac (patch) | |
| tree | 07030434f531353eee21c29df90609a97220f1e3 /src/rustllvm/RustWrapper.cpp | |
| parent | e2273d945640442224a09e532865e4a58257a851 (diff) | |
| download | rust-f1799fdfcae806988bd7104870da56c7596af8ac.tar.gz rust-f1799fdfcae806988bd7104870da56c7596af8ac.zip | |
librustc: Record unique immutable borrows in the restrictions table.
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]
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
