Update ui tests
This commit is contained in:
parent
c5047cb494
commit
1a6ed0271e
24 changed files with 73 additions and 720 deletions
|
|
@ -1,27 +1,3 @@
|
|||
error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-anon-fields-struct.rs:23:19
|
||||
|
|
||||
LL | Y(ref mut a, _) => a
|
||||
| --------- mutable borrow occurs here
|
||||
...
|
||||
LL | let b = match y {
|
||||
| ^ immutable borrow occurs here
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-anon-fields-struct.rs:38:19
|
||||
|
|
||||
LL | Y(ref mut a, _) => a
|
||||
| --------- mutable borrow occurs here
|
||||
...
|
||||
LL | let b = match y {
|
||||
| ^ immutable borrow occurs here
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
|
||||
--> $DIR/borrowck-anon-fields-struct.rs:39:11
|
||||
|
|
||||
|
|
@ -34,7 +10,6 @@ LL | Y(ref mut b, _) => b //~ ERROR cannot borrow
|
|||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
Some errors occurred: E0499, E0502.
|
||||
For more information about an error, try `rustc --explain E0499`.
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
|
|
|
|||
|
|
@ -1,27 +1,3 @@
|
|||
error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-anon-fields-tuple.rs:21:19
|
||||
|
|
||||
LL | (ref mut a, _) => a
|
||||
| --------- mutable borrow occurs here
|
||||
...
|
||||
LL | let b = match y {
|
||||
| ^ immutable borrow occurs here
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-anon-fields-tuple.rs:36:19
|
||||
|
|
||||
LL | (ref mut a, _) => a
|
||||
| --------- mutable borrow occurs here
|
||||
...
|
||||
LL | let b = match y {
|
||||
| ^ immutable borrow occurs here
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
|
||||
--> $DIR/borrowck-anon-fields-tuple.rs:37:10
|
||||
|
|
||||
|
|
@ -34,7 +10,6 @@ LL | (ref mut b, _) => b //~ ERROR cannot borrow
|
|||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
Some errors occurred: E0499, E0502.
|
||||
For more information about an error, try `rustc --explain E0499`.
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
|
|
|
|||
|
|
@ -1,27 +1,3 @@
|
|||
error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:26:19
|
||||
|
|
||||
LL | Foo::Y(ref mut a, _) => a,
|
||||
| --------- mutable borrow occurs here
|
||||
...
|
||||
LL | let b = match y {
|
||||
| ^ immutable borrow occurs here
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:43:19
|
||||
|
|
||||
LL | Foo::Y(ref mut a, _) => a,
|
||||
| --------- mutable borrow occurs here
|
||||
...
|
||||
LL | let b = match y {
|
||||
| ^ immutable borrow occurs here
|
||||
...
|
||||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `y.0` as mutable more than once at a time
|
||||
--> $DIR/borrowck-anon-fields-variant.rs:44:14
|
||||
|
|
||||
|
|
@ -34,7 +10,6 @@ LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow
|
|||
LL | *a += 1;
|
||||
| ------- borrow later used here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
Some errors occurred: E0499, E0502.
|
||||
For more information about an error, try `rustc --explain E0499`.
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
|
|
|
|||
|
|
@ -28,17 +28,6 @@ LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
|
|||
LL | *bar1;
|
||||
| ----- borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-borrow-from-owned-ptr.rs:72:11
|
||||
|
|
||||
LL | let bar1 = &mut foo.bar1;
|
||||
| ------------- mutable borrow occurs here
|
||||
LL | match *foo {
|
||||
| ^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | *bar1;
|
||||
| ----- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
|
||||
--> $DIR/borrowck-borrow-from-owned-ptr.rs:73:21
|
||||
|
|
||||
|
|
@ -121,7 +110,7 @@ LL | let foo = make_foo();
|
|||
LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
|
||||
| ^^^^^^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
Some errors occurred: E0499, E0502, E0596.
|
||||
For more information about an error, try `rustc --explain E0499`.
|
||||
|
|
|
|||
|
|
@ -28,17 +28,6 @@ LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
|
|||
LL | *bar1;
|
||||
| ----- borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-borrow-from-stack-variable.rs:70:11
|
||||
|
|
||||
LL | let bar1 = &mut foo.bar1;
|
||||
| ------------- mutable borrow occurs here
|
||||
LL | match foo {
|
||||
| ^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | *bar1;
|
||||
| ----- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
|
||||
--> $DIR/borrowck-borrow-from-stack-variable.rs:71:21
|
||||
|
|
||||
|
|
@ -121,7 +110,7 @@ LL | let foo = make_foo();
|
|||
LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
|
||||
| ^^^^^^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
Some errors occurred: E0499, E0502, E0596.
|
||||
For more information about an error, try `rustc --explain E0499`.
|
||||
|
|
|
|||
|
|
@ -72,23 +72,12 @@ LL | //[mir]~^ ERROR cannot use `h.0` because it was mutably borrow
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:77:15
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
| ^ use of borrowed `e`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:78:20
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
LL | match e {
|
||||
LL | Baz::X(value) => value
|
||||
| ^^^^^ use of borrowed `e`
|
||||
...
|
||||
|
|
@ -139,23 +128,12 @@ LL | //[mir]~^ ERROR cannot use `h.0` because it was mutably borrow
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `*e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:120:15
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `*e` occurs here
|
||||
LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
|
||||
| ^^ use of borrowed `*e`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:121:20
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `*e` occurs here
|
||||
LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
|
||||
LL | match *e {
|
||||
LL | Baz::X(value) => value
|
||||
| ^^^^^ use of borrowed `*e`
|
||||
...
|
||||
|
|
@ -173,41 +151,18 @@ LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrow
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:139:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:140:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
LL | match v {
|
||||
LL | &[x, _, .., _, _] => println!("{}", x),
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:145:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:146:18
|
||||
|
|
||||
|
|
@ -220,18 +175,6 @@ LL | &[_, x, .., _, _] => println!("{}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:151:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:152:25
|
||||
|
|
||||
|
|
@ -244,18 +187,6 @@ LL | &[_, _, .., x, _] => println!("{}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:157:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:158:28
|
||||
|
|
||||
|
|
@ -268,41 +199,18 @@ LL | &[_, _, .., _, x] => println!("{}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:169:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:170:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
LL | match v {
|
||||
LL | &[x..] => println!("{:?}", x),
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:175:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:176:18
|
||||
|
|
||||
|
|
@ -315,18 +223,6 @@ LL | &[_, x..] => println!("{:?}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:181:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:182:15
|
||||
|
|
||||
|
|
@ -339,18 +235,6 @@ LL | &[x.., _] => println!("{:?}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:187:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:188:18
|
||||
|
|
||||
|
|
@ -363,23 +247,12 @@ LL | &[_, x.., _] => println!("{:?}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:201:15
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
| ^ use of borrowed `e`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:202:13
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
LL | match e {
|
||||
LL | E::A(ref ax) =>
|
||||
| ^^^^^^^^^^^^ use of borrowed `e`
|
||||
...
|
||||
|
|
@ -391,7 +264,7 @@ error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mu
|
|||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
LL | match e {
|
||||
LL | E::A(ref ax) =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
|
|
@ -410,41 +283,18 @@ LL | E::B { x: ref bx } =>
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `s` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:220:15
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ borrow of `s` occurs here
|
||||
LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
| ^ use of borrowed `s`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:221:22
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
LL | match s {
|
||||
LL | S { y: (ref y0, _), .. } =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `s` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:227:15
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ borrow of `s` occurs here
|
||||
...
|
||||
LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
| ^ use of borrowed `s`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:228:28
|
||||
|
|
||||
|
|
@ -479,23 +329,12 @@ LL | v[0].y;
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:282:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:283:24
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
LL | match v {
|
||||
LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
|
|
@ -534,7 +373,7 @@ LL | drop(x); //[ast]~ ERROR use of moved value: `x`
|
|||
|
|
||||
= note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to 46 previous errors
|
||||
error: aborting due to 32 previous errors
|
||||
|
||||
Some errors occurred: E0382, E0499, E0502, E0503.
|
||||
For more information about an error, try `rustc --explain E0382`.
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
|
|||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
LL | match e {
|
||||
LL | Baz::X(value) => value
|
||||
| ^^^^^ use of borrowed `e`
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
|
|||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `*e` occurs here
|
||||
LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
|
||||
LL | match *e {
|
||||
LL | Baz::X(value) => value
|
||||
| ^^^^^ use of borrowed `*e`
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
|||
|
|
||||
LL | let x = &mut v;
|
||||
| - borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
LL | match v {
|
||||
LL | &[x, _, .., _, _] => println!("{}", x),
|
||||
| ^ use of borrowed `v`
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
|||
|
|
||||
LL | let x = &mut v;
|
||||
| - borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
LL | match v {
|
||||
LL | &[x..] => println!("{:?}", x),
|
||||
| ^ use of borrowed `v`
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ error[E0502]: cannot borrow `e.0` as immutable because `e` is also borrowed as m
|
|||
|
|
||||
LL | let x = &mut e;
|
||||
| - mutable borrow occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
LL | match e {
|
||||
LL | E::A(ref ax) =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
|
|
@ -181,7 +181,7 @@ error[E0502]: cannot borrow `s.y.0` as immutable because `s` is also borrowed as
|
|||
|
|
||||
LL | let x = &mut s;
|
||||
| - mutable borrow occurs here
|
||||
LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
LL | match s {
|
||||
LL | S { y: (ref y0, _), .. } =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
|
|
|
|||
|
|
@ -72,23 +72,12 @@ LL | //[mir]~^ ERROR cannot use `h.0` because it was mutably borrow
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:77:15
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
| ^ use of borrowed `e`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:78:20
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
LL | match e {
|
||||
LL | Baz::X(value) => value
|
||||
| ^^^^^ use of borrowed `e`
|
||||
...
|
||||
|
|
@ -139,23 +128,12 @@ LL | //[mir]~^ ERROR cannot use `h.0` because it was mutably borrow
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `*e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:120:15
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `*e` occurs here
|
||||
LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
|
||||
| ^^ use of borrowed `*e`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e.0` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:121:20
|
||||
|
|
||||
LL | let x = e.x();
|
||||
| - borrow of `*e` occurs here
|
||||
LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
|
||||
LL | match *e {
|
||||
LL | Baz::X(value) => value
|
||||
| ^^^^^ use of borrowed `*e`
|
||||
...
|
||||
|
|
@ -173,41 +151,18 @@ LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrow
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:139:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:140:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
LL | match v {
|
||||
LL | &[x, _, .., _, _] => println!("{}", x),
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:145:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:146:18
|
||||
|
|
||||
|
|
@ -220,18 +175,6 @@ LL | &[_, x, .., _, _] => println!("{}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:151:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:152:25
|
||||
|
|
||||
|
|
@ -244,18 +187,6 @@ LL | &[_, _, .., x, _] => println!("{}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:157:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:158:28
|
||||
|
|
||||
|
|
@ -268,41 +199,18 @@ LL | &[_, _, .., _, x] => println!("{}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:169:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:170:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
LL | match v {
|
||||
LL | &[x..] => println!("{:?}", x),
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:175:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:176:18
|
||||
|
|
||||
|
|
@ -315,18 +223,6 @@ LL | &[_, x..] => println!("{:?}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:181:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:182:15
|
||||
|
|
||||
|
|
@ -339,18 +235,6 @@ LL | &[x.., _] => println!("{:?}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:187:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
...
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v[..]` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:188:18
|
||||
|
|
||||
|
|
@ -363,23 +247,12 @@ LL | &[_, x.., _] => println!("{:?}", x),
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:201:15
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
| ^ use of borrowed `e`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:202:13
|
||||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ borrow of `e` occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
LL | match e {
|
||||
LL | E::A(ref ax) =>
|
||||
| ^^^^^^^^^^^^ use of borrowed `e`
|
||||
...
|
||||
|
|
@ -391,7 +264,7 @@ error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mu
|
|||
|
|
||||
LL | let x = &mut e;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
LL | match e {
|
||||
LL | E::A(ref ax) =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
|
|
@ -410,41 +283,18 @@ LL | E::B { x: ref bx } =>
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `s` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:220:15
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ borrow of `s` occurs here
|
||||
LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
| ^ use of borrowed `s`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:221:22
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
LL | match s {
|
||||
LL | S { y: (ref y0, _), .. } =>
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `s` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:227:15
|
||||
|
|
||||
LL | let x = &mut s;
|
||||
| ------ borrow of `s` occurs here
|
||||
...
|
||||
LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
| ^ use of borrowed `s`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:228:28
|
||||
|
|
||||
|
|
@ -479,23 +329,12 @@ LL | v[0].y;
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `v` because it was mutably borrowed
|
||||
--> $DIR/borrowck-describe-lvalue.rs:282:15
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ borrow of `v` occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
| ^ use of borrowed `v`
|
||||
...
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-describe-lvalue.rs:283:24
|
||||
|
|
||||
LL | let x = &mut v;
|
||||
| ------ mutable borrow occurs here
|
||||
LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
LL | match v {
|
||||
LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
...
|
||||
|
|
@ -534,7 +373,7 @@ LL | drop(x); //[ast]~ ERROR use of moved value: `x`
|
|||
|
|
||||
= note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to 46 previous errors
|
||||
error: aborting due to 32 previous errors
|
||||
|
||||
Some errors occurred: E0382, E0499, E0502, E0503.
|
||||
For more information about an error, try `rustc --explain E0382`.
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ fn main() {
|
|||
{
|
||||
let mut e = Baz::X(2);
|
||||
let x = e.x();
|
||||
match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
match e {
|
||||
Baz::X(value) => value
|
||||
//[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
|
||||
|
|
@ -117,7 +117,7 @@ fn main() {
|
|||
{
|
||||
let mut e = Box::new(Baz::X(3));
|
||||
let x = e.x();
|
||||
match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
|
||||
match *e {
|
||||
Baz::X(value) => value
|
||||
//[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
|
||||
|
|
@ -136,25 +136,25 @@ fn main() {
|
|||
{
|
||||
let mut v = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
let x = &mut v;
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[x, _, .., _, _] => println!("{}", x),
|
||||
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
_ => panic!("other case"),
|
||||
}
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[_, x, .., _, _] => println!("{}", x),
|
||||
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
_ => panic!("other case"),
|
||||
}
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[_, _, .., x, _] => println!("{}", x),
|
||||
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
_ => panic!("other case"),
|
||||
}
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[_, _, .., _, x] => println!("{}", x),
|
||||
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
|
|
@ -166,25 +166,25 @@ fn main() {
|
|||
{
|
||||
let mut v = &[1, 2, 3, 4, 5];
|
||||
let x = &mut v;
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[x..] => println!("{:?}", x),
|
||||
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
_ => panic!("other case"),
|
||||
}
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[_, x..] => println!("{:?}", x),
|
||||
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
_ => panic!("other case"),
|
||||
}
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[x.., _] => println!("{:?}", x),
|
||||
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
_ => panic!("other case"),
|
||||
}
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[_, x.., _] => println!("{:?}", x),
|
||||
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
|
||||
|
|
@ -198,7 +198,7 @@ fn main() {
|
|||
|
||||
let mut e = E::A(3);
|
||||
let x = &mut e;
|
||||
match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
|
||||
match e {
|
||||
E::A(ref ax) =>
|
||||
//[ast]~^ ERROR cannot borrow `e.0` as immutable because `e` is also borrowed as mutable
|
||||
//[mir]~^^ ERROR cannot borrow `e.0` as immutable because it is also borrowed as mutable
|
||||
|
|
@ -217,14 +217,14 @@ fn main() {
|
|||
struct S { x: F, y: (u32, u32), };
|
||||
let mut s = S { x: F { x: 1, y: 2}, y: (999, 998) };
|
||||
let x = &mut s;
|
||||
match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
match s {
|
||||
S { y: (ref y0, _), .. } =>
|
||||
//[ast]~^ ERROR cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable
|
||||
//[mir]~^^ ERROR cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
|
||||
println!("y0: {:?}", y0),
|
||||
_ => panic!("other case"),
|
||||
}
|
||||
match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
|
||||
match s {
|
||||
S { x: F { y: ref x0, .. }, .. } =>
|
||||
//[ast]~^ ERROR cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable
|
||||
//[mir]~^^ ERROR cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
|
||||
|
|
@ -279,7 +279,7 @@ fn main() {
|
|||
struct F {x: u32, y: u32};
|
||||
let mut v = &[F{x: 1, y: 2}, F{x: 3, y: 4}];
|
||||
let x = &mut v;
|
||||
match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
|
||||
match v {
|
||||
&[_, F {x: ref xf, ..}] => println!("{}", xf),
|
||||
//[mir]~^ ERROR cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
|
||||
// No errors in AST
|
||||
|
|
|
|||
|
|
@ -1,20 +1,9 @@
|
|||
error[E0503]: cannot use `foo` because it was mutably borrowed
|
||||
--> $DIR/borrowck-match-already-borrowed.rs:22:19
|
||||
|
|
||||
LL | let p = &mut foo;
|
||||
| -------- borrow of `foo` occurs here
|
||||
LL | let _ = match foo { //[mir]~ ERROR [E0503]
|
||||
| ^^^ use of borrowed `foo`
|
||||
...
|
||||
LL | drop(p);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `foo` because it was mutably borrowed
|
||||
--> $DIR/borrowck-match-already-borrowed.rs:23:9
|
||||
|
|
||||
LL | let p = &mut foo;
|
||||
| -------- borrow of `foo` occurs here
|
||||
LL | let _ = match foo { //[mir]~ ERROR [E0503]
|
||||
LL | let _ = match foo {
|
||||
LL | Foo::B => 1, //[mir]~ ERROR [E0503]
|
||||
| ^^^^^^ use of borrowed `foo`
|
||||
...
|
||||
|
|
@ -33,23 +22,12 @@ LL | Foo::A(x) => x //[ast]~ ERROR [E0503]
|
|||
LL | drop(p);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `x` because it was mutably borrowed
|
||||
--> $DIR/borrowck-match-already-borrowed.rs:35:19
|
||||
|
|
||||
LL | let r = &mut x;
|
||||
| ------ borrow of `x` occurs here
|
||||
LL | let _ = match x { //[mir]~ ERROR [E0503]
|
||||
| ^ use of borrowed `x`
|
||||
...
|
||||
LL | drop(r);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `x` because it was mutably borrowed
|
||||
--> $DIR/borrowck-match-already-borrowed.rs:36:9
|
||||
|
|
||||
LL | let r = &mut x;
|
||||
| ------ borrow of `x` occurs here
|
||||
LL | let _ = match x { //[mir]~ ERROR [E0503]
|
||||
LL | let _ = match x {
|
||||
LL | x => x + 1, //[ast]~ ERROR [E0503]
|
||||
| ^ use of borrowed `x`
|
||||
...
|
||||
|
|
@ -68,6 +46,6 @@ LL | y => y + 2, //[ast]~ ERROR [E0503]
|
|||
LL | drop(r);
|
||||
| - borrow later used here
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0503`.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed
|
|||
|
|
||||
LL | let r = &mut x;
|
||||
| - borrow of `x` occurs here
|
||||
LL | let _ = match x { //[mir]~ ERROR [E0503]
|
||||
LL | let _ = match x {
|
||||
LL | x => x + 1, //[ast]~ ERROR [E0503]
|
||||
| ^ use of borrowed `x`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,9 @@
|
|||
error[E0503]: cannot use `foo` because it was mutably borrowed
|
||||
--> $DIR/borrowck-match-already-borrowed.rs:22:19
|
||||
|
|
||||
LL | let p = &mut foo;
|
||||
| -------- borrow of `foo` occurs here
|
||||
LL | let _ = match foo { //[mir]~ ERROR [E0503]
|
||||
| ^^^ use of borrowed `foo`
|
||||
...
|
||||
LL | drop(p);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `foo` because it was mutably borrowed
|
||||
--> $DIR/borrowck-match-already-borrowed.rs:23:9
|
||||
|
|
||||
LL | let p = &mut foo;
|
||||
| -------- borrow of `foo` occurs here
|
||||
LL | let _ = match foo { //[mir]~ ERROR [E0503]
|
||||
LL | let _ = match foo {
|
||||
LL | Foo::B => 1, //[mir]~ ERROR [E0503]
|
||||
| ^^^^^^ use of borrowed `foo`
|
||||
...
|
||||
|
|
@ -33,23 +22,12 @@ LL | Foo::A(x) => x //[ast]~ ERROR [E0503]
|
|||
LL | drop(p);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `x` because it was mutably borrowed
|
||||
--> $DIR/borrowck-match-already-borrowed.rs:35:19
|
||||
|
|
||||
LL | let r = &mut x;
|
||||
| ------ borrow of `x` occurs here
|
||||
LL | let _ = match x { //[mir]~ ERROR [E0503]
|
||||
| ^ use of borrowed `x`
|
||||
...
|
||||
LL | drop(r);
|
||||
| - borrow later used here
|
||||
|
||||
error[E0503]: cannot use `x` because it was mutably borrowed
|
||||
--> $DIR/borrowck-match-already-borrowed.rs:36:9
|
||||
|
|
||||
LL | let r = &mut x;
|
||||
| ------ borrow of `x` occurs here
|
||||
LL | let _ = match x { //[mir]~ ERROR [E0503]
|
||||
LL | let _ = match x {
|
||||
LL | x => x + 1, //[ast]~ ERROR [E0503]
|
||||
| ^ use of borrowed `x`
|
||||
...
|
||||
|
|
@ -68,6 +46,6 @@ LL | y => y + 2, //[ast]~ ERROR [E0503]
|
|||
LL | drop(r);
|
||||
| - borrow later used here
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0503`.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ enum Foo {
|
|||
fn match_enum() {
|
||||
let mut foo = Foo::B;
|
||||
let p = &mut foo;
|
||||
let _ = match foo { //[mir]~ ERROR [E0503]
|
||||
let _ = match foo {
|
||||
Foo::B => 1, //[mir]~ ERROR [E0503]
|
||||
_ => 2,
|
||||
Foo::A(x) => x //[ast]~ ERROR [E0503]
|
||||
|
|
@ -32,7 +32,7 @@ fn match_enum() {
|
|||
fn main() {
|
||||
let mut x = 1;
|
||||
let r = &mut x;
|
||||
let _ = match x { //[mir]~ ERROR [E0503]
|
||||
let _ = match x {
|
||||
x => x + 1, //[ast]~ ERROR [E0503]
|
||||
//[mir]~^ ERROR [E0503]
|
||||
y => y + 2, //[ast]~ ERROR [E0503]
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
warning: this constant cannot be used
|
||||
--> $DIR/conditional_array_execution.rs:15:1
|
||||
|
|
||||
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
||||
| ^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| attempt to subtract with overflow
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/conditional_array_execution.rs:11:9
|
||||
|
|
||||
LL | #![warn(const_err)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0080]: referenced constant has errors
|
||||
--> $DIR/conditional_array_execution.rs:19:14
|
||||
|
|
||||
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
||||
| ----- attempt to subtract with overflow
|
||||
...
|
||||
LL | println!("{}", FOO);
|
||||
| ^^^^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/conditional_array_execution.rs:19:14
|
||||
|
|
||||
LL | println!("{}", FOO);
|
||||
| ^^^^ --- referenced constant has errors
|
||||
|
||||
error[E0080]: referenced constant has errors
|
||||
--> $DIR/conditional_array_execution.rs:19:20
|
||||
|
|
||||
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
||||
| ----- attempt to subtract with overflow
|
||||
...
|
||||
LL | println!("{}", FOO);
|
||||
| ^^^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/conditional_array_execution.rs:19:20
|
||||
|
|
||||
LL | println!("{}", FOO);
|
||||
| ^^^ referenced constant has errors
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
warning: this constant cannot be used
|
||||
--> $DIR/issue-43197.rs:20:5
|
||||
|
|
||||
LL | const X: u32 = 0-1;
|
||||
| ^^^^^^^^^^^^^^^---^
|
||||
| |
|
||||
| attempt to subtract with overflow
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-43197.rs:11:9
|
||||
|
|
||||
LL | #![warn(const_err)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
warning: this constant cannot be used
|
||||
--> $DIR/issue-43197.rs:22:5
|
||||
|
|
||||
LL | const Y: u32 = foo(0-1);
|
||||
| ^^^^^^^^^^^^^^^^^^^---^^
|
||||
| |
|
||||
| attempt to subtract with overflow
|
||||
|
||||
error[E0080]: referenced constant has errors
|
||||
--> $DIR/issue-43197.rs:24:14
|
||||
|
|
||||
LL | const X: u32 = 0-1;
|
||||
| --- attempt to subtract with overflow
|
||||
...
|
||||
LL | println!("{} {}", X, Y);
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/issue-43197.rs:24:14
|
||||
|
|
||||
LL | println!("{} {}", X, Y);
|
||||
| ^^^^^^^ - referenced constant has errors
|
||||
|
||||
error[E0080]: referenced constant has errors
|
||||
--> $DIR/issue-43197.rs:24:26
|
||||
|
|
||||
LL | const Y: u32 = foo(0-1);
|
||||
| --- attempt to subtract with overflow
|
||||
LL | //~^ WARN this constant cannot be used
|
||||
LL | println!("{} {}", X, Y);
|
||||
| ^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/issue-43197.rs:24:26
|
||||
|
|
||||
LL | println!("{} {}", X, Y);
|
||||
| ^ referenced constant has errors
|
||||
|
||||
error[E0080]: referenced constant has errors
|
||||
--> $DIR/issue-43197.rs:24:23
|
||||
|
|
||||
LL | const X: u32 = 0-1;
|
||||
| --- attempt to subtract with overflow
|
||||
...
|
||||
LL | println!("{} {}", X, Y);
|
||||
| ^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/issue-43197.rs:24:23
|
||||
|
|
||||
LL | println!("{} {}", X, Y);
|
||||
| ^ referenced constant has errors
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
error[E0080]: referenced constant has errors
|
||||
--> $DIR/issue-44578.rs:35:14
|
||||
|
|
||||
LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize];
|
||||
| ------------------------------------ index out of bounds: the len is 1 but the index is 1
|
||||
...
|
||||
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
||||
| ^^^^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/issue-44578.rs:35:14
|
||||
|
|
||||
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
||||
| ^^^^ -------------------------- referenced constant has errors
|
||||
|
||||
error[E0080]: referenced constant has errors
|
||||
--> $DIR/issue-44578.rs:35:20
|
||||
|
|
||||
LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize];
|
||||
| ------------------------------------ index out of bounds: the len is 1 but the index is 1
|
||||
...
|
||||
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/issue-44578.rs:35:20
|
||||
|
|
||||
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
|
@ -24,7 +24,6 @@ fn main() {
|
|||
match b {
|
||||
&mut false => {},
|
||||
_ if { (|| { let bar = b; *bar = false; })();
|
||||
//~^ ERROR cannot move out of `b` because it is borrowed [E0505]
|
||||
false } => { },
|
||||
&mut true => { println!("You might think we should get here"); },
|
||||
//~^ ERROR use of moved value: `*b` [E0382]
|
||||
|
|
|
|||
|
|
@ -1,29 +1,14 @@
|
|||
error[E0505]: cannot move out of `b` because it is borrowed
|
||||
--> $DIR/issue-27282-move-match-input-into-guard.rs:26:17
|
||||
|
|
||||
LL | match b {
|
||||
| - borrow of `b` occurs here
|
||||
LL | &mut false => {},
|
||||
LL | _ if { (|| { let bar = b; *bar = false; })();
|
||||
| ^^ - move occurs due to use in closure
|
||||
| |
|
||||
| move out of `b` occurs here
|
||||
...
|
||||
LL | &mut true => { println!("You might think we should get here"); },
|
||||
| --------- borrow later used here
|
||||
|
||||
error[E0382]: use of moved value: `*b`
|
||||
--> $DIR/issue-27282-move-match-input-into-guard.rs:29:14
|
||||
--> $DIR/issue-27282-move-match-input-into-guard.rs:28:14
|
||||
|
|
||||
LL | _ if { (|| { let bar = b; *bar = false; })();
|
||||
| -- - variable moved due to use in closure
|
||||
| |
|
||||
| value moved into closure here
|
||||
...
|
||||
LL | false } => { },
|
||||
LL | &mut true => { println!("You might think we should get here"); },
|
||||
| ^^^^ value used here after move
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
Some errors occurred: E0382, E0505.
|
||||
For more information about an error, try `rustc --explain E0382`.
|
||||
For more information about this error, try `rustc --explain E0382`.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ fn main() {
|
|||
&mut Some(&_) if {
|
||||
// ForceFnOnce needed to exploit #27282
|
||||
(|| { *x = None; drop(force_fn_once); })();
|
||||
//~^ ERROR closure requires unique access to `x` but it is already borrowed [E0500]
|
||||
//~^ ERROR cannot mutably borrow `x` in match guard [E0510]
|
||||
false
|
||||
} => {}
|
||||
&mut Some(&a) if { // this binds to garbage if we've corrupted discriminant
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
error[E0500]: closure requires unique access to `x` but it is already borrowed
|
||||
error[E0510]: cannot mutably borrow `x` in match guard
|
||||
--> $DIR/issue-27282-mutate-before-diverging-arm-1.rs:33:14
|
||||
|
|
||||
LL | match x {
|
||||
| - borrow occurs here
|
||||
| - value is immutable in match guard
|
||||
...
|
||||
LL | (|| { *x = None; drop(force_fn_once); })();
|
||||
| ^^ - second borrow occurs due to use of `x` in closure
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| closure construction occurs here
|
||||
...
|
||||
LL | &mut Some(&a) if { // this binds to garbage if we've corrupted discriminant
|
||||
| ------------- borrow later used here
|
||||
| cannot mutably borrow
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0500`.
|
||||
For more information about this error, try `rustc --explain E0510`.
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ fn main() {
|
|||
if {
|
||||
// ForceFnOnce needed to exploit #27282
|
||||
(|| { *x = None; drop(force_fn_once); })();
|
||||
//~^ ERROR closure requires unique access to `x` but it is already borrowed [E0500]
|
||||
//~^ ERROR cannot mutably borrow `x` in match guard [E0510]
|
||||
false
|
||||
} => {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
error[E0500]: closure requires unique access to `x` but it is already borrowed
|
||||
error[E0510]: cannot mutably borrow `x` in match guard
|
||||
--> $DIR/issue-27282-mutate-before-diverging-arm-2.rs:38:18
|
||||
|
|
||||
LL | match x {
|
||||
| - borrow occurs here
|
||||
| - value is immutable in match guard
|
||||
...
|
||||
LL | (|| { *x = None; drop(force_fn_once); })();
|
||||
| ^^ - second borrow occurs due to use of `x` in closure
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| closure construction occurs here
|
||||
...
|
||||
LL | &mut Some(&2)
|
||||
| ------------- borrow later used here
|
||||
| cannot mutably borrow
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0500`.
|
||||
For more information about this error, try `rustc --explain E0510`.
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
let mut e = Xyz::A;
|
||||
let f = &mut e;
|
||||
let g = f;
|
||||
match e { //~ cannot use `e` because it was mutably borrowed [E0503]
|
||||
match e {
|
||||
Xyz::A => println!("a"),
|
||||
//~^ cannot use `e` because it was mutably borrowed [E0503]
|
||||
Xyz::B => println!("b"),
|
||||
|
|
|
|||
|
|
@ -1,15 +1,3 @@
|
|||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowed-match-issue-45045.rs:24:11
|
||||
|
|
||||
LL | let f = &mut e;
|
||||
| ------ borrow of `e` occurs here
|
||||
LL | let g = f;
|
||||
LL | match e { //~ cannot use `e` because it was mutably borrowed [E0503]
|
||||
| ^ use of borrowed `e`
|
||||
...
|
||||
LL | *g = Xyz::B;
|
||||
| ----------- borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowed-match-issue-45045.rs:25:9
|
||||
|
|
||||
|
|
@ -22,6 +10,6 @@ LL | Xyz::A => println!("a"),
|
|||
LL | *g = Xyz::B;
|
||||
| ----------- borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0503`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue