]> git.lizzy.rs Git - rust.git/commitdiff
Fix variance ordering
authorAlexis Beingessner <a.beingessner@gmail.com>
Tue, 4 Aug 2015 22:09:47 +0000 (15:09 -0700)
committerAlexis Beingessner <a.beingessner@gmail.com>
Tue, 4 Aug 2015 22:25:37 +0000 (15:25 -0700)
I thought this was actually a huge error and I'd have to rewrite a bunch but
it looks like everything else was correct.

Closes #27457

src/doc/nomicon/subtyping.md

index 3c57297f323cc7ad69f2545c148886a5e1d1a50a..65dcb6a94e13ccbf9aec33415fc638525202f9b9 100644 (file)
@@ -93,8 +93,8 @@ fn main() {
 
 The signature of `overwrite` is clearly valid: it takes mutable references to
 two values of the same type, and overwrites one with the other. If `&mut T` was
-variant over T, then `&mut &'a str` would be a subtype of `&mut &'static str`,
-since `&'a str` is a subtype of `&'static str`. Therefore the lifetime of
+variant over T, then `&mut &'static str` would be a subtype of `&mut &'a str`,
+since `&'static str` is a subtype of `&'a str`. Therefore the lifetime of
 `forever_str` would successfully be "shrunk" down to the shorter lifetime of
 `string`, and `overwrite` would be called successfully. `string` would
 subsequently be dropped, and `forever_str` would point to freed memory when we