We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
align_of
size_of
1 parent 70db9e4 commit 8d1e4dcCopy full SHA for 8d1e4dc
src/vec/vec-alloc.md
@@ -10,7 +10,7 @@ just put some other garbage in there!
10
This is perfectly fine because we already have `cap == 0` as our sentinel for no
11
allocation. We don't even need to handle it specially in almost any code because
12
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
+Rust value to put here is `mem::align_of::<T>()`. `NonNull` provides a convenience
14
for this: `NonNull::dangling()`. There are quite a few places where we'll
15
want to use `dangling` because there's no real allocation to talk about but
16
`null` would make the compiler do bad things.
0 commit comments