From e66bfc1780f911e89029946f883fc8f699a89c5f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 30 Aug 2026 15:00:33 +0000 Subject: [PATCH] Remove leftover `types/textual.md` file When we split the textual types chapter into the `char` and `str` chapters, we neglected to delete the old file and to repoint a redirect away from the old chapter. Let's do those things. --- book.toml | 2 +- src/types/textual.md | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 src/types/textual.md diff --git a/book.toml b/book.toml index 98697bf6c2..b792c714be 100644 --- a/book.toml +++ b/book.toml @@ -83,7 +83,7 @@ use-boolean-and = true "/types.html#shared-references-" = "types/pointer.html#shared-references-" "/types.html#smart-pointers" = "types/pointer.html#smart-pointers" "/types.html#struct-types" = "types/struct.html" -"/types.html#textual-types" = "types/textual.html" +"/types.html#textual-types" = "types/char.html" "/types.html#trait-object-lifetime-bounds" = "types/trait-object.html#trait-object-lifetime-bounds" "/types.html#trait-objects" = "types/trait-object.html" "/types.html#tuple-types" = "types/tuple.html" diff --git a/src/types/textual.md b/src/types/textual.md deleted file mode 100644 index 05068309a7..0000000000 --- a/src/types/textual.md +++ /dev/null @@ -1,30 +0,0 @@ -r[type.text] -# Textual types - -r[type.text.intro] -The types `char` and `str` hold textual data. - -r[type.text.char-value] -A value of type `char` is a [Unicode scalar value] (i.e. a code point that is not a surrogate), represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF or 0xE000 to 0x10FFFF range. - -r[type.text.char-precondition] -It is immediate [undefined behavior] to create a `char` that falls outside this range. A `[char]` is effectively a UCS-4 / UTF-32 string of length 1. - -r[type.text.str-value] -A value of type `str` is represented the same way as `[u8]`, a slice of 8-bit unsigned bytes. However, the Rust standard library makes extra assumptions about `str`: methods working on `str` assume and ensure that the data in there is valid UTF-8. Calling a `str` method with a non-UTF-8 buffer can cause [undefined behavior] now or in the future. - -r[type.text.str-unsized] -Since `str` is a [dynamically sized type], it can only be instantiated through a pointer type, such as `&str`. The layout of `&str` is the same as the layout of `&[u8]`. - -r[type.text.layout] -## Layout and bit validity - -r[type.layout.char-layout] -`char` is guaranteed to have the same size and alignment as `u32` on all platforms. - -r[type.layout.char-validity] -Every byte of a `char` is guaranteed to be initialized (in other words, `transmute::()]>(...)` is always sound -- but since some bit patterns are invalid `char`s, the inverse is not always sound). - -[Unicode scalar value]: http://www.unicode.org/glossary/#unicode_scalar_value -[undefined behavior]: ../behavior-considered-undefined.md -[dynamically sized type]: ../dynamically-sized-types.md