Skip to content

x509-cert: Certificate doesn't implement Arbitrary anymore #1149

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

Closed
stormshield-guillaumed opened this issue Jul 11, 2023 · 1 comment · Fixed by #1150
Closed

x509-cert: Certificate doesn't implement Arbitrary anymore #1149

stormshield-guillaumed opened this issue Jul 11, 2023 · 1 comment · Fixed by #1150

Comments

@stormshield-guillaumed
Copy link
Contributor

Arbitrary support was introduced in 0.2.0 but broke recently.

Steps to Reproduce the Problem

  1. Try to compile the following code on 0.2.3 :
fn f<'a>(_arbitrary: impl arbitrary::Arbitrary<'a>) {}

fn g(certificate: x509_cert::Certificate) {
    f(certificate);
}

It fails to compile with the following error :

error[E0277]: the trait bound `Rfc5280: Arbitrary<'_>` is not satisfied
 --> src/main.rs:4:7
  |
4 |     f(certificate);
  |     - ^^^^^^^^^^^ the trait `Arbitrary<'_>` is not implemented for `Rfc5280`
  |     |
  |     required by a bound introduced by this call
  |
  = help: the following other types implement trait `Arbitrary<'a>`:
            <&'a [u8] as Arbitrary<'a>>
            <&'a str as Arbitrary<'a>>
            <() as Arbitrary<'a>>
            <(B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, A) as Arbitrary<'a>>
            <(C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, B) as Arbitrary<'a>>
            <(D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, C) as Arbitrary<'a>>
            <(E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, D) as Arbitrary<'a>>
            <(F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, E) as Arbitrary<'a>>
          and 116 others
  = note: required for `CertificateInner` to implement `Arbitrary<'_>`
note: required by a bound in `f`
 --> src/main.rs:1:27
  |
1 | fn f<'a>(_arbitrary: impl arbitrary::Arbitrary<'a>) {}
  |                           ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f`

On 0.2.0, it compiles fine.

I could submit a PR with a fix and a test to ensure Certificate still implements Arbitrary in the future if you would like.

baloo added a commit to baloo/formats that referenced this issue Jul 12, 2023
@baloo
Copy link
Member

baloo commented Jul 12, 2023

Thanks for the bug report!
Would you mind giving #1150 a shot?

tarcieri pushed a commit that referenced this issue Jul 12, 2023
Fixes #1149

This broke with the parsing profiles (#987)
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

Successfully merging a pull request may close this issue.

2 participants