]> git.proxmox.com Git - rustc.git/blame - src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / diagnostics / borrowck / borrowck-4.rs
CommitLineData
136023e0 1// edition:2021
17df50a5
XL
2
3#[derive(Debug)]
4struct Point {
5 x: i32,
6 y: i32,
7}
8fn foo () -> impl FnMut()->() {
9 let mut p = Point {x: 1, y: 2 };
10 let mut c = || {
11 //~^ ERROR closure may outlive the current function, but it borrows `p`
12 p.x+=5;
13 println!("{:?}", p);
14 };
15 c
16}
17fn main() {
18 let c = foo();
19 c();
20}