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

Add core::fmt::Debug constraint to PrimeCurveParams::FieldElement #1036

Closed
wants to merge 1 commit into from

Conversation

coder0xff
Copy link
Contributor

Building with master causes the below error depending on usage.

error[E0277]: `<C as PrimeCurveParams>::FieldElement` doesn't implement `Debug`
   --> /home/coder0xff/Dropbox/Documents/Projects/Community/src/community/elliptic-curves/primeorder/src/affine.rs:290:30
    |
290 | impl<C> PrimeCurveAffine for AffinePoint<C>
    |                              ^^^^^^^^^^^^^^ `<C as PrimeCurveParams>::FieldElement` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
    = help: the trait `Debug` is not implemented for `<C as PrimeCurveParams>::FieldElement`
note: required for `AffinePoint<C>` to implement `Debug`
   --> /home/coder0xff/Dropbox/Documents/Projects/Community/src/community/elliptic-curves/primeorder/src/affine.rs:28:23
    |
28  | #[derive(Clone, Copy, Debug)]
    |                       ^^^^^ unsatisfied trait bound introduced in this `derive` macro
note: required by a bound in `PrimeCurveAffine`
   --> /home/coder0xff/.cargo/registry/src/index.crates.io-6f17d22bba15001f/group-0.13.0/src/prime.rs:27:7
    |
21  | pub trait PrimeCurveAffine: GroupEncoding
    |           ---------------- required by a bound in this trait
...
27  |     + fmt::Debug
    |       ^^^^^^^^^^ required by this bound in `PrimeCurveAffine`
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting the associated type
    |
298 |     <UncompressedPointSize<C> as ArraySize>::ArrayType<u8>: Copy, <C as PrimeCurveParams>::FieldElement: Debug
    |                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@tarcieri
Copy link
Member

I'm confused what's the error you're reporting here. Everything builds for me locally and in CI.

@coder0xff
Copy link
Contributor Author

coder0xff commented Mar 13, 2024

The toolchain for the embedded platform I'm working on is based on nightly Rust, so it could be caused by that. The constraint I added isn't wrong at least, as Debug isn't included in PrimeField or Invert.

@tarcieri
Copy link
Member

I can also build all of the crates in this repo locally with 1.78.0-nightly (7065f0ef4 2024-03-12).

It's unclear to me what's requiring a Debug impl in this case.

We can potentially add one, but it would be helpful to fully understand the situation first.

@tarcieri tarcieri closed this May 28, 2024
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 this pull request may close these issues.

None yet

2 participants