@@ -2406,6 +2406,11 @@ fn simplify_lines(
24062406 let result = ConstExpression :: MathExpr ( * operation, const_args) ;
24072407 res. push ( SimpleLine :: equality ( target_var, SimpleExpr :: Constant ( result) ) ) ;
24082408 } else {
2409+ if !operation. supports_runtime ( ) {
2410+ return Err ( format ! (
2411+ "Operation `{operation}` is compile-time only; all operands must be constants"
2412+ ) ) ;
2413+ }
24092414 res. push ( SimpleLine :: Assignment {
24102415 var : target_var. into ( ) ,
24112416 operation : * operation,
@@ -2449,6 +2454,11 @@ fn simplify_lines(
24492454 let result = ConstExpression :: MathExpr ( * operation, const_args) ;
24502455 res. push ( SimpleLine :: equality ( var, SimpleExpr :: Constant ( result) ) ) ;
24512456 } else {
2457+ if !operation. supports_runtime ( ) {
2458+ return Err ( format ! (
2459+ "Operation `{operation}` is compile-time only; all operands must be constants"
2460+ ) ) ;
2461+ }
24522462 assert_eq ! ( simplified_args. len( ) , 2 ) ;
24532463 res. push ( SimpleLine :: Assignment {
24542464 var,
@@ -3062,6 +3072,11 @@ fn simplify_expr(
30623072 if let Some ( const_args) = SimpleExpr :: try_vec_as_constant ( & simplified_args) {
30633073 return Ok ( SimpleExpr :: Constant ( ConstExpression :: MathExpr ( * operation, const_args) ) ) ;
30643074 }
3075+ if !operation. supports_runtime ( ) {
3076+ return Err ( format ! (
3077+ "Operation `{operation}` is compile-time only; all operands must be constants"
3078+ ) ) ;
3079+ }
30653080 let aux_var = state. counters . aux_var ( ) ;
30663081 assert_eq ! ( simplified_args. len( ) , 2 ) ;
30673082 lines. push ( SimpleLine :: Assignment {
0 commit comments