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

Conflicting implementations on 0.8.1, time for release? #630

Closed
RCasatta opened this issue Jul 17, 2023 · 10 comments
Closed

Conflicting implementations on 0.8.1, time for release? #630

RCasatta opened this issue Jul 17, 2023 · 10 comments

Comments

@RCasatta
Copy link
Contributor

In a downstream crate I have this kind of errors:

error[E0119]: conflicting implementations of trait `Ord` for type `KeyPair`
   --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:75:9
    |
75  |         impl Ord for $thing {
    |         ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `KeyPair`
    |
   ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:408:1
    |
408 | impl_array_newtype!(KeyPair, c_uchar, 96);
    | ----------------------------------------- in this macro invocation
...
499 | impl Ord for KeyPair {
    | -------------------- first implementation here
    |
    = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0119`.
error: could not compile `secp256k1-sys` (lib) due to 10 previous errors

with also the following types: RecoverableSignature, PublicKey, Signature, Signature

this appears to be fixed if I add to my Cargo.toml:

[patch.crates-io]
secp256k1-sys = { git="https://github.com/rust-bitcoin/rust-secp256k1", optional = true }

So I guess we just need to release a new version?

@apoelstra
Copy link
Member

I wouldn't mind releasing, but if 0.8.1 is failing to compile, then we need to fix that.

Can you try again with cargo -v and post the actual rustc invocation?

@RCasatta
Copy link
Contributor Author

It happens for example in elements-miniscript

cargo -v build
...
Running `rustc --crate-name secp256k1_sys --edition=2018 /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=94 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="recovery"' --cfg 'feature="std"' -C metadata=2c843164a47b95c1 -C extra-filename=-2c843164a47b95c1 --out-dir /tmp/elements-miniscript/target/debug/deps -L dependency=/tmp/elements-miniscript/target/debug/deps --cap-lints allow -L native=/tmp/elements-miniscript/target/debug/build/secp256k1-sys-604ffdc4e7be363c/out -l static=secp256k1`
error[E0119]: conflicting implementations of trait `PartialOrd` for type `RecoverableSignature`
--> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:68:9
 |
68 |         impl PartialOrd for $thing {
 |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `RecoverableSignature`
 |
::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/recovery.rs:26:1
 |
26 | impl_array_newtype!(RecoverableSignature, c_uchar, 65);
 | ------------------------------------------------------ in this macro invocation
...
81 | impl PartialOrd for RecoverableSignature {
 | ---------------------------------------- first implementation here
 |
 = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `PartialOrd` for type `PublicKey`
 --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:68:9
  |
68  |         impl PartialOrd for $thing {
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `PublicKey`
  |
 ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:137:1
  |
137 | impl_array_newtype!(PublicKey, c_uchar, 64);
  | ------------------------------------------- in this macro invocation
...
193 | impl PartialOrd for PublicKey {
  | ----------------------------- first implementation here
  |
  = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `PartialOrd` for type `Signature`
 --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:68:9
  |
68  |         impl PartialOrd for $thing {
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Signature`
  |
 ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:231:1
  |
231 | impl_array_newtype!(Signature, c_uchar, 64);
  | ------------------------------------------- in this macro invocation
...
283 | impl PartialOrd for Signature {
  | ----------------------------- first implementation here
  |
  = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `PartialOrd` for type `XOnlyPublicKey`
 --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:68:9
  |
68  |         impl PartialOrd for $thing {
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `XOnlyPublicKey`
  |
 ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:319:1
  |
319 | impl_array_newtype!(XOnlyPublicKey, c_uchar, 64);
  | ------------------------------------------------ in this macro invocation
...
371 | impl PartialOrd for XOnlyPublicKey {
  | ---------------------------------- first implementation here
  |
  = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `PartialOrd` for type `KeyPair`
 --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:68:9
  |
68  |         impl PartialOrd for $thing {
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `KeyPair`
  |
 ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:408:1
  |
408 | impl_array_newtype!(KeyPair, c_uchar, 96);
  | ----------------------------------------- in this macro invocation
...
492 | impl PartialOrd for KeyPair {
  | --------------------------- first implementation here
  |
  = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `Ord` for type `RecoverableSignature`
--> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:75:9
 |
75 |         impl Ord for $thing {
 |         ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `RecoverableSignature`
 |
::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/recovery.rs:26:1
 |
26 | impl_array_newtype!(RecoverableSignature, c_uchar, 65);
 | ------------------------------------------------------ in this macro invocation
...
88 | impl Ord for RecoverableSignature {
 | --------------------------------- first implementation here
 |
 = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `Ord` for type `PublicKey`
 --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:75:9
  |
75  |         impl Ord for $thing {
  |         ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `PublicKey`
  |
 ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:137:1
  |
137 | impl_array_newtype!(PublicKey, c_uchar, 64);
  | ------------------------------------------- in this macro invocation
...
200 | impl Ord for PublicKey {
  | ---------------------- first implementation here
  |
  = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `Ord` for type `Signature`
 --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:75:9
  |
75  |         impl Ord for $thing {
  |         ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Signature`
  |
 ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:231:1
  |
231 | impl_array_newtype!(Signature, c_uchar, 64);
  | ------------------------------------------- in this macro invocation
...
290 | impl Ord for Signature {
  | ---------------------- first implementation here
  |
  = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `Ord` for type `XOnlyPublicKey`
 --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:75:9
  |
75  |         impl Ord for $thing {
  |         ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `XOnlyPublicKey`
  |
 ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:319:1
  |
319 | impl_array_newtype!(XOnlyPublicKey, c_uchar, 64);
  | ------------------------------------------------ in this macro invocation
...
378 | impl Ord for XOnlyPublicKey {
  | --------------------------- first implementation here
  |
  = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `Ord` for type `KeyPair`
 --> /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/macros.rs:75:9
  |
75  |         impl Ord for $thing {
  |         ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `KeyPair`
  |
 ::: /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs:408:1
  |
408 | impl_array_newtype!(KeyPair, c_uchar, 96);
  | ----------------------------------------- in this macro invocation
...
499 | impl Ord for KeyPair {
  | -------------------- first implementation here
  |
  = note: this error originates in the macro `impl_array_newtype` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0119`.
error: could not compile `secp256k1-sys` (lib) due to 10 previous errors

Caused by:
process didn't exit successfully: `rustc --crate-name secp256k1_sys --edition=2018 /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=94 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="recovery"' --cfg 'feature="std"' -C metadata=2c843164a47b95c1 -C extra-filename=-2c843164a47b95c1 --out-dir /tmp/elements-miniscript/target/debug/deps -L dependency=/tmp/elements-miniscript/target/debug/deps --cap-lints allow -L native=/tmp/elements-miniscript/target/debug/build/secp256k1-sys-604ffdc4e7be363c/out -l static=secp256k1` (exit status: 1)
warning: build failed, waiting for other jobs to finish...

@apoelstra
Copy link
Member

Can you post an exact version of rust-elements and a lockfile somewhere? I cannot reproduce this.

@RCasatta
Copy link
Contributor Author

I can reproduce like this:

$ cargo --version
cargo 1.70.0 (ec8a8a0ca 2023-04-25)
$ git clone https://github.com/ElementsProject/elements-miniscript/
...
$ cd elements-miniscript/

$ cargo -v build

Cargo.lock.txt

@apoelstra
Copy link
Member

Still cannot reproduce. I tried in a fresh workspace, with a fresh clone, with your lockfile, with 1.70, with 1.71, it always suceeds.

@RCasatta
Copy link
Contributor Author

Oh, I tried on another machine and everything went smoothly. So it's my issue.

Sorry for the noise.

I'll post here if I find the issue on my local env.

@apoelstra
Copy link
Member

No worries! I had something similar recently when I was trying to patch a Cargo.toml, but then I was editing the dependency rather than using [patch], so my problem was that I actually had multiple versions of a crate in my dep tree.

Not sure what to make of this one. Would definitely be curious to find out.

@RCasatta
Copy link
Contributor Author

I solved removing /home/casatta/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secp256k1-sys-0.8.1/

I think using vscode I have inadvertently changed some source files thinking to operate on my git dir instead I was changing the downloaded registry

@apoelstra
Copy link
Member

Ok, cool, that makes sense. Though a little unfortunate that the tooling didn't notice. We had a similar-seeming issue at rust-lang/cargo#11897 and it seems to be unclear whether this is expected behavior.

@dpc
Copy link
Contributor

dpc commented Jul 17, 2023

BTW. cargo crev verify and cargo crev clean should be able to detect and fix issues like this, in case you have them installed already.

sanket1729 added a commit to ElementsProject/elements-miniscript that referenced this issue Sep 11, 2023
f6d0667 rust-elements 0.22.0 -> 0.23.0 (Riccardo Casatta)

Pull request description:

  Draft because requires:

  * release rust-elements 0.32 ElementsProject/rust-elements#170
  * ~~ElementsProject/rust-elements#169
  * ~~rust-bitcoin/rust-secp256k1#630

Top commit has no ACKs.

Tree-SHA512: 2986d7a32b7c2917343205d8d319ffa91eac7e255e126a27c3cb354485c10d441caaa3e5ce8b4b8b932b5081da5e2f428d912c56a78482d0e8862d0261b379af
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

3 participants