add regression test for #54124

Fixes #54124
This commit is contained in:
Niko Matsakis 2018-10-20 15:00:57 -04:00
parent 3a17880539
commit dbbdce51dc
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#![feature(nll)]
fn test<'a>() {
let _:fn(&()) = |_:&'a ()| {};
}
fn main() {
test();
}

View File

@ -0,0 +1,20 @@
error: unsatisfied lifetime constraints
--> $DIR/issue-54124.rs:4:22
|
LL | fn test<'a>() {
| -- lifetime `'a` defined here
LL | let _:fn(&()) = |_:&'a ()| {};
| ^ - let's call the lifetime of this reference `'1`
| |
| requires that `'1` must outlive `'a`
error: unsatisfied lifetime constraints
--> $DIR/issue-54124.rs:4:22
|
LL | fn test<'a>() {
| -- lifetime `'a` defined here
LL | let _:fn(&()) = |_:&'a ()| {};
| ^ requires that `'a` must outlive `'static`
error: aborting due to 2 previous errors