Auto merge of #55134 - davidtwco:issue-55118, r=pnkfelix
NLL: change compare-mode=nll to use borrowck=migrate Fixes #55118. This PR is split into two parts: The first commit is a minor change that fixes a flaw in the existing `borrowck=migrate` implementation whereby a lint that was promoted to an error in the AST borrow checker would result in the same lint from the NLL borrow checker being downgraded to a warning in migrate mode. This PR fixes this by ensuring lints are exempt from buffering in the NLL borrow checker. The second commit updates `compiletest` to make the NLL compare mode use `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The third commit shows all the test output changes that result from this. r? @pnkfelix
This commit is contained in:
commit
f7eb7fbbf6
206 changed files with 928 additions and 2966 deletions
|
|
@ -1,11 +0,0 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/issue-10291.rs:13:9
|
||||
|
|
||||
LL | fn test<'x>(x: &'x isize) {
|
||||
| -- lifetime `'x` defined here
|
||||
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
||||
LL | x //~ ERROR E0312
|
||||
| ^ returning this value requires that `'x` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -40,6 +40,43 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
|
|||
LL | (&[hd1, ..], &[hd2, ..])
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-12567.rs:16:17
|
||||
|
|
||||
LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
|
||||
| ^^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
For more information about this error, try `rustc --explain E0508`.
|
||||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-12567.rs:16:31
|
||||
|
|
||||
LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
|
||||
| ^^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-12567.rs:20:12
|
||||
|
|
||||
LL | (&[hd1, ..], &[hd2, ..])
|
||||
| ^^^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-12567.rs:20:24
|
||||
|
|
||||
LL | (&[hd1, ..], &[hd2, ..])
|
||||
| ^^^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors occurred: E0507, E0508.
|
||||
For more information about an error, try `rustc --explain E0507`.
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
error[E0621]: explicit lifetime required in the type of `cont`
|
||||
--> $DIR/issue-13058.rs:24:21
|
||||
|
|
||||
LL | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
|
||||
| -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T`
|
||||
LL | {
|
||||
LL | let cont_iter = cont.iter();
|
||||
| ^^^^^^^^^^^ lifetime `'r` required
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
error[E0621]: explicit lifetime required in the type of `lexer`
|
||||
--> $DIR/issue-15034.rs:27:9
|
||||
|
|
||||
LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
|
||||
| ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`
|
||||
LL | Parser { lexer: lexer }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
error: borrowed data escapes outside of function
|
||||
--> $DIR/issue-16683.rs:14:9
|
||||
|
|
||||
LL | fn b(&self) {
|
||||
| ----- `self` is a reference that is only valid in the function body
|
||||
LL | self.a(); //~ ERROR cannot infer
|
||||
| ^^^^^^^^ `self` escapes the function body here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -7,6 +7,15 @@ LL | let _a = FOO; //~ ERROR: cannot move out of static item
|
|||
| cannot move out of static item
|
||||
| help: consider borrowing here: `&FOO`
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0507]: cannot move out of immutable static item `FOO`
|
||||
--> $DIR/issue-17718-static-move.rs:16:14
|
||||
|
|
||||
LL | let _a = FOO; //~ ERROR: cannot move out of static item
|
||||
| ^^^
|
||||
| |
|
||||
| cannot move out of immutable static item `FOO`
|
||||
| cannot move
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
error[E0308]: match arms have incompatible types
|
||||
--> $DIR/issue-17728.rs:110:5
|
||||
|
|
||||
LL | / match to_parse { //~ ERROR match arms have incompatible types
|
||||
LL | | "w" | "west" => RoomDirection::West,
|
||||
LL | | "e" | "east" => RoomDirection::East,
|
||||
LL | | "n" | "north" => RoomDirection::North,
|
||||
... |
|
||||
LL | | _ => None
|
||||
| | ---- match arm with an incompatible type
|
||||
LL | | }
|
||||
| |_____^ expected enum `RoomDirection`, found enum `std::option::Option`
|
||||
|
|
||||
= note: expected type `RoomDirection`
|
||||
found type `std::option::Option<_>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
error: borrowed data escapes outside of function
|
||||
--> $DIR/issue-17758.rs:17:9
|
||||
|
|
||||
LL | fn bar(&self) {
|
||||
| ----- `self` is a reference that is only valid in the function body
|
||||
LL | self.foo();
|
||||
| ^^^^^^^^^^ `self` escapes the function body here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -16,6 +16,15 @@ LL | let b = unsafe { *imm_ref() };
|
|||
| cannot move out of borrowed content
|
||||
| help: consider removing the `*`: `imm_ref()`
|
||||
|
||||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-20801.rs:39:22
|
||||
|
|
||||
LL | let b = unsafe { *imm_ref() };
|
||||
| ^^^^^^^^^^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
error[E0507]: cannot move out of dereference of raw pointer
|
||||
--> $DIR/issue-20801.rs:42:22
|
||||
|
|
||||
|
|
@ -34,6 +43,15 @@ LL | let d = unsafe { *const_ptr() };
|
|||
| cannot move out of dereference of raw pointer
|
||||
| help: consider removing the `*`: `const_ptr()`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0507]: cannot move out of data in a `*const` pointer
|
||||
--> $DIR/issue-20801.rs:45:22
|
||||
|
|
||||
LL | let d = unsafe { *const_ptr() };
|
||||
| ^^^^^^^^^^^^
|
||||
| |
|
||||
| cannot move out of data in a `*const` pointer
|
||||
| cannot move
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
||||
|
|
|
|||
|
|
@ -4,6 +4,17 @@ error[E0507]: cannot move out of borrowed content
|
|||
LL | self.tokens //~ ERROR cannot move out of borrowed content
|
||||
| ^^^^^^^^^^^ cannot move out of borrowed content
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0507]: cannot move out of `self.tokens` which is behind a `&` reference
|
||||
--> $DIR/issue-2590.rs:22:9
|
||||
|
|
||||
LL | fn parse(&self) -> Vec<isize> {
|
||||
| ----- help: consider changing this to be a mutable reference: `&mut self`
|
||||
LL | self.tokens //~ ERROR cannot move out of borrowed content
|
||||
| ^^^^^^^^^^^
|
||||
| |
|
||||
| cannot move out of `self.tokens` which is behind a `&` reference
|
||||
| `self` is a `&` reference, so the data it refers to cannot be moved
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
error[E0131]: `main` function is not allowed to have generic parameters
|
||||
--> $DIR/issue-26217.rs:13:8
|
||||
|
|
||||
LL | fn main<'a>() {
|
||||
| ^^^^ `main` cannot have generic parameters
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0131`.
|
||||
|
|
@ -16,7 +16,16 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice
|
|||
LL | &X(*Y)
|
||||
| ^^ cannot move out of here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-30355.rs:15:8
|
||||
|
|
||||
LL | &X(*Y)
|
||||
| ^^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
Some errors occurred: E0161, E0508.
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors occurred: E0161, E0507, E0508.
|
||||
For more information about an error, try `rustc --explain E0161`.
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
error[E0621]: explicit lifetime required in the type of `y`
|
||||
--> $DIR/issue-40288-2.rs:17:9
|
||||
|
|
||||
LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
|
||||
| -- help: add explicit lifetime `'a` to the type of `y`: `&'a T`
|
||||
...
|
||||
LL | slice[0] = y;
|
||||
| ^^^^^^^^^^^^ lifetime `'a` required
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `y`
|
||||
--> $DIR/issue-40288-2.rs:32:9
|
||||
|
|
||||
LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
|
||||
| -- help: add explicit lifetime `'a` to the type of `y`: `&'a T`
|
||||
...
|
||||
LL | dst.head = y;
|
||||
| ^^^^^^^^^^^^ lifetime `'a` required
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
|
|
@ -7,6 +7,15 @@ LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content
|
|||
| cannot move out of borrowed content
|
||||
| help: consider borrowing here: `&f.v[0]`
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-40402-1.rs:19:13
|
||||
|
|
||||
LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content
|
||||
| ^^^^^^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-40402-2.rs:15:10
|
||||
|
|
||||
LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
|
||||
| ^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
error[E0507]: cannot move out of data in a `&` reference
|
||||
--> $DIR/issue-40402-2.rs:15:13
|
||||
|
|
||||
LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
|
||||
| ^
|
||||
| |
|
||||
| cannot move out of data in a `&` reference
|
||||
| cannot move
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/issue-40402-2.rs:15:18
|
||||
|
|
||||
|
|
@ -15,6 +33,6 @@ note: move occurs because these variables have types that don't implement the `C
|
|||
LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
|
||||
| ^ ^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: captured variable cannot escape `FnMut` closure body
|
||||
warning: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-1.rs:18:9
|
||||
|
|
||||
LL | || {
|
||||
|
|
@ -8,6 +8,15 @@ LL | &mut x
|
|||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
|
||||
It represents potential unsoundness in your code.
|
||||
This warning will become a hard error in the future.
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/issue-40510-1.rs:23:1
|
||||
|
|
||||
LL | fn main() {} //~ ERROR compilation successful
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: captured variable cannot escape `FnMut` closure body
|
||||
warning: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-3.rs:18:9
|
||||
|
|
||||
LL | || {
|
||||
|
|
@ -10,6 +10,15 @@ LL | | }
|
|||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
|
||||
It represents potential unsoundness in your code.
|
||||
This warning will become a hard error in the future.
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/issue-40510-3.rs:25:1
|
||||
|
|
||||
LL | fn main() {} //~ ERROR compilation successful
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,15 @@ LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
|
|||
LL | id(Box::new(|| *v))
|
||||
| ^^ cannot move out of captured variable in an `FnMut` closure
|
||||
|
||||
error[E0507]: cannot move out of `*v` which is behind a `&` reference
|
||||
--> $DIR/issue-4335.rs:16:20
|
||||
|
|
||||
LL | id(Box::new(|| *v))
|
||||
| ^^
|
||||
| |
|
||||
| cannot move out of `*v` which is behind a `&` reference
|
||||
| cannot move
|
||||
|
||||
error[E0597]: `v` does not live long enough
|
||||
--> $DIR/issue-4335.rs:16:21
|
||||
|
|
||||
|
|
@ -23,7 +32,7 @@ note: borrowed value must be valid for the lifetime 'r as defined on the functio
|
|||
LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
|
||||
| ^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors occurred: E0507, E0597.
|
||||
For more information about an error, try `rustc --explain E0507`.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: captured variable cannot escape `FnMut` closure body
|
||||
warning: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-49824.rs:22:9
|
||||
|
|
||||
LL | || {
|
||||
|
|
@ -10,6 +10,21 @@ LL | | }
|
|||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
|
||||
It represents potential unsoundness in your code.
|
||||
This warning will become a hard error in the future.
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/issue-49824.rs:18:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | | //~^ compilation successful
|
||||
LL | | let mut x = 0;
|
||||
LL | | || {
|
||||
... |
|
||||
LL | | };
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/issue-52213.rs:13:20
|
||||
|
|
||||
LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
|
||||
LL | ((u,),) => u,
|
||||
| ^ returning this value requires that `'a` must outlive `'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/issue-52533-1.rs:19:18
|
||||
|
|
||||
LL | gimme(|x, y| y)
|
||||
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
||||
| | |
|
||||
| | has type `&Foo<'_, '1, u32>`
|
||||
| has type `&Foo<'_, '2, u32>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/issue-52533.rs:15:16
|
||||
|
|
||||
LL | foo(|a, b| b)
|
||||
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
||||
| | |
|
||||
| | has type `&'1 u32`
|
||||
| has type `&'2 u32`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue