From 70db9e4189f64d1d8e2451b1046111fb356b6dc2 Mon Sep 17 00:00:00 2001 From: gftea <1705787+gftea@users.noreply.github.com> Date: Mon, 27 Jun 2022 13:47:21 +0200 Subject: [PATCH] should be `size_of` instead of `align_of` (#371) --- src/vec/vec-alloc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vec/vec-alloc.md b/src/vec/vec-alloc.md index 6c69c93..1e4945b 100644 --- a/src/vec/vec-alloc.md +++ b/src/vec/vec-alloc.md @@ -10,7 +10,7 @@ just put some other garbage in there! This is perfectly fine because we already have `cap == 0` as our sentinel for no allocation. We don't even need to handle it specially in almost any code because we usually need to check if `cap > len` or `len > 0` anyway. The recommended -Rust value to put here is `mem::align_of::()`. `NonNull` provides a convenience +Rust value to put here is `mem::size_of::()`. `NonNull` provides a convenience for this: `NonNull::dangling()`. There are quite a few places where we'll want to use `dangling` because there's no real allocation to talk about but `null` would make the compiler do bad things.