diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:12:43 +0000 |
commit | cf94bdc0742c13e2a0cac864c478b8626b266e1b (patch) | |
tree | 044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /compiler/rustc_error_messages | |
parent | Adding debian version 1.65.0+dfsg1-2. (diff) | |
download | rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_error_messages')
17 files changed, 1047 insertions, 157 deletions
diff --git a/compiler/rustc_error_messages/Cargo.toml b/compiler/rustc_error_messages/Cargo.toml index fc84c7c86..9945f3379 100644 --- a/compiler/rustc_error_messages/Cargo.toml +++ b/compiler/rustc_error_messages/Cargo.toml @@ -4,7 +4,6 @@ version = "0.0.0" edition = "2021" [lib] -doctest = false [dependencies] fluent-bundle = "0.15.2" diff --git a/compiler/rustc_error_messages/locales/en-US/ast_lowering.ftl b/compiler/rustc_error_messages/locales/en-US/ast_lowering.ftl index c45e045b4..03c88c6c0 100644 --- a/compiler/rustc_error_messages/locales/en-US/ast_lowering.ftl +++ b/compiler/rustc_error_messages/locales/en-US/ast_lowering.ftl @@ -7,7 +7,9 @@ ast_lowering_use_angle_brackets = use angle brackets instead ast_lowering_invalid_abi = invalid ABI: found `{$abi}` .label = invalid ABI - .help = valid ABIs: {$valid_abis} + .note = invoke `{$command}` for a full list of supported calling conventions. + +ast_lowering_invalid_abi_suggestion = did you mean ast_lowering_assoc_ty_parentheses = parenthesized generic arguments cannot be used in associated type constraints diff --git a/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl b/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl new file mode 100644 index 000000000..178e1a67c --- /dev/null +++ b/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl @@ -0,0 +1,68 @@ +codegen_gcc_ranlib_failure = + Ranlib exited with code {$exit_code} + +codegen_gcc_linkage_const_or_mut_type = + must have type `*const T` or `*mut T` due to `#[linkage]` attribute + +codegen_gcc_unwinding_inline_asm = + GCC backend does not support unwinding from inline asm + +codegen_gcc_lto_not_supported = + LTO is not supported. You may get a linker error. + +codegen_gcc_invalid_monomorphization_basic_integer = + invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}` + +codegen_gcc_invalid_monomorphization_invalid_float_vector = + invalid monomorphization of `{$name}` intrinsic: unsupported element type `{$elem_ty}` of floating-point vector `{$vec_ty}` + +codegen_gcc_invalid_monomorphization_not_float = + invalid monomorphization of `{$name}` intrinsic: `{$ty}` is not a floating-point type + +codegen_gcc_invalid_monomorphization_unrecognized = + invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}` + +codegen_gcc_invalid_monomorphization_expected_signed_unsigned = + invalid monomorphization of `{$name}` intrinsic: expected element type `{$elem_ty}` of vector type `{$vec_ty}` to be a signed or unsigned integer type + +codegen_gcc_invalid_monomorphization_unsupported_element = + invalid monomorphization of `{$name}` intrinsic: unsupported {$name} from `{$in_ty}` with element `{$elem_ty}` to `{$ret_ty}` + +codegen_gcc_invalid_monomorphization_invalid_bitmask = + invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]` + +codegen_gcc_invalid_monomorphization_simd_shuffle = + invalid monomorphization of `{$name}` intrinsic: simd_shuffle index must be an array of `u32`, got `{$ty}` + +codegen_gcc_invalid_monomorphization_expected_simd = + invalid monomorphization of `{$name}` intrinsic: expected SIMD {$expected_ty} type, found non-SIMD `{$found_ty}` + +codegen_gcc_invalid_monomorphization_mask_type = + invalid monomorphization of `{$name}` intrinsic: mask element type is `{$ty}`, expected `i_` + +codegen_gcc_invalid_monomorphization_return_length = + invalid monomorphization of `{$name}` intrinsic: expected return type of length {$in_len}, found `{$ret_ty}` with length {$out_len} + +codegen_gcc_invalid_monomorphization_return_length_input_type = + invalid monomorphization of `{$name}` intrinsic: expected return type with length {$in_len} (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_len} + +codegen_gcc_invalid_monomorphization_return_element = + invalid monomorphization of `{$name}` intrinsic: expected return element type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}` with element type `{$out_ty}` + +codegen_gcc_invalid_monomorphization_return_type = + invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}` + +codegen_gcc_invalid_monomorphization_inserted_type = + invalid monomorphization of `{$name}` intrinsic: expected inserted type `{$in_elem}` (element of input `{$in_ty}`), found `{$out_ty}` + +codegen_gcc_invalid_monomorphization_return_integer_type = + invalid monomorphization of `{$name}` intrinsic: expected return type with integer elements, found `{$ret_ty}` with non-integer `{$out_ty}` + +codegen_gcc_invalid_monomorphization_mismatched_lengths = + invalid monomorphization of `{$name}` intrinsic: mismatched lengths: mask length `{$m_len}` != other vector length `{$v_len}` + +codegen_gcc_invalid_monomorphization_unsupported_cast = + invalid monomorphization of `{$name}` intrinsic: unsupported cast from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}` with element `{$out_elem}` + +codegen_gcc_invalid_monomorphization_unsupported_operation = + invalid monomorphization of `{$name}` intrinsic: unsupported operation on `{$in_ty}` with element `{$in_elem}` diff --git a/compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl b/compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl new file mode 100644 index 000000000..966a421bc --- /dev/null +++ b/compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl @@ -0,0 +1,121 @@ +codegen_ssa_lib_def_write_failure = failed to write lib.def file: {$error} + +codegen_ssa_version_script_write_failure = failed to write version script: {$error} + +codegen_ssa_symbol_file_write_failure = failed to write symbols file: {$error} + +codegen_ssa_ld64_unimplemented_modifier = `as-needed` modifier not implemented yet for ld64 + +codegen_ssa_linker_unsupported_modifier = `as-needed` modifier not supported for current linker + +codegen_ssa_L4Bender_exporting_symbols_unimplemented = exporting symbols not implemented yet for L4Bender + +codegen_ssa_no_natvis_directory = error enumerating natvis directory: {$error} + +codegen_ssa_copy_path = could not copy {$from} to {$to}: {$error} + +codegen_ssa_copy_path_buf = unable to copy {$source_file} to {$output_path}: {$error} + +codegen_ssa_ignoring_emit_path = ignoring emit path because multiple .{$extension} files were produced + +codegen_ssa_ignoring_output = ignoring -o because multiple .{$extension} files were produced + +codegen_ssa_create_temp_dir = couldn't create a temp dir: {$error} + +codegen_ssa_incompatible_linking_modifiers = the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs + +codegen_ssa_add_native_library = failed to add native library {$library_path}: {$error} + +codegen_ssa_multiple_external_func_decl = multiple declarations of external function `{$function}` from library `{$library_name}` have different calling conventions + +codegen_ssa_rlib_missing_format = could not find formats for rlibs + +codegen_ssa_rlib_only_rmeta_found = could not find rlib for: `{$crate_name}`, found rmeta (metadata) file + +codegen_ssa_rlib_not_found = could not find rlib for: `{$crate_name}` + +codegen_ssa_rlib_incompatible_dependency_formats = `{$ty1}` and `{$ty2}` do not have equivalent dependency formats (`{$list1}` vs `{$list2}`) + +codegen_ssa_linking_failed = linking with `{$linker_path}` failed: {$exit_status} + +codegen_ssa_extern_funcs_not_found = some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified + +codegen_ssa_specify_libraries_to_link = use the `-l` flag to specify native libraries to link + +codegen_ssa_use_cargo_directive = use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname) + +codegen_ssa_thorin_read_input_failure = failed to read input file + +codegen_ssa_thorin_parse_input_file_kind = failed to parse input file kind + +codegen_ssa_thorin_parse_input_object_file = failed to parse input object file + +codegen_ssa_thorin_parse_input_archive_file = failed to parse input archive file + +codegen_ssa_thorin_parse_archive_member = failed to parse archive member + +codegen_ssa_thorin_invalid_input_kind = input is not an archive or elf object + +codegen_ssa_thorin_decompress_data = failed to decompress compressed section + +codegen_ssa_thorin_section_without_name = section without name at offset {$offset} + +codegen_ssa_thorin_relocation_with_invalid_symbol = relocation with invalid symbol for section `{$section}` at offset {$offset} + +codegen_ssa_thorin_multiple_relocations = multiple relocations for section `{$section}` at offset {$offset} + +codegen_ssa_thorin_unsupported_relocation = unsupported relocation for section {$section} at offset {$offset} + +codegen_ssa_thorin_missing_dwo_name = missing path attribute to DWARF object ({$id}) + +codegen_ssa_thorin_no_compilation_units = input object has no compilation units + +codegen_ssa_thorin_no_die = no top-level debugging information entry in compilation/type unit + +codegen_ssa_thorin_top_level_die_not_unit = top-level debugging information entry is not a compilation/type unit + +codegen_ssa_thorin_missing_required_section = input object missing required section `{$section}` + +codegen_ssa_thorin_parse_unit_abbreviations = failed to parse unit abbreviations + +codegen_ssa_thorin_parse_unit_attribute = failed to parse unit attribute + +codegen_ssa_thorin_parse_unit_header = failed to parse unit header + +codegen_ssa_thorin_parse_unit = failed to parse unit + +codegen_ssa_thorin_incompatible_index_version = incompatible `{$section}` index version: found version {$actual}, expected version {$format} + +codegen_ssa_thorin_offset_at_index = read offset at index {$index} of `.debug_str_offsets.dwo` section + +codegen_ssa_thorin_str_at_offset = read string at offset {$offset} of `.debug_str.dwo` section + +codegen_ssa_thorin_parse_index = failed to parse `{$section}` index section + +codegen_ssa_thorin_unit_not_in_index = unit {$unit} from input package is not in its index + +codegen_ssa_thorin_row_not_in_index = row {$row} found in index's hash table not present in index + +codegen_ssa_thorin_section_not_in_row = section not found in unit's row in index + +codegen_ssa_thorin_empty_unit = unit {$unit} in input DWARF object with no data + +codegen_ssa_thorin_multiple_debug_info_section = multiple `.debug_info.dwo` sections + +codegen_ssa_thorin_multiple_debug_types_section = multiple `.debug_types.dwo` sections in a package + +codegen_ssa_thorin_not_split_unit = regular compilation unit in object (missing dwo identifier) + +codegen_ssa_thorin_duplicate_unit = duplicate split compilation unit ({$unit}) + +codegen_ssa_thorin_missing_referenced_unit = unit {$unit} referenced by executable was not found + +codegen_ssa_thorin_not_output_object_created = no output object was created from inputs + +codegen_ssa_thorin_mixed_input_encodings = input objects haved mixed encodings + +codegen_ssa_thorin_io = {$error} +codegen_ssa_thorin_object_read = {$error} +codegen_ssa_thorin_object_write = {$error} +codegen_ssa_thorin_gimli_read = {$error} +codegen_ssa_thorin_gimli_write = {$error} diff --git a/compiler/rustc_error_messages/locales/en-US/compiletest.ftl b/compiler/rustc_error_messages/locales/en-US/compiletest.ftl new file mode 100644 index 000000000..55061fbce --- /dev/null +++ b/compiler/rustc_error_messages/locales/en-US/compiletest.ftl @@ -0,0 +1,5 @@ +compiletest_example = this is an example message used in testing + .note = with a note + .help = with a help + .suggestion = with a suggestion + .label = with a label diff --git a/compiler/rustc_error_messages/locales/en-US/errors.ftl b/compiler/rustc_error_messages/locales/en-US/errors.ftl new file mode 100644 index 000000000..429bdd277 --- /dev/null +++ b/compiler/rustc_error_messages/locales/en-US/errors.ftl @@ -0,0 +1,13 @@ +errors_target_invalid_address_space = invalid address space `{$addr_space}` for `{$cause}` in "data-layout": {$err} + +errors_target_invalid_bits = invalid {$kind} `{$bit}` for `{$cause}` in "data-layout": {$err} + +errors_target_missing_alignment = missing alignment for `{$cause}` in "data-layout" + +errors_target_invalid_alignment = invalid alignment for `{$cause}` in "data-layout": {$err} + +errors_target_inconsistent_architecture = inconsistent target specification: "data-layout" claims architecture is {$dl}-endian, while "target-endian" is `{$target}` + +errors_target_inconsistent_pointer_width = inconsistent target specification: "data-layout" claims pointers are {$pointer_size}-bit, while "target-pointer-width" is `{$target}` + +errors_target_invalid_bits_size = {$err} diff --git a/compiler/rustc_error_messages/locales/en-US/typeck.ftl b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl index 272731d99..74088f4df 100644 --- a/compiler/rustc_error_messages/locales/en-US/typeck.ftl +++ b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl @@ -1,101 +1,101 @@ -typeck_field_multiply_specified_in_initializer = +hir_analysis_field_multiply_specified_in_initializer = field `{$ident}` specified more than once .label = used more than once .previous_use_label = first use of `{$ident}` -typeck_unrecognized_atomic_operation = +hir_analysis_unrecognized_atomic_operation = unrecognized atomic operation function: `{$op}` .label = unrecognized atomic operation -typeck_wrong_number_of_generic_arguments_to_intrinsic = +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 -> [one] parameter *[other] parameters } -typeck_unrecognized_intrinsic_function = +hir_analysis_unrecognized_intrinsic_function = unrecognized intrinsic function: `{$name}` .label = unrecognized intrinsic -typeck_lifetimes_or_bounds_mismatch_on_trait = +hir_analysis_lifetimes_or_bounds_mismatch_on_trait = lifetime parameters or bounds on {$item_kind} `{$ident}` do not match the trait declaration .label = lifetimes do not match {$item_kind} in trait .generics_label = lifetimes in impl do not match this {$item_kind} in trait -typeck_drop_impl_on_wrong_item = +hir_analysis_drop_impl_on_wrong_item = 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 -typeck_field_already_declared = +hir_analysis_field_already_declared = field `{$field_name}` is already declared .label = field already declared .previous_decl_label = `{$field_name}` first declared here -typeck_copy_impl_on_type_with_dtor = +hir_analysis_copy_impl_on_type_with_dtor = the trait `Copy` may not be implemented for this type; the type has a destructor .label = `Copy` not allowed on types with destructors -typeck_multiple_relaxed_default_bounds = +hir_analysis_multiple_relaxed_default_bounds = type parameter has more than one relaxed default bound, only one is supported -typeck_copy_impl_on_non_adt = +hir_analysis_copy_impl_on_non_adt = the trait `Copy` may not be implemented for this type .label = type is not a structure or enumeration -typeck_trait_object_declared_with_no_traits = +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 -typeck_ambiguous_lifetime_bound = +hir_analysis_ambiguous_lifetime_bound = ambiguous lifetime bound, explicit lifetime bound required -typeck_assoc_type_binding_not_allowed = +hir_analysis_assoc_type_binding_not_allowed = associated type bindings are not allowed here .label = associated type not allowed here -typeck_functional_record_update_on_non_struct = +hir_analysis_functional_record_update_on_non_struct = functional record update syntax requires a struct -typeck_typeof_reserved_keyword_used = +hir_analysis_typeof_reserved_keyword_used = `typeof` is a reserved keyword but unimplemented .suggestion = consider replacing `typeof(...)` with an actual type .label = reserved keyword -typeck_return_stmt_outside_of_fn_body = +hir_analysis_return_stmt_outside_of_fn_body = return statement outside of function body .encl_body_label = the return is part of this body... .encl_fn_label = ...not the enclosing function body -typeck_yield_expr_outside_of_generator = +hir_analysis_yield_expr_outside_of_generator = yield expression outside of generator literal -typeck_struct_expr_non_exhaustive = +hir_analysis_struct_expr_non_exhaustive = cannot create non-exhaustive {$what} using struct expression -typeck_method_call_on_unknown_type = +hir_analysis_method_call_on_unknown_type = the type of this value must be known to call a method on a raw pointer on it -typeck_value_of_associated_struct_already_specified = +hir_analysis_value_of_associated_struct_already_specified = the value of the associated type `{$item_name}` (from trait `{$def_path}`) is already specified .label = re-bound here .previous_bound_label = `{$item_name}` bound here first -typeck_address_of_temporary_taken = cannot take address of a temporary +hir_analysis_address_of_temporary_taken = cannot take address of a temporary .label = temporary value -typeck_add_return_type_add = try adding a return type +hir_analysis_add_return_type_add = try adding a return type -typeck_add_return_type_missing_here = a return type might be missing here +hir_analysis_add_return_type_missing_here = a return type might be missing here -typeck_expected_default_return_type = expected `()` because of default return type +hir_analysis_expected_default_return_type = expected `()` because of default return type -typeck_expected_return_type = expected `{$expected}` because of return type +hir_analysis_expected_return_type = expected `{$expected}` because of return type -typeck_unconstrained_opaque_type = unconstrained opaque type - .note = `{$name}` must be used in combination with a concrete type within the same module +hir_analysis_unconstrained_opaque_type = unconstrained opaque type + .note = `{$name}` must be used in combination with a concrete type within the same {$what} -typeck_missing_type_params = +hir_analysis_missing_type_params = the type {$parameterCount -> [one] parameter *[other] parameters @@ -117,19 +117,36 @@ typeck_missing_type_params = } to {$parameters} .note = because of the default `Self` reference, type parameters must be specified on object types -typeck_manual_implementation = +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 -typeck_substs_on_overridden_impl = could not resolve substs on overridden impl +hir_analysis_substs_on_overridden_impl = could not resolve substs on overridden impl -typeck_unused_extern_crate = +hir_analysis_unused_extern_crate = unused extern crate .suggestion = remove it -typeck_extern_crate_not_idiomatic = +hir_analysis_extern_crate_not_idiomatic = `extern crate` is not idiomatic in the new edition .suggestion = convert it to a `{$msg_code}` -typeck_expected_used_symbol = expected `used`, `used(compiler)` or `used(linker)` +hir_analysis_expected_used_symbol = expected `used`, `used(compiler)` or `used(linker)` + +hir_analysis_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}` + +hir_analysis_add_missing_parentheses_in_range = you must surround the range in parentheses to call its `{$func_name}` function + +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 + +hir_analysis_const_bound_for_non_const_trait = + ~const can only be applied to `#[const_trait]` traits + +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 diff --git a/compiler/rustc_error_messages/locales/en-US/infer.ftl b/compiler/rustc_error_messages/locales/en-US/infer.ftl index 65371a285..18b3408b0 100644 --- a/compiler/rustc_error_messages/locales/en-US/infer.ftl +++ b/compiler/rustc_error_messages/locales/en-US/infer.ftl @@ -164,7 +164,9 @@ infer_region_explanation = {$pref_kind -> } infer_mismatched_static_lifetime = incompatible lifetime on type -infer_msl_impl_note = ...does not necessarily outlive the static lifetime introduced by the compatible `impl` +infer_does_not_outlive_static_from_impl = ...does not necessarily outlive the static lifetime introduced by the compatible `impl` +infer_implicit_static_lifetime_note = this has an implicit `'static` lifetime requirement +infer_implicit_static_lifetime_suggestion = consider relaxing the implicit `'static` requirement infer_msl_introduces_static = introduces a `'static` lifetime requirement infer_msl_unmet_req = because this has an unmet lifetime requirement infer_msl_trait_note = this has an implicit `'static` lifetime requirement diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl index 7f9918e4f..7e28f22c0 100644 --- a/compiler/rustc_error_messages/locales/en-US/lint.ftl +++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl @@ -51,7 +51,7 @@ lint_non_existant_doc_keyword = found non-existing keyword `{$keyword}` used in .help = only existing keywords are allowed in core/std lint_diag_out_of_impl = - diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls + diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls lint_untranslatable_diag = diagnostics should be created using translatable messages @@ -433,3 +433,8 @@ lint_check_name_unknown_tool = unknown lint tool: `{$tool_name}` lint_check_name_warning = {$msg} lint_check_name_deprecated = lint name `{$lint_name}` is deprecated and does not have an effect anymore. Use: {$new_name} + +lint_opaque_hidden_inferred_bound = opaque type `{$ty}` does not satisfy its associated type bounds + .specifically = this associated type bound is unsatisfied for `{$proj_ty}` + +lint_opaque_hidden_inferred_bound_sugg = add this bound diff --git a/compiler/rustc_error_messages/locales/en-US/metadata.ftl b/compiler/rustc_error_messages/locales/en-US/metadata.ftl index d27100c56..08e553d9f 100644 --- a/compiler/rustc_error_messages/locales/en-US/metadata.ftl +++ b/compiler/rustc_error_messages/locales/en-US/metadata.ftl @@ -165,6 +165,8 @@ metadata_failed_write_error = metadata_missing_native_library = could not find native static library `{$libname}`, perhaps an -L flag is missing? +metadata_only_provide_library_name = only provide the library name `{$suggested_name}`, not the full filename + metadata_failed_create_tempdir = couldn't create a temp dir: {$err} diff --git a/compiler/rustc_error_messages/locales/en-US/middle.ftl b/compiler/rustc_error_messages/locales/en-US/middle.ftl index ed8348864..b9e4499d4 100644 --- a/compiler/rustc_error_messages/locales/en-US/middle.ftl +++ b/compiler/rustc_error_messages/locales/en-US/middle.ftl @@ -15,3 +15,15 @@ middle_previous_use_here = middle_limit_invalid = `limit` must be a non-negative integer .label = {$error_str} + +middle_const_eval_non_int = + constant evaluation of enum discriminant resulted in non-integer + +middle_unknown_layout = + the type `{$ty}` has an unknown layout + +middle_values_too_big = + values of the type `{$ty}` are too big for the current architecture + +middle_cannot_be_normalized = + unable to determine layout for `{$ty}` because `{$failure_ty}` cannot be normalized diff --git a/compiler/rustc_error_messages/locales/en-US/parser.ftl b/compiler/rustc_error_messages/locales/en-US/parser.ftl index f74df3d97..13c368d1c 100644 --- a/compiler/rustc_error_messages/locales/en-US/parser.ftl +++ b/compiler/rustc_error_messages/locales/en-US/parser.ftl @@ -47,7 +47,7 @@ parser_invalid_comparison_operator = invalid comparison operator `{$invalid}` .spaceship_operator_invalid = `<=>` is not a valid comparison operator, use `std::cmp::Ordering` parser_invalid_logical_operator = `{$incorrect}` is not a logical operator - .note = unlike in e.g., python and PHP, `&&` and `||` are used for logical operators + .note = unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators .use_amp_amp_for_conjunction = use `&&` to perform logical conjunction .use_pipe_pipe_for_disjunction = use `||` to perform logical disjunction @@ -55,7 +55,9 @@ parser_tilde_is_not_unary_operator = `~` cannot be used as a unary operator .suggestion = use `!` to perform bitwise not parser_unexpected_token_after_not = unexpected {$negated_desc} after identifier - .suggestion = use `!` to perform logical negation +parser_unexpected_token_after_not_bitwise = use `!` to perform bitwise not +parser_unexpected_token_after_not_logical = use `!` to perform logical negation +parser_unexpected_token_after_not_default = use `!` to perform logical negation or bitwise not parser_malformed_loop_label = malformed loop label .suggestion = use the correct loop label format @@ -69,6 +71,8 @@ parser_field_expression_with_generic = field expressions cannot have generic arg parser_macro_invocation_with_qualified_path = macros cannot use qualified paths parser_unexpected_token_after_label = expected `while`, `for`, `loop` or `{"{"}` after a label + .suggestion_remove_label = consider removing the label + .suggestion_enclose_in_block = consider enclosing expression in a block parser_require_colon_after_labeled_expression = labeled expression must be followed by `:` .note = labels are used before loops and blocks, allowing e.g., `break 'label` to them @@ -156,3 +160,212 @@ parser_remove_let = expected pattern, found `let` parser_use_eq_instead = unexpected `==` .suggestion = try using `=` instead + +parser_use_empty_block_not_semi = expected { "`{}`" }, found `;` + .suggestion = try using { "`{}`" } instead + +parser_comparison_interpreted_as_generic = + `<` is interpreted as a start of generic arguments for `{$type}`, not a comparison + .label_args = interpreted as generic arguments + .label_comparison = not interpreted as comparison + .suggestion = try comparing the cast value + +parser_shift_interpreted_as_generic = + `<<` is interpreted as a start of generic arguments for `{$type}`, not a shift + .label_args = interpreted as generic arguments + .label_comparison = not interpreted as shift + .suggestion = try shifting the cast value + +parser_found_expr_would_be_stmt = expected expression, found `{$token}` + .label = expected expression + +parser_leading_plus_not_supported = leading `+` is not supported + .label = unexpected `+` + .suggestion_remove_plus = try removing the `+` + +parser_parentheses_with_struct_fields = invalid `struct` delimiters or `fn` call arguments + .suggestion_braces_for_struct = if `{$type}` is a struct, use braces as delimiters + .suggestion_no_fields_for_fn = if `{$type}` is a function, use the arguments directly + +parser_labeled_loop_in_break = parentheses are required around this expression to avoid confusion with a labeled break expression + +parser_sugg_wrap_expression_in_parentheses = wrap the expression in parentheses + +parser_array_brackets_instead_of_braces = this is a block expression, not an array + .suggestion = to make an array, use square brackets instead of curly braces + +parser_match_arm_body_without_braces = `match` arm body without braces + .label_statements = {$num_statements -> + [one] this statement is not surrounded by a body + *[other] these statements are not surrounded by a body + } + .label_arrow = while parsing the `match` arm starting here + .suggestion_add_braces = surround the {$num_statements -> + [one] statement + *[other] statements + } with a body + .suggestion_use_comma_not_semicolon = use a comma to end a `match` arm expression + +parser_struct_literal_not_allowed_here = struct literals are not allowed here + .suggestion = surround the struct literal with parentheses + +parser_invalid_interpolated_expression = invalid interpolated expression + +parser_hexadecimal_float_literal_not_supported = hexadecimal float literal is not supported +parser_octal_float_literal_not_supported = octal float literal is not supported +parser_binary_float_literal_not_supported = binary float literal is not supported +parser_not_supported = not supported + +parser_invalid_literal_suffix = suffixes on {$kind} literals are invalid + .label = invalid suffix `{$suffix}` + +parser_invalid_literal_suffix_on_tuple_index = suffixes on a tuple index are invalid + .label = invalid suffix `{$suffix}` + .tuple_exception_line_1 = `{$suffix}` is *temporarily* accepted on tuple index fields as it was incorrectly accepted on stable for a few releases + .tuple_exception_line_2 = on proc macros, you'll want to use `syn::Index::from` or `proc_macro::Literal::*_unsuffixed` for code that will desugar to tuple field access + .tuple_exception_line_3 = see issue #60210 <https://github.com/rust-lang/rust/issues/60210> for more information + +parser_non_string_abi_literal = non-string ABI literal + .suggestion = specify the ABI with a string literal + +parser_mismatched_closing_delimiter = mismatched closing delimiter: `{$delimiter}` + .label_unmatched = mismatched closing delimiter + .label_opening_candidate = closing delimiter possibly meant for this + .label_unclosed = unclosed delimiter + +parser_incorrect_visibility_restriction = incorrect visibility restriction + .help = some possible visibility restrictions are: + `pub(crate)`: visible only on the current crate + `pub(super)`: visible only in the current module's parent + `pub(in path::to::module)`: visible only on the specified path + .suggestion = make this visible only to module `{$inner_str}` with `in` + +parser_assignment_else_not_allowed = <assignment> ... else {"{"} ... {"}"} is not allowed + +parser_expected_statement_after_outer_attr = expected statement after outer attribute + +parser_doc_comment_does_not_document_anything = found a documentation comment that doesn't document anything + .help = doc comments must come before what they document, if a comment was intended use `//` + .suggestion = missing comma here + +parser_const_let_mutually_exclusive = `const` and `let` are mutually exclusive + .suggestion = remove `let` + +parser_invalid_expression_in_let_else = a `{$operator}` expression cannot be directly assigned in `let...else` +parser_invalid_curly_in_let_else = right curly brace `{"}"}` before `else` in a `let...else` statement not allowed + +parser_compound_assignment_expression_in_let = can't reassign to an uninitialized variable + .suggestion = initialize the variable + .help = if you meant to overwrite, remove the `let` binding + +parser_suffixed_literal_in_attribute = suffixed literals are not allowed in attributes + .help = instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) + +parser_invalid_meta_item = expected unsuffixed literal or identifier, found `{$token}` + +parser_label_inner_attr_does_not_annotate_this = the inner attribute doesn't annotate this {$item} +parser_sugg_change_inner_attr_to_outer = to annotate the {$item}, change the attribute from inner to outer style + +parser_inner_attr_not_permitted_after_outer_doc_comment = an inner attribute is not permitted following an outer doc comment + .label_attr = not permitted following an outer doc comment + .label_prev_doc_comment = previous doc comment + .label_does_not_annotate_this = {parser_label_inner_attr_does_not_annotate_this} + .sugg_change_inner_to_outer = {parser_sugg_change_inner_attr_to_outer} + +parser_inner_attr_not_permitted_after_outer_attr = an inner attribute is not permitted following an outer attribute + .label_attr = not permitted following an outer attribute + .label_prev_attr = previous outer attribute + .label_does_not_annotate_this = {parser_label_inner_attr_does_not_annotate_this} + .sugg_change_inner_to_outer = {parser_sugg_change_inner_attr_to_outer} + +parser_inner_attr_not_permitted = an inner attribute is not permitted in this context + .label_does_not_annotate_this = {parser_label_inner_attr_does_not_annotate_this} + .sugg_change_inner_to_outer = {parser_sugg_change_inner_attr_to_outer} + +parser_inner_attr_explanation = inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +parser_outer_attr_explanation = outer attributes, like `#[test]`, annotate the item following them + +parser_inner_doc_comment_not_permitted = expected outer doc comment + .note = inner doc comments like this (starting with `//!` or `/*!`) can only appear before items + .suggestion = you might have meant to write a regular comment + .label_does_not_annotate_this = the inner doc comment doesn't annotate this {$item} + .sugg_change_inner_to_outer = to annotate the {$item}, change the doc comment from inner to outer style + +parser_expected_identifier_found_reserved_identifier_str = expected identifier, found reserved identifier `{$token}` +parser_expected_identifier_found_keyword_str = expected identifier, found keyword `{$token}` +parser_expected_identifier_found_reserved_keyword_str = expected identifier, found reserved keyword `{$token}` +parser_expected_identifier_found_doc_comment_str = expected identifier, found doc comment `{$token}` +parser_expected_identifier_found_str = expected identifier, found `{$token}` + +parser_expected_identifier_found_reserved_identifier = expected identifier, found reserved identifier +parser_expected_identifier_found_keyword = expected identifier, found keyword +parser_expected_identifier_found_reserved_keyword = expected identifier, found reserved keyword +parser_expected_identifier_found_doc_comment = expected identifier, found doc comment +parser_expected_identifier = expected identifier + +parser_sugg_escape_to_use_as_identifier = escape `{$ident_name}` to use it as an identifier + +parser_sugg_remove_comma = remove this comma + +parser_expected_semi_found_reserved_identifier_str = expected `;`, found reserved identifier `{$token}` +parser_expected_semi_found_keyword_str = expected `;`, found keyword `{$token}` +parser_expected_semi_found_reserved_keyword_str = expected `;`, found reserved keyword `{$token}` +parser_expected_semi_found_doc_comment_str = expected `;`, found doc comment `{$token}` +parser_expected_semi_found_str = expected `;`, found `{$token}` + +parser_sugg_change_this_to_semi = change this to `;` +parser_sugg_add_semi = add `;` here +parser_label_unexpected_token = unexpected token + +parser_unmatched_angle_brackets = {$num_extra_brackets -> + [one] unmatched angle bracket + *[other] unmatched angle brackets + } + .suggestion = {$num_extra_brackets -> + [one] remove extra angle bracket + *[other] remove extra angle brackets + } + +parser_generic_parameters_without_angle_brackets = generic parameters without surrounding angle brackets + .suggestion = surround the type parameters with angle brackets + +parser_comparison_operators_cannot_be_chained = comparison operators cannot be chained + .sugg_parentheses_for_function_args = or use `(...)` if you meant to specify fn arguments + .sugg_split_comparison = split the comparison into two + .sugg_parenthesize = parenthesize the comparison +parser_sugg_turbofish_syntax = use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + +parser_question_mark_in_type = invalid `?` in type + .label = `?` is only allowed on expressions, not types + .suggestion = if you meant to express that the type might not contain a value, use the `Option` wrapper type + +parser_unexpected_parentheses_in_for_head = unexpected parentheses surrounding `for` loop head + .suggestion = remove parentheses in `for` loop + +parser_doc_comment_on_param_type = documentation comments cannot be applied to a function parameter's type + .label = doc comments are not allowed here + +parser_attribute_on_param_type = attributes cannot be applied to a function parameter's type + .label = attributes are not allowed here + +parser_pattern_method_param_without_body = patterns aren't allowed in methods without bodies + .suggestion = give this argument a name or use an underscore to ignore it + +parser_self_param_not_first = unexpected `self` parameter in function + .label = must be the first parameter of an associated function + +parser_const_generic_without_braces = expressions must be enclosed in braces to be used as const generic arguments + .suggestion = enclose the `const` expression in braces + +parser_unexpected_const_param_declaration = unexpected `const` parameter declaration + .label = expected a `const` expression, not a parameter declaration + .suggestion = `const` parameters must be declared for the `impl` + +parser_unexpected_const_in_generic_param = expected lifetime, type, or constant, found keyword `const` + .suggestion = the `const` keyword is only needed in the definition of the type + +parser_async_move_order_incorrect = the order of `move` and `async` is incorrect + .suggestion = try switching the order + +parser_double_colon_in_bound = expected `:` followed by trait or lifetime + .suggestion = use single colon diff --git a/compiler/rustc_error_messages/locales/en-US/passes.ftl b/compiler/rustc_error_messages/locales/en-US/passes.ftl index 556a6452f..4bc6bd9fb 100644 --- a/compiler/rustc_error_messages/locales/en-US/passes.ftl +++ b/compiler/rustc_error_messages/locales/en-US/passes.ftl @@ -10,88 +10,119 @@ passes_outer_crate_level_attr = passes_inner_crate_level_attr = crate-level attribute should be in the root module -passes_ignored_attr_with_macro = `#[{$sym}]` is ignored on struct fields, match arms and macro defs +passes_ignored_attr_with_macro = + `#[{$sym}]` is ignored on struct fields, match arms and macro defs .warn = {-passes_previously_accepted} .note = {-passes_see_issue(issue: "80564")} -passes_ignored_attr = `#[{$sym}]` is ignored on struct fields and match arms +passes_ignored_attr = + `#[{$sym}]` is ignored on struct fields and match arms .warn = {-passes_previously_accepted} .note = {-passes_see_issue(issue: "80564")} -passes_inline_ignored_function_prototype = `#[inline]` is ignored on function prototypes +passes_inline_ignored_function_prototype = + `#[inline]` is ignored on function prototypes -passes_inline_ignored_constants = `#[inline]` is ignored on constants +passes_inline_ignored_constants = + `#[inline]` is ignored on constants .warn = {-passes_previously_accepted} .note = {-passes_see_issue(issue: "65833")} -passes_inline_not_fn_or_closure = attribute should be applied to function or closure +passes_inline_not_fn_or_closure = + attribute should be applied to function or closure .label = not a function or closure -passes_no_coverage_ignored_function_prototype = `#[no_coverage]` is ignored on function prototypes +passes_no_coverage_ignored_function_prototype = + `#[no_coverage]` is ignored on function prototypes passes_no_coverage_propagate = `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly -passes_no_coverage_fn_defn = `#[no_coverage]` may only be applied to function definitions +passes_no_coverage_fn_defn = + `#[no_coverage]` may only be applied to function definitions -passes_no_coverage_not_coverable = `#[no_coverage]` must be applied to coverable code +passes_no_coverage_not_coverable = + `#[no_coverage]` must be applied to coverable code .label = not coverable code -passes_should_be_applied_to_fn = attribute should be applied to a function definition +passes_should_be_applied_to_fn = + attribute should be applied to a function definition .label = not a function definition -passes_naked_tracked_caller = cannot use `#[track_caller]` with `#[naked]` +passes_naked_tracked_caller = + cannot use `#[track_caller]` with `#[naked]` -passes_should_be_applied_to_struct_enum = attribute should be applied to a struct or enum +passes_should_be_applied_to_struct_enum = + attribute should be applied to a struct or enum .label = not a struct or enum -passes_should_be_applied_to_trait = attribute should be applied to a trait +passes_should_be_applied_to_trait = + attribute should be applied to a trait .label = not a trait -passes_target_feature_on_statement = {passes_should_be_applied_to_fn} +passes_target_feature_on_statement = + {passes_should_be_applied_to_fn} .warn = {-passes_previously_accepted} .label = {passes_should_be_applied_to_fn.label} -passes_should_be_applied_to_static = attribute should be applied to a static +passes_should_be_applied_to_static = + attribute should be applied to a static .label = not a static -passes_doc_expect_str = doc {$attr_name} attribute expects a string: #[doc({$attr_name} = "a")] +passes_doc_expect_str = + doc {$attr_name} attribute expects a string: #[doc({$attr_name} = "a")] -passes_doc_alias_empty = {$attr_str} attribute cannot have empty value +passes_doc_alias_empty = + {$attr_str} attribute cannot have empty value -passes_doc_alias_bad_char = {$char_} character isn't allowed in {$attr_str} +passes_doc_alias_bad_char = + {$char_} character isn't allowed in {$attr_str} -passes_doc_alias_start_end = {$attr_str} cannot start or end with ' ' +passes_doc_alias_start_end = + {$attr_str} cannot start or end with ' ' -passes_doc_alias_bad_location = {$attr_str} isn't allowed on {$location} +passes_doc_alias_bad_location = + {$attr_str} isn't allowed on {$location} -passes_doc_alias_not_an_alias = {$attr_str} is the same as the item's name +passes_doc_alias_not_an_alias = + {$attr_str} is the same as the item's name passes_doc_alias_duplicated = doc alias is duplicated .label = first defined here -passes_doc_alias_not_string_literal = `#[doc(alias("a"))]` expects string literals +passes_doc_alias_not_string_literal = + `#[doc(alias("a"))]` expects string literals passes_doc_alias_malformed = doc alias attribute expects a string `#[doc(alias = "a")]` or a list of strings `#[doc(alias("a", "b"))]` -passes_doc_keyword_empty_mod = `#[doc(keyword = "...")]` should be used on empty modules +passes_doc_keyword_empty_mod = + `#[doc(keyword = "...")]` should be used on empty modules -passes_doc_keyword_not_mod = `#[doc(keyword = "...")]` should be used on modules +passes_doc_keyword_not_mod = + `#[doc(keyword = "...")]` should be used on modules -passes_doc_keyword_invalid_ident = `{$doc_keyword}` is not a valid identifier +passes_doc_keyword_invalid_ident = + `{$doc_keyword}` is not a valid identifier passes_doc_fake_variadic_not_valid = `#[doc(fake_variadic)]` must be used on the first of a set of tuple or fn pointer trait impls with varying arity -passes_doc_keyword_only_impl = `#[doc(keyword = "...")]` should be used on impl blocks +passes_doc_keyword_only_impl = + `#[doc(keyword = "...")]` should be used on impl blocks -passes_doc_inline_conflict_first = this attribute... -passes_doc_inline_conflict_second = ...conflicts with this attribute -passes_doc_inline_conflict = conflicting doc inlining attributes +passes_doc_inline_conflict_first = + this attribute... + +passes_doc_inline_conflict_second = + {"."}..conflicts with this attribute + +passes_doc_inline_conflict = + conflicting doc inlining attributes .help = remove one of the conflicting attributes -passes_doc_inline_only_use = this attribute can only be applied to a `use` item +passes_doc_inline_only_use = + this attribute can only be applied to a `use` item .label = only applicable on `use` items .not_a_use_item_label = not a `use` item .note = read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information @@ -99,30 +130,42 @@ passes_doc_inline_only_use = this attribute can only be applied to a `use` item passes_doc_attr_not_crate_level = `#![doc({$attr_name} = "...")]` isn't allowed as a crate-level attribute -passes_attr_crate_level = this attribute can only be applied at the crate level +passes_attr_crate_level = + this attribute can only be applied at the crate level .suggestion = to apply to the crate, use an inner attribute .help = to apply to the crate, use an inner attribute .note = read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information -passes_doc_test_unknown = unknown `doc(test)` attribute `{$path}` +passes_doc_test_unknown = + unknown `doc(test)` attribute `{$path}` + +passes_doc_test_takes_list = + `#[doc(test(...)]` takes a list of attributes -passes_doc_test_takes_list = `#[doc(test(...)]` takes a list of attributes +passes_doc_primitive = + `doc(primitive)` should never have been stable -passes_doc_primitive = `doc(primitive)` should never have been stable +passes_doc_cfg_hide_takes_list = + `#[doc(cfg_hide(...)]` takes a list of attributes -passes_doc_test_unknown_any = unknown `doc` attribute `{$path}` +passes_doc_test_unknown_any = + unknown `doc` attribute `{$path}` -passes_doc_test_unknown_spotlight = unknown `doc` attribute `{$path}` +passes_doc_test_unknown_spotlight = + unknown `doc` attribute `{$path}` .note = `doc(spotlight)` was renamed to `doc(notable_trait)` .suggestion = use `notable_trait` instead .no_op_note = `doc(spotlight)` is now a no-op -passes_doc_test_unknown_include = unknown `doc` attribute `{$path}` +passes_doc_test_unknown_include = + unknown `doc` attribute `{$path}` .suggestion = use `doc = include_str!` instead -passes_doc_invalid = invalid `doc` attribute +passes_doc_invalid = + invalid `doc` attribute -passes_pass_by_value = `pass_by_value` attribute should be applied to a struct, enum or type alias +passes_pass_by_value = + `pass_by_value` attribute should be applied to a struct, enum or type alias .label = is not a struct, enum or type alias passes_allow_incoherent_impl = @@ -137,42 +180,54 @@ passes_must_use_async = `must_use` attribute on `async` functions applies to the anonymous `Future` returned by the function, not the value within .label = this attribute does nothing, the `Future`s returned by async functions are already `must_use` -passes_must_use_no_effect = `#[must_use]` has no effect when applied to {$article} {$target} +passes_must_use_no_effect = + `#[must_use]` has no effect when applied to {$article} {$target} -passes_must_not_suspend = `must_not_suspend` attribute should be applied to a struct, enum, or trait +passes_must_not_suspend = + `must_not_suspend` attribute should be applied to a struct, enum, or trait .label = is not a struct, enum, or trait -passes_cold = {passes_should_be_applied_to_fn} +passes_cold = + {passes_should_be_applied_to_fn} .warn = {-passes_previously_accepted} .label = {passes_should_be_applied_to_fn.label} -passes_link = attribute should be applied to an `extern` block with non-Rust ABI +passes_link = + attribute should be applied to an `extern` block with non-Rust ABI .warn = {-passes_previously_accepted} .label = not an `extern` block -passes_link_name = attribute should be applied to a foreign function or static +passes_link_name = + attribute should be applied to a foreign function or static .warn = {-passes_previously_accepted} .label = not a foreign function or static .help = try `#[link(name = "{$value}")]` instead -passes_no_link = attribute should be applied to an `extern crate` item +passes_no_link = + attribute should be applied to an `extern crate` item .label = not an `extern crate` item -passes_export_name = attribute should be applied to a free function, impl method or static +passes_export_name = + attribute should be applied to a free function, impl method or static .label = not a free function, impl method or static -passes_rustc_layout_scalar_valid_range_not_struct = attribute should be applied to a struct +passes_rustc_layout_scalar_valid_range_not_struct = + attribute should be applied to a struct .label = not a struct -passes_rustc_layout_scalar_valid_range_arg = expected exactly one integer literal argument +passes_rustc_layout_scalar_valid_range_arg = + expected exactly one integer literal argument -passes_rustc_legacy_const_generics_only = #[rustc_legacy_const_generics] functions must only have const generics +passes_rustc_legacy_const_generics_only = + #[rustc_legacy_const_generics] functions must only have const generics .label = non-const generic parameter -passes_rustc_legacy_const_generics_index = #[rustc_legacy_const_generics] must have one index for each generic parameter +passes_rustc_legacy_const_generics_index = + #[rustc_legacy_const_generics] must have one index for each generic parameter .label = generic parameters -passes_rustc_legacy_const_generics_index_exceed = index exceeds number of arguments +passes_rustc_legacy_const_generics_index_exceed = + index exceeds number of arguments .label = there {$arg_count -> [one] is *[other] are @@ -181,90 +236,438 @@ passes_rustc_legacy_const_generics_index_exceed = index exceeds number of argume *[other] arguments } -passes_rustc_legacy_const_generics_index_negative = arguments should be non-negative integers +passes_rustc_legacy_const_generics_index_negative = + arguments should be non-negative integers -passes_rustc_dirty_clean = attribute requires -Z query-dep-graph to be enabled +passes_rustc_dirty_clean = + attribute requires -Z query-dep-graph to be enabled -passes_link_section = attribute should be applied to a function or static +passes_link_section = + attribute should be applied to a function or static .warn = {-passes_previously_accepted} .label = not a function or static -passes_no_mangle_foreign = `#[no_mangle]` has no effect on a foreign {$foreign_item_kind} +passes_no_mangle_foreign = + `#[no_mangle]` has no effect on a foreign {$foreign_item_kind} .warn = {-passes_previously_accepted} .label = foreign {$foreign_item_kind} .note = symbol names in extern blocks are not mangled .suggestion = remove this attribute -passes_no_mangle = attribute should be applied to a free function, impl method or static +passes_no_mangle = + attribute should be applied to a free function, impl method or static .warn = {-passes_previously_accepted} .label = not a free function, impl method or static -passes_repr_ident = meta item in `repr` must be an identifier +passes_repr_ident = + meta item in `repr` must be an identifier -passes_repr_conflicting = conflicting representation hints +passes_repr_conflicting = + conflicting representation hints -passes_used_static = attribute must be applied to a `static` variable +passes_used_static = + attribute must be applied to a `static` variable -passes_used_compiler_linker = `used(compiler)` and `used(linker)` can't be used together +passes_used_compiler_linker = + `used(compiler)` and `used(linker)` can't be used together -passes_allow_internal_unstable = attribute should be applied to a macro +passes_allow_internal_unstable = + attribute should be applied to a macro .label = not a macro -passes_debug_visualizer_placement = attribute should be applied to a module +passes_debug_visualizer_placement = + attribute should be applied to a module -passes_debug_visualizer_invalid = invalid argument +passes_debug_visualizer_invalid = + invalid argument .note_1 = expected: `natvis_file = "..."` .note_2 = OR .note_3 = expected: `gdb_script_file = "..."` -passes_rustc_allow_const_fn_unstable = attribute should be applied to `const fn` +passes_debug_visualizer_unreadable = + couldn't read {$file}: {$error} + +passes_rustc_allow_const_fn_unstable = + attribute should be applied to `const fn` .label = not a `const fn` -passes_rustc_std_internal_symbol = attribute should be applied to functions or statics +passes_rustc_std_internal_symbol = + attribute should be applied to functions or statics .label = not a function or static -passes_const_trait = attribute should be applied to a trait +passes_const_trait = + attribute should be applied to a trait -passes_stability_promotable = attribute cannot be applied to an expression +passes_stability_promotable = + attribute cannot be applied to an expression -passes_deprecated = attribute is ignored here +passes_deprecated = + attribute is ignored here -passes_macro_use = `#[{$name}]` only has an effect on `extern crate` and modules +passes_macro_use = + `#[{$name}]` only has an effect on `extern crate` and modules -passes_macro_export = `#[macro_export]` only has an effect on macro definitions +passes_macro_export = + `#[macro_export]` only has an effect on macro definitions -passes_plugin_registrar = `#[plugin_registrar]` only has an effect on functions +passes_plugin_registrar = + `#[plugin_registrar]` only has an effect on functions -passes_unused_empty_lints_note = attribute `{$name}` with an empty list has no effect +passes_unused_empty_lints_note = + attribute `{$name}` with an empty list has no effect -passes_unused_no_lints_note = attribute `{$name}` without any lints has no effect +passes_unused_no_lints_note = + attribute `{$name}` without any lints has no effect passes_unused_default_method_body_const_note = `default_method_body_is_const` has been replaced with `#[const_trait]` on traits -passes_unused = unused attribute +passes_unused = + unused attribute .suggestion = remove this attribute -passes_non_exported_macro_invalid_attrs = attribute should be applied to function or closure +passes_non_exported_macro_invalid_attrs = + attribute should be applied to function or closure .label = not a function or closure -passes_unused_duplicate = unused attribute +passes_unused_duplicate = + unused attribute .suggestion = remove this attribute .note = attribute also specified here .warn = {-passes_previously_accepted} -passes_unused_multiple = multiple `{$name}` attributes +passes_unused_multiple = + multiple `{$name}` attributes .suggestion = remove this attribute .note = attribute also specified here -passes_rustc_lint_opt_ty = `#[rustc_lint_opt_ty]` should be applied to a struct +passes_rustc_lint_opt_ty = + `#[rustc_lint_opt_ty]` should be applied to a struct .label = not a struct -passes_rustc_lint_opt_deny_field_access = `#[rustc_lint_opt_deny_field_access]` should be applied to a field +passes_rustc_lint_opt_deny_field_access = + `#[rustc_lint_opt_deny_field_access]` should be applied to a field .label = not a field -passes_link_ordinal = attribute should be applied to a foreign function or static +passes_link_ordinal = + attribute should be applied to a foreign function or static .label = not a foreign function or static -passes_collapse_debuginfo = `collapse_debuginfo` attribute should be applied to macro definitions +passes_collapse_debuginfo = + `collapse_debuginfo` attribute should be applied to macro definitions .label = not a macro definition + +passes_deprecated_annotation_has_no_effect = + this `#[deprecated]` annotation has no effect + .suggestion = remove the unnecessary deprecation attribute + +passes_unknown_external_lang_item = + unknown external lang item: `{$lang_item}` + +passes_missing_panic_handler = + `#[panic_handler]` function required, but not found + +passes_alloc_func_required = + `#[alloc_error_handler]` function required, but not found + +passes_missing_alloc_error_handler = + use `#![feature(default_alloc_error_handler)]` for a default error handler + +passes_missing_lang_item = + language item required, but not found: `{$name}` + .note = this can occur when a binary crate with `#![no_std]` is compiled for a target where `{$name}` is defined in the standard library + .help = you may be able to compile for a target that doesn't need `{$name}`, specify a target with `--target` or in `.cargo/config` + +passes_lang_item_on_incorrect_target = + `{$name}` language item must be applied to a {$expected_target} + .label = attribute should be applied to a {$expected_target}, not a {$actual_target} + +passes_unknown_lang_item = + definition of an unknown language item: `{$name}` + .label = definition of unknown language item `{$name}` + +passes_invalid_attr_at_crate_level = + `{$name}` attribute cannot be used at crate level + .suggestion = perhaps you meant to use an outer attribute + +passes_duplicate_diagnostic_item = + duplicate diagnostic item found: `{$name}`. + +passes_duplicate_diagnostic_item_in_crate = + duplicate diagnostic item in crate `{$crate_name}`: `{$name}`. + +passes_diagnostic_item_first_defined = + the diagnostic item is first defined here + .note = the diagnostic item is first defined in crate `{$orig_crate_name}`. + +passes_abi = + abi: {$abi} + +passes_align = + align: {$align} + +passes_size = + size: {$size} + +passes_homogeneous_aggregate = + homogeneous_aggregate: {$homogeneous_aggregate} + +passes_layout_of = + layout_of({$normalized_ty}) = {$ty_layout} + +passes_unrecognized_field = + unrecognized field name `{$name}` + +passes_layout = + layout error: {$layout_error} + +passes_feature_stable_twice = + feature `{$feature}` is declared stable since {$since}, but was previously declared stable since {$prev_since} + +passes_feature_previously_declared = + feature `{$feature}` is declared {$declared}, but was previously declared {$prev_declared} + +passes_expr_not_allowed_in_context = + {$expr} is not allowed in a `{$context}` + +passes_const_impl_const_trait = + const `impl`s must be for traits marked with `#[const_trait]` + .note = this trait must be annotated with `#[const_trait]` + +passes_break_non_loop = + `break` with value from a `{$kind}` loop + .label = can only break with a value inside `loop` or breakable block + .label2 = you can't `break` with a value in a `{$kind}` loop + .suggestion = use `break` on its own without a value inside this `{$kind}` loop + .break_expr_suggestion = alternatively, you might have meant to use the available loop label + +passes_continue_labeled_block = + `continue` pointing to a labeled block + .label = labeled blocks cannot be `continue`'d + .block_label = labeled block the `continue` points to + +passes_break_inside_closure = + `{$name}` inside of a closure + .label = cannot `{$name}` inside of a closure + .closure_label = enclosing closure + +passes_break_inside_async_block = + `{$name}` inside of an `async` block + .label = cannot `{$name}` inside of an `async` block + .async_block_label = enclosing `async` block + +passes_outside_loop = + `{$name}` outside of a loop + .label = cannot `{$name}` outside of a loop + +passes_unlabeled_in_labeled_block = + unlabeled `{$cf_type}` inside of a labeled block + .label = `{$cf_type}` statements that would diverge to or through a labeled block need to bear a label + +passes_unlabeled_cf_in_while_condition = + `break` or `continue` with no label in the condition of a `while` loop + .label = unlabeled `{$cf_type}` in the condition of a `while` loop + +passes_cannot_inline_naked_function = + naked functions cannot be inlined + +passes_undefined_naked_function_abi = + Rust ABI is unsupported in naked functions + +passes_no_patterns = + patterns not allowed in naked function parameters + +passes_params_not_allowed = + referencing function parameters is not allowed in naked functions + .help = follow the calling convention in asm block to use parameters + +passes_naked_functions_asm_block = + naked functions must contain a single asm block + .label_multiple_asm = multiple asm blocks are unsupported in naked functions + .label_non_asm = non-asm is unsupported in naked functions + +passes_naked_functions_operands = + only `const` and `sym` operands are supported in naked functions + +passes_naked_functions_asm_options = + asm options unsupported in naked functions: {$unsupported_options} + +passes_naked_functions_must_use_noreturn = + asm in naked functions must use `noreturn` option + .suggestion = consider specifying that the asm block is responsible for returning from the function + +passes_attr_only_on_main = + `{$attr}` attribute can only be used on `fn main()` + +passes_attr_only_on_root_main = + `{$attr}` attribute can only be used on root `fn main()` + +passes_attr_only_in_functions = + `{$attr}` attribute can only be used on functions + +passes_multiple_rustc_main = + multiple functions with a `#[rustc_main]` attribute + .first = first `#[rustc_main]` function + .additional = additional `#[rustc_main]` function + +passes_multiple_start_functions = + multiple `start` functions + .label = multiple `start` functions + .previous = previous `#[start]` function here + +passes_extern_main = + the `main` function cannot be declared in an `extern` block + +passes_unix_sigpipe_values = + valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` + +passes_no_main_function = + `main` function not found in crate `{$crate_name}` + .here_is_main = here is a function named `main` + .one_or_more_possible_main = you have one or more functions named `main` not defined at the crate level + .consider_moving_main = consider moving the `main` function definitions + .main_must_be_defined_at_crate = the main function must be defined at the crate level{$has_filename -> + [true] {" "}(in `{$filename}`) + *[false] {""} + } + .consider_adding_main_to_file = consider adding a `main` function to `{$filename}` + .consider_adding_main_at_crate = consider adding a `main` function at the crate level + .teach_note = If you don't know the basics of Rust, you can go look to the Rust Book to get started: https://doc.rust-lang.org/book/ + .non_function_main = non-function item at `crate::main` is found + +passes_duplicate_lang_item = + found duplicate lang item `{$lang_item_name}` + .first_defined_span = the lang item is first defined here + .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on) + .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`. + .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) + .second_definition_local = second definition in the local crate (`{$crate_name}`) + .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} + .second_definition_path = second definition in `{$crate_name}` loaded from {$path} + +passes_duplicate_lang_item_crate = + duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}`. + .first_defined_span = the lang item is first defined here + .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on) + .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`. + .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) + .second_definition_local = second definition in the local crate (`{$crate_name}`) + .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} + .second_definition_path = second definition in `{$crate_name}` loaded from {$path} + +passes_duplicate_lang_item_crate_depends = + duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}`. + .first_defined_span = the lang item is first defined here + .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on) + .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`. + .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) + .second_definition_local = second definition in the local crate (`{$crate_name}`) + .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} + .second_definition_path = second definition in `{$crate_name}` loaded from {$path} + +passes_incorrect_target = + `{$name}` language item must be applied to a {$kind} with {$at_least -> + [true] at least {$num} + *[false] {$num} + } generic {$num -> + [one] argument + *[other] arguments + } + .label = this {$kind} has {$actual_num} generic {$actual_num -> + [one] argument + *[other] arguments + } + +passes_useless_assignment = + useless assignment of {$is_field_assign -> + [true] field + *[false] variable + } of type `{$ty}` to itself + +passes_only_has_effect_on = + `#[{$attr_name}]` only has an effect on {$target_name -> + [function] functions + [module] modules + [implementation_block] implementation blocks + *[unspecified] (unspecified--this is a compiler bug) + } + +passes_object_lifetime_err = + {$repr} + +passes_unrecognized_repr_hint = + unrecognized representation hint + .help = valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` + +passes_attr_application_enum = + attribute should be applied to an enum + .label = not an enum + +passes_attr_application_struct = + attribute should be applied to a struct + .label = not a struct + +passes_attr_application_struct_union = + attribute should be applied to a struct or union + .label = not a struct or union + +passes_attr_application_struct_enum_union = + attribute should be applied to a struct, enum, or union + .label = not a struct, enum, or union + +passes_attr_application_struct_enum_function_union = + attribute should be applied to a struct, enum, function, or union + .label = not a struct, enum, function, or union + +passes_transparent_incompatible = + transparent {$target} cannot have other repr hints + +passes_deprecated_attribute = + deprecated attribute must be paired with either stable or unstable attribute + +passes_useless_stability = + this stability annotation is useless + .label = useless stability annotation + .item = the stability attribute annotates this item + +passes_invalid_stability = + invalid stability version found + .label = invalid stability version + .item = the stability attribute annotates this item + +passes_cannot_stabilize_deprecated = + an API can't be stabilized after it is deprecated + .label = invalid version + .item = the stability attribute annotates this item + +passes_invalid_deprecation_version = + invalid deprecation version found + .label = invalid deprecation version + .item = the stability attribute annotates this item + +passes_missing_stability_attr = + {$descr} has missing stability attribute + +passes_missing_const_stab_attr = + {$descr} has missing const stability attribute + +passes_trait_impl_const_stable = + trait implementations cannot be const stable yet + .note = see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + +passes_feature_only_on_nightly = + `#![feature]` may not be used on the {$release_channel} release channel + +passes_unknown_feature = + unknown feature `{$feature}` + +passes_implied_feature_not_exist = + feature `{$implied_by}` implying `{$feature}` does not exist + +passes_duplicate_feature_err = + the feature `{$feature}` has already been declared + +passes_missing_const_err = + attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` + .help = make the function or method const + .label = attribute specified here diff --git a/compiler/rustc_error_messages/locales/en-US/privacy.ftl b/compiler/rustc_error_messages/locales/en-US/privacy.ftl index da987152f..a26d1b2b3 100644 --- a/compiler/rustc_error_messages/locales/en-US/privacy.ftl +++ b/compiler/rustc_error_messages/locales/en-US/privacy.ftl @@ -11,7 +11,7 @@ privacy_in_public_interface = {$vis_descr} {$kind} `{$descr}` in public interfac .label = can't leak {$vis_descr} {$kind} .visibility_label = `{$descr}` declared as {$vis_descr} -privacy_report_access_level = {$descr} +privacy_report_effective_visibility = {$descr} privacy_from_private_dep_in_public_interface = {$kind} `{$descr}` from private dependency '{$krate}' in public interface diff --git a/compiler/rustc_error_messages/locales/en-US/query_system.ftl b/compiler/rustc_error_messages/locales/en-US/query_system.ftl index 167704e46..870e82403 100644 --- a/compiler/rustc_error_messages/locales/en-US/query_system.ftl +++ b/compiler/rustc_error_messages/locales/en-US/query_system.ftl @@ -12,6 +12,8 @@ query_system_cycle_usage = cycle used when {$usage} query_system_cycle_stack_single = ...which immediately requires {$stack_bottom} again +query_system_cycle_stack_middle = ...which requires {$desc}... + query_system_cycle_stack_multiple = ...which again requires {$stack_bottom}, completing the cycle query_system_cycle_recursive_ty_alias = type aliases cannot be recursive @@ -23,3 +25,6 @@ query_system_cycle_recursive_trait_alias = trait aliases cannot be recursive query_system_cycle_which_requires = ...which requires {$desc}... query_system_query_overflow = queries overflow the depth limit! + .help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]` attribute to your crate (`{$crate_name}`) + +query_system_layout_of_depth = query depth increased by {$depth} when {$desc} diff --git a/compiler/rustc_error_messages/locales/en-US/session.ftl b/compiler/rustc_error_messages/locales/en-US/session.ftl index 76cae3c81..e22779230 100644 --- a/compiler/rustc_error_messages/locales/en-US/session.ftl +++ b/compiler/rustc_error_messages/locales/en-US/session.ftl @@ -39,20 +39,6 @@ session_unstable_virtual_function_elimination = `-Zvirtual-function-elimination` session_unsupported_dwarf_version = requested DWARF version {$dwarf_version} is greater than 5 -session_target_invalid_address_space = invalid address space `{$addr_space}` for `{$cause}` in "data-layout": {$err} - -session_target_invalid_bits = invalid {$kind} `{$bit}` for `{$cause}` in "data-layout": {$err} - -session_target_missing_alignment = missing alignment for `{$cause}` in "data-layout" - -session_target_invalid_alignment = invalid alignment for `{$cause}` in "data-layout": {$err} - -session_target_inconsistent_architecture = inconsistent target specification: "data-layout" claims architecture is {$dl}-endian, while "target-endian" is `{$target}` - -session_target_inconsistent_pointer_width = inconsistent target specification: "data-layout" claims pointers are {$pointer_size}-bit, while "target-pointer-width" is `{$target}` - -session_target_invalid_bits_size = {$err} - session_target_stack_protector_not_supported = `-Z stack-protector={$stack_protector}` is not supported for target {$target_triple} and will be ignored session_split_debuginfo_unstable_platform = `-Csplit-debuginfo={$debuginfo}` is unstable on this platform @@ -66,3 +52,9 @@ session_crate_name_invalid = crate names cannot start with a `-`, but `{$s}` has session_crate_name_empty = crate name must not be empty session_invalid_character_in_create_name = invalid character `{$character}` in crate name: `{$crate_name}` + +session_expr_parentheses_needed = parentheses are required to parse this as an expression + +session_skipping_const_checks = skipping const checks +session_unleashed_feature_help_named = skipping check for `{$gate}` feature +session_unleashed_feature_help_unnamed = skipping check that does not even have a feature gate diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index b6e0f3faa..9465051dd 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -35,32 +35,38 @@ pub use unic_langid::{langid, LanguageIdentifier}; // Generates `DEFAULT_LOCALE_RESOURCES` static and `fluent_generated` module. fluent_messages! { + // tidy-alphabetical-start ast_lowering => "../locales/en-US/ast_lowering.ftl", ast_passes => "../locales/en-US/ast_passes.ftl", attr => "../locales/en-US/attr.ftl", borrowck => "../locales/en-US/borrowck.ftl", builtin_macros => "../locales/en-US/builtin_macros.ftl", + codegen_gcc => "../locales/en-US/codegen_gcc.ftl", + codegen_ssa => "../locales/en-US/codegen_ssa.ftl", + compiletest => "../locales/en-US/compiletest.ftl", const_eval => "../locales/en-US/const_eval.ftl", driver => "../locales/en-US/driver.ftl", + errors => "../locales/en-US/errors.ftl", expand => "../locales/en-US/expand.ftl", - session => "../locales/en-US/session.ftl", - interface => "../locales/en-US/interface.ftl", + hir_analysis => "../locales/en-US/hir_analysis.ftl", infer => "../locales/en-US/infer.ftl", + interface => "../locales/en-US/interface.ftl", lint => "../locales/en-US/lint.ftl", + metadata => "../locales/en-US/metadata.ftl", middle => "../locales/en-US/middle.ftl", + mir_dataflow => "../locales/en-US/mir_dataflow.ftl", monomorphize => "../locales/en-US/monomorphize.ftl", - metadata => "../locales/en-US/metadata.ftl", parser => "../locales/en-US/parser.ftl", passes => "../locales/en-US/passes.ftl", plugin_impl => "../locales/en-US/plugin_impl.ftl", privacy => "../locales/en-US/privacy.ftl", query_system => "../locales/en-US/query_system.ftl", - trait_selection => "../locales/en-US/trait_selection.ftl", save_analysis => "../locales/en-US/save_analysis.ftl", - ty_utils => "../locales/en-US/ty_utils.ftl", - typeck => "../locales/en-US/typeck.ftl", - mir_dataflow => "../locales/en-US/mir_dataflow.ftl", + session => "../locales/en-US/session.ftl", symbol_mangling => "../locales/en-US/symbol_mangling.ftl", + trait_selection => "../locales/en-US/trait_selection.ftl", + ty_utils => "../locales/en-US/ty_utils.ftl", + // tidy-alphabetical-end } pub use fluent_generated::{self as fluent, DEFAULT_LOCALE_RESOURCES}; @@ -268,14 +274,26 @@ type FluentId = Cow<'static, str>; /// Translatable messages for subdiagnostics are typically attributes attached to a larger Fluent /// message so messages of this type must be combined with a `DiagnosticMessage` (using /// `DiagnosticMessage::with_subdiagnostic_message`) before rendering. However, subdiagnostics from -/// the `SessionSubdiagnostic` derive refer to Fluent identifiers directly. +/// the `Subdiagnostic` derive refer to Fluent identifiers directly. #[rustc_diagnostic_item = "SubdiagnosticMessage"] pub enum SubdiagnosticMessage { /// Non-translatable diagnostic message. // FIXME(davidtwco): can a `Cow<'static, str>` be used here? Str(String), + /// Translatable message which has already been translated eagerly. + /// + /// Some diagnostics have repeated subdiagnostics where the same interpolated variables would + /// be instantiated multiple times with different values. As translation normally happens + /// immediately prior to emission, after the diagnostic and subdiagnostic derive logic has run, + /// the setting of diagnostic arguments in the derived code will overwrite previous variable + /// values and only the final value will be set when translation occurs - resulting in + /// incorrect diagnostics. Eager translation results in translation for a subdiagnostic + /// happening immediately after the subdiagnostic derive's logic has been run. This variant + /// stores messages which have been translated eagerly. + // FIXME(#100717): can a `Cow<'static, str>` be used here? + Eager(String), /// Identifier of a Fluent message. Instances of this variant are generated by the - /// `SessionSubdiagnostic` derive. + /// `Subdiagnostic` derive. FluentIdentifier(FluentId), /// Attribute of a Fluent message. Needs to be combined with a Fluent identifier to produce an /// actual translated message. Instances of this variant are generated by the `fluent_messages` @@ -301,8 +319,20 @@ impl<S: Into<String>> From<S> for SubdiagnosticMessage { #[rustc_diagnostic_item = "DiagnosticMessage"] pub enum DiagnosticMessage { /// Non-translatable diagnostic message. - // FIXME(davidtwco): can a `Cow<'static, str>` be used here? + // FIXME(#100717): can a `Cow<'static, str>` be used here? Str(String), + /// Translatable message which has already been translated eagerly. + /// + /// Some diagnostics have repeated subdiagnostics where the same interpolated variables would + /// be instantiated multiple times with different values. As translation normally happens + /// immediately prior to emission, after the diagnostic and subdiagnostic derive logic has run, + /// the setting of diagnostic arguments in the derived code will overwrite previous variable + /// values and only the final value will be set when translation occurs - resulting in + /// incorrect diagnostics. Eager translation results in translation for a subdiagnostic + /// happening immediately after the subdiagnostic derive's logic has been run. This variant + /// stores messages which have been translated eagerly. + // FIXME(#100717): can a `Cow<'static, str>` be used here? + Eager(String), /// Identifier for a Fluent message (with optional attribute) corresponding to the diagnostic /// message. /// @@ -321,6 +351,7 @@ impl DiagnosticMessage { pub fn with_subdiagnostic_message(&self, sub: SubdiagnosticMessage) -> Self { let attr = match sub { SubdiagnosticMessage::Str(s) => return DiagnosticMessage::Str(s), + SubdiagnosticMessage::Eager(s) => return DiagnosticMessage::Eager(s), SubdiagnosticMessage::FluentIdentifier(id) => { return DiagnosticMessage::FluentIdentifier(id, None); } @@ -329,24 +360,12 @@ impl DiagnosticMessage { match self { DiagnosticMessage::Str(s) => DiagnosticMessage::Str(s.clone()), + DiagnosticMessage::Eager(s) => DiagnosticMessage::Eager(s.clone()), DiagnosticMessage::FluentIdentifier(id, _) => { DiagnosticMessage::FluentIdentifier(id.clone(), Some(attr)) } } } - - /// Returns the `String` contained within the `DiagnosticMessage::Str` variant, assuming that - /// this diagnostic message is of the legacy, non-translatable variety. Panics if this - /// assumption does not hold. - /// - /// Don't use this - it exists to support some places that do comparison with diagnostic - /// strings. - pub fn expect_str(&self) -> &str { - match self { - DiagnosticMessage::Str(s) => s, - _ => panic!("expected non-translatable diagnostic message"), - } - } } /// `From` impl that enables existing diagnostic calls to functions which now take @@ -357,6 +376,17 @@ impl<S: Into<String>> From<S> for DiagnosticMessage { } } +/// A workaround for "good path" ICEs when formatting types in disables lints. +/// +/// Delays formatting until `.into(): DiagnosticMessage` is used. +pub struct DelayDm<F>(pub F); + +impl<F: FnOnce() -> String> From<DelayDm<F>> for DiagnosticMessage { + fn from(DelayDm(f): DelayDm<F>) -> Self { + DiagnosticMessage::from(f()) + } +} + /// Translating *into* a subdiagnostic message from a diagnostic message is a little strange - but /// the subdiagnostic functions (e.g. `span_label`) take a `SubdiagnosticMessage` and the /// subdiagnostic derive refers to typed identifiers that are `DiagnosticMessage`s, so need to be @@ -366,6 +396,7 @@ impl Into<SubdiagnosticMessage> for DiagnosticMessage { fn into(self) -> SubdiagnosticMessage { match self { DiagnosticMessage::Str(s) => SubdiagnosticMessage::Str(s), + DiagnosticMessage::Eager(s) => SubdiagnosticMessage::Eager(s), DiagnosticMessage::FluentIdentifier(id, None) => { SubdiagnosticMessage::FluentIdentifier(id) } |