]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/coercion/coerce-overloaded-autoderef-fail.rs
1 fn borrow_mut
<T
>(x
: &mut T
) -> &mut T { x }
2 fn borrow
<T
>(x
: &T
) -> &T { x }
4 fn borrow_mut2
<T
>(_
: &mut T
, _
: &mut T
) {}
5 fn borrow2
<T
>(_
: &mut T
, _
: &T
) {}
7 fn double_mut_borrow
<T
>(x
: &mut Box
<T
>) {
10 //~^ ERROR cannot borrow `*x` as mutable more than once at a time
14 fn double_imm_borrow(x
: &mut Box
<i32>) {
18 //~^ ERROR cannot assign to `**x` because it is borrowed
22 fn double_mut_borrow2
<T
>(x
: &mut Box
<T
>) {
24 //~^ ERROR cannot borrow `*x` as mutable more than once at a time
27 fn double_borrow2
<T
>(x
: &mut Box
<T
>) {
29 //~^ ERROR cannot borrow `*x` as mutable because it is also borrowed as immutable