Skip to content

Commit 647ba29

Browse files
Explain reason behind error span
We can't expand the span of the error reliably according to @oli-obk, so just mention why it points to this particular expression.
1 parent d36302d commit 647ba29

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/librustc/mir/interpret/error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> {
399399
RemainderByZero => "attempt to calculate the remainder with a divisor of zero",
400400
GeneratorResumedAfterReturn => "generator resumed after completion",
401401
GeneratorResumedAfterPanic => "generator resumed after panicking",
402-
InfiniteLoop => "program will never terminate",
402+
InfiniteLoop =>
403+
"duplicate interpreter state observed while executing this expression, \
404+
const evaluation will never terminate",
403405
}
404406
}
405407
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ LL | | //~| ERROR could not evaluate repeat length
2929
LL | | let mut n = 113383; // #20 in 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-
| | ---------- program will never terminate
32+
| | ---------- duplicate interpreter state observed while executing this expression, const evaluation will never terminate
3333
LL | | }
3434
LL | | n
3535
LL | | }];

0 commit comments

Comments
 (0)