Skip to content

Commit

Permalink
Auto merge of #49861 - pnkfelix:compare-mode-nll-followup-2, r=nikoma…
Browse files Browse the repository at this point in the history
…tsakis

Blindly checkpoint status of NLL mode ui tests

This takes the next (and potentially final?) step with #48879.

Namely, this PR got things to the point where I can successfully run `compiletest` on `src/test/ui` with `--compile-mode=nll`.

Here are the main pieces of it:

 1. To figure out how to even run `compiletest` normally on the ui directory, I ran `x.py test -vv`, and then looked for the `compiletest` invocation that mentioned `src/test/ui`.
 2. I took the aforementioned `compiletest` invocation and used it, adding `--compile-mode=nll` to the end. It had 170 failing cases.
 3. Due to #49855, I had to edit some of the tests so that they fail even under NLL, via `#[rustc_error]`. That's the first commit. (Then goto 2 to double-check no such tests remain.)
 4. I took the generated `build/target/test/foo.stderr` file for every case that failed, and blindly copied it to `src/test/foo.nll.stderr`. That's the second commit.
 5. Goto 2 until there were no failing cases.
 6. Remove any stamp files, and re-run `x.py test` to make sure that the edits and new `.nll.stderr` files haven't broken the pre-existing test suite.
  • Loading branch information
bors committed Apr 11, 2018
2 parents ca26ef3 + 746d63a commit 3242880
Show file tree
Hide file tree
Showing 198 changed files with 3,626 additions and 56 deletions.
26 changes: 26 additions & 0 deletions src/test/ui/augmented-assignments.nll.stderr
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 src/test/ui/borrowck/borrowck-box-insensitivity.nll.stderr
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`.
78 changes: 78 additions & 0 deletions src/test/ui/borrowck/borrowck-closures-two-mut.nll.stderr
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 src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr
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 src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr
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`.
9 changes: 9 additions & 0 deletions src/test/ui/borrowck/borrowck-in-static.nll.stderr
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 src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr
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 src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr
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`.
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

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(rustc_attrs)]
#![allow(dead_code)]
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
// Original borrow ends at end of function
let mut x = 1;
let y = &mut x;
Expand Down
51 changes: 51 additions & 0 deletions src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr
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`.
30 changes: 30 additions & 0 deletions src/test/ui/borrowck/issue-45983.nll.stderr
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`.
14 changes: 14 additions & 0 deletions src/test/ui/borrowck/issue-7573.nll.stderr
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

21 changes: 21 additions & 0 deletions src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr
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`.
14 changes: 14 additions & 0 deletions src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr
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

Loading

0 comments on commit 3242880

Please sign in to comment.