clarify subtyping

pull/10/head
Alexis Beingessner 9 years ago committed by Manish Goregaokar
parent 56fd7834f6
commit efe5b1b79e

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

Loading…
Cancel
Save