2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2018-08-31 15:02:01 +02:00
|
|
|
#![allow(non_upper_case_globals)]
|
|
|
|
|
2014-07-22 05:27:46 -04:00
|
|
|
// Check that the 'static bound on a proc influences lifetimes of
|
|
|
|
// region variables contained within (otherwise, region inference will
|
|
|
|
// give `x` a very short lifetime).
|
|
|
|
|
2015-03-22 13:13:15 -07:00
|
|
|
//@ pretty-expanded FIXME #23616
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
static i: usize = 3;
|
2014-11-26 08:12:18 -05:00
|
|
|
fn foo<F:FnOnce()+'static>(_: F) {}
|
2015-03-25 17:06:52 -07:00
|
|
|
fn read(_: usize) { }
|
2014-07-22 05:27:46 -04:00
|
|
|
pub fn main() {
|
|
|
|
let x = &i;
|
2014-11-26 08:12:18 -05:00
|
|
|
foo(move|| {
|
2014-07-22 05:27:46 -04:00
|
|
|
read(*x);
|
|
|
|
});
|
|
|
|
}
|