clarkmcc / cel-rust

Common Expression Language interpreter written in Rust
https://crates.io/crates/cel-interpreter
MIT License
377 stars 21 forks source link

Fix compilation without chrono #111

Closed Caellian closed 2 days ago

Caellian commented 2 days ago

This PR fixes compilation without chrono

Previously cfg!(feature = "chrono") was used which blocks execution at runtime, this was switched out with a #[cfg(feature = "chrono")] block which will block the code at compile time. Blocking it at runtime doesn't work because prevented functions in functions::time don't exist so this causes a compile error.

Added a minimal build to the CI to avoid these kinds of problems in future.

alexsnaps commented 1 day ago

@Caellian thanks for catching this... cause indeed unlike #[cfg(..., if cfg!(... doesn't remove the code (tho it will get DCE'ed eventually), while they both still evaluate at compile time, so the code guarded here would indeed need to compile, which in this case it can't. I plead guilty!