make borrowck more conservative around rvalues.

this will require more temporaries, but is probably less magical.
also, it means that borrowck matches trans better, so fewer crashes.
bonus.

Finally, stop warning about implicit copies when we are actually borrowing.

Also, one test (vec-res-add) stopped failing due to #2587, and hence I
added an xfail-test.

Fixes #3217, #2977, #3067
This commit is contained in:
Niko Matsakis 2012-08-17 14:09:20 -07:00
parent 8f01343f01
commit ea549e7a71
9 changed files with 89 additions and 49 deletions

View file

@ -28,11 +28,13 @@ fn b() {
// Here I create an outstanding loan and check that we get conflicts:
&mut p; //~ NOTE prior loan as mutable granted here
let q = &mut p; //~ NOTE prior loan as mutable granted here
//~^ NOTE prior loan as mutable granted here
p + 3; //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
p.times(3); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
q.x += 1;
}
fn c() {

View file

@ -35,11 +35,13 @@ fn b() {
// Here I create an outstanding loan and check that we get conflicts:
&mut p; //~ NOTE prior loan as mutable granted here
let l = &mut p; //~ NOTE prior loan as mutable granted here
//~^ NOTE prior loan as mutable granted here
p.purem(); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
p.impurem(); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
l.x += 1;
}
fn c() {

View file

@ -1,3 +1,4 @@
// xfail-test #2587
// error-pattern: copying a noncopyable value
struct r {