Merge pull request #4164 from rust-lang/ch10-03-static-error-messages

Ch. 10: clarify note about compiler errors and `'static`
This commit is contained in:
Chris Krycho
2024-12-16 09:11:34 -07:00
committed by GitHub

View File

@@ -567,7 +567,7 @@ let s: &'static str = "I have a static lifetime.";
The text of this string is stored directly in the programs binary, which is
always available. Therefore, the lifetime of all string literals is `'static`.
You might see suggestions to use the `'static` lifetime in error messages. But
You might see suggestions in error messages to use the `'static` lifetime. But
before specifying `'static` as the lifetime for a reference, think about
whether the reference you have actually lives the entire lifetime of your
program or not, and whether you want it to. Most of the time, an error message