Skip to content

Commit 7a93c08

Browse files
authored
Merge pull request #76 from hynek/patch-1
Fix definition of contravariance
2 parents 13e3745 + d9abcb6 commit 7a93c08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/subtyping.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ For instance `Vec` is a type constructor that takes a `T` and returns a
6464
`Vec<T>`. `&` and `&mut` are type constructors that take two inputs: a
6565
lifetime, and a type to point to.
6666

67-
A type constructor's *variance* is how the subtyping of its inputs affects the
67+
A type constructor F's *variance* is how the subtyping of its inputs affects the
6868
subtyping of its outputs. There are three kinds of variance in Rust:
6969

7070
* F is *covariant* over `T` if `T` being a subtype of `U` implies
7171
`F<T>` is a subtype of `F<U>` (subtyping "passes through")
7272
* F is *contravariant* over `T` if `T` being a subtype of `U` implies
73-
`F<U>` is a subtype of `F<U>` (subtyping is "inverted")
73+
`F<U>` is a subtype of `F<T>` (subtyping is "inverted")
7474
* F is *invariant* over `T` otherwise (no subtyping relation can be derived)
7575

7676
It should be noted that covariance is *far* more common and important than

0 commit comments

Comments
 (0)