Skip to content

Commit 8d1e4dc

Browse files
5225225Gankra
authored andcommitted
Should be align_of instead of size_of
1 parent 70db9e4 commit 8d1e4dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/vec/vec-alloc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ just put some other garbage in there!
1010
This is perfectly fine because we already have `cap == 0` as our sentinel for no
1111
allocation. We don't even need to handle it specially in almost any code because
1212
we usually need to check if `cap > len` or `len > 0` anyway. The recommended
13-
Rust value to put here is `mem::size_of::<T>()`. `NonNull` provides a convenience
13+
Rust value to put here is `mem::align_of::<T>()`. `NonNull` provides a convenience
1414
for this: `NonNull::dangling()`. There are quite a few places where we'll
1515
want to use `dangling` because there's no real allocation to talk about but
1616
`null` would make the compiler do bad things.

0 commit comments

Comments
 (0)