]> git.lizzy.rs Git - rust.git/commitdiff
Explain reason behind error span
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Wed, 27 Jun 2018 01:54:59 +0000 (18:54 -0700)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Wed, 4 Jul 2018 21:36:07 +0000 (14:36 -0700)
We can't expand the span of the error reliably according to @oli-obk, so
just mention why it points to this particular expression.

src/librustc/mir/interpret/error.rs
src/test/ui/const-eval/infinite_loop.stderr

index 143b7b2069cc2c945b5236ffc72577b036faffd8..68e1d6c65c06c8e5d5f652c316153572c0bb6fa0 100644 (file)
@@ -399,7 +399,9 @@ pub fn description(&self) -> &str {
             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",
         }
     }
 }
index 904fbcb07e4b2cddd2450b7ed87578330c770cbe..95c15c3e4e254ae54045b5f37012b00dff6b4e1e 100644 (file)
@@ -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 | |     }];