From 0e53e2624311272010d3ada6fcb191ded5e5b861 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 11 Apr 2020 16:41:14 +0200 Subject: [PATCH] mention size_of_val --- src/behavior-considered-undefined.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/behavior-considered-undefined.md b/src/behavior-considered-undefined.md index f3a27ad63..89c318a04 100644 --- a/src/behavior-considered-undefined.md +++ b/src/behavior-considered-undefined.md @@ -61,11 +61,11 @@ code. A reference/pointer is "dangling" if it is null or not all of the bytes it points to are part of the same allocation (so in particular they all have to be part of *some* allocation). The span of bytes it points to is determined by the -pointer value and the size of the pointee type. As a consequence, if the span is -empty, "dangling" is the same as "non-null". Note that slices point to their -entire range, so it is important that the length metadata is never too -large. In particular, allocations and therefore slices cannot be bigger than -`isize::MAX` bytes. +pointer value and the size of the pointee type (using `size_of_val`). As a +consequence, if the span is empty, "dangling" is the same as "non-null". Note +that slices point to their entire range, so it is important that the length +metadata is never too large. In particular, allocations and therefore slices +cannot be bigger than `isize::MAX` bytes. > **Note**: Undefined behavior affects the entire program. For example, calling > a function in C that exhibits undefined behavior of C means your entire