Skip to content

Commit d846083

Browse files
authored
add non_exhaustive to a couple more types (#1169)
1 parent fc699ab commit d846083

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

cedar-policy-core/src/ast/restricted_expr.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,7 @@ pub mod restricted_expr_errors {
657657

658658
/// Errors possible from `RestrictedExpr::from_str()`
659659
//
660-
// CAUTION: this type is publicly exported in `cedar-policy`.
661-
// Don't make fields `pub`, don't make breaking changes, and use caution when
662-
// adding public methods.
660+
// This is NOT a publicly exported error type.
663661
#[derive(Debug, Clone, PartialEq, Eq, Diagnostic, Error)]
664662
pub enum RestrictedExpressionParseError {
665663
/// Failed to parse the expression

cedar-policy-validator/src/cedar_schema/err.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,10 @@ impl Diagnostic for MultipleEAMapDeclarationsError {
580580
}
581581

582582
/// Errors relating to embedded attribute maps (`EAMap`s)
583+
//
584+
// This is NOT a publicly exported error type.
583585
#[derive(Debug, Clone, Diagnostic, Error, PartialEq, Eq)]
586+
#[non_exhaustive]
584587
pub enum EAMapError {
585588
/// An embedded attribute map (RFC 68) was encountered where one is not allowed
586589
#[error(transparent)]

cedar-policy-validator/src/cedar_schema/parser.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ lazy_static::lazy_static! {
8484
}
8585

8686
/// Parse errors for parsing a schema in the Cedar syntax
87+
//
88+
// This is NOT a publicly exported error type.
8789
#[derive(Debug, Diagnostic, Error)]
90+
#[non_exhaustive]
8891
pub enum CedarSchemaParseErrors {
8992
/// Parse error for the Cedar syntax
9093
#[error(transparent)]

cedar-policy-validator/src/coreschema.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ impl<'a> ast::RequestSchema for CoreSchema<'a> {
257257
}
258258

259259
/// Error when the request does not conform to the schema.
260+
//
261+
// This is NOT a publicly exported error type.
260262
#[derive(Debug, Diagnostic, Error)]
261263
pub enum RequestValidationError {
262264
/// Request action is not declared in the schema

cedar-policy-validator/src/diagnostics.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ impl ValidationResult {
8787
/// policy. The error contains a enumeration that specifies the kind of problem,
8888
/// and provides details specific to that kind of problem. The error also records
8989
/// where the problem was encountered.
90+
//
91+
// This is NOT a publicly exported error type.
9092
#[derive(Clone, Debug, Diagnostic, Error, Hash, Eq, PartialEq)]
9193
pub enum ValidationError {
9294
/// A policy contains an entity type that is not declared in the schema.

cedar-policy/CHANGELOG.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Cedar Language Version: 4.0
1515
### Added
1616
- Implemented [RFC 74](https://github.com/cedar-policy/rfcs/pull/74): A new experimental API (`compute_entity_manifest`)
1717
that provides the Entity Manifest: a data
18-
structure that describes what data is required to satisfy a
18+
structure that describes what data is required to satisfy a
1919
Cedar request. To use this API you must enable the `entity-manifest` feature flag.
2020
- Additional functionality to the JSON FFI including parsing utilities (#1079)
2121
and conversion between the Cedar and JSON formats (#1087)
@@ -53,9 +53,8 @@ Cedar Language Version: 4.0
5353
to parse strings in the JSON schema format.
5454
- `PolicySet::template_annotation` now returns `Option<&str>` as opposed to
5555
`Option<String>` in the previous version (#1131, resolving #1116)
56-
- Marked errors/warnings related to parsing and entity/request validation as
57-
`non_exhaustive`, allowing future variants to be added without a breaking
58-
change. (#1137)
56+
- Marked errors/warnings related to parsing and validation as `non_exhaustive`,
57+
allowing future variants to be added without a breaking change. (#1137, #1169)
5958
- (*) Improved consistency between JSON and Cedar schema formats. Both now
6059
forbid using `Bool`, `Boolean`, `Entity`, `Extension`, `Long`, `Record`, `Set`,
6160
and `String` as common type names. (#1150, resolving #1139)

cedar-policy/src/api/err.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@ pub mod context_json_errors {
956956

957957
/// Error type for parsing a `RestrictedExpression`
958958
#[derive(Debug, Diagnostic, Error)]
959+
#[non_exhaustive]
959960
pub enum RestrictedExpressionParseError {
960961
/// Failed to parse the expression
961962
#[error(transparent)]

0 commit comments

Comments
 (0)