Repository: cedar-policy/cedar
Pull request #1542 (2025-03-19 21:56:26)

Bump MSRV to 1.81
## Description of changes
#1537 requires 1.81, which is greater than that required by #1539 
## Issue #, if available
#1539 
## Checklist for requesting a review

The change in this PR is (choose one, and delete the other options):

- [x] A backwards-compatible change requiring a minor version bump to `cedar-policy` (e.g., addition of a new API).

I confirm that this PR (choose one, and delete the other options):

- [x] Updates the "Unreleased" section of the CHANGELOG with a description of my change (required for major/minor version bumps).

I confirm that [`cedar-spec`](https://github.com/cedar-policy/cedar-spec) (choose one, and delete the other options):

- [x] Does not require updates because my change does not impact the Cedar formal model or DRT infrastructure.

I confirm that [`docs.cedarpolicy.com`](https://docs.cedarpolicy.com/) (choose one, and delete the other options):

- [x] Does not require updates because my change does not impact the Cedar language specification.


cdisselkoen: CI msrv check is failing; do we need to update that too?
shaobo-he-aws: > CI msrv check is failing; do we need to update that too?

Yes. I will update it now.

Patch:
diff --git a/Cargo.toml b/Cargo.toml
index c8f812ef..7b2db52e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ debug = "line-tables-only"  # this adds more debug symbols/info to the binary th
 # Keys that packages can inherit
 [workspace.package]
 # Check the minimum supported Rust version with `cargo install cargo-msrv && cargo msrv --min 1.X.0` where `X` is something lower than the version noted here (to confirm that versions lower than the one noted here _don't_ work)
-rust-version = "1.77"
+rust-version = "1.81"
 version = "4.4.0"
 homepage = "https://cedarpolicy.com"
 keywords = ["cedar", "authorization", "policy", "security"]
diff --git a/cedar-policy-cli/Cargo.toml b/cedar-policy-cli/Cargo.toml
index 0e9b6ded..7fc29304 100644
--- a/cedar-policy-cli/Cargo.toml
+++ b/cedar-policy-cli/Cargo.toml
@@ -22,11 +22,10 @@ semver = "1.0.26"
 
 [features]
 default = []
-experimental = ["level-validate", "permissive-validate", "partial-validate", "partial-eval", "datetime"]
+experimental = ["level-validate", "permissive-validate", "partial-validate", "partial-eval"]
 permissive-validate = ["cedar-policy/permissive-validate"]
 partial-validate = ["cedar-policy/partial-validate"]
 partial-eval = ["cedar-policy/partial-eval"]
-datetime = ["cedar-policy/datetime"]
 level-validate = ["cedar-policy/level-validate"]
 
 [dev-dependencies]
diff --git a/cedar-policy-core/Cargo.toml b/cedar-policy-core/Cargo.toml
index e721ed52..ea578bf7 100644
--- a/cedar-policy-core/Cargo.toml
+++ b/cedar-policy-core/Cargo.toml
@@ -43,7 +43,7 @@ chrono = { version = "0.4.40", optional = true, default-features = false}
 
 [features]
 # by default, enable all Cedar extensions
-default = ["ipaddr", "decimal"]
+default = ["ipaddr", "decimal", "datetime"]
 ipaddr = []
 decimal = ["dep:regex"]
 datetime = ["dep:chrono", "dep:regex"]
diff --git a/cedar-policy-core/src/evaluator.rs b/cedar-policy-core/src/evaluator.rs
index 6f3faaa5..8f3633f8 100644
--- a/cedar-policy-core/src/evaluator.rs
+++ b/cedar-policy-core/src/evaluator.rs
@@ -3184,7 +3184,6 @@ pub(crate) mod test {
         );
     }
 
-    #[cfg(feature = "datetime")]
     #[test]
     fn interpret_datetime_extension_compares() {
         let request = basic_request();
diff --git a/cedar-policy-validator/Cargo.toml b/cedar-policy-validator/Cargo.toml
index c9f62bb2..23006fdc 100644
--- a/cedar-policy-validator/Cargo.toml
+++ b/cedar-policy-validator/Cargo.toml
@@ -35,7 +35,7 @@ wasm-bindgen = { version = "0.2.97", optional = true }
 
 [features]
 # by default, enable all Cedar extensions
-default = ["ipaddr", "decimal"]
+default = ["ipaddr", "decimal", "datetime"]
 # when enabling a feature, make sure that the Core feature is also enabled
 ipaddr = ["cedar-policy-core/ipaddr"]
 decimal = ["cedar-policy-core/decimal"]
diff --git a/cedar-policy-validator/src/schema.rs b/cedar-policy-validator/src/schema.rs
index ab4c8168..2b0f5377 100644
--- a/cedar-policy-validator/src/schema.rs
+++ b/cedar-policy-validator/src/schema.rs
@@ -3109,7 +3109,6 @@ pub(crate) mod test {
                     .build());
         });
 
-        #[cfg(feature = "datetime")]
         {
             let src: serde_json::Value = json!({
                 "": {
diff --git a/cedar-policy/Cargo.toml b/cedar-policy/Cargo.toml
index 716d36ba..bc871f41 100644
--- a/cedar-policy/Cargo.toml
+++ b/cedar-policy/Cargo.toml
@@ -39,7 +39,7 @@ prost-build = { version = "0.13", optional = true }
 
 [features]
 # by default, enable all Cedar extensions, but not other crate features
-default = ["ipaddr", "decimal"]
+default = ["ipaddr", "decimal", "datetime"]
 
 # Cedar extensions
 ipaddr = ["cedar-policy-core/ipaddr", "cedar-policy-validator/ipaddr"]
@@ -52,7 +52,7 @@ corpus-timing = []
 
 # Experimental features.
 # Enable all experimental features with `cargo build --features "experimental"`
-experimental = ["partial-eval", "permissive-validate", "partial-validate", "level-validate", "entity-manifest", "protobufs", "datetime", "tolerant-ast", "extended-schema"]
+experimental = ["partial-eval", "permissive-validate", "partial-validate", "level-validate", "entity-manifest", "protobufs", "tolerant-ast", "extended-schema"]
 entity-manifest = ["cedar-policy-validator/entity-manifest"]
 partial-eval = ["cedar-policy-core/partial-eval", "cedar-policy-validator/partial-eval"]
 permissive-validate = []


Test patch:
diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index 40621021..625980b9 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -104,7 +104,8 @@ jobs:
     steps:
     - uses: actions/checkout@v4
     - uses: taiki-e/install-action@cargo-hack
-    - run: cargo hack check --rust-version --workspace --all-targets --ignore-private
+    - run: sudo apt-get install protobuf-compiler
+    - run: cargo hack check --rust-version --workspace --all-targets --ignore-private --all-features
 
   wasm-build:
     name: run wasm build script
diff --git a/cedar-policy-validator/src/typecheck/test/expr.rs b/cedar-policy-validator/src/typecheck/test/expr.rs
index 516c1cb1..976c1f5f 100644
--- a/cedar-policy-validator/src/typecheck/test/expr.rs
+++ b/cedar-policy-validator/src/typecheck/test/expr.rs
@@ -1353,7 +1353,6 @@ fn is_typechecks() {
     );
 }
 
-#[cfg(feature = "datetime")]
 mod datetime {
     use cedar_policy_core::{
         ast::{Expr, Name, Value},