Sign in
android
/
toolchain
/
rustc
/
refs/heads/main
/
.
/
tests
/
ui
/
unboxed-closures
/
unboxed-closures-borrow-conflict.rs
blob: 835a1f598601c1540c8c6a1c88a8e79daeb77c19 [
file
] [
log
] [
blame
] [
edit
]
// Test that an unboxed closure that mutates a free variable will
// cause borrow conflicts.
fn
main
()
{
let
mut
x
=
0
;
let
f
=
||
x
+=
1
;
let
_y
=
x
;
//~ ERROR cannot use `x` because it was mutably borrowed
f
;
}