Termsslug: orphan-rule

Orphan Rule

孤儿规则

Rust coherence rule requiring at least one of trait or type to be local, otherwise raising E0117.

Curated Intelligence

1 items · Page 1/1
Hacker News AIT2·Tools
58 pts
Rust Orphan Rule Is Not a Dead End Three Legal Workarounds

The article argues that Rust's orphan rule (E0117), which forbids implementing foreign traits for foreign types, is not a hard wall but a design with wide legal openings. It systematically walks through several compliant workaround patterns beyond the NewType wrapper and highlights their value for validation and type erasure.