2024-06-14 10:28:23 +00:00
hir_analysis_ambiguous_assoc_item = ambiguous associated {$assoc_kind} `{$assoc_name}` in bounds of `{$qself}`
2023-11-24 08:53:10 +00:00
.label = ambiguous associated {$assoc_kind} `{$assoc_name}`
2022-09-28 09:21:33 +00:00
hir_analysis_ambiguous_lifetime_bound =
2022-03-31 07:35:17 +00:00
ambiguous lifetime bound, explicit lifetime bound required
2024-05-27 21:53:46 +00:00
hir_analysis_assoc_item_constraints_not_allowed_here =
associated item constraints are not allowed here
.label = associated item constraint not allowed here
2024-06-04 14:47:23 +00:00
hir_analysis_assoc_item_is_private = {$kind} `{$name}` is private
.label = private {$kind}
.defined_here_label = the {$kind} is defined here
2024-06-14 10:28:23 +00:00
hir_analysis_assoc_item_not_found = associated {$assoc_kind} `{$assoc_name}` not found for `{$qself}`
2023-11-24 08:53:10 +00:00
hir_analysis_assoc_item_not_found_found_in_other_trait_label = there is {$identically_named ->
[true] an
*[false] a similarly named
} associated {$assoc_kind} `{$suggested_name}` in the trait `{$trait_name}`
hir_analysis_assoc_item_not_found_label = associated {$assoc_kind} `{$assoc_name}` not found
2024-06-14 10:28:23 +00:00
hir_analysis_assoc_item_not_found_other_sugg = `{$qself}` has the following associated {$assoc_kind}
2024-06-14 10:38:21 +00:00
hir_analysis_assoc_item_not_found_similar_in_other_trait_qpath_sugg =
consider fully qualifying{$identically_named ->
[true] {""}
*[false] {" "}and renaming
} the associated {$assoc_kind}
2023-11-24 08:53:10 +00:00
hir_analysis_assoc_item_not_found_similar_in_other_trait_sugg = change the associated {$assoc_kind} name to use `{$suggested_name}` from `{$trait_name}`
2024-06-14 10:38:21 +00:00
hir_analysis_assoc_item_not_found_similar_in_other_trait_with_bound_sugg = ...and changing the associated {$assoc_kind} name
2023-11-24 08:53:10 +00:00
hir_analysis_assoc_item_not_found_similar_sugg = there is an associated {$assoc_kind} with a similar name
hir_analysis_assoc_kind_mismatch = expected {$expected}, found {$got}
.label = unexpected {$got}
.expected_because_label = expected a {$expected} because of this associated {$expected}
.note = the associated {$assoc_kind} is defined here
.bound_on_assoc_const_label = bounds are not allowed on associated constants
hir_analysis_assoc_kind_mismatch_wrap_in_braces_sugg = consider adding braces here
2023-08-11 21:27:52 +00:00
2024-08-26 19:53:39 +00:00
hir_analysis_associated_type_trait_uninferred_generic_params = cannot use the associated {$what} of a trait with uninferred generic parameters
2022-03-31 07:35:17 +00:00
.suggestion = use a fully qualified path with inferred lifetimes
hir_analysis_associated_type_trait_uninferred_generic_params_multipart_suggestion = use a fully qualified path with explicit lifetimes
2022-12-27 00:39:36 +00:00
hir_analysis_auto_deref_reached_recursion_limit = reached the recursion limit while auto-dereferencing `{$ty}`
.label = deref recursion limit reached
.help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]` attribute to your crate (`{$crate_name}`)
2023-05-23 01:51:25 +00:00
2024-04-04 16:54:56 +00:00
hir_analysis_bad_precise_capture = expected {$kind} parameter in `use<...>` precise captures list, found {$found}
2024-08-26 18:51:26 +00:00
hir_analysis_bad_return_type_notation_position = return type notation not allowed in this position yet
2023-09-02 21:29:27 +00:00
hir_analysis_cannot_capture_late_bound_const =
cannot capture late-bound const parameter in {$what}
2023-02-28 05:59:54 +00:00
.label = parameter defined here
2023-05-23 01:51:25 +00:00
2023-09-02 21:29:27 +00:00
hir_analysis_cannot_capture_late_bound_lifetime =
cannot capture late-bound lifetime in {$what}
.label = lifetime defined here
hir_analysis_cannot_capture_late_bound_ty =
cannot capture late-bound type parameter in {$what}
2023-02-28 05:59:54 +00:00
.label = parameter defined here
2023-05-23 01:51:25 +00:00
2023-04-10 15:04:14 +00:00
hir_analysis_closure_implicit_hrtb = implicit types in closure signatures are forbidden when `for<...>` is present
.label = `for<...>` is here
2023-05-23 01:51:25 +00:00
2024-07-17 14:47:03 +00:00
hir_analysis_cmse_call_generic =
function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type
2024-10-14 20:32:32 +00:00
hir_analysis_cmse_entry_generic =
functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type
hir_analysis_cmse_inputs_stack_spill =
arguments for `"{$abi_name}"` function too large to pass via registers
2024-07-18 12:32:10 +00:00
.label = {$plural ->
[false] this argument doesn't
*[true] these arguments don't
} fit in the available registers
2024-10-14 20:32:32 +00:00
.note = functions with the `"{$abi_name}"` ABI must pass all their arguments via the 4 32-bit available argument registers
2024-07-17 14:47:03 +00:00
2024-10-14 20:32:32 +00:00
hir_analysis_cmse_output_stack_spill =
return value of `"{$abi_name}"` function too large to pass via registers
2024-07-17 14:47:03 +00:00
.label = this type doesn't fit in the available registers
2024-10-14 20:32:32 +00:00
.note1 = functions with the `"{$abi_name}"` ABI must pass their result via the available return registers
2024-07-18 12:32:10 +00:00
.note2 = the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
2024-07-17 14:47:03 +00:00
2023-09-13 17:42:56 +00:00
hir_analysis_coerce_unsized_may = the trait `{$trait_name}` may only be implemented for a coercion between structures
hir_analysis_coerce_unsized_multi = implementing the trait `CoerceUnsized` requires multiple coercions
.note = `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced
.coercions_note = currently, {$number} fields need coercions: {$coercions}
.label = requires multiple coercions
hir_analysis_coercion_between_struct_same_note = expected coercion between the same definition; expected `{$source_path}`, found `{$target_path}`
hir_analysis_coercion_between_struct_single_note = expected a single field to be coerced, none found
2022-10-25 18:28:04 +00:00
hir_analysis_const_bound_for_non_const_trait =
2023-12-18 16:55:55 +00:00
`{$modifier}` can only be applied to `#[const_trait]` traits
2023-05-23 01:51:25 +00:00
2022-10-25 18:28:04 +00:00
hir_analysis_const_impl_for_non_const_trait =
const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]`
.suggestion = mark `{$trait_name}` as const
.note = marking a trait with `#[const_trait]` ensures all default method bodies are `const`
.adding = adding a non-const method body in the future would be a breaking change
2023-05-23 01:51:25 +00:00
2023-02-17 13:44:35 +00:00
hir_analysis_const_param_ty_impl_on_non_adt =
the trait `ConstParamTy` may not be implemented for this type
.label = type is not a structure or enumeration
2023-05-23 01:51:25 +00:00
2024-07-14 12:38:51 +00:00
hir_analysis_const_param_ty_impl_on_unsized =
the trait `ConstParamTy` may not be implemented for this type
.label = type is not `Sized`
2023-04-10 15:04:14 +00:00
hir_analysis_const_specialize = cannot specialize on const impl with non-const impl
2023-05-23 01:51:25 +00:00
2022-10-13 09:13:02 +00:00
hir_analysis_copy_impl_on_non_adt =
2023-03-07 23:55:51 +00:00
the trait `Copy` cannot be implemented for this type
2023-02-17 13:44:35 +00:00
.label = type is not a structure or enumeration
2023-05-23 01:51:25 +00:00
2022-10-13 09:13:02 +00:00
hir_analysis_copy_impl_on_type_with_dtor =
2023-03-07 23:55:51 +00:00
the trait `Copy` cannot be implemented for this type; the type has a destructor
2022-10-13 09:13:02 +00:00
.label = `Copy` not allowed on types with destructors
2023-05-23 01:51:25 +00:00
2023-10-03 17:17:40 +00:00
hir_analysis_cross_crate_traits = cross-crate traits with a default impl, like `{$traits}`, can only be implemented for a struct/enum type, not `{$self_ty}`
.label = can't implement cross-crate trait with a default impl for non-struct/enum type
hir_analysis_cross_crate_traits_defined = cross-crate traits with a default impl, like `{$traits}`, can only be implemented for a struct/enum type defined in the current crate
.label = can't implement cross-crate trait for type in another crate
2023-09-13 17:42:56 +00:00
hir_analysis_dispatch_from_dyn_multi = implementing the `DispatchFromDyn` trait requires multiple coercions
.note = the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced
.coercions_note = currently, {$number} fields need coercions: {$coercions}
hir_analysis_dispatch_from_dyn_repr = structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]`
hir_analysis_dispatch_from_dyn_zst = the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else
.note = extra field `{$name}` of type `{$ty}` is not allowed
2023-04-26 18:22:32 +00:00
hir_analysis_drop_impl_negative = negative `Drop` impls are not supported
2023-05-23 01:51:25 +00:00
2022-09-28 09:21:33 +00:00
hir_analysis_drop_impl_on_wrong_item =
2022-07-21 22:00:15 +00:00
the `Drop` trait may only be implemented for local structs, enums, and unions
.label = must be a struct, enum, or union in the current crate
2022-03-31 07:35:17 +00:00
2023-04-26 18:22:32 +00:00
hir_analysis_drop_impl_reservation = reservation `Drop` impls are not supported
2023-05-23 01:51:25 +00:00
2024-04-04 19:06:30 +00:00
hir_analysis_duplicate_precise_capture = cannot capture parameter `{$name}` twice
.label = parameter captured again here
2023-05-05 11:54:58 +00:00
hir_analysis_empty_specialization = specialization impl does not specialize any associated items
.note = impl is a specialization of this impl
2023-05-23 01:51:25 +00:00
2023-04-06 23:04:42 +00:00
hir_analysis_enum_discriminant_overflowed = enum discriminant overflowed
.label = overflowed on value after {$discr}
.note = explicitly set `{$item_name} = {$wrapped_discr}` if that is desired outcome
2023-05-23 01:51:25 +00:00
2024-01-10 01:11:25 +00:00
hir_analysis_escaping_bound_var_in_ty_of_assoc_const_binding =
the type of the associated constant `{$assoc_const}` cannot capture late-bound generic parameters
.label = its type cannot capture the late-bound {$var_def_kind} `{$var_name}`
.var_defined_here_label = the late-bound {$var_def_kind} `{$var_name}` is defined here
2022-09-28 09:21:33 +00:00
hir_analysis_field_already_declared =
2022-03-31 07:35:17 +00:00
field `{$field_name}` is already declared
.label = field already declared
2022-08-10 07:42:10 +00:00
.previous_decl_label = `{$field_name}` first declared here
2022-03-31 07:35:17 +00:00
2024-01-04 13:56:45 +00:00
hir_analysis_field_already_declared_both_nested =
field `{$field_name}` is already declared
.label = field `{$field_name}` declared in this unnamed field
.nested_field_decl_note = field `{$field_name}` declared here
.previous_decl_label = `{$field_name}` first declared here in this unnamed field
.previous_nested_field_decl_note = field `{$field_name}` first declared here
hir_analysis_field_already_declared_current_nested =
field `{$field_name}` is already declared
.label = field `{$field_name}` declared in this unnamed field
.nested_field_decl_note = field `{$field_name}` declared here
.previous_decl_label = `{$field_name}` first declared here
2024-01-29 07:08:11 +00:00
hir_analysis_field_already_declared_nested_help =
fields from the type of this unnamed field are considered fields of the outer type
2024-01-04 13:56:45 +00:00
hir_analysis_field_already_declared_previous_nested =
field `{$field_name}` is already declared
.label = field already declared
.previous_decl_label = `{$field_name}` first declared here in this unnamed field
.previous_nested_field_decl_note = field `{$field_name}` first declared here
2022-10-13 09:13:02 +00:00
hir_analysis_function_not_found_in_trait = function not found in this trait
2022-03-31 07:35:17 +00:00
2023-02-17 13:44:35 +00:00
hir_analysis_function_not_have_default_implementation = function doesn't have a default implementation
.note = required by this annotation
2022-09-28 09:21:33 +00:00
hir_analysis_functions_names_duplicated = functions names are duplicated
2022-03-31 07:35:17 +00:00
.note = all `#[rustc_must_implement_one_of]` arguments must be unique
2024-02-12 06:39:32 +00:00
hir_analysis_generic_args_on_overridden_impl = could not resolve generic parameters on overridden impl
2022-09-28 09:21:33 +00:00
hir_analysis_impl_not_marked_default = `{$ident}` specializes an item from a parent `impl`, but that item is not marked `default`
2022-03-31 07:35:17 +00:00
.label = cannot specialize default item `{$ident}`
.ok_label = parent `impl` is here
.note = to specialize, `{$ident}` in the parent `impl` must be marked `default`
2023-03-09 07:42:45 +00:00
hir_analysis_impl_not_marked_default_err = `{$ident}` specializes an item from a parent `impl`, but that item is not marked `default`
.note = parent implementation is in crate `{$cname}`
2023-09-14 18:50:22 +00:00
hir_analysis_inherent_dyn = cannot define inherent `impl` for a dyn auto trait
.label = impl requires at least one non-auto trait
.note = define and implement a new trait or type instead
hir_analysis_inherent_nominal = no nominal type found for inherent implementation
.label = impl requires a nominal type
.note = either implement a trait on it or create a newtype to wrap it instead
hir_analysis_inherent_primitive_ty = cannot define inherent `impl` for primitive types
.help = consider using an extension trait instead
hir_analysis_inherent_primitive_ty_note = you could also try moving the reference to uses of `{$subty}` (such as `self`) within the implementation
hir_analysis_inherent_ty_outside = cannot define inherent `impl` for a type outside of the crate where the type is defined
.help = consider moving this inherent impl into the crate defining the type if possible
.span_help = alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items
hir_analysis_inherent_ty_outside_new = cannot define inherent `impl` for a type outside of the crate where the type is defined
2024-06-21 22:20:45 +00:00
.label = impl for type defined outside of crate
2023-09-14 18:50:22 +00:00
.note = define and implement a trait or new type instead
hir_analysis_inherent_ty_outside_primitive = cannot define inherent `impl` for primitive types outside of `core`
.help = consider moving this inherent impl into `core` if possible
.span_help = alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items
hir_analysis_inherent_ty_outside_relevant = cannot define inherent `impl` for a type outside of the crate where the type is defined
.help = consider moving this inherent impl into the crate defining the type if possible
.span_help = alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items
Reject generic self types.
The RFC for arbitrary self types v2 declares that we should reject
"generic" self types. This commit does so.
The definition of "generic" was unclear in the RFC, but has been
explored in
https://github.com/rust-lang/rust/issues/129147
and the conclusion is that "generic" means any `self` type which
is a type parameter defined on the method itself, or references
to such a type.
This approach was chosen because other definitions of "generic"
don't work. Specifically,
* we can't filter out generic type _arguments_, because that would
filter out Rc<Self> and all the other types of smart pointer
we want to support;
* we can't filter out all type params, because Self itself is a
type param, and because existing Rust code depends on other
type params declared on the type (as opposed to the method).
This PR decides to make a new error code for this case, instead of
reusing the existing E0307 error. This makes the code a
bit more complex, but it seems we have an opportunity to provide
specific diagnostics for this case so we should do so.
This PR filters out generic self types whether or not the
'arbitrary self types' feature is enabled. However, it's believed
that it can't have any effect on code which uses stable Rust, since
there are no stable traits which can be used to indicate a valid
generic receiver type, and thus it would have been impossible to
write code which could trigger this new error case.
It is however possible that this could break existing code which
uses either of the unstable `arbitrary_self_types` or
`receiver_trait` features. This breakage is intentional; as
we move arbitrary self types towards stabilization we don't want
to continue to support generic such types.
This PR adds lots of extra tests to arbitrary-self-from-method-substs.
Most of these are ways to trigger a "type mismatch" error which
https://github.com/rust-lang/rust/blob/9b82580c7347f800c2550e6719e4218a60a80b28/compiler/rustc_hir_typeck/src/method/confirm.rs#L519
hopes can be minimized by filtering out generics in this way.
We remove a FIXME from confirm.rs suggesting that we make this change.
It's still possible to cause type mismatch errors, and a subsequent
PR may be able to improve diagnostics in this area, but it's harder
to cause these errors without contrived uses of the turbofish.
This is a part of the arbitrary self types v2 project,
https://github.com/rust-lang/rfcs/pull/3519
https://github.com/rust-lang/rust/issues/44874
r? @wesleywiser
2024-09-02 12:52:39 +00:00
hir_analysis_invalid_generic_receiver_ty = invalid generic `self` parameter type: `{$receiver_ty}`
.note = type of `self` must not be a method generic parameter type
hir_analysis_invalid_generic_receiver_ty_help =
use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
2024-04-25 01:11:19 +00:00
hir_analysis_invalid_receiver_ty = invalid `self` parameter type: `{$receiver_ty}`
.note = type of `self` must be `Self` or a type that dereferences to it
hir_analysis_invalid_receiver_ty_help =
consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
2022-09-28 09:21:33 +00:00
hir_analysis_invalid_union_field =
2022-03-31 07:35:17 +00:00
field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
2022-04-07 18:46:53 +00:00
.note = union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
2022-03-31 07:35:17 +00:00
2022-09-28 09:21:33 +00:00
hir_analysis_invalid_union_field_sugg =
2022-03-31 07:35:17 +00:00
wrap the field type in `ManuallyDrop<...>`
2023-06-26 18:19:51 +00:00
hir_analysis_late_bound_const_in_apit = `impl Trait` can only mention const parameters from an fn or impl
.label = const parameter declared here
2023-06-26 18:36:37 +00:00
hir_analysis_late_bound_lifetime_in_apit = `impl Trait` can only mention lifetimes from an fn or impl
.label = lifetime declared here
2023-06-26 18:19:51 +00:00
hir_analysis_late_bound_type_in_apit = `impl Trait` can only mention type parameters from an fn or impl
.label = type parameter declared here
2024-09-29 17:49:32 +00:00
hir_analysis_lifetime_implicitly_captured = `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list
.param_label = all lifetime parameters originating from a trait are captured implicitly
2024-04-04 19:06:30 +00:00
hir_analysis_lifetime_must_be_first = lifetime parameter `{$name}` must be listed before non-lifetime parameters
.label = move the lifetime before this parameter
2024-04-04 16:54:56 +00:00
hir_analysis_lifetime_not_captured = `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list
.label = lifetime captured due to being mentioned in the bounds of the `impl Trait`
.param_label = this lifetime parameter is captured
2022-09-28 09:21:33 +00:00
hir_analysis_lifetimes_or_bounds_mismatch_on_trait =
2022-10-22 03:09:49 +00:00
lifetime parameters or bounds on {$item_kind} `{$ident}` do not match the trait declaration
2022-03-31 07:35:17 +00:00
.label = lifetimes do not match {$item_kind} in trait
2022-08-10 07:42:10 +00:00
.generics_label = lifetimes in impl do not match this {$item_kind} in trait
2022-10-22 03:09:49 +00:00
.where_label = this `where` clause might not match the one in the trait
2022-11-28 08:03:57 +00:00
.bounds_label = this bound might be missing in the impl
2023-05-23 01:51:25 +00:00
2022-10-22 03:09:49 +00:00
hir_analysis_linkage_type =
invalid type for variable with `#[linkage]` attribute
2023-05-23 01:51:25 +00:00
2023-02-24 20:23:30 +00:00
hir_analysis_main_function_async = `main` function is not allowed to be `async`
.label = `main` function is not allowed to be `async`
2023-05-23 01:51:25 +00:00
2023-02-24 20:23:30 +00:00
hir_analysis_main_function_generic_parameters = `main` function is not allowed to have generic parameters
2022-10-22 03:09:49 +00:00
.label = `main` cannot have generic parameters
2023-05-23 01:51:25 +00:00
2022-10-22 03:09:49 +00:00
hir_analysis_main_function_return_type_generic = `main` function return type is not allowed to have generic parameters
2022-05-06 02:46:12 +00:00
2022-10-13 09:13:02 +00:00
hir_analysis_manual_implementation =
manual implementations of `{$trait_name}` are experimental
.label = manual implementations of `{$trait_name}` are experimental
.help = add `#![feature(unboxed_closures)]` to the crate attributes to enable
2024-01-18 17:20:39 +00:00
hir_analysis_method_should_return_future = method should be `async` or return a future, but it is synchronous
.note = this method is `async` so it expects a future to be returned
2022-10-13 09:13:02 +00:00
hir_analysis_missing_one_of_trait_item = not all trait items implemented, missing one of: `{$missing_items_msg}`
.label = missing one of `{$missing_items_msg}` in implementation
.note = required because of this annotation
hir_analysis_missing_trait_item = not all trait items implemented, missing: `{$missing_items_msg}`
2023-04-14 15:02:41 +00:00
.label = missing `{$missing_items_msg}` in implementation
2023-05-23 01:51:25 +00:00
2022-10-13 09:13:02 +00:00
hir_analysis_missing_trait_item_label = `{$item}` from trait
2023-05-23 01:51:25 +00:00
2022-10-13 09:13:02 +00:00
hir_analysis_missing_trait_item_suggestion = implement the missing item: `{$snippet}`
2023-05-23 01:51:25 +00:00
2022-10-13 09:13:02 +00:00
hir_analysis_missing_trait_item_unstable = not all trait items implemented, missing: `{$missing_item_name}`
.note = default implementation of `{$missing_item_name}` is unstable
2024-11-02 23:10:24 +00:00
.some_note = use of unstable library feature `{$feature}`: {$reason}
.none_note = use of unstable library feature `{$feature}`
2022-10-13 09:13:02 +00:00
2022-09-28 09:21:33 +00:00
hir_analysis_missing_type_params =
2022-05-07 06:32:01 +00:00
the type {$parameterCount ->
[one] parameter
*[other] parameters
} {$parameters} must be explicitly specified
.label = type {$parameterCount ->
[one] parameter
*[other] parameters
} {$parameters} must be specified for this
.suggestion = set the type {$parameterCount ->
[one] parameter
*[other] parameters
} to the desired {$parameterCount ->
[one] type
*[other] types
}
2022-08-10 07:42:10 +00:00
.no_suggestion_label = missing {$parameterCount ->
2022-05-07 06:32:01 +00:00
[one] reference
*[other] references
} to {$parameters}
.note = because of the default `Self` reference, type parameters must be specified on object types
2022-05-07 06:50:01 +00:00
2022-10-13 09:13:02 +00:00
hir_analysis_multiple_relaxed_default_bounds =
type parameter has more than one relaxed default bound, only one is supported
2022-08-17 09:47:44 +00:00
2023-02-22 23:50:38 +00:00
hir_analysis_must_be_name_of_associated_function = must be a name of an associated function
2023-02-24 20:23:30 +00:00
hir_analysis_must_implement_not_function = not a function
hir_analysis_must_implement_not_function_note = all `#[rustc_must_implement_one_of]` arguments must be associated function names
hir_analysis_must_implement_not_function_span_note = required by this annotation
2023-02-28 05:59:54 +00:00
hir_analysis_must_implement_one_of_attribute = the `#[rustc_must_implement_one_of]` attribute must be used with at least 2 args
2024-05-30 19:00:44 +00:00
hir_analysis_not_supported_delegation = {$descr}
2023-11-26 12:57:31 +00:00
.label = callee defined here
2024-03-30 01:21:41 +00:00
hir_analysis_only_current_traits_adt = `{$name}` is not defined in the current crate
2023-10-03 17:17:40 +00:00
hir_analysis_only_current_traits_arbitrary = only traits defined in the current crate can be implemented for arbitrary types
hir_analysis_only_current_traits_foreign = this is not defined in the current crate because this is a foreign trait
hir_analysis_only_current_traits_name = this is not defined in the current crate because {$name} are always foreign
hir_analysis_only_current_traits_note = define and implement a trait or new type instead
2024-09-26 17:10:03 +00:00
hir_analysis_only_current_traits_note_more_info = for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
hir_analysis_only_current_traits_note_uncovered = impl doesn't have any local type before any uncovered type parameters
2023-10-03 17:17:40 +00:00
hir_analysis_only_current_traits_opaque = type alias impl trait is treated as if it were foreign, because its hidden type could be from a foreign crate
hir_analysis_only_current_traits_outside = only traits defined in the current crate can be implemented for types defined outside of the crate
hir_analysis_only_current_traits_pointer = `{$pointer}` is not defined in the current crate because raw pointers are always foreign
hir_analysis_only_current_traits_pointer_sugg = consider introducing a new wrapper type
hir_analysis_only_current_traits_primitive = only traits defined in the current crate can be implemented for primitive types
hir_analysis_only_current_traits_ty = `{$ty}` is not defined in the current crate
2024-03-07 15:44:07 +00:00
hir_analysis_opaque_captures_higher_ranked_lifetime = `impl Trait` cannot capture {$bad_place}
.label = `impl Trait` implicitly captures all lifetimes in scope
.note = lifetime declared here
2023-12-28 17:51:53 +00:00
hir_analysis_param_in_ty_of_assoc_const_binding =
the type of the associated constant `{$assoc_const}` must not depend on {$param_category ->
[self] `Self`
[synthetic] `impl Trait`
*[normal] generic parameters
}
.label = its type must not depend on {$param_category ->
[self] `Self`
[synthetic] `impl Trait`
*[normal] the {$param_def_kind} `{$param_name}`
}
.param_defined_here_label = {$param_category ->
[synthetic] the `impl Trait` is specified here
*[normal] the {$param_def_kind} `{$param_name}` is defined here
}
2024-04-20 15:39:43 +00:00
hir_analysis_param_not_captured = `impl Trait` must mention all {$kind} parameters in scope in `use<...>`
2024-04-04 16:54:56 +00:00
.label = {$kind} parameter is implicitly captured by this `impl Trait`
.note = currently, all {$kind} parameters are required to be mentioned in the precise captures list
2023-02-28 05:59:54 +00:00
hir_analysis_paren_sugar_attribute = the `#[rustc_paren_sugar]` attribute is a temporary means of controlling which traits can use parenthetical notation
.help = add `#![feature(unboxed_closures)]` to the crate attributes to use it
2023-02-25 17:26:48 +00:00
hir_analysis_parenthesized_fn_trait_expansion =
parenthesized trait syntax expands to `{$expanded_type}`
2024-05-11 13:40:34 +00:00
hir_analysis_pattern_type_non_const_range = range patterns must have constant range start and end
hir_analysis_pattern_type_wild_pat = wildcard patterns are not permitted for pattern types
.label = this type is the same as the inner type without a pattern
2023-03-07 22:26:52 +00:00
hir_analysis_placeholder_not_allowed_item_signatures = the placeholder `_` is not allowed within types on item signatures for {$kind}
.label = not allowed in type signatures
2023-03-11 04:10:09 +00:00
2024-04-05 00:36:18 +00:00
hir_analysis_precise_capture_self_alias = `Self` can't be captured in `use<...>` precise captures list, since it is an alias
.label = `Self` is not a generic argument, but an alias to the type of the {$what}
2024-07-17 19:56:16 +00:00
hir_analysis_recursive_generic_parameter = {$param_def_kind} `{$param_name}` is only used recursively
.label = {$param_def_kind} must be used non-recursively in the definition
2024-07-17 20:36:21 +00:00
.note = all type parameters must be used in a non-recursive way in order to constrain their variance
2024-07-17 19:56:16 +00:00
2023-11-29 02:41:31 +00:00
hir_analysis_redundant_lifetime_args = unnecessary lifetime parameter `{$victim}`
.note = you can use the `{$candidate}` lifetime directly, in place of `{$victim}`
2023-09-13 17:42:56 +00:00
hir_analysis_requires_note = the `{$trait_name}` impl for `{$ty}` requires that `{$error_predicate}`
2023-03-11 04:10:09 +00:00
hir_analysis_return_type_notation_equality_bound =
return type notation is not allowed to use type equality
2023-05-01 05:15:45 +00:00
hir_analysis_return_type_notation_illegal_param_const =
return type notation is not allowed for functions that have const parameters
.label = const parameter declared here
hir_analysis_return_type_notation_illegal_param_type =
return type notation is not allowed for functions that have type parameters
.label = type parameter declared here
2023-05-03 21:09:50 +00:00
hir_analysis_return_type_notation_on_non_rpitit =
2023-04-06 23:04:42 +00:00
return type notation used on function that is not `async` and does not return `impl Trait`
.note = function returns `{$ty}`, which is not compatible with associated type return bounds
.label = this function must be `async` or return `impl Trait`
2023-09-02 04:02:11 +00:00
hir_analysis_rpitit_refined = impl trait in impl method signature does not match trait method signature
.suggestion = replace the return type so that it matches the trait
.label = return type from trait method defined here
.unmatched_bound_label = this bound is stronger than that defined on the trait
2023-09-07 00:49:04 +00:00
.note = add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
2024-02-28 01:08:48 +00:00
.feedback_note = we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
2023-09-02 04:02:11 +00:00
2024-11-09 00:59:35 +00:00
hir_analysis_rpitit_refined_lifetimes = impl trait in impl method captures fewer lifetimes than in trait
.suggestion = modify the `use<..>` bound to capture the same lifetimes that the trait does
.note = add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
.feedback_note = we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
2023-04-06 23:04:42 +00:00
hir_analysis_self_in_impl_self =
`Self` is not valid in the self type of an impl block
.note = replace `Self` with a different type
2024-04-20 15:39:43 +00:00
hir_analysis_self_ty_not_captured = `impl Trait` must mention the `Self` type of the trait in `use<...>`
.label = `Self` type parameter is implicitly captured by this `impl Trait`
.note = currently, all type parameters are required to be mentioned in the precise captures list
2023-04-06 23:04:42 +00:00
hir_analysis_simd_ffi_highly_experimental = use of SIMD type{$snip} in FFI is highly experimental and may result in invalid code
.help = add `#![feature(simd_ffi)]` to the crate attributes to enable
hir_analysis_specialization_trait = implementing `rustc_specialization_trait` traits is unstable
.help = add `#![feature(min_specialization)]` to the crate attributes to enable
2023-09-22 13:58:43 +00:00
hir_analysis_start_function_parameters = `#[start]` function is not allowed to have type parameters
.label = `#[start]` function cannot have type parameters
2023-04-06 23:04:42 +00:00
2023-09-22 13:58:43 +00:00
hir_analysis_start_function_where = `#[start]` function is not allowed to have a `where` clause
.label = `#[start]` function cannot have a `where` clause
2023-04-06 23:04:42 +00:00
2023-09-22 13:58:43 +00:00
hir_analysis_start_not_async = `#[start]` function is not allowed to be `async`
.label = `#[start]` is not allowed to be `async`
2023-04-06 23:04:42 +00:00
2023-09-22 13:58:43 +00:00
hir_analysis_start_not_target_feature = `#[start]` function is not allowed to have `#[target_feature]`
.label = `#[start]` function is not allowed to have `#[target_feature]`
2023-04-14 15:02:41 +00:00
2023-09-22 13:58:43 +00:00
hir_analysis_start_not_track_caller = `#[start]` function is not allowed to be `#[track_caller]`
.label = `#[start]` function is not allowed to be `#[track_caller]`
2023-04-14 15:02:41 +00:00
hir_analysis_static_specialize = cannot specialize on `'static` lifetime
2023-06-15 09:41:14 +00:00
hir_analysis_tait_forward_compat = item constrains opaque type that is not in its signature
.note = this item must mention the opaque type in its signature in order to be able to register hidden types
2024-06-10 16:17:38 +00:00
hir_analysis_tait_forward_compat2 = item does not constrain `{$opaque_type}`, but has it in its signature
.note = consider moving the opaque type's declaration and defining uses into a separate module
.opaque = this opaque type is in the signature
2023-04-14 15:02:41 +00:00
hir_analysis_target_feature_on_main = `main` function is not allowed to have `#[target_feature]`
2024-09-20 07:39:10 +00:00
hir_analysis_too_large_static = extern static is too large for the target architecture
2023-04-14 15:02:41 +00:00
hir_analysis_track_caller_on_main = `main` function is not allowed to be `#[track_caller]`
.suggestion = remove this annotation
2023-09-13 17:42:56 +00:00
hir_analysis_trait_cannot_impl_for_ty = the trait `{$trait_name}` cannot be implemented for this type
.label = this field does not implement `{$trait_name}`
2023-04-14 15:02:41 +00:00
hir_analysis_trait_object_declared_with_no_traits =
at least one trait is required for an object type
.alias_span = this alias does not contain a trait
2023-10-03 17:17:40 +00:00
hir_analysis_traits_with_defualt_impl = traits with a default impl, like `{$traits}`, cannot be implemented for {$problematic_kind} `{$self_ty}`
.note = a trait object implements `{$traits}` if and only if `{$traits}` is one of the trait object's trait bounds
2023-04-14 15:02:41 +00:00
hir_analysis_transparent_enum_variant = transparent enum needs exactly one variant, but has {$number}
.label = needs exactly one variant, but has {$number}
.many_label = too many variants in `{$path}`
.multi_label = variant here
2023-08-29 06:58:38 +00:00
hir_analysis_transparent_non_zero_sized = transparent {$desc} needs at most one field with non-trivial size or alignment, but has {$field_count}
.label = needs at most one field with non-trivial size or alignment, but has {$field_count}
.labels = this field has non-zero size or requires alignment
2023-04-14 15:02:41 +00:00
2023-08-29 06:58:38 +00:00
hir_analysis_transparent_non_zero_sized_enum = the variant of a transparent {$desc} needs at most one field with non-trivial size or alignment, but has {$field_count}
.label = needs at most one field with non-trivial size or alignment, but has {$field_count}
.labels = this field has non-zero size or requires alignment
2023-04-10 15:04:14 +00:00
2023-12-28 17:51:53 +00:00
hir_analysis_ty_of_assoc_const_binding_note = `{$assoc_const}` has type `{$ty}`
2023-10-15 11:40:17 +00:00
hir_analysis_ty_param_first_local = type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)
.label = type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)
2023-10-03 17:17:40 +00:00
.note = implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type
.case_note = in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last
2023-10-15 11:40:17 +00:00
hir_analysis_ty_param_some = type parameter `{$param}` must be used as the type parameter for some local type (e.g., `MyStruct<{$param}>`)
.label = type parameter `{$param}` must be used as the type parameter for some local type
2023-10-03 17:17:40 +00:00
.note = implementing a foreign trait is only possible if at least one of the types for which it is implemented is local
.only_note = only traits defined in the current crate can be implemented for a type parameter
2024-06-19 11:11:18 +00:00
hir_analysis_type_of = {$ty}
2023-10-04 23:08:05 +00:00
2023-04-10 15:04:14 +00:00
hir_analysis_typeof_reserved_keyword_used =
`typeof` is a reserved keyword but unimplemented
.suggestion = consider replacing `typeof(...)` with an actual type
.label = reserved keyword
2024-07-19 14:21:30 +00:00
hir_analysis_unconstrained_generic_parameter = the {$param_def_kind} `{$param_name}` is not constrained by the impl trait, self type, or predicates
.label = unconstrained {$param_def_kind}
.const_param_note = expressions using a const parameter must map each value to a distinct output value
.const_param_note2 = proving the result of expressions other than the parameter are unique is not supported
2023-04-10 15:04:14 +00:00
hir_analysis_unconstrained_opaque_type = unconstrained opaque type
.note = `{$name}` must be used in combination with a concrete type within the same {$what}
hir_analysis_unrecognized_atomic_operation =
unrecognized atomic operation function: `{$op}`
.label = unrecognized atomic operation
2023-05-05 11:54:58 +00:00
hir_analysis_unrecognized_intrinsic_function =
unrecognized intrinsic function: `{$name}`
.label = unrecognized intrinsic
2024-02-17 23:26:45 +00:00
.help = if you're adding an intrinsic, be sure to update `check_intrinsic_type`
2023-05-05 11:54:58 +00:00
2023-06-05 17:08:27 +00:00
hir_analysis_unused_associated_type_bounds =
2024-09-25 08:38:40 +00:00
unnecessary associated type bound for dyn-incompatible associated type
2024-06-21 22:20:45 +00:00
.note = this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized`
2023-06-05 17:08:27 +00:00
.suggestion = remove this bound
2024-02-01 14:58:07 +00:00
hir_analysis_unused_generic_parameter =
{$param_def_kind} `{$param_name}` is never used
.label = unused {$param_def_kind}
.const_param_help = if you intended `{$param_name}` to be a const parameter, use `const {$param_name}: /* Type */` instead
2024-07-17 22:05:21 +00:00
.usage_spans = `{$param_name}` is named here, but is likely unused in the containing type
2024-07-17 19:56:16 +00:00
2024-02-01 14:58:07 +00:00
hir_analysis_unused_generic_parameter_adt_help =
consider removing `{$param_name}`, referring to it in a field, or using a marker such as `{$phantom_data}`
hir_analysis_unused_generic_parameter_adt_no_phantom_data_help =
consider removing `{$param_name}` or referring to it in a field
hir_analysis_unused_generic_parameter_ty_alias_help =
consider removing `{$param_name}` or referring to it in the body of the type alias
2023-04-10 15:04:14 +00:00
hir_analysis_value_of_associated_struct_already_specified =
2023-10-04 01:10:51 +00:00
the value of the associated type `{$item_name}` in trait `{$def_path}` is already specified
2023-04-10 15:04:14 +00:00
.label = re-bound here
.previous_bound_label = `{$item_name}` bound here first
hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like {$conventions}
.label = C-variadic function must have a compatible calling convention
2024-06-19 11:11:18 +00:00
hir_analysis_variances_of = {$variances}
2023-04-26 18:22:32 +00:00
hir_analysis_where_clause_on_main = `main` function is not allowed to have a `where` clause
.label = `main` cannot have a `where` clause
hir_analysis_wrong_number_of_generic_arguments_to_intrinsic =
intrinsic has wrong number of {$descr} parameters: found {$found}, expected {$expected}
.label = expected {$expected} {$descr} {$expected ->
2022-05-07 06:32:01 +00:00
[one] parameter
2023-04-26 18:22:32 +00:00
*[other] parameters
2023-05-23 01:51:25 +00:00
}