decentralized-identity / decentralized-identity/did-key.rs

Example program doesn't compile; complains about `alloc` needing to be enabled

Open
#43 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
50
Forks
22
PR merge metrics
No merged PRs in 30d

Description

This trivial program doesn't compile:

```rust
use did_key::Fingerprint;

fn main() {
match did_key::resolve("did:key:z9Bg7Lbpq3RzgN8RkgEuZqLDF4nT1ZzobJe9ZPbS6HJpQ") {
Ok(k) => println!("{:?}", k.fingerprint()),
Err(e) => println!("{:?}", e),
}
}
```

The output is:

```
❯ cargo run
Compiling form_urlencoded v1.2.1
error: the `alloc` feature must currently be enabled
--> /home/harm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/form_urlencoded-1.2.1/src/lib.rs:24:1
|
24 | compile_error!("the `alloc` feature must currently be enabled");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `Cow<'_, _>: From>` is not satisfied
--> /home/harm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/form_urlencoded-1.2.1/src/lib.rs:72:55
|
72 | decode_utf8_lossy(match percent_decode(&replaced).into() {
| ^^^^ the trait `From>` is not implemented for `Cow<'_, _>`
|
= help: the following other types implement trait `From`:
as From>
as From<&'a CStr>>
as From<&'a CString>>
as From<&'a str>>
as From>
as From<&'a String>>
as From<&'a [T]>>
as From>>
as From<&'a Vec>>
= note: required for `PercentDecode<'_>` to implement `Into>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `form_urlencoded` (lib) due to 2 previous errors
```

Adding the form_urlencoded crate explicitly fixes the error:
```
❯ cargo add form_urlencoded
Updating crates.io index
Adding form_urlencoded v1.2.1 to dependencies.
Features:
+ alloc
+ std
```

I doubt this is expected behaviour. Notably I was able to run the test of this repo without this issue and no mention of `alloc` was made anywhere.

Crate version 0.2.1.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.