You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/src/clauses/coherence.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ This document was previously prepared for the initial design of coherence rules
7
7
>
8
8
> The role of the orphan rules in particular is basically to prevent you from implementing external traits for external types. So continuing our simple example of `Show`, if you are defining your own library, you could not implement `Show` for `Vec<T>`, because both `Show` and `Vec` are defined in the standard library. But you can implement `Show` for `MyType`, because you defined `MyType`. However, if you define your own trait `MyTrait`, then you can implement `MyTrait` for any type you like, including external types like `Vec<T>`. To this end, the orphan rule intuitively says “either the trait must be local or the self-type must be local”.
9
9
>
10
-
> -- [Little Orphan Impls](http://smallcultfollowing.com/babysteps/blog/2015/01/14/little-orphan-impls/) by Niko Matsakis
10
+
> -- [Little Orphan Impls](https://smallcultfollowing.com/babysteps/blog/2015/01/14/little-orphan-impls/) by Niko Matsakis
11
11
12
12
To check for coherence, the Rust compiler completes two separate but related checks:
13
13
@@ -17,9 +17,9 @@ To check for coherence, the Rust compiler completes two separate but related che
17
17
-**compatible** - any semver compatible world
18
18
# Resources About Coherence
19
19
-[Coherence - talk by withoutboats](https://air.mozilla.org/rust-meetup-march-2017/)
-[E0210: A violation of the orphan rules in the](https://doc.rust-lang.org/error-index.html#E0210)[*Rust Error Index*](https://doc.rust-lang.org/error-index.html#E0210)
47
-
-[*Little Orphan Impls*](http://smallcultfollowing.com/babysteps/blog/2015/01/14/little-orphan-impls/)[by Niko Matsakis](http://smallcultfollowing.com/babysteps/blog/2015/01/14/little-orphan-impls/)
47
+
-[*Little Orphan Impls*](https://smallcultfollowing.com/babysteps/blog/2015/01/14/little-orphan-impls/)[by Niko Matsakis](https://smallcultfollowing.com/babysteps/blog/2015/01/14/little-orphan-impls/)
48
48
49
49
Of all of these, RFC 1023 is probably considered the most authoritative source on the orphan rules. The orphan rules as proposed in that RFC are as follows:
50
50
@@ -168,7 +168,7 @@ The conclusion from all of this is that it is perfectly safe to rule out impls t
168
168
169
169
## Discussion: Modelling the Overlap Check
170
170
171
-
[Aaron’s excellent blog post](http://aturon.github.io/blog/2017/04/24/negative-chalk/) talks about this exact problem from the point of view of negative reasoning. It also describes a potential solution which we will apply here to solve our problem.
171
+
[Aaron’s excellent blog post](https://aturon.github.io/blog/2017/04/24/negative-chalk/) talks about this exact problem from the point of view of negative reasoning. It also describes a potential solution which we will apply here to solve our problem.
172
172
173
173
The **compatible modality** (`compat` in Aaron’s blog post) is necessary because we don’t always want to assume that all compatible impls exist. In particular, there are certain phases of compilation (e.g. trans) where the closed-world assumption is entirely necessary and sufficient.
0 commit comments