rustc: Remove moved_variables_set
This commit is contained in:
parent
d10735e384
commit
aff620de1e
9 changed files with 16 additions and 34 deletions
|
|
@ -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));
|
||||
|
|
@ -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));
|
||||
|
|
@ -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));
|
||||
|
|
@ -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);
|
||||
|
|
@ -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));
|
||||
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue