Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x509-cert: Error when targeting WASM #1332

Open
OtaK opened this issue Jan 23, 2024 · 4 comments
Open

x509-cert: Error when targeting WASM #1332

OtaK opened this issue Jan 23, 2024 · 4 comments

Comments

@OtaK
Copy link
Contributor

OtaK commented Jan 23, 2024

Hi! I'm currently running into these errors when targeting WASM (wasm32-unknown-unknown) with x509-cert:

error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
  --> /home/otak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x509-cert-0.2.5/src/ext/pkix/constraints/basic.rs:17:22
   |
17 |     #[asn1(default = "Default::default")]
   |                      ^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
   |
help: use a fully-qualified path to a specific available implementation
   |
17 |     #[asn1(default = </* self type */ as "Default::default">)]
   |                      +++++++++++++++++++                   +

error[E0283]: type annotations needed
  --> /home/otak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x509-cert-0.2.5/src/ext/pkix/constraints/basic.rs:14:39
   |
14 | #[derive(Clone, Debug, Eq, PartialEq, Sequence)]
   |                                       ^^^^^^^^ cannot infer type
   |
   = note: multiple `impl`s satisfying `bool: PartialEq<_>` found in the following crates: `core`, `serde_json`:
           - impl PartialEq for bool;
           - impl PartialEq<serde_json::value::Value> for bool;
   = note: required for `&bool` to implement `PartialEq<&_>`
   = note: this error originates in the derive macro `Sequence` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
  --> /home/otak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x509-cert-0.2.5/src/ext/pkix/constraints/name.rs:64:19
   |
64 |         default = "Default::default"
   |                   ^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
   |
help: use a fully-qualified path to a specific available implementation
   |
64 |         default = </* self type */ as "Default::default">
   |                   +++++++++++++++++++                   +

error[E0283]: type annotations needed
  --> /home/otak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x509-cert-0.2.5/src/ext/pkix/constraints/name.rs:56:39
   |
56 | #[derive(Clone, Debug, Eq, PartialEq, Sequence)]
   |                                       ^^^^^^^^ cannot infer type
   |
   = note: multiple `impl`s satisfying `u32: PartialEq<_>` found in the following crates: `core`, `serde_json`:
           - impl PartialEq for u32;
           - impl PartialEq<serde_json::value::Value> for u32;
   = note: required for `&u32` to implement `PartialEq<&_>`
   = note: this error originates in the derive macro `Sequence` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
  --> /home/otak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x509-cert-0.2.5/src/ext/pkix/crl/dp.rs:34:19
   |
34 |         default = "Default::default"
   |                   ^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
   |
help: use a fully-qualified path to a specific available implementation
   |
34 |         default = </* self type */ as "Default::default">
   |                   +++++++++++++++++++                   +

error[E0283]: type annotations needed
  --> /home/otak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x509-cert-0.2.5/src/ext/pkix/crl/dp.rs:25:39
   |
25 | #[derive(Clone, Debug, Eq, PartialEq, Sequence)]
   |                                       ^^^^^^^^ cannot infer type
   |
   = note: multiple `impl`s satisfying `bool: PartialEq<_>` found in the following crates: `core`, `serde_json`:
           - impl PartialEq for bool;
           - impl PartialEq<serde_json::value::Value> for bool;
   = note: required for `&bool` to implement `PartialEq<&_>`
   = note: this error originates in the derive macro `Sequence` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
  --> /home/otak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x509-cert-0.2.5/src/ext.rs:32:22
   |
32 |     #[asn1(default = "Default::default")]
   |                      ^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
   |
help: use a fully-qualified path to a specific available implementation
   |
32 |     #[asn1(default = </* self type */ as "Default::default">)]
   |                      +++++++++++++++++++                   +

error[E0283]: type annotations needed
  --> /home/otak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x509-cert-0.2.5/src/ext.rs:27:39
   |
27 | #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)]
   |                                       ^^^^^^^^ cannot infer type
   |
   = note: multiple `impl`s satisfying `bool: PartialEq<_>` found in the following crates: `core`, `serde_json`:
           - impl PartialEq for bool;
           - impl PartialEq<serde_json::value::Value> for bool;
   = note: required for `&bool` to implement `PartialEq<&_>`
   = note: this error originates in the derive macro `Sequence` (in Nightly builds, run with -Z macro-backtrace for more info)

I know the 0.3 release train is in full swing, but maybe we could sneak in a fix for this?

Cheers

@OtaK
Copy link
Contributor Author

OtaK commented Jan 23, 2024

As an example, I made a fixed branch (based on tag v0.2.5) here: https://github.com/OtaK/formats/tree/otak/x509-cert-wasm

@tarcieri
Copy link
Member

tarcieri commented Jan 23, 2024

There's something else breaking inference here besides merely "WASM". We build all of our crates on WASM in CI:

https://github.com/RustCrypto/formats/blob/master/.github/workflows/x509-cert.yml#L33-L41

https://github.com/RustCrypto/formats/actions/runs/7602097002/job/20702246159

There is something else in your project, likely another crate which is breaking inference, although I'm not sure how.

The change on your PR looks fine but we literally just flipped over to the 0.3.0-pre release train days ago, which is very annoying.

I suppose we can backport it if need be.

@OtaK
Copy link
Contributor Author

OtaK commented Jan 24, 2024

I think you're right, it might be another crate disabling some features (like std on the der crate?) somewhere in my dependency tree. I'll run my patch for now and I have unfortunately no time to find another fix but I'll revisit later on and keep you updated.

Feel free to close the issue for now or keep it open if you'd like to keep track of this.

@tarcieri
Copy link
Member

tarcieri commented Feb 2, 2024

Your branch looks fine if you want to PR it. We should probably use something less ambiguous to prevent these sorts of inference errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants