You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
calling a function with argument of type {$callee_ty} passing data of type {$caller_ty}
136
136
137
-
const_eval_interior_mutable_data_refer =
137
+
const_eval_interior_mutable_ref_escaping =
138
138
{const_eval_const_context}s cannot refer to interior mutable data
139
139
.label = this borrow of an interior mutable value may end up in the final value
140
140
.help = to fix this, the value can be extracted to a separate `static` item and then referenced
141
141
.teach_note =
142
-
A constant containing interior mutable data behind a reference can allow you to modify that data.
143
-
This would make multiple uses of a constant to be able to see different values and allow circumventing
144
-
the `Send` and `Sync` requirements for shared mutable data, which is unsound.
142
+
References that escape into the final value of a constant or static must be immutable.
143
+
This is to avoid accidentally creating shared mutable state.
144
+
145
+
146
+
If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
145
147
146
148
const_eval_intern_kind = {$kind->
147
149
[static] static
@@ -229,6 +231,24 @@ const_eval_modified_global =
229
231
230
232
const_eval_mutable_ptr_in_final = encountered mutable pointer in final value of {const_eval_intern_kind}
231
233
234
+
const_eval_mutable_raw_escaping =
235
+
raw mutable pointers are not allowed in the final value of {const_eval_const_context}s
236
+
.teach_note =
237
+
Pointers that escape into the final value of a constant or static must be immutable.
238
+
This is to avoid accidentally creating shared mutable state.
239
+
240
+
241
+
If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
242
+
243
+
const_eval_mutable_ref_escaping =
244
+
mutable references are not allowed in the final value of {const_eval_const_context}s
245
+
.teach_note =
246
+
References that escape into the final value of a constant or static must be immutable.
247
+
This is to avoid accidentally creating shared mutable state.
248
+
249
+
250
+
If you really want global mutable state, try using an interior mutable `static` or a `static mut`.
251
+
232
252
const_eval_nested_static_in_thread_local = #[thread_local] does not support implicit nested statics, please create explicit static items and refer to them instead
233
253
const_eval_non_const_fmt_macro_call =
234
254
cannot call non-const formatting macro in {const_eval_const_context}s
@@ -364,30 +384,11 @@ const_eval_unallowed_fn_pointer_call = function pointer calls are not allowed in
364
384
const_eval_unallowed_heap_allocations =
365
385
allocations are not allowed in {const_eval_const_context}s
366
386
.label = allocation not allowed in {const_eval_const_context}s
367
-
.teach_note = The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.
387
+
.teach_note =
388
+
The runtime heap is not yet available at compile-time, so no runtime heap allocations can be created.
368
389
369
390
const_eval_unallowed_inline_asm =
370
391
inline assembly is not allowed in {const_eval_const_context}s
371
-
const_eval_unallowed_mutable_raw =
372
-
raw mutable pointers are not allowed in the final value of {const_eval_const_context}s
373
-
.teach_note =
374
-
References in statics and constants may only refer to immutable values.
375
-
376
-
377
-
Statics are shared everywhere, and if they refer to mutable data one might violate memory
378
-
safety since holding multiple mutable references to shared data is not allowed.
379
-
380
-
381
-
If you really want global mutable state, try using static mut or a global UnsafeCell.
382
-
383
-
const_eval_unallowed_mutable_refs =
384
-
mutable references are not allowed in the final value of {const_eval_const_context}s
385
-
.teach_note =
386
-
Statics are shared everywhere, and if they refer to mutable data one might violate memory
387
-
safety since holding multiple mutable references to shared data is not allowed.
388
-
389
-
390
-
If you really want global mutable state, try using static mut or a global UnsafeCell.
0 commit comments