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