Skip to content

Commit

Permalink
fix: unsoundness issue caught in recent nightly (#712)
Browse files Browse the repository at this point in the history
Signed-off-by: Saurav Sharma <[email protected]>
  • Loading branch information
iamsauravsharma authored Mar 11, 2024
1 parent 6ab6d80 commit 97d95c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 3 additions & 0 deletions cedar-policy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Validation for the `in` operator to no longer reports an error when comparing actions
in different namespaces. (#704, resolving #642)
- `ValidationResult` methods `validation_errors` and `validation_warnings`, along with
`confusable_string_checker`, now return iterators with static lifetimes instead of
custom lifetimes, addressing potential unsoundness. (#712)

## [3.1.0] - 2024-03-08
Cedar Language Version: 3.1.0
Expand Down
11 changes: 4 additions & 7 deletions cedar-policy/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1673,12 +1673,12 @@ impl<'a> ValidationResult<'a> {
}

/// Get an iterator over the errors found by the validator.
pub fn validation_errors<'b>(&self) -> impl Iterator<Item = &ValidationError<'b>> {
pub fn validation_errors(&self) -> impl Iterator<Item = &ValidationError<'static>> {
self.validation_errors.iter()
}

/// Get an iterator over the warnings found by the validator.
pub fn validation_warnings<'b>(&self) -> impl Iterator<Item = &ValidationWarning<'b>> {
pub fn validation_warnings(&self) -> impl Iterator<Item = &ValidationWarning<'static>> {
self.validation_warnings.iter()
}

Expand Down Expand Up @@ -1911,12 +1911,9 @@ impl<'a> From<cedar_policy_validator::SourceLocation<'a>> for SourceLocation<'st
/// checks are also provided through [`Validator::validate`] which provides more
/// comprehensive error detection, but this function can be used to check for
/// confusable strings without defining a schema.
pub fn confusable_string_checker<'a, 'b>(
pub fn confusable_string_checker<'a>(
templates: impl Iterator<Item = &'a Template> + 'a,
) -> impl Iterator<Item = ValidationWarning<'b>> + 'a
where
'b: 'a,
{
) -> impl Iterator<Item = ValidationWarning<'static>> + 'a {
cedar_policy_validator::confusable_string_checks(templates.map(|t| &t.ast))
.map(std::convert::Into::into)
}
Expand Down

0 comments on commit 97d95c0

Please sign in to comment.