move mir_check_* to ui tests, add adjusted references

This commit is contained in:
Niko Matsakis 2018-07-26 08:21:35 +03:00
parent 9f09127f4d
commit 687f2526fb
8 changed files with 71 additions and 3 deletions

View File

@ -0,0 +1,14 @@
warning: not reporting region error due to nll
--> $DIR/mir_check_cast_closure.rs:18:5
|
LL | g
| ^
error: unsatisfied lifetime constraints
--> $DIR/mir_check_cast_closure.rs:16:28
|
LL | let g: fn(_, _) -> _ = |_x, y| y;
| ^^^^^^^^^ cast requires that `'b` must outlive `'a`
error: aborting due to previous error

View File

@ -45,8 +45,8 @@ fn bar<'a>(x: &'a u32) -> &'static u32 {
// as part of checking the `ReifyFnPointer`.
let f: fn(_) -> _ = foo;
//~^ WARNING not reporting region error due to nll
//~| ERROR unsatisfied lifetime constraints
f(x)
//~^ ERROR
}
fn main() {}

View File

@ -0,0 +1,17 @@
warning: not reporting region error due to nll
--> $DIR/mir_check_cast_reify.rs:46:25
|
LL | let f: fn(_) -> _ = foo;
| ^^^
error: borrowed data escapes outside of closure
--> $DIR/mir_check_cast_reify.rs:48:5
|
LL | fn bar<'a>(x: &'a u32) -> &'static u32 {
| - `x` is a reference that is only valid in the closure body
...
LL | f(x)
| ^^^^ `x` escapes the closure body here
error: aborting due to previous error

View File

@ -17,8 +17,8 @@ fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
// in `g`. These are related via the `UnsafeFnPointer` cast.
let g: unsafe fn(_) -> _ = f;
//~^ WARNING not reporting region error due to nll
//~| ERROR unsatisfied lifetime constraints
unsafe { g(input) }
//~^ ERROR
}
fn main() {}

View File

@ -0,0 +1,17 @@
warning: not reporting region error due to nll
--> $DIR/mir_check_cast_unsafe_fn.rs:18:32
|
LL | let g: unsafe fn(_) -> _ = f;
| ^
error: borrowed data escapes outside of closure
--> $DIR/mir_check_cast_unsafe_fn.rs:20:14
|
LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
| ----- `input` is a reference that is only valid in the closure body
...
LL | unsafe { g(input) }
| ^^^^^^^^ `input` escapes the closure body here
error: aborting due to previous error

View File

@ -15,7 +15,8 @@
use std::fmt::Debug;
fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
x //~ ERROR unsatisfied lifetime constraints
//~^ ERROR unsatisfied lifetime constraints
x
//~^ WARNING not reporting region error due to nll
}

View File

@ -0,0 +1,19 @@
warning: not reporting region error due to nll
--> $DIR/mir_check_cast_unsize.rs:19:5
|
LL | x
| ^
error: unsatisfied lifetime constraints
--> $DIR/mir_check_cast_unsize.rs:17:46
|
LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
| ______________________________________________^
LL | | //~^ ERROR unsatisfied lifetime constraints
LL | | x
LL | | //~^ WARNING not reporting region error due to nll
LL | | }
| |_^ return requires that `'a` must outlive `'static`
error: aborting due to previous error