@@ -125,15 +125,13 @@ const_eval_incompatible_types =
125
125
calling a function with argument of type { $callee_ty } passing data of type { $caller_ty }
126
126
127
127
const_eval_interior_mutable_borrow_escaping =
128
- interior mutable shared borrows of lifetime- extended temporaries in the top-level scope of a { const_eval_const_context } are not allowed
128
+ interior mutable shared borrows of temporaries that have their lifetime extended until the end of the program are not allowed
129
129
.label = this borrow of an interior mutable value refers to a lifetime-extended temporary
130
130
.help = to fix this, the value can be extracted to a separate `static` item and then referenced
131
131
.teach_note =
132
- This creates a raw pointer to a temporary that has its lifetime extended to last for the entire program.
133
- Lifetime-extended temporaries in constants and statics must be immutable.
134
- This is to avoid accidentally creating shared mutable state.
135
-
136
-
132
+ Temporaries in constants and statics can have their lifetime extended until the end of the program.
133
+ (See <https://doc.rust-lang.org/reference/destructors.html#r-destructors.scope.lifetime-extension.static>.)
134
+ To avoid accidentally creating global mutable state, such temporaries must be immutable.
137
135
If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
138
136
139
137
const_eval_intern_kind = { $kind ->
@@ -215,13 +213,11 @@ const_eval_modified_global =
215
213
modifying a static's initial value from another static's initializer
216
214
217
215
const_eval_mutable_borrow_escaping =
218
- mutable borrows of lifetime- extended temporaries in the top-level scope of a { const_eval_const_context } are not allowed
216
+ mutable borrows of temporaries that have their lifetime extended until the end of the program are not allowed
219
217
.teach_note =
220
- This creates a reference to a temporary that has its lifetime extended to last for the entire program.
221
- Lifetime-extended temporaries in constants and statics must be immutable.
222
- This is to avoid accidentally creating shared mutable state.
223
-
224
-
218
+ Temporaries in constants and statics can have their lifetime extended until the end of the program.
219
+ (See <https://doc.rust-lang.org/reference/destructors.html#r-destructors.scope.lifetime-extension.static>.)
220
+ To avoid accidentally creating global mutable state, such temporaries must be immutable.
225
221
If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
226
222
227
223
const_eval_mutable_ptr_in_final = encountered mutable pointer in final value of { const_eval_intern_kind }
0 commit comments