Incorporate edition flag testing into tests of -Z borrowck=migrate
.
This commit is contained in:
parent
94a2972d3f
commit
9f05f29e56
@ -1,5 +1,5 @@
|
|||||||
error[E0507]: cannot move out of borrowed content
|
error[E0507]: cannot move out of borrowed content
|
||||||
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:30:17
|
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17
|
||||||
|
|
|
|
||||||
LL | (|| { let bar = foo; bar.take() })();
|
LL | (|| { let bar = foo; bar.take() })();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
@ -18,7 +18,9 @@
|
|||||||
// NLL checks will be emitted as errors *even* in the presence of `-Z
|
// NLL checks will be emitted as errors *even* in the presence of `-Z
|
||||||
// borrowck=migrate`.
|
// borrowck=migrate`.
|
||||||
|
|
||||||
// compile-flags: -Z borrowck=migrate
|
// revisions: zflag edition
|
||||||
|
// [zflag]compile-flags: -Z borrowck=migrate
|
||||||
|
// [edition]compile-flags: --edition 2018
|
||||||
|
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
|
|
||||||
@ -28,7 +30,8 @@ fn main() {
|
|||||||
ref mut foo
|
ref mut foo
|
||||||
if {
|
if {
|
||||||
(|| { let bar = foo; bar.take() })();
|
(|| { let bar = foo; bar.take() })();
|
||||||
//~^ ERROR cannot move out of borrowed content [E0507]
|
//[zflag]~^ ERROR cannot move out of borrowed content [E0507]
|
||||||
|
//[edition]~^^ ERROR cannot move out of borrowed content [E0507]
|
||||||
false
|
false
|
||||||
} => {},
|
} => {},
|
||||||
Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."),
|
Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."),
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
error[E0507]: cannot move out of borrowed content
|
||||||
|
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17
|
||||||
|
|
|
||||||
|
LL | (|| { let bar = foo; bar.take() })();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0507`.
|
@ -1,5 +1,5 @@
|
|||||||
warning[E0507]: cannot move out of borrowed content
|
warning[E0507]: cannot move out of borrowed content
|
||||||
--> $DIR/borrowck-migrate-to-nll.rs:26:17
|
--> $DIR/borrowck-migrate-to-nll.rs:35:17
|
||||||
|
|
|
|
||||||
LL | (|| { let bar = foo; bar.take() })();
|
LL | (|| { let bar = foo; bar.take() })();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||||
@ -9,7 +9,7 @@ LL | (|| { let bar = foo; bar.take() })();
|
|||||||
This warning will become a hard error in the future.
|
This warning will become a hard error in the future.
|
||||||
|
|
||||||
warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
|
warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
|
||||||
--> $DIR/borrowck-migrate-to-nll.rs:26:17
|
--> $DIR/borrowck-migrate-to-nll.rs:35:17
|
||||||
|
|
|
|
||||||
LL | (|| { let bar = foo; bar.take() })();
|
LL | (|| { let bar = foo; bar.take() })();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
@ -15,8 +15,17 @@
|
|||||||
// Therefore, for backwards-compatiblity, under borrowck=migrate the
|
// Therefore, for backwards-compatiblity, under borrowck=migrate the
|
||||||
// NLL checks will be emitted as *warnings*.
|
// NLL checks will be emitted as *warnings*.
|
||||||
|
|
||||||
// compile-flags: -Z borrowck=migrate
|
// NLL mode makes this compile-fail; we cannot currently encode a
|
||||||
// run-pass
|
// test that is run-pass or compile-fail based on compare-mode. So
|
||||||
|
// just ignore it instead:
|
||||||
|
|
||||||
|
// ignore-compare-mode-nll
|
||||||
|
|
||||||
|
// revisions: zflag edition
|
||||||
|
//[zflag]compile-flags: -Z borrowck=migrate
|
||||||
|
//[edition]compile-flags: --edition 2018
|
||||||
|
//[zflag] run-pass
|
||||||
|
//[edition] run-pass
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match Some(&4) {
|
match Some(&4) {
|
||||||
|
24
src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr
Normal file
24
src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
warning[E0507]: cannot move out of borrowed content
|
||||||
|
--> $DIR/borrowck-migrate-to-nll.rs:35:17
|
||||||
|
|
|
||||||
|
LL | (|| { let bar = foo; bar.take() })();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||||
|
|
|
||||||
|
= 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.
|
||||||
|
|
||||||
|
warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
|
||||||
|
--> $DIR/borrowck-migrate-to-nll.rs:35:17
|
||||||
|
|
|
||||||
|
LL | (|| { let bar = foo; bar.take() })();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| cannot move out of `foo`, as it is immutable for the pattern guard
|
||||||
|
| cannot move
|
||||||
|
|
|
||||||
|
= note: variables bound in patterns are immutable until the end of the pattern guard
|
||||||
|
= 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.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user