jwt-compact icon indicating copy to clipboard operation
jwt-compact copied to clipboard

Problem with the download crate v0.6.0

Open hanusek opened this issue 3 years ago • 1 comments

Hello @slowli I have a problem with the download and build the crate.

My compiler: rust 1.54 (required by yocto).

Cargo.toml

[package]
name = "jwt_tests"
version = "0.1.0"
edition = "2018"

[dependencies]
jwt-compact = "0.6.0"

Log:

$ cargo +1.54 b
    Blocking waiting for file lock on package cache
    Updating crates.io index
error: failed to select a version for the requirement `jwt-compact = "=0.6.0"`
candidate versions found which didn't match: 0.5.0, 0.4.0, 0.3.0, ...
location searched: crates.io index
required by package `speedy_tests v0.1.0 (/home/mhanusek/work/code/rnd/jwt_tests)`

For jwt-compact = "0.5.0" :

$cargo +1.54 b
    Blocking waiting for file lock on build directory
   Compiling jwt-compact v0.5.0
error[E0277]: the trait bound `serde_json::Error: std::error::Error` is not satisfied
  --> /home/mhanusek/.cargo/registry/src/github.com-1ecc6299db9ec823/jwt-compact-0.5.0/src/error.rs:46:46
   |
46 |             Self::MalformedHeader(e) => Some(e),
   |                                              ^ the trait `std::error::Error` is not implemented for `serde_json::Error`
   |
   = note: required for the cast to the object type `dyn std::error::Error`

error[E0277]: the trait bound `serde_json::Error: std::error::Error` is not satisfied
   --> /home/mhanusek/.cargo/registry/src/github.com-1ecc6299db9ec823/jwt-compact-0.5.0/src/error.rs:143:46
    |
143 |             Self::MalformedClaims(e) => Some(e),
    |                                              ^ the trait `std::error::Error` is not implemented for `serde_json::Error`
    |
    = note: required for the cast to the object type `dyn std::error::Error`

error[E0277]: the trait bound `serde_cbor::Error: std::error::Error` is not satisfied
   --> /home/mhanusek/.cargo/registry/src/github.com-1ecc6299db9ec823/jwt-compact-0.5.0/src/error.rs:145:50
    |
145 |             Self::MalformedCborClaims(e) => Some(e),
    |                                                  ^ the trait `std::error::Error` is not implemented for `serde_cbor::Error`
    |
    = note: required for the cast to the object type `dyn std::error::Error`

error[E0277]: the trait bound `serde_json::Error: std::error::Error` is not satisfied
   --> /home/mhanusek/.cargo/registry/src/github.com-1ecc6299db9ec823/jwt-compact-0.5.0/src/error.rs:180:55
    |
180 |             Self::Header(e) | Self::Claims(e) => Some(e),
    |                                                       ^ the trait `std::error::Error` is not implemented for `serde_json::Error`
    |
    = note: required for the cast to the object type `dyn std::error::Error`

error[E0277]: the trait bound `serde_cbor::Error: std::error::Error` is not satisfied
   --> /home/mhanusek/.cargo/registry/src/github.com-1ecc6299db9ec823/jwt-compact-0.5.0/src/error.rs:182:41
    |
182 |             Self::CborClaims(e) => Some(e),
    |                                         ^ the trait `std::error::Error` is not implemented for `serde_cbor::Error`
    |
    = note: required for the cast to the object type `dyn std::error::Error`

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0277`.
error: could not compile `jwt-compact`

hanusek avatar Dec 23 '22 12:12 hanusek

Hi! The version 0.6.0 is not available in your case because it requires Rust 1.60+ / Rust 2021 edition as specified in the crate manifest. (The cargo message is not very helpful here, unfortunately, but I'm 99.9% sure that this is the cause.)

0.6.0 is also the first version that fixes the bug with no_std support that you've encountered with version 0.5.0. This bug was reported previously (#92); see https://github.com/slowli/jwt-compact/issues/92#issuecomment-1032420283 on a moderately hacky fix. Essentially, the fix boils down to specifying serde_cbor as a direct dependency of your crate.

slowli avatar Dec 23 '22 16:12 slowli