@@ -63,18 +63,18 @@ local or not has nothing to do with type parameters. Given `trait Foo<T, U>`,
63
63
64
64
Local Type: A struct, enum, or union which was defined in the current crate.
65
65
This is not affected by type parameters. ` struct Foo ` is considered local, but
66
- ` Vec<Foo> ` is not. ` LocalType<ForeignType> ` is local. Type aliases do not affect
67
- locality.
66
+ ` Vec<Foo> ` is not. ` LocalType<ForeignType> ` is local. Type aliases and trait
67
+ aliases do not affect locality.
68
68
69
69
Covered Type: A type which appears as a parameter to another type. For example,
70
- ` T ` is uncovered, but ` Vec<T> ` is covered. This is only relevant for type
71
- parameters.
70
+ ` T ` is uncovered, but the ` T ` in ` Vec<T> ` is covered. This is only relevant for
71
+ type parameters.
72
72
73
73
Blanket Impl: Any implementation where a type appears uncovered. `impl<T > Foo
74
74
for T` , ` impl<T > Bar<T > for T` , ` impl<T > Bar<Vec<T >> for T` , and ` impl<T > Bar<T >
75
75
for Vec<T >` are considered blanket impls. However, ` impl<T > Bar<Vec<T >> for
76
- Vec<T >` is not a blanket impl, as all types which appear in this impl are
77
- covered by ` Vec ` .
76
+ Vec<T >` is not a blanket impl, as all instances of ` T` which appear in this impl
77
+ are covered by ` Vec ` .
78
78
79
79
Fundamental Type: A type for which you cannot add a blanket impl backwards
80
80
compatibly. This includes ` & ` , ` &mut ` , and ` Box ` . Any time a type ` T ` is
@@ -93,7 +93,8 @@ implementation to use.
93
93
In languages without coherence, the compiler has to have some way to choose
94
94
which implementation to use when multiple implementations could apply. Scala
95
95
does this by having complex scope resolution rules for "implicit" parameters.
96
- Haskell does this by picking one at random.
96
+ Haskell (when a discouraged flag is enabled) does this by picking an impl
97
+ arbitrarily.
97
98
98
99
Rust's solution is to enforce that there is only one impl to choose from at all.
99
100
While the rules required to enforce this are quite complex, the result is easy
0 commit comments