about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2018-06-26 18:54:59 -0700
committerDylan MacKenzie <ecstaticmorse@gmail.com>2018-07-04 14:36:07 -0700
commit647ba29b90155e07cf569060d344242b3ee474eb (patch)
treefa5e66ee8d9257824a2f5faf1cfe5b987d289c8f
parentd36302da53d398e35d8eacc8cef1c43d1d95359c (diff)
downloadrust-647ba29b90155e07cf569060d344242b3ee474eb.tar.gz
rust-647ba29b90155e07cf569060d344242b3ee474eb.zip
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.
-rw-r--r--src/librustc/mir/interpret/error.rs4
-rw-r--r--src/test/ui/const-eval/infinite_loop.stderr2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs
index 143b7b2069c..68e1d6c65c0 100644
--- a/src/librustc/mir/interpret/error.rs
+++ b/src/librustc/mir/interpret/error.rs
@@ -399,7 +399,9 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> {
             RemainderByZero => "attempt to calculate the remainder with a divisor of zero",
             GeneratorResumedAfterReturn => "generator resumed after completion",
             GeneratorResumedAfterPanic => "generator resumed after panicking",
-            InfiniteLoop => "program will never terminate",
+            InfiniteLoop =>
+                "duplicate interpreter state observed while executing this expression, \
+                const evaluation will never terminate",
         }
     }
 }
diff --git a/src/test/ui/const-eval/infinite_loop.stderr b/src/test/ui/const-eval/infinite_loop.stderr
index 904fbcb07e4..95c15c3e4e2 100644
--- a/src/test/ui/const-eval/infinite_loop.stderr
+++ b/src/test/ui/const-eval/infinite_loop.stderr
@@ -29,7 +29,7 @@ LL | |         //~| ERROR could not evaluate repeat length
 LL | |         let mut n = 113383; // #20 in A006884
 LL | |         while n != 0 { //~ ERROR constant contains unimplemented expression type
 LL | |             n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
-   | |                    ---------- program will never terminate
+   | |                    ---------- duplicate interpreter state observed while executing this expression, const evaluation will never terminate
 LL | |         }
 LL | |         n
 LL | |     }];