fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
22.3 KiB464 linesraw
1const_eval_address_space_full =
2    there are no more free addresses in the address space
3const_eval_align_check_failed = accessing memory with alignment {$has}, but alignment {$required} is required
4const_eval_align_offset_invalid_align =
5    `align_offset` called with non-power-of-two align: {$target_align}
6
7const_eval_alignment_check_failed =
8    accessing memory with alignment {$has}, but alignment {$required} is required
9const_eval_already_reported =
10    an error has already been reported elsewhere (this should not usually be printed)
11const_eval_assume_false =
12    `assume` called with `false`
13
14const_eval_await_non_const =
15    cannot convert `{$ty}` into a future in {const_eval_const_context}s
16const_eval_bounds_check_failed =
17    indexing out of bounds: the len is {$len} but the index is {$index}
18const_eval_call_nonzero_intrinsic =
19    `{$name}` called on 0
20
21const_eval_closure_call =
22    closures need an RFC before allowed to be called in {const_eval_const_context}s
23const_eval_closure_fndef_not_const =
24    function defined here, but it is not `const`
25const_eval_closure_non_const =
26    cannot call non-const closure in {const_eval_const_context}s
27const_eval_consider_dereferencing =
28    consider dereferencing here
29const_eval_const_accesses_static = constant accesses static
30
31const_eval_const_context = {$kind ->
32    [const] constant
33    [static] static
34    [const_fn] constant function
35    *[other] {""}
36}
37
38const_eval_copy_nonoverlapping_overlapping =
39    `copy_nonoverlapping` called on overlapping ranges
40
41const_eval_dangling_int_pointer =
42    {$bad_pointer_message}: {$pointer} is a dangling pointer (it has no provenance)
43const_eval_dangling_null_pointer =
44    {$bad_pointer_message}: null pointer is a dangling pointer (it has no provenance)
45const_eval_dangling_ptr_in_final = encountered dangling pointer in final constant
46
47const_eval_dead_local =
48    accessing a dead local variable
49const_eval_dealloc_immutable =
50    deallocating immutable allocation {$alloc}
51
52const_eval_dealloc_incorrect_layout =
53    incorrect layout on deallocation: {$alloc} has size {$size} and alignment {$align}, but gave size {$size_found} and alignment {$align_found}
54
55const_eval_dealloc_kind_mismatch =
56    deallocating {$alloc}, which is {$alloc_kind} memory, using {$kind} deallocation operation
57
58const_eval_deref_coercion_non_const =
59    cannot perform deref coercion on `{$ty}` in {const_eval_const_context}s
60    .note = attempting to deref into `{$target_ty}`
61    .target_note = deref defined here
62const_eval_deref_function_pointer =
63    accessing {$allocation} which contains a function
64const_eval_deref_test = dereferencing pointer failed
65const_eval_deref_vtable_pointer =
66    accessing {$allocation} which contains a vtable
67const_eval_different_allocations =
68    `{$name}` called on pointers into different allocations
69
70const_eval_division_by_zero =
71    dividing by zero
72const_eval_division_overflow =
73    overflow in signed division (dividing MIN by -1)
74const_eval_double_storage_live =
75    StorageLive on a local that was already live
76
77const_eval_dyn_call_not_a_method =
78    `dyn` call trying to call something that is not a method
79
80const_eval_dyn_call_vtable_mismatch =
81    `dyn` call on a pointer whose vtable does not match its type
82
83const_eval_dyn_star_call_vtable_mismatch =
84    `dyn*` call on a pointer whose vtable does not match its type
85
86const_eval_error = {$error_kind ->
87    [static] could not evaluate static initializer
88    [const] evaluation of constant value failed
89    [const_with_path] evaluation of `{$instance}` failed
90    *[other] {""}
91}
92
93const_eval_exact_div_has_remainder =
94    exact_div: {$a} cannot be divided by {$b} without remainder
95
96const_eval_fn_ptr_call =
97    function pointers need an RFC before allowed to be called in {const_eval_const_context}s
98const_eval_for_loop_into_iter_non_const =
99    cannot convert `{$ty}` into an iterator in {const_eval_const_context}s
100
101const_eval_frame_note = {$times ->
102    [0] {const_eval_frame_note_inner}
103    *[other] [... {$times} additional calls {const_eval_frame_note_inner} ...]
104}
105
106const_eval_frame_note_inner = inside {$where_ ->
107    [closure] closure
108    [instance] `{$instance}`
109    *[other] {""}
110}
111
112const_eval_in_bounds_test = out-of-bounds pointer use
113const_eval_incompatible_calling_conventions =
114    calling a function with calling convention {$callee_conv} using calling convention {$caller_conv}
115
116const_eval_incompatible_return_types =
117    calling a function with return type {$callee_ty} passing return place of type {$caller_ty}
118
119const_eval_incompatible_types =
120    calling a function with argument of type {$callee_ty} passing data of type {$caller_ty}
121
122const_eval_interior_mutability_borrow =
123    cannot borrow here, since the borrowed element may contain interior mutability
124
125const_eval_interior_mutable_data_refer =
126    {const_eval_const_context}s cannot refer to interior mutable data
127    .label = this borrow of an interior mutable value may end up in the final value
128    .help = to fix this, the value can be extracted to a separate `static` item and then referenced
129    .teach_note =
130        A constant containing interior mutable data behind a reference can allow you to modify that data.
131        This would make multiple uses of a constant to be able to see different values and allow circumventing
132        the `Send` and `Sync` requirements for shared mutable data, which is unsound.
133
134const_eval_invalid_align =
135    align has to be a power of 2
136
137const_eval_invalid_align_details =
138    invalid align passed to `{$name}`: {$align} is {$err_kind ->
139        [not_power_of_two] not a power of 2
140        [too_large] too large
141        *[other] {""}
142    }
143
144const_eval_invalid_bool =
145    interpreting an invalid 8-bit value as a bool: 0x{$value}
146const_eval_invalid_char =
147    interpreting an invalid 32-bit value as a char: 0x{$value}
148const_eval_invalid_dealloc =
149    deallocating {$alloc_id}, which is {$kind ->
150        [fn] a function
151        [vtable] a vtable
152        [static_mem] static memory
153        *[other] {""}
154    }
155
156const_eval_invalid_function_pointer =
157    using {$pointer} as function pointer but it does not point to a function
158const_eval_invalid_meta =
159    invalid metadata in wide pointer: total size is bigger than largest supported object
160const_eval_invalid_meta_slice =
161    invalid metadata in wide pointer: slice is bigger than largest supported object
162const_eval_invalid_str =
163    this string is not valid UTF-8: {$err}
164const_eval_invalid_tag =
165    enum value has invalid tag: {$tag}
166const_eval_invalid_transmute =
167    transmuting from {$src_bytes}-byte type to {$dest_bytes}-byte type: `{$src}` -> `{$dest}`
168
169const_eval_invalid_uninit_bytes =
170    reading memory at {$alloc}{$access}, but memory is uninitialized at {$uninit}, and this operation requires initialized memory
171const_eval_invalid_uninit_bytes_unknown =
172    using uninitialized data, but this operation requires initialized memory
173
174const_eval_invalid_vtable_pointer =
175    using {$pointer} as vtable pointer but it does not point to a vtable
176
177
178const_eval_live_drop =
179    destructor of `{$dropped_ty}` cannot be evaluated at compile-time
180    .label = the destructor for this type cannot be evaluated in {const_eval_const_context}s
181    .dropped_at_label = value is dropped here
182
183const_eval_long_running =
184    constant evaluation is taking a long time
185    .note = this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
186        If your compilation actually takes a long time, you can safely allow the lint.
187    .label = the const evaluator is currently interpreting this expression
188    .help = the constant being evaluated
189
190const_eval_match_eq_non_const = cannot match on `{$ty}` in {const_eval_const_context}s
191    .note = `{$ty}` cannot be compared in compile-time, and therefore cannot be used in `match`es
192
193const_eval_max_num_nodes_in_const = maximum number of nodes exceeded in constant {$global_const_id}
194
195const_eval_memory_access_test = memory access failed
196const_eval_memory_exhausted =
197    tried to allocate more memory than available to compiler
198
199const_eval_modified_global =
200    modifying a static's initial value from another static's initializer
201
202const_eval_mut_deref =
203    mutation through a reference is not allowed in {const_eval_const_context}s
204
205const_eval_non_const_fmt_macro_call =
206    cannot call non-const formatting macro in {const_eval_const_context}s
207
208const_eval_non_const_fn_call =
209    cannot call non-const fn `{$def_path_str}` in {const_eval_const_context}s
210
211const_eval_non_const_impl =
212    impl defined here, but it is not `const`
213
214const_eval_noreturn_asm_returned =
215    returned from noreturn inline assembly
216
217const_eval_not_enough_caller_args =
218    calling a function with fewer arguments than it requires
219
220const_eval_nullary_intrinsic_fail =
221    could not evaluate nullary intrinsic
222
223const_eval_offset_from_overflow =
224    `{$name}` called when first pointer is too far ahead of second
225
226const_eval_offset_from_test = out-of-bounds `offset_from`
227const_eval_offset_from_underflow =
228    `{$name}` called when first pointer is too far before second
229
230const_eval_operator_non_const =
231    cannot call non-const operator in {const_eval_const_context}s
232const_eval_overflow =
233    overflow executing `{$name}`
234
235const_eval_overflow_shift =
236    overflowing shift by {$val} in `{$name}`
237
238const_eval_panic =
239    the evaluated program panicked at '{$msg}', {$file}:{$line}:{$col}
240
241const_eval_panic_non_str = argument to `panic!()` in a const context must have type `&str`
242
243const_eval_partial_pointer_copy =
244    unable to copy parts of a pointer from memory at {$ptr}
245const_eval_partial_pointer_overwrite =
246    unable to overwrite parts of a pointer in memory at {$ptr}
247const_eval_pointer_arithmetic_overflow =
248    overflowing in-bounds pointer arithmetic
249const_eval_pointer_arithmetic_test = out-of-bounds pointer arithmetic
250const_eval_pointer_out_of_bounds =
251    {$bad_pointer_message}: {$alloc_id} has size {$alloc_size}, so pointer to {$ptr_size} {$ptr_size ->
252        [1] byte
253        *[many] bytes
254    } starting at offset {$ptr_offset} is out-of-bounds
255const_eval_pointer_use_after_free =
256    {$bad_pointer_message}: {$alloc_id} has been freed, so this pointer is dangling
257const_eval_ptr_as_bytes_1 =
258    this code performed an operation that depends on the underlying bytes representing a pointer
259const_eval_ptr_as_bytes_2 =
260    the absolute address of a pointer is not known at compile-time, so such operations are not supported
261const_eval_question_branch_non_const =
262    `?` cannot determine the branch of `{$ty}` in {const_eval_const_context}s
263
264const_eval_question_from_residual_non_const =
265    `?` cannot convert from residual of `{$ty}` in {const_eval_const_context}s
266
267const_eval_range = in the range {$lo}..={$hi}
268const_eval_range_lower = greater or equal to {$lo}
269const_eval_range_singular = equal to {$lo}
270const_eval_range_upper = less or equal to {$hi}
271const_eval_range_wrapping = less or equal to {$hi}, or greater or equal to {$lo}
272const_eval_raw_bytes = the raw bytes of the constant (size: {$size}, align: {$align}) {"{"}{$bytes}{"}"}
273
274const_eval_raw_eq_with_provenance =
275    `raw_eq` on bytes with provenance
276
277const_eval_raw_ptr_comparison =
278    pointers cannot be reliably compared during const eval
279    .note = see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
280
281const_eval_raw_ptr_to_int =
282    pointers cannot be cast to integers during const eval
283    .note = at compile-time, pointers do not have an integer value
284    .note2 = avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
285
286const_eval_read_extern_static =
287    cannot read from extern static ({$did})
288const_eval_read_pointer_as_int =
289    unable to turn pointer into integer
290const_eval_realloc_or_alloc_with_offset =
291    {$kind ->
292        [dealloc] deallocating
293        [realloc] reallocating
294        *[other] {""}
295    } {$ptr} which does not point to the beginning of an object
296
297const_eval_remainder_by_zero =
298    calculating the remainder with a divisor of zero
299const_eval_remainder_overflow =
300    overflow in signed remainder (dividing MIN by -1)
301const_eval_scalar_size_mismatch =
302    scalar size mismatch: expected {$target_size} bytes but got {$data_size} bytes instead
303const_eval_size_overflow =
304    overflow computing total size of `{$name}`
305
306const_eval_stack_frame_limit_reached =
307    reached the configured maximum number of stack frames
308
309const_eval_static_access =
310    {const_eval_const_context}s cannot refer to statics
311    .help = consider extracting the value of the `static` to a `const`, and referring to that
312    .teach_note = `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
313    .teach_help = To fix this, the value can be extracted to a `const` and then used.
314
315const_eval_thread_local_access =
316    thread-local statics cannot be accessed at compile-time
317
318const_eval_thread_local_static =
319    cannot access thread local static ({$did})
320const_eval_too_generic =
321    encountered overly generic constant
322const_eval_too_many_caller_args =
323    calling a function with more arguments than it expected
324
325const_eval_transient_mut_borrow = mutable references are not allowed in {const_eval_const_context}s
326
327const_eval_transient_mut_borrow_raw = raw mutable references are not allowed in {const_eval_const_context}s
328
329const_eval_try_block_from_output_non_const =
330    `try` block cannot convert `{$ty}` to the result in {const_eval_const_context}s
331const_eval_unallowed_fn_pointer_call = function pointer calls are not allowed in {const_eval_const_context}s
332
333const_eval_unallowed_heap_allocations =
334    allocations are not allowed in {const_eval_const_context}s
335    .label = allocation not allowed in {const_eval_const_context}s
336    .teach_note =
337        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.
338
339const_eval_unallowed_inline_asm =
340    inline assembly is not allowed in {const_eval_const_context}s
341const_eval_unallowed_mutable_refs =
342    mutable references are not allowed in the final value of {const_eval_const_context}s
343    .teach_note =
344        Statics are shared everywhere, and if they refer to mutable data one might violate memory
345        safety since holding multiple mutable references to shared data is not allowed.
346
347
348        If you really want global mutable state, try using static mut or a global UnsafeCell.
349
350const_eval_unallowed_mutable_refs_raw =
351    raw mutable references are not allowed in the final value of {const_eval_const_context}s
352    .teach_note =
353        References in statics and constants may only refer to immutable values.
354
355
356        Statics are shared everywhere, and if they refer to mutable data one might violate memory
357        safety since holding multiple mutable references to shared data is not allowed.
358
359
360        If you really want global mutable state, try using static mut or a global UnsafeCell.
361
362const_eval_unallowed_op_in_const_context =
363    {$msg}
364
365const_eval_unavailable_target_features_for_fn =
366    calling a function that requires unavailable target features: {$unavailable_feats}
367
368const_eval_undefined_behavior =
369    it is undefined behavior to use this value
370
371const_eval_undefined_behavior_note =
372    The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
373
374const_eval_uninhabited_enum_variant_read =
375    read discriminant of an uninhabited enum variant
376const_eval_uninhabited_enum_variant_written =
377    writing discriminant of an uninhabited enum variant
378const_eval_unreachable = entering unreachable code
379const_eval_unreachable_unwind =
380    unwinding past a stack frame that does not allow unwinding
381
382const_eval_unsigned_offset_from_overflow =
383    `ptr_offset_from_unsigned` called when first pointer has smaller offset than second: {$a_offset} < {$b_offset}
384const_eval_unsized_local = unsized locals are not supported
385const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn
386
387const_eval_unstable_in_stable =
388    const-stable function cannot use `#[feature({$gate})]`
389    .unstable_sugg = if it is not part of the public API, make this function unstably const
390    .bypass_sugg = otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
391
392const_eval_unsupported_untyped_pointer = unsupported untyped pointer in constant
393    .note = memory only reachable via raw pointers is not supported
394
395const_eval_unterminated_c_string =
396    reading a null-terminated string starting at {$pointer} with no null found before end of allocation
397
398const_eval_unwind_past_top =
399    unwinding past the topmost frame of the stack
400
401const_eval_upcast_mismatch =
402    upcast on a pointer whose vtable does not match its type
403
404## The `front_matter`s here refer to either `const_eval_front_matter_invalid_value` or `const_eval_front_matter_invalid_value_with_path`.
405## (We'd love to sort this differently to make that more clear but tidy won't let us...)
406const_eval_validation_box_to_mut = {$front_matter}: encountered a box pointing to mutable memory in a constant
407const_eval_validation_box_to_static = {$front_matter}: encountered a box pointing to a static variable in a constant
408const_eval_validation_box_to_uninhabited = {$front_matter}: encountered a box pointing to uninhabited type {$ty}
409const_eval_validation_dangling_box_no_provenance = {$front_matter}: encountered a dangling box ({$pointer} has no provenance)
410const_eval_validation_dangling_box_out_of_bounds = {$front_matter}: encountered a dangling box (going beyond the bounds of its allocation)
411const_eval_validation_dangling_box_use_after_free = {$front_matter}: encountered a dangling box (use-after-free)
412const_eval_validation_dangling_ref_no_provenance = {$front_matter}: encountered a dangling reference ({$pointer} has no provenance)
413const_eval_validation_dangling_ref_out_of_bounds = {$front_matter}: encountered a dangling reference (going beyond the bounds of its allocation)
414const_eval_validation_dangling_ref_use_after_free = {$front_matter}: encountered a dangling reference (use-after-free)
415
416const_eval_validation_expected_bool = expected a boolean
417const_eval_validation_expected_box = expected a box
418const_eval_validation_expected_char = expected a unicode scalar value
419const_eval_validation_expected_enum_tag = expected a valid enum tag
420const_eval_validation_expected_float = expected a floating point number
421const_eval_validation_expected_fn_ptr = expected a function pointer
422const_eval_validation_expected_init_scalar = expected initialized scalar value
423const_eval_validation_expected_int = expected an integer
424const_eval_validation_expected_raw_ptr = expected a raw pointer
425const_eval_validation_expected_ref = expected a reference
426const_eval_validation_expected_str = expected a string
427
428const_eval_validation_front_matter_invalid_value = constructing invalid value
429const_eval_validation_front_matter_invalid_value_with_path = constructing invalid value at {$path}
430
431const_eval_validation_invalid_bool = {$front_matter}: encountered {$value}, but expected a boolean
432const_eval_validation_invalid_box_meta = {$front_matter}: encountered invalid box metadata: total size is bigger than largest supported object
433const_eval_validation_invalid_box_slice_meta = {$front_matter}: encountered invalid box metadata: slice is bigger than largest supported object
434const_eval_validation_invalid_char = {$front_matter}: encountered {$value}, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
435
436const_eval_validation_invalid_enum_tag = {$front_matter}: encountered {$value}, but expected a valid enum tag
437const_eval_validation_invalid_fn_ptr = {$front_matter}: encountered {$value}, but expected a function pointer
438const_eval_validation_invalid_ref_meta = {$front_matter}: encountered invalid reference metadata: total size is bigger than largest supported object
439const_eval_validation_invalid_ref_slice_meta = {$front_matter}: encountered invalid reference metadata: slice is bigger than largest supported object
440const_eval_validation_invalid_vtable_ptr = {$front_matter}: encountered {$value}, but expected a vtable pointer
441const_eval_validation_mutable_ref_in_const = {$front_matter}: encountered mutable reference in a `const`
442const_eval_validation_never_val = {$front_matter}: encountered a value of the never type `!`
443const_eval_validation_null_box = {$front_matter}: encountered a null box
444const_eval_validation_null_fn_ptr = {$front_matter}: encountered a null function pointer
445const_eval_validation_null_ref = {$front_matter}: encountered a null reference
446const_eval_validation_nullable_ptr_out_of_range = {$front_matter}: encountered a potentially null pointer, but expected something that cannot possibly fail to be {$in_range}
447const_eval_validation_out_of_range = {$front_matter}: encountered {$value}, but expected something {$in_range}
448const_eval_validation_partial_pointer = {$front_matter}: encountered a partial pointer or a mix of pointers
449const_eval_validation_pointer_as_int = {$front_matter}: encountered a pointer, but {$expected}
450const_eval_validation_ptr_out_of_range = {$front_matter}: encountered a pointer, but expected something that cannot possibly fail to be {$in_range}
451const_eval_validation_ref_to_mut = {$front_matter}: encountered a reference pointing to mutable memory in a constant
452const_eval_validation_ref_to_static = {$front_matter}: encountered a reference pointing to a static variable in a constant
453const_eval_validation_ref_to_uninhabited = {$front_matter}: encountered a reference pointing to uninhabited type {$ty}
454const_eval_validation_unaligned_box = {$front_matter}: encountered an unaligned box (required {$required_bytes} byte alignment but found {$found_bytes})
455const_eval_validation_unaligned_ref = {$front_matter}: encountered an unaligned reference (required {$required_bytes} byte alignment but found {$found_bytes})
456const_eval_validation_uninhabited_enum_variant = {$front_matter}: encountered an uninhabited enum variant
457const_eval_validation_uninhabited_val = {$front_matter}: encountered a value of uninhabited type `{$ty}`
458const_eval_validation_uninit = {$front_matter}: encountered uninitialized memory, but {$expected}
459const_eval_validation_unsafe_cell = {$front_matter}: encountered `UnsafeCell` in a `const`
460
461const_eval_write_to_read_only =
462    writing to {$allocation} which is read-only
463const_eval_zst_pointer_out_of_bounds =
464    {$bad_pointer_message}: {$alloc_id} has size {$alloc_size}, so pointer at offset {$ptr_offset} is out-of-bounds