about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/messages.ftl
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-06-27 15:32:53 +0200
committerRalf Jung <post@ralfj.de>2025-06-27 17:03:48 +0200
commitd0fa0260ca410b5691a03237e7336bb09c135230 (patch)
tree36bbbda6a73349ccbc9a4806f94177d3b91971f0 /compiler/rustc_const_eval/messages.ftl
parente61dd437f33b5a640e67dc3628397689c664c17f (diff)
downloadrust-d0fa0260ca410b5691a03237e7336bb09c135230.tar.gz
rust-d0fa0260ca410b5691a03237e7336bb09c135230.zip
const checks: avoid 'top-level scope' terminology
Diffstat (limited to 'compiler/rustc_const_eval/messages.ftl')
-rw-r--r--compiler/rustc_const_eval/messages.ftl28
1 files changed, 10 insertions, 18 deletions
diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl
index 97b154ad142..94d1d7d388b 100644
--- a/compiler/rustc_const_eval/messages.ftl
+++ b/compiler/rustc_const_eval/messages.ftl
@@ -125,16 +125,11 @@ const_eval_incompatible_types =
     calling a function with argument of type {$callee_ty} passing data of type {$caller_ty}
 
 const_eval_interior_mutable_borrow_escaping =
-    interior mutable shared borrows of lifetime-extended temporaries in the top-level scope of a {const_eval_const_context} are not allowed
-    .label = this borrow of an interior mutable value refers to a lifetime-extended temporary
-    .help = to fix this, the value can be extracted to a separate `static` item and then referenced
-    .teach_note =
-        This creates a raw pointer to a temporary that has its lifetime extended to last for the entire program.
-        Lifetime-extended temporaries in constants and statics must be immutable.
-        This is to avoid accidentally creating shared mutable state.
-
-
-        If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
+    interior mutable shared borrows of temporaries that have their lifetime extended until the end of the program are not allowed
+    .label = this borrow of an interior mutable value refers to such a temporary
+    .note = Temporaries in constants and statics can have their lifetime extended until the end of the program
+    .note2 = To avoid accidentally creating global mutable state, such temporaries must be immutable
+    .help = If you really want global mutable state, try replacing the temporary by an interior mutable `static` or a `static mut`
 
 const_eval_intern_kind = {$kind ->
     [static] static
@@ -215,14 +210,11 @@ const_eval_modified_global =
     modifying a static's initial value from another static's initializer
 
 const_eval_mutable_borrow_escaping =
-    mutable borrows of lifetime-extended temporaries in the top-level scope of a {const_eval_const_context} are not allowed
-    .teach_note =
-        This creates a reference to a temporary that has its lifetime extended to last for the entire program.
-        Lifetime-extended temporaries in constants and statics must be immutable.
-        This is to avoid accidentally creating shared mutable state.
-
-
-        If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
+    mutable borrows of temporaries that have their lifetime extended until the end of the program are not allowed
+    .label = this mutable borrow refers to such a temporary
+    .note = Temporaries in constants and statics can have their lifetime extended until the end of the program
+    .note2 = To avoid accidentally creating global mutable state, such temporaries must be immutable
+    .help = If you really want global mutable state, try replacing the temporary by an interior mutable `static` or a `static mut`
 
 const_eval_mutable_ptr_in_final = encountered mutable pointer in final value of {const_eval_intern_kind}