diff --git a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.stderr b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr similarity index 84% rename from src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.stderr rename to src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr index f12da562f1b..fa82efa3533 100644 --- a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.stderr +++ b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr @@ -1,5 +1,5 @@ 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() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs index b9cb97eeec1..72043938f53 100644 --- a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs +++ b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs @@ -18,7 +18,9 @@ // NLL checks will be emitted as errors *even* in the presence of `-Z // borrowck=migrate`. -// compile-flags: -Z borrowck=migrate +// revisions: zflag edition +// [zflag]compile-flags: -Z borrowck=migrate +// [edition]compile-flags: --edition 2018 #![feature(nll)] @@ -28,7 +30,8 @@ fn main() { ref mut foo if { (|| { 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 } => {}, Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."), diff --git a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.zflag.stderr b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.zflag.stderr new file mode 100644 index 00000000000..fa82efa3533 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.zflag.stderr @@ -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`. diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.stderr b/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr similarity index 92% rename from src/test/ui/borrowck/borrowck-migrate-to-nll.stderr rename to src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr index 115b0946673..f5a9db36406 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.stderr +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr @@ -1,5 +1,5 @@ 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() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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. 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() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.rs b/src/test/ui/borrowck/borrowck-migrate-to-nll.rs index cac595e6ae5..e7f2bfbfedb 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.rs +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.rs @@ -15,8 +15,17 @@ // Therefore, for backwards-compatiblity, under borrowck=migrate the // NLL checks will be emitted as *warnings*. -// compile-flags: -Z borrowck=migrate -// run-pass +// NLL mode makes this compile-fail; we cannot currently encode a +// 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() { match Some(&4) { diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr b/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr new file mode 100644 index 00000000000..f5a9db36406 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr @@ -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. +