Skip to content

Commit bec3afe

Browse files
PoorlyDefinedBehaviourGankra
authored andcommitted
fix: typo
1 parent db8387a commit bec3afe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sixth-variance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<T> NonNull<T> {
148148

149149
NOPE. NO MAGIC HERE! NonNull just abuses the fact that `*const T` is covariant and stores that instead, casting back and forth between `*mut T` at the API boundary to make it "look like" it's storing a `*mut T`. That's the whole trick! That's how collections in Rust are covariant! And it's miserable! So I made the Good Pointer Type do it for you! You're welcome! Enjoy your subtyping footgun!
150150

151-
The solution to all your problems it to use NonNull, and then if you want to have nullable pointers again, use `Option<NonNull<T>>`. Are we really going to bother doing that..?
151+
The solution to all your problems is to use NonNull, and then if you want to have nullable pointers again, use `Option<NonNull<T>>`. Are we really going to bother doing that..?
152152

153153
Yep! It sucks, but we're making *production grade linked lists* so we're going to eat all our vegetables and do things the hard way (we could just use bare `*const T` and cast everywhere, but I genuinely want to see how painful this is... for Ergonomics Science).
154154

0 commit comments

Comments
 (0)