Merge pull request #493 from senekor/senekor-rrqpxsznswmt

Use consistent type parameters in subtyping.md
master
Yuki Okushi 1 month ago committed by GitHub
commit dd31c8d397
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -139,7 +139,7 @@ If we remember from the above examples,
it was ok for us to treat `&'a T` as a subtype of `&'b T` if `'a <: 'b`, it was ok for us to treat `&'a T` as a subtype of `&'b T` if `'a <: 'b`,
therefore we can say that `&'a T` is *covariant* over `'a`. therefore we can say that `&'a T` is *covariant* over `'a`.
Also, we saw that it was not ok for us to treat `&mut &'a U` as a subtype of `&mut &'b U`, Also, we saw that it was not ok for us to treat `&mut &'a T` as a subtype of `&mut &'b T`,
therefore we can say that `&mut T` is *invariant* over `T` therefore we can say that `&mut T` is *invariant* over `T`
Here is a table of some other generic types and their variances: Here is a table of some other generic types and their variances:

Loading…
Cancel
Save