Repository navigation
symcc: use the compiled API in the README example and deny doctest warnings - #2742
Merged
victornicolet merged 1 commit intoDec 3, 2026
Conversation
…rnings The crate-level example (the README, included as the crate docs) used the deprecated `WellTypedPolicies`, `check_always_allows` and `check_always_allows_with_counterexample`, so copying it gave deprecation warnings. It now builds a `CompiledSchema` once and uses `CompiledPolicySet::compile`, `check_always_allows_opt` and `check_always_allows_with_counterexample_opt`. The list of supported checks now names the `_opt` functions. rustdoc does not read RUSTFLAGS, so the `-D warnings` that CI sets there never reaches doc tests, and the deprecated example passed with its warnings unseen. The crate now sets `#![doc(test(attr(deny(warnings), allow(unused))))]`: doc tests fail on warnings such as deprecation, while keeping rustdoc's default `allow(unused)`, which setting `doc(test(attr(..)))` would otherwise drop. Fixes cedar-policy#2537 Signed-off-by: lazarus-boop <319656483+lazarus-boop@users.noreply.github.com>
victornicolet
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Fixes #2537.
The
cedar-policy-symcccrate docs (the README, included withinclude_str!) showed an example built on the deprecatedWellTypedPolicies,check_always_allowsandcheck_always_allows_with_counterexample, so copying it gave deprecation warnings.CompiledSchemaonce, compiles the policy set per request environment withCompiledPolicySet::compile, and callscheck_always_allows_optandcheck_always_allows_with_counterexample_opt, as suggested in the issue._optfunctions and says they take aCompiledPolicyorCompiledPolicySet.always_deniesalthough it held the result of the always-allows check; it is nowalways_allows.On the CI question in the issue: CI sets
-D warningsthroughRUSTFLAGS, but rustdoc does not readRUSTFLAGS, so it never reaches doc tests. The deprecated example compiled and passed, and rustdoc only shows a doc test's warnings when the test fails. This PR adds#![doc(test(attr(deny(warnings), allow(unused))))]to the crate. Settingdoc(test(attr(..)))drops rustdoc's defaultallow(unused)for doc tests, so it is kept explicitly; without it the two existingno_runexamples insolver.rsandsolver_pool.rsfail on unused variables.Testing
cargo test --doc -p cedar-policy-symccon stable 1.99.1, withoutCVC5set:mainLocalSolver::cvc5())deny(warnings); panics atLocalSolver::cvc5()lib.rswithmain's READMEuse of deprecatederrorsI don't have cvc5 1.3.1 on this machine, so I could not run the example to completion; CI installs cvc5 and runs it.
cargo fmt -p cedar-policy-symcc --checkis clean.Not covered: the new guard checks the compiled example, not the README's prose list of functions. Separately, the
*_assertsfunction docs inlib.rsstill mention the non-_optcalls; I left those out to keep this change to the README example, and can send a follow-up if you'd like. The same goes for thecompiledocs (lib.rs:165,lib.rs:240and two insymccopt/compiled_policies.rs), which say theCompiledSchema"should be created for the givenschemaandenv".CompiledSchema::newtakes only the schema, so the example builds it once and reuses it for every request environment.Issue #, if available
#2537
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
I confirm that this PR (choose one, and delete the other options):
I confirm that
cedar-spec(choose one, and delete the other options):I confirm that
docs.cedarpolicy.com(choose one, and delete the other options):