@@ -125,11 +125,12 @@ const_eval_incompatible_types =
125125 calling a function with argument of type { $callee_ty } passing data of type { $caller_ty }
126126
127127const_eval_interior_mutable_ref_escaping =
128- { const_eval_const_context } s cannot refer to interior mutable data
129- .label = this borrow of an interior mutable value may end up in the final value
128+ shared references to lifetime-extended temporaries with interior mutability are not allowed in { const_eval_const_context } s
129+ .label = this borrow of an interior mutable value refers to a lifetime-extended temporary
130130 .help = to fix this, the value can be extracted to a separate `static` item and then referenced
131131 .teach_note =
132- References that escape into the final value of a constant or static must be immutable.
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.
133134 This is to avoid accidentally creating shared mutable state.
134135
135136
@@ -216,18 +217,20 @@ const_eval_modified_global =
216217const_eval_mutable_ptr_in_final = encountered mutable pointer in final value of { const_eval_intern_kind }
217218
218219const_eval_mutable_raw_escaping =
219- raw mutable pointers are not allowed in the final value of { const_eval_const_context } s
220+ raw mutable pointers to lifetime-extended temporaries are not allowed in { const_eval_const_context } s
220221 .teach_note =
221- Pointers that escape into the final value of a constant or static must be immutable.
222+ This creates a raw pointer to a temporary that has its lifetime extended to last for the entire program.
223+ Lifetime-extended temporaries in constants and statics must be immutable.
222224 This is to avoid accidentally creating shared mutable state.
223225
224226
225227 If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
226228
227229const_eval_mutable_ref_escaping =
228- mutable references are not allowed in the final value of { const_eval_const_context } s
230+ mutable references to lifetime-extended temporaries are not allowed in { const_eval_const_context } s
229231 .teach_note =
230- References that escape into the final value of a constant or static must be immutable.
232+ This creates a reference to a temporary that has its lifetime extended to last for the entire program.
233+ Lifetime-extended temporaries in constants and statics must be immutable.
231234 This is to avoid accidentally creating shared mutable state.
232235
233236
0 commit comments