[GH-ISSUE #1824] proto::rr::domain::Label implements trait Borrow but does not fulfil requirements #783

Open
opened 2026-03-16 00:13:55 +03:00 by kerem · 2 comments
Owner

Originally created by @kaimaera on GitHub (Nov 5, 2022).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1824

github.com/bluejekyll/trust-dns@f7128a1a58/crates/proto/src/rr/domain/label.rs (L221-L225)

From Borrow:

In particular Eq, Ord and Hash must be equivalent for borrowed and owned values: x.borrow() == y.borrow() should give the same result as x == y.

However, Label implements Ord using an ASCII case insensitive comparison. cmp(x, b) != cmp(x.borrow(), y.borrow()). Same for PartialEq.

Originally created by @kaimaera on GitHub (Nov 5, 2022). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1824 https://github.com/bluejekyll/trust-dns/blob/f7128a1a582af3e7ea2c5dbac28363afe2757bc9/crates/proto/src/rr/domain/label.rs#L221-L225 From [Borrow](https://doc.rust-lang.org/std/borrow/trait.Borrow.html): > In particular Eq, Ord and Hash must be equivalent for borrowed and owned values: x.borrow() == y.borrow() should give the same result as x == y. However, Label implements Ord using an ASCII case insensitive comparison. cmp(x, b) != cmp(x.borrow(), y.borrow()). Same for PartialEq.
Author
Owner

@djc commented on GitHub (Nov 7, 2022):

Nice catch! Do you want to propose a fix, ideally as a PR?

<!-- gh-comment-id:1305308211 --> @djc commented on GitHub (Nov 7, 2022): Nice catch! Do you want to propose a fix, ideally as a PR?
Author
Owner

@kaimaera commented on GitHub (Nov 7, 2022):

Sure, I'll find some time this week.

<!-- gh-comment-id:1306125416 --> @kaimaera commented on GitHub (Nov 7, 2022): Sure, I'll find some time this week.
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#783
No description provided.