Skip to content

Commit 731d375

Browse files
authored
Auto merge of #34294 - alexandermerritt:book-nuls, r=steveklabnik
Correct use of 'nul' 'null' and capitalization in the book r? @steveklabnik
2 parents ec58d0c + 161ba12 commit 731d375

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/doc/book/ffi.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,14 @@ against `libc` and `libm` by default.
521521

522522
# The "nullable pointer optimization"
523523

524-
Certain types are defined to not be `null`. This includes references (`&T`,
524+
Certain types are defined to not be NULL. This includes references (`&T`,
525525
`&mut T`), boxes (`Box<T>`), and function pointers (`extern "abi" fn()`).
526-
When interfacing with C, pointers that might be null are often used.
526+
When interfacing with C, pointers that might be NULL are often used.
527527
As a special case, a generic `enum` that contains exactly two variants, one of
528528
which contains no data and the other containing a single field, is eligible
529529
for the "nullable pointer optimization". When such an enum is instantiated
530530
with one of the non-nullable types, it is represented as a single pointer,
531-
and the non-data variant is represented as the null pointer. So
531+
and the non-data variant is represented as the NULL pointer. So
532532
`Option<extern "C" fn(c_int) -> c_int>` is how one represents a nullable
533533
function pointer using the C ABI.
534534

src/doc/book/raw-pointers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Here are some things to remember about raw pointers that are different than
1717
other pointer types. They:
1818

1919
- are not guaranteed to point to valid memory and are not even
20-
guaranteed to be non-null (unlike both `Box` and `&`);
20+
guaranteed to be non-NULL (unlike both `Box` and `&`);
2121
- do not have any automatic clean-up, unlike `Box`, and so require
2222
manual resource management;
2323
- are plain-old-data, that is, they don't move ownership, again unlike

src/doc/book/strings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ strings also work differently than in some other systems languages, such as C.
99
Let’s dig into the details. A ‘string’ is a sequence of Unicode scalar values
1010
encoded as a stream of UTF-8 bytes. All strings are guaranteed to be a valid
1111
encoding of UTF-8 sequences. Additionally, unlike some systems languages,
12-
strings are not null-terminated and can contain null bytes.
12+
strings are not NUL-terminated and can contain NUL bytes.
1313

1414
Rust has two main types of strings: `&str` and `String`. Let’s talk about
1515
`&str` first. These are called ‘string slices’. A string slice has a fixed

src/doc/book/unsafe.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ In addition, the following are all undefined behaviors in Rust, and must be
6363
avoided, even when writing `unsafe` code:
6464

6565
* Data races
66-
* Dereferencing a null/dangling raw pointer
66+
* Dereferencing a NULL/dangling raw pointer
6767
* Reads of [undef][undef] (uninitialized) memory
6868
* Breaking the [pointer aliasing rules][aliasing] with raw pointers.
6969
* `&mut T` and `&T` follow LLVM’s scoped [noalias][noalias] model, except if
@@ -77,7 +77,7 @@ avoided, even when writing `unsafe` code:
7777
* Using `std::ptr::copy_nonoverlapping_memory` (`memcpy32`/`memcpy64`
7878
intrinsics) on overlapping buffers
7979
* Invalid values in primitive types, even in private fields/locals:
80-
* Null/dangling references or boxes
80+
* NULL/dangling references or boxes
8181
* A value other than `false` (0) or `true` (1) in a `bool`
8282
* A discriminant in an `enum` not included in its type definition
8383
* A value in a `char` which is a surrogate or above `char::MAX`

0 commit comments

Comments
 (0)