| 1 |
// { dg-additional-options "-frust-compile-until=compilation -frust-borrowcheck -fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } |
| 2 |
// { dg-enable-nn-line-numbers "" } |
| 3 |
pub fn use_while_mut_fr(x: &mut i32) -> &mut i32 { |
| 4 |
let y = &mut *x; |
| 5 |
let z = x; //~ ERROR |
| 6 |
// { dg-error "use of borrowed value" "" { target *-*-* } .-1 } |
| 7 |
y |
| 8 |
/* |
| 9 |
{ dg-begin-multiline-output "" } |
| 10 |
NN | let y = &mut *x; |
| 11 |
| ~ |
| 12 |
| | |
| 13 |
| borrow occurs here |
| 14 |
NN | let z = x; //~ ERROR |
| 15 |
| ^ |
| 16 |
| | |
| 17 |
| borrowed value used here |
| 18 |
{ dg-end-multiline-output "" } |
| 19 |
*/ |
| 20 |
} |
| 21 |
|