Consequences of breaking the orphan rule

⚓ Rust    📅 2025-06-29    👤 surdeus    👁️ 5      

surdeus

Warning

This post was published 41 days ago. The information described in this article may have changed.

The rule is explained here, where it says:

An orphan implementation is one that implements a foreign trait for a foreign type.

And explains why:

If these were freely allowed, two crates could implement the same trait for the same type in incompatible ways, creating a situation where adding or updating a dependency could break compilation due to conflicting implementations.

I'm trying to follow the text to find the issue i.e how two orphan implementations are a problem.

I take two crates that implement the foreign trait on a foreign struct. The homonym structs would operate differently since the associated functions are implemented differently.

I am unsure how the update of dependencies turns it into a problem.

9 posts - 4 participants

Read full topic

🏷️ rust_feed