Skip to content

cedar-policy-2.4.2: type error when applying the ? operator #205

Open
@lcnr

Description

@lcnr
[INFO] [stdout] error[E0277]: `?` couldn't convert the error to `serde_json::Error`
[INFO] [stdout]     --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/cedar-policy-2.4.2/src/api.rs:1410:76
[INFO] [stdout]      |
[INFO] [stdout] 1410 |             parsed.into_euid(|| JsonDeserializationErrorContext::EntityUid)?,
[INFO] [stdout]      |                    --------------------------------------------------------^ the trait `From<cedar_policy_core::entities::JsonDeserializationError>` is not implemented for `serde_json::Error`
[INFO] [stdout]      |                    |
[INFO] [stdout]      |                    this can't be annotated with `?` because it has type `Result<_, cedar_policy_core::entities::JsonDeserializationError>`
[INFO] [stdout]      |
[INFO] [stdout]      = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error[E0308]: mismatched types
[INFO] [stdout]     --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/cedar-policy-2.4.2/src/api.rs:1409:9
[INFO] [stdout]      |
[INFO] [stdout] 1406 |       pub fn from_json(json: serde_json::Value) -> Result<Self, impl std::error::Error> {
[INFO] [stdout]      |                                                    ------------------------------------ expected `Result<api::EntityUid, impl StdError>` because of return type
[INFO] [stdout] ...
[INFO] [stdout] 1409 | /         Ok::<Self, entities::JsonDeserializationError>(Self(
[INFO] [stdout] 1410 | |             parsed.into_euid(|| JsonDeserializationErrorContext::EntityUid)?,
[INFO] [stdout] 1411 | |         ))
[INFO] [stdout]      | |__________^ types differ
[INFO] [stdout]      |
[INFO] [stdout]      = note: expected enum `Result<_, serde_json::Error>`
[INFO] [stdout]                 found enum `Result<_, cedar_policy_core::entities::JsonDeserializationError>`

Metadata

Metadata

Assignees

Labels

from-craterA regression found via a crater run, not part of our test suite

Type

No type

Projects

Status

todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions