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