]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closure-region.rs
Rollup merge of #95376 - WaffleLapkin:drain_keep_rest, r=dtolnay
[rust.git] / src / test / ui / unboxed-closures / unboxed-closure-region.rs
1 // Test that an unboxed closure that captures a free variable by
2 // reference cannot escape the region of that variable.
3
4
5 fn main() {
6     let _f = {
7         let x = 0;
8         || x //~ ERROR `x` does not live long enough
9     };
10     _f;
11 }