Skip to content

Commit 9f05f29

Browse files
committed
Incorporate edition flag testing into tests of -Z borrowck=migrate.
1 parent 94a2972 commit 9f05f29

6 files changed

+52
-7
lines changed

src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.stderr renamed to src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0507]: cannot move out of borrowed content
2-
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:30:17
2+
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17
33
|
44
LL | (|| { let bar = foo; bar.take() })();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content

src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
// NLL checks will be emitted as errors *even* in the presence of `-Z
1919
// borrowck=migrate`.
2020

21-
// compile-flags: -Z borrowck=migrate
21+
// revisions: zflag edition
22+
// [zflag]compile-flags: -Z borrowck=migrate
23+
// [edition]compile-flags: --edition 2018
2224

2325
#![feature(nll)]
2426

@@ -28,7 +30,8 @@ fn main() {
2830
ref mut foo
2931
if {
3032
(|| { let bar = foo; bar.take() })();
31-
//~^ ERROR cannot move out of borrowed content [E0507]
33+
//[zflag]~^ ERROR cannot move out of borrowed content [E0507]
34+
//[edition]~^^ ERROR cannot move out of borrowed content [E0507]
3235
false
3336
} => {},
3437
Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0507]: cannot move out of borrowed content
2+
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17
3+
|
4+
LL | (|| { let bar = foo; bar.take() })();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0507`.

src/test/ui/borrowck/borrowck-migrate-to-nll.stderr renamed to src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning[E0507]: cannot move out of borrowed content
2-
--> $DIR/borrowck-migrate-to-nll.rs:26:17
2+
--> $DIR/borrowck-migrate-to-nll.rs:35:17
33
|
44
LL | (|| { let bar = foo; bar.take() })();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
@@ -9,7 +9,7 @@ LL | (|| { let bar = foo; bar.take() })();
99
This warning will become a hard error in the future.
1010

1111
warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
12-
--> $DIR/borrowck-migrate-to-nll.rs:26:17
12+
--> $DIR/borrowck-migrate-to-nll.rs:35:17
1313
|
1414
LL | (|| { let bar = foo; bar.take() })();
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/borrowck/borrowck-migrate-to-nll.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@
1515
// Therefore, for backwards-compatiblity, under borrowck=migrate the
1616
// NLL checks will be emitted as *warnings*.
1717

18-
// compile-flags: -Z borrowck=migrate
19-
// run-pass
18+
// NLL mode makes this compile-fail; we cannot currently encode a
19+
// test that is run-pass or compile-fail based on compare-mode. So
20+
// just ignore it instead:
21+
22+
// ignore-compare-mode-nll
23+
24+
// revisions: zflag edition
25+
//[zflag]compile-flags: -Z borrowck=migrate
26+
//[edition]compile-flags: --edition 2018
27+
//[zflag] run-pass
28+
//[edition] run-pass
2029

2130
fn main() {
2231
match Some(&4) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
warning[E0507]: cannot move out of borrowed content
2+
--> $DIR/borrowck-migrate-to-nll.rs:35:17
3+
|
4+
LL | (|| { let bar = foo; bar.take() })();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
6+
|
7+
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
8+
It represents potential unsoundness in your code.
9+
This warning will become a hard error in the future.
10+
11+
warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard
12+
--> $DIR/borrowck-migrate-to-nll.rs:35:17
13+
|
14+
LL | (|| { let bar = foo; bar.take() })();
15+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
| |
17+
| cannot move out of `foo`, as it is immutable for the pattern guard
18+
| cannot move
19+
|
20+
= note: variables bound in patterns are immutable until the end of the pattern guard
21+
= warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
22+
It represents potential unsoundness in your code.
23+
This warning will become a hard error in the future.
24+

0 commit comments

Comments
 (0)