1
Fork 0

Test fixes for the change of error message for issue #54015

This commit is contained in:
Rusty Blitzerr 2018-09-28 09:21:10 -07:00
parent d5ae6f7870
commit 44b3674d8e
15 changed files with 22 additions and 22 deletions

View file

@ -5,7 +5,7 @@ LL | for &x in &vector {
| ------- | -------
| | | |
| immutable borrow occurs here | immutable borrow occurs here
| borrow used here in later iteration of loop | borrow used here, in later iteration of loop
LL | let cap = vector.capacity(); LL | let cap = vector.capacity();
LL | vector.extend(repeat(0)); //~ ERROR cannot borrow LL | vector.extend(repeat(0)); //~ ERROR cannot borrow
| ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
@ -17,7 +17,7 @@ LL | for &x in &vector {
| ------- | -------
| | | |
| immutable borrow occurs here | immutable borrow occurs here
| borrow used here in later iteration of loop | borrow used here, in later iteration of loop
... ...
LL | vector[1] = 5; //~ ERROR cannot borrow LL | vector[1] = 5; //~ ERROR cannot borrow
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here

View file

@ -8,13 +8,13 @@ LL | borrow(&*v); //~ ERROR cannot borrow
| ^^^ immutable borrow occurs here | ^^^ immutable borrow occurs here
LL | } LL | }
LL | *x = box 5; LL | *x = box 5;
| -- borrow used here in later iteration of loop | -- borrow used here, in later iteration of loop
error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-lend-flow-loop.rs:109:16 --> $DIR/borrowck-lend-flow-loop.rs:109:16
| |
LL | **x += 1; LL | **x += 1;
| -------- borrow used here in later iteration of loop | -------- borrow used here, in later iteration of loop
LL | borrow(&*v); //~ ERROR cannot borrow LL | borrow(&*v); //~ ERROR cannot borrow
| ^^^ immutable borrow occurs here | ^^^ immutable borrow occurs here
LL | if cond2 { LL | if cond2 {

View file

@ -4,7 +4,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
| ---- ^^^^^^ second mutable borrow occurs here | ---- ^^^^^^ second mutable borrow occurs here
| | | |
| borrow used here in later iteration of loop | borrow used here, in later iteration of loop
... ...
LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499] LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
| ------ first mutable borrow occurs here | ------ first mutable borrow occurs here
@ -13,7 +13,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30 --> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30
| |
LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
| ---- borrow used here in later iteration of loop | ---- borrow used here, in later iteration of loop
LL | //[mir]~^ ERROR [E0499] LL | //[mir]~^ ERROR [E0499]
LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
| ^^^^^^ second mutable borrow occurs here | ^^^^^^ second mutable borrow occurs here

View file

@ -4,7 +4,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
| ---- ^^^^^^ second mutable borrow occurs here | ---- ^^^^^^ second mutable borrow occurs here
| | | |
| borrow used here in later iteration of loop | borrow used here, in later iteration of loop
... ...
LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499] LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
| ------ first mutable borrow occurs here | ------ first mutable borrow occurs here
@ -13,7 +13,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30 --> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30
| |
LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
| ---- borrow used here in later iteration of loop | ---- borrow used here, in later iteration of loop
LL | //[mir]~^ ERROR [E0499] LL | //[mir]~^ ERROR [E0499]
LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
| ^^^^^^ second mutable borrow occurs here | ^^^^^^ second mutable borrow occurs here

View file

@ -20,7 +20,7 @@ error[E0382]: use of moved value (Mir)
--> $DIR/issue-41962.rs:17:21 --> $DIR/issue-41962.rs:17:21
| |
LL | if let Some(thing) = maybe { LL | if let Some(thing) = maybe {
| ^^^^^ value moved here in previous iteration of loop | ^^^^^ value moved here, in previous iteration of loop
| |
= note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait

View file

@ -17,7 +17,7 @@ LL | let inner_second = &mut inner_void; //~ ERROR cannot borrow
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here | ^^^^^^^^^^^^^^^ second mutable borrow occurs here
LL | inner_second.use_mut(); LL | inner_second.use_mut();
LL | inner_first.use_mut(); LL | inner_first.use_mut();
| ----------- borrow used here in later iteration of loop | ----------- borrow used here, in later iteration of loop
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error[E0382]: use of moved value: `tx`
--> $DIR/issue-12041.rs:18:22 --> $DIR/issue-12041.rs:18:22
| |
LL | let tx = tx; LL | let tx = tx;
| ^^ value moved here in previous iteration of loop | ^^ value moved here, in previous iteration of loop
| |
= note: move occurs because `tx` has type `std::sync::mpsc::Sender<i32>`, which does not implement the `Copy` trait = note: move occurs because `tx` has type `std::sync::mpsc::Sender<i32>`, which does not implement the `Copy` trait

View file

@ -5,7 +5,7 @@ LL | let v: Vec<&str> = line.split_whitespace().collect();
| ^^^^ borrowed value does not live long enough | ^^^^ borrowed value does not live long enough
LL | //~^ ERROR `line` does not live long enough LL | //~^ ERROR `line` does not live long enough
LL | println!("accumulator before add_assign {:?}", acc.map); LL | println!("accumulator before add_assign {:?}", acc.map);
| ------- borrow used here in later iteration of loop | ------- borrow used here, in later iteration of loop
... ...
LL | } LL | }
| - `line` dropped here while still borrowed | - `line` dropped here while still borrowed

View file

@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `y`
LL | println!("{}", y); //~ ERROR use of moved value: `y` LL | println!("{}", y); //~ ERROR use of moved value: `y`
| ^ value borrowed here after move | ^ value borrowed here after move
LL | while true { while true { while true { x = y; x.clone(); } } } LL | while true { while true { while true { x = y; x.clone(); } } }
| - value moved here | - value moved here, in previous iteration of loop
| |
= note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait

View file

@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x`
LL | || x; //~ ERROR LL | || x; //~ ERROR
| ^^ - use occurs due to use in closure | ^^ - use occurs due to use in closure
| | | |
| value moved into closure here in previous iteration of loop | value moved into closure here, in previous iteration of loop
| |
= note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait

View file

@ -2,7 +2,7 @@ error[E0382]: use of moved value
--> $DIR/issue-53807.rs:14:21 --> $DIR/issue-53807.rs:14:21
| |
LL | if let Some(thing) = maybe { LL | if let Some(thing) = maybe {
| ^^^^^ value moved here in previous iteration of loop | ^^^^^ value moved here, in previous iteration of loop
| |
= note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait = note: move occurs because value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait

View file

@ -7,7 +7,7 @@ LL | foo.mutate();
| ^^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^^^ mutable borrow occurs here
LL | //~^ ERROR cannot borrow `foo` as mutable LL | //~^ ERROR cannot borrow `foo` as mutable
LL | println!("foo={:?}", *string); LL | println!("foo={:?}", *string);
| ------- borrow used here in later iteration of loop | ------- borrow used here, in later iteration of loop
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0597]: `x` does not live long enough
--> $DIR/regions-escape-loop-via-variable.rs:21:13 --> $DIR/regions-escape-loop-via-variable.rs:21:13
| |
LL | let x = 1 + *p; LL | let x = 1 + *p;
| -- borrow used here in later iteration of loop | -- borrow used here, in later iteration of loop
LL | p = &x; LL | p = &x;
| ^^ borrowed value does not live long enough | ^^ borrowed value does not live long enough
LL | } LL | }

View file

@ -7,7 +7,7 @@ LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
| ^ use of borrowed `x` | ^ use of borrowed `x`
LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
LL | _y.push(&mut z); LL | _y.push(&mut z);
| -- borrow used here in later iteration of loop | -- borrow used here, in later iteration of loop
error[E0503]: cannot use `x` because it was mutably borrowed error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/regions-escape-loop-via-vec.rs:16:21 --> $DIR/regions-escape-loop-via-vec.rs:16:21
@ -18,7 +18,7 @@ LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
| ^ use of borrowed `x` | ^ use of borrowed `x`
LL | _y.push(&mut z); LL | _y.push(&mut z);
| -- borrow used here in later iteration of loop | -- borrow used here, in later iteration of loop
error[E0597]: `z` does not live long enough error[E0597]: `z` does not live long enough
--> $DIR/regions-escape-loop-via-vec.rs:17:17 --> $DIR/regions-escape-loop-via-vec.rs:17:17
@ -26,7 +26,7 @@ error[E0597]: `z` does not live long enough
LL | _y.push(&mut z); LL | _y.push(&mut z);
| -- ^^^^^^ borrowed value does not live long enough | -- ^^^^^^ borrowed value does not live long enough
| | | |
| borrow used here in later iteration of loop | borrow used here, in later iteration of loop
... ...
LL | } LL | }
| - `z` dropped here while still borrowed | - `z` dropped here while still borrowed
@ -38,7 +38,7 @@ LL | let mut _y = vec![&mut x];
| ------ borrow of `x` occurs here | ------ borrow of `x` occurs here
... ...
LL | _y.push(&mut z); LL | _y.push(&mut z);
| -- borrow used here in later iteration of loop | -- borrow used here, in later iteration of loop
LL | //~^ ERROR `z` does not live long enough LL | //~^ ERROR `z` does not live long enough
LL | x += 1; //~ ERROR cannot assign LL | x += 1; //~ ERROR cannot assign
| ^^^^^^ use of borrowed `x` | ^^^^^^ use of borrowed `x`

View file

@ -5,7 +5,7 @@ LL | for x in &mut xs {
| ------- | -------
| | | |
| first mutable borrow occurs here | first mutable borrow occurs here
| borrow used here in later iteration of loop | borrow used here, in later iteration of loop
LL | xs.push(1) //~ ERROR cannot borrow `xs` LL | xs.push(1) //~ ERROR cannot borrow `xs`
| ^^ second mutable borrow occurs here | ^^ second mutable borrow occurs here