File tree Expand file tree Collapse file tree 2 files changed +67
-0
lines changed
src/test/ui/consts/const-eval Expand file tree Collapse file tree 2 files changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ feature( const_let) ]
12
+
13
+ fn main ( ) {
14
+ let _ = [ ( ) ; {
15
+ //~^ WARNING Constant evaluating a complex constant, this might take some time
16
+ //~| ERROR could not evaluate repeat length
17
+ let mut x = & 0 ;
18
+ let mut n = 0 ;
19
+ while n < 5 { //~ ERROR constant contains unimplemented expression type
20
+ n = ( n + 1 ) % 5 ;
21
+ x = & 0 ; // Materialize a new AllocId
22
+ }
23
+ 0
24
+ } ] ;
25
+ }
Original file line number Diff line number Diff line change
1
+ error[E0019]: constant contains unimplemented expression type
2
+ --> $DIR/issue-52475.rs:19:9
3
+ |
4
+ LL | / while n < 5 { //~ ERROR constant contains unimplemented expression type
5
+ LL | | n = (n + 1) % 5;
6
+ LL | | x = &0; // Materialize a new AllocId
7
+ LL | | }
8
+ | |_________^
9
+
10
+ warning: Constant evaluating a complex constant, this might take some time
11
+ --> $DIR/issue-52475.rs:14:18
12
+ |
13
+ LL | let _ = [(); {
14
+ | __________________^
15
+ LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time
16
+ LL | | //~| ERROR could not evaluate repeat length
17
+ LL | | let mut x = &0;
18
+ ... |
19
+ LL | | 0
20
+ LL | | }];
21
+ | |_____^
22
+
23
+ error[E0080]: could not evaluate repeat length
24
+ --> $DIR/issue-52475.rs:14:18
25
+ |
26
+ LL | let _ = [(); {
27
+ | __________________^
28
+ LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time
29
+ LL | | //~| ERROR could not evaluate repeat length
30
+ LL | | let mut x = &0;
31
+ ... |
32
+ LL | | n = (n + 1) % 5;
33
+ | | ----------- duplicate interpreter state observed here, const evaluation will never terminate
34
+ ... |
35
+ LL | | 0
36
+ LL | | }];
37
+ | |_____^
38
+
39
+ error: aborting due to 2 previous errors
40
+
41
+ Some errors occurred: E0019, E0080.
42
+ For more information about an error, try `rustc --explain E0019`.
You can’t perform that action at this time.
0 commit comments