Skip to content

Commit 687f252

Browse files
committed
move mir_check_* to ui tests, add adjusted references
1 parent 9f09127 commit 687f252

8 files changed

+71
-3
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
warning: not reporting region error due to nll
2+
--> $DIR/mir_check_cast_closure.rs:18:5
3+
|
4+
LL | g
5+
| ^
6+
7+
error: unsatisfied lifetime constraints
8+
--> $DIR/mir_check_cast_closure.rs:16:28
9+
|
10+
LL | let g: fn(_, _) -> _ = |_x, y| y;
11+
| ^^^^^^^^^ cast requires that `'b` must outlive `'a`
12+
13+
error: aborting due to previous error
14+

src/test/compile-fail/mir_check_cast_reify.rs renamed to src/test/ui/nll/mir_check_cast_reify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ fn bar<'a>(x: &'a u32) -> &'static u32 {
4545
// as part of checking the `ReifyFnPointer`.
4646
let f: fn(_) -> _ = foo;
4747
//~^ WARNING not reporting region error due to nll
48-
//~| ERROR unsatisfied lifetime constraints
4948
f(x)
49+
//~^ ERROR
5050
}
5151

5252
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
warning: not reporting region error due to nll
2+
--> $DIR/mir_check_cast_reify.rs:46:25
3+
|
4+
LL | let f: fn(_) -> _ = foo;
5+
| ^^^
6+
7+
error: borrowed data escapes outside of closure
8+
--> $DIR/mir_check_cast_reify.rs:48:5
9+
|
10+
LL | fn bar<'a>(x: &'a u32) -> &'static u32 {
11+
| - `x` is a reference that is only valid in the closure body
12+
...
13+
LL | f(x)
14+
| ^^^^ `x` escapes the closure body here
15+
16+
error: aborting due to previous error
17+

src/test/compile-fail/mir_check_cast_unsafe_fn.rs renamed to src/test/ui/nll/mir_check_cast_unsafe_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
1717
// in `g`. These are related via the `UnsafeFnPointer` cast.
1818
let g: unsafe fn(_) -> _ = f;
1919
//~^ WARNING not reporting region error due to nll
20-
//~| ERROR unsatisfied lifetime constraints
2120
unsafe { g(input) }
21+
//~^ ERROR
2222
}
2323

2424
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
warning: not reporting region error due to nll
2+
--> $DIR/mir_check_cast_unsafe_fn.rs:18:32
3+
|
4+
LL | let g: unsafe fn(_) -> _ = f;
5+
| ^
6+
7+
error: borrowed data escapes outside of closure
8+
--> $DIR/mir_check_cast_unsafe_fn.rs:20:14
9+
|
10+
LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
11+
| ----- `input` is a reference that is only valid in the closure body
12+
...
13+
LL | unsafe { g(input) }
14+
| ^^^^^^^^ `input` escapes the closure body here
15+
16+
error: aborting due to previous error
17+

src/test/compile-fail/mir_check_cast_unsize.rs renamed to src/test/ui/nll/mir_check_cast_unsize.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
use std::fmt::Debug;
1616

1717
fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
18-
x //~ ERROR unsatisfied lifetime constraints
18+
//~^ ERROR unsatisfied lifetime constraints
19+
x
1920
//~^ WARNING not reporting region error due to nll
2021
}
2122

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
warning: not reporting region error due to nll
2+
--> $DIR/mir_check_cast_unsize.rs:19:5
3+
|
4+
LL | x
5+
| ^
6+
7+
error: unsatisfied lifetime constraints
8+
--> $DIR/mir_check_cast_unsize.rs:17:46
9+
|
10+
LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
11+
| ______________________________________________^
12+
LL | | //~^ ERROR unsatisfied lifetime constraints
13+
LL | | x
14+
LL | | //~^ WARNING not reporting region error due to nll
15+
LL | | }
16+
| |_^ return requires that `'a` must outlive `'static`
17+
18+
error: aborting due to previous error
19+

0 commit comments

Comments
 (0)