summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_messages
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_error_messages')
-rw-r--r--compiler/rustc_error_messages/Cargo.toml8
-rw-r--r--compiler/rustc_error_messages/locales/en-US/borrowck.ftl68
-rw-r--r--compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl6
-rw-r--r--compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl49
-rw-r--r--compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl73
-rw-r--r--compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl42
-rw-r--r--compiler/rustc_error_messages/locales/en-US/hir_typeck.ftl48
-rw-r--r--compiler/rustc_error_messages/locales/en-US/infer.ftl5
-rw-r--r--compiler/rustc_error_messages/locales/en-US/lint.ftl3
-rw-r--r--compiler/rustc_error_messages/locales/en-US/metadata.ftl18
-rw-r--r--compiler/rustc_error_messages/locales/en-US/middle.ftl7
-rw-r--r--compiler/rustc_error_messages/locales/en-US/monomorphize.ftl3
-rw-r--r--compiler/rustc_error_messages/locales/en-US/parse.ftl364
-rw-r--r--compiler/rustc_error_messages/locales/en-US/parser.ftl371
-rw-r--r--compiler/rustc_error_messages/locales/en-US/passes.ftl54
-rw-r--r--compiler/rustc_error_messages/locales/en-US/resolve.ftl211
-rw-r--r--compiler/rustc_error_messages/locales/en-US/session.ftl28
-rw-r--r--compiler/rustc_error_messages/src/lib.rs97
18 files changed, 1021 insertions, 434 deletions
diff --git a/compiler/rustc_error_messages/Cargo.toml b/compiler/rustc_error_messages/Cargo.toml
index 9945f3379..0c705d2ec 100644
--- a/compiler/rustc_error_messages/Cargo.toml
+++ b/compiler/rustc_error_messages/Cargo.toml
@@ -9,9 +9,17 @@ edition = "2021"
fluent-bundle = "0.15.2"
fluent-syntax = "0.11"
intl-memoizer = "0.5.1"
+rustc_baked_icu_data = { path = "../rustc_baked_icu_data" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
rustc_macros = { path = "../rustc_macros" }
tracing = "0.1"
unic-langid = { version = "0.9.0", features = ["macros"] }
+icu_list = "1.0.0"
+writeable = "0.5.0"
+icu_locid = "1.0.0"
+icu_provider_adapters = "1.0.0"
+
+[features]
+rustc_use_parallel_compiler = ['rustc_baked_icu_data/rustc_use_parallel_compiler']
diff --git a/compiler/rustc_error_messages/locales/en-US/borrowck.ftl b/compiler/rustc_error_messages/locales/en-US/borrowck.ftl
index 67f2156f3..2cd473322 100644
--- a/compiler/rustc_error_messages/locales/en-US/borrowck.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/borrowck.ftl
@@ -24,9 +24,6 @@ borrowck_var_does_not_need_mut =
variable does not need to be mutable
.suggestion = remove this `mut`
-borrowck_const_not_used_in_type_alias =
- const parameter `{$ct}` is part of concrete type but not used in parameter list for the `impl Trait` type alias
-
borrowck_var_cannot_escape_closure =
captured variable cannot escape `FnMut` closure body
.note = `FnMut` closures only have access to their captured variables while they are executing...
@@ -58,3 +55,68 @@ borrowck_returned_lifetime_short =
borrowck_used_impl_require_static =
the used `impl` has a `'static` requirement
+
+borrowck_capture_kind_label =
+ capture is {$kind_desc} because of use here
+
+borrowck_var_borrow_by_use_place_in_generator =
+ borrow occurs due to use of {$place} in closure in generator
+
+borrowck_var_borrow_by_use_place_in_closure =
+ borrow occurs due to use of {$place} in closure
+
+borrowck_var_borrow_by_use_place =
+ borrow occurs due to use of {$place}
+
+borrowck_borrow_due_to_use_generator =
+ borrow occurs due to use in generator
+
+borrowck_use_due_to_use_generator =
+ use occurs due to use in generator
+
+borrowck_assign_due_to_use_generator =
+ assign occurs due to use in generator
+
+borrowck_assign_part_due_to_use_generator =
+ assign to part occurs due to use in generator
+
+borrowck_borrow_due_to_use_closure =
+ borrow occurs due to use in closure
+
+borrowck_use_due_to_use_closure =
+ use occurs due to use in closure
+
+borrowck_assign_due_to_use_closure =
+ assign occurs due to use in closure
+
+borrowck_assign_part_due_to_use_closure =
+ assign to part occurs due to use in closure
+
+borrowck_capture_immute =
+ capture is immutable because of use here
+
+borrowck_capture_mut =
+ capture is mutable because of use here
+
+borrowck_capture_move =
+ capture is moved because of use here
+
+borrowck_var_move_by_use_place_in_generator =
+ move occurs due to use of {$place} in generator
+
+borrowck_var_move_by_use_place_in_closure =
+ move occurs due to use of {$place} in closure
+
+borrowck_cannot_move_when_borrowed =
+ cannot move out of {$place ->
+ [value] value
+ *[other] {$place}
+ } because it is borrowed
+ .label = borrow of {$borrow_place ->
+ [value] value
+ *[other] {$borrow_place}
+ } occurs here
+ .move_label = move out of {$value_place ->
+ [value] value
+ *[other] {$value_place}
+ } occurs here
diff --git a/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl b/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl
index 178e1a67c..08ce51725 100644
--- a/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl
@@ -1,9 +1,3 @@
-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
diff --git a/compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl b/compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl
new file mode 100644
index 000000000..97198cb4b
--- /dev/null
+++ b/compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl
@@ -0,0 +1,49 @@
+codegen_llvm_unknown_ctarget_feature =
+ unknown feature specified for `-Ctarget-feature`: `{$feature}`
+ .note = it is still passed through to the codegen backend
+ .possible_feature = you might have meant: `{$rust_feature}`
+ .consider_filing_feature_request = consider filing a feature request
+
+codegen_llvm_unknown_ctarget_feature_prefix =
+ unknown feature specified for `-Ctarget-feature`: `{$feature}`
+ .note = features must begin with a `+` to enable or `-` to disable it
+
+codegen_llvm_error_creating_import_library =
+ Error creating import library for {$lib_name}: {$error}
+
+codegen_llvm_instrument_coverage_requires_llvm_12 =
+ rustc option `-C instrument-coverage` requires LLVM 12 or higher.
+
+codegen_llvm_symbol_already_defined =
+ symbol `{$symbol_name}` is already defined
+
+codegen_llvm_branch_protection_requires_aarch64 =
+ -Zbranch-protection is only supported on aarch64
+
+codegen_llvm_invalid_minimum_alignment =
+ invalid minimum global alignment: {$err}
+
+codegen_llvm_sanitizer_memtag_requires_mte =
+ `-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`
+
+codegen_llvm_error_writing_def_file =
+ Error writing .DEF file: {$error}
+
+codegen_llvm_error_calling_dlltool =
+ Error calling dlltool: {$error}
+
+codegen_llvm_dlltool_fail_import_library =
+ Dlltool could not create import library: {$stdout}\n{$stderr}
+
+codegen_llvm_target_feature_disable_or_enable =
+ the target features {$features} must all be either enabled or disabled together
+
+codegen_llvm_missing_features =
+ add the missing features in a `target_feature` attribute
+
+codegen_llvm_dynamic_linking_with_lto =
+ cannot prefer dynamic linking when performing LTO
+ .note = only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO
+
+codegen_llvm_fail_parsing_target_machine_config_to_target_machine =
+ failed to parse target machine config to target machine: {$error}
diff --git a/compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl b/compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl
index 966a421bc..4d1f9c1c9 100644
--- a/compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/codegen_ssa.ftl
@@ -119,3 +119,76 @@ codegen_ssa_thorin_object_read = {$error}
codegen_ssa_thorin_object_write = {$error}
codegen_ssa_thorin_gimli_read = {$error}
codegen_ssa_thorin_gimli_write = {$error}
+
+codegen_ssa_link_exe_unexpected_error = `link.exe` returned an unexpected error
+
+codegen_ssa_repair_vs_build_tools = the Visual Studio build tools may need to be repaired using the Visual Studio installer
+
+codegen_ssa_missing_cpp_build_tool_component = or a necessary component may be missing from the "C++ build tools" workload
+
+codegen_ssa_select_cpp_build_tool_workload = in the Visual Studio installer, ensure the "C++ build tools" workload is selected
+
+codegen_ssa_visual_studio_not_installed = you may need to install Visual Studio build tools with the "C++ build tools" workload
+
+codegen_ssa_linker_not_found = linker `{$linker_path}` not found
+ .note = {$error}
+
+codegen_ssa_unable_to_exe_linker = could not exec the linker `{$linker_path}`
+ .note = {$error}
+ .command_note = {$command_formatted}
+
+codegen_ssa_msvc_missing_linker = the msvc targets depend on the msvc linker but `link.exe` was not found
+
+codegen_ssa_check_installed_visual_studio = please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.
+
+codegen_ssa_unsufficient_vs_code_product = VS Code is a different product, and is not sufficient.
+
+codegen_ssa_processing_dymutil_failed = processing debug info with `dsymutil` failed: {$status}
+ .note = {$output}
+
+codegen_ssa_unable_to_run_dsymutil = unable to run `dsymutil`: {$error}
+
+codegen_ssa_stripping_debu_info_failed = stripping debug info with `{$util}` failed: {$status}
+ .note = {$output}
+
+codegen_ssa_unable_to_run = unable to run `{$util}`: {$error}
+
+codegen_ssa_linker_file_stem = couldn't extract file stem from specified linker
+
+codegen_ssa_static_library_native_artifacts = Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.
+
+codegen_ssa_native_static_libs = native-static-libs: {$arguments}
+
+codegen_ssa_link_script_unavailable = can only use link script when linking with GNU-like linker
+
+codegen_ssa_link_script_write_failure = failed to write link script to {$path}: {$error}
+
+codegen_ssa_failed_to_write = failed to write {$path}: {$error}
+
+codegen_ssa_unable_to_write_debugger_visualizer = Unable to write debugger visualizer file `{$path}`: {$error}
+
+codegen_ssa_rlib_archive_build_failure = failed to build archive from rlib: {$error}
+
+codegen_ssa_option_gcc_only = option `-Z gcc-ld` is used even though linker flavor is not gcc
+
+codegen_ssa_extract_bundled_libs_open_file = failed to open file '{$rlib}': {$error}
+codegen_ssa_extract_bundled_libs_mmap_file = failed to mmap file '{$rlib}': {$error}
+codegen_ssa_extract_bundled_libs_parse_archive = failed to parse archive '{$rlib}': {$error}
+codegen_ssa_extract_bundled_libs_read_entry = failed to read entry '{$rlib}': {$error}
+codegen_ssa_extract_bundled_libs_archive_member = failed to get data from archive member '{$rlib}': {$error}
+codegen_ssa_extract_bundled_libs_convert_name = failed to convert name '{$rlib}': {$error}
+codegen_ssa_extract_bundled_libs_write_file = failed to write file '{$rlib}': {$error}
+
+codegen_ssa_unsupported_arch = unsupported arch `{$arch}` for os `{$os}`
+
+codegen_ssa_apple_sdk_error_sdk_path = failed to get {$sdk_name} SDK path: {error}
+
+codegen_ssa_read_file = failed to read file: {message}
+
+codegen_ssa_unsupported_link_self_contained = option `-C link-self-contained` is not supported on this target
+
+codegen_ssa_archive_build_failure =
+ failed to build archive: {$error}
+
+codegen_ssa_unknown_archive_kind =
+ Don't know how to build archive of type: {$kind}
diff --git a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl
index 74088f4df..a9ea161b9 100644
--- a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl
@@ -1,8 +1,3 @@
-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}`
-
hir_analysis_unrecognized_atomic_operation =
unrecognized atomic operation function: `{$op}`
.label = unrecognized atomic operation
@@ -22,6 +17,8 @@ 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
+ .where_label = this `where` clause might not match the one in the trait
+ .bounds_label = this bound might be missing in the impl
hir_analysis_drop_impl_on_wrong_item =
the `Drop` trait may only be implemented for local structs, enums, and unions
@@ -54,44 +51,16 @@ hir_analysis_assoc_type_binding_not_allowed =
associated type bindings are not allowed here
.label = associated type not allowed here
-hir_analysis_functional_record_update_on_non_struct =
- functional record update syntax requires a struct
-
hir_analysis_typeof_reserved_keyword_used =
`typeof` is a reserved keyword but unimplemented
.suggestion = consider replacing `typeof(...)` with an actual type
.label = reserved keyword
-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
-
-hir_analysis_yield_expr_outside_of_generator =
- yield expression outside of generator literal
-
-hir_analysis_struct_expr_non_exhaustive =
- cannot create non-exhaustive {$what} using struct expression
-
-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
-
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
-hir_analysis_address_of_temporary_taken = cannot take address of a temporary
- .label = temporary value
-
-hir_analysis_add_return_type_add = try adding a return type
-
-hir_analysis_add_return_type_missing_here = a return type might be missing here
-
-hir_analysis_expected_default_return_type = expected `()` because of default return type
-
-hir_analysis_expected_return_type = expected `{$expected}` because of return type
-
hir_analysis_unconstrained_opaque_type = unconstrained opaque type
.note = `{$name}` must be used in combination with a concrete type within the same {$what}
@@ -134,10 +103,6 @@ hir_analysis_extern_crate_not_idiomatic =
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
@@ -150,3 +115,6 @@ hir_analysis_const_bound_for_non_const_trait =
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
+
+hir_analysis_linkage_type =
+ invalid type for variable with `#[linkage]` attribute
diff --git a/compiler/rustc_error_messages/locales/en-US/hir_typeck.ftl b/compiler/rustc_error_messages/locales/en-US/hir_typeck.ftl
new file mode 100644
index 000000000..0612dbae0
--- /dev/null
+++ b/compiler/rustc_error_messages/locales/en-US/hir_typeck.ftl
@@ -0,0 +1,48 @@
+hir_typeck_fru_note = this expression may have been misinterpreted as a `..` range expression
+hir_typeck_fru_expr = this expression does not end in a comma...
+hir_typeck_fru_expr2 = ... so this is interpreted as a `..` range expression, instead of functional record update syntax
+hir_typeck_fru_suggestion =
+ to set the remaining fields{$expr ->
+ [NONE]{""}
+ *[other] {" "}from `{$expr}`
+ }, separate the last named field with a comma
+
+hir_typeck_field_multiply_specified_in_initializer =
+ field `{$ident}` specified more than once
+ .label = used more than once
+ .previous_use_label = first use of `{$ident}`
+
+hir_typeck_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
+
+hir_typeck_yield_expr_outside_of_generator =
+ yield expression outside of generator literal
+
+hir_typeck_struct_expr_non_exhaustive =
+ cannot create non-exhaustive {$what} using struct expression
+
+hir_typeck_method_call_on_unknown_type =
+ the type of this value must be known to call a method on a raw pointer on it
+
+hir_typeck_functional_record_update_on_non_struct =
+ functional record update syntax requires a struct
+
+hir_typeck_address_of_temporary_taken = cannot take address of a temporary
+ .label = temporary value
+
+hir_typeck_add_return_type_add = try adding a return type
+
+hir_typeck_add_return_type_missing_here = a return type might be missing here
+
+hir_typeck_expected_default_return_type = expected `()` because of default return type
+
+hir_typeck_expected_return_type = expected `{$expected}` because of return type
+
+hir_typeck_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}`
+
+hir_typeck_add_missing_parentheses_in_range = you must surround the range in parentheses to call its `{$func_name}` function
+
+hir_typeck_op_trait_generic_params =
+ `{$method_name}` must not have any generic parameters
diff --git a/compiler/rustc_error_messages/locales/en-US/infer.ftl b/compiler/rustc_error_messages/locales/en-US/infer.ftl
index 18b3408b0..c9d83746d 100644
--- a/compiler/rustc_error_messages/locales/en-US/infer.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/infer.ftl
@@ -126,10 +126,10 @@ infer_data_lifetime_flow = ...but data with one lifetime flows into the other he
infer_declared_multiple = this type is declared with multiple lifetimes...
infer_types_declared_different = these two types are declared with different lifetimes...
infer_data_flows = ...but data{$label_var1_exists ->
- [true] -> {" "}from `{$label_var1}`
+ [true] {" "}from `{$label_var1}`
*[false] -> {""}
} flows{$label_var2_exists ->
- [true] -> {" "}into `{$label_var2}`
+ [true] {" "}into `{$label_var2}`
*[false] -> {""}
} here
@@ -171,3 +171,4 @@ 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
infer_msl_trait_sugg = consider relaxing the implicit `'static` requirement
+infer_suggest_add_let_for_letchains = consider adding `let`
diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl
index 7e28f22c0..2eb409a5d 100644
--- a/compiler/rustc_error_messages/locales/en-US/lint.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl
@@ -350,6 +350,9 @@ lint_builtin_mutable_transmutes =
lint_builtin_unstable_features = unstable feature
+lint_ungated_async_fn_track_caller = `#[track_caller]` on async functions is a no-op
+ .label = this function will not propagate the caller location
+
lint_builtin_unreachable_pub = unreachable `pub` {$what}
.suggestion = consider restricting its visibility
.help = or consider exporting it for use by other crates
diff --git a/compiler/rustc_error_messages/locales/en-US/metadata.ftl b/compiler/rustc_error_messages/locales/en-US/metadata.ftl
index 08e553d9f..d1e1fd54d 100644
--- a/compiler/rustc_error_messages/locales/en-US/metadata.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/metadata.ftl
@@ -150,12 +150,28 @@ metadata_no_multiple_global_alloc =
metadata_prev_global_alloc =
previous global allocator defined here
+metadata_no_multiple_alloc_error_handler =
+ cannot define multiple allocation error handlers
+ .label = cannot define a new allocation error handler
+
+metadata_prev_alloc_error_handler =
+ previous allocation error handler defined here
+
metadata_conflicting_global_alloc =
the `#[global_allocator]` in {$other_crate_name} conflicts with global allocator in: {$crate_name}
+metadata_conflicting_alloc_error_handler =
+ the `#[alloc_error_handler]` in {$other_crate_name} conflicts with allocation error handler in: {$crate_name}
+
metadata_global_alloc_required =
no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait
+metadata_alloc_func_required =
+ `#[alloc_error_handler]` function required, but not found
+
+metadata_missing_alloc_error_handler =
+ use `#![feature(default_alloc_error_handler)]` for a default error handler
+
metadata_no_transitive_needs_dep =
the crate `{$crate_name}` cannot depend on a crate that needs {$needs_crate_name}, but it depends on `{$deps_crate_name}`
@@ -259,7 +275,7 @@ metadata_crate_location_unknown_type =
extern location for {$crate_name} is of an unknown type: {$path}
metadata_lib_filename_form =
- file name should be lib*.rlib or {dll_prefix}*.{dll_suffix}
+ file name should be lib*.rlib or {$dll_prefix}*{$dll_suffix}
metadata_multiple_import_name_type =
multiple `import_name_type` arguments in a single `#[link]` attribute
diff --git a/compiler/rustc_error_messages/locales/en-US/middle.ftl b/compiler/rustc_error_messages/locales/en-US/middle.ftl
index b9e4499d4..4f4e5c6a2 100644
--- a/compiler/rustc_error_messages/locales/en-US/middle.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/middle.ftl
@@ -27,3 +27,10 @@ middle_values_too_big =
middle_cannot_be_normalized =
unable to determine layout for `{$ty}` because `{$failure_ty}` cannot be normalized
+
+middle_strict_coherence_needs_negative_coherence =
+ to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled
+ .label = due to this attribute
+
+middle_const_not_used_in_type_alias =
+ const parameter `{$ct}` is part of concrete type but not used in parameter list for the `impl Trait` type alias
diff --git a/compiler/rustc_error_messages/locales/en-US/monomorphize.ftl b/compiler/rustc_error_messages/locales/en-US/monomorphize.ftl
index 42c84fdd2..48ddb54b7 100644
--- a/compiler/rustc_error_messages/locales/en-US/monomorphize.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/monomorphize.ftl
@@ -21,6 +21,3 @@ monomorphize_large_assignments =
moving {$size} bytes
.label = value moved from here
.note = The current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-monomorphize_requires_lang_item =
- requires `{$lang_item}` lang_item
diff --git a/compiler/rustc_error_messages/locales/en-US/parse.ftl b/compiler/rustc_error_messages/locales/en-US/parse.ftl
new file mode 100644
index 000000000..114b7ec16
--- /dev/null
+++ b/compiler/rustc_error_messages/locales/en-US/parse.ftl
@@ -0,0 +1,364 @@
+parse_struct_literal_body_without_path =
+ struct literal body without path
+ .suggestion = you might have forgotten to add the struct literal inside the block
+
+parse_maybe_report_ambiguous_plus =
+ ambiguous `+` in a type
+ .suggestion = use parentheses to disambiguate
+
+parse_maybe_recover_from_bad_type_plus =
+ expected a path on the left-hand side of `+`, not `{$ty}`
+
+parse_add_paren = try adding parentheses
+
+parse_forgot_paren = perhaps you forgot parentheses?
+
+parse_expect_path = expected a path
+
+parse_maybe_recover_from_bad_qpath_stage_2 =
+ missing angle brackets in associated item path
+ .suggestion = try: `{$ty}`
+
+parse_incorrect_semicolon =
+ expected item, found `;`
+ .suggestion = remove this semicolon
+ .help = {$name} declarations are not followed by a semicolon
+
+parse_incorrect_use_of_await =
+ incorrect use of `await`
+ .parentheses_suggestion = `await` is not a method call, remove the parentheses
+ .postfix_suggestion = `await` is a postfix operation
+
+parse_in_in_typo =
+ expected iterable, found keyword `in`
+ .suggestion = remove the duplicated `in`
+
+parse_invalid_variable_declaration =
+ invalid variable declaration
+
+parse_switch_mut_let_order =
+ switch the order of `mut` and `let`
+parse_missing_let_before_mut = missing keyword
+parse_use_let_not_auto = write `let` instead of `auto` to introduce a new variable
+parse_use_let_not_var = write `let` instead of `var` to introduce a new variable
+
+parse_invalid_comparison_operator = invalid comparison operator `{$invalid}`
+ .use_instead = `{$invalid}` is not a valid comparison operator, use `{$correct}`
+ .spaceship_operator_invalid = `<=>` is not a valid comparison operator, use `std::cmp::Ordering`
+
+parse_invalid_logical_operator = `{$incorrect}` is not a logical operator
+ .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
+
+parse_tilde_is_not_unary_operator = `~` cannot be used as a unary operator
+ .suggestion = use `!` to perform bitwise not
+
+parse_unexpected_if_with_if = unexpected `if` in the condition expression
+ .suggestion = remove the `if`
+
+parse_unexpected_token_after_not = unexpected {$negated_desc} after identifier
+parse_unexpected_token_after_not_bitwise = use `!` to perform bitwise not
+parse_unexpected_token_after_not_logical = use `!` to perform logical negation
+parse_unexpected_token_after_not_default = use `!` to perform logical negation or bitwise not
+
+parse_malformed_loop_label = malformed loop label
+ .suggestion = use the correct loop label format
+
+parse_lifetime_in_borrow_expression = borrow expressions cannot be annotated with lifetimes
+ .suggestion = remove the lifetime annotation
+ .label = annotated with lifetime here
+
+parse_field_expression_with_generic = field expressions cannot have generic arguments
+
+parse_macro_invocation_with_qualified_path = macros cannot use qualified paths
+
+parse_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
+
+parse_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
+ .label = the label
+ .suggestion = add `:` after the label
+
+parse_do_catch_syntax_removed = found removed `do catch` syntax
+ .note = following RFC #2388, the new non-placeholder syntax is `try`
+ .suggestion = replace with the new syntax
+
+parse_float_literal_requires_integer_part = float literals must have an integer part
+ .suggestion = must have an integer part
+
+parse_missing_semicolon_before_array = expected `;`, found `[`
+ .suggestion = consider adding `;` here
+
+parse_invalid_block_macro_segment = cannot use a `block` macro fragment here
+ .label = the `block` fragment is within this context
+
+parse_expect_dotdot_not_dotdotdot = expected `..`, found `...`
+ .suggestion = use `..` to fill in the rest of the fields
+
+parse_if_expression_missing_then_block = this `if` expression is missing a block after the condition
+ .add_then_block = add a block here
+ .condition_possibly_unfinished = this binary operation is possibly unfinished
+
+parse_if_expression_missing_condition = missing condition for `if` expression
+ .condition_label = expected condition here
+ .block_label = if this block is the condition of the `if` expression, then it must be followed by another block
+
+parse_expected_expression_found_let = expected expression, found `let` statement
+
+parse_expect_eq_instead_of_eqeq = expected `=`, found `==`
+ .suggestion = consider using `=` here
+
+parse_expected_else_block = expected `{"{"}`, found {$first_tok}
+ .label = expected an `if` or a block after this `else`
+ .suggestion = add an `if` if this is the condition of a chained `else if` statement
+
+parse_outer_attribute_not_allowed_on_if_else = outer attributes are not allowed on `if` and `else` branches
+ .branch_label = the attributes are attached to this branch
+ .ctx_label = the branch belongs to this `{$ctx}`
+ .suggestion = remove the attributes
+
+parse_missing_in_in_for_loop = missing `in` in `for` loop
+ .use_in_not_of = try using `in` here instead
+ .add_in = try adding `in` here
+
+parse_missing_comma_after_match_arm = expected `,` following `match` arm
+ .suggestion = missing a comma here to end this `match` arm
+
+parse_catch_after_try = keyword `catch` cannot follow a `try` block
+ .help = try using `match` on the result of the `try` block instead
+
+parse_comma_after_base_struct = cannot use a comma after the base struct
+ .note = the base struct must always be the last field
+ .suggestion = remove this comma
+
+parse_eq_field_init = expected `:`, found `=`
+ .suggestion = replace equals symbol with a colon
+
+parse_dotdotdot = unexpected token: `...`
+ .suggest_exclusive_range = use `..` for an exclusive range
+ .suggest_inclusive_range = or `..=` for an inclusive range
+
+parse_left_arrow_operator = unexpected token: `<-`
+ .suggestion = if you meant to write a comparison against a negative value, add a space in between `<` and `-`
+
+parse_remove_let = expected pattern, found `let`
+ .suggestion = remove the unnecessary `let` keyword
+
+parse_use_eq_instead = unexpected `==`
+ .suggestion = try using `=` instead
+
+parse_use_empty_block_not_semi = expected { "`{}`" }, found `;`
+ .suggestion = try using { "`{}`" } instead
+
+parse_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
+
+parse_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
+
+parse_found_expr_would_be_stmt = expected expression, found `{$token}`
+ .label = expected expression
+
+parse_leading_plus_not_supported = leading `+` is not supported
+ .label = unexpected `+`
+ .suggestion_remove_plus = try removing the `+`
+
+parse_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
+
+parse_labeled_loop_in_break = parentheses are required around this expression to avoid confusion with a labeled break expression
+
+parse_sugg_wrap_expression_in_parentheses = wrap the expression in parentheses
+
+parse_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
+
+parse_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
+
+parse_struct_literal_not_allowed_here = struct literals are not allowed here
+ .suggestion = surround the struct literal with parentheses
+
+parse_invalid_interpolated_expression = invalid interpolated expression
+
+parse_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
+
+parse_non_string_abi_literal = non-string ABI literal
+ .suggestion = specify the ABI with a string literal
+
+parse_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
+
+parse_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`
+
+parse_assignment_else_not_allowed = <assignment> ... else {"{"} ... {"}"} is not allowed
+
+parse_expected_statement_after_outer_attr = expected statement after outer attribute
+
+parse_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
+
+parse_const_let_mutually_exclusive = `const` and `let` are mutually exclusive
+ .suggestion = remove `let`
+
+parse_invalid_expression_in_let_else = a `{$operator}` expression cannot be directly assigned in `let...else`
+parse_invalid_curly_in_let_else = right curly brace `{"}"}` before `else` in a `let...else` statement not allowed
+
+parse_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
+
+parse_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.)
+
+parse_invalid_meta_item = expected unsuffixed literal or identifier, found `{$token}`
+
+parse_label_inner_attr_does_not_annotate_this = the inner attribute doesn't annotate this {$item}
+parse_sugg_change_inner_attr_to_outer = to annotate the {$item}, change the attribute from inner to outer style
+
+parse_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 = {parse_label_inner_attr_does_not_annotate_this}
+ .sugg_change_inner_to_outer = {parse_sugg_change_inner_attr_to_outer}
+
+parse_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 = {parse_label_inner_attr_does_not_annotate_this}
+ .sugg_change_inner_to_outer = {parse_sugg_change_inner_attr_to_outer}
+
+parse_inner_attr_not_permitted = an inner attribute is not permitted in this context
+ .label_does_not_annotate_this = {parse_label_inner_attr_does_not_annotate_this}
+ .sugg_change_inner_to_outer = {parse_sugg_change_inner_attr_to_outer}
+
+parse_inner_attr_explanation = inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
+parse_outer_attr_explanation = outer attributes, like `#[test]`, annotate the item following them
+
+parse_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
+
+parse_expected_identifier_found_reserved_identifier_str = expected identifier, found reserved identifier `{$token}`
+parse_expected_identifier_found_keyword_str = expected identifier, found keyword `{$token}`
+parse_expected_identifier_found_reserved_keyword_str = expected identifier, found reserved keyword `{$token}`
+parse_expected_identifier_found_doc_comment_str = expected identifier, found doc comment `{$token}`
+parse_expected_identifier_found_str = expected identifier, found `{$token}`
+
+parse_expected_identifier_found_reserved_identifier = expected identifier, found reserved identifier
+parse_expected_identifier_found_keyword = expected identifier, found keyword
+parse_expected_identifier_found_reserved_keyword = expected identifier, found reserved keyword
+parse_expected_identifier_found_doc_comment = expected identifier, found doc comment
+parse_expected_identifier = expected identifier
+
+parse_sugg_escape_to_use_as_identifier = escape `{$ident_name}` to use it as an identifier
+
+parse_sugg_remove_comma = remove this comma
+
+parse_expected_semi_found_reserved_identifier_str = expected `;`, found reserved identifier `{$token}`
+parse_expected_semi_found_keyword_str = expected `;`, found keyword `{$token}`
+parse_expected_semi_found_reserved_keyword_str = expected `;`, found reserved keyword `{$token}`
+parse_expected_semi_found_doc_comment_str = expected `;`, found doc comment `{$token}`
+parse_expected_semi_found_str = expected `;`, found `{$token}`
+
+parse_sugg_change_this_to_semi = change this to `;`
+parse_sugg_add_semi = add `;` here
+parse_label_unexpected_token = unexpected token
+
+parse_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
+ }
+
+parse_generic_parameters_without_angle_brackets = generic parameters without surrounding angle brackets
+ .suggestion = surround the type parameters with angle brackets
+
+parse_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
+parse_sugg_turbofish_syntax = use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
+
+parse_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
+
+parse_unexpected_parentheses_in_for_head = unexpected parentheses surrounding `for` loop head
+ .suggestion = remove parentheses in `for` loop
+
+parse_doc_comment_on_param_type = documentation comments cannot be applied to a function parameter's type
+ .label = doc comments are not allowed here
+
+parse_attribute_on_param_type = attributes cannot be applied to a function parameter's type
+ .label = attributes are not allowed here
+
+parse_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
+
+parse_self_param_not_first = unexpected `self` parameter in function
+ .label = must be the first parameter of an associated function
+
+parse_const_generic_without_braces = expressions must be enclosed in braces to be used as const generic arguments
+ .suggestion = enclose the `const` expression in braces
+
+parse_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`
+
+parse_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
+
+parse_async_move_order_incorrect = the order of `move` and `async` is incorrect
+ .suggestion = try switching the order
+
+parse_double_colon_in_bound = expected `:` followed by trait or lifetime
+ .suggestion = use single colon
+
+parse_fn_ptr_with_generics = function pointer types may not have generic parameters
+ .suggestion = consider moving the lifetime {$arity ->
+ [one] parameter
+ *[other] parameters
+ } to {$for_param_list_exists ->
+ [true] the
+ *[false] a
+ } `for` parameter list
+
+parse_invalid_identifier_with_leading_number = expected identifier, found number literal
+ .label = identifiers cannot start with a number
diff --git a/compiler/rustc_error_messages/locales/en-US/parser.ftl b/compiler/rustc_error_messages/locales/en-US/parser.ftl
deleted file mode 100644
index 13c368d1c..000000000
--- a/compiler/rustc_error_messages/locales/en-US/parser.ftl
+++ /dev/null
@@ -1,371 +0,0 @@
-parser_struct_literal_body_without_path =
- struct literal body without path
- .suggestion = you might have forgotten to add the struct literal inside the block
-
-parser_maybe_report_ambiguous_plus =
- ambiguous `+` in a type
- .suggestion = use parentheses to disambiguate
-
-parser_maybe_recover_from_bad_type_plus =
- expected a path on the left-hand side of `+`, not `{$ty}`
-
-parser_add_paren = try adding parentheses
-
-parser_forgot_paren = perhaps you forgot parentheses?
-
-parser_expect_path = expected a path
-
-parser_maybe_recover_from_bad_qpath_stage_2 =
- missing angle brackets in associated item path
- .suggestion = try: `{$ty}`
-
-parser_incorrect_semicolon =
- expected item, found `;`
- .suggestion = remove this semicolon
- .help = {$name} declarations are not followed by a semicolon
-
-parser_incorrect_use_of_await =
- incorrect use of `await`
- .parentheses_suggestion = `await` is not a method call, remove the parentheses
- .postfix_suggestion = `await` is a postfix operation
-
-parser_in_in_typo =
- expected iterable, found keyword `in`
- .suggestion = remove the duplicated `in`
-
-parser_invalid_variable_declaration =
- invalid variable declaration
-
-parser_switch_mut_let_order =
- switch the order of `mut` and `let`
-parser_missing_let_before_mut = missing keyword
-parser_use_let_not_auto = write `let` instead of `auto` to introduce a new variable
-parser_use_let_not_var = write `let` instead of `var` to introduce a new variable
-
-parser_invalid_comparison_operator = invalid comparison operator `{$invalid}`
- .use_instead = `{$invalid}` is not a valid comparison operator, use `{$correct}`
- .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
- .use_amp_amp_for_conjunction = use `&&` to perform logical conjunction
- .use_pipe_pipe_for_disjunction = use `||` to perform logical disjunction
-
-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
-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
-
-parser_lifetime_in_borrow_expression = borrow expressions cannot be annotated with lifetimes
- .suggestion = remove the lifetime annotation
- .label = annotated with lifetime here
-
-parser_field_expression_with_generic = field expressions cannot have generic arguments
-
-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
- .label = the label
- .suggestion = add `:` after the label
-
-parser_do_catch_syntax_removed = found removed `do catch` syntax
- .note = following RFC #2388, the new non-placeholder syntax is `try`
- .suggestion = replace with the new syntax
-
-parser_float_literal_requires_integer_part = float literals must have an integer part
- .suggestion = must have an integer part
-
-parser_invalid_int_literal_width = invalid width `{$width}` for integer literal
- .help = valid widths are 8, 16, 32, 64 and 128
-
-parser_invalid_num_literal_base_prefix = invalid base prefix for number literal
- .note = base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
- .suggestion = try making the prefix lowercase
-
-parser_invalid_num_literal_suffix = invalid suffix `{$suffix}` for number literal
- .label = invalid suffix `{$suffix}`
- .help = the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
-
-parser_invalid_float_literal_width = invalid width `{$width}` for float literal
- .help = valid widths are 32 and 64
-
-parser_invalid_float_literal_suffix = invalid suffix `{$suffix}` for float literal
- .label = invalid suffix `{$suffix}`
- .help = valid suffixes are `f32` and `f64`
-
-parser_int_literal_too_large = integer literal is too large
-
-parser_missing_semicolon_before_array = expected `;`, found `[`
- .suggestion = consider adding `;` here
-
-parser_invalid_block_macro_segment = cannot use a `block` macro fragment here
- .label = the `block` fragment is within this context
-
-parser_if_expression_missing_then_block = this `if` expression is missing a block after the condition
- .add_then_block = add a block here
- .condition_possibly_unfinished = this binary operation is possibly unfinished
-
-parser_if_expression_missing_condition = missing condition for `if` expression
- .condition_label = expected condition here
- .block_label = if this block is the condition of the `if` expression, then it must be followed by another block
-
-parser_expected_expression_found_let = expected expression, found `let` statement
-
-parser_expected_else_block = expected `{"{"}`, found {$first_tok}
- .label = expected an `if` or a block after this `else`
- .suggestion = add an `if` if this is the condition of a chained `else if` statement
-
-parser_outer_attribute_not_allowed_on_if_else = outer attributes are not allowed on `if` and `else` branches
- .branch_label = the attributes are attached to this branch
- .ctx_label = the branch belongs to this `{$ctx}`
- .suggestion = remove the attributes
-
-parser_missing_in_in_for_loop = missing `in` in `for` loop
- .use_in_not_of = try using `in` here instead
- .add_in = try adding `in` here
-
-parser_missing_comma_after_match_arm = expected `,` following `match` arm
- .suggestion = missing a comma here to end this `match` arm
-
-parser_catch_after_try = keyword `catch` cannot follow a `try` block
- .help = try using `match` on the result of the `try` block instead
-
-parser_comma_after_base_struct = cannot use a comma after the base struct
- .note = the base struct must always be the last field
- .suggestion = remove this comma
-
-parser_eq_field_init = expected `:`, found `=`
- .suggestion = replace equals symbol with a colon
-
-parser_dotdotdot = unexpected token: `...`
- .suggest_exclusive_range = use `..` for an exclusive range
- .suggest_inclusive_range = or `..=` for an inclusive range
-
-parser_left_arrow_operator = unexpected token: `<-`
- .suggestion = if you meant to write a comparison against a negative value, add a space in between `<` and `-`
-
-parser_remove_let = expected pattern, found `let`
- .suggestion = remove the unnecessary `let` keyword
-
-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 4bc6bd9fb..001e53d1d 100644
--- a/compiler/rustc_error_messages/locales/en-US/passes.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/passes.ftl
@@ -47,7 +47,10 @@ passes_no_coverage_not_coverable =
passes_should_be_applied_to_fn =
attribute should be applied to a function definition
- .label = not a function definition
+ .label = {$on_crate ->
+ [true] cannot be applied to crates
+ *[false] not a function definition
+ }
passes_naked_tracked_caller =
cannot use `#[track_caller]` with `#[naked]`
@@ -367,12 +370,6 @@ passes_unknown_external_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
@@ -457,8 +454,14 @@ passes_break_inside_async_block =
.async_block_label = enclosing `async` block
passes_outside_loop =
- `{$name}` outside of a loop
- .label = cannot `{$name}` outside of a loop
+ `{$name}` outside of a loop{$is_break ->
+ [true] {" or labeled block"}
+ *[false] {""}
+ }
+ .label = cannot `{$name}` outside of a loop{$is_break ->
+ [true] {" or labeled block"}
+ *[false] {""}
+ }
passes_unlabeled_in_labeled_block =
unlabeled `{$cf_type}` inside of a labeled block
@@ -671,3 +674,36 @@ 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
+
+passes_dead_codes =
+ { $multiple ->
+ *[true] multiple {$descr}s are
+ [false] { $num ->
+ [one] {$descr} {$name_list} is
+ *[other] {$descr}s {$name_list} are
+ }
+ } never {$participle}
+
+passes_change_fields_to_be_of_unit_type =
+ consider changing the { $num ->
+ [one] field
+ *[other] fields
+ } to be of unit type to suppress this warning while preserving the field numbering, or remove the { $num ->
+ [one] field
+ *[other] fields
+ }
+
+passes_parent_info =
+ {$num ->
+ [one] {$descr}
+ *[other] {$descr}s
+ } in this {$parent_descr}
+
+passes_ignored_derived_impls =
+ `{$name}` has {$trait_list_len ->
+ [one] a derived impl
+ *[other] derived impls
+ } for the {$trait_list_len ->
+ [one] trait {$trait_list}, but this is
+ *[other] traits {$trait_list}, but these are
+ } intentionally ignored during dead code analysis
diff --git a/compiler/rustc_error_messages/locales/en-US/resolve.ftl b/compiler/rustc_error_messages/locales/en-US/resolve.ftl
new file mode 100644
index 000000000..817bb83ed
--- /dev/null
+++ b/compiler/rustc_error_messages/locales/en-US/resolve.ftl
@@ -0,0 +1,211 @@
+resolve_parent_module_reset_for_binding =
+ parent module is reset for binding
+
+resolve_ampersand_used_without_explicit_lifetime_name =
+ `&` without an explicit lifetime name cannot be used here
+ .note = explicit lifetime name needed here
+
+resolve_underscore_lifetime_name_cannot_be_used_here =
+ `'_` cannot be used here
+ .note = `'_` is a reserved lifetime name
+
+resolve_crate_may_not_be_imported =
+ `$crate` may not be imported
+
+resolve_crate_root_imports_must_be_named_explicitly =
+ crate root imports need to be explicitly named: `use crate as name;`
+
+resolve_generic_params_from_outer_function =
+ can't use generic parameters from outer function
+ .label = use of generic parameter from outer function
+ .suggestion = try using a local generic parameter instead
+
+resolve_self_type_implicitly_declared_by_impl =
+ `Self` type implicitly declared here, by this `impl`
+
+resolve_cannot_use_self_type_here =
+ can't use `Self` here
+
+resolve_use_a_type_here_instead =
+ use a type here instead
+
+resolve_type_param_from_outer_fn =
+ type parameter from outer function
+
+resolve_const_param_from_outer_fn =
+ const parameter from outer function
+
+resolve_try_using_local_generic_parameter =
+ try using a local generic parameter instead
+
+resolve_try_adding_local_generic_param_on_method =
+ try adding a local generic parameter in this method instead
+
+resolve_help_try_using_local_generic_param =
+ try using a local generic paramter instead
+
+resolve_name_is_already_used_as_generic_parameter =
+ the name `{$name}` is already used for a generic parameter in this item's generic parameters
+ .label = already used
+ .first_use_of_name = first use of `{$name}`
+
+resolve_method_not_member_of_trait =
+ method `{$method}` is not a member of trait `{$trait_}`
+ .label = not a member of trait `{$trait_}`
+
+resolve_associated_fn_with_similar_name_exists =
+ there is an associated function with a similar name
+
+resolve_type_not_member_of_trait =
+ type `{$type_}` is not a member of trait `{$trait_}`
+ .label = not a member of trait `{$trait_}`
+
+resolve_associated_type_with_similar_name_exists =
+ there is an associated type with a similar name
+
+resolve_const_not_member_of_trait =
+ const `{$const_}` is not a member of trait `{$trait_}`
+ .label = not a member of trait `{$trait_}`
+
+resolve_associated_const_with_similar_name_exists =
+ there is an associated constant with a similar name
+
+resolve_variable_bound_with_different_mode =
+ variable `{$variable_name}` is bound inconsistently across alternatives separated by `|`
+ .label = bound in different ways
+ .first_binding_span = first binding
+
+resolve_ident_bound_more_than_once_in_parameter_list =
+ identifier `{$identifier}` is bound more than once in this parameter list
+ .label = used as parameter more than once
+
+resolve_ident_bound_more_than_once_in_same_pattern =
+ identifier `{$identifier}` is bound more than once in the same pattern
+ .label = used in a pattern more than once
+
+resolve_undeclared_label =
+ use of undeclared label `{$name}`
+ .label = undeclared label `{$name}`
+
+resolve_label_with_similar_name_reachable =
+ a label with a similar name is reachable
+
+resolve_try_using_similarly_named_label =
+ try using similarly named label
+
+resolve_unreachable_label_with_similar_name_exists =
+ a label with a similar name exists but is unreachable
+
+resolve_self_import_can_only_appear_once_in_the_list =
+ `self` import can only appear once in an import list
+ .label = can only appear once in an import list
+
+resolve_self_import_only_in_import_list_with_non_empty_prefix =
+ `self` import can only appear in an import list with a non-empty prefix
+ .label = can only appear in an import list with a non-empty prefix
+
+resolve_cannot_capture_dynamic_environment_in_fn_item =
+ can't capture dynamic environment in a fn item
+ .help = use the `|| {"{"} ... {"}"}` closure form instead
+
+resolve_attempt_to_use_non_constant_value_in_constant =
+ attempt to use a non-constant value in a constant
+
+resolve_attempt_to_use_non_constant_value_in_constant_with_suggestion =
+ consider using `{$suggestion}` instead of `{$current}`
+
+resolve_attempt_to_use_non_constant_value_in_constant_label_with_suggestion =
+ non-constant value
+
+resolve_attempt_to_use_non_constant_value_in_constant_without_suggestion =
+ this would need to be a `{$suggestion}`
+
+resolve_self_imports_only_allowed_within =
+ `self` imports are only allowed within a {"{"} {"}"} list
+
+resolve_self_imports_only_allowed_within_suggestion =
+ consider importing the module directly
+
+resolve_self_imports_only_allowed_within_multipart_suggestion =
+ alternatively, use the multi-path `use` syntax to import `self`
+
+resolve_binding_shadows_something_unacceptable =
+ {$shadowing_binding}s cannot shadow {$shadowed_binding}s
+ .label = cannot be named the same as {$article} {$shadowed_binding}
+ .label_shadowed_binding = the {$shadowed_binding} `{$name}` is {$participle} here
+
+resolve_binding_shadows_something_unacceptable_suggestion =
+ try specify the pattern arguments
+
+resolve_forward_declared_generic_param =
+ generic parameters with a default cannot use forward declared identifiers
+ .label = defaulted generic parameters cannot be forward declared
+
+resolve_param_in_ty_of_const_param =
+ the type of const parameters must not depend on other generic parameters
+ .label = the type must not depend on the parameter `{$name}`
+
+resolve_self_in_generic_param_default =
+ generic parameters cannot use `Self` in their defaults
+ .label = `Self` in generic parameter default
+
+resolve_param_in_non_trivial_anon_const =
+ generic parameters may not be used in const operations
+ .label = cannot perform const operation using `{$name}`
+
+resolve_param_in_non_trivial_anon_const_help =
+ use `#![feature(generic_const_exprs)]` to allow generic const expressions
+
+resolve_param_in_non_trivial_anon_const_sub_type =
+ type parameters may not be used in const expressions
+
+resolve_param_in_non_trivial_anon_const_sub_non_type =
+ const parameters may only be used as standalone arguments, i.e. `{$name}`
+
+resolve_unreachable_label =
+ use of unreachable label `{$name}`
+ .label = unreachable label `{$name}`
+ .label_definition_span = unreachable label defined here
+ .note = labels are unreachable through functions, closures, async blocks and modules
+
+resolve_unreachable_label_suggestion_use_similarly_named =
+ try using similarly named label
+
+resolve_unreachable_label_similar_name_reachable =
+ a label with a similar name is reachable
+
+resolve_unreachable_label_similar_name_unreachable =
+ a label with a similar name exists but is also unreachable
+
+resolve_trait_impl_mismatch =
+ item `{$name}` is an associated {$kind}, which doesn't match its trait `{$trait_path}`
+ .label = does not match trait
+ .label_trait_item = item in trait
+
+resolve_invalid_asm_sym =
+ invalid `sym` operand
+ .label = is a local variable
+ .help = `sym` operands must refer to either a function or a static
+
+resolve_trait_impl_duplicate =
+ duplicate definitions with name `{$name}`:
+ .label = duplicate definition
+ .old_span_label = previous definition here
+ .trait_item_span = item in trait
+
+resolve_relative_2018 =
+ relative paths are not supported in visibilities in 2018 edition or later
+ .suggestion = try
+
+resolve_ancestor_only =
+ visibilities can only be restricted to ancestor modules
+
+resolve_expected_found =
+ expected module, found {$res} `{$path_str}`
+ .label = not a module
+
+resolve_indeterminate =
+ cannot determine resolution for the visibility
+
+resolve_module_only =
+ visibility must resolve to a module
diff --git a/compiler/rustc_error_messages/locales/en-US/session.ftl b/compiler/rustc_error_messages/locales/en-US/session.ftl
index e22779230..983eb9262 100644
--- a/compiler/rustc_error_messages/locales/en-US/session.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/session.ftl
@@ -58,3 +58,31 @@ session_expr_parentheses_needed = parentheses are required to parse this as an e
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
+
+session_hexadecimal_float_literal_not_supported = hexadecimal float literal is not supported
+session_octal_float_literal_not_supported = octal float literal is not supported
+session_binary_float_literal_not_supported = binary float literal is not supported
+session_not_supported = not supported
+
+session_invalid_literal_suffix = suffixes on {$kind} literals are invalid
+ .label = invalid suffix `{$suffix}`
+
+session_invalid_num_literal_base_prefix = invalid base prefix for number literal
+ .note = base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
+ .suggestion = try making the prefix lowercase
+
+session_invalid_num_literal_suffix = invalid suffix `{$suffix}` for number literal
+ .label = invalid suffix `{$suffix}`
+ .help = the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
+
+session_invalid_float_literal_width = invalid width `{$width}` for float literal
+ .help = valid widths are 32 and 64
+
+session_invalid_float_literal_suffix = invalid suffix `{$suffix}` for float literal
+ .label = invalid suffix `{$suffix}`
+ .help = valid suffixes are `f32` and `f64`
+
+session_int_literal_too_large = integer literal is too large
+
+session_invalid_int_literal_width = invalid width `{$width}` for integer literal
+ .help = valid widths are 8, 16, 32, 64 and 128
diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs
index 9465051dd..418ba3c74 100644
--- a/compiler/rustc_error_messages/src/lib.rs
+++ b/compiler/rustc_error_messages/src/lib.rs
@@ -10,6 +10,7 @@ extern crate tracing;
use fluent_bundle::FluentResource;
use fluent_syntax::parser::ParserError;
+use icu_provider_adapters::fallback::{LocaleFallbackProvider, LocaleFallbacker};
use rustc_data_structures::sync::Lrc;
use rustc_macros::{fluent_messages, Decodable, Encodable};
use rustc_span::Span;
@@ -30,7 +31,7 @@ use intl_memoizer::concurrent::IntlLangMemoizer;
#[cfg(not(parallel_compiler))]
use intl_memoizer::IntlLangMemoizer;
-pub use fluent_bundle::{FluentArgs, FluentError, FluentValue};
+pub use fluent_bundle::{self, types::FluentType, FluentArgs, FluentError, FluentValue};
pub use unic_langid::{langid, LanguageIdentifier};
// Generates `DEFAULT_LOCALE_RESOURCES` static and `fluent_generated` module.
@@ -42,6 +43,7 @@ fluent_messages! {
borrowck => "../locales/en-US/borrowck.ftl",
builtin_macros => "../locales/en-US/builtin_macros.ftl",
codegen_gcc => "../locales/en-US/codegen_gcc.ftl",
+ codegen_llvm => "../locales/en-US/codegen_llvm.ftl",
codegen_ssa => "../locales/en-US/codegen_ssa.ftl",
compiletest => "../locales/en-US/compiletest.ftl",
const_eval => "../locales/en-US/const_eval.ftl",
@@ -49,6 +51,7 @@ fluent_messages! {
errors => "../locales/en-US/errors.ftl",
expand => "../locales/en-US/expand.ftl",
hir_analysis => "../locales/en-US/hir_analysis.ftl",
+ hir_typeck => "../locales/en-US/hir_typeck.ftl",
infer => "../locales/en-US/infer.ftl",
interface => "../locales/en-US/interface.ftl",
lint => "../locales/en-US/lint.ftl",
@@ -56,11 +59,12 @@ fluent_messages! {
middle => "../locales/en-US/middle.ftl",
mir_dataflow => "../locales/en-US/mir_dataflow.ftl",
monomorphize => "../locales/en-US/monomorphize.ftl",
- parser => "../locales/en-US/parser.ftl",
+ parse => "../locales/en-US/parse.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",
+ resolve => "../locales/en-US/resolve.ftl",
save_analysis => "../locales/en-US/save_analysis.ftl",
session => "../locales/en-US/session.ftl",
symbol_mangling => "../locales/en-US/symbol_mangling.ftl",
@@ -539,3 +543,92 @@ impl From<Vec<Span>> for MultiSpan {
MultiSpan::from_spans(spans)
}
}
+
+fn icu_locale_from_unic_langid(lang: LanguageIdentifier) -> Option<icu_locid::Locale> {
+ icu_locid::Locale::try_from_bytes(lang.to_string().as_bytes()).ok()
+}
+
+pub fn fluent_value_from_str_list_sep_by_and<'source>(
+ l: Vec<Cow<'source, str>>,
+) -> FluentValue<'source> {
+ // Fluent requires 'static value here for its AnyEq usages.
+ #[derive(Clone, PartialEq, Debug)]
+ struct FluentStrListSepByAnd(Vec<String>);
+
+ impl FluentType for FluentStrListSepByAnd {
+ fn duplicate(&self) -> Box<dyn FluentType + Send> {
+ Box::new(self.clone())
+ }
+
+ fn as_string(&self, intls: &intl_memoizer::IntlLangMemoizer) -> Cow<'static, str> {
+ let result = intls
+ .with_try_get::<MemoizableListFormatter, _, _>((), |list_formatter| {
+ list_formatter.format_to_string(self.0.iter())
+ })
+ .unwrap();
+ Cow::Owned(result)
+ }
+
+ #[cfg(not(parallel_compiler))]
+ fn as_string_threadsafe(
+ &self,
+ _intls: &intl_memoizer::concurrent::IntlLangMemoizer,
+ ) -> Cow<'static, str> {
+ unreachable!("`as_string_threadsafe` is not used in non-parallel rustc")
+ }
+
+ #[cfg(parallel_compiler)]
+ fn as_string_threadsafe(
+ &self,
+ intls: &intl_memoizer::concurrent::IntlLangMemoizer,
+ ) -> Cow<'static, str> {
+ let result = intls
+ .with_try_get::<MemoizableListFormatter, _, _>((), |list_formatter| {
+ list_formatter.format_to_string(self.0.iter())
+ })
+ .unwrap();
+ Cow::Owned(result)
+ }
+ }
+
+ struct MemoizableListFormatter(icu_list::ListFormatter);
+
+ impl std::ops::Deref for MemoizableListFormatter {
+ type Target = icu_list::ListFormatter;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+ }
+
+ impl intl_memoizer::Memoizable for MemoizableListFormatter {
+ type Args = ();
+ type Error = ();
+
+ fn construct(lang: LanguageIdentifier, _args: Self::Args) -> Result<Self, Self::Error>
+ where
+ Self: Sized,
+ {
+ let baked_data_provider = rustc_baked_icu_data::baked_data_provider();
+ let locale_fallbacker =
+ LocaleFallbacker::try_new_with_any_provider(&baked_data_provider)
+ .expect("Failed to create fallback provider");
+ let data_provider =
+ LocaleFallbackProvider::new_with_fallbacker(baked_data_provider, locale_fallbacker);
+ let locale = icu_locale_from_unic_langid(lang)
+ .unwrap_or_else(|| rustc_baked_icu_data::supported_locales::EN);
+ let list_formatter =
+ icu_list::ListFormatter::try_new_and_with_length_with_any_provider(
+ &data_provider,
+ &locale.into(),
+ icu_list::ListLength::Wide,
+ )
+ .expect("Failed to create list formatter");
+
+ Ok(MemoizableListFormatter(list_formatter))
+ }
+ }
+
+ let l = l.into_iter().map(|x| x.into_owned()).collect();
+
+ FluentValue::Custom(Box::new(FluentStrListSepByAnd(l)))
+}