Skip to content

Commit

Permalink
fixup! [const-eval] error on NaN and infinite floats
Browse files Browse the repository at this point in the history
  • Loading branch information
jimblandy committed Oct 10, 2023
1 parent eb6a862 commit 4bb0467
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/proc/constant_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,9 +1158,11 @@ impl<'a> ConstantEvaluator<'a> {
expr: Expression,
span: Span,
) -> Result<Handle<Expression>, ConstantEvaluatorError> {
match expr {
Expression::Literal(literal) => crate::valid::validate_literal(literal)?,
_ => {}
// It suffices to only check literals, since we only register one
// expression at a time, `Compose` expressions can only refer to other
// expressions, and `ZeroValue` expressions are always okay.
if let Expression::Literal(literal) = expr {
crate::valid::validate_literal(literal)?;
}

if let Some(FunctionLocalData {
Expand Down

0 comments on commit 4bb0467

Please sign in to comment.