2014-10-03 00:57:21 -07:00
|
|
|
// Test that an unboxed closure that captures a free variable by
|
|
|
|
|
// reference cannot escape the region of that variable.
|
2018-08-15 23:39:30 +02:00
|
|
|
|
|
|
|
|
|
2014-10-03 00:57:21 -07:00
|
|
|
fn main() {
|
|
|
|
|
let _f = {
|
2015-03-03 10:42:26 +02:00
|
|
|
let x = 0;
|
2023-01-05 21:29:36 +00:00
|
|
|
|| x //~ ERROR closure may outlive the current block, but it borrows `x`
|
2014-10-03 00:57:21 -07:00
|
|
|
};
|
2018-08-15 23:39:30 +02:00
|
|
|
_f;
|
2014-10-03 00:57:21 -07:00
|
|
|
}
|