From 631cd5845e8de329d0e227aaa707d7ea228b8f8f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:29 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc/src/main.rs | 9 + compiler/rustc_abi/src/layout.rs | 93 +- compiler/rustc_abi/src/lib.rs | 80 +- compiler/rustc_arena/src/lib.rs | 9 + compiler/rustc_ast/src/ast.rs | 77 +- compiler/rustc_ast/src/attr/mod.rs | 22 + compiler/rustc_ast/src/format.rs | 6 +- compiler/rustc_ast/src/mut_visit.rs | 31 +- compiler/rustc_ast/src/util/classify.rs | 1 - compiler/rustc_ast/src/util/parser.rs | 4 +- compiler/rustc_ast/src/visit.rs | 12 +- compiler/rustc_ast_lowering/locales/en-US.ftl | 141 -- compiler/rustc_ast_lowering/messages.ftl | 153 ++ compiler/rustc_ast_lowering/src/errors.rs | 18 +- compiler/rustc_ast_lowering/src/expr.rs | 92 +- compiler/rustc_ast_lowering/src/format.rs | 274 ++- compiler/rustc_ast_lowering/src/item.rs | 25 +- compiler/rustc_ast_lowering/src/lib.rs | 140 +- compiler/rustc_ast_lowering/src/path.rs | 25 +- compiler/rustc_ast_passes/locales/en-US.ftl | 236 -- compiler/rustc_ast_passes/messages.ftl | 237 ++ compiler/rustc_ast_passes/src/ast_validation.rs | 79 +- compiler/rustc_ast_passes/src/errors.rs | 14 +- compiler/rustc_ast_passes/src/feature_gate.rs | 92 +- compiler/rustc_ast_passes/src/lib.rs | 3 +- compiler/rustc_ast_pretty/src/pprust/state.rs | 6 +- compiler/rustc_ast_pretty/src/pprust/state/expr.rs | 10 +- compiler/rustc_ast_pretty/src/pprust/state/item.rs | 18 +- compiler/rustc_attr/locales/en-US.ftl | 107 - compiler/rustc_attr/messages.ftl | 107 + compiler/rustc_attr/src/builtin.rs | 599 ++--- compiler/rustc_attr/src/lib.rs | 2 +- compiler/rustc_borrowck/locales/en-US.ftl | 129 -- compiler/rustc_borrowck/messages.ftl | 129 ++ compiler/rustc_borrowck/src/borrow_set.rs | 17 +- .../rustc_borrowck/src/constraint_generation.rs | 6 +- compiler/rustc_borrowck/src/constraints/graph.rs | 32 +- compiler/rustc_borrowck/src/constraints/mod.rs | 6 +- compiler/rustc_borrowck/src/consumers.rs | 4 +- compiler/rustc_borrowck/src/dataflow.rs | 17 +- compiler/rustc_borrowck/src/def_use.rs | 3 +- .../src/diagnostics/bound_region_errors.rs | 4 +- .../src/diagnostics/conflict_errors.rs | 86 +- .../src/diagnostics/explain_borrow.rs | 10 +- .../rustc_borrowck/src/diagnostics/find_use.rs | 14 +- compiler/rustc_borrowck/src/diagnostics/mod.rs | 55 +- .../rustc_borrowck/src/diagnostics/move_errors.rs | 19 +- .../src/diagnostics/mutability_errors.rs | 116 +- .../src/diagnostics/outlives_suggestion.rs | 4 +- .../src/diagnostics/region_errors.rs | 2 +- .../rustc_borrowck/src/diagnostics/region_name.rs | 12 +- .../rustc_borrowck/src/diagnostics/var_name.rs | 12 +- compiler/rustc_borrowck/src/invalidation.rs | 19 +- compiler/rustc_borrowck/src/lib.rs | 102 +- compiler/rustc_borrowck/src/member_constraints.rs | 10 +- compiler/rustc_borrowck/src/nll.rs | 35 +- compiler/rustc_borrowck/src/path_utils.rs | 5 +- compiler/rustc_borrowck/src/region_infer/mod.rs | 61 +- .../src/region_infer/opaque_types.rs | 17 +- .../src/region_infer/reverse_sccs.rs | 8 +- compiler/rustc_borrowck/src/renumber.rs | 49 +- .../src/type_check/constraint_conversion.rs | 3 +- .../rustc_borrowck/src/type_check/input_output.rs | 2 +- .../src/type_check/liveness/local_use_map.rs | 4 +- .../rustc_borrowck/src/type_check/liveness/mod.rs | 5 +- .../src/type_check/liveness/trace.rs | 11 +- compiler/rustc_borrowck/src/type_check/mod.rs | 170 +- .../rustc_borrowck/src/type_check/relate_tys.rs | 30 +- compiler/rustc_borrowck/src/universal_regions.rs | 70 +- compiler/rustc_borrowck/src/used_muts.rs | 13 +- compiler/rustc_builtin_macros/locales/en-US.ftl | 5 - compiler/rustc_builtin_macros/messages.ftl | 151 ++ .../src/alloc_error_handler.rs | 3 +- compiler/rustc_builtin_macros/src/asm.rs | 35 +- compiler/rustc_builtin_macros/src/assert.rs | 28 +- .../rustc_builtin_macros/src/assert/context.rs | 3 +- compiler/rustc_builtin_macros/src/cfg.rs | 21 +- .../rustc_builtin_macros/src/cfg_accessible.rs | 18 +- compiler/rustc_builtin_macros/src/cmdline_attrs.rs | 4 +- compiler/rustc_builtin_macros/src/compile_error.rs | 5 + compiler/rustc_builtin_macros/src/concat.rs | 23 +- compiler/rustc_builtin_macros/src/concat_bytes.rs | 77 +- compiler/rustc_builtin_macros/src/concat_idents.rs | 8 +- compiler/rustc_builtin_macros/src/derive.rs | 40 +- .../rustc_builtin_macros/src/deriving/default.rs | 134 +- .../src/deriving/generic/mod.rs | 7 +- compiler/rustc_builtin_macros/src/env.rs | 30 +- compiler/rustc_builtin_macros/src/errors.rs | 553 +++++ compiler/rustc_builtin_macros/src/format.rs | 254 +- .../rustc_builtin_macros/src/global_allocator.rs | 4 +- compiler/rustc_builtin_macros/src/lib.rs | 5 +- .../rustc_builtin_macros/src/proc_macro_harness.rs | 20 +- .../src/standard_library_imports.rs | 19 +- compiler/rustc_builtin_macros/src/test.rs | 185 +- compiler/rustc_builtin_macros/src/test_harness.rs | 30 +- compiler/rustc_builtin_macros/src/util.rs | 4 +- .../.github/workflows/abi-cafe.yml | 64 + .../.github/workflows/main.yml | 59 +- compiler/rustc_codegen_cranelift/Cargo.lock | 53 +- compiler/rustc_codegen_cranelift/Cargo.toml | 16 +- .../build_sysroot/Cargo.lock | 15 +- .../build_sysroot/Cargo.toml | 2 +- .../build_system/build_sysroot.rs | 5 +- .../build_system/prepare.rs | 29 +- .../rustc_codegen_cranelift/build_system/tests.rs | 51 +- .../example/alloc_example.rs | 4 +- .../example/alloc_system.rs | 12 +- .../rustc_codegen_cranelift/example/mini_core.rs | 11 + .../example/mini_core_hello_world.rs | 383 ++- .../rustc_codegen_cranelift/example/std_example.rs | 5 +- .../0003-rand-Disable-rand-tests-on-mingw.patch | 4 +- ...022-coretests-Disable-not-compiling-tests.patch | 44 + .../0022-sysroot-Disable-not-compiling-tests.patch | 35 - .../0023-coretests-Ignore-failing-tests.patch | 62 + .../0023-sysroot-Ignore-failing-tests.patch | 62 - .../0027-coretests-128bit-atomic-operations.patch | 30 + .../0027-stdlib-128bit-atomic-operations.patch | 90 + .../0027-sysroot-128bit-atomic-operations.patch | 105 - ...0028-coretests-Disable-long-running-tests.patch | 48 + .../0028-sysroot-Disable-long-running-tests.patch | 48 - compiler/rustc_codegen_cranelift/rust-toolchain | 2 +- .../rustc_codegen_cranelift/scripts/cargo-clif.rs | 7 +- .../rustc_codegen_cranelift/scripts/rustc-clif.rs | 7 +- .../scripts/rustdoc-clif.rs | 7 +- compiler/rustc_codegen_cranelift/scripts/rustup.sh | 37 +- .../scripts/setup_rust_fork.sh | 4 +- .../scripts/test_rustc_tests.sh | 7 +- compiler/rustc_codegen_cranelift/src/abi/mod.rs | 102 +- .../rustc_codegen_cranelift/src/abi/returning.rs | 3 +- compiler/rustc_codegen_cranelift/src/allocator.rs | 28 +- compiler/rustc_codegen_cranelift/src/analyze.rs | 30 +- compiler/rustc_codegen_cranelift/src/base.rs | 68 +- compiler/rustc_codegen_cranelift/src/cast.rs | 50 +- .../rustc_codegen_cranelift/src/codegen_i128.rs | 85 +- compiler/rustc_codegen_cranelift/src/common.rs | 2 +- .../src/compiler_builtins.rs | 1 + .../src/concurrency_limiter.rs | 2 +- compiler/rustc_codegen_cranelift/src/constant.rs | 32 +- .../src/cranelift_native.rs | 248 -- .../rustc_codegen_cranelift/src/debuginfo/emit.rs | 2 +- .../rustc_codegen_cranelift/src/discriminant.rs | 95 +- compiler/rustc_codegen_cranelift/src/driver/aot.rs | 4 +- compiler/rustc_codegen_cranelift/src/driver/jit.rs | 6 +- compiler/rustc_codegen_cranelift/src/global_asm.rs | 2 +- compiler/rustc_codegen_cranelift/src/inline_asm.rs | 6 +- .../src/intrinsics/llvm_x86.rs | 4 +- .../rustc_codegen_cranelift/src/intrinsics/mod.rs | 161 +- .../rustc_codegen_cranelift/src/intrinsics/simd.rs | 11 +- compiler/rustc_codegen_cranelift/src/lib.rs | 17 +- compiler/rustc_codegen_cranelift/src/main_shim.rs | 2 +- compiler/rustc_codegen_cranelift/src/num.rs | 39 +- compiler/rustc_codegen_cranelift/src/pointer.rs | 5 - .../rustc_codegen_cranelift/src/pretty_clif.rs | 2 +- compiler/rustc_codegen_cranelift/src/unsize.rs | 12 +- .../rustc_codegen_cranelift/src/value_and_place.rs | 43 +- compiler/rustc_codegen_cranelift/src/vtable.rs | 23 +- .../rustc_codegen_gcc/.github/workflows/ci.yml | 111 +- .../.github/workflows/release.yml | 111 + .../.github/workflows/stdarch.yml | 116 + compiler/rustc_codegen_gcc/Cargo.lock | 33 +- compiler/rustc_codegen_gcc/Cargo.toml | 2 + compiler/rustc_codegen_gcc/Readme.md | 92 +- .../build_sysroot/build_sysroot.sh | 2 +- compiler/rustc_codegen_gcc/config.sh | 2 +- .../rustc_codegen_gcc/example/alloc_example.rs | 22 +- compiler/rustc_codegen_gcc/example/alloc_system.rs | 13 +- compiler/rustc_codegen_gcc/example/mini_core.rs | 68 +- .../example/mini_core_hello_world.rs | 10 +- compiler/rustc_codegen_gcc/example/mod_bench.rs | 8 +- compiler/rustc_codegen_gcc/example/std_example.rs | 1 + compiler/rustc_codegen_gcc/failing-ui-tests.txt | 68 + compiler/rustc_codegen_gcc/failing-ui-tests12.txt | 39 + compiler/rustc_codegen_gcc/locales/en-US.ftl | 62 - compiler/rustc_codegen_gcc/messages.ftl | 68 + .../0001-Add-stdarch-Cargo.toml-for-testing.patch | 39 + .../patches/0001-Disable-examples.patch | 25 + .../0022-core-Disable-not-compiling-tests.patch | 47 +- .../0024-core-Disable-portable-simd-test.patch | 28 - compiler/rustc_codegen_gcc/rust-toolchain | 2 +- .../rustc_patches/compile_test.patch | 14 - compiler/rustc_codegen_gcc/src/allocator.rs | 16 +- compiler/rustc_codegen_gcc/src/asm.rs | 218 +- compiler/rustc_codegen_gcc/src/attributes.rs | 113 + compiler/rustc_codegen_gcc/src/back/write.rs | 1 + compiler/rustc_codegen_gcc/src/base.rs | 45 +- compiler/rustc_codegen_gcc/src/builder.rs | 413 +++- compiler/rustc_codegen_gcc/src/callee.rs | 113 +- compiler/rustc_codegen_gcc/src/common.rs | 31 +- compiler/rustc_codegen_gcc/src/consts.rs | 171 +- compiler/rustc_codegen_gcc/src/context.rs | 83 +- compiler/rustc_codegen_gcc/src/declare.rs | 15 +- compiler/rustc_codegen_gcc/src/errors.rs | 15 + compiler/rustc_codegen_gcc/src/int.rs | 16 +- compiler/rustc_codegen_gcc/src/intrinsic/archs.rs | 2443 +++++++++++++++++++- compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs | 797 +++++-- compiler/rustc_codegen_gcc/src/intrinsic/mod.rs | 158 +- compiler/rustc_codegen_gcc/src/intrinsic/simd.rs | 839 +++++-- compiler/rustc_codegen_gcc/src/lib.rs | 11 +- compiler/rustc_codegen_gcc/src/mono_item.rs | 40 +- compiler/rustc_codegen_gcc/src/type_.rs | 22 +- compiler/rustc_codegen_gcc/src/type_of.rs | 48 +- compiler/rustc_codegen_gcc/test.sh | 240 +- .../rustc_codegen_gcc/tests/lang_tests_common.rs | 6 +- compiler/rustc_codegen_gcc/tests/run/abort1.rs | 1 + compiler/rustc_codegen_gcc/tests/run/abort2.rs | 1 + compiler/rustc_codegen_gcc/tests/run/array.rs | 3 +- compiler/rustc_codegen_gcc/tests/run/assign.rs | 3 +- compiler/rustc_codegen_gcc/tests/run/closure.rs | 10 +- compiler/rustc_codegen_gcc/tests/run/condition.rs | 3 +- compiler/rustc_codegen_gcc/tests/run/fun_ptr.rs | 3 +- compiler/rustc_codegen_gcc/tests/run/int.rs | 16 +- .../rustc_codegen_gcc/tests/run/int_overflow.rs | 3 +- compiler/rustc_codegen_gcc/tests/run/mut_ref.rs | 3 +- compiler/rustc_codegen_gcc/tests/run/operations.rs | 3 +- compiler/rustc_codegen_gcc/tests/run/ptr_cast.rs | 3 +- compiler/rustc_codegen_gcc/tests/run/slice.rs | 1 + compiler/rustc_codegen_gcc/tests/run/static.rs | 1 + .../tools/check_intrinsics_duplicates.py | 67 + .../rustc_codegen_gcc/tools/generate_intrinsics.py | 91 +- compiler/rustc_codegen_llvm/locales/en-US.ftl | 89 - compiler/rustc_codegen_llvm/messages.ftl | 90 + compiler/rustc_codegen_llvm/src/asm.rs | 12 +- compiler/rustc_codegen_llvm/src/back/archive.rs | 41 +- compiler/rustc_codegen_llvm/src/back/write.rs | 7 +- compiler/rustc_codegen_llvm/src/builder.rs | 35 +- compiler/rustc_codegen_llvm/src/common.rs | 7 +- compiler/rustc_codegen_llvm/src/consts.rs | 17 +- compiler/rustc_codegen_llvm/src/context.rs | 4 + compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs | 4 +- .../rustc_codegen_llvm/src/debuginfo/metadata.rs | 53 +- .../src/debuginfo/metadata/enums/mod.rs | 15 +- .../src/debuginfo/metadata/enums/native.rs | 1 + compiler/rustc_codegen_llvm/src/debuginfo/mod.rs | 91 +- compiler/rustc_codegen_llvm/src/debuginfo/utils.rs | 2 +- compiler/rustc_codegen_llvm/src/intrinsic.rs | 4 +- compiler/rustc_codegen_llvm/src/lib.rs | 11 +- compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 78 +- compiler/rustc_codegen_llvm/src/llvm_util.rs | 2 +- compiler/rustc_codegen_llvm/src/type_.rs | 2 +- compiler/rustc_codegen_ssa/locales/en-US.ftl | 293 --- compiler/rustc_codegen_ssa/messages.ftl | 293 +++ compiler/rustc_codegen_ssa/src/back/link.rs | 28 +- compiler/rustc_codegen_ssa/src/back/linker.rs | 180 +- compiler/rustc_codegen_ssa/src/back/metadata.rs | 22 +- .../rustc_codegen_ssa/src/back/symbol_export.rs | 69 +- compiler/rustc_codegen_ssa/src/back/write.rs | 9 +- compiler/rustc_codegen_ssa/src/base.rs | 56 +- compiler/rustc_codegen_ssa/src/codegen_attrs.rs | 625 ++--- compiler/rustc_codegen_ssa/src/coverageinfo/map.rs | 4 +- compiler/rustc_codegen_ssa/src/errors.rs | 4 +- compiler/rustc_codegen_ssa/src/glue.rs | 2 +- compiler/rustc_codegen_ssa/src/lib.rs | 5 +- compiler/rustc_codegen_ssa/src/mir/analyze.rs | 21 +- compiler/rustc_codegen_ssa/src/mir/block.rs | 356 ++- compiler/rustc_codegen_ssa/src/mir/debuginfo.rs | 49 +- compiler/rustc_codegen_ssa/src/mir/mod.rs | 25 +- compiler/rustc_codegen_ssa/src/mir/operand.rs | 51 +- compiler/rustc_codegen_ssa/src/mir/place.rs | 97 +- compiler/rustc_codegen_ssa/src/mir/rvalue.rs | 274 ++- compiler/rustc_codegen_ssa/src/mir/statement.rs | 7 +- compiler/rustc_codegen_ssa/src/target_features.rs | 12 +- compiler/rustc_codegen_ssa/src/traits/consts.rs | 1 + compiler/rustc_codegen_ssa/src/traits/type_.rs | 11 + compiler/rustc_const_eval/locales/en-US.ftl | 83 - compiler/rustc_const_eval/messages.ftl | 91 + .../src/const_eval/eval_queries.rs | 2 +- .../rustc_const_eval/src/const_eval/fn_queries.rs | 18 +- .../rustc_const_eval/src/const_eval/machine.rs | 22 +- .../rustc_const_eval/src/const_eval/valtrees.rs | 5 +- compiler/rustc_const_eval/src/interpret/cast.rs | 51 +- .../rustc_const_eval/src/interpret/eval_context.rs | 70 +- .../rustc_const_eval/src/interpret/intrinsics.rs | 4 - .../src/interpret/intrinsics/caller_location.rs | 8 +- compiler/rustc_const_eval/src/interpret/machine.rs | 23 +- compiler/rustc_const_eval/src/interpret/mod.rs | 4 +- compiler/rustc_const_eval/src/interpret/place.rs | 15 +- compiler/rustc_const_eval/src/interpret/step.rs | 2 +- .../rustc_const_eval/src/interpret/terminator.rs | 60 +- .../rustc_const_eval/src/interpret/validity.rs | 10 +- compiler/rustc_const_eval/src/lib.rs | 3 +- .../src/transform/check_consts/check.rs | 85 +- .../src/transform/check_consts/ops.rs | 6 +- .../check_consts/post_drop_elaboration.rs | 7 +- .../src/transform/check_consts/qualifs.rs | 7 +- .../src/transform/check_consts/resolver.rs | 15 - .../src/transform/promote_consts.rs | 17 +- .../rustc_const_eval/src/transform/validate.rs | 178 +- compiler/rustc_data_structures/Cargo.toml | 25 +- .../rustc_data_structures/src/flat_map_in_place.rs | 72 + compiler/rustc_data_structures/src/flock.rs | 5 +- .../rustc_data_structures/src/flock/windows.rs | 64 +- .../src/graph/dominators/mod.rs | 14 +- .../src/graph/implementation/mod.rs | 10 +- .../rustc_data_structures/src/graph/iterate/mod.rs | 4 +- .../rustc_data_structures/src/graph/scc/mod.rs | 6 +- .../rustc_data_structures/src/graph/scc/tests.rs | 6 +- .../src/graph/vec_graph/tests.rs | 6 +- compiler/rustc_data_structures/src/lib.rs | 11 +- compiler/rustc_data_structures/src/map_in_place.rs | 79 - compiler/rustc_data_structures/src/memmap.rs | 12 +- .../src/obligation_forest/mod.rs | 19 +- compiler/rustc_data_structures/src/owned_slice.rs | 118 + .../rustc_data_structures/src/owned_slice/tests.rs | 74 + .../rustc_data_structures/src/owning_ref/LICENSE | 21 - .../rustc_data_structures/src/owning_ref/mod.rs | 1211 ---------- .../rustc_data_structures/src/owning_ref/tests.rs | 711 ------ compiler/rustc_data_structures/src/profiling.rs | 105 +- compiler/rustc_data_structures/src/sharded.rs | 4 +- compiler/rustc_data_structures/src/sip128.rs | 20 +- compiler/rustc_data_structures/src/sip128/tests.rs | 325 +-- .../rustc_data_structures/src/sso/either_iter.rs | 73 - compiler/rustc_data_structures/src/sso/map.rs | 70 +- compiler/rustc_data_structures/src/sso/mod.rs | 1 - .../rustc_data_structures/src/stable_hasher.rs | 20 +- .../src/stable_hasher/tests.rs | 6 +- compiler/rustc_data_structures/src/stack.rs | 2 +- compiler/rustc_data_structures/src/sync.rs | 110 +- compiler/rustc_data_structures/src/sync/vec.rs | 68 +- compiler/rustc_data_structures/src/unord.rs | 37 +- compiler/rustc_data_structures/src/vec_map.rs | 192 -- .../rustc_data_structures/src/vec_map/tests.rs | 48 - compiler/rustc_driver_impl/Cargo.toml | 7 +- compiler/rustc_driver_impl/locales/en-US.ftl | 19 - compiler/rustc_driver_impl/messages.ftl | 19 + compiler/rustc_driver_impl/src/lib.rs | 116 +- compiler/rustc_error_codes/src/error_codes.rs | 1 + .../rustc_error_codes/src/error_codes/E0010.md | 4 +- .../rustc_error_codes/src/error_codes/E0080.md | 10 +- .../rustc_error_codes/src/error_codes/E0206.md | 8 +- .../rustc_error_codes/src/error_codes/E0223.md | 28 +- .../rustc_error_codes/src/error_codes/E0368.md | 2 +- .../rustc_error_codes/src/error_codes/E0416.md | 2 +- .../rustc_error_codes/src/error_codes/E0449.md | 29 +- .../rustc_error_codes/src/error_codes/E0710.md | 4 +- .../rustc_error_codes/src/error_codes/E0794.md | 64 + compiler/rustc_error_messages/locales/en-US.ftl | 1 - compiler/rustc_error_messages/messages.ftl | 1 + compiler/rustc_error_messages/src/lib.rs | 4 +- compiler/rustc_errors/Cargo.toml | 10 +- compiler/rustc_errors/locales/en-US.ftl | 19 - compiler/rustc_errors/messages.ftl | 19 + .../src/annotate_snippet_emitter_writer.rs | 5 +- compiler/rustc_errors/src/diagnostic.rs | 3 +- compiler/rustc_errors/src/diagnostic_impls.rs | 26 +- compiler/rustc_errors/src/emitter.rs | 123 +- compiler/rustc_errors/src/lib.rs | 9 +- compiler/rustc_errors/src/lock.rs | 81 +- compiler/rustc_errors/src/snippet.rs | 65 +- compiler/rustc_expand/locales/en-US.ftl | 138 -- compiler/rustc_expand/messages.ftl | 138 ++ compiler/rustc_expand/src/base.rs | 24 +- compiler/rustc_expand/src/build.rs | 20 +- compiler/rustc_expand/src/config.rs | 73 +- compiler/rustc_expand/src/expand.rs | 18 +- compiler/rustc_expand/src/lib.rs | 2 +- compiler/rustc_expand/src/mbe/diagnostics.rs | 41 +- compiler/rustc_expand/src/mbe/metavar_expr.rs | 2 +- compiler/rustc_expand/src/mbe/transcribe.rs | 2 +- compiler/rustc_expand/src/proc_macro.rs | 10 +- compiler/rustc_feature/src/accepted.rs | 4 +- compiler/rustc_feature/src/active.rs | 17 +- compiler/rustc_feature/src/builtin_attrs.rs | 4 + compiler/rustc_feature/src/lib.rs | 2 +- compiler/rustc_feature/src/removed.rs | 2 + compiler/rustc_fs_util/src/lib.rs | 8 +- compiler/rustc_hir/src/hir.rs | 48 +- compiler/rustc_hir/src/hir_id.rs | 6 + compiler/rustc_hir/src/intravisit.rs | 1 - compiler/rustc_hir/src/lang_items.rs | 8 +- compiler/rustc_hir/src/pat_util.rs | 11 - compiler/rustc_hir/src/stable_hash_impls.rs | 17 +- compiler/rustc_hir_analysis/locales/en-US.ftl | 157 -- compiler/rustc_hir_analysis/messages.ftl | 227 ++ compiler/rustc_hir_analysis/src/astconv/errors.rs | 123 +- .../rustc_hir_analysis/src/astconv/generics.rs | 14 +- compiler/rustc_hir_analysis/src/astconv/mod.rs | 430 ++-- compiler/rustc_hir_analysis/src/bounds.rs | 2 +- compiler/rustc_hir_analysis/src/check/check.rs | 81 +- .../src/check/compare_impl_item.rs | 204 +- compiler/rustc_hir_analysis/src/check/dropck.rs | 8 - compiler/rustc_hir_analysis/src/check/intrinsic.rs | 30 +- .../rustc_hir_analysis/src/check/intrinsicck.rs | 9 +- compiler/rustc_hir_analysis/src/check/mod.rs | 9 +- compiler/rustc_hir_analysis/src/check/wfcheck.rs | 125 +- compiler/rustc_hir_analysis/src/check_unused.rs | 2 +- .../rustc_hir_analysis/src/coherence/builtin.rs | 72 +- .../src/coherence/inherent_impls.rs | 12 +- .../src/coherence/inherent_impls_overlap.rs | 2 +- compiler/rustc_hir_analysis/src/coherence/mod.rs | 4 +- .../rustc_hir_analysis/src/coherence/orphan.rs | 4 - compiler/rustc_hir_analysis/src/collect.rs | 256 +- .../rustc_hir_analysis/src/collect/generics_of.rs | 16 +- .../rustc_hir_analysis/src/collect/item_bounds.rs | 76 +- .../src/collect/predicates_of.rs | 200 +- .../src/collect/resolve_bound_vars.rs | 78 +- compiler/rustc_hir_analysis/src/collect/type_of.rs | 141 +- compiler/rustc_hir_analysis/src/errors.rs | 234 +- compiler/rustc_hir_analysis/src/hir_wf_check.rs | 44 +- .../src/impl_wf_check/min_specialization.rs | 51 +- compiler/rustc_hir_analysis/src/lib.rs | 65 +- .../rustc_hir_analysis/src/outlives/explicit.rs | 2 +- .../src/outlives/implicit_infer.rs | 2 +- compiler/rustc_hir_analysis/src/outlives/mod.rs | 9 +- compiler/rustc_hir_analysis/src/outlives/test.rs | 2 +- .../missing_cast_for_variadic_arg.rs | 35 +- .../src/structured_errors/sized_unsized_cast.rs | 15 +- .../wrong_number_of_generic_args.rs | 8 +- compiler/rustc_hir_analysis/src/variance/mod.rs | 22 +- compiler/rustc_hir_analysis/src/variance/test.rs | 9 +- compiler/rustc_hir_pretty/src/lib.rs | 106 +- compiler/rustc_hir_typeck/locales/en-US.ftl | 79 - compiler/rustc_hir_typeck/messages.ftl | 79 + compiler/rustc_hir_typeck/src/_match.rs | 10 +- compiler/rustc_hir_typeck/src/callee.rs | 6 +- compiler/rustc_hir_typeck/src/cast.rs | 18 +- compiler/rustc_hir_typeck/src/closure.rs | 51 +- compiler/rustc_hir_typeck/src/coercion.rs | 75 +- compiler/rustc_hir_typeck/src/demand.rs | 421 ++-- compiler/rustc_hir_typeck/src/expr.rs | 83 +- compiler/rustc_hir_typeck/src/expr_use_visitor.rs | 18 +- compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs | 216 +- .../src/fn_ctxt/adjust_fulfillment_errors.rs | 121 +- compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs | 91 +- compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs | 6 +- .../rustc_hir_typeck/src/fn_ctxt/suggestions.rs | 91 +- .../generator_interior/drop_ranges/cfg_build.rs | 7 +- .../rustc_hir_typeck/src/generator_interior/mod.rs | 36 +- compiler/rustc_hir_typeck/src/inherited.rs | 50 +- compiler/rustc_hir_typeck/src/intrinsicck.rs | 11 +- compiler/rustc_hir_typeck/src/lib.rs | 236 +- .../rustc_hir_typeck/src/mem_categorization.rs | 20 +- compiler/rustc_hir_typeck/src/method/confirm.rs | 14 +- compiler/rustc_hir_typeck/src/method/probe.rs | 102 +- compiler/rustc_hir_typeck/src/method/suggest.rs | 132 +- compiler/rustc_hir_typeck/src/op.rs | 43 +- compiler/rustc_hir_typeck/src/pat.rs | 44 +- compiler/rustc_hir_typeck/src/upvar.rs | 31 +- compiler/rustc_hir_typeck/src/writeback.rs | 5 +- compiler/rustc_incremental/locales/en-US.ftl | 118 - compiler/rustc_incremental/messages.ftl | 118 + compiler/rustc_incremental/src/lib.rs | 2 +- .../rustc_incremental/src/persist/dirty_clean.rs | 2 +- compiler/rustc_incremental/src/persist/fs.rs | 12 +- compiler/rustc_index/src/bit_set.rs | 14 +- compiler/rustc_index/src/vec.rs | 323 ++- compiler/rustc_infer/locales/en-US.ftl | 350 --- compiler/rustc_infer/messages.ftl | 393 ++++ compiler/rustc_infer/src/errors/mod.rs | 395 +++- .../rustc_infer/src/errors/note_and_explain.rs | 126 +- compiler/rustc_infer/src/infer/at.rs | 158 +- .../src/infer/canonical/canonicalizer.rs | 77 +- compiler/rustc_infer/src/infer/canonical/mod.rs | 12 +- .../src/infer/canonical/query_response.rs | 28 +- compiler/rustc_infer/src/infer/combine.rs | 104 +- compiler/rustc_infer/src/infer/equate.rs | 16 +- .../rustc_infer/src/infer/error_reporting/mod.rs | 620 ++--- .../src/infer/error_reporting/need_type_info.rs | 23 +- .../nice_region_error/placeholder_relation.rs | 20 +- .../nice_region_error/static_impl_trait.rs | 2 +- .../error_reporting/nice_region_error/util.rs | 2 +- .../rustc_infer/src/infer/error_reporting/note.rs | 9 +- .../src/infer/error_reporting/note_and_explain.rs | 8 +- .../src/infer/error_reporting/suggest.rs | 217 +- compiler/rustc_infer/src/infer/freshen.rs | 17 +- compiler/rustc_infer/src/infer/glb.rs | 18 +- .../rustc_infer/src/infer/higher_ranked/mod.rs | 14 +- compiler/rustc_infer/src/infer/lattice.rs | 6 +- .../src/infer/lexical_region_resolve/mod.rs | 53 +- compiler/rustc_infer/src/infer/lub.rs | 18 +- compiler/rustc_infer/src/infer/mod.rs | 333 ++- compiler/rustc_infer/src/infer/nll_relate/mod.rs | 326 ++- compiler/rustc_infer/src/infer/opaque_types.rs | 22 +- compiler/rustc_infer/src/infer/outlives/env.rs | 48 +- compiler/rustc_infer/src/infer/outlives/mod.rs | 107 +- .../rustc_infer/src/infer/outlives/obligations.rs | 47 +- .../src/infer/outlives/test_type_match.rs | 8 - compiler/rustc_infer/src/infer/projection.rs | 2 +- .../src/infer/region_constraints/leak_check.rs | 7 +- .../src/infer/region_constraints/mod.rs | 89 +- compiler/rustc_infer/src/infer/resolve.rs | 15 +- compiler/rustc_infer/src/infer/sub.rs | 17 +- compiler/rustc_infer/src/infer/type_variable.rs | 5 + compiler/rustc_infer/src/lib.rs | 2 +- compiler/rustc_infer/src/traits/engine.rs | 6 +- compiler/rustc_infer/src/traits/mod.rs | 22 +- .../rustc_infer/src/traits/structural_impls.rs | 3 +- compiler/rustc_infer/src/traits/util.rs | 246 +- compiler/rustc_interface/Cargo.toml | 7 +- compiler/rustc_interface/locales/en-US.ftl | 52 - compiler/rustc_interface/messages.ftl | 52 + compiler/rustc_interface/src/interface.rs | 2 +- compiler/rustc_interface/src/lib.rs | 4 +- compiler/rustc_interface/src/passes.rs | 130 +- compiler/rustc_interface/src/proc_macro_decls.rs | 3 +- compiler/rustc_interface/src/queries.rs | 56 +- compiler/rustc_interface/src/tests.rs | 6 +- compiler/rustc_interface/src/util.rs | 8 +- compiler/rustc_lexer/src/unescape.rs | 6 +- compiler/rustc_lint/locales/en-US.ftl | 510 ---- compiler/rustc_lint/messages.ftl | 512 ++++ compiler/rustc_lint/src/builtin.rs | 66 +- compiler/rustc_lint/src/context.rs | 4 + compiler/rustc_lint/src/early.rs | 13 +- .../rustc_lint/src/for_loops_over_fallibles.rs | 11 +- compiler/rustc_lint/src/internal.rs | 36 +- compiler/rustc_lint/src/let_underscore.rs | 2 +- compiler/rustc_lint/src/levels.rs | 20 +- compiler/rustc_lint/src/lib.rs | 2 +- compiler/rustc_lint/src/lints.rs | 68 +- compiler/rustc_lint/src/map_unit_fn.rs | 11 +- compiler/rustc_lint/src/methods.rs | 49 +- compiler/rustc_lint/src/non_ascii_idents.rs | 6 +- compiler/rustc_lint/src/nonstandard_style.rs | 11 +- .../rustc_lint/src/opaque_hidden_inferred_bound.rs | 21 +- compiler/rustc_lint/src/types.rs | 42 +- compiler/rustc_lint/src/unused.rs | 87 +- compiler/rustc_lint_defs/src/builtin.rs | 56 +- compiler/rustc_lint_defs/src/lib.rs | 17 +- compiler/rustc_llvm/build.rs | 2 + compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 33 +- compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 102 +- compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp | 1 - compiler/rustc_llvm/src/lib.rs | 10 +- compiler/rustc_log/src/lib.rs | 3 +- compiler/rustc_macros/Cargo.toml | 4 +- .../src/diagnostics/diagnostic_builder.rs | 176 +- compiler/rustc_macros/src/diagnostics/error.rs | 55 +- compiler/rustc_macros/src/diagnostics/fluent.rs | 31 +- .../rustc_macros/src/diagnostics/subdiagnostic.rs | 79 +- compiler/rustc_macros/src/diagnostics/utils.rs | 232 +- compiler/rustc_macros/src/hash_stable.rs | 45 +- compiler/rustc_macros/src/newtype.rs | 10 +- compiler/rustc_macros/src/query.rs | 8 +- compiler/rustc_macros/src/type_foldable.rs | 27 +- compiler/rustc_macros/src/type_visitable.rs | 30 +- compiler/rustc_metadata/Cargo.toml | 1 + compiler/rustc_metadata/locales/en-US.ftl | 288 --- compiler/rustc_metadata/messages.ftl | 288 +++ compiler/rustc_metadata/src/creader.rs | 131 +- compiler/rustc_metadata/src/fs.rs | 26 +- compiler/rustc_metadata/src/lib.rs | 5 +- compiler/rustc_metadata/src/locator.rs | 46 +- compiler/rustc_metadata/src/native_libs.rs | 76 +- compiler/rustc_metadata/src/rmeta/decoder.rs | 204 +- .../src/rmeta/decoder/cstore_impl.rs | 111 +- .../rustc_metadata/src/rmeta/def_path_hash_map.rs | 14 +- compiler/rustc_metadata/src/rmeta/encoder.rs | 402 ++-- compiler/rustc_metadata/src/rmeta/mod.rs | 21 +- compiler/rustc_metadata/src/rmeta/table.rs | 27 +- compiler/rustc_middle/Cargo.toml | 4 +- compiler/rustc_middle/locales/en-US.ftl | 36 - compiler/rustc_middle/messages.ftl | 40 + compiler/rustc_middle/src/arena.rs | 7 +- compiler/rustc_middle/src/dep_graph/mod.rs | 4 +- compiler/rustc_middle/src/error.rs | 8 + compiler/rustc_middle/src/hir/map/mod.rs | 54 +- compiler/rustc_middle/src/hir/mod.rs | 37 +- compiler/rustc_middle/src/hir/place.rs | 4 +- compiler/rustc_middle/src/infer/canonical.rs | 24 +- compiler/rustc_middle/src/infer/unify_key.rs | 37 +- compiler/rustc_middle/src/lib.rs | 4 +- compiler/rustc_middle/src/macros.rs | 2 +- compiler/rustc_middle/src/metadata.rs | 28 +- .../rustc_middle/src/middle/exported_symbols.rs | 5 + compiler/rustc_middle/src/middle/mod.rs | 2 +- compiler/rustc_middle/src/middle/privacy.rs | 18 +- compiler/rustc_middle/src/middle/stability.rs | 2 +- compiler/rustc_middle/src/mir/basic_blocks.rs | 6 +- .../rustc_middle/src/mir/interpret/allocation.rs | 28 +- .../src/mir/interpret/allocation/init_mask.rs | 330 ++- .../mir/interpret/allocation/init_mask/tests.rs | 195 ++ .../src/mir/interpret/allocation/provenance_map.rs | 2 +- .../src/mir/interpret/allocation/tests.rs | 19 - compiler/rustc_middle/src/mir/interpret/mod.rs | 3 +- compiler/rustc_middle/src/mir/mod.rs | 214 +- compiler/rustc_middle/src/mir/mono.rs | 4 +- compiler/rustc_middle/src/mir/patch.rs | 68 +- compiler/rustc_middle/src/mir/pretty.rs | 1 + compiler/rustc_middle/src/mir/query.rs | 26 +- compiler/rustc_middle/src/mir/spanview.rs | 4 +- compiler/rustc_middle/src/mir/syntax.rs | 151 +- compiler/rustc_middle/src/mir/tcx.rs | 34 +- compiler/rustc_middle/src/mir/terminator.rs | 186 +- compiler/rustc_middle/src/mir/traversal.rs | 16 +- compiler/rustc_middle/src/mir/visit.rs | 51 +- compiler/rustc_middle/src/query/erase.rs | 336 +++ compiler/rustc_middle/src/query/keys.rs | 297 +-- compiler/rustc_middle/src/query/mod.rs | 69 +- compiler/rustc_middle/src/thir.rs | 68 +- compiler/rustc_middle/src/thir/visit.rs | 1 + compiler/rustc_middle/src/traits/mod.rs | 38 +- compiler/rustc_middle/src/traits/solve.rs | 107 +- compiler/rustc_middle/src/ty/_match.rs | 8 - compiler/rustc_middle/src/ty/adjustment.rs | 3 +- compiler/rustc_middle/src/ty/adt.rs | 12 +- compiler/rustc_middle/src/ty/assoc.rs | 7 +- compiler/rustc_middle/src/ty/closure.rs | 8 +- compiler/rustc_middle/src/ty/codec.rs | 2 - compiler/rustc_middle/src/ty/consts.rs | 19 +- compiler/rustc_middle/src/ty/consts/int.rs | 16 +- compiler/rustc_middle/src/ty/consts/valtree.rs | 2 +- compiler/rustc_middle/src/ty/context.rs | 105 +- compiler/rustc_middle/src/ty/context/tls.rs | 59 +- compiler/rustc_middle/src/ty/diagnostics.rs | 10 +- compiler/rustc_middle/src/ty/error.rs | 8 +- compiler/rustc_middle/src/ty/fast_reject.rs | 104 +- compiler/rustc_middle/src/ty/flags.rs | 2 +- compiler/rustc_middle/src/ty/fold.rs | 23 +- .../src/ty/inhabitedness/inhabited_predicate.rs | 2 +- compiler/rustc_middle/src/ty/instance.rs | 55 +- compiler/rustc_middle/src/ty/layout.rs | 115 +- compiler/rustc_middle/src/ty/mod.rs | 219 +- compiler/rustc_middle/src/ty/parameterized.rs | 1 + compiler/rustc_middle/src/ty/print/mod.rs | 2 +- compiler/rustc_middle/src/ty/print/pretty.rs | 35 +- compiler/rustc_middle/src/ty/query.rs | 140 +- compiler/rustc_middle/src/ty/relate.rs | 32 +- compiler/rustc_middle/src/ty/structural_impls.rs | 15 +- compiler/rustc_middle/src/ty/sty.rs | 201 +- compiler/rustc_middle/src/ty/subst.rs | 4 +- compiler/rustc_middle/src/ty/trait_def.rs | 81 +- compiler/rustc_middle/src/ty/typeck_results.rs | 16 +- compiler/rustc_middle/src/ty/util.rs | 100 +- compiler/rustc_middle/src/ty/visit.rs | 3 + compiler/rustc_middle/src/values.rs | 2 +- compiler/rustc_mir_build/locales/en-US.ftl | 382 --- compiler/rustc_mir_build/messages.ftl | 374 +++ compiler/rustc_mir_build/src/build/block.rs | 2 + compiler/rustc_mir_build/src/build/cfg.rs | 11 + compiler/rustc_mir_build/src/build/custom/mod.rs | 6 +- compiler/rustc_mir_build/src/build/custom/parse.rs | 4 +- .../src/build/custom/parse/instruction.rs | 56 +- .../rustc_mir_build/src/build/expr/as_constant.rs | 6 +- .../rustc_mir_build/src/build/expr/as_operand.rs | 14 +- .../rustc_mir_build/src/build/expr/as_place.rs | 10 +- .../rustc_mir_build/src/build/expr/as_rvalue.rs | 174 +- compiler/rustc_mir_build/src/build/expr/as_temp.rs | 25 +- compiler/rustc_mir_build/src/build/expr/into.rs | 28 +- compiler/rustc_mir_build/src/build/expr/stmt.rs | 2 +- compiler/rustc_mir_build/src/build/matches/mod.rs | 34 +- compiler/rustc_mir_build/src/build/matches/test.rs | 4 +- compiler/rustc_mir_build/src/build/misc.rs | 4 +- compiler/rustc_mir_build/src/build/mod.rs | 45 +- compiler/rustc_mir_build/src/build/scope.rs | 68 +- compiler/rustc_mir_build/src/errors.rs | 51 +- compiler/rustc_mir_build/src/lib.rs | 3 +- compiler/rustc_mir_build/src/lints.rs | 11 +- compiler/rustc_mir_build/src/thir/cx/block.rs | 5 + compiler/rustc_mir_build/src/thir/cx/expr.rs | 21 +- .../src/thir/pattern/check_match.rs | 727 +++--- .../src/thir/pattern/const_to_pat.rs | 54 +- .../src/thir/pattern/deconstruct_pat.rs | 53 +- compiler/rustc_mir_build/src/thir/pattern/mod.rs | 57 +- .../rustc_mir_build/src/thir/pattern/usefulness.rs | 36 +- compiler/rustc_mir_build/src/thir/print.rs | 2 + compiler/rustc_mir_dataflow/locales/en-US.ftl | 29 - compiler/rustc_mir_dataflow/messages.ftl | 29 + compiler/rustc_mir_dataflow/src/elaborate_drops.rs | 253 +- .../rustc_mir_dataflow/src/framework/direction.rs | 17 +- .../rustc_mir_dataflow/src/framework/engine.rs | 3 +- .../rustc_mir_dataflow/src/framework/graphviz.rs | 28 +- compiler/rustc_mir_dataflow/src/framework/tests.rs | 4 +- .../src/impls/borrowed_locals.rs | 5 +- compiler/rustc_mir_dataflow/src/impls/liveness.rs | 4 +- .../src/impls/storage_liveness.rs | 7 +- compiler/rustc_mir_dataflow/src/lib.rs | 3 +- .../rustc_mir_dataflow/src/move_paths/builder.rs | 12 +- compiler/rustc_mir_dataflow/src/move_paths/mod.rs | 8 +- compiler/rustc_mir_dataflow/src/value_analysis.rs | 30 +- .../src/abort_unwinding_calls.rs | 32 +- .../rustc_mir_transform/src/add_call_guards.rs | 5 +- .../src/add_moves_for_packed_drops.rs | 3 - compiler/rustc_mir_transform/src/add_retag.rs | 2 +- .../rustc_mir_transform/src/check_alignment.rs | 242 ++ .../src/check_const_item_mutation.rs | 2 +- compiler/rustc_mir_transform/src/check_unsafety.rs | 32 +- .../src/cleanup_post_borrowck.rs | 1 + compiler/rustc_mir_transform/src/const_prop.rs | 311 ++- .../rustc_mir_transform/src/const_prop_lint.rs | 477 ++-- compiler/rustc_mir_transform/src/copy_prop.rs | 5 +- compiler/rustc_mir_transform/src/coverage/debug.rs | 3 +- compiler/rustc_mir_transform/src/coverage/graph.rs | 56 +- compiler/rustc_mir_transform/src/coverage/mod.rs | 2 +- compiler/rustc_mir_transform/src/coverage/spans.rs | 4 +- compiler/rustc_mir_transform/src/coverage/tests.rs | 6 +- .../rustc_mir_transform/src/dataflow_const_prop.rs | 14 +- .../src/dead_store_elimination.rs | 4 +- .../rustc_mir_transform/src/deduce_param_attrs.rs | 11 +- .../rustc_mir_transform/src/deref_separator.rs | 2 +- compiler/rustc_mir_transform/src/dest_prop.rs | 15 +- .../src/elaborate_box_derefs.rs | 12 +- .../rustc_mir_transform/src/elaborate_drops.rs | 192 +- .../rustc_mir_transform/src/ffi_unwind_calls.rs | 7 +- .../src/function_item_references.rs | 2 +- compiler/rustc_mir_transform/src/generator.rs | 82 +- compiler/rustc_mir_transform/src/inline.rs | 89 +- compiler/rustc_mir_transform/src/inline/cycle.rs | 4 + compiler/rustc_mir_transform/src/instcombine.rs | 68 +- compiler/rustc_mir_transform/src/large_enums.rs | 45 +- compiler/rustc_mir_transform/src/lib.rs | 55 +- .../rustc_mir_transform/src/lower_intrinsics.rs | 85 + .../rustc_mir_transform/src/lower_slice_len.rs | 5 +- compiler/rustc_mir_transform/src/nrvo.rs | 2 +- .../src/remove_noop_landing_pads.rs | 8 +- .../rustc_mir_transform/src/remove_uninit_drops.rs | 28 +- compiler/rustc_mir_transform/src/remove_zsts.rs | 136 +- .../src/separate_const_switch.rs | 8 +- compiler/rustc_mir_transform/src/shim.rs | 107 +- compiler/rustc_mir_transform/src/simplify.rs | 57 +- compiler/rustc_mir_transform/src/sroa.rs | 13 +- compiler/rustc_mir_transform/src/ssa.rs | 60 +- .../rustc_mir_transform/src/unreachable_prop.rs | 2 +- compiler/rustc_monomorphize/locales/en-US.ftl | 32 - compiler/rustc_monomorphize/messages.ftl | 32 + compiler/rustc_monomorphize/src/collector.rs | 98 +- compiler/rustc_monomorphize/src/lib.rs | 2 +- .../rustc_monomorphize/src/partitioning/default.rs | 48 +- .../rustc_monomorphize/src/partitioning/merging.rs | 2 +- .../rustc_monomorphize/src/partitioning/mod.rs | 4 +- compiler/rustc_monomorphize/src/polymorphize.rs | 9 +- compiler/rustc_parse/locales/en-US.ftl | 734 ------ compiler/rustc_parse/messages.ftl | 744 ++++++ compiler/rustc_parse/src/errors.rs | 55 +- compiler/rustc_parse/src/lexer/diagnostics.rs | 8 +- compiler/rustc_parse/src/lexer/mod.rs | 6 +- compiler/rustc_parse/src/lexer/tokentrees.rs | 4 +- compiler/rustc_parse/src/lexer/unicode_chars.rs | 4 +- compiler/rustc_parse/src/lib.rs | 2 +- compiler/rustc_parse/src/parser/diagnostics.rs | 247 +- compiler/rustc_parse/src/parser/expr.rs | 65 +- compiler/rustc_parse/src/parser/generics.rs | 2 +- compiler/rustc_parse/src/parser/item.rs | 51 +- compiler/rustc_parse/src/parser/mod.rs | 68 +- compiler/rustc_parse/src/parser/pat.rs | 10 +- compiler/rustc_parse/src/parser/path.rs | 40 +- compiler/rustc_parse/src/parser/stmt.rs | 12 - compiler/rustc_parse/src/parser/ty.rs | 9 +- compiler/rustc_parse_format/src/lib.rs | 54 +- compiler/rustc_passes/Cargo.toml | 1 + compiler/rustc_passes/locales/en-US.ftl | 748 ------ compiler/rustc_passes/messages.ftl | 726 ++++++ compiler/rustc_passes/src/check_attr.rs | 186 +- compiler/rustc_passes/src/check_const.rs | 4 +- compiler/rustc_passes/src/dead.rs | 101 +- compiler/rustc_passes/src/debugger_visualizer.rs | 8 +- compiler/rustc_passes/src/diagnostic_items.rs | 7 +- compiler/rustc_passes/src/entry.rs | 15 +- compiler/rustc_passes/src/errors.rs | 49 +- compiler/rustc_passes/src/hir_id_validator.rs | 4 +- compiler/rustc_passes/src/hir_stats.rs | 4 +- compiler/rustc_passes/src/layout_test.rs | 2 +- compiler/rustc_passes/src/lib.rs | 2 +- compiler/rustc_passes/src/liveness.rs | 9 +- compiler/rustc_passes/src/naked_functions.rs | 7 +- compiler/rustc_passes/src/reachable.rs | 10 +- compiler/rustc_passes/src/stability.rs | 31 +- compiler/rustc_plugin_impl/locales/en-US.ftl | 4 - compiler/rustc_plugin_impl/messages.ftl | 4 + compiler/rustc_plugin_impl/src/lib.rs | 2 +- compiler/rustc_plugin_impl/src/load.rs | 6 +- compiler/rustc_privacy/locales/en-US.ftl | 23 - compiler/rustc_privacy/messages.ftl | 23 + compiler/rustc_privacy/src/lib.rs | 33 +- compiler/rustc_query_impl/Cargo.toml | 2 +- compiler/rustc_query_impl/src/lib.rs | 15 +- compiler/rustc_query_impl/src/on_disk_cache.rs | 42 +- compiler/rustc_query_impl/src/plumbing.rs | 197 +- compiler/rustc_query_system/Cargo.toml | 2 +- compiler/rustc_query_system/locales/en-US.ftl | 30 - compiler/rustc_query_system/messages.ftl | 30 + compiler/rustc_query_system/src/cache.rs | 7 +- compiler/rustc_query_system/src/dep_graph/graph.rs | 456 ++-- compiler/rustc_query_system/src/dep_graph/mod.rs | 34 +- .../rustc_query_system/src/dep_graph/serialized.rs | 5 - compiler/rustc_query_system/src/lib.rs | 2 +- compiler/rustc_query_system/src/query/caches.rs | 35 +- compiler/rustc_query_system/src/query/config.rs | 54 +- compiler/rustc_query_system/src/query/job.rs | 4 +- compiler/rustc_query_system/src/query/mod.rs | 3 +- compiler/rustc_query_system/src/query/plumbing.rs | 619 ++--- compiler/rustc_resolve/locales/en-US.ftl | 211 -- compiler/rustc_resolve/messages.ftl | 225 ++ compiler/rustc_resolve/src/build_reduced_graph.rs | 156 +- compiler/rustc_resolve/src/check_unused.rs | 44 +- compiler/rustc_resolve/src/def_collector.rs | 4 +- compiler/rustc_resolve/src/diagnostics.rs | 84 +- .../rustc_resolve/src/effective_visibilities.rs | 84 +- compiler/rustc_resolve/src/errors.rs | 36 + compiler/rustc_resolve/src/ident.rs | 55 +- compiler/rustc_resolve/src/imports.rs | 133 +- compiler/rustc_resolve/src/late.rs | 76 +- compiler/rustc_resolve/src/late/diagnostics.rs | 204 +- compiler/rustc_resolve/src/lib.rs | 136 +- compiler/rustc_resolve/src/macros.rs | 52 +- compiler/rustc_resolve/src/rustdoc.rs | 36 +- compiler/rustc_serialize/Cargo.toml | 2 +- compiler/rustc_serialize/src/opaque.rs | 36 - compiler/rustc_serialize/src/serialize.rs | 16 +- compiler/rustc_serialize/tests/opaque.rs | 32 +- compiler/rustc_session/Cargo.toml | 8 +- compiler/rustc_session/locales/en-US.ftl | 95 - compiler/rustc_session/messages.ftl | 95 + compiler/rustc_session/src/code_stats.rs | 12 +- compiler/rustc_session/src/config.rs | 61 +- compiler/rustc_session/src/cstore.rs | 11 +- compiler/rustc_session/src/filesearch.rs | 131 +- compiler/rustc_session/src/lib.rs | 4 +- compiler/rustc_session/src/options.rs | 43 +- compiler/rustc_session/src/output.rs | 4 +- compiler/rustc_session/src/parse.rs | 41 +- compiler/rustc_session/src/session.rs | 95 +- compiler/rustc_session/src/utils.rs | 12 +- compiler/rustc_smir/Cargo.toml | 19 +- compiler/rustc_smir/README.md | 37 + compiler/rustc_smir/rust-toolchain.toml | 2 +- compiler/rustc_smir/src/lib.rs | 8 +- compiler/rustc_smir/src/mir.rs | 10 - compiler/rustc_smir/src/rustc_internal/mod.rs | 32 + compiler/rustc_smir/src/rustc_smir/mod.rs | 162 ++ compiler/rustc_smir/src/stable_mir/mir.rs | 3 + compiler/rustc_smir/src/stable_mir/mir/body.rs | 69 + compiler/rustc_smir/src/stable_mir/mod.rs | 73 + compiler/rustc_smir/src/very_unstable.rs | 27 - compiler/rustc_span/Cargo.toml | 1 + compiler/rustc_span/src/def_id.rs | 6 +- compiler/rustc_span/src/edit_distance.rs | 32 +- compiler/rustc_span/src/hygiene.rs | 8 +- compiler/rustc_span/src/lib.rs | 60 +- compiler/rustc_span/src/profiling.rs | 16 +- compiler/rustc_span/src/source_map.rs | 81 +- compiler/rustc_span/src/symbol.rs | 17 +- compiler/rustc_symbol_mangling/locales/en-US.ftl | 1 - compiler/rustc_symbol_mangling/messages.ftl | 1 + compiler/rustc_symbol_mangling/src/legacy.rs | 4 + compiler/rustc_symbol_mangling/src/lib.rs | 2 +- compiler/rustc_symbol_mangling/src/test.rs | 4 +- compiler/rustc_symbol_mangling/src/v0.rs | 34 +- compiler/rustc_target/Cargo.toml | 1 + compiler/rustc_target/src/abi/call/mod.rs | 2 +- compiler/rustc_target/src/asm/aarch64.rs | 4 +- compiler/rustc_target/src/asm/arm.rs | 12 +- compiler/rustc_target/src/asm/m68k.rs | 81 + compiler/rustc_target/src/asm/mod.rs | 45 +- compiler/rustc_target/src/asm/riscv.rs | 4 +- compiler/rustc_target/src/asm/x86.rs | 10 +- .../src/spec/aarch64_unknown_linux_ohos.rs | 32 + .../src/spec/aarch64_unknown_nto_qnx_710.rs | 1 + compiler/rustc_target/src/spec/abi.rs | 4 +- compiler/rustc_target/src/spec/armv4t_none_eabi.rs | 11 +- .../src/spec/armv7_unknown_linux_ohos.rs | 28 + .../rustc_target/src/spec/i586_pc_nto_qnx700.rs | 24 + .../src/spec/loongarch64_unknown_linux_gnu.rs | 17 + compiler/rustc_target/src/spec/mod.rs | 22 +- compiler/rustc_target/src/spec/msvc_base.rs | 1 + compiler/rustc_target/src/spec/nto_qnx_base.rs | 1 - .../src/spec/riscv64gc_unknown_fuchsia.rs | 19 + .../rustc_target/src/spec/thumbv4t_none_eabi.rs | 11 +- compiler/rustc_target/src/spec/wasm_base.rs | 8 + compiler/rustc_target/src/spec/windows_gnu_base.rs | 1 + .../rustc_target/src/spec/windows_gnullvm_base.rs | 1 + .../rustc_target/src/spec/x86_64_pc_nto_qnx710.rs | 1 + compiler/rustc_trait_selection/locales/en-US.ftl | 22 - compiler/rustc_trait_selection/messages.ftl | 22 + compiler/rustc_trait_selection/src/infer.rs | 35 +- compiler/rustc_trait_selection/src/lib.rs | 2 +- .../rustc_trait_selection/src/solve/assembly.rs | 550 ----- .../src/solve/assembly/mod.rs | 605 +++++ .../src/solve/assembly/structural_traits.rs | 417 ++++ .../src/solve/canonical/canonicalize.rs | 390 ---- .../src/solve/canonical/mod.rs | 240 -- .../src/solve/canonicalize.rs | 414 ++++ .../rustc_trait_selection/src/solve/eval_ctxt.rs | 537 ++++- .../src/solve/eval_ctxt/canonical.rs | 230 ++ .../rustc_trait_selection/src/solve/fulfill.rs | 47 +- compiler/rustc_trait_selection/src/solve/mod.rs | 605 ++--- .../src/solve/project_goals.rs | 250 +- .../src/solve/search_graph/cache.rs | 27 +- .../src/solve/search_graph/mod.rs | 149 +- .../src/solve/search_graph/overflow.rs | 26 +- .../rustc_trait_selection/src/solve/trait_goals.rs | 338 ++- .../src/solve/trait_goals/structural_traits.rs | 345 --- .../rustc_trait_selection/src/traits/auto_trait.rs | 43 +- .../src/traits/chalk_fulfill.rs | 7 +- .../rustc_trait_selection/src/traits/coherence.rs | 86 +- .../rustc_trait_selection/src/traits/engine.rs | 35 +- .../src/traits/error_reporting/ambiguity.rs | 8 +- .../src/traits/error_reporting/method_chain.rs | 13 +- .../src/traits/error_reporting/mod.rs | 314 ++- .../src/traits/error_reporting/on_unimplemented.rs | 14 +- .../src/traits/error_reporting/suggestions.rs | 137 +- .../rustc_trait_selection/src/traits/fulfill.rs | 72 +- compiler/rustc_trait_selection/src/traits/misc.rs | 12 +- compiler/rustc_trait_selection/src/traits/mod.rs | 89 +- .../src/traits/object_safety.rs | 76 +- .../src/traits/outlives_bounds.rs | 41 +- .../rustc_trait_selection/src/traits/project.rs | 59 +- .../src/traits/query/evaluate_obligation.rs | 48 +- .../src/traits/query/normalize.rs | 103 +- .../src/traits/query/type_op/custom.rs | 8 +- .../src/traits/select/candidate_assembly.rs | 205 +- .../src/traits/select/confirmation.rs | 86 +- .../rustc_trait_selection/src/traits/select/mod.rs | 412 ++-- .../src/traits/specialize/mod.rs | 15 +- .../src/traits/specialize/specialization_graph.rs | 18 +- compiler/rustc_trait_selection/src/traits/util.rs | 47 +- compiler/rustc_trait_selection/src/traits/wf.rs | 16 +- compiler/rustc_traits/src/chalk/db.rs | 2 +- compiler/rustc_traits/src/chalk/lowering.rs | 61 +- compiler/rustc_traits/src/dropck_outlives.rs | 4 +- .../rustc_traits/src/implied_outlives_bounds.rs | 4 +- .../rustc_traits/src/normalize_erasing_regions.rs | 2 +- compiler/rustc_transmute/src/layout/tree.rs | 28 +- compiler/rustc_transmute/src/lib.rs | 2 +- .../rustc_transmute/src/maybe_transmutable/mod.rs | 27 +- .../src/maybe_transmutable/query_context.rs | 4 +- .../src/maybe_transmutable/tests.rs | 6 +- compiler/rustc_ty_utils/locales/en-US.ftl | 47 - compiler/rustc_ty_utils/messages.ftl | 57 + compiler/rustc_ty_utils/src/abi.rs | 14 +- compiler/rustc_ty_utils/src/assoc.rs | 245 +- compiler/rustc_ty_utils/src/common_traits.rs | 3 +- compiler/rustc_ty_utils/src/consts.rs | 5 +- compiler/rustc_ty_utils/src/errors.rs | 33 + compiler/rustc_ty_utils/src/implied_bounds.rs | 1 - compiler/rustc_ty_utils/src/instance.rs | 20 +- compiler/rustc_ty_utils/src/layout.rs | 143 +- compiler/rustc_ty_utils/src/lib.rs | 5 +- compiler/rustc_ty_utils/src/representability.rs | 4 +- compiler/rustc_ty_utils/src/ty.rs | 100 +- compiler/rustc_type_ir/src/fold.rs | 2 +- compiler/rustc_type_ir/src/lib.rs | 24 +- compiler/rustc_type_ir/src/sty.rs | 2 +- 932 files changed, 36820 insertions(+), 27100 deletions(-) delete mode 100644 compiler/rustc_ast_lowering/locales/en-US.ftl create mode 100644 compiler/rustc_ast_lowering/messages.ftl delete mode 100644 compiler/rustc_ast_passes/locales/en-US.ftl create mode 100644 compiler/rustc_ast_passes/messages.ftl delete mode 100644 compiler/rustc_attr/locales/en-US.ftl create mode 100644 compiler/rustc_attr/messages.ftl delete mode 100644 compiler/rustc_borrowck/locales/en-US.ftl create mode 100644 compiler/rustc_borrowck/messages.ftl delete mode 100644 compiler/rustc_builtin_macros/locales/en-US.ftl create mode 100644 compiler/rustc_builtin_macros/messages.ftl create mode 100644 compiler/rustc_builtin_macros/src/errors.rs create mode 100644 compiler/rustc_codegen_cranelift/.github/workflows/abi-cafe.yml create mode 100644 compiler/rustc_codegen_cranelift/patches/0022-coretests-Disable-not-compiling-tests.patch delete mode 100644 compiler/rustc_codegen_cranelift/patches/0022-sysroot-Disable-not-compiling-tests.patch create mode 100644 compiler/rustc_codegen_cranelift/patches/0023-coretests-Ignore-failing-tests.patch delete mode 100644 compiler/rustc_codegen_cranelift/patches/0023-sysroot-Ignore-failing-tests.patch create mode 100644 compiler/rustc_codegen_cranelift/patches/0027-coretests-128bit-atomic-operations.patch create mode 100644 compiler/rustc_codegen_cranelift/patches/0027-stdlib-128bit-atomic-operations.patch delete mode 100644 compiler/rustc_codegen_cranelift/patches/0027-sysroot-128bit-atomic-operations.patch create mode 100644 compiler/rustc_codegen_cranelift/patches/0028-coretests-Disable-long-running-tests.patch delete mode 100644 compiler/rustc_codegen_cranelift/patches/0028-sysroot-Disable-long-running-tests.patch delete mode 100644 compiler/rustc_codegen_cranelift/src/cranelift_native.rs create mode 100644 compiler/rustc_codegen_gcc/.github/workflows/release.yml create mode 100644 compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml create mode 100644 compiler/rustc_codegen_gcc/failing-ui-tests.txt create mode 100644 compiler/rustc_codegen_gcc/failing-ui-tests12.txt delete mode 100644 compiler/rustc_codegen_gcc/locales/en-US.ftl create mode 100644 compiler/rustc_codegen_gcc/messages.ftl create mode 100644 compiler/rustc_codegen_gcc/patches/0001-Add-stdarch-Cargo.toml-for-testing.patch create mode 100644 compiler/rustc_codegen_gcc/patches/0001-Disable-examples.patch delete mode 100644 compiler/rustc_codegen_gcc/patches/0024-core-Disable-portable-simd-test.patch delete mode 100644 compiler/rustc_codegen_gcc/rustc_patches/compile_test.patch create mode 100644 compiler/rustc_codegen_gcc/src/attributes.rs create mode 100644 compiler/rustc_codegen_gcc/tools/check_intrinsics_duplicates.py delete mode 100644 compiler/rustc_codegen_llvm/locales/en-US.ftl create mode 100644 compiler/rustc_codegen_llvm/messages.ftl delete mode 100644 compiler/rustc_codegen_ssa/locales/en-US.ftl create mode 100644 compiler/rustc_codegen_ssa/messages.ftl delete mode 100644 compiler/rustc_const_eval/locales/en-US.ftl create mode 100644 compiler/rustc_const_eval/messages.ftl create mode 100644 compiler/rustc_data_structures/src/flat_map_in_place.rs delete mode 100644 compiler/rustc_data_structures/src/map_in_place.rs create mode 100644 compiler/rustc_data_structures/src/owned_slice.rs create mode 100644 compiler/rustc_data_structures/src/owned_slice/tests.rs delete mode 100644 compiler/rustc_data_structures/src/owning_ref/LICENSE delete mode 100644 compiler/rustc_data_structures/src/owning_ref/mod.rs delete mode 100644 compiler/rustc_data_structures/src/owning_ref/tests.rs delete mode 100644 compiler/rustc_data_structures/src/sso/either_iter.rs delete mode 100644 compiler/rustc_data_structures/src/vec_map.rs delete mode 100644 compiler/rustc_data_structures/src/vec_map/tests.rs delete mode 100644 compiler/rustc_driver_impl/locales/en-US.ftl create mode 100644 compiler/rustc_driver_impl/messages.ftl create mode 100644 compiler/rustc_error_codes/src/error_codes/E0794.md delete mode 100644 compiler/rustc_error_messages/locales/en-US.ftl create mode 100644 compiler/rustc_error_messages/messages.ftl delete mode 100644 compiler/rustc_errors/locales/en-US.ftl create mode 100644 compiler/rustc_errors/messages.ftl delete mode 100644 compiler/rustc_expand/locales/en-US.ftl create mode 100644 compiler/rustc_expand/messages.ftl delete mode 100644 compiler/rustc_hir_analysis/locales/en-US.ftl create mode 100644 compiler/rustc_hir_analysis/messages.ftl delete mode 100644 compiler/rustc_hir_typeck/locales/en-US.ftl create mode 100644 compiler/rustc_hir_typeck/messages.ftl delete mode 100644 compiler/rustc_incremental/locales/en-US.ftl create mode 100644 compiler/rustc_incremental/messages.ftl delete mode 100644 compiler/rustc_infer/locales/en-US.ftl create mode 100644 compiler/rustc_infer/messages.ftl delete mode 100644 compiler/rustc_interface/locales/en-US.ftl create mode 100644 compiler/rustc_interface/messages.ftl delete mode 100644 compiler/rustc_lint/locales/en-US.ftl create mode 100644 compiler/rustc_lint/messages.ftl delete mode 100644 compiler/rustc_metadata/locales/en-US.ftl create mode 100644 compiler/rustc_metadata/messages.ftl delete mode 100644 compiler/rustc_middle/locales/en-US.ftl create mode 100644 compiler/rustc_middle/messages.ftl create mode 100644 compiler/rustc_middle/src/mir/interpret/allocation/init_mask/tests.rs delete mode 100644 compiler/rustc_middle/src/mir/interpret/allocation/tests.rs create mode 100644 compiler/rustc_middle/src/query/erase.rs delete mode 100644 compiler/rustc_mir_build/locales/en-US.ftl create mode 100644 compiler/rustc_mir_build/messages.ftl delete mode 100644 compiler/rustc_mir_dataflow/locales/en-US.ftl create mode 100644 compiler/rustc_mir_dataflow/messages.ftl create mode 100644 compiler/rustc_mir_transform/src/check_alignment.rs delete mode 100644 compiler/rustc_monomorphize/locales/en-US.ftl create mode 100644 compiler/rustc_monomorphize/messages.ftl delete mode 100644 compiler/rustc_parse/locales/en-US.ftl create mode 100644 compiler/rustc_parse/messages.ftl delete mode 100644 compiler/rustc_passes/locales/en-US.ftl create mode 100644 compiler/rustc_passes/messages.ftl delete mode 100644 compiler/rustc_plugin_impl/locales/en-US.ftl create mode 100644 compiler/rustc_plugin_impl/messages.ftl delete mode 100644 compiler/rustc_privacy/locales/en-US.ftl create mode 100644 compiler/rustc_privacy/messages.ftl delete mode 100644 compiler/rustc_query_system/locales/en-US.ftl create mode 100644 compiler/rustc_query_system/messages.ftl delete mode 100644 compiler/rustc_resolve/locales/en-US.ftl create mode 100644 compiler/rustc_resolve/messages.ftl delete mode 100644 compiler/rustc_session/locales/en-US.ftl create mode 100644 compiler/rustc_session/messages.ftl delete mode 100644 compiler/rustc_smir/src/mir.rs create mode 100644 compiler/rustc_smir/src/rustc_internal/mod.rs create mode 100644 compiler/rustc_smir/src/rustc_smir/mod.rs create mode 100644 compiler/rustc_smir/src/stable_mir/mir.rs create mode 100644 compiler/rustc_smir/src/stable_mir/mir/body.rs create mode 100644 compiler/rustc_smir/src/stable_mir/mod.rs delete mode 100644 compiler/rustc_smir/src/very_unstable.rs delete mode 100644 compiler/rustc_symbol_mangling/locales/en-US.ftl create mode 100644 compiler/rustc_symbol_mangling/messages.ftl create mode 100644 compiler/rustc_target/src/asm/m68k.rs create mode 100644 compiler/rustc_target/src/spec/aarch64_unknown_linux_ohos.rs create mode 100644 compiler/rustc_target/src/spec/armv7_unknown_linux_ohos.rs create mode 100644 compiler/rustc_target/src/spec/i586_pc_nto_qnx700.rs create mode 100644 compiler/rustc_target/src/spec/loongarch64_unknown_linux_gnu.rs create mode 100644 compiler/rustc_target/src/spec/riscv64gc_unknown_fuchsia.rs delete mode 100644 compiler/rustc_trait_selection/locales/en-US.ftl create mode 100644 compiler/rustc_trait_selection/messages.ftl delete mode 100644 compiler/rustc_trait_selection/src/solve/assembly.rs create mode 100644 compiler/rustc_trait_selection/src/solve/assembly/mod.rs create mode 100644 compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs delete mode 100644 compiler/rustc_trait_selection/src/solve/canonical/canonicalize.rs delete mode 100644 compiler/rustc_trait_selection/src/solve/canonical/mod.rs create mode 100644 compiler/rustc_trait_selection/src/solve/canonicalize.rs create mode 100644 compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs delete mode 100644 compiler/rustc_trait_selection/src/solve/trait_goals/structural_traits.rs delete mode 100644 compiler/rustc_ty_utils/locales/en-US.ftl create mode 100644 compiler/rustc_ty_utils/messages.ftl (limited to 'compiler') diff --git a/compiler/rustc/src/main.rs b/compiler/rustc/src/main.rs index e21c9b660..434b978ae 100644 --- a/compiler/rustc/src/main.rs +++ b/compiler/rustc/src/main.rs @@ -24,6 +24,15 @@ // The two crates we link to here, `std` and `rustc_driver`, are both dynamic // libraries. So we must reference jemalloc symbols one way or another, because // this file is the only object code in the rustc executable. +// +// NOTE: if you are reading this comment because you want to set a custom `global_allocator` for +// benchmarking, consider using the benchmarks in the `rustc-perf` collector suite instead: +// https://github.com/rust-lang/rustc-perf/blob/master/collector/README.md#profiling +// +// NOTE: if you are reading this comment because you want to replace jemalloc with another allocator +// to compare their performance, see +// https://github.com/rust-lang/rust/commit/b90cfc887c31c3e7a9e6d462e2464db1fe506175#diff-43914724af6e464c1da2171e4a9b6c7e607d5bc1203fa95c0ab85be4122605ef +// for an example of how to do so. #[unix_sigpipe = "sig_dfl"] fn main() { diff --git a/compiler/rustc_abi/src/layout.rs b/compiler/rustc_abi/src/layout.rs index 54858b520..c863acde7 100644 --- a/compiler/rustc_abi/src/layout.rs +++ b/compiler/rustc_abi/src/layout.rs @@ -8,19 +8,6 @@ use rand_xoshiro::Xoshiro128StarStar; use tracing::debug; -// Invert a bijective mapping, i.e. `invert(map)[y] = x` if `map[x] = y`. -// This is used to go between `memory_index` (source field order to memory order) -// and `inverse_memory_index` (memory order to source field order). -// See also `FieldsShape::Arbitrary::memory_index` for more details. -// FIXME(eddyb) build a better abstraction for permutations, if possible. -fn invert_mapping(map: &[u32]) -> Vec { - let mut inverse = vec![0; map.len()]; - for i in 0..map.len() { - inverse[map[i] as usize] = i as u32; - } - inverse -} - pub trait LayoutCalculator { type TargetDataLayoutRef: Borrow; @@ -43,10 +30,10 @@ pub trait LayoutCalculator { .max_by_key(|niche| niche.available(dl)); LayoutS { - variants: Variants::Single { index: VariantIdx::new(0) }, + variants: Variants::Single { index: FIRST_VARIANT }, fields: FieldsShape::Arbitrary { - offsets: vec![Size::ZERO, b_offset], - memory_index: vec![0, 1], + offsets: [Size::ZERO, b_offset].into(), + memory_index: [0, 1].into(), }, abi: Abi::ScalarPair(a, b), largest_niche, @@ -58,18 +45,18 @@ pub trait LayoutCalculator { fn univariant( &self, dl: &TargetDataLayout, - fields: &[Layout<'_>], + fields: &IndexSlice>, repr: &ReprOptions, kind: StructKind, ) -> Option { let pack = repr.pack; let mut align = if pack.is_some() { dl.i8_align } else { dl.aggregate_align }; - let mut inverse_memory_index: Vec = (0..fields.len() as u32).collect(); + let mut inverse_memory_index: IndexVec = fields.indices().collect(); let optimize = !repr.inhibit_struct_field_reordering_opt(); if optimize { let end = if let StructKind::MaybeUnsized = kind { fields.len() - 1 } else { fields.len() }; - let optimizing = &mut inverse_memory_index[..end]; + let optimizing = &mut inverse_memory_index.raw[..end]; let effective_field_align = |layout: Layout<'_>| { if let Some(pack) = pack { // return the packed alignment in bytes @@ -105,7 +92,7 @@ pub trait LayoutCalculator { // Place ZSTs first to avoid "interesting offsets", // especially with only one or two non-ZST fields. // Then place largest alignments first, largest niches within an alignment group last - let f = fields[x as usize]; + let f = fields[x]; let niche_size = f.largest_niche().map_or(0, |n| n.available(dl)); (!f.0.is_zst(), cmp::Reverse(effective_field_align(f)), niche_size) }); @@ -117,7 +104,7 @@ pub trait LayoutCalculator { // And put the largest niche in an alignment group at the end // so it can be used as discriminant in jagged enums optimizing.sort_by_key(|&x| { - let f = fields[x as usize]; + let f = fields[x]; let niche_size = f.largest_niche().map_or(0, |n| n.available(dl)); (effective_field_align(f), niche_size) }); @@ -135,7 +122,7 @@ pub trait LayoutCalculator { // At the bottom of this function, we invert `inverse_memory_index` to // produce `memory_index` (see `invert_mapping`). let mut sized = true; - let mut offsets = vec![Size::ZERO; fields.len()]; + let mut offsets = IndexVec::from_elem(Size::ZERO, &fields); let mut offset = Size::ZERO; let mut largest_niche = None; let mut largest_niche_available = 0; @@ -146,7 +133,7 @@ pub trait LayoutCalculator { offset = prefix_size.align_to(prefix_align); } for &i in &inverse_memory_index { - let field = &fields[i as usize]; + let field = &fields[i]; if !sized { self.delay_bug(&format!( "univariant: field #{} comes after unsized field", @@ -168,7 +155,7 @@ pub trait LayoutCalculator { align = align.max(field_align); debug!("univariant offset: {:?} field: {:#?}", offset, field); - offsets[i as usize] = offset; + offsets[i] = offset; if let Some(mut niche) = field.largest_niche() { let available = niche.available(dl); @@ -192,14 +179,18 @@ pub trait LayoutCalculator { // If field 5 has offset 0, offsets[0] is 5, and memory_index[5] should be 0. // Field 5 would be the first element, so memory_index is i: // Note: if we didn't optimize, it's already right. - let memory_index = - if optimize { invert_mapping(&inverse_memory_index) } else { inverse_memory_index }; + let memory_index = if optimize { + inverse_memory_index.invert_bijective_mapping() + } else { + debug_assert!(inverse_memory_index.iter().copied().eq(fields.indices())); + inverse_memory_index.into_iter().map(FieldIdx::as_u32).collect() + }; let size = min_size.align_to(align.abi); let mut abi = Abi::Aggregate { sized }; // Unpack newtype ABIs and find scalar pairs. if sized && size.bytes() > 0 { // All other fields must be ZSTs. - let mut non_zst_fields = fields.iter().enumerate().filter(|&(_, f)| !f.0.is_zst()); + let mut non_zst_fields = fields.iter_enumerated().filter(|&(_, f)| !f.0.is_zst()); match (non_zst_fields.next(), non_zst_fields.next(), non_zst_fields.next()) { // We have exactly one non-ZST field. @@ -238,13 +229,13 @@ pub trait LayoutCalculator { let pair = self.scalar_pair(a, b); let pair_offsets = match pair.fields { FieldsShape::Arbitrary { ref offsets, ref memory_index } => { - assert_eq!(memory_index, &[0, 1]); + assert_eq!(memory_index.raw, [0, 1]); offsets } _ => panic!(), }; - if offsets[i] == pair_offsets[0] - && offsets[j] == pair_offsets[1] + if offsets[i] == pair_offsets[FieldIdx::from_usize(0)] + && offsets[j] == pair_offsets[FieldIdx::from_usize(1)] && align == pair.align && size == pair.size { @@ -264,7 +255,7 @@ pub trait LayoutCalculator { abi = Abi::Uninhabited; } Some(LayoutS { - variants: Variants::Single { index: VariantIdx::new(0) }, + variants: Variants::Single { index: FIRST_VARIANT }, fields: FieldsShape::Arbitrary { offsets, memory_index }, abi, largest_niche, @@ -277,7 +268,7 @@ pub trait LayoutCalculator { let dl = self.current_data_layout(); let dl = dl.borrow(); LayoutS { - variants: Variants::Single { index: VariantIdx::new(0) }, + variants: Variants::Single { index: FIRST_VARIANT }, fields: FieldsShape::Primitive, abi: Abi::Uninhabited, largest_niche: None, @@ -289,7 +280,7 @@ pub trait LayoutCalculator { fn layout_of_struct_or_enum( &self, repr: &ReprOptions, - variants: &IndexVec>>, + variants: &IndexSlice>>, is_enum: bool, is_unsafe_cell: bool, scalar_valid_range: (Bound, Bound), @@ -312,7 +303,7 @@ pub trait LayoutCalculator { // but *not* an encoding of the discriminant (e.g., a tag value). // See issue #49298 for more details on the need to leave space // for non-ZST uninhabited data (mostly partial initialization). - let absent = |fields: &[Layout<'_>]| { + let absent = |fields: &IndexSlice>| { let uninhabited = fields.iter().any(|f| f.abi().is_uninhabited()); let is_zst = fields.iter().all(|f| f.0.is_zst()); uninhabited && is_zst @@ -331,7 +322,7 @@ pub trait LayoutCalculator { } // If it's a struct, still compute a layout so that we can still compute the // field offsets. - None => VariantIdx::new(0), + None => FIRST_VARIANT, }; let is_struct = !is_enum || @@ -467,7 +458,7 @@ pub trait LayoutCalculator { .max_by_key(|(_i, layout)| layout.size.bytes()) .map(|(i, _layout)| i)?; - let all_indices = (0..=variants.len() - 1).map(VariantIdx::new); + let all_indices = variants.indices(); let needs_disc = |index: VariantIdx| index != largest_variant_index && !absent(&variants[index]); let niche_variants = all_indices.clone().find(|v| needs_disc(*v)).unwrap().index() @@ -510,7 +501,7 @@ pub trait LayoutCalculator { // It'll fit, but we need to make some adjustments. match layout.fields { FieldsShape::Arbitrary { ref mut offsets, .. } => { - for (j, offset) in offsets.iter_mut().enumerate() { + for (j, offset) in offsets.iter_enumerated_mut() { if !variants[i][j].0.is_zst() { *offset += this_offset; } @@ -577,8 +568,8 @@ pub trait LayoutCalculator { variants: IndexVec::new(), }, fields: FieldsShape::Arbitrary { - offsets: vec![niche_offset], - memory_index: vec![0], + offsets: [niche_offset].into(), + memory_index: [0].into(), }, abi, largest_niche, @@ -651,7 +642,8 @@ pub trait LayoutCalculator { st.variants = Variants::Single { index: i }; // Find the first field we can't move later // to make room for a larger discriminant. - for field in st.fields.index_by_increasing_offset().map(|j| &field_layouts[j]) { + for field_idx in st.fields.index_by_increasing_offset() { + let field = &field_layouts[FieldIdx::from_usize(field_idx)]; if !field.0.is_zst() || field.align().abi.bytes() != 1 { start_align = start_align.min(field.align().abi); break; @@ -802,13 +794,13 @@ pub trait LayoutCalculator { let pair = self.scalar_pair(tag, prim_scalar); let pair_offsets = match pair.fields { FieldsShape::Arbitrary { ref offsets, ref memory_index } => { - assert_eq!(memory_index, &[0, 1]); + assert_eq!(memory_index.raw, [0, 1]); offsets } _ => panic!(), }; - if pair_offsets[0] == Size::ZERO - && pair_offsets[1] == *offset + if pair_offsets[FieldIdx::from_u32(0)] == Size::ZERO + && pair_offsets[FieldIdx::from_u32(1)] == *offset && align == pair.align && size == pair.size { @@ -844,7 +836,10 @@ pub trait LayoutCalculator { tag_field: 0, variants: IndexVec::new(), }, - fields: FieldsShape::Arbitrary { offsets: vec![Size::ZERO], memory_index: vec![0] }, + fields: FieldsShape::Arbitrary { + offsets: [Size::ZERO].into(), + memory_index: [0].into(), + }, largest_niche, abi, align, @@ -883,7 +878,7 @@ pub trait LayoutCalculator { fn layout_of_union( &self, repr: &ReprOptions, - variants: &IndexVec>>, + variants: &IndexSlice>>, ) -> Option { let dl = self.current_data_layout(); let dl = dl.borrow(); @@ -896,8 +891,8 @@ pub trait LayoutCalculator { let optimize = !repr.inhibit_union_abi_opt(); let mut size = Size::ZERO; let mut abi = Abi::Aggregate { sized: true }; - let index = VariantIdx::new(0); - for field in &variants[index] { + let only_variant = &variants[FIRST_VARIANT]; + for field in only_variant { assert!(field.0.is_sized()); align = align.max(field.align()); @@ -930,8 +925,8 @@ pub trait LayoutCalculator { } Some(LayoutS { - variants: Variants::Single { index }, - fields: FieldsShape::Union(NonZeroUsize::new(variants[index].len())?), + variants: Variants::Single { index: FIRST_VARIANT }, + fields: FieldsShape::Union(NonZeroUsize::new(only_variant.len())?), abi, largest_niche: None, align, diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 39574ca55..b0c0ee942 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -11,7 +11,7 @@ use bitflags::bitflags; use rustc_data_structures::intern::Interned; #[cfg(feature = "nightly")] use rustc_data_structures::stable_hasher::StableOrd; -use rustc_index::vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexSlice, IndexVec}; #[cfg(feature = "nightly")] use rustc_macros::HashStable_Generic; #[cfg(feature = "nightly")] @@ -1057,6 +1057,32 @@ impl Scalar { } } +rustc_index::newtype_index! { + /// The *source-order* index of a field in a variant. + /// + /// This is how most code after type checking refers to fields, rather than + /// using names (as names have hygiene complications and more complex lookup). + /// + /// Particularly for `repr(Rust)` types, this may not be the same as *layout* order. + /// (It is for `repr(C)` `struct`s, however.) + /// + /// For example, in the following types, + /// ```rust + /// # enum Never {} + /// # #[repr(u16)] + /// enum Demo1 { + /// Variant0 { a: Never, b: i32 } = 100, + /// Variant1 { c: u8, d: u64 } = 10, + /// } + /// struct Demo2 { e: u8, f: u16, g: u8 } + /// ``` + /// `b` is `FieldIdx(1)` in `VariantIdx(0)`, + /// `d` is `FieldIdx(1)` in `VariantIdx(1)`, and + /// `f` is `FieldIdx(1)` in `VariantIdx(0)`. + #[derive(HashStable_Generic)] + pub struct FieldIdx {} +} + /// Describes how the fields of a type are located in memory. #[derive(PartialEq, Eq, Hash, Clone, Debug)] #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] @@ -1082,7 +1108,7 @@ pub enum FieldsShape { /// ordered to match the source definition order. /// This vector does not go in increasing order. // FIXME(eddyb) use small vector optimization for the common case. - offsets: Vec, + offsets: IndexVec, /// Maps source order field indices to memory order indices, /// depending on how the fields were reordered (if at all). @@ -1096,7 +1122,7 @@ pub enum FieldsShape { /// // FIXME(eddyb) build a better abstraction for permutations, if possible. // FIXME(camlorn) also consider small vector optimization here. - memory_index: Vec, + memory_index: IndexVec, }, } @@ -1131,7 +1157,7 @@ impl FieldsShape { assert!(i < count); stride * i } - FieldsShape::Arbitrary { ref offsets, .. } => offsets[i], + FieldsShape::Arbitrary { ref offsets, .. } => offsets[FieldIdx::from_usize(i)], } } @@ -1142,28 +1168,27 @@ impl FieldsShape { unreachable!("FieldsShape::memory_index: `Primitive`s have no fields") } FieldsShape::Union(_) | FieldsShape::Array { .. } => i, - FieldsShape::Arbitrary { ref memory_index, .. } => memory_index[i].try_into().unwrap(), + FieldsShape::Arbitrary { ref memory_index, .. } => { + memory_index[FieldIdx::from_usize(i)].try_into().unwrap() + } } } /// Gets source indices of the fields by increasing offsets. #[inline] - pub fn index_by_increasing_offset<'a>(&'a self) -> impl Iterator + 'a { + pub fn index_by_increasing_offset(&self) -> impl Iterator + '_ { let mut inverse_small = [0u8; 64]; - let mut inverse_big = vec![]; + let mut inverse_big = IndexVec::new(); let use_small = self.count() <= inverse_small.len(); // We have to write this logic twice in order to keep the array small. if let FieldsShape::Arbitrary { ref memory_index, .. } = *self { if use_small { - for i in 0..self.count() { - inverse_small[memory_index[i] as usize] = i as u8; + for (field_idx, &mem_idx) in memory_index.iter_enumerated() { + inverse_small[mem_idx as usize] = field_idx.as_u32() as u8; } } else { - inverse_big = vec![0; self.count()]; - for i in 0..self.count() { - inverse_big[memory_index[i] as usize] = i as u32; - } + inverse_big = memory_index.invert_bijective_mapping(); } } @@ -1173,7 +1198,7 @@ impl FieldsShape { if use_small { inverse_small[i] as usize } else { - inverse_big[i] as usize + inverse_big[i as u32].as_usize() } } }) @@ -1380,8 +1405,21 @@ impl Niche { } rustc_index::newtype_index! { + /// The *source-order* index of a variant in a type. + /// + /// For enums, these are always `0..variant_count`, regardless of any + /// custom discriminants that may have been defined, and including any + /// variants that may end up uninhabited due to field types. (Some of the + /// variants may not be present in a monomorphized ABI [`Variants`], but + /// those skipped variants are always counted when determining the *index*.) + /// + /// `struct`s, `tuples`, and `unions`s are considered to have a single variant + /// with variant index zero, aka [`FIRST_VARIANT`]. #[derive(HashStable_Generic)] - pub struct VariantIdx {} + pub struct VariantIdx { + /// Equivalent to `VariantIdx(0)`. + const FIRST_VARIANT = 0; + } } #[derive(PartialEq, Eq, Hash, Clone)] @@ -1422,7 +1460,7 @@ impl LayoutS { let size = scalar.size(cx); let align = scalar.align(cx); LayoutS { - variants: Variants::Single { index: VariantIdx::new(0) }, + variants: Variants::Single { index: FIRST_VARIANT }, fields: FieldsShape::Primitive, abi: Abi::Scalar(scalar), largest_niche, @@ -1484,6 +1522,16 @@ impl<'a> Layout<'a> { pub fn size(self) -> Size { self.0.0.size } + + /// Whether the layout is from a type that implements [`std::marker::PointerLike`]. + /// + /// Currently, that means that the type is pointer-sized, pointer-aligned, + /// and has a scalar ABI. + pub fn is_pointer_like(self, data_layout: &TargetDataLayout) -> bool { + self.size() == data_layout.pointer_size + && self.align().abi == data_layout.pointer_align.abi + && matches!(self.abi(), Abi::Scalar(..)) + } } #[derive(Copy, Clone, PartialEq, Eq, Debug)] diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 4fae5ef84..345e058e1 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -22,6 +22,7 @@ #![feature(strict_provenance)] #![deny(rustc::untranslatable_diagnostic)] #![deny(rustc::diagnostic_outside_of_impl)] +#![allow(clippy::mut_from_ref)] // Arena allocators are one of the places where this pattern is fine. use smallvec::SmallVec; @@ -568,7 +569,9 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { } pub trait ArenaAllocatable<'tcx, C = rustc_arena::IsNotCopy>: Sized { + #[allow(clippy::mut_from_ref)] fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self; + #[allow(clippy::mut_from_ref)] fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl ::std::iter::IntoIterator, @@ -578,10 +581,12 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { // Any type that impls `Copy` can be arena-allocated in the `DroplessArena`. impl<'tcx, T: Copy> ArenaAllocatable<'tcx, rustc_arena::IsCopy> for T { #[inline] + #[allow(clippy::mut_from_ref)] fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self { arena.dropless.alloc(self) } #[inline] + #[allow(clippy::mut_from_ref)] fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl ::std::iter::IntoIterator, @@ -601,6 +606,7 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { } #[inline] + #[allow(clippy::mut_from_ref)] fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl ::std::iter::IntoIterator, @@ -616,12 +622,14 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { impl<'tcx> Arena<'tcx> { #[inline] + #[allow(clippy::mut_from_ref)] pub fn alloc, C>(&self, value: T) -> &mut T { value.allocate_on(self) } // Any type that impls `Copy` can have slices be arena-allocated in the `DroplessArena`. #[inline] + #[allow(clippy::mut_from_ref)] pub fn alloc_slice(&self, value: &[T]) -> &mut [T] { if value.is_empty() { return &mut []; @@ -629,6 +637,7 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { self.dropless.alloc_slice(value) } + #[allow(clippy::mut_from_ref)] pub fn alloc_from_iter<'a, T: ArenaAllocatable<'tcx, C>, C>( &'a self, iter: impl ::std::iter::IntoIterator, diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 03c375c46..df1a71675 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -231,15 +231,15 @@ impl AngleBracketedArg { } } -impl Into>> for AngleBracketedArgs { - fn into(self) -> Option> { - Some(P(GenericArgs::AngleBracketed(self))) +impl Into> for AngleBracketedArgs { + fn into(self) -> P { + P(GenericArgs::AngleBracketed(self)) } } -impl Into>> for ParenthesizedArgs { - fn into(self) -> Option> { - Some(P(GenericArgs::Parenthesized(self))) +impl Into> for ParenthesizedArgs { + fn into(self) -> P { + P(GenericArgs::Parenthesized(self)) } } @@ -1184,6 +1184,15 @@ impl Expr { expr } + pub fn peel_parens_and_refs(&self) -> &Expr { + let mut expr = self; + while let ExprKind::Paren(inner) | ExprKind::AddrOf(BorrowKind::Ref, _, inner) = &expr.kind + { + expr = inner; + } + expr + } + /// Attempts to reparse as `Ty` (for diagnostic purposes). pub fn to_ty(&self) -> Option> { let kind = match &self.kind { @@ -1230,7 +1239,6 @@ impl Expr { pub fn precedence(&self) -> ExprPrecedence { match self.kind { - ExprKind::Box(_) => ExprPrecedence::Box, ExprKind::Array(_) => ExprPrecedence::Array, ExprKind::ConstBlock(_) => ExprPrecedence::ConstBlock, ExprKind::Call(..) => ExprPrecedence::Call, @@ -1291,8 +1299,7 @@ impl Expr { /// To a first-order approximation, is this a pattern? pub fn is_approximately_pattern(&self) -> bool { match &self.peel_parens().kind { - ExprKind::Box(_) - | ExprKind::Array(_) + ExprKind::Array(_) | ExprKind::Call(_, _) | ExprKind::Tup(_) | ExprKind::Lit(_) @@ -1363,8 +1370,6 @@ pub struct StructExpr { #[derive(Clone, Encodable, Decodable, Debug)] pub enum ExprKind { - /// A `box x` expression. - Box(P), /// An array (`[a, b, c, d]`) Array(ThinVec>), /// Allow anonymous constants from an inline `const` block @@ -1421,13 +1426,9 @@ pub enum ExprKind { Block(P, Option