[GH-ISSUE #1946] trust-dns-proto version 0.22.0 compilation error on Rust stable 1.69.0 & nightly #828

Closed
opened 2026-03-16 00:27:22 +03:00 by kerem · 12 comments
Owner

Originally created by @freshtonic on GitHub (May 28, 2023).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1946

Describe the bug

Creating a new rust crate with trust-dns-proto version 0.22.0 as its sole dependency fails to compile.

Compiling trust-dns-proto v0.22.0
error[E0592]: duplicate definitions with name `is_soa`
   --> /Users/jamessadler/.cargo/registry/src/github.com-1ecc6299db9ec823/trust-dns-proto-0.22.0/src/rr/record_data.rs:55:17
    |
55  | #[derive(Debug, EnumAsInner, PartialEq, Clone, Eq)]
    |                 ^^^^^^^^^^^ duplicate definitions for `is_soa`
...
994 |     pub fn is_soa(&self) -> bool {
    |     ---------------------------- other definition for `is_soa`
    |
    = note: this error originates in the derive macro `EnumAsInner` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0592`.
error: could not compile `trust-dns-proto` due to previous error

To Reproduce
Steps to reproduce the behavior:

cargo new thowaway
cd throwaway
cargo add trust-dns-proto@0.22.0
cargo build

Expected behavior
A clear and concise description of what you expected to happen.

I expect the compilation to succeed.

System:

  • OS: macOS 13.1 & Ubuntu 22
  • Architecture: x86_64 & M1
  • rustc version: stable (1.69.0 & latst nightly)

Version:
Crate: trust-dns-proto
Version: 0.22.0

Additional context

Version 0.21.0 does not exhibit this issue, i.e. it compiles successfully

Originally created by @freshtonic on GitHub (May 28, 2023). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1946 **Describe the bug** Creating a new rust crate with `trust-dns-proto` version `0.22.0` as its sole dependency fails to compile. ``` Compiling trust-dns-proto v0.22.0 error[E0592]: duplicate definitions with name `is_soa` --> /Users/jamessadler/.cargo/registry/src/github.com-1ecc6299db9ec823/trust-dns-proto-0.22.0/src/rr/record_data.rs:55:17 | 55 | #[derive(Debug, EnumAsInner, PartialEq, Clone, Eq)] | ^^^^^^^^^^^ duplicate definitions for `is_soa` ... 994 | pub fn is_soa(&self) -> bool { | ---------------------------- other definition for `is_soa` | = note: this error originates in the derive macro `EnumAsInner` (in Nightly builds, run with -Z macro-backtrace for more info) For more information about this error, try `rustc --explain E0592`. error: could not compile `trust-dns-proto` due to previous error ``` **To Reproduce** Steps to reproduce the behavior: ``` cargo new thowaway cd throwaway cargo add trust-dns-proto@0.22.0 cargo build ``` **Expected behavior** A clear and concise description of what you expected to happen. I expect the compilation to succeed. **System:** - OS: macOS 13.1 & Ubuntu 22 - Architecture: x86_64 & M1 - rustc version: stable (1.69.0 & latst nightly) **Version:** Crate: trust-dns-proto Version: 0.22.0 **Additional context** Version 0.21.0 does not exhibit this issue, i.e. it compiles successfully
kerem closed this issue 2026-03-16 00:27:27 +03:00
Author
Owner

@trevyn commented on GitHub (May 28, 2023):

xref https://github.com/bluejekyll/enum-as-inner/issues/98

<!-- gh-comment-id:1565845013 --> @trevyn commented on GitHub (May 28, 2023): xref https://github.com/bluejekyll/enum-as-inner/issues/98
Author
Owner

@0cv commented on GitHub (May 28, 2023):

Adding enum-as-inner = "=0.5.1" to the Cargo.toml file "fixes" (temporarily) the issue

<!-- gh-comment-id:1566202251 --> @0cv commented on GitHub (May 28, 2023): Adding `enum-as-inner = "=0.5.1"` to the Cargo.toml file "fixes" (temporarily) the issue
Author
Owner

@dipk-mish7 commented on GitHub (May 30, 2023):

Hi Team, I got this error out of nowhere today when I tried to build locally. I fixed the issue by removing is_soa function from $HOME/.cargo/bin/cargo/registry/src/artifactory.my.company.com-c8223d652781490d/trust-dns-proto-0.22.0/src/rr/record_data.rs:55:17. However I am still getting same issue if I build dockerfile locally which I get in CI. Only the location of the file changes where I removed is_soa function.

My problem is I am getting same error in gitlab-ci, how do I fix that as it comes while building dockerfile and the location of the file changes if I build dockerfile in CI to /usr/local/cargo/registry/src/artifactory.my.company.com-c8223d652781490d/trust-dns-proto-0.22.0/src/rr/record_data.rs:55:17. Please find exact error below.

error[E0592]: duplicate definitions with name is_soa
--> /usr/local/cargo/registry/src/artifactory.my.company.com-c8223d652781490d/trust-dns-proto-0.22.0/src/rr/record_data.rs:55:17
|
55 | #[derive(Debug, EnumAsInner, PartialEq, Clone, Eq)]
| ^^^^^^^^^^^ duplicate definitions for is_soa
...
994 | pub fn is_soa(&self) -> bool {
| ---------------------------- other definition for is_soa
|
= note: this error originates in the derive macro EnumAsInner (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try rustc --explain E0592.
error: could not compile trust-dns-proto due to previous error

<!-- gh-comment-id:1568516334 --> @dipk-mish7 commented on GitHub (May 30, 2023): Hi Team, I got this error out of nowhere today when I tried to build locally. I fixed the issue by removing is_soa function from $HOME/.cargo/bin/cargo/registry/src/artifactory.my.company.com-c8223d652781490d/trust-dns-proto-0.22.0/src/rr/record_data.rs:55:17. However I am still getting same issue if I build dockerfile locally which I get in CI. Only the location of the file changes where I removed is_soa function. My problem is I am getting same error in gitlab-ci, how do I fix that as it comes while building dockerfile and the location of the file changes if I build dockerfile in CI to /usr/local/cargo/registry/src/artifactory.my.company.com-c8223d652781490d/trust-dns-proto-0.22.0/src/rr/record_data.rs:55:17. Please find exact error below. ----------------------------------------------------------------------------------------------------------------------------------- error[E0592]: duplicate definitions with name `is_soa` --> /usr/local/cargo/registry/src/artifactory.my.company.com-c8223d652781490d/trust-dns-proto-0.22.0/src/rr/record_data.rs:55:17 | 55 | #[derive(Debug, EnumAsInner, PartialEq, Clone, Eq)] | ^^^^^^^^^^^ duplicate definitions for `is_soa` ... 994 | pub fn is_soa(&self) -> bool { | ---------------------------- other definition for `is_soa` | = note: this error originates in the derive macro `EnumAsInner` (in Nightly builds, run with -Z macro-backtrace for more info) For more information about this error, try `rustc --explain E0592`. error: could not compile `trust-dns-proto` due to previous error
Author
Owner

@NobodyXu commented on GitHub (May 30, 2023):

@dipk-mish7 Try passing --locked to cargo and use enum-as-inner v0.5.1 in the Cargo.lock lockfile.

<!-- gh-comment-id:1568569247 --> @NobodyXu commented on GitHub (May 30, 2023): @dipk-mish7 Try passing `--locked` to `cargo` and use enum-as-inner v0.5.1 in the `Cargo.lock` lockfile.
Author
Owner

@dipk-mish7 commented on GitHub (May 31, 2023):

@NobodyXu where should I pass this? Is it cargo build -Z sparse-registry --locked ?
I have a docker file which I want to build Dockerfile
The base image I am using is rust:1.69.0.
Just an FYI now if I run cargo build -Z sparse-registry locally it gives me above issue but if I build Dockerfile it works just fine for me. Any guess? I have not changed anything.

<!-- gh-comment-id:1569644879 --> @dipk-mish7 commented on GitHub (May 31, 2023): @NobodyXu where should I pass this? Is it cargo build -Z sparse-registry --locked ? I have a docker file which I want to build [Dockerfile](https://github.com/svix/svix-webhooks/blob/main/server/Dockerfile) The base image I am using is rust:1.69.0. Just an FYI now if I run cargo build -Z sparse-registry locally it gives me above issue but if I build Dockerfile it works just fine for me. Any guess? I have not changed anything.
Author
Owner

@djc commented on GitHub (May 31, 2023):

You need to make sure you don't have enum-as-inner 0.5.2 in your Cargo.lock file. If you do that, everything should be fine.

<!-- gh-comment-id:1569650714 --> @djc commented on GitHub (May 31, 2023): You need to make sure you don't have enum-as-inner 0.5.2 in your `Cargo.lock` file. If you do that, everything should be fine.
Author
Owner

@dipk-mish7 commented on GitHub (May 31, 2023):

@djc As Cargo.lock gets generated on the fly and Its not recommended to manually change this.. I can see my enum-as-inner is set as :-

[[package]] name = "enum-as-inner" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", ]

How do I ensure the version gets updated to 0.5.2 by commands at the time of build.

<!-- gh-comment-id:1570181795 --> @dipk-mish7 commented on GitHub (May 31, 2023): @djc As `Cargo.lock` gets generated on the fly and Its not recommended to manually change this.. I can see my enum-as-inner is set as :- `[[package]] name = "enum-as-inner" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", ]` How do I ensure the version gets updated to 0.5.2 by commands at the time of build.
Author
Owner

@djc commented on GitHub (May 31, 2023):

You don't want to upgrade to 0.5.2, it was broken and is currently yanked. Stick to 0.5.1 for now.

<!-- gh-comment-id:1570186668 --> @djc commented on GitHub (May 31, 2023): You don't want to upgrade to 0.5.2, it was broken and is currently yanked. Stick to 0.5.1 for now.
Author
Owner

@NobodyXu commented on GitHub (May 31, 2023):

@dipk-mish7 The repository you linked contains Cargo.lock in git, so it's not generated on the fly but rather checked out in git.

How do I ensure the version gets updated to 0.5.2 by commands at the time of build.

You get it backwards: enum-as-inner 0.5.2 is buggy so you'd like it to be v0.5.1 instead

With enum-as-inner v0.5.2 yanked, this is no longer a problem, but I think it's better if you pass --locked when building your application @dipk-mish7

<!-- gh-comment-id:1570187218 --> @NobodyXu commented on GitHub (May 31, 2023): @dipk-mish7 The repository you [linked](https://github.com/svix/svix-webhooks/blob/main/server/Dockerfile) contains `Cargo.lock` in git, so it's not generated on the fly but rather checked out in git. > How do I ensure the version gets updated to 0.5.2 by commands at the time of build. You get it backwards: enum-as-inner 0.5.2 is buggy so you'd like it to be v0.5.1 instead With enum-as-inner v0.5.2 yanked, this is no longer a problem, but I think it's better if you pass `--locked` when building your application @dipk-mish7
Author
Owner

@dipk-mish7 commented on GitHub (May 31, 2023):

For some reasons I am able to build the Dockerfile with no issues. But If I run cargo build -Z sparse-registry --locked
It tries to find is_soa function .. I deleted it as suggested in the another github thread. Now I am not sure where to find this.
@NobodyXu It generates on the fly when I do cargo build.. If I delete target folder and cargo.lock it and do cargo build .. it will generate it. My docker environment for some reasons is working .. maybe because is_soa function is there and that's why it is working.. I was getting the issue yesterday even while building dockerfile.
image
image

<!-- gh-comment-id:1570310996 --> @dipk-mish7 commented on GitHub (May 31, 2023): For some reasons I am able to build the Dockerfile with no issues. But If I run `cargo build -Z sparse-registry --locked` It tries to find is_soa function .. I deleted it as suggested in the another github thread. Now I am not sure where to find this. @NobodyXu It generates on the fly when I do cargo build.. If I delete target folder and cargo.lock it and do cargo build .. it will generate it. My docker environment for some reasons is working .. maybe because is_soa function is there and that's why it is working.. I was getting the issue yesterday even while building dockerfile. ![image](https://github.com/bluejekyll/trust-dns/assets/52923075/fb142b97-2968-4e43-983b-c3464e8d0c7b) ![image](https://github.com/bluejekyll/trust-dns/assets/52923075/14bf9cec-c1a9-489e-b54a-c72792b84580)
Author
Owner

@NobodyXu commented on GitHub (May 31, 2023):

For some reasons I am able to build the Dockerfile with no issues.

That's because your repository contains the Cargo.lock

But If I run cargo build -Z sparse-registry --locked

Are you using nightly?
Sparse registries is supported on stable by setting environment variable CARGO_REGISTRIES_CRATES_IO_PROTOCOL to sparse.

<!-- gh-comment-id:1570398828 --> @NobodyXu commented on GitHub (May 31, 2023): > For some reasons I am able to build the Dockerfile with no issues. That's because your repository contains the [`Cargo.lock`] [`Cargo.lock`]: https://github.com/svix/svix-webhooks/blob/main/server/Cargo.lock > But If I run cargo build -Z sparse-registry --locked Are you using nightly? Sparse registries is supported on stable by setting environment variable `CARGO_REGISTRIES_CRATES_IO_PROTOCOL` to `sparse`.
Author
Owner

@djc commented on GitHub (May 31, 2023):

@dipk-mish7 it appears you don't yet have much experience with the basic functions of Cargo. Please consider seeking help in a more appropriate forum (like https://users.rust-lang.org/).

<!-- gh-comment-id:1570432734 --> @djc commented on GitHub (May 31, 2023): @dipk-mish7 it appears you don't yet have much experience with the basic functions of Cargo. Please consider seeking help in a more appropriate forum (like https://users.rust-lang.org/).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#828
No description provided.