rustc: Remove moved_variables_set

This commit is contained in:
Flavio Percoco 2014-04-23 00:59:42 +02:00
parent d10735e384
commit aff620de1e
9 changed files with 16 additions and 34 deletions

View file

@ -26,8 +26,10 @@ struct F { f: ~int }
pub fn main() {
let mut x = @F {f: ~3};
borrow(x.f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = @F {f: ~4};
println!("&*b_x = {:p}", &(*b_x));

View file

@ -26,8 +26,10 @@ struct F { f: ~int }
pub fn main() {
let mut x = ~@F{f: ~3};
borrow(x.f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
//~^ NOTE borrow occurs due to use of `x` in closure
*x = @F{f: ~4};
println!("&*b_x = {:p}", &(*b_x));

View file

@ -24,8 +24,10 @@ fn borrow(x: &int, f: |x: &int|) {
pub fn main() {
let mut x = @3;
borrow(x, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x) as *int, &(*b_x) as *int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = @22;
println!("&*b_x = {:p}", &(*b_x));

View file

@ -30,8 +30,8 @@ fn testfn(cond: bool) {
println!("*r = {}, exp = {}", *r, exp);
assert_eq!(*r, exp);
x = @5;
y = @6;
x = @5; //~ERROR cannot assign to `x` because it is borrowed
y = @6; //~ERROR cannot assign to `y` because it is borrowed
println!("*r = {}, exp = {}", *r, exp);
assert_eq!(*r, exp);

View file

@ -26,8 +26,10 @@ struct F { f: ~int }
pub fn main() {
let mut x = @F {f: ~3};
borrow((*x).f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = @F {f: ~4};
println!("&*b_x = {:p}", &(*b_x));

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/* Tests conditional rooting of the box y */
// Test no-special rooting is used for managed boxes
#![feature(managed_boxes)]
@ -25,12 +25,11 @@ fn testfn(cond: bool) {
exp = 4;
}
x = @5;
y = @6;
x = @5; //~ERROR cannot assign to `x` because it is borrowed
y = @6; //~ERROR cannot assign to `y` because it is borrowed
assert_eq!(*a, exp);
assert_eq!(x, @5);
assert_eq!(y, @6);
}
pub fn main() {
}
pub fn main() {}