[GH-ISSUE #2017] RecordType does not implement Deserialize... but it does? #851

Closed
opened 2026-03-16 00:34:51 +03:00 by kerem · 3 comments
Owner

Originally created by @cetanu on GitHub (Sep 4, 2023).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2017

Describe the bug
Trying to just include the RecordType in a struct which derives Deserialize and it's not working

To Reproduce
code:

// main.rs
use serde::Deserialize;
use trust_dns_client::rr::RecordType;

#[derive(Deserialize)]
struct Test {
    test: RecordType,
}

fn main() {
    println!("Hello, world!");
}
# Cargo.toml
[package]
name = "test"
version = "0.1.0"
edition = "2021"

[dependencies]
trust-dns-client = {version = "0.23", features = ["serde-config"]}
serde = {version = "*", features = ["derive"]}

Expected behavior
RecordType is compiled with Deserialize due to the serde-config feature being used

Actual behavior

error[E0277]: the trait bound `RecordType: Deserialize<'_>` is not satisfied
    --> src/main.rs:6:11
     |
6    |     test: RecordType,
     |           ^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `RecordType`
     |
     = help: the following other types implement trait `Deserialize<'de>`:
               &'a Path
               &'a [u8]
               &'a str
               ()
               (T0, T1)
               (T0, T1, T2)
               (T0, T1, T2, T3)
               (T0, T1, T2, T3, T4)
             and 129 others
note: required by a bound in `next_element`
    --> /Users/redacted/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/src/de/mod.rs:1724:12
     |
1724 |         T: Deserialize<'de>,
     |            ^^^^^^^^^^^^^^^^ required by this bound in `SeqAccess::next_element`

error[E0277]: the trait bound `RecordType: Deserialize<'_>` is not satisfied
    --> src/main.rs:6:11
     |
6    |     test: RecordType,
     |           ^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `RecordType`
     |
     = help: the following other types implement trait `Deserialize<'de>`:
               &'a Path
               &'a [u8]
               &'a str
               ()
               (T0, T1)
               (T0, T1, T2)
               (T0, T1, T2, T3)
               (T0, T1, T2, T3, T4)
             and 129 others
note: required by a bound in `next_value`
    --> /Users/redacted/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/src/de/mod.rs:1863:12
     |
1863 |         V: Deserialize<'de>,
     |            ^^^^^^^^^^^^^^^^ required by this bound in `MapAccess::next_value`

error[E0277]: the trait bound `RecordType: Deserialize<'_>` is not satisfied
  --> src/main.rs:6:5
   |
6  |     test: RecordType,
   |     ^^^^^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `RecordType`
   |
   = help: the following other types implement trait `Deserialize<'de>`:
             &'a Path
             &'a [u8]
             &'a str
             ()
             (T0, T1)
             (T0, T1, T2)
             (T0, T1, T2, T3)
             (T0, T1, T2, T3, T4)
           and 129 others
note: required by a bound in `_serde::__private::de::missing_field`
  --> /Users/redacted/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/src/private/de.rs:25:8
   |
25 |     V: Deserialize<'de>,
   |        ^^^^^^^^^^^^^^^^ required by this bound in `missing_field`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `test` (bin "test") due to 3 previous errors

System:

  • OS: macos
  • Architecture: arm64
  • Version 13.5
  • rustc version: 1.71 nightly

Version:
Crate: trusty-dns-client
Version: 0.23

Originally created by @cetanu on GitHub (Sep 4, 2023). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2017 **Describe the bug** Trying to just include the `RecordType` in a struct which derives `Deserialize` and it's not working **To Reproduce** code: ```rust // main.rs use serde::Deserialize; use trust_dns_client::rr::RecordType; #[derive(Deserialize)] struct Test { test: RecordType, } fn main() { println!("Hello, world!"); } ``` ```toml # Cargo.toml [package] name = "test" version = "0.1.0" edition = "2021" [dependencies] trust-dns-client = {version = "0.23", features = ["serde-config"]} serde = {version = "*", features = ["derive"]} ``` **Expected behavior** `RecordType` is compiled with `Deserialize` due to the `serde-config` feature being used **Actual behavior** ``` error[E0277]: the trait bound `RecordType: Deserialize<'_>` is not satisfied --> src/main.rs:6:11 | 6 | test: RecordType, | ^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `RecordType` | = help: the following other types implement trait `Deserialize<'de>`: &'a Path &'a [u8] &'a str () (T0, T1) (T0, T1, T2) (T0, T1, T2, T3) (T0, T1, T2, T3, T4) and 129 others note: required by a bound in `next_element` --> /Users/redacted/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/src/de/mod.rs:1724:12 | 1724 | T: Deserialize<'de>, | ^^^^^^^^^^^^^^^^ required by this bound in `SeqAccess::next_element` error[E0277]: the trait bound `RecordType: Deserialize<'_>` is not satisfied --> src/main.rs:6:11 | 6 | test: RecordType, | ^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `RecordType` | = help: the following other types implement trait `Deserialize<'de>`: &'a Path &'a [u8] &'a str () (T0, T1) (T0, T1, T2) (T0, T1, T2, T3) (T0, T1, T2, T3, T4) and 129 others note: required by a bound in `next_value` --> /Users/redacted/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/src/de/mod.rs:1863:12 | 1863 | V: Deserialize<'de>, | ^^^^^^^^^^^^^^^^ required by this bound in `MapAccess::next_value` error[E0277]: the trait bound `RecordType: Deserialize<'_>` is not satisfied --> src/main.rs:6:5 | 6 | test: RecordType, | ^^^^^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `RecordType` | = help: the following other types implement trait `Deserialize<'de>`: &'a Path &'a [u8] &'a str () (T0, T1) (T0, T1, T2) (T0, T1, T2, T3) (T0, T1, T2, T3, T4) and 129 others note: required by a bound in `_serde::__private::de::missing_field` --> /Users/redacted/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.188/src/private/de.rs:25:8 | 25 | V: Deserialize<'de>, | ^^^^^^^^^^^^^^^^ required by this bound in `missing_field` For more information about this error, try `rustc --explain E0277`. error: could not compile `test` (bin "test") due to 3 previous errors ``` **System:** - OS: macos - Architecture: arm64 - Version 13.5 - rustc version: 1.71 nightly **Version:** Crate: trusty-dns-client Version: 0.23
kerem 2026-03-16 00:34:51 +03:00
  • closed this issue
  • added the
    bug
    tools
    labels
Author
Owner

@djc commented on GitHub (Sep 4, 2023):

It looks like there's a bug in that the trust-dns-client isn't forwarding the serde-config flag to its dependency on trust-dns-proto, which is where RecordType actually lives. Can you send a PR?

<!-- gh-comment-id:1705451488 --> @djc commented on GitHub (Sep 4, 2023): It looks like there's a bug in that the trust-dns-client isn't forwarding the `serde-config` flag to its dependency on trust-dns-proto, which is where `RecordType` actually lives. Can you send a PR?
Author
Owner

@cetanu commented on GitHub (Sep 5, 2023):

TIL how to forward features onto other crates, I think the linked PR is the fix?

I'm not sure how to add tests for this (or if they are wanted)

<!-- gh-comment-id:1707409967 --> @cetanu commented on GitHub (Sep 5, 2023): TIL how to forward features onto other crates, I think the linked PR is the fix? I'm not sure how to add tests for this (or if they are wanted)
Author
Owner

@djc commented on GitHub (Sep 6, 2023):

I don't think we need tests for this.

<!-- gh-comment-id:1707673286 --> @djc commented on GitHub (Sep 6, 2023): I don't think we need tests for this.
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#851
No description provided.