Sign in
android
/
toolchain
/
rustc
/
refs/heads/main
/
.
/
tests
/
ui
/
borrowck
/
borrowck-loan-blocks-mut-uniq.rs
blob: 33d6af303102af3d267926cb3fe4d9b6596eac86 [
file
] [
log
] [
blame
] [
edit
]
fn
borrow
<
F
>(
v
:
&
isize
,
f
:
F
)
where F
:
FnOnce
(&
isize
)
{
f
(
v
);
}
fn
box_imm
()
{
let
mut
v
:
Box
<
_
>
=
Box
::
new
(
3
);
borrow
(&*
v
,
|
w
|
{
//~ ERROR cannot borrow `v` as mutable
v
=
Box
::
new
(
4
);
assert_eq
!(*
v
,
3
);
assert_eq
!(*
w
,
4
);
})
}
fn
main
()
{
}