2023-05-22 20:51:25 -05:00
mir_build_adt_defined_here = `{$ty}` defined here
2022-08-20 15:54:58 -05:00
2023-05-22 20:51:25 -05:00
mir_build_already_borrowed = cannot borrow value as mutable because it is also borrowed as immutable
2022-08-20 15:54:58 -05:00
2023-05-22 20:51:25 -05:00
mir_build_already_mut_borrowed = cannot borrow value as immutable because it is also borrowed as mutable
2022-08-20 15:54:58 -05:00
2023-05-22 20:51:25 -05:00
mir_build_assoc_const_in_pattern = associated consts cannot be referenced in patterns
2022-08-20 15:54:58 -05:00
2023-05-22 20:51:25 -05:00
mir_build_bindings_with_variant_name =
pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`
.suggestion = to match on the variant, qualify the path
2022-08-20 15:54:58 -05:00
2023-05-22 20:51:25 -05:00
mir_build_borrow = value is borrowed by `{$name}` here
2022-08-20 15:54:58 -05:00
2023-05-22 20:51:25 -05:00
mir_build_borrow_of_layout_constrained_field_requires_unsafe =
borrow of layout constrained field with interior mutability is unsafe and requires unsafe block
.note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
.label = borrow of layout constrained field with interior mutability
2022-08-20 15:54:58 -05:00
2023-05-22 20:51:25 -05:00
mir_build_borrow_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block
2022-08-20 15:54:58 -05:00
.note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
.label = borrow of layout constrained field with interior mutability
2023-05-22 20:51:25 -05:00
mir_build_borrow_of_moved_value = borrow of moved value
.label = value moved into `{$name}` here
2024-03-09 14:32:13 -06:00
.occurs_because_label = move occurs because `{$name}` has type `{$ty}`, which does not implement the `Copy` trait
2023-05-22 20:51:25 -05:00
.value_borrowed_label = value borrowed here after move
.suggestion = borrow this binding in the pattern to avoid moving the value
mir_build_call_to_fn_with_requires_unsafe =
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block
2023-11-28 13:37:02 -06:00
.help = in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->
[1] feature
*[count] features
}: {$missing_target_features}
.note = the {$build_target_features} target {$build_target_features_count ->
[1] feature
*[count] features
} being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->
[1] it
*[count] them
} in `#[target_feature]`
2023-05-22 20:51:25 -05:00
.label = call to function with `#[target_feature]`
mir_build_call_to_fn_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe function or block
2023-11-28 13:37:02 -06:00
.help = in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->
[1] feature
*[count] features
}: {$missing_target_features}
.note = the {$build_target_features} target {$build_target_features_count ->
[1] feature
*[count] features
} being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->
[1] it
*[count] them
} in `#[target_feature]`
2022-08-20 15:54:58 -05:00
.label = call to function with `#[target_feature]`
2022-08-24 03:01:53 -05:00
mir_build_call_to_unsafe_fn_requires_unsafe =
call to unsafe function `{$function}` is unsafe and requires unsafe block
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_call_to_unsafe_fn_requires_unsafe_nameless =
call to unsafe function is unsafe and requires unsafe block
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_call_to_unsafe_fn_requires_unsafe_nameless_unsafe_op_in_unsafe_fn_allowed =
call to unsafe function is unsafe and requires unsafe function or block
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
2023-05-22 20:51:25 -05:00
mir_build_call_to_unsafe_fn_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
call to unsafe function `{$function}` is unsafe and requires unsafe function or block
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
2022-08-24 03:01:53 -05:00
2023-05-22 20:51:25 -05:00
mir_build_confused = missing patterns are not covered because `{$variable}` is interpreted as a constant pattern, not a new variable
2022-08-24 03:01:53 -05:00
2023-05-22 20:51:25 -05:00
mir_build_const_param_in_pattern = const parameters cannot be referenced in patterns
2022-08-24 03:01:53 -05:00
2023-05-22 20:51:25 -05:00
mir_build_const_pattern_depends_on_generic_parameter =
constant pattern depends on a generic parameter
2022-08-24 03:01:53 -05:00
2023-05-22 20:51:25 -05:00
mir_build_could_not_eval_const_pattern = could not evaluate constant pattern
2022-08-24 03:01:53 -05:00
mir_build_deref_raw_pointer_requires_unsafe =
dereference of raw pointer is unsafe and requires unsafe block
.note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
.label = dereference of raw pointer
mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
dereference of raw pointer is unsafe and requires unsafe function or block
.note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
.label = dereference of raw pointer
2023-05-22 20:51:25 -05:00
mir_build_extern_static_requires_unsafe =
use of extern static is unsafe and requires unsafe block
.note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
.label = use of extern static
2022-08-26 11:30:33 -05:00
2023-05-22 20:51:25 -05:00
mir_build_extern_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
use of extern static is unsafe and requires unsafe function or block
.note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
.label = use of extern static
2022-08-27 14:06:06 -05:00
2023-05-22 20:51:25 -05:00
mir_build_indirect_structural_match =
2023-09-26 02:39:41 -05:00
to use a constant of type `{$non_sm_ty}` in a pattern, `{$non_sm_ty}` must be annotated with `#[derive(PartialEq)]`
2022-08-27 14:25:09 -05:00
2023-05-22 20:51:25 -05:00
mir_build_inform_irrefutable = `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
2022-08-27 14:48:18 -05:00
2023-05-22 20:51:25 -05:00
mir_build_initializing_type_with_requires_unsafe =
initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe block
.note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior
.label = initializing type with `rustc_layout_scalar_valid_range` attr
2022-08-27 14:48:18 -05:00
2023-05-22 20:51:25 -05:00
mir_build_initializing_type_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block
.note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior
.label = initializing type with `rustc_layout_scalar_valid_range` attr
2023-01-09 01:10:17 -06:00
2023-05-22 20:51:25 -05:00
mir_build_inline_assembly_requires_unsafe =
use of inline assembly is unsafe and requires unsafe block
.note = inline assembly is entirely unchecked and can cause undefined behavior
.label = use of inline assembly
2022-08-28 13:48:09 -05:00
2023-05-22 20:51:25 -05:00
mir_build_inline_assembly_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
use of inline assembly is unsafe and requires unsafe function or block
.note = inline assembly is entirely unchecked and can cause undefined behavior
.label = use of inline assembly
2022-08-28 13:48:09 -05:00
2023-05-22 20:51:25 -05:00
mir_build_interpreted_as_const = introduce a variable instead
2022-08-29 02:06:50 -05:00
2023-05-22 20:51:25 -05:00
mir_build_invalid_pattern = `{$non_sm_ty}` cannot be used in patterns
2022-08-29 03:21:25 -05:00
mir_build_irrefutable_let_patterns_if_let = irrefutable `if let` {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the `if let` is useless
.help = consider replacing the `if let` with a `let`
mir_build_irrefutable_let_patterns_if_let_guard = irrefutable `if let` guard {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the guard is useless
.help = consider removing the guard and adding a `let` inside the match arm
mir_build_irrefutable_let_patterns_let_else = irrefutable `let...else` {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the `else` clause is useless
.help = consider removing the `else` clause
mir_build_irrefutable_let_patterns_while_let = irrefutable `while let` {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the loop will never exit
.help = consider instead using a `loop {"{"} ... {"}"}` with a `let` inside it
2022-08-30 12:01:28 -05:00
2023-05-22 20:51:25 -05:00
mir_build_leading_irrefutable_let_patterns = leading irrefutable {$count ->
[one] pattern
*[other] patterns
} in let chain
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match
.help = consider moving {$count ->
[one] it
*[other] them
} outside of the construct
2022-08-30 12:38:10 -05:00
2023-05-22 20:51:25 -05:00
mir_build_literal_in_range_out_of_bounds =
literal out of range for `{$ty}`
2023-10-10 21:54:21 -05:00
.label = this value does not fit into the type `{$ty}` whose range is `{$min}..={$max}`
2023-01-17 06:48:43 -06:00
2023-05-22 20:51:25 -05:00
mir_build_lower_range_bound_must_be_less_than_or_equal_to_upper =
lower range bound must be less than or equal to upper
.label = lower bound larger than upper bound
.teach_note = When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
2023-01-17 06:48:43 -06:00
2023-05-22 20:51:25 -05:00
mir_build_lower_range_bound_must_be_less_than_upper = lower range bound must be less than upper
2023-01-17 06:48:43 -06:00
2023-05-22 20:51:25 -05:00
mir_build_more_information = for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
2023-01-17 06:48:43 -06:00
2023-05-22 20:51:25 -05:00
mir_build_moved = value is moved into `{$name}` here
2023-01-17 06:48:43 -06:00
2023-05-22 20:51:25 -05:00
mir_build_moved_while_borrowed = cannot move out of value because it is borrowed
2023-01-17 06:48:43 -06:00
2023-05-22 20:51:25 -05:00
mir_build_multiple_mut_borrows = cannot borrow value as mutable more than once at a time
2022-12-19 17:28:33 -06:00
2023-05-22 20:51:25 -05:00
mir_build_mutable_borrow = value is mutably borrowed by `{$name}` here
2022-12-19 17:28:33 -06:00
2023-05-22 20:51:25 -05:00
mir_build_mutable_static_requires_unsafe =
use of mutable static is unsafe and requires unsafe block
.note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
.label = use of mutable static
2022-12-19 17:28:33 -06:00
2023-05-22 20:51:25 -05:00
mir_build_mutable_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
use of mutable static is unsafe and requires unsafe function or block
.note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
.label = use of mutable static
2022-12-19 17:28:33 -06:00
2023-05-22 20:51:25 -05:00
mir_build_mutation_of_layout_constrained_field_requires_unsafe =
mutation of layout constrained field is unsafe and requires unsafe block
.note = mutating layout constrained fields cannot statically be checked for valid values
.label = mutation of layout constrained field
2022-12-19 17:28:33 -06:00
2023-05-22 20:51:25 -05:00
mir_build_mutation_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
mutation of layout constrained field is unsafe and requires unsafe function or block
.note = mutating layout constrained fields cannot statically be checked for valid values
.label = mutation of layout constrained field
2022-12-19 17:28:33 -06:00
2023-09-30 01:15:34 -05:00
mir_build_nan_pattern = cannot use NaN in patterns
.note = NaNs compare inequal to everything, even themselves, so this pattern would never match
.help = try using the `is_nan` method instead
2023-05-22 20:51:25 -05:00
mir_build_non_const_path = runtime values cannot be referenced in patterns
2022-12-19 17:28:33 -06:00
2024-01-05 10:21:09 -06:00
mir_build_non_empty_never_pattern =
mismatched types
.label = a never pattern must be used on an uninhabited type
.note = the matched value is of type `{$ty}`
2023-06-28 00:49:21 -05:00
mir_build_non_exhaustive_match_all_arms_guarded =
match arms with guards don't count towards exhaustivity
2023-05-22 20:51:25 -05:00
mir_build_non_exhaustive_patterns_type_not_empty = non-exhaustive patterns: type `{$ty}` is non-empty
.def_note = `{$peeled_ty}` defined here
.type_note = the matched value is of type `{$ty}`
.non_exhaustive_type_note = the matched value is of type `{$ty}`, which is marked as non-exhaustive
.reference_note = references are always considered inhabited
.suggestion = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
.help = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
2022-12-19 17:28:33 -06:00
2023-09-16 07:15:48 -05:00
mir_build_non_partial_eq_match =
to use a constant of type `{$non_peq_ty}` in a pattern, the type must implement `PartialEq`
2022-12-20 14:24:18 -06:00
mir_build_nontrivial_structural_match =
2023-09-26 02:39:41 -05:00
to use a constant of type `{$non_sm_ty}` in a pattern, the constant's initializer must be trivial or `{$non_sm_ty}` must be annotated with `#[derive(PartialEq)]`
2022-12-20 09:43:34 -06:00
2022-12-23 14:02:23 -06:00
mir_build_pattern_not_covered = refutable pattern in {$origin}
.pattern_ty = the matched value is of type `{$pattern_ty}`
2023-10-19 01:36:24 -05:00
mir_build_pointer_pattern = function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
2022-12-23 14:02:23 -06:00
2023-05-22 20:51:25 -05:00
mir_build_privately_uninhabited = pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future
2022-12-23 14:02:23 -06:00
2023-05-22 20:51:25 -05:00
mir_build_rustc_box_attribute_error = `#[rustc_box]` attribute used incorrectly
.attributes = no other attributes may be applied
.not_box = `#[rustc_box]` may only be applied to a `Box::new()` call
.missing_box = `#[rustc_box]` requires the `owned_box` lang item
2022-12-23 14:02:23 -06:00
2023-05-22 20:51:25 -05:00
mir_build_static_in_pattern = statics cannot be referenced in patterns
2022-12-23 14:02:23 -06:00
2023-05-22 20:51:25 -05:00
mir_build_suggest_attempted_int_lit = alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
2022-12-23 14:02:23 -06:00
mir_build_suggest_if_let = you might want to use `if let` to ignore the {$count ->
[one] variant that isn't
*[other] variants that aren't
} matched
2022-12-23 15:23:37 -06:00
mir_build_suggest_let_else = you might want to use `let else` to handle the {$count ->
2022-12-23 14:02:23 -06:00
[one] variant that isn't
*[other] variants that aren't
} matched
2023-01-12 19:14:26 -06:00
2023-05-22 20:51:25 -05:00
mir_build_trailing_irrefutable_let_patterns = trailing irrefutable {$count ->
[one] pattern
*[other] patterns
} in let chain
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match
.help = consider moving {$count ->
[one] it
*[other] them
} into the body
2023-02-26 19:32:07 -06:00
2023-05-22 20:51:25 -05:00
mir_build_type_not_structural =
2023-09-26 02:39:41 -05:00
to use a constant of type `{$non_sm_ty}` in a pattern, `{$non_sm_ty}` must be annotated with `#[derive(PartialEq)]`
2023-02-26 19:32:07 -06:00
2023-09-26 02:39:41 -05:00
mir_build_type_not_structural_more_info = see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
2023-05-22 20:51:25 -05:00
mir_build_type_not_structural_tip = the traits must be derived, manual `impl`s are not sufficient
mir_build_unconditional_recursion = function cannot return without recursing
.label = cannot return without recursing
.help = a `loop` may express intention better if this is on purpose
mir_build_unconditional_recursion_call_site_label = recursive call site
mir_build_union_field_requires_unsafe =
access to union field is unsafe and requires unsafe block
.note = the field may not be properly initialized: using uninitialized data will cause undefined behavior
.label = access to union field
mir_build_union_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
access to union field is unsafe and requires unsafe function or block
.note = the field may not be properly initialized: using uninitialized data will cause undefined behavior
.label = access to union field
mir_build_union_pattern = cannot use unions in constant patterns
mir_build_unreachable_pattern = unreachable pattern
.label = unreachable pattern
.catchall_label = matches any value
2023-10-26 10:39:25 -05:00
mir_build_unsafe_fn_safe_body = an unsafe function restricts its caller, but its body is safe by default
2023-07-14 21:06:32 -05:00
mir_build_unsafe_not_inherited = items do not inherit unsafety from separate enclosing items
2023-05-22 20:51:25 -05:00
mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe =
borrow of layout constrained field with interior mutability is unsafe and requires unsafe block (error E0133)
.note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
.label = borrow of layout constrained field with interior mutability
mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe =
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
2023-11-28 13:37:02 -06:00
.help = in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->
[1] feature
*[count] features
}: {$missing_target_features}
.note = the {$build_target_features} target {$build_target_features_count ->
[1] feature
*[count] features
} being enabled in the build configuration does not remove the requirement to list {$build_target_features_count ->
[1] it
*[count] them
} in `#[target_feature]`
2023-05-22 20:51:25 -05:00
.label = call to function with `#[target_feature]`
mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe =
call to unsafe function `{$function}` is unsafe and requires unsafe block (error E0133)
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless =
call to unsafe function is unsafe and requires unsafe block (error E0133)
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe =
dereference of raw pointer is unsafe and requires unsafe block (error E0133)
.note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
.label = dereference of raw pointer
mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe =
use of extern static is unsafe and requires unsafe block (error E0133)
.note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
.label = use of extern static
mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe =
initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe
block (error E0133)
.note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior
.label = initializing type with `rustc_layout_scalar_valid_range` attr
mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe =
use of inline assembly is unsafe and requires unsafe block (error E0133)
.note = inline assembly is entirely unchecked and can cause undefined behavior
.label = use of inline assembly
mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe =
use of mutable static is unsafe and requires unsafe block (error E0133)
.note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
.label = use of mutable static
mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe =
mutation of layout constrained field is unsafe and requires unsafe block (error E0133)
.note = mutating layout constrained fields cannot statically be checked for valid values
.label = mutation of layout constrained field
mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe =
access to union field is unsafe and requires unsafe block (error E0133)
.note = the field may not be properly initialized: using uninitialized data will cause undefined behavior
.label = access to union field
mir_build_unsized_pattern = cannot use unsized non-slice type `{$non_sm_ty}` in constant patterns
mir_build_unused_unsafe = unnecessary `unsafe` block
.label = unnecessary `unsafe` block
mir_build_unused_unsafe_enclosing_block_label = because it's nested under this `unsafe` block
mir_build_variant_defined_here = not covered
2023-10-26 10:39:25 -05:00
mir_build_wrap_suggestion = consider wrapping the function body in an unsafe block