2019-11-22 16:14:24 -08:00
|
|
|
// Ensure that we point the user to the erroneous borrow but not to any subsequent borrows of that
|
|
|
|
|
// initial one.
|
|
|
|
|
|
2019-09-17 16:25:26 -07:00
|
|
|
const _X: i32 = {
|
|
|
|
|
let mut a = 5;
|
2019-11-22 16:14:24 -08:00
|
|
|
let p = &mut a; //~ ERROR references in constants may only refer to immutable values
|
2019-09-17 16:25:26 -07:00
|
|
|
|
2019-11-22 16:14:24 -08:00
|
|
|
let reborrow = {p};
|
2019-09-17 16:25:26 -07:00
|
|
|
let pp = &reborrow;
|
|
|
|
|
let ppp = &pp;
|
|
|
|
|
***ppp
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
fn main() {}
|