From: LukeMathWalker <20745048+LukeMathWalker@users.noreply.github.com> Date: Mon, 13 May 2024 19:10:54 +0000 (+0200) Subject: Complete section on read-only data segment. X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=602ce11299c339834636cab30c48c98cab0e43a3;p=rust_exercises.git Complete section on read-only data segment. --- diff --git a/book/src/07_threads/02_static.md b/book/src/07_threads/02_static.md index f209583..4c88289 100644 --- a/book/src/07_threads/02_static.md +++ b/book/src/07_threads/02_static.md @@ -104,9 +104,11 @@ The most common case is a reference to **static data**, such as string literals: let s: &'static str = "Hello world!"; ``` -Since string literals are known at compile-time, Rust's stores them in a memory -region known as ***. *** is part of the executable itself: there is no risk of it -being freed during program execution. +Since string literals are known at compile-time, Rust stores them *inside* your executable, +in a region known as **read-only data segment**. All references pointing to that region will therefore be valid for as long as the program runs; they satisfy the `'static` contract. +## Further reading + +- [The data segment](https://en.wikipedia.org/wiki/Data_segment)