forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated the most glaring instances of weak tests w.r.t. NLL that came…
… from rust-lang#53196. See also the bulletpoint list on rust-lang#53351.
- Loading branch information
Showing
45 changed files
with
626 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
error[E0505]: cannot move out of `x` because it is borrowed | ||
--> $DIR/borrow-tuple-fields.rs:22:13 | ||
| | ||
LL | let r = &x.0; | ||
| ---- borrow of `x.0` occurs here | ||
LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed | ||
| ^ move out of `x` occurs here | ||
LL | | ||
LL | r.use_ref(); | ||
| - borrow later used here | ||
|
||
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable | ||
--> $DIR/borrow-tuple-fields.rs:28:13 | ||
| | ||
LL | let a = &x.0; | ||
| ---- immutable borrow occurs here | ||
LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as | ||
| ^^^^^^^^ mutable borrow occurs here | ||
LL | a.use_ref(); | ||
| - borrow later used here | ||
|
||
error[E0499]: cannot borrow `x.0` as mutable more than once at a time | ||
--> $DIR/borrow-tuple-fields.rs:33:13 | ||
| | ||
LL | let a = &mut x.0; | ||
| -------- first mutable borrow occurs here | ||
LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time | ||
| ^^^^^^^^ second mutable borrow occurs here | ||
LL | a.use_ref(); | ||
| - borrow later used here | ||
|
||
error[E0505]: cannot move out of `x` because it is borrowed | ||
--> $DIR/borrow-tuple-fields.rs:38:13 | ||
| | ||
LL | let r = &x.0; | ||
| ---- borrow of `x.0` occurs here | ||
LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed | ||
| ^ move out of `x` occurs here | ||
LL | r.use_ref(); | ||
| - borrow later used here | ||
|
||
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable | ||
--> $DIR/borrow-tuple-fields.rs:43:13 | ||
| | ||
LL | let a = &x.0; | ||
| ---- immutable borrow occurs here | ||
LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as | ||
| ^^^^^^^^ mutable borrow occurs here | ||
LL | a.use_ref(); | ||
| - borrow later used here | ||
|
||
error[E0499]: cannot borrow `x.0` as mutable more than once at a time | ||
--> $DIR/borrow-tuple-fields.rs:48:13 | ||
| | ||
LL | let a = &mut x.0; | ||
| -------- first mutable borrow occurs here | ||
LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time | ||
| ^^^^^^^^ second mutable borrow occurs here | ||
LL | a.use_mut(); | ||
| - borrow later used here | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
Some errors occurred: E0499, E0502, E0505. | ||
For more information about an error, try `rustc --explain E0499`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error[E0499]: cannot borrow `*x` as mutable more than once at a time | ||
--> $DIR/borrowck-borrow-mut-object-twice.rs:23:5 | ||
| | ||
LL | let y = x.f1(); | ||
| - first mutable borrow occurs here | ||
LL | x.f2(); //~ ERROR cannot borrow `*x` as mutable | ||
| ^ second mutable borrow occurs here | ||
LL | y.use_ref(); | ||
| - borrow later used here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0499`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable | ||
--> $DIR/borrowck-closures-unique-imm.rs:23:9 | ||
| | ||
LL | let p = &this.x; | ||
| ------- immutable borrow occurs here | ||
LL | &mut this.x; //~ ERROR cannot borrow | ||
| ^^^^^^^^^^^ mutable borrow occurs here | ||
LL | p.use_ref(); | ||
| - borrow later used here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0502`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error[E0505]: cannot move out of `x` because it is borrowed | ||
--> $DIR/borrowck-issue-2657-1.rs:19:18 | ||
| | ||
LL | Some(ref _y) => { | ||
| ------ borrow of `x.0` occurs here | ||
LL | let _a = x; //~ ERROR cannot move | ||
| ^ move out of `x` occurs here | ||
LL | _y.use_ref(); | ||
| -- borrow later used here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0505`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
error[E0505]: cannot move out of `v` because it is borrowed | ||
--> $DIR/borrowck-loan-blocks-move-cc.rs:24:19 | ||
| | ||
LL | let w = &v; | ||
| -- borrow of `v` occurs here | ||
LL | thread::spawn(move|| { | ||
| ^^^^^^ move out of `v` occurs here | ||
LL | println!("v={}", *v); | ||
| - move occurs due to use in closure | ||
... | ||
LL | w.use_ref(); | ||
| - borrow later used here | ||
|
||
error[E0505]: cannot move out of `v` because it is borrowed | ||
--> $DIR/borrowck-loan-blocks-move-cc.rs:34:19 | ||
| | ||
LL | let w = &v; | ||
| -- borrow of `v` occurs here | ||
LL | thread::spawn(move|| { | ||
| ^^^^^^ move out of `v` occurs here | ||
LL | println!("v={}", *v); | ||
| - move occurs due to use in closure | ||
... | ||
LL | w.use_ref(); | ||
| - borrow later used here | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0505`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.