error[E0506]: cannot assign to `p` because it is borrowed --> $DIR/mut_while_borrow.rs:9:5 | LL | let r = foo(&p); | -- borrow of `p` occurs here LL | p += 1; | ^^^^^^ assignment to borrowed `p` occurs here LL | println!("{}", r); | - borrow later used here error: aborting due to previous error For more information about this error, try `rustc --explain E0506`.