rust-orphan-rules icon indicating copy to clipboard operation
rust-orphan-rules copied to clipboard

A Brief History of Rust's Orphan Rules

Open Ixrec opened this issue 6 years ago • 2 comments

Please comment if I missed anything significant.


Mar 2014 - RFC #19 "Opt-in builtin traits" is posted and accepted. This RFC discussed the special case in the coherence rules we need for OIBITs/auto traits.

Apr 2014 - RFC #48 "Trait reform" covers a lot of ground, but one of its many goals was to "Expand coherence rules to operate recursively and distinguish orphans more carefully." I think this is the first RFC to explicitly define and discuss coherence, and state that it's enforced through a combination of overlap and orphan rules.

Jun 2014 - RFC #127 "Opt-in builtin traits, take 2: default and negative impls" is posted. At least for me, it's much easier to understand the special case here than it was in RFC #19: "Negative impls are subject to the usual orphan rules, but they are permitting to be overlapping. This makes sense because negative impls are not providing an implementation ..."

Sep 2014 - RFC #127 "Opt-in builtin traits, take 2: default and negative impls" is accepted.

Jan 2015 - RFC #586 "Negative bounds" is posted. Technically only changes the overlap rules, not the orphan rules, but this might cover some of the use cases that make people suggest orphan rule changes.

Jan 2015 - Niko's "Little Orphan Impls" blog post. If you're still wondering why coherence/orphan rules are such a hard problem, this is the one link you should definitely read.

Mar 2015 - RFC #1023 "Rebalancing Coherence" is posted. This is the RFC that introduced the #[fundamental] attribute. It was accepted and implemented a month later in April.

Apr 2015 - RFC #586 "Negative bounds" is postponed because "There is too much in flight."

Apr 2015 - RFC #1023 "Rebalancing Coherence" is accepted and implemented.

May 2015 - Rust 1.0 released. 🎉

Jun 2015 - RFC #1148 "Mutually exclusive traits" is posted.

Jun 2015 - RFC #1210 "impl specialization" is posted. Technically only changes the overlap rules, not the orphan rules, but this might cover some of the use cases that make people suggest orphan rule changes.

Feb 2016 - RFC #1210 "impl specialization" is accepted.

Apr 2016 - RFC #1148 "Mutually exclusive traits" is postponed because "it makes sense to wait until the specialization implementation has progressed a bit farther before we make any decision here." but "there will be a role for negative reasoning", and "the broad outlines of this RFC are correct."

Jan 2017 - Rust issue #1856 "Orphan rules are stricter than we would like" is created, and most of the discussion on it happens this same month. This appears to contain the most recent opinions of several core team members on the precise orphan rules and how to improve them.

May 2017 - RFC #2451 "Re-Rebalancing Coherence" is posted.

Jul 2017 - RFC #2052 "Evolving Rust through Epochs" is posted. I'm including this because of the explicit statement that "Trait coherence rules, like the "orphan" rule" cannot be changed via editions.

Apr 2018 - Aturon's "Sound and ergonomic specialization for Rust" blog post. There are many other blog posts about why specialization soundness is hard, but I think this is the most recent one and represents the current status.

Oct 2018 - RFC #2451 "Re-Rebalancing Coherence" is accepted.

Jan 2019 - RFC #2451 "Re-Rebalancing Coherence" is implemented.

Ixrec avatar Jul 07 '18 21:07 Ixrec

January 2020, negative impl for non-auto-traits feature lands in order to close a soundness hole. To be RFC'd or discarded eventually; implications to the language TBD.

QuineDot avatar Aug 14 '21 04:08 QuineDot