Skip to content

Commit c395044

Browse files
Shorten error message and add link to test
Implements @bjorn3's suggestions.
1 parent 0d0e021 commit c395044

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/librustc/mir/interpret/error.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,7 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> {
400400
GeneratorResumedAfterReturn => "generator resumed after completion",
401401
GeneratorResumedAfterPanic => "generator resumed after panicking",
402402
InfiniteLoop =>
403-
"duplicate interpreter state observed while executing this expression, \
404-
const evaluation will never terminate",
403+
"duplicate interpreter state observed here, const evaluation will never terminate",
405404
}
406405
}
407406
}

src/test/ui/const-eval/infinite_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn main() {
1616
let _ = [(); {
1717
//~^ WARNING Constant evaluating a complex constant, this might take some time
1818
//~| ERROR could not evaluate repeat length
19-
let mut n = 113383; // #20 in A006884
19+
let mut n = 113383; // #20 in https://oeis.org/A006884
2020
while n != 0 { //~ ERROR constant contains unimplemented expression type
2121
n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
2222
}

src/test/ui/const-eval/infinite_loop.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LL | let _ = [(); {
1313
| __________________^
1414
LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time
1515
LL | | //~| ERROR could not evaluate repeat length
16-
LL | | let mut n = 113383; // #20 in A006884
16+
LL | | let mut n = 113383; // #20 in https://oeis.org/A006884
1717
... |
1818
LL | | n
1919
LL | | }];
@@ -26,10 +26,10 @@ LL | let _ = [(); {
2626
| __________________^
2727
LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time
2828
LL | | //~| ERROR could not evaluate repeat length
29-
LL | | let mut n = 113383; // #20 in A006884
29+
LL | | let mut n = 113383; // #20 in https://oeis.org/A006884
3030
LL | | while n != 0 { //~ ERROR constant contains unimplemented expression type
3131
LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
32-
| | ---------- duplicate interpreter state observed while executing this expression, const evaluation will never terminate
32+
| | ---------- duplicate interpreter state observed here, const evaluation will never terminate
3333
LL | | }
3434
LL | | n
3535
LL | | }];

0 commit comments

Comments
 (0)