mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
12 lines
267 B
Rust
12 lines
267 B
Rust
// Test that an unboxed closure that captures a free variable by
|
|
// reference cannot escape the region of that variable.
|
|
|
|
|
|
fn main() {
|
|
let _f = {
|
|
let x = 0;
|
|
|| x //~ ERROR closure may outlive the current block, but it borrows `x`
|
|
};
|
|
_f;
|
|
}
|