External Publication
Visit Post

Too strict orphan rules E0117

Rust Internals [Unofficial] May 5, 2026
Source

PC-Killer:

Is it possible to correct the behavior?

it is not possible to correct the behavior because the behavior is correct.

PC-Killer:

Here we implement From<Option<Vec<T>> for Option<MyVec<T>>, and the compiler reports that we voilate the orphan rule. However, MyVec is defined in the scope, so there's no chance that a more specialized overload will be defined in any other modules.

i'm really not sure what you mean by "more specialized". what should stop downstream crates from mplementing impl<T> From<Option<Vec<LocalTy<T>>>> for Option<MyVec<LocalTy<T>>> ?

PC-Killer:

However the compiler just reports that Option<MyVec<i32>> is foreign, which is a little stupid.

its really not ; Option<MyVec<i32>> is local to the crate that defined Option, the same way MyVec<i32> is local to your crate, and not core, that defined i32.

PC-Killer:

This proves that similar case does make sense, while still being rejected by the compiler.

i am very confused as to what this is supposed to prove ?

this is the current orphan rule

Given impl<P1..=Pn> Trait<T1..=Tn> for T0, an impl is valid only if at least one of the following is true:

  • Trait is a local trait
  • All of
    • At least one of the types T0..=Tn must be a local type. Let Ti be the first such type.
    • No uncovered type parameters P1..=Pn may appear in T0..Ti (excluding Ti)

if you think you can make a better one that is sound, feel free to do so, but very smart people have worked a long time on making it as relaxed as possible

Discussion in the ATmosphere

Loading comments...