File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ const _X: i32 = if true { 5 } else { 6 } ;
2
+ //~^ ERROR constant contains unimplemented expression type
3
+ //~| ERROR constant contains unimplemented expression type
4
+
5
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0019]: constant contains unimplemented expression type
2
+ --> $DIR/const-if.rs:1:20
3
+ |
4
+ LL | const _X: i32 = if true { 5 } else { 6 };
5
+ | ^^^^
6
+
7
+ error[E0019]: constant contains unimplemented expression type
8
+ --> $DIR/const-if.rs:1:17
9
+ |
10
+ LL | const _X: i32 = if true { 5 } else { 6 };
11
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
12
+
13
+ error: aborting due to 2 previous errors
14
+
15
+ For more information about this error, try `rustc --explain E0019`.
Original file line number Diff line number Diff line change
1
+ const _X: i32 = {
2
+ let mut a = 5 ;
3
+ let p = & mut a; //~ ERROR references in constants may only refer to immutable values
4
+
5
+ let reborrow = { p} ; //~ ERROR references in constants may only refer to immutable values
6
+ let pp = & reborrow;
7
+ let ppp = & pp;
8
+ * * * ppp
9
+ } ;
10
+
11
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0017]: references in constants may only refer to immutable values
2
+ --> $DIR/const-multi-ref.rs:3:13
3
+ |
4
+ LL | let p = &mut a;
5
+ | ^^^^^^ constants require immutable values
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
14
+
15
+ For more information about this error, try `rustc --explain E0017`.
You can’t perform that action at this time.
0 commit comments