Shorten error message and add link to test

Implements @bjorn3's suggestions.
This commit is contained in:
Dylan MacKenzie 2018-06-29 13:32:54 -07:00
parent 0d0e021b1c
commit c395044a50
3 changed files with 5 additions and 6 deletions

View File

@ -400,8 +400,7 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> {
GeneratorResumedAfterReturn => "generator resumed after completion", GeneratorResumedAfterReturn => "generator resumed after completion",
GeneratorResumedAfterPanic => "generator resumed after panicking", GeneratorResumedAfterPanic => "generator resumed after panicking",
InfiniteLoop => InfiniteLoop =>
"duplicate interpreter state observed while executing this expression, \ "duplicate interpreter state observed here, const evaluation will never terminate",
const evaluation will never terminate",
} }
} }
} }

View File

@ -16,7 +16,7 @@ fn main() {
let _ = [(); { let _ = [(); {
//~^ WARNING Constant evaluating a complex constant, this might take some time //~^ WARNING Constant evaluating a complex constant, this might take some time
//~| ERROR could not evaluate repeat length //~| 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 while n != 0 { //~ ERROR constant contains unimplemented expression type
n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
} }

View File

@ -13,7 +13,7 @@ LL | let _ = [(); {
| __________________^ | __________________^
LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time
LL | | //~| ERROR could not evaluate repeat length 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 | | n
LL | | }]; LL | | }];
@ -26,10 +26,10 @@ LL | let _ = [(); {
| __________________^ | __________________^
LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time
LL | | //~| ERROR could not evaluate repeat length 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 | | while n != 0 { //~ ERROR constant contains unimplemented expression type
LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; 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 | | }
LL | | n LL | | n
LL | | }]; LL | | }];