-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checkpoint the current status of NLL on
ui
tests via compare-mode=nll.
- Loading branch information
Showing
170 changed files
with
3,543 additions
and
0 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,26 @@ | ||
error[E0505]: cannot move out of `x` because it is borrowed | ||
--> $DIR/augmented-assignments.rs:26:5 | ||
| | ||
LL | x //~ error: use of moved value: `x` | ||
| - | ||
| | | ||
| _____borrow of `x` occurs here | ||
| | | ||
LL | | //~^ value used here after move | ||
LL | | += | ||
LL | | x; //~ value moved here | ||
| | - | ||
| | | | ||
| |_____move out of `x` occurs here | ||
| borrow later used here | ||
|
||
error[E0596]: cannot borrow immutable item `y` as mutable | ||
--> $DIR/augmented-assignments.rs:30:5 | ||
| | ||
LL | y //~ error: cannot borrow immutable local variable `y` as mutable | ||
| ^ cannot borrow as mutable | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors occurred: E0505, E0596. | ||
For more information about an error, try `rustc --explain E0505`. |
25 changes: 25 additions & 0 deletions
25
src/test/ui/borrowck/borrowck-box-insensitivity.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,25 @@ | ||
error[E0382]: use of moved value: `a.y` | ||
--> $DIR/borrowck-box-insensitivity.rs:46:14 | ||
| | ||
LL | let _x = a.x; | ||
| --- value moved here | ||
LL | //~^ value moved here | ||
LL | let _y = a.y; //~ ERROR use of moved | ||
| ^^^ value used here after move | ||
| | ||
= note: move occurs because `a.y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait | ||
|
||
error[E0382]: use of moved value: `a.y` | ||
--> $DIR/borrowck-box-insensitivity.rs:108:14 | ||
| | ||
LL | let _x = a.x.x; | ||
| ----- value moved here | ||
LL | //~^ value moved here | ||
LL | let _y = a.y; //~ ERROR use of collaterally moved | ||
| ^^^ value used here after move | ||
| | ||
= note: move occurs because `a.y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0382`. |
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,78 @@ | ||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) | ||
--> $DIR/borrowck-closures-two-mut.rs:24:24 | ||
| | ||
LL | let c1 = to_fn_mut(|| x = 4); | ||
| -- - previous borrow occurs due to use of `x` in closure | ||
| | | ||
| first mutable borrow occurs here | ||
LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once | ||
| ^^ - borrow occurs due to use of `x` in closure | ||
| | | ||
| second mutable borrow occurs here | ||
LL | //~| ERROR cannot borrow `x` as mutable more than once | ||
LL | } | ||
| - first borrow ends here | ||
|
||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) | ||
--> $DIR/borrowck-closures-two-mut.rs:35:24 | ||
| | ||
LL | let c1 = to_fn_mut(|| set(&mut x)); | ||
| -- - previous borrow occurs due to use of `x` in closure | ||
| | | ||
| first mutable borrow occurs here | ||
LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once | ||
| ^^ - borrow occurs due to use of `x` in closure | ||
| | | ||
| second mutable borrow occurs here | ||
LL | //~| ERROR cannot borrow `x` as mutable more than once | ||
LL | } | ||
| - first borrow ends here | ||
|
||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) | ||
--> $DIR/borrowck-closures-two-mut.rs:42:24 | ||
| | ||
LL | let c1 = to_fn_mut(|| x = 5); | ||
| -- - previous borrow occurs due to use of `x` in closure | ||
| | | ||
| first mutable borrow occurs here | ||
LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once | ||
| ^^ - borrow occurs due to use of `x` in closure | ||
| | | ||
| second mutable borrow occurs here | ||
LL | //~| ERROR cannot borrow `x` as mutable more than once | ||
LL | } | ||
| - first borrow ends here | ||
|
||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) | ||
--> $DIR/borrowck-closures-two-mut.rs:49:24 | ||
| | ||
LL | let c1 = to_fn_mut(|| x = 5); | ||
| -- - previous borrow occurs due to use of `x` in closure | ||
| | | ||
| first mutable borrow occurs here | ||
LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) | ||
| ^^ - borrow occurs due to use of `x` in closure | ||
| | | ||
| second mutable borrow occurs here | ||
... | ||
LL | } | ||
| - first borrow ends here | ||
|
||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) | ||
--> $DIR/borrowck-closures-two-mut.rs:61:24 | ||
| | ||
LL | let c1 = to_fn_mut(|| set(&mut *x.f)); | ||
| -- - previous borrow occurs due to use of `x` in closure | ||
| | | ||
| first mutable borrow occurs here | ||
LL | let c2 = to_fn_mut(|| set(&mut *x.f)); | ||
| ^^ - borrow occurs due to use of `x` in closure | ||
| | | ||
| second mutable borrow occurs here | ||
... | ||
LL | } | ||
| - first borrow ends here | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0499`. |
14 changes: 14 additions & 0 deletions
14
src/test/ui/borrowck/borrowck-escaping-closure-error-1.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,14 @@ | ||
error[E0597]: `books` does not live long enough | ||
--> $DIR/borrowck-escaping-closure-error-1.rs:23:11 | ||
| | ||
LL | spawn(|| books.push(4)); | ||
| ^^^^^^^^^^^^^^^^ borrowed value does not live long enough | ||
LL | //~^ ERROR E0373 | ||
LL | } | ||
| - borrowed value only lives until here | ||
| | ||
= note: borrowed value must be valid for the static lifetime... | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0597`. |
18 changes: 18 additions & 0 deletions
18
src/test/ui/borrowck/borrowck-escaping-closure-error-2.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[E0597]: `books` does not live long enough | ||
--> $DIR/borrowck-escaping-closure-error-2.rs:21:14 | ||
| | ||
LL | Box::new(|| books.push(4)) | ||
| ^^^^^^^^^^^^^^^^ borrowed value does not live long enough | ||
LL | //~^ ERROR E0373 | ||
LL | } | ||
| - borrowed value only lives until here | ||
| | ||
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 19:1... | ||
--> $DIR/borrowck-escaping-closure-error-2.rs:19:1 | ||
| | ||
LL | fn foo<'a>(x: &'a i32) -> Box<FnMut()+'a> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0597`. |
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,9 @@ | ||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-in-static.rs:15:17 | ||
| | ||
LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable | ||
| ^ cannot move out of borrowed content | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0507`. |
40 changes: 40 additions & 0 deletions
40
src/test/ui/borrowck/borrowck-move-error-with-note.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,40 @@ | ||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-move-error-with-note.rs:23:19 | ||
| | ||
LL | Foo::Foo1(num1, | ||
| ^^^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-move-error-with-note.rs:24:19 | ||
| | ||
LL | num2) => (), | ||
| ^^^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-move-error-with-note.rs:25:19 | ||
| | ||
LL | Foo::Foo2(num) => (), | ||
| ^^^ cannot move out of borrowed content | ||
|
||
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait | ||
--> $DIR/borrowck-move-error-with-note.rs:42:16 | ||
| | ||
LL | f: _s, | ||
| ^^ cannot move out of here | ||
|
||
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait | ||
--> $DIR/borrowck-move-error-with-note.rs:43:16 | ||
| | ||
LL | g: _t | ||
| ^^ cannot move out of here | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-move-error-with-note.rs:59:9 | ||
| | ||
LL | n => { | ||
| ^ cannot move out of borrowed content | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
Some errors occurred: E0507, E0509. | ||
For more information about an error, try `rustc --explain E0507`. |
15 changes: 15 additions & 0 deletions
15
src/test/ui/borrowck/borrowck-move-out-of-vec-tail.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,15 @@ | ||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-move-out-of-vec-tail.rs:30:33 | ||
| | ||
LL | &[Foo { string: a }, | ||
| ^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-move-out-of-vec-tail.rs:34:33 | ||
| | ||
LL | Foo { string: b }] => { | ||
| ^ cannot move out of borrowed content | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0507`. |
14 changes: 14 additions & 0 deletions
14
src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.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,14 @@ | ||
error: compilation successful | ||
--> $DIR/borrowck-report-with-custom-diagnostic.rs:12:1 | ||
| | ||
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855 | ||
LL | | // Original borrow ends at end of function | ||
LL | | let mut x = 1; | ||
LL | | let y = &mut x; | ||
... | | ||
LL | | //~^ immutable borrow occurs here | ||
LL | | } | ||
| |_^ | ||
|
||
error: aborting due to previous error | ||
|
51 changes: 51 additions & 0 deletions
51
src/test/ui/borrowck/borrowck-vec-pattern-nesting.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,51 @@ | ||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-vec-pattern-nesting.rs:42:15 | ||
| | ||
LL | &mut [_a, //~ ERROR cannot move out | ||
| ^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-vec-pattern-nesting.rs:55:13 | ||
| | ||
LL | let a = vec[0]; //~ ERROR cannot move out | ||
| ^^^^^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-vec-pattern-nesting.rs:65:10 | ||
| | ||
LL | _b] => {} | ||
| ^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-vec-pattern-nesting.rs:68:13 | ||
| | ||
LL | let a = vec[0]; //~ ERROR cannot move out | ||
| ^^^^^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-vec-pattern-nesting.rs:76:15 | ||
| | ||
LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | ||
| ^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-vec-pattern-nesting.rs:76:19 | ||
| | ||
LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | ||
| ^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-vec-pattern-nesting.rs:76:23 | ||
| | ||
LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | ||
| ^^ cannot move out of borrowed content | ||
|
||
error[E0507]: cannot move out of borrowed content | ||
--> $DIR/borrowck-vec-pattern-nesting.rs:80:13 | ||
| | ||
LL | let a = vec[0]; //~ ERROR cannot move out | ||
| ^^^^^^ cannot move out of borrowed content | ||
|
||
error: aborting due to 8 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0507`. |
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,30 @@ | ||
warning: not reporting region error due to -Znll | ||
--> $DIR/issue-45983.rs:17:27 | ||
| | ||
LL | give_any(|y| x = Some(y)); | ||
| ^ | ||
|
||
error: free region `` does not outlive free region `'_#2r` | ||
--> $DIR/issue-45983.rs:17:27 | ||
| | ||
LL | give_any(|y| x = Some(y)); | ||
| ^ | ||
|
||
error[E0594]: cannot assign to immutable item `x` | ||
--> $DIR/issue-45983.rs:17:18 | ||
| | ||
LL | give_any(|y| x = Some(y)); | ||
| ^^^^^^^^^^^ cannot mutate | ||
| | ||
= note: Value not mutable causing this error: `x` | ||
|
||
error[E0596]: cannot borrow immutable item `x` as mutable | ||
--> $DIR/issue-45983.rs:17:14 | ||
| | ||
LL | give_any(|y| x = Some(y)); | ||
| ^^^^^^^^^^^^^^^ cannot borrow as mutable | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors occurred: E0594, E0596. | ||
For more information about an error, try `rustc --explain E0594`. |
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,14 @@ | ||
warning: not reporting region error due to -Znll | ||
--> $DIR/issue-7573.rs:27:31 | ||
| | ||
LL | let mut lines_to_use: Vec<&CrateId> = Vec::new(); | ||
| ^ | ||
|
||
error: free region `` does not outlive free region `'_#2r` | ||
--> $DIR/issue-7573.rs:32:9 | ||
| | ||
LL | lines_to_use.push(installed_id); | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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,21 @@ | ||
error[E0499]: cannot borrow `*arg` as mutable more than once at a time | ||
--> $DIR/mut-borrow-in-loop.rs:20:25 | ||
| | ||
LL | (self.func)(arg) //~ ERROR cannot borrow | ||
| ^^^ mutable borrow starts here in previous iteration of loop | ||
|
||
error[E0499]: cannot borrow `*arg` as mutable more than once at a time | ||
--> $DIR/mut-borrow-in-loop.rs:26:25 | ||
| | ||
LL | (self.func)(arg) //~ ERROR cannot borrow | ||
| ^^^ mutable borrow starts here in previous iteration of loop | ||
|
||
error[E0499]: cannot borrow `*arg` as mutable more than once at a time | ||
--> $DIR/mut-borrow-in-loop.rs:33:25 | ||
| | ||
LL | (self.func)(arg) //~ ERROR cannot borrow | ||
| ^^^ mutable borrow starts here in previous iteration of loop | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: compilation successful | ||
--> $DIR/mut-borrow-outside-loop.rs:13:1 | ||
| | ||
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855 | ||
LL | | let mut void = (); | ||
LL | | | ||
LL | | let first = &mut void; | ||
... | | ||
LL | | } | ||
LL | | } | ||
| |_^ | ||
|
||
error: aborting due to previous error | ||
|
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,14 @@ | ||
warning: not reporting region error due to -Znll | ||
--> $DIR/regions-escape-bound-fn-2.rs:18:27 | ||
| | ||
LL | with_int(|y| x = Some(y)); | ||
| ^ | ||
|
||
error: free region `` does not outlive free region `'_#2r` | ||
--> $DIR/regions-escape-bound-fn-2.rs:18:27 | ||
| | ||
LL | with_int(|y| x = Some(y)); | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|
Oops, something went wrong.