Skip to content

Commit

Permalink
Rename TimeLimitReached -> StepLimitReached
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Mar 22, 2020
1 parent 044dc6e commit b5636b8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ pub enum ResourceExhaustionInfo {
/// The program ran for too long.
///
/// The exact limit is set by the `const_eval_limit` attribute.
TimeLimitReached,
StepLimitReached,
}

impl fmt::Debug for ResourceExhaustionInfo {
Expand All @@ -578,7 +578,9 @@ impl fmt::Debug for ResourceExhaustionInfo {
StackFrameLimitReached => {
write!(f, "reached the configured maximum number of stack frames")
}
TimeLimitReached => write!(f, "exceeded interpreter time limit"),
StepLimitReached => {
write!(f, "exceeded interpreter step limit (see `#[const_eval_limit]`)")
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/const_eval/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter {

ecx.machine.steps_remaining -= 1;
if ecx.machine.steps_remaining == 0 {
throw_exhaust!(TimeLimitReached)
throw_exhaust!(StepLimitReached)
}

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/infinite_loop.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/infinite_loop.rs:8:20
|
LL | n = if n % 2 == 0 { n/2 } else { 3*n + 1 };
| ^^^^^^^^^^ exceeded interpreter time limit
| ^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)

error: aborting due to 3 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const-eval/issue-52475.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-52475.rs:7:17
|
LL | n = (n + 1) % 5;
| ^^^^^^^^^^^ exceeded interpreter time limit
| ^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | / const X: usize = {
LL | | let mut x = 0;
LL | | while x != 1000 {
| | ^^^^^^^^^ exceeded interpreter time limit
| | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
LL | |
... |
LL | | x
Expand Down

0 comments on commit b5636b8

Please sign in to comment.