clarify subtyping

This commit is contained in:
Alexis Beingessner 2015-07-28 15:41:58 -07:00
parent 9123bb02ca
commit b539906de1

View file

@ -1,9 +1,9 @@
% Subtyping and Variance
Although Rust doesn't have any notion of inheritance, it *does* include
subtyping. In Rust, subtyping derives entirely from *lifetimes*. Since lifetimes
are scopes, we can partially order them based on the *contains* (outlives)
relationship. We can even express this as a generic bound.
Although Rust doesn't have any notion of structural inheritance, it *does*
include subtyping. In Rust, subtyping derives entirely from *lifetimes*. Since
lifetimes are scopes, we can partially order them based on the *contains*
(outlives) relationship. We can even express this as a generic bound.
Subtyping on lifetimes in terms of that relationship: if `'a: 'b` ("a contains
b" or "a outlives b"), then `'a` is a subtype of `'b`. This is a large source of