From f5c82503f949a84f06c23f5d416a9e693fc74aa2 Mon Sep 17 00:00:00 2001 From: Lauri Virtanen Date: Mon, 16 Dec 2024 19:51:13 +0200 Subject: [PATCH] Be more explicit with `pi()` being the only nullary math function --- core/vdbe/mod.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs index 547cde53b..154d6f7e6 100644 --- a/core/vdbe/mod.rs +++ b/core/vdbe/mod.rs @@ -2492,9 +2492,18 @@ impl Program { } }, crate::function::Func::Math(math_func) => match math_func.arity() { - MathFuncArity::Nullary => { - state.registers[*dest] = OwnedValue::Float(std::f64::consts::PI); - } + MathFuncArity::Nullary => match math_func { + MathFunc::Pi => { + state.registers[*dest] = + OwnedValue::Float(std::f64::consts::PI); + } + _ => { + unreachable!( + "Unexpected mathematical Nullary function {:?}", + math_func + ); + } + }, MathFuncArity::Unary => { let reg_value = &state.registers[*start_reg];