Skip to content

Commit f060791

Browse files
meithecatteGankra
authored andcommitted
Typo fixes
1 parent f76ba10 commit f060791

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/sixth-panics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl<T> LinkedList<T> {
172172

173173
What can panic here? Well, knowing that honestly requires you to be a bit of a Rust expert, but thankfully, I am!
174174

175-
The only places I can see in this code that *possibly* can panic (barring some absolute fuckery where someone recompiles the stdlib with debug_asserts enabled, but this is not something you should ever do) are Box::new (for out-of-memory conditions) and and the len arithmetic. All of that stuff is at the very end or very start of our methods, so yep, we're being nice and safe!
175+
The only places I can see in this code that *possibly* can panic (barring some absolute fuckery where someone recompiles the stdlib with debug_asserts enabled, but this is not something you should ever do) are `Box::new` (for out-of-memory conditions) and the len arithmetic. All of that stuff is at the very end or very start of our methods, so yep, we're being nice and safe!
176176

177-
...were you surprised by Box::new being able to panic? Panics will get you like that! Try to preserve those invariants so you don't need to worry about it!
177+
...were you surprised by `Box::new` being able to panic? Panics will get you like that! Try to preserve those invariants so you don't need to worry about it!
178178

src/sixth-variance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ See it doesn't compile eith-- wait what??? Vec is magic??????
9494

9595
Well, yes. But also, no. The magic was inside us all along, and that magic is ✨*Variance*✨.
9696

97-
Read the [nomicon's chapter on subtyping]([Variance](https://doc.rust-lang.org/nightly/nomicon/subtyping.html) if you want all the gorey details, but basically subtyping *isn't* always safe. In particular it's not safe when mutable references are involved because you can use things like `mem::swap` and suddenly oops dangling pointers!
97+
Read the [nomicon's chapter on subtyping](https://doc.rust-lang.org/nightly/nomicon/subtyping.html) if you want all the gorey details, but basically subtyping *isn't* always safe. In particular it's not safe when mutable references are involved because you can use things like `mem::swap` and suddenly oops dangling pointers!
9898

9999
Things that are "like mutable references" are *invariant* which means they block subtyping from happening on their generic parameters. So for safety, `&mut T` is invariant over T, and `Cell<T>` is invariant over T because `&Cell<T>` is basically just `&mut T` (because of interior mutability).
100100

0 commit comments

Comments
 (0)