File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 1+ // Ensure that we point the user to the erroneous borrow but not to any subsequent borrows of that
2+ // initial one.
3+
14const _X: i32 = {
25 let mut a = 5 ;
3- let p = & mut a; //~ ERROR references in constants may only refer to immutable values
6+ let p = & mut a; //~ ERROR references in constants may only refer to immutable values
47
5- let reborrow = { p} ; //~ ERROR references in constants may only refer to immutable values
8+ let reborrow = { p} ;
69 let pp = & reborrow;
710 let ppp = & pp;
811 * * * ppp
Original file line number Diff line number Diff line change 11error[E0017]: references in constants may only refer to immutable values
2- --> $DIR/const-multi-ref.rs:3 :13
2+ --> $DIR/const-multi-ref.rs:6 :13
33 |
44LL | let p = &mut a;
55 | ^^^^^^ constants require immutable values
66
7- error[E0017]: references in constants may only refer to immutable values
8- --> $DIR/const-multi-ref.rs:5:21
9- |
10- LL | let reborrow = {p};
11- | ^ constants require immutable values
12-
13- error: aborting due to 2 previous errors
7+ error: aborting due to previous error
148
159For more information about this error, try `rustc --explain E0017`.
You can’t perform that action at this time.
0 commit comments