-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #55700 - pnkfelix:issue-55533-update-ui-tests-wrt-nll…
…, r=davidtwco Update ui tests with respect to NLL Fix #55533
- Loading branch information
Showing
43 changed files
with
532 additions
and
254 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
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
33 changes: 25 additions & 8 deletions
33
src/test/ui/borrowck/borrowck-closures-mut-of-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 |
---|---|---|
@@ -1,15 +1,32 @@ | ||
error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | ||
--> $DIR/borrowck-closures-mut-of-imm.rs:23:21 | ||
--> $DIR/borrowck-closures-mut-of-imm.rs:23:25 | ||
| | ||
LL | let c1 = || set(&mut *x); | ||
| ^^^^^^^ cannot borrow as mutable | ||
LL | let mut c1 = || set(&mut *x); | ||
| ^^^^^^^ cannot borrow as mutable | ||
|
||
error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | ||
--> $DIR/borrowck-closures-mut-of-imm.rs:25:21 | ||
--> $DIR/borrowck-closures-mut-of-imm.rs:25:25 | ||
| | ||
LL | let c2 = || set(&mut *x); | ||
| ^^^^^^^ cannot borrow as mutable | ||
LL | let mut c2 = || set(&mut *x); | ||
| ^^^^^^^ cannot borrow as mutable | ||
|
||
error: aborting due to 2 previous errors | ||
error[E0524]: two closures require unique access to `x` at the same time | ||
--> $DIR/borrowck-closures-mut-of-imm.rs:25:18 | ||
| | ||
LL | let mut c1 = || set(&mut *x); | ||
| -- - first borrow occurs due to use of `x` in closure | ||
| | | ||
| first closure is constructed here | ||
LL | //~^ ERROR cannot borrow | ||
LL | let mut c2 = || set(&mut *x); | ||
| ^^ - second borrow occurs due to use of `x` in closure | ||
| | | ||
| second closure is constructed here | ||
... | ||
LL | c2(); c1(); | ||
| -- first borrow later used here | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0596`. | ||
Some errors occurred: E0524, E0596. | ||
For more information about an error, try `rustc --explain E0524`. |
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
18 changes: 18 additions & 0 deletions
18
src/test/ui/borrowck/borrowck-closures-mut-of-mut.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,18 @@ | ||
error[E0524]: two closures require unique access to `x` at the same time | ||
--> $DIR/borrowck-closures-mut-of-mut.rs:14:18 | ||
| | ||
LL | let mut c1 = || set(&mut *x); | ||
| -- - first borrow occurs due to use of `x` in closure | ||
| | | ||
| first closure is constructed here | ||
LL | let mut c2 = || set(&mut *x); | ||
| ^^ - second borrow occurs due to use of `x` in closure | ||
| | | ||
| second closure is constructed here | ||
LL | //~^ ERROR two closures require unique access to `x` at the same time | ||
LL | c2(); c1(); | ||
| -- first borrow later used here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0524`. |
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,20 @@ | ||
// Tests that two closures cannot simultaneously both have mutable | ||
// access to the variable. Related to issue #6801. | ||
|
||
fn get(x: &isize) -> isize { | ||
*x | ||
} | ||
|
||
fn set(x: &mut isize) { | ||
*x = 4; | ||
} | ||
|
||
fn a(x: &mut isize) { | ||
let mut c1 = || set(&mut *x); | ||
let mut c2 = || set(&mut *x); | ||
//~^ ERROR two closures require unique access to `x` at the same time | ||
c2(); c1(); | ||
} | ||
|
||
fn main() { | ||
} |
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,18 @@ | ||
error[E0524]: two closures require unique access to `x` at the same time | ||
--> $DIR/borrowck-closures-mut-of-mut.rs:14:18 | ||
| | ||
LL | let mut c1 = || set(&mut *x); | ||
| -- - previous borrow occurs due to use of `x` in closure | ||
| | | ||
| first closure is constructed here | ||
LL | let mut c2 = || set(&mut *x); | ||
| ^^ - borrow occurs due to use of `x` in closure | ||
| | | ||
| second closure is constructed here | ||
... | ||
LL | } | ||
| - borrow from first closure ends here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0524`. |
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.