From c395044a5002a9c275b92bc8e0bc54da245fa8b1 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Fri, 29 Jun 2018 13:32:54 -0700 Subject: [PATCH] Shorten error message and add link to test Implements @bjorn3's suggestions. --- src/librustc/mir/interpret/error.rs | 3 +-- src/test/ui/const-eval/infinite_loop.rs | 2 +- src/test/ui/const-eval/infinite_loop.stderr | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 68e1d6c65c0..9125597a727 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -400,8 +400,7 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> { GeneratorResumedAfterReturn => "generator resumed after completion", GeneratorResumedAfterPanic => "generator resumed after panicking", InfiniteLoop => - "duplicate interpreter state observed while executing this expression, \ - const evaluation will never terminate", + "duplicate interpreter state observed here, const evaluation will never terminate", } } } diff --git a/src/test/ui/const-eval/infinite_loop.rs b/src/test/ui/const-eval/infinite_loop.rs index 8011cf83eed..a1f8ab7f878 100644 --- a/src/test/ui/const-eval/infinite_loop.rs +++ b/src/test/ui/const-eval/infinite_loop.rs @@ -16,7 +16,7 @@ fn main() { let _ = [(); { //~^ WARNING Constant evaluating a complex constant, this might take some time //~| ERROR could not evaluate repeat length - let mut n = 113383; // #20 in A006884 + let mut n = 113383; // #20 in https://oeis.org/A006884 while n != 0 { //~ ERROR constant contains unimplemented expression type n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; } diff --git a/src/test/ui/const-eval/infinite_loop.stderr b/src/test/ui/const-eval/infinite_loop.stderr index 95c15c3e4e2..f69aae29203 100644 --- a/src/test/ui/const-eval/infinite_loop.stderr +++ b/src/test/ui/const-eval/infinite_loop.stderr @@ -13,7 +13,7 @@ LL | let _ = [(); { | __________________^ LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time LL | | //~| ERROR could not evaluate repeat length -LL | | let mut n = 113383; // #20 in A006884 +LL | | let mut n = 113383; // #20 in https://oeis.org/A006884 ... | LL | | n LL | | }]; @@ -26,10 +26,10 @@ LL | let _ = [(); { | __________________^ LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time LL | | //~| ERROR could not evaluate repeat length -LL | | let mut n = 113383; // #20 in A006884 +LL | | let mut n = 113383; // #20 in https://oeis.org/A006884 LL | | while n != 0 { //~ ERROR constant contains unimplemented expression type LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; - | | ---------- duplicate interpreter state observed while executing this expression, const evaluation will never terminate + | | ---------- duplicate interpreter state observed here, const evaluation will never terminate LL | | } LL | | n LL | | }];