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
+
1
4
const _X: i32 = {
2
5
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
4
7
5
- let reborrow = { p} ; //~ ERROR references in constants may only refer to immutable values
8
+ let reborrow = { p} ;
6
9
let pp = & reborrow;
7
10
let ppp = & pp;
8
11
* * * ppp
Original file line number Diff line number Diff line change 1
1
error[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
3
3
|
4
4
LL | let p = &mut a;
5
5
| ^^^^^^ constants require immutable values
6
6
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
14
8
15
9
For more information about this error, try `rustc --explain E0017`.
You can’t perform that action at this time.
0 commit comments