about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.reuse/dep52
-rw-r--r--Cargo.lock80
-rw-r--r--compiler/rustc_ast/src/lib.rs2
-rw-r--r--compiler/rustc_ast/src/visit.rs800
-rw-r--r--compiler/rustc_ast_lowering/src/errors.rs9
-rw-r--r--compiler/rustc_ast_passes/src/errors.rs17
-rw-r--r--compiler/rustc_ast_passes/src/feature_gate.rs3
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs35
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs8
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/mod.rs12
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/move_errors.rs17
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs17
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs6
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/region_errors.rs27
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/region_name.rs4
-rw-r--r--compiler/rustc_borrowck/src/lib.rs2
-rw-r--r--compiler/rustc_borrowck/src/region_infer/mod.rs4
-rw-r--r--compiler/rustc_borrowck/src/type_check/canonical.rs2
-rw-r--r--compiler/rustc_borrowck/src/type_check/constraint_conversion.rs4
-rw-r--r--compiler/rustc_borrowck/src/type_check/free_region_relations.rs16
-rw-r--r--compiler/rustc_borrowck/src/type_check/mod.rs6
-rw-r--r--compiler/rustc_borrowck/src/type_check/relate_tys.rs16
-rw-r--r--compiler/rustc_borrowck/src/universal_regions.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/errors.rs10
-rw-r--r--compiler/rustc_codegen_ssa/Cargo.toml2
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs4
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs2
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/ops.rs7
-rw-r--r--compiler/rustc_data_structures/Cargo.toml2
-rw-r--r--compiler/rustc_data_structures/src/flock/windows.rs1
-rw-r--r--compiler/rustc_data_structures/src/profiling.rs6
-rw-r--r--compiler/rustc_driver_impl/Cargo.toml2
-rw-r--r--compiler/rustc_errors/Cargo.toml2
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs212
-rw-r--r--compiler/rustc_errors/src/diagnostic_builder.rs191
-rw-r--r--compiler/rustc_errors/src/diagnostic_impls.rs30
-rw-r--r--compiler/rustc_errors/src/emitter.rs2
-rw-r--r--compiler/rustc_errors/src/lib.rs86
-rw-r--r--compiler/rustc_errors/src/lock.rs6
-rw-r--r--compiler/rustc_expand/messages.ftl5
-rw-r--r--compiler/rustc_expand/src/base.rs4
-rw-r--r--compiler/rustc_expand/src/config.rs1
-rw-r--r--compiler/rustc_expand/src/errors.rs10
-rw-r--r--compiler/rustc_expand/src/expand.rs16
-rw-r--r--compiler/rustc_expand/src/lib.rs1
-rw-r--r--compiler/rustc_expand/src/mbe/diagnostics.rs10
-rw-r--r--compiler/rustc_expand/src/mbe/quoted.rs18
-rw-r--r--compiler/rustc_expand/src/mbe/transcribe.rs55
-rw-r--r--compiler/rustc_expand/src/proc_macro_server.rs9
-rw-r--r--compiler/rustc_hir/src/intravisit.rs835
-rw-r--r--compiler/rustc_hir_analysis/messages.ftl1
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/errors.rs6
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/generics.rs4
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/lint.rs12
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/mod.rs27
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/check/mod.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/coherence/orphan.rs188
-rw-r--r--compiler/rustc_hir_analysis/src/collect.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/errors.rs1
-rw-r--r--compiler/rustc_hir_analysis/src/lib.rs11
-rw-r--r--compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs28
-rw-r--r--compiler/rustc_hir_typeck/src/_match.rs8
-rw-r--r--compiler/rustc_hir_typeck/src/callee.rs8
-rw-r--r--compiler/rustc_hir_typeck/src/cast.rs8
-rw-r--r--compiler/rustc_hir_typeck/src/coercion.rs10
-rw-r--r--compiler/rustc_hir_typeck/src/demand.rs18
-rw-r--r--compiler/rustc_hir_typeck/src/errors.rs24
-rw-r--r--compiler/rustc_hir_typeck/src/expr.rs20
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs4
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs9
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs74
-rw-r--r--compiler/rustc_hir_typeck/src/method/mod.rs4
-rw-r--r--compiler/rustc_hir_typeck/src/method/suggest.rs43
-rw-r--r--compiler/rustc_hir_typeck/src/op.rs4
-rw-r--r--compiler/rustc_hir_typeck/src/pat.rs12
-rw-r--r--compiler/rustc_infer/src/errors/mod.rs59
-rw-r--r--compiler/rustc_infer/src/errors/note_and_explain.rs11
-rw-r--r--compiler/rustc_infer/src/infer/canonical/query_response.rs9
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/mod.rs32
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs4
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs8
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/note.rs10
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs18
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/suggest.rs16
-rw-r--r--compiler/rustc_infer/src/infer/relate/combine.rs199
-rw-r--r--compiler/rustc_infer/src/infer/relate/equate.rs18
-rw-r--r--compiler/rustc_infer/src/infer/relate/generalize.rs383
-rw-r--r--compiler/rustc_infer/src/infer/relate/glb.rs5
-rw-r--r--compiler/rustc_infer/src/infer/relate/lub.rs5
-rw-r--r--compiler/rustc_infer/src/infer/relate/mod.rs2
-rw-r--r--compiler/rustc_infer/src/infer/relate/nll.rs233
-rw-r--r--compiler/rustc_infer/src/infer/relate/sub.rs13
-rw-r--r--compiler/rustc_lint/src/builtin.rs26
-rw-r--r--compiler/rustc_lint/src/context/diagnostics.rs3
-rw-r--r--compiler/rustc_lint/src/errors.rs10
-rw-r--r--compiler/rustc_lint/src/levels.rs3
-rw-r--r--compiler/rustc_lint/src/lib.rs7
-rw-r--r--compiler/rustc_lint/src/lints.rs66
-rw-r--r--compiler/rustc_lint_defs/src/builtin.rs37
-rw-r--r--compiler/rustc_lint_defs/src/lib.rs30
-rw-r--r--compiler/rustc_macros/src/diagnostics/subdiagnostic.rs10
-rw-r--r--compiler/rustc_metadata/src/errors.rs4
-rw-r--r--compiler/rustc_middle/src/hir/map/mod.rs73
-rw-r--r--compiler/rustc_middle/src/lint.rs8
-rw-r--r--compiler/rustc_middle/src/middle/stability.rs4
-rw-r--r--compiler/rustc_middle/src/traits/mod.rs4
-rw-r--r--compiler/rustc_middle/src/ty/diagnostics.rs8
-rw-r--r--compiler/rustc_mir_build/src/errors.rs14
-rw-r--r--compiler/rustc_mir_transform/src/const_prop.rs161
-rw-r--r--compiler/rustc_mir_transform/src/const_prop_lint.rs132
-rw-r--r--compiler/rustc_mir_transform/src/dataflow_const_prop.rs27
-rw-r--r--compiler/rustc_mir_transform/src/errors.rs3
-rw-r--r--compiler/rustc_mir_transform/src/lib.rs1
-rw-r--r--compiler/rustc_monomorphize/src/errors.rs1
-rw-r--r--compiler/rustc_parse/src/errors.rs8
-rw-r--r--compiler/rustc_parse/src/lexer/diagnostics.rs6
-rw-r--r--compiler/rustc_parse/src/parser/attr.rs4
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs12
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs8
-rw-r--r--compiler/rustc_passes/src/check_const.rs9
-rw-r--r--compiler/rustc_passes/src/errors.rs11
-rw-r--r--compiler/rustc_pattern_analysis/src/errors.rs8
-rw-r--r--compiler/rustc_pattern_analysis/src/usefulness.rs164
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs16
-rw-r--r--compiler/rustc_resolve/src/late/diagnostics.rs143
-rw-r--r--compiler/rustc_session/Cargo.toml2
-rw-r--r--compiler/rustc_session/src/config.rs3
-rw-r--r--compiler/rustc_session/src/filesearch.rs1
-rw-r--r--compiler/rustc_session/src/parse.rs13
-rw-r--r--compiler/rustc_smir/src/rustc_internal/mod.rs10
-rw-r--r--compiler/rustc_span/src/lib.rs73
-rw-r--r--compiler/rustc_target/src/spec/base/apple/mod.rs107
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs9
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs9
-rw-r--r--compiler/rustc_trait_selection/src/errors.rs10
-rw-r--r--compiler/rustc_trait_selection/src/solve/normalize.rs5
-rw-r--r--compiler/rustc_trait_selection/src/traits/coherence.rs4
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs113
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs45
-rw-r--r--compiler/rustc_trait_selection/src/traits/fulfill.rs3
-rw-r--r--compiler/rustc_trait_selection/src/traits/mod.rs56
-rw-r--r--compiler/rustc_trait_selection/src/traits/normalize.rs423
-rw-r--r--compiler/rustc_trait_selection/src/traits/outlives_bounds.rs5
-rw-r--r--compiler/rustc_trait_selection/src/traits/project.rs835
-rw-r--r--compiler/rustc_trait_selection/src/traits/query/normalize.rs5
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/confirmation.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs21
-rw-r--r--compiler/rustc_trait_selection/src/traits/specialize/mod.rs6
-rw-r--r--compiler/rustc_trait_selection/src/traits/util.rs342
-rw-r--r--compiler/rustc_trait_selection/src/traits/wf.rs2
-rw-r--r--compiler/rustc_traits/src/normalize_projection_ty.rs27
-rw-r--r--compiler/stable_mir/src/error.rs12
-rw-r--r--config.example.toml6
-rw-r--r--library/alloc/src/raw_vec.rs4
-rw-r--r--library/core/src/intrinsics.rs1
-rw-r--r--library/core/src/num/f32.rs14
-rw-r--r--library/core/src/num/f64.rs14
-rw-r--r--library/core/src/num/int_macros.rs2
-rw-r--r--library/core/src/num/shells/int_macros.rs2
-rw-r--r--library/core/src/prelude/mod.rs8
-rw-r--r--library/core/src/str/pattern.rs34
-rw-r--r--library/portable-simd/crates/core_simd/src/intrinsics.rs169
-rw-r--r--library/portable-simd/crates/core_simd/src/lib.rs22
-rw-r--r--library/portable-simd/crates/core_simd/src/masks.rs41
-rw-r--r--library/portable-simd/crates/core_simd/src/masks/bitmask.rs9
-rw-r--r--library/portable-simd/crates/core_simd/src/masks/full_masks.rs27
-rw-r--r--library/portable-simd/crates/core_simd/src/mod.rs4
-rw-r--r--library/portable-simd/crates/core_simd/src/ops.rs6
-rw-r--r--library/portable-simd/crates/core_simd/src/ops/unary.rs3
-rw-r--r--library/portable-simd/crates/core_simd/src/select.rs3
-rw-r--r--library/portable-simd/crates/core_simd/src/simd/cmp/eq.rs9
-rw-r--r--library/portable-simd/crates/core_simd/src/simd/cmp/ord.rs25
-rw-r--r--library/portable-simd/crates/core_simd/src/simd/num/float.rs20
-rw-r--r--library/portable-simd/crates/core_simd/src/simd/num/int.rs26
-rw-r--r--library/portable-simd/crates/core_simd/src/simd/num/uint.rs30
-rw-r--r--library/portable-simd/crates/core_simd/src/simd/ptr/const_ptr.rs14
-rw-r--r--library/portable-simd/crates/core_simd/src/simd/ptr/mut_ptr.rs14
-rw-r--r--library/portable-simd/crates/core_simd/src/swizzle.rs5
-rw-r--r--library/portable-simd/crates/core_simd/src/swizzle_dyn.rs44
-rw-r--r--library/portable-simd/crates/core_simd/src/vector.rs15
-rw-r--r--library/portable-simd/crates/core_simd/tests/masks.rs42
-rw-r--r--library/portable-simd/crates/std_float/src/lib.rs38
-rw-r--r--library/portable-simd/crates/test_helpers/src/lib.rs6
-rw-r--r--library/std/src/env.rs3
-rw-r--r--library/std/src/ffi/mod.rs7
-rw-r--r--library/std/src/ffi/os_str.rs43
-rw-r--r--library/std/src/ffi/os_str/tests.rs68
-rw-r--r--library/std/src/fs.rs18
-rw-r--r--library/std/src/io/buffered/bufreader.rs3
-rw-r--r--library/std/src/io/buffered/bufwriter.rs3
-rw-r--r--library/std/src/io/mod.rs58
-rw-r--r--library/std/src/io/tests.rs11
-rw-r--r--library/std/src/os/wasi/fs.rs14
-rw-r--r--library/std/src/prelude/mod.rs6
-rw-r--r--library/std/src/sys/locks/condvar/futex.rs (renamed from library/std/src/sys/pal/unix/locks/futex_condvar.rs)2
-rw-r--r--library/std/src/sys/locks/condvar/itron.rs (renamed from library/std/src/sys/pal/itron/condvar.rs)4
-rw-r--r--library/std/src/sys/locks/condvar/mod.rs36
-rw-r--r--library/std/src/sys/locks/condvar/no_threads.rs (renamed from library/std/src/sys/pal/unsupported/locks/condvar.rs)0
-rw-r--r--library/std/src/sys/locks/condvar/pthread.rs (renamed from library/std/src/sys/pal/unix/locks/pthread_condvar.rs)8
-rw-r--r--library/std/src/sys/locks/condvar/sgx.rs (renamed from library/std/src/sys/pal/sgx/condvar.rs)3
-rw-r--r--library/std/src/sys/locks/condvar/teeos.rs (renamed from library/std/src/sys/pal/teeos/locks/condvar.rs)0
-rw-r--r--library/std/src/sys/locks/condvar/windows.rs (renamed from library/std/src/sys/pal/windows/locks/condvar.rs)2
-rw-r--r--library/std/src/sys/locks/condvar/xous.rs (renamed from library/std/src/sys/pal/xous/locks/condvar.rs)2
-rw-r--r--library/std/src/sys/locks/mod.rs (renamed from library/std/src/sys/pal/unsupported/locks/mod.rs)1
-rw-r--r--library/std/src/sys/locks/mutex/fuchsia.rs (renamed from library/std/src/sys/pal/unix/locks/fuchsia_mutex.rs)0
-rw-r--r--library/std/src/sys/locks/mutex/futex.rs (renamed from library/std/src/sys/pal/unix/locks/futex_mutex.rs)0
-rw-r--r--library/std/src/sys/locks/mutex/itron.rs (renamed from library/std/src/sys/pal/itron/mutex.rs)19
-rw-r--r--library/std/src/sys/locks/mutex/mod.rs38
-rw-r--r--library/std/src/sys/locks/mutex/no_threads.rs (renamed from library/std/src/sys/pal/unsupported/locks/mutex.rs)0
-rw-r--r--library/std/src/sys/locks/mutex/pthread.rs (renamed from library/std/src/sys/pal/unix/locks/pthread_mutex.rs)0
-rw-r--r--library/std/src/sys/locks/mutex/sgx.rs (renamed from library/std/src/sys/pal/sgx/mutex.rs)2
-rw-r--r--library/std/src/sys/locks/mutex/windows.rs (renamed from library/std/src/sys/pal/windows/locks/mutex.rs)0
-rw-r--r--library/std/src/sys/locks/mutex/xous.rs (renamed from library/std/src/sys/pal/xous/locks/mutex.rs)0
-rw-r--r--library/std/src/sys/locks/rwlock/futex.rs (renamed from library/std/src/sys/pal/unix/locks/futex_rwlock.rs)0
-rw-r--r--library/std/src/sys/locks/rwlock/mod.rs36
-rw-r--r--library/std/src/sys/locks/rwlock/no_threads.rs (renamed from library/std/src/sys/pal/unsupported/locks/rwlock.rs)0
-rw-r--r--library/std/src/sys/locks/rwlock/queue.rs (renamed from library/std/src/sys/pal/unix/locks/queue_rwlock.rs)0
-rw-r--r--library/std/src/sys/locks/rwlock/sgx.rs (renamed from library/std/src/sys/pal/sgx/rwlock.rs)7
-rw-r--r--library/std/src/sys/locks/rwlock/solid.rs (renamed from library/std/src/sys/pal/solid/rwlock.rs)2
-rw-r--r--library/std/src/sys/locks/rwlock/teeos.rs (renamed from library/std/src/sys/pal/teeos/locks/rwlock.rs)0
-rw-r--r--library/std/src/sys/locks/rwlock/windows.rs (renamed from library/std/src/sys/pal/windows/locks/rwlock.rs)0
-rw-r--r--library/std/src/sys/locks/rwlock/xous.rs (renamed from library/std/src/sys/pal/xous/locks/rwlock.rs)0
-rw-r--r--library/std/src/sys/mod.rs1
-rw-r--r--library/std/src/sys/os_str/bytes.rs43
-rw-r--r--library/std/src/sys/os_str/wtf8.rs7
-rw-r--r--library/std/src/sys/pal/common/small_c_string.rs29
-rw-r--r--library/std/src/sys/pal/common/tests.rs12
-rw-r--r--library/std/src/sys/pal/hermit/fs.rs4
-rw-r--r--library/std/src/sys/pal/hermit/mod.rs10
-rw-r--r--library/std/src/sys/pal/sgx/mod.rs13
-rw-r--r--library/std/src/sys/pal/solid/abi/fs.rs5
-rw-r--r--library/std/src/sys/pal/solid/abi/sockets.rs2
-rw-r--r--library/std/src/sys/pal/solid/mod.rs24
-rw-r--r--library/std/src/sys/pal/solid/os.rs8
-rw-r--r--library/std/src/sys/pal/teeos/locks/mod.rs8
-rw-r--r--library/std/src/sys/pal/teeos/mod.rs1
-rw-r--r--library/std/src/sys/pal/uefi/mod.rs2
-rw-r--r--library/std/src/sys/pal/unix/fs.rs42
-rw-r--r--library/std/src/sys/pal/unix/locks/mod.rs31
-rw-r--r--library/std/src/sys/pal/unix/mod.rs1
-rw-r--r--library/std/src/sys/pal/unix/os.rs10
-rw-r--r--library/std/src/sys/pal/unsupported/mod.rs1
-rw-r--r--library/std/src/sys/pal/wasi/fs.rs2
-rw-r--r--library/std/src/sys/pal/wasi/mod.rs15
-rw-r--r--library/std/src/sys/pal/wasi/os.rs10
-rw-r--r--library/std/src/sys/pal/wasm/mod.rs12
-rw-r--r--library/std/src/sys/pal/windows/locks/mod.rs6
-rw-r--r--library/std/src/sys/pal/windows/mod.rs1
-rw-r--r--library/std/src/sys/pal/xous/locks/mod.rs7
-rw-r--r--library/std/src/sys/pal/xous/mod.rs1
-rw-r--r--library/std/src/sys/pal/zkvm/mod.rs2
-rw-r--r--library/std/src/sys_common/net.rs2
-rw-r--r--library/std/src/sys_common/wtf8.rs36
-rw-r--r--library/std/src/sys_common/wtf8/tests.rs62
m---------library/stdarch0
-rw-r--r--src/bootstrap/defaults/config.codegen.toml3
-rw-r--r--src/bootstrap/defaults/config.compiler.toml3
-rw-r--r--src/bootstrap/src/core/build_steps/dist.rs3
-rw-r--r--src/bootstrap/src/core/build_steps/install.rs2
-rw-r--r--src/bootstrap/src/core/builder.rs10
-rw-r--r--src/bootstrap/src/core/config/config.rs4
-rw-r--r--src/bootstrap/src/utils/change_tracker.rs5
-rw-r--r--src/doc/unstable-book/src/compiler-flags/sanitizer.md44
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs37
-rw-r--r--src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/functions/result.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/if_let_mutex.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/implicit_hasher.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/manual_clamp.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/matches/significant_drop_in_scrutinee.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs4
-rw-r--r--src/tools/clippy/clippy_utils/src/diagnostics.rs12
-rw-r--r--src/tools/clippy/clippy_utils/src/sugg.rs4
-rw-r--r--src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.rs5
-rw-r--r--src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr33
-rw-r--r--src/tools/clippy/tests/ui/indexing_slicing_index.rs2
-rw-r--r--src/tools/clippy/tests/ui/indexing_slicing_index.stderr47
-rw-r--r--src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs1
-rw-r--r--src/tools/clippy/tests/ui/non_send_fields_in_send_ty.stderr52
-rw-r--r--src/tools/compiletest/Cargo.toml2
-rw-r--r--src/tools/compiletest/src/header.rs92
-rw-r--r--src/tools/miri/tests/fail/shims/fs/isolated_file.stderr5
-rw-r--r--src/tools/opt-dist/Cargo.toml2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs5
-rw-r--r--src/tools/tidy/src/deps.rs1
-rw-r--r--src/tools/tidy/src/issues.txt4387
-rw-r--r--src/tools/tidy/src/main.rs2
-rw-r--r--src/tools/tidy/src/ui_tests.rs84
-rw-r--r--tests/coverage/no_spans.cov-map8
-rw-r--r--tests/coverage/no_spans.coverage2
-rw-r--r--tests/coverage/no_spans_if_not.cov-map12
-rw-r--r--tests/coverage/no_spans_if_not.coverage8
-rw-r--r--tests/debuginfo/mutex.rs2
-rw-r--r--tests/debuginfo/rwlock-read.rs2
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.rs2
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics.rs13
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics.stderr8
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr9
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs4
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr6
-rw-r--r--tests/ui-fulldeps/stable-mir/compilation-result.rs2
-rw-r--r--tests/ui/anon-params/anon-params-edition-hygiene.rs4
-rw-r--r--tests/ui/anon-params/anon-params-edition-hygiene.stderr23
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.rs4
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr16
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr14
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.rs4
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr16
-rw-r--r--tests/ui/async-await/for-await-passthrough.rs2
-rw-r--r--tests/ui/auto-traits/issue-117789.rs2
-rw-r--r--tests/ui/auto-traits/issue-117789.stderr4
-rw-r--r--tests/ui/auto-traits/issue-83857-ub.rs1
-rw-r--r--tests/ui/auto-traits/issue-83857-ub.stderr12
-rw-r--r--tests/ui/auto-traits/suspicious-impls-lint.rs50
-rw-r--r--tests/ui/auto-traits/suspicious-impls-lint.stderr82
-rw-r--r--tests/ui/auto-traits/suspicious-negative-impls-lint.rs21
-rw-r--r--tests/ui/auto-traits/suspicious-negative-impls-lint.stderr52
-rw-r--r--tests/ui/check-static-values-constraints.stderr22
-rw-r--r--tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs2
-rw-r--r--tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr18
-rw-r--r--tests/ui/coherence/coherence-fn-implied-bounds.rs2
-rw-r--r--tests/ui/coherence/coherence-fn-implied-bounds.stderr2
-rw-r--r--tests/ui/coherence/coherence-free-vs-bound-region.rs2
-rw-r--r--tests/ui/coherence/coherence-free-vs-bound-region.stderr2
-rw-r--r--tests/ui/coherence/coherence-orphan.rs12
-rw-r--r--tests/ui/coherence/coherence-orphan.stderr25
-rw-r--r--tests/ui/coherence/coherence-overlap-negative-impls.rs13
-rw-r--r--tests/ui/coherence/coherence-subtyping.rs4
-rw-r--r--tests/ui/coherence/coherence-subtyping.stderr2
-rw-r--r--tests/ui/coherence/coherence-wasm-bindgen.rs2
-rw-r--r--tests/ui/coherence/coherence-wasm-bindgen.stderr2
-rw-r--r--tests/ui/coherence/const-errs-dont-conflict-103369.rs14
-rw-r--r--tests/ui/coherence/const-errs-dont-conflict-103369.stderr39
-rw-r--r--tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr2
-rw-r--r--tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs2
-rw-r--r--tests/ui/coherence/occurs-check/associated-type.next.stderr8
-rw-r--r--tests/ui/coherence/occurs-check/associated-type.old.stderr8
-rw-r--r--tests/ui/const-generics/invariant.rs10
-rw-r--r--tests/ui/const-generics/invariant.stderr4
-rw-r--r--tests/ui/const-generics/issues/issue-100313.rs1
-rw-r--r--tests/ui/const-generics/issues/issue-100313.stderr13
-rw-r--r--tests/ui/consts/const-array-oob.rs3
-rw-r--r--tests/ui/consts/const-array-oob.stderr10
-rw-r--r--tests/ui/consts/const-eval/const-eval-query-stack.stderr3
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr.stderr10
-rw-r--r--tests/ui/consts/const-eval/generic-slice.stderr28
-rw-r--r--tests/ui/consts/const-eval/validate_uninhabited_zsts.rs2
-rw-r--r--tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr32
-rw-r--r--tests/ui/consts/const-mut-refs/issue-76510.rs1
-rw-r--r--tests/ui/consts/const-mut-refs/issue-76510.stderr12
-rw-r--r--tests/ui/consts/const_cmp_type_id.stderr12
-rw-r--r--tests/ui/consts/const_let_assign3.stderr16
-rw-r--r--tests/ui/consts/const_refs_to_static_fail_invalid.stderr24
-rw-r--r--tests/ui/consts/fn_trait_refs.stderr36
-rw-r--r--tests/ui/consts/issue-16538.stderr18
-rw-r--r--tests/ui/consts/issue-66693.rs4
-rw-r--r--tests/ui/consts/issue-66693.stderr19
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr36
-rw-r--r--tests/ui/consts/miri_unleashed/mutable_references.rs15
-rw-r--r--tests/ui/consts/miri_unleashed/mutable_references.stderr48
-rw-r--r--tests/ui/consts/promote-not.stderr40
-rw-r--r--tests/ui/consts/promoted_const_call2.stderr12
-rw-r--r--tests/ui/consts/qualif-indirect-mutation-fail.stderr51
-rw-r--r--tests/ui/consts/recursive-zst-static.default.stderr12
-rw-r--r--tests/ui/consts/recursive-zst-static.unleash.stderr12
-rw-r--r--tests/ui/coroutine/async_gen_fn_iter.rs1
-rw-r--r--tests/ui/drop/repeat-drop-2.stderr18
-rw-r--r--tests/ui/editions/edition-keywords-2018-2018-parsing.rs4
-rw-r--r--tests/ui/editions/edition-keywords-2018-2018-parsing.stderr6
-rw-r--r--tests/ui/error-codes/E0017.rs4
-rw-r--r--tests/ui/error-codes/E0017.stderr33
-rw-r--r--tests/ui/error-codes/E0093.stderr2
-rw-r--r--tests/ui/error-codes/E0388.rs6
-rw-r--r--tests/ui/error-codes/E0388.stderr6
-rw-r--r--tests/ui/error-codes/E0396.stderr32
-rw-r--r--tests/ui/extern/issue-28324.rs1
-rw-r--r--tests/ui/extern/issue-28324.stderr11
-rw-r--r--tests/ui/feature-gates/feature-gate-abi.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-intrinsics.stderr4
-rw-r--r--tests/ui/fmt/format-args-capture-first-literal-is-macro.rs2
-rw-r--r--tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr8
-rw-r--r--tests/ui/generic-associated-types/issue-79636-1.rs1
-rw-r--r--tests/ui/generic-associated-types/issue-79636-1.stderr17
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs2
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr13
-rw-r--r--tests/ui/impl-trait/rpit/early_bound.rs1
-rw-r--r--tests/ui/impl-trait/rpit/early_bound.stderr14
-rw-r--r--tests/ui/impl-trait/where-allowed.rs1
-rw-r--r--tests/ui/impl-trait/where-allowed.stderr86
-rw-r--r--tests/ui/inference/issue-80409.no-compat.stderr12
-rw-r--r--tests/ui/inference/issue-80409.rs1
-rw-r--r--tests/ui/intrinsics-always-extern.stderr2
-rw-r--r--tests/ui/issues/issue-106755.rs2
-rw-r--r--tests/ui/issues/issue-106755.stderr18
-rw-r--r--tests/ui/issues/issue-17252.rs1
-rw-r--r--tests/ui/issues/issue-17252.stderr21
-rw-r--r--tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-3.stderr10
-rw-r--r--tests/ui/issues/issue-76191.rs1
-rw-r--r--tests/ui/issues/issue-76191.stderr17
-rw-r--r--tests/ui/lint/wide_pointer_comparisons.rs4
-rw-r--r--tests/ui/lint/wide_pointer_comparisons.stderr14
-rw-r--r--tests/ui/liveness/liveness-consts.stderr12
-rw-r--r--tests/ui/macros/invalid-fragment-specifier.rs10
-rw-r--r--tests/ui/macros/invalid-fragment-specifier.stderr18
-rw-r--r--tests/ui/macros/issue-118786.rs4
-rw-r--r--tests/ui/macros/issue-118786.stderr10
-rw-r--r--tests/ui/macros/macro-invalid-fragment-spec.rs8
-rw-r--r--tests/ui/macros/macro-invalid-fragment-spec.stderr10
-rw-r--r--tests/ui/methods/method-on-ambiguous-numeric-type.stderr4
-rw-r--r--tests/ui/parser/issues/issue-44406.stderr2
-rw-r--r--tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr5
-rw-r--r--tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs4
-rw-r--r--tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr6
-rw-r--r--tests/ui/proc-macro/capture-macro-rules-invoke.stdout2
-rw-r--r--tests/ui/proc-macro/custom-attr-panic.rs8
-rw-r--r--tests/ui/proc-macro/custom-attr-panic.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr22
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr55
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr89
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr16
-rw-r--r--tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed16
-rw-r--r--tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs12
-rw-r--r--tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr33
-rw-r--r--tests/ui/rust-2024/prelude2024.rs9
-rw-r--r--tests/ui/span/macro-span-replacement.rs4
-rw-r--r--tests/ui/span/macro-span-replacement.stderr7
-rw-r--r--tests/ui/static/static-drop-scope.stderr32
-rw-r--r--tests/ui/statics/issue-14227.rs1
-rw-r--r--tests/ui/statics/issue-14227.stderr11
-rw-r--r--tests/ui/statics/uninhabited-static.rs2
-rw-r--r--tests/ui/statics/uninhabited-static.stderr31
-rw-r--r--tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.next.stderr4
-rw-r--r--tests/ui/treat-err-as-bug/err.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr10
-rw-r--r--tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr4
-rw-r--r--tests/ui/typeck/cyclic_type_ice.rs7
-rw-r--r--tests/ui/typeck/cyclic_type_ice.stderr31
-rw-r--r--tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs4
-rw-r--r--tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr26
-rw-r--r--tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs13
-rw-r--r--tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr16
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_item.stderr12
-rw-r--r--tests/ui/wf/issue-110157.rs3
-rw-r--r--tests/ui/wf/issue-110157.stderr25
449 files changed, 10154 insertions, 5594 deletions
diff --git a/.reuse/dep5 b/.reuse/dep5
index 2c3adf1bfa1..6c39025b5de 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -52,7 +52,7 @@ Copyright: 2019 The Crossbeam Project Developers
            The Rust Project Developers (see https://thanks.rust-lang.org)
 License: MIT OR Apache-2.0
 
-Files: library/std/src/sys/pal/unix/locks/fuchsia_mutex.rs
+Files: library/std/src/sys/locks/mutex/fuchsia.rs
 Copyright: 2016 The Fuchsia Authors
            The Rust Project Developers (see https://thanks.rust-lang.org)
 License: BSD-2-Clause AND (MIT OR Apache-2.0)
diff --git a/Cargo.lock b/Cargo.lock
index 7c6c10cdbd7..61f9c130e38 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -931,43 +931,19 @@ dependencies = [
 
 [[package]]
 name = "darling"
-version = "0.14.4"
+version = "0.20.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
+checksum = "c376d08ea6aa96aafe61237c7200d1241cb177b7d3a542d791f2d118e9cbb955"
 dependencies = [
- "darling_core 0.14.4",
- "darling_macro 0.14.4",
-]
-
-[[package]]
-name = "darling"
-version = "0.20.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8"
-dependencies = [
- "darling_core 0.20.5",
- "darling_macro 0.20.5",
+ "darling_core",
+ "darling_macro",
 ]
 
 [[package]]
 name = "darling_core"
-version = "0.14.4"
+version = "0.20.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
-dependencies = [
- "fnv",
- "ident_case",
- "proc-macro2",
- "quote",
- "strsim 0.10.0",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "darling_core"
-version = "0.20.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3"
+checksum = "33043dcd19068b8192064c704b3f83eb464f91f1ff527b44a4e2b08d9cdb8855"
 dependencies = [
  "fnv",
  "ident_case",
@@ -979,22 +955,11 @@ dependencies = [
 
 [[package]]
 name = "darling_macro"
-version = "0.14.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
-dependencies = [
- "darling_core 0.14.4",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "darling_macro"
-version = "0.20.5"
+version = "0.20.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77"
+checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be"
 dependencies = [
- "darling_core 0.20.5",
+ "darling_core",
  "quote",
  "syn 2.0.48",
 ]
@@ -1036,33 +1001,33 @@ dependencies = [
 
 [[package]]
 name = "derive_builder"
-version = "0.12.0"
+version = "0.20.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8"
+checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7"
 dependencies = [
  "derive_builder_macro",
 ]
 
 [[package]]
 name = "derive_builder_core"
-version = "0.12.0"
+version = "0.20.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f"
+checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d"
 dependencies = [
- "darling 0.14.4",
+ "darling",
  "proc-macro2",
  "quote",
- "syn 1.0.109",
+ "syn 2.0.48",
 ]
 
 [[package]]
 name = "derive_builder_macro"
-version = "0.12.0"
+version = "0.20.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
+checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b"
 dependencies = [
  "derive_builder_core",
- "syn 1.0.109",
+ "syn 2.0.48",
 ]
 
 [[package]]
@@ -1084,7 +1049,7 @@ version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4e8ef033054e131169b8f0f9a7af8f5533a9436fadf3c500ed547f730f07090d"
 dependencies = [
- "darling 0.20.5",
+ "darling",
  "proc-macro2",
  "quote",
  "syn 2.0.48",
@@ -6206,11 +6171,12 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 
 [[package]]
 name = "windows"
-version = "0.48.0"
+version = "0.52.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
+checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
 dependencies = [
- "windows-targets 0.48.5",
+ "windows-core",
+ "windows-targets 0.52.0",
 ]
 
 [[package]]
diff --git a/compiler/rustc_ast/src/lib.rs b/compiler/rustc_ast/src/lib.rs
index 6414c8e9041..6e42cf37b86 100644
--- a/compiler/rustc_ast/src/lib.rs
+++ b/compiler/rustc_ast/src/lib.rs
@@ -12,10 +12,12 @@
 #![allow(internal_features)]
 #![feature(rustdoc_internals)]
 #![feature(associated_type_bounds)]
+#![feature(associated_type_defaults)]
 #![feature(box_patterns)]
 #![feature(if_let_guard)]
 #![feature(let_chains)]
 #![cfg_attr(bootstrap, feature(min_specialization))]
+#![feature(never_type)]
 #![feature(negative_impls)]
 #![feature(stmt_expr_attributes)]
 
diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs
index 83f6746bdeb..ecf379cc240 100644
--- a/compiler/rustc_ast/src/visit.rs
+++ b/compiler/rustc_ast/src/visit.rs
@@ -15,6 +15,8 @@
 
 use crate::ast::*;
 
+use core::ops::ControlFlow;
+
 use rustc_span::symbol::Ident;
 use rustc_span::Span;
 
@@ -99,6 +101,51 @@ pub enum LifetimeCtxt {
     GenericArg,
 }
 
+/// Similar to the `Try` trait, but also implemented for `()`.
+pub trait VisitorResult {
+    type Residual;
+    fn output() -> Self;
+    fn from_residual(residual: Self::Residual) -> Self;
+    fn branch(self) -> ControlFlow<Self::Residual>;
+}
+
+impl VisitorResult for () {
+    type Residual = !;
+
+    fn output() -> Self {}
+    fn from_residual(_: !) -> Self {}
+    fn branch(self) -> ControlFlow<!> {
+        ControlFlow::Continue(())
+    }
+}
+
+impl<T> VisitorResult for ControlFlow<T> {
+    type Residual = T;
+
+    fn output() -> Self {
+        ControlFlow::Continue(())
+    }
+    fn from_residual(residual: Self::Residual) -> Self {
+        ControlFlow::Break(residual)
+    }
+    fn branch(self) -> ControlFlow<T> {
+        self
+    }
+}
+
+#[macro_export]
+macro_rules! try_visit {
+    ($e:expr) => {
+        match $crate::visit::VisitorResult::branch($e) {
+            core::ops::ControlFlow::Continue(()) => (),
+            #[allow(unreachable_code)]
+            core::ops::ControlFlow::Break(r) => {
+                return $crate::visit::VisitorResult::from_residual(r);
+            }
+        }
+    };
+}
+
 /// Each method of the `Visitor` trait is a hook to be potentially
 /// overridden. Each method's default implementation recursively visits
 /// the substructure of the input via the corresponding `walk` method;
@@ -109,240 +156,259 @@ pub enum LifetimeCtxt {
 /// to monitor future changes to `Visitor` in case a new method with a
 /// new default implementation gets introduced.)
 pub trait Visitor<'ast>: Sized {
-    fn visit_ident(&mut self, _ident: Ident) {}
-    fn visit_foreign_item(&mut self, i: &'ast ForeignItem) {
+    /// The result type of the `visit_*` methods. Can be either `()`,
+    /// or `ControlFlow<T>`.
+    type Result: VisitorResult = ();
+
+    fn visit_ident(&mut self, _ident: Ident) -> Self::Result {
+        Self::Result::output()
+    }
+    fn visit_foreign_item(&mut self, i: &'ast ForeignItem) -> Self::Result {
         walk_foreign_item(self, i)
     }
-    fn visit_item(&mut self, i: &'ast Item) {
+    fn visit_item(&mut self, i: &'ast Item) -> Self::Result {
         walk_item(self, i)
     }
-    fn visit_local(&mut self, l: &'ast Local) {
+    fn visit_local(&mut self, l: &'ast Local) -> Self::Result {
         walk_local(self, l)
     }
-    fn visit_block(&mut self, b: &'ast Block) {
+    fn visit_block(&mut self, b: &'ast Block) -> Self::Result {
         walk_block(self, b)
     }
-    fn visit_stmt(&mut self, s: &'ast Stmt) {
+    fn visit_stmt(&mut self, s: &'ast Stmt) -> Self::Result {
         walk_stmt(self, s)
     }
-    fn visit_param(&mut self, param: &'ast Param) {
+    fn visit_param(&mut self, param: &'ast Param) -> Self::Result {
         walk_param(self, param)
     }
-    fn visit_arm(&mut self, a: &'ast Arm) {
+    fn visit_arm(&mut self, a: &'ast Arm) -> Self::Result {
         walk_arm(self, a)
     }
-    fn visit_pat(&mut self, p: &'ast Pat) {
+    fn visit_pat(&mut self, p: &'ast Pat) -> Self::Result {
         walk_pat(self, p)
     }
-    fn visit_anon_const(&mut self, c: &'ast AnonConst) {
+    fn visit_anon_const(&mut self, c: &'ast AnonConst) -> Self::Result {
         walk_anon_const(self, c)
     }
-    fn visit_expr(&mut self, ex: &'ast Expr) {
+    fn visit_expr(&mut self, ex: &'ast Expr) -> Self::Result {
         walk_expr(self, ex)
     }
     /// This method is a hack to workaround unstable of `stmt_expr_attributes`.
     /// It can be removed once that feature is stabilized.
-    fn visit_method_receiver_expr(&mut self, ex: &'ast Expr) {
+    fn visit_method_receiver_expr(&mut self, ex: &'ast Expr) -> Self::Result {
         self.visit_expr(ex)
     }
-    fn visit_expr_post(&mut self, _ex: &'ast Expr) {}
-    fn visit_ty(&mut self, t: &'ast Ty) {
+    fn visit_expr_post(&mut self, _ex: &'ast Expr) -> Self::Result {
+        Self::Result::output()
+    }
+    fn visit_ty(&mut self, t: &'ast Ty) -> Self::Result {
         walk_ty(self, t)
     }
-    fn visit_generic_param(&mut self, param: &'ast GenericParam) {
+    fn visit_generic_param(&mut self, param: &'ast GenericParam) -> Self::Result {
         walk_generic_param(self, param)
     }
-    fn visit_generics(&mut self, g: &'ast Generics) {
+    fn visit_generics(&mut self, g: &'ast Generics) -> Self::Result {
         walk_generics(self, g)
     }
-    fn visit_closure_binder(&mut self, b: &'ast ClosureBinder) {
+    fn visit_closure_binder(&mut self, b: &'ast ClosureBinder) -> Self::Result {
         walk_closure_binder(self, b)
     }
-    fn visit_where_predicate(&mut self, p: &'ast WherePredicate) {
+    fn visit_where_predicate(&mut self, p: &'ast WherePredicate) -> Self::Result {
         walk_where_predicate(self, p)
     }
-    fn visit_fn(&mut self, fk: FnKind<'ast>, _: Span, _: NodeId) {
+    fn visit_fn(&mut self, fk: FnKind<'ast>, _: Span, _: NodeId) -> Self::Result {
         walk_fn(self, fk)
     }
-    fn visit_assoc_item(&mut self, i: &'ast AssocItem, ctxt: AssocCtxt) {
+    fn visit_assoc_item(&mut self, i: &'ast AssocItem, ctxt: AssocCtxt) -> Self::Result {
         walk_assoc_item(self, i, ctxt)
     }
-    fn visit_trait_ref(&mut self, t: &'ast TraitRef) {
+    fn visit_trait_ref(&mut self, t: &'ast TraitRef) -> Self::Result {
         walk_trait_ref(self, t)
     }
-    fn visit_param_bound(&mut self, bounds: &'ast GenericBound, _ctxt: BoundKind) {
+    fn visit_param_bound(&mut self, bounds: &'ast GenericBound, _ctxt: BoundKind) -> Self::Result {
         walk_param_bound(self, bounds)
     }
-    fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef) {
+    fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef) -> Self::Result {
         walk_poly_trait_ref(self, t)
     }
-    fn visit_variant_data(&mut self, s: &'ast VariantData) {
+    fn visit_variant_data(&mut self, s: &'ast VariantData) -> Self::Result {
         walk_struct_def(self, s)
     }
-    fn visit_field_def(&mut self, s: &'ast FieldDef) {
+    fn visit_field_def(&mut self, s: &'ast FieldDef) -> Self::Result {
         walk_field_def(self, s)
     }
-    fn visit_enum_def(&mut self, enum_definition: &'ast EnumDef) {
+    fn visit_enum_def(&mut self, enum_definition: &'ast EnumDef) -> Self::Result {
         walk_enum_def(self, enum_definition)
     }
-    fn visit_variant(&mut self, v: &'ast Variant) {
+    fn visit_variant(&mut self, v: &'ast Variant) -> Self::Result {
         walk_variant(self, v)
     }
-    fn visit_variant_discr(&mut self, discr: &'ast AnonConst) {
-        self.visit_anon_const(discr);
+    fn visit_variant_discr(&mut self, discr: &'ast AnonConst) -> Self::Result {
+        self.visit_anon_const(discr)
     }
-    fn visit_label(&mut self, label: &'ast Label) {
+    fn visit_label(&mut self, label: &'ast Label) -> Self::Result {
         walk_label(self, label)
     }
-    fn visit_lifetime(&mut self, lifetime: &'ast Lifetime, _: LifetimeCtxt) {
+    fn visit_lifetime(&mut self, lifetime: &'ast Lifetime, _: LifetimeCtxt) -> Self::Result {
         walk_lifetime(self, lifetime)
     }
-    fn visit_mac_call(&mut self, mac: &'ast MacCall) {
+    fn visit_mac_call(&mut self, mac: &'ast MacCall) -> Self::Result {
         walk_mac(self, mac)
     }
-    fn visit_mac_def(&mut self, _mac: &'ast MacroDef, _id: NodeId) {
-        // Nothing to do
+    fn visit_mac_def(&mut self, _mac: &'ast MacroDef, _id: NodeId) -> Self::Result {
+        Self::Result::output()
     }
-    fn visit_path(&mut self, path: &'ast Path, _id: NodeId) {
+    fn visit_path(&mut self, path: &'ast Path, _id: NodeId) -> Self::Result {
         walk_path(self, path)
     }
-    fn visit_use_tree(&mut self, use_tree: &'ast UseTree, id: NodeId, _nested: bool) {
+    fn visit_use_tree(
+        &mut self,
+        use_tree: &'ast UseTree,
+        id: NodeId,
+        _nested: bool,
+    ) -> Self::Result {
         walk_use_tree(self, use_tree, id)
     }
-    fn visit_path_segment(&mut self, path_segment: &'ast PathSegment) {
+    fn visit_path_segment(&mut self, path_segment: &'ast PathSegment) -> Self::Result {
         walk_path_segment(self, path_segment)
     }
-    fn visit_generic_args(&mut self, generic_args: &'ast GenericArgs) {
+    fn visit_generic_args(&mut self, generic_args: &'ast GenericArgs) -> Self::Result {
         walk_generic_args(self, generic_args)
     }
-    fn visit_generic_arg(&mut self, generic_arg: &'ast GenericArg) {
+    fn visit_generic_arg(&mut self, generic_arg: &'ast GenericArg) -> Self::Result {
         walk_generic_arg(self, generic_arg)
     }
-    fn visit_assoc_constraint(&mut self, constraint: &'ast AssocConstraint) {
+    fn visit_assoc_constraint(&mut self, constraint: &'ast AssocConstraint) -> Self::Result {
         walk_assoc_constraint(self, constraint)
     }
-    fn visit_attribute(&mut self, attr: &'ast Attribute) {
+    fn visit_attribute(&mut self, attr: &'ast Attribute) -> Self::Result {
         walk_attribute(self, attr)
     }
-    fn visit_vis(&mut self, vis: &'ast Visibility) {
+    fn visit_vis(&mut self, vis: &'ast Visibility) -> Self::Result {
         walk_vis(self, vis)
     }
-    fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FnRetTy) {
+    fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FnRetTy) -> Self::Result {
         walk_fn_ret_ty(self, ret_ty)
     }
-    fn visit_fn_header(&mut self, _header: &'ast FnHeader) {
-        // Nothing to do
+    fn visit_fn_header(&mut self, _header: &'ast FnHeader) -> Self::Result {
+        Self::Result::output()
     }
-    fn visit_expr_field(&mut self, f: &'ast ExprField) {
+    fn visit_expr_field(&mut self, f: &'ast ExprField) -> Self::Result {
         walk_expr_field(self, f)
     }
-    fn visit_pat_field(&mut self, fp: &'ast PatField) {
+    fn visit_pat_field(&mut self, fp: &'ast PatField) -> Self::Result {
         walk_pat_field(self, fp)
     }
-    fn visit_crate(&mut self, krate: &'ast Crate) {
+    fn visit_crate(&mut self, krate: &'ast Crate) -> Self::Result {
         walk_crate(self, krate)
     }
-    fn visit_inline_asm(&mut self, asm: &'ast InlineAsm) {
+    fn visit_inline_asm(&mut self, asm: &'ast InlineAsm) -> Self::Result {
         walk_inline_asm(self, asm)
     }
-    fn visit_format_args(&mut self, fmt: &'ast FormatArgs) {
+    fn visit_format_args(&mut self, fmt: &'ast FormatArgs) -> Self::Result {
         walk_format_args(self, fmt)
     }
-    fn visit_inline_asm_sym(&mut self, sym: &'ast InlineAsmSym) {
+    fn visit_inline_asm_sym(&mut self, sym: &'ast InlineAsmSym) -> Self::Result {
         walk_inline_asm_sym(self, sym)
     }
-    fn visit_capture_by(&mut self, _capture_by: &'ast CaptureBy) {
-        // Nothing to do
+    fn visit_capture_by(&mut self, _capture_by: &'ast CaptureBy) -> Self::Result {
+        Self::Result::output()
     }
 }
 
 #[macro_export]
 macro_rules! walk_list {
     ($visitor: expr, $method: ident, $list: expr $(, $($extra_args: expr),* )?) => {
-        {
-            #[allow(for_loops_over_fallibles)]
-            for elem in $list {
-                $visitor.$method(elem $(, $($extra_args,)* )?)
-            }
+        for elem in $list {
+            $crate::try_visit!($visitor.$method(elem $(, $($extra_args,)* )?));
         }
     }
 }
 
-pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) {
+#[macro_export]
+macro_rules! visit_opt {
+    ($visitor: expr, $method: ident, $opt: expr $(, $($extra_args: expr),* )?) => {
+        if let Some(x) = $opt {
+            $crate::try_visit!($visitor.$method(x $(, $($extra_args,)* )?));
+        }
+    }
+}
+
+pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) -> V::Result {
     walk_list!(visitor, visit_item, &krate.items);
     walk_list!(visitor, visit_attribute, &krate.attrs);
+    V::Result::output()
 }
 
-pub fn walk_local<'a, V: Visitor<'a>>(visitor: &mut V, local: &'a Local) {
-    for attr in local.attrs.iter() {
-        visitor.visit_attribute(attr);
-    }
-    visitor.visit_pat(&local.pat);
-    walk_list!(visitor, visit_ty, &local.ty);
+pub fn walk_local<'a, V: Visitor<'a>>(visitor: &mut V, local: &'a Local) -> V::Result {
+    walk_list!(visitor, visit_attribute, &local.attrs);
+    try_visit!(visitor.visit_pat(&local.pat));
+    visit_opt!(visitor, visit_ty, &local.ty);
     if let Some((init, els)) = local.kind.init_else_opt() {
-        visitor.visit_expr(init);
-        walk_list!(visitor, visit_block, els);
+        try_visit!(visitor.visit_expr(init));
+        visit_opt!(visitor, visit_block, els);
     }
+    V::Result::output()
 }
 
-pub fn walk_label<'a, V: Visitor<'a>>(visitor: &mut V, label: &'a Label) {
-    visitor.visit_ident(label.ident);
+pub fn walk_label<'a, V: Visitor<'a>>(visitor: &mut V, label: &'a Label) -> V::Result {
+    visitor.visit_ident(label.ident)
 }
 
-pub fn walk_lifetime<'a, V: Visitor<'a>>(visitor: &mut V, lifetime: &'a Lifetime) {
-    visitor.visit_ident(lifetime.ident);
+pub fn walk_lifetime<'a, V: Visitor<'a>>(visitor: &mut V, lifetime: &'a Lifetime) -> V::Result {
+    visitor.visit_ident(lifetime.ident)
 }
 
-pub fn walk_poly_trait_ref<'a, V>(visitor: &mut V, trait_ref: &'a PolyTraitRef)
+pub fn walk_poly_trait_ref<'a, V>(visitor: &mut V, trait_ref: &'a PolyTraitRef) -> V::Result
 where
     V: Visitor<'a>,
 {
     walk_list!(visitor, visit_generic_param, &trait_ref.bound_generic_params);
-    visitor.visit_trait_ref(&trait_ref.trait_ref);
+    visitor.visit_trait_ref(&trait_ref.trait_ref)
 }
 
-pub fn walk_trait_ref<'a, V: Visitor<'a>>(visitor: &mut V, trait_ref: &'a TraitRef) {
+pub fn walk_trait_ref<'a, V: Visitor<'a>>(visitor: &mut V, trait_ref: &'a TraitRef) -> V::Result {
     visitor.visit_path(&trait_ref.path, trait_ref.ref_id)
 }
 
-pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
-    visitor.visit_vis(&item.vis);
-    visitor.visit_ident(item.ident);
+pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) -> V::Result {
+    try_visit!(visitor.visit_vis(&item.vis));
+    try_visit!(visitor.visit_ident(item.ident));
     match &item.kind {
         ItemKind::ExternCrate(_) => {}
-        ItemKind::Use(use_tree) => visitor.visit_use_tree(use_tree, item.id, false),
+        ItemKind::Use(use_tree) => try_visit!(visitor.visit_use_tree(use_tree, item.id, false)),
         ItemKind::Static(box StaticItem { ty, mutability: _, expr }) => {
-            visitor.visit_ty(ty);
-            walk_list!(visitor, visit_expr, expr);
+            try_visit!(visitor.visit_ty(ty));
+            visit_opt!(visitor, visit_expr, expr);
         }
         ItemKind::Const(box ConstItem { defaultness: _, generics, ty, expr }) => {
-            visitor.visit_generics(generics);
-            visitor.visit_ty(ty);
-            walk_list!(visitor, visit_expr, expr);
+            try_visit!(visitor.visit_generics(generics));
+            try_visit!(visitor.visit_ty(ty));
+            visit_opt!(visitor, visit_expr, expr);
         }
         ItemKind::Fn(box Fn { defaultness: _, generics, sig, body }) => {
             let kind =
                 FnKind::Fn(FnCtxt::Free, item.ident, sig, &item.vis, generics, body.as_deref());
-            visitor.visit_fn(kind, item.span, item.id)
+            try_visit!(visitor.visit_fn(kind, item.span, item.id));
         }
         ItemKind::Mod(_unsafety, mod_kind) => match mod_kind {
             ModKind::Loaded(items, _inline, _inner_span) => {
-                walk_list!(visitor, visit_item, items)
+                walk_list!(visitor, visit_item, items);
             }
             ModKind::Unloaded => {}
         },
         ItemKind::ForeignMod(foreign_module) => {
             walk_list!(visitor, visit_foreign_item, &foreign_module.items);
         }
-        ItemKind::GlobalAsm(asm) => visitor.visit_inline_asm(asm),
+        ItemKind::GlobalAsm(asm) => try_visit!(visitor.visit_inline_asm(asm)),
         ItemKind::TyAlias(box TyAlias { generics, bounds, ty, .. }) => {
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_generics(generics));
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
-            walk_list!(visitor, visit_ty, ty);
+            visit_opt!(visitor, visit_ty, ty);
         }
         ItemKind::Enum(enum_definition, generics) => {
-            visitor.visit_generics(generics);
-            visitor.visit_enum_def(enum_definition)
+            try_visit!(visitor.visit_generics(generics));
+            try_visit!(visitor.visit_enum_def(enum_definition));
         }
         ItemKind::Impl(box Impl {
             defaultness: _,
@@ -354,91 +420,97 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
             self_ty,
             items,
         }) => {
-            visitor.visit_generics(generics);
-            walk_list!(visitor, visit_trait_ref, of_trait);
-            visitor.visit_ty(self_ty);
+            try_visit!(visitor.visit_generics(generics));
+            visit_opt!(visitor, visit_trait_ref, of_trait);
+            try_visit!(visitor.visit_ty(self_ty));
             walk_list!(visitor, visit_assoc_item, items, AssocCtxt::Impl);
         }
         ItemKind::Struct(struct_definition, generics)
         | ItemKind::Union(struct_definition, generics) => {
-            visitor.visit_generics(generics);
-            visitor.visit_variant_data(struct_definition);
+            try_visit!(visitor.visit_generics(generics));
+            try_visit!(visitor.visit_variant_data(struct_definition));
         }
         ItemKind::Trait(box Trait { unsafety: _, is_auto: _, generics, bounds, items }) => {
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_generics(generics));
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::SuperTraits);
             walk_list!(visitor, visit_assoc_item, items, AssocCtxt::Trait);
         }
         ItemKind::TraitAlias(generics, bounds) => {
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_generics(generics));
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
         }
-        ItemKind::MacCall(mac) => visitor.visit_mac_call(mac),
-        ItemKind::MacroDef(ts) => visitor.visit_mac_def(ts, item.id),
+        ItemKind::MacCall(mac) => try_visit!(visitor.visit_mac_call(mac)),
+        ItemKind::MacroDef(ts) => try_visit!(visitor.visit_mac_def(ts, item.id)),
         ItemKind::Delegation(box Delegation { id, qself, path, body }) => {
             if let Some(qself) = qself {
-                visitor.visit_ty(&qself.ty);
-            }
-            visitor.visit_path(path, *id);
-            if let Some(body) = body {
-                visitor.visit_block(body);
+                try_visit!(visitor.visit_ty(&qself.ty));
             }
+            try_visit!(visitor.visit_path(path, *id));
+            visit_opt!(visitor, visit_block, body);
         }
     }
     walk_list!(visitor, visit_attribute, &item.attrs);
+    V::Result::output()
 }
 
-pub fn walk_enum_def<'a, V: Visitor<'a>>(visitor: &mut V, enum_definition: &'a EnumDef) {
+pub fn walk_enum_def<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    enum_definition: &'a EnumDef,
+) -> V::Result {
     walk_list!(visitor, visit_variant, &enum_definition.variants);
+    V::Result::output()
 }
 
-pub fn walk_variant<'a, V: Visitor<'a>>(visitor: &mut V, variant: &'a Variant)
+pub fn walk_variant<'a, V: Visitor<'a>>(visitor: &mut V, variant: &'a Variant) -> V::Result
 where
     V: Visitor<'a>,
 {
-    visitor.visit_ident(variant.ident);
-    visitor.visit_vis(&variant.vis);
-    visitor.visit_variant_data(&variant.data);
-    walk_list!(visitor, visit_variant_discr, &variant.disr_expr);
+    try_visit!(visitor.visit_ident(variant.ident));
+    try_visit!(visitor.visit_vis(&variant.vis));
+    try_visit!(visitor.visit_variant_data(&variant.data));
+    visit_opt!(visitor, visit_variant_discr, &variant.disr_expr);
     walk_list!(visitor, visit_attribute, &variant.attrs);
+    V::Result::output()
 }
 
-pub fn walk_expr_field<'a, V: Visitor<'a>>(visitor: &mut V, f: &'a ExprField) {
-    visitor.visit_expr(&f.expr);
-    visitor.visit_ident(f.ident);
-    walk_list!(visitor, visit_attribute, f.attrs.iter());
+pub fn walk_expr_field<'a, V: Visitor<'a>>(visitor: &mut V, f: &'a ExprField) -> V::Result {
+    try_visit!(visitor.visit_expr(&f.expr));
+    try_visit!(visitor.visit_ident(f.ident));
+    walk_list!(visitor, visit_attribute, &f.attrs);
+    V::Result::output()
 }
 
-pub fn walk_pat_field<'a, V: Visitor<'a>>(visitor: &mut V, fp: &'a PatField) {
-    visitor.visit_ident(fp.ident);
-    visitor.visit_pat(&fp.pat);
-    walk_list!(visitor, visit_attribute, fp.attrs.iter());
+pub fn walk_pat_field<'a, V: Visitor<'a>>(visitor: &mut V, fp: &'a PatField) -> V::Result {
+    try_visit!(visitor.visit_ident(fp.ident));
+    try_visit!(visitor.visit_pat(&fp.pat));
+    walk_list!(visitor, visit_attribute, &fp.attrs);
+    V::Result::output()
 }
 
-pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
+pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) -> V::Result {
     match &typ.kind {
-        TyKind::Slice(ty) | TyKind::Paren(ty) => visitor.visit_ty(ty),
-        TyKind::Ptr(mutable_type) => visitor.visit_ty(&mutable_type.ty),
+        TyKind::Slice(ty) | TyKind::Paren(ty) => try_visit!(visitor.visit_ty(ty)),
+        TyKind::Ptr(mutable_type) => try_visit!(visitor.visit_ty(&mutable_type.ty)),
         TyKind::Ref(opt_lifetime, mutable_type) => {
-            walk_list!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Ref);
-            visitor.visit_ty(&mutable_type.ty)
+            visit_opt!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Ref);
+            try_visit!(visitor.visit_ty(&mutable_type.ty));
         }
         TyKind::Tup(tuple_element_types) => {
             walk_list!(visitor, visit_ty, tuple_element_types);
         }
         TyKind::BareFn(function_declaration) => {
             walk_list!(visitor, visit_generic_param, &function_declaration.generic_params);
-            walk_fn_decl(visitor, &function_declaration.decl);
+            try_visit!(walk_fn_decl(visitor, &function_declaration.decl));
         }
         TyKind::Path(maybe_qself, path) => {
             if let Some(qself) = maybe_qself {
-                visitor.visit_ty(&qself.ty);
+                try_visit!(visitor.visit_ty(&qself.ty));
             }
-            visitor.visit_path(path, typ.id);
+            try_visit!(visitor.visit_path(path, typ.id));
         }
         TyKind::Array(ty, length) => {
-            visitor.visit_ty(ty);
-            visitor.visit_anon_const(length)
+            try_visit!(visitor.visit_ty(ty));
+            try_visit!(visitor.visit_anon_const(length));
         }
         TyKind::TraitObject(bounds, ..) => {
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::TraitObject);
@@ -446,48 +518,53 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
         TyKind::ImplTrait(_, bounds) => {
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::Impl);
         }
-        TyKind::Typeof(expression) => visitor.visit_anon_const(expression),
+        TyKind::Typeof(expression) => try_visit!(visitor.visit_anon_const(expression)),
         TyKind::Infer | TyKind::ImplicitSelf | TyKind::Dummy | TyKind::Err(_) => {}
-        TyKind::MacCall(mac) => visitor.visit_mac_call(mac),
+        TyKind::MacCall(mac) => try_visit!(visitor.visit_mac_call(mac)),
         TyKind::Never | TyKind::CVarArgs => {}
         TyKind::AnonStruct(_, ref fields) | TyKind::AnonUnion(_, ref fields) => {
-            walk_list!(visitor, visit_field_def, fields)
+            walk_list!(visitor, visit_field_def, fields);
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_path<'a, V: Visitor<'a>>(visitor: &mut V, path: &'a Path) {
-    for segment in &path.segments {
-        visitor.visit_path_segment(segment);
-    }
+pub fn walk_path<'a, V: Visitor<'a>>(visitor: &mut V, path: &'a Path) -> V::Result {
+    walk_list!(visitor, visit_path_segment, &path.segments);
+    V::Result::output()
 }
 
-pub fn walk_use_tree<'a, V: Visitor<'a>>(visitor: &mut V, use_tree: &'a UseTree, id: NodeId) {
-    visitor.visit_path(&use_tree.prefix, id);
-    match &use_tree.kind {
+pub fn walk_use_tree<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    use_tree: &'a UseTree,
+    id: NodeId,
+) -> V::Result {
+    try_visit!(visitor.visit_path(&use_tree.prefix, id));
+    match use_tree.kind {
         UseTreeKind::Simple(rename) => {
             // The extra IDs are handled during HIR lowering.
-            if let &Some(rename) = rename {
-                visitor.visit_ident(rename);
-            }
+            visit_opt!(visitor, visit_ident, rename);
         }
         UseTreeKind::Glob => {}
-        UseTreeKind::Nested(use_trees) => {
+        UseTreeKind::Nested(ref use_trees) => {
             for &(ref nested_tree, nested_id) in use_trees {
-                visitor.visit_use_tree(nested_tree, nested_id, true);
+                try_visit!(visitor.visit_use_tree(nested_tree, nested_id, true));
             }
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_path_segment<'a, V: Visitor<'a>>(visitor: &mut V, segment: &'a PathSegment) {
-    visitor.visit_ident(segment.ident);
-    if let Some(args) = &segment.args {
-        visitor.visit_generic_args(args);
-    }
+pub fn walk_path_segment<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    segment: &'a PathSegment,
+) -> V::Result {
+    try_visit!(visitor.visit_ident(segment.ident));
+    visit_opt!(visitor, visit_generic_args, &segment.args);
+    V::Result::output()
 }
 
-pub fn walk_generic_args<'a, V>(visitor: &mut V, generic_args: &'a GenericArgs)
+pub fn walk_generic_args<'a, V>(visitor: &mut V, generic_args: &'a GenericArgs) -> V::Result
 where
     V: Visitor<'a>,
 {
@@ -495,19 +572,22 @@ where
         GenericArgs::AngleBracketed(data) => {
             for arg in &data.args {
                 match arg {
-                    AngleBracketedArg::Arg(a) => visitor.visit_generic_arg(a),
-                    AngleBracketedArg::Constraint(c) => visitor.visit_assoc_constraint(c),
+                    AngleBracketedArg::Arg(a) => try_visit!(visitor.visit_generic_arg(a)),
+                    AngleBracketedArg::Constraint(c) => {
+                        try_visit!(visitor.visit_assoc_constraint(c))
+                    }
                 }
             }
         }
         GenericArgs::Parenthesized(data) => {
             walk_list!(visitor, visit_ty, &data.inputs);
-            visitor.visit_fn_ret_ty(&data.output);
+            try_visit!(visitor.visit_fn_ret_ty(&data.output));
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_generic_arg<'a, V>(visitor: &mut V, generic_arg: &'a GenericArg)
+pub fn walk_generic_arg<'a, V>(visitor: &mut V, generic_arg: &'a GenericArg) -> V::Result
 where
     V: Visitor<'a>,
 {
@@ -518,127 +598,141 @@ where
     }
 }
 
-pub fn walk_assoc_constraint<'a, V: Visitor<'a>>(visitor: &mut V, constraint: &'a AssocConstraint) {
-    visitor.visit_ident(constraint.ident);
-    if let Some(gen_args) = &constraint.gen_args {
-        visitor.visit_generic_args(gen_args);
-    }
+pub fn walk_assoc_constraint<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    constraint: &'a AssocConstraint,
+) -> V::Result {
+    try_visit!(visitor.visit_ident(constraint.ident));
+    visit_opt!(visitor, visit_generic_args, &constraint.gen_args);
     match &constraint.kind {
         AssocConstraintKind::Equality { term } => match term {
-            Term::Ty(ty) => visitor.visit_ty(ty),
-            Term::Const(c) => visitor.visit_anon_const(c),
+            Term::Ty(ty) => try_visit!(visitor.visit_ty(ty)),
+            Term::Const(c) => try_visit!(visitor.visit_anon_const(c)),
         },
         AssocConstraintKind::Bound { bounds } => {
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) {
+pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) -> V::Result {
     match &pattern.kind {
         PatKind::TupleStruct(opt_qself, path, elems) => {
             if let Some(qself) = opt_qself {
-                visitor.visit_ty(&qself.ty);
+                try_visit!(visitor.visit_ty(&qself.ty));
             }
-            visitor.visit_path(path, pattern.id);
+            try_visit!(visitor.visit_path(path, pattern.id));
             walk_list!(visitor, visit_pat, elems);
         }
         PatKind::Path(opt_qself, path) => {
             if let Some(qself) = opt_qself {
-                visitor.visit_ty(&qself.ty);
+                try_visit!(visitor.visit_ty(&qself.ty));
             }
-            visitor.visit_path(path, pattern.id)
+            try_visit!(visitor.visit_path(path, pattern.id))
         }
         PatKind::Struct(opt_qself, path, fields, _) => {
             if let Some(qself) = opt_qself {
-                visitor.visit_ty(&qself.ty);
+                try_visit!(visitor.visit_ty(&qself.ty));
             }
-            visitor.visit_path(path, pattern.id);
+            try_visit!(visitor.visit_path(path, pattern.id));
             walk_list!(visitor, visit_pat_field, fields);
         }
         PatKind::Box(subpattern) | PatKind::Ref(subpattern, _) | PatKind::Paren(subpattern) => {
-            visitor.visit_pat(subpattern)
+            try_visit!(visitor.visit_pat(subpattern));
         }
         PatKind::Ident(_, ident, optional_subpattern) => {
-            visitor.visit_ident(*ident);
-            walk_list!(visitor, visit_pat, optional_subpattern);
+            try_visit!(visitor.visit_ident(*ident));
+            visit_opt!(visitor, visit_pat, optional_subpattern);
         }
-        PatKind::Lit(expression) => visitor.visit_expr(expression),
+        PatKind::Lit(expression) => try_visit!(visitor.visit_expr(expression)),
         PatKind::Range(lower_bound, upper_bound, _) => {
-            walk_list!(visitor, visit_expr, lower_bound);
-            walk_list!(visitor, visit_expr, upper_bound);
+            visit_opt!(visitor, visit_expr, lower_bound);
+            visit_opt!(visitor, visit_expr, upper_bound);
         }
         PatKind::Wild | PatKind::Rest | PatKind::Never | PatKind::Err(_) => {}
         PatKind::Tuple(elems) | PatKind::Slice(elems) | PatKind::Or(elems) => {
             walk_list!(visitor, visit_pat, elems);
         }
-        PatKind::MacCall(mac) => visitor.visit_mac_call(mac),
+        PatKind::MacCall(mac) => try_visit!(visitor.visit_mac_call(mac)),
     }
+    V::Result::output()
 }
 
-pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a ForeignItem) {
+pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a ForeignItem) -> V::Result {
     let &Item { id, span, ident, ref vis, ref attrs, ref kind, tokens: _ } = item;
-    visitor.visit_vis(vis);
-    visitor.visit_ident(ident);
+    try_visit!(visitor.visit_vis(vis));
+    try_visit!(visitor.visit_ident(ident));
     walk_list!(visitor, visit_attribute, attrs);
     match kind {
         ForeignItemKind::Static(ty, _, expr) => {
-            visitor.visit_ty(ty);
-            walk_list!(visitor, visit_expr, expr);
+            try_visit!(visitor.visit_ty(ty));
+            visit_opt!(visitor, visit_expr, expr);
         }
         ForeignItemKind::Fn(box Fn { defaultness: _, generics, sig, body }) => {
             let kind = FnKind::Fn(FnCtxt::Foreign, ident, sig, vis, generics, body.as_deref());
-            visitor.visit_fn(kind, span, id);
+            try_visit!(visitor.visit_fn(kind, span, id));
         }
         ForeignItemKind::TyAlias(box TyAlias { generics, bounds, ty, .. }) => {
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_generics(generics));
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
-            walk_list!(visitor, visit_ty, ty);
+            visit_opt!(visitor, visit_ty, ty);
         }
         ForeignItemKind::MacCall(mac) => {
-            visitor.visit_mac_call(mac);
+            try_visit!(visitor.visit_mac_call(mac));
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a GenericBound) {
+pub fn walk_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a GenericBound) -> V::Result {
     match bound {
         GenericBound::Trait(typ, _modifier) => visitor.visit_poly_trait_ref(typ),
         GenericBound::Outlives(lifetime) => visitor.visit_lifetime(lifetime, LifetimeCtxt::Bound),
     }
 }
 
-pub fn walk_generic_param<'a, V: Visitor<'a>>(visitor: &mut V, param: &'a GenericParam) {
-    visitor.visit_ident(param.ident);
-    walk_list!(visitor, visit_attribute, param.attrs.iter());
+pub fn walk_generic_param<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    param: &'a GenericParam,
+) -> V::Result {
+    try_visit!(visitor.visit_ident(param.ident));
+    walk_list!(visitor, visit_attribute, &param.attrs);
     walk_list!(visitor, visit_param_bound, &param.bounds, BoundKind::Bound);
     match &param.kind {
         GenericParamKind::Lifetime => (),
-        GenericParamKind::Type { default } => walk_list!(visitor, visit_ty, default),
+        GenericParamKind::Type { default } => visit_opt!(visitor, visit_ty, default),
         GenericParamKind::Const { ty, default, .. } => {
-            visitor.visit_ty(ty);
-            if let Some(default) = default {
-                visitor.visit_anon_const(default);
-            }
+            try_visit!(visitor.visit_ty(ty));
+            visit_opt!(visitor, visit_anon_const, default);
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_generics<'a, V: Visitor<'a>>(visitor: &mut V, generics: &'a Generics) {
+pub fn walk_generics<'a, V: Visitor<'a>>(visitor: &mut V, generics: &'a Generics) -> V::Result {
     walk_list!(visitor, visit_generic_param, &generics.params);
     walk_list!(visitor, visit_where_predicate, &generics.where_clause.predicates);
+    V::Result::output()
 }
 
-pub fn walk_closure_binder<'a, V: Visitor<'a>>(visitor: &mut V, binder: &'a ClosureBinder) {
+pub fn walk_closure_binder<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    binder: &'a ClosureBinder,
+) -> V::Result {
     match binder {
         ClosureBinder::NotPresent => {}
         ClosureBinder::For { generic_params, span: _ } => {
             walk_list!(visitor, visit_generic_param, generic_params)
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_where_predicate<'a, V: Visitor<'a>>(visitor: &mut V, predicate: &'a WherePredicate) {
+pub fn walk_where_predicate<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    predicate: &'a WherePredicate,
+) -> V::Result {
     match predicate {
         WherePredicate::BoundPredicate(WhereBoundPredicate {
             bounded_ty,
@@ -646,181 +740,196 @@ pub fn walk_where_predicate<'a, V: Visitor<'a>>(visitor: &mut V, predicate: &'a
             bound_generic_params,
             ..
         }) => {
-            visitor.visit_ty(bounded_ty);
+            try_visit!(visitor.visit_ty(bounded_ty));
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
             walk_list!(visitor, visit_generic_param, bound_generic_params);
         }
         WherePredicate::RegionPredicate(WhereRegionPredicate { lifetime, bounds, .. }) => {
-            visitor.visit_lifetime(lifetime, LifetimeCtxt::Bound);
+            try_visit!(visitor.visit_lifetime(lifetime, LifetimeCtxt::Bound));
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
         }
         WherePredicate::EqPredicate(WhereEqPredicate { lhs_ty, rhs_ty, .. }) => {
-            visitor.visit_ty(lhs_ty);
-            visitor.visit_ty(rhs_ty);
+            try_visit!(visitor.visit_ty(lhs_ty));
+            try_visit!(visitor.visit_ty(rhs_ty));
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_fn_ret_ty<'a, V: Visitor<'a>>(visitor: &mut V, ret_ty: &'a FnRetTy) {
+pub fn walk_fn_ret_ty<'a, V: Visitor<'a>>(visitor: &mut V, ret_ty: &'a FnRetTy) -> V::Result {
     if let FnRetTy::Ty(output_ty) = ret_ty {
-        visitor.visit_ty(output_ty)
+        try_visit!(visitor.visit_ty(output_ty));
     }
+    V::Result::output()
 }
 
-pub fn walk_fn_decl<'a, V: Visitor<'a>>(visitor: &mut V, function_declaration: &'a FnDecl) {
-    for param in &function_declaration.inputs {
-        visitor.visit_param(param);
-    }
-    visitor.visit_fn_ret_ty(&function_declaration.output);
+pub fn walk_fn_decl<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    function_declaration: &'a FnDecl,
+) -> V::Result {
+    walk_list!(visitor, visit_param, &function_declaration.inputs);
+    visitor.visit_fn_ret_ty(&function_declaration.output)
 }
 
-pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>) {
+pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>) -> V::Result {
     match kind {
         FnKind::Fn(_, _, sig, _, generics, body) => {
-            visitor.visit_generics(generics);
-            visitor.visit_fn_header(&sig.header);
-            walk_fn_decl(visitor, &sig.decl);
-            walk_list!(visitor, visit_block, body);
+            try_visit!(visitor.visit_generics(generics));
+            try_visit!(visitor.visit_fn_header(&sig.header));
+            try_visit!(walk_fn_decl(visitor, &sig.decl));
+            visit_opt!(visitor, visit_block, body);
         }
         FnKind::Closure(binder, decl, body) => {
-            visitor.visit_closure_binder(binder);
-            walk_fn_decl(visitor, decl);
-            visitor.visit_expr(body);
+            try_visit!(visitor.visit_closure_binder(binder));
+            try_visit!(walk_fn_decl(visitor, decl));
+            try_visit!(visitor.visit_expr(body));
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem, ctxt: AssocCtxt) {
+pub fn walk_assoc_item<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    item: &'a AssocItem,
+    ctxt: AssocCtxt,
+) -> V::Result {
     let &Item { id, span, ident, ref vis, ref attrs, ref kind, tokens: _ } = item;
-    visitor.visit_vis(vis);
-    visitor.visit_ident(ident);
+    try_visit!(visitor.visit_vis(vis));
+    try_visit!(visitor.visit_ident(ident));
     walk_list!(visitor, visit_attribute, attrs);
     match kind {
         AssocItemKind::Const(box ConstItem { defaultness: _, generics, ty, expr }) => {
-            visitor.visit_generics(generics);
-            visitor.visit_ty(ty);
-            walk_list!(visitor, visit_expr, expr);
+            try_visit!(visitor.visit_generics(generics));
+            try_visit!(visitor.visit_ty(ty));
+            visit_opt!(visitor, visit_expr, expr);
         }
         AssocItemKind::Fn(box Fn { defaultness: _, generics, sig, body }) => {
             let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), ident, sig, vis, generics, body.as_deref());
-            visitor.visit_fn(kind, span, id);
+            try_visit!(visitor.visit_fn(kind, span, id));
         }
         AssocItemKind::Type(box TyAlias { generics, bounds, ty, .. }) => {
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_generics(generics));
             walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
-            walk_list!(visitor, visit_ty, ty);
+            visit_opt!(visitor, visit_ty, ty);
         }
         AssocItemKind::MacCall(mac) => {
-            visitor.visit_mac_call(mac);
+            try_visit!(visitor.visit_mac_call(mac));
         }
         AssocItemKind::Delegation(box Delegation { id, qself, path, body }) => {
             if let Some(qself) = qself {
                 visitor.visit_ty(&qself.ty);
             }
-            visitor.visit_path(path, *id);
-            if let Some(body) = body {
-                visitor.visit_block(body);
-            }
+            try_visit!(visitor.visit_path(path, *id));
+            visit_opt!(visitor, visit_block, body);
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_struct_def<'a, V: Visitor<'a>>(visitor: &mut V, struct_definition: &'a VariantData) {
+pub fn walk_struct_def<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    struct_definition: &'a VariantData,
+) -> V::Result {
     walk_list!(visitor, visit_field_def, struct_definition.fields());
+    V::Result::output()
 }
 
-pub fn walk_field_def<'a, V: Visitor<'a>>(visitor: &mut V, field: &'a FieldDef) {
-    visitor.visit_vis(&field.vis);
-    if let Some(ident) = field.ident {
-        visitor.visit_ident(ident);
-    }
-    visitor.visit_ty(&field.ty);
+pub fn walk_field_def<'a, V: Visitor<'a>>(visitor: &mut V, field: &'a FieldDef) -> V::Result {
+    try_visit!(visitor.visit_vis(&field.vis));
+    visit_opt!(visitor, visit_ident, field.ident);
+    try_visit!(visitor.visit_ty(&field.ty));
     walk_list!(visitor, visit_attribute, &field.attrs);
+    V::Result::output()
 }
 
-pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) {
+pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) -> V::Result {
     walk_list!(visitor, visit_stmt, &block.stmts);
+    V::Result::output()
 }
 
-pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) {
+pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) -> V::Result {
     match &statement.kind {
-        StmtKind::Local(local) => visitor.visit_local(local),
-        StmtKind::Item(item) => visitor.visit_item(item),
-        StmtKind::Expr(expr) | StmtKind::Semi(expr) => visitor.visit_expr(expr),
+        StmtKind::Local(local) => try_visit!(visitor.visit_local(local)),
+        StmtKind::Item(item) => try_visit!(visitor.visit_item(item)),
+        StmtKind::Expr(expr) | StmtKind::Semi(expr) => try_visit!(visitor.visit_expr(expr)),
         StmtKind::Empty => {}
         StmtKind::MacCall(mac) => {
             let MacCallStmt { mac, attrs, style: _, tokens: _ } = &**mac;
-            visitor.visit_mac_call(mac);
-            for attr in attrs.iter() {
-                visitor.visit_attribute(attr);
-            }
+            try_visit!(visitor.visit_mac_call(mac));
+            walk_list!(visitor, visit_attribute, attrs);
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_mac<'a, V: Visitor<'a>>(visitor: &mut V, mac: &'a MacCall) {
-    visitor.visit_path(&mac.path, DUMMY_NODE_ID);
+pub fn walk_mac<'a, V: Visitor<'a>>(visitor: &mut V, mac: &'a MacCall) -> V::Result {
+    visitor.visit_path(&mac.path, DUMMY_NODE_ID)
 }
 
-pub fn walk_anon_const<'a, V: Visitor<'a>>(visitor: &mut V, constant: &'a AnonConst) {
-    visitor.visit_expr(&constant.value);
+pub fn walk_anon_const<'a, V: Visitor<'a>>(visitor: &mut V, constant: &'a AnonConst) -> V::Result {
+    visitor.visit_expr(&constant.value)
 }
 
-pub fn walk_inline_asm<'a, V: Visitor<'a>>(visitor: &mut V, asm: &'a InlineAsm) {
+pub fn walk_inline_asm<'a, V: Visitor<'a>>(visitor: &mut V, asm: &'a InlineAsm) -> V::Result {
     for (op, _) in &asm.operands {
         match op {
             InlineAsmOperand::In { expr, .. }
             | InlineAsmOperand::Out { expr: Some(expr), .. }
-            | InlineAsmOperand::InOut { expr, .. } => visitor.visit_expr(expr),
+            | InlineAsmOperand::InOut { expr, .. } => try_visit!(visitor.visit_expr(expr)),
             InlineAsmOperand::Out { expr: None, .. } => {}
             InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
-                visitor.visit_expr(in_expr);
-                if let Some(out_expr) = out_expr {
-                    visitor.visit_expr(out_expr);
-                }
+                try_visit!(visitor.visit_expr(in_expr));
+                visit_opt!(visitor, visit_expr, out_expr);
+            }
+            InlineAsmOperand::Const { anon_const, .. } => {
+                try_visit!(visitor.visit_anon_const(anon_const))
             }
-            InlineAsmOperand::Const { anon_const, .. } => visitor.visit_anon_const(anon_const),
-            InlineAsmOperand::Sym { sym } => visitor.visit_inline_asm_sym(sym),
+            InlineAsmOperand::Sym { sym } => try_visit!(visitor.visit_inline_asm_sym(sym)),
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_inline_asm_sym<'a, V: Visitor<'a>>(visitor: &mut V, sym: &'a InlineAsmSym) {
+pub fn walk_inline_asm_sym<'a, V: Visitor<'a>>(
+    visitor: &mut V,
+    sym: &'a InlineAsmSym,
+) -> V::Result {
     if let Some(qself) = &sym.qself {
-        visitor.visit_ty(&qself.ty);
+        try_visit!(visitor.visit_ty(&qself.ty));
     }
-    visitor.visit_path(&sym.path, sym.id);
+    visitor.visit_path(&sym.path, sym.id)
 }
 
-pub fn walk_format_args<'a, V: Visitor<'a>>(visitor: &mut V, fmt: &'a FormatArgs) {
+pub fn walk_format_args<'a, V: Visitor<'a>>(visitor: &mut V, fmt: &'a FormatArgs) -> V::Result {
     for arg in fmt.arguments.all_args() {
         if let FormatArgumentKind::Named(name) = arg.kind {
-            visitor.visit_ident(name);
+            try_visit!(visitor.visit_ident(name));
         }
-        visitor.visit_expr(&arg.expr);
+        try_visit!(visitor.visit_expr(&arg.expr));
     }
+    V::Result::output()
 }
 
-pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
-    walk_list!(visitor, visit_attribute, expression.attrs.iter());
+pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V::Result {
+    walk_list!(visitor, visit_attribute, &expression.attrs);
 
     match &expression.kind {
         ExprKind::Array(subexpressions) => {
             walk_list!(visitor, visit_expr, subexpressions);
         }
-        ExprKind::ConstBlock(anon_const) => visitor.visit_anon_const(anon_const),
+        ExprKind::ConstBlock(anon_const) => try_visit!(visitor.visit_anon_const(anon_const)),
         ExprKind::Repeat(element, count) => {
-            visitor.visit_expr(element);
-            visitor.visit_anon_const(count)
+            try_visit!(visitor.visit_expr(element));
+            try_visit!(visitor.visit_anon_const(count));
         }
         ExprKind::Struct(se) => {
             if let Some(qself) = &se.qself {
-                visitor.visit_ty(&qself.ty);
+                try_visit!(visitor.visit_ty(&qself.ty));
             }
-            visitor.visit_path(&se.path, expression.id);
+            try_visit!(visitor.visit_path(&se.path, expression.id));
             walk_list!(visitor, visit_expr_field, &se.fields);
             match &se.rest {
-                StructRest::Base(expr) => visitor.visit_expr(expr),
+                StructRest::Base(expr) => try_visit!(visitor.visit_expr(expr)),
                 StructRest::Rest(_span) => {}
                 StructRest::None => {}
             }
@@ -829,51 +938,51 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
             walk_list!(visitor, visit_expr, subexpressions);
         }
         ExprKind::Call(callee_expression, arguments) => {
-            visitor.visit_expr(callee_expression);
+            try_visit!(visitor.visit_expr(callee_expression));
             walk_list!(visitor, visit_expr, arguments);
         }
         ExprKind::MethodCall(box MethodCall { seg, receiver, args, span: _ }) => {
-            visitor.visit_path_segment(seg);
-            visitor.visit_expr(receiver);
+            try_visit!(visitor.visit_path_segment(seg));
+            try_visit!(visitor.visit_expr(receiver));
             walk_list!(visitor, visit_expr, args);
         }
         ExprKind::Binary(_, left_expression, right_expression) => {
-            visitor.visit_expr(left_expression);
-            visitor.visit_expr(right_expression)
+            try_visit!(visitor.visit_expr(left_expression));
+            try_visit!(visitor.visit_expr(right_expression));
         }
         ExprKind::AddrOf(_, _, subexpression) | ExprKind::Unary(_, subexpression) => {
-            visitor.visit_expr(subexpression)
+            try_visit!(visitor.visit_expr(subexpression));
         }
         ExprKind::Cast(subexpression, typ) | ExprKind::Type(subexpression, typ) => {
-            visitor.visit_expr(subexpression);
-            visitor.visit_ty(typ)
+            try_visit!(visitor.visit_expr(subexpression));
+            try_visit!(visitor.visit_ty(typ));
         }
         ExprKind::Let(pat, expr, _, _) => {
-            visitor.visit_pat(pat);
-            visitor.visit_expr(expr);
+            try_visit!(visitor.visit_pat(pat));
+            try_visit!(visitor.visit_expr(expr));
         }
         ExprKind::If(head_expression, if_block, optional_else) => {
-            visitor.visit_expr(head_expression);
-            visitor.visit_block(if_block);
-            walk_list!(visitor, visit_expr, optional_else);
+            try_visit!(visitor.visit_expr(head_expression));
+            try_visit!(visitor.visit_block(if_block));
+            visit_opt!(visitor, visit_expr, optional_else);
         }
         ExprKind::While(subexpression, block, opt_label) => {
-            walk_list!(visitor, visit_label, opt_label);
-            visitor.visit_expr(subexpression);
-            visitor.visit_block(block);
+            visit_opt!(visitor, visit_label, opt_label);
+            try_visit!(visitor.visit_expr(subexpression));
+            try_visit!(visitor.visit_block(block));
         }
         ExprKind::ForLoop { pat, iter, body, label, kind: _ } => {
-            walk_list!(visitor, visit_label, label);
-            visitor.visit_pat(pat);
-            visitor.visit_expr(iter);
-            visitor.visit_block(body);
+            visit_opt!(visitor, visit_label, label);
+            try_visit!(visitor.visit_pat(pat));
+            try_visit!(visitor.visit_expr(iter));
+            try_visit!(visitor.visit_block(body));
         }
         ExprKind::Loop(block, opt_label, _) => {
-            walk_list!(visitor, visit_label, opt_label);
-            visitor.visit_block(block);
+            visit_opt!(visitor, visit_label, opt_label);
+            try_visit!(visitor.visit_block(block));
         }
         ExprKind::Match(subexpression, arms) => {
-            visitor.visit_expr(subexpression);
+            try_visit!(visitor.visit_expr(subexpression));
             walk_list!(visitor, visit_arm, arms);
         }
         ExprKind::Closure(box Closure {
@@ -887,112 +996,117 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
             fn_decl_span: _,
             fn_arg_span: _,
         }) => {
-            visitor.visit_capture_by(capture_clause);
-            visitor.visit_fn(FnKind::Closure(binder, fn_decl, body), expression.span, expression.id)
+            try_visit!(visitor.visit_capture_by(capture_clause));
+            try_visit!(visitor.visit_fn(
+                FnKind::Closure(binder, fn_decl, body),
+                expression.span,
+                expression.id
+            ))
         }
         ExprKind::Block(block, opt_label) => {
-            walk_list!(visitor, visit_label, opt_label);
-            visitor.visit_block(block);
+            visit_opt!(visitor, visit_label, opt_label);
+            try_visit!(visitor.visit_block(block));
         }
-        ExprKind::Gen(_, body, _) => {
-            visitor.visit_block(body);
-        }
-        ExprKind::Await(expr, _) => visitor.visit_expr(expr),
+        ExprKind::Gen(_, body, _) => try_visit!(visitor.visit_block(body)),
+        ExprKind::Await(expr, _) => try_visit!(visitor.visit_expr(expr)),
         ExprKind::Assign(lhs, rhs, _) => {
-            visitor.visit_expr(lhs);
-            visitor.visit_expr(rhs);
+            try_visit!(visitor.visit_expr(lhs));
+            try_visit!(visitor.visit_expr(rhs));
         }
         ExprKind::AssignOp(_, left_expression, right_expression) => {
-            visitor.visit_expr(left_expression);
-            visitor.visit_expr(right_expression);
+            try_visit!(visitor.visit_expr(left_expression));
+            try_visit!(visitor.visit_expr(right_expression));
         }
         ExprKind::Field(subexpression, ident) => {
-            visitor.visit_expr(subexpression);
-            visitor.visit_ident(*ident);
+            try_visit!(visitor.visit_expr(subexpression));
+            try_visit!(visitor.visit_ident(*ident));
         }
         ExprKind::Index(main_expression, index_expression, _) => {
-            visitor.visit_expr(main_expression);
-            visitor.visit_expr(index_expression)
+            try_visit!(visitor.visit_expr(main_expression));
+            try_visit!(visitor.visit_expr(index_expression));
         }
         ExprKind::Range(start, end, _) => {
-            walk_list!(visitor, visit_expr, start);
-            walk_list!(visitor, visit_expr, end);
+            visit_opt!(visitor, visit_expr, start);
+            visit_opt!(visitor, visit_expr, end);
         }
         ExprKind::Underscore => {}
         ExprKind::Path(maybe_qself, path) => {
             if let Some(qself) = maybe_qself {
-                visitor.visit_ty(&qself.ty);
+                try_visit!(visitor.visit_ty(&qself.ty));
             }
-            visitor.visit_path(path, expression.id)
+            try_visit!(visitor.visit_path(path, expression.id));
         }
         ExprKind::Break(opt_label, opt_expr) => {
-            walk_list!(visitor, visit_label, opt_label);
-            walk_list!(visitor, visit_expr, opt_expr);
+            visit_opt!(visitor, visit_label, opt_label);
+            visit_opt!(visitor, visit_expr, opt_expr);
         }
         ExprKind::Continue(opt_label) => {
-            walk_list!(visitor, visit_label, opt_label);
+            visit_opt!(visitor, visit_label, opt_label);
         }
         ExprKind::Ret(optional_expression) => {
-            walk_list!(visitor, visit_expr, optional_expression);
+            visit_opt!(visitor, visit_expr, optional_expression);
         }
         ExprKind::Yeet(optional_expression) => {
-            walk_list!(visitor, visit_expr, optional_expression);
+            visit_opt!(visitor, visit_expr, optional_expression);
         }
-        ExprKind::Become(expr) => visitor.visit_expr(expr),
-        ExprKind::MacCall(mac) => visitor.visit_mac_call(mac),
-        ExprKind::Paren(subexpression) => visitor.visit_expr(subexpression),
-        ExprKind::InlineAsm(asm) => visitor.visit_inline_asm(asm),
-        ExprKind::FormatArgs(f) => visitor.visit_format_args(f),
+        ExprKind::Become(expr) => try_visit!(visitor.visit_expr(expr)),
+        ExprKind::MacCall(mac) => try_visit!(visitor.visit_mac_call(mac)),
+        ExprKind::Paren(subexpression) => try_visit!(visitor.visit_expr(subexpression)),
+        ExprKind::InlineAsm(asm) => try_visit!(visitor.visit_inline_asm(asm)),
+        ExprKind::FormatArgs(f) => try_visit!(visitor.visit_format_args(f)),
         ExprKind::OffsetOf(container, fields) => {
             visitor.visit_ty(container);
-            for &field in fields {
-                visitor.visit_ident(field);
-            }
+            walk_list!(visitor, visit_ident, fields.iter().copied());
         }
         ExprKind::Yield(optional_expression) => {
-            walk_list!(visitor, visit_expr, optional_expression);
+            visit_opt!(visitor, visit_expr, optional_expression);
         }
-        ExprKind::Try(subexpression) => visitor.visit_expr(subexpression),
-        ExprKind::TryBlock(body) => visitor.visit_block(body),
+        ExprKind::Try(subexpression) => try_visit!(visitor.visit_expr(subexpression)),
+        ExprKind::TryBlock(body) => try_visit!(visitor.visit_block(body)),
         ExprKind::Lit(_) | ExprKind::IncludedBytes(..) | ExprKind::Err => {}
     }
 
     visitor.visit_expr_post(expression)
 }
 
-pub fn walk_param<'a, V: Visitor<'a>>(visitor: &mut V, param: &'a Param) {
-    walk_list!(visitor, visit_attribute, param.attrs.iter());
-    visitor.visit_pat(&param.pat);
-    visitor.visit_ty(&param.ty);
+pub fn walk_param<'a, V: Visitor<'a>>(visitor: &mut V, param: &'a Param) -> V::Result {
+    walk_list!(visitor, visit_attribute, &param.attrs);
+    try_visit!(visitor.visit_pat(&param.pat));
+    try_visit!(visitor.visit_ty(&param.ty));
+    V::Result::output()
 }
 
-pub fn walk_arm<'a, V: Visitor<'a>>(visitor: &mut V, arm: &'a Arm) {
-    visitor.visit_pat(&arm.pat);
-    walk_list!(visitor, visit_expr, &arm.guard);
-    walk_list!(visitor, visit_expr, &arm.body);
+pub fn walk_arm<'a, V: Visitor<'a>>(visitor: &mut V, arm: &'a Arm) -> V::Result {
+    try_visit!(visitor.visit_pat(&arm.pat));
+    visit_opt!(visitor, visit_expr, &arm.guard);
+    visit_opt!(visitor, visit_expr, &arm.body);
     walk_list!(visitor, visit_attribute, &arm.attrs);
+    V::Result::output()
 }
 
-pub fn walk_vis<'a, V: Visitor<'a>>(visitor: &mut V, vis: &'a Visibility) {
+pub fn walk_vis<'a, V: Visitor<'a>>(visitor: &mut V, vis: &'a Visibility) -> V::Result {
     if let VisibilityKind::Restricted { ref path, id, shorthand: _ } = vis.kind {
-        visitor.visit_path(path, id);
+        try_visit!(visitor.visit_path(path, id));
     }
+    V::Result::output()
 }
 
-pub fn walk_attribute<'a, V: Visitor<'a>>(visitor: &mut V, attr: &'a Attribute) {
+pub fn walk_attribute<'a, V: Visitor<'a>>(visitor: &mut V, attr: &'a Attribute) -> V::Result {
     match &attr.kind {
-        AttrKind::Normal(normal) => walk_attr_args(visitor, &normal.item.args),
+        AttrKind::Normal(normal) => try_visit!(walk_attr_args(visitor, &normal.item.args)),
         AttrKind::DocComment(..) => {}
     }
+    V::Result::output()
 }
 
-pub fn walk_attr_args<'a, V: Visitor<'a>>(visitor: &mut V, args: &'a AttrArgs) {
+pub fn walk_attr_args<'a, V: Visitor<'a>>(visitor: &mut V, args: &'a AttrArgs) -> V::Result {
     match args {
         AttrArgs::Empty => {}
         AttrArgs::Delimited(_) => {}
-        AttrArgs::Eq(_eq_span, AttrArgsEq::Ast(expr)) => visitor.visit_expr(expr),
+        AttrArgs::Eq(_eq_span, AttrArgsEq::Ast(expr)) => try_visit!(visitor.visit_expr(expr)),
         AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => {
             unreachable!("in literal form when walking mac args eq: {:?}", lit)
         }
     }
+    V::Result::output()
 }
diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs
index 274e6b7458c..834409da675 100644
--- a/compiler/rustc_ast_lowering/src/errors.rs
+++ b/compiler/rustc_ast_lowering/src/errors.rs
@@ -1,5 +1,6 @@
 use rustc_errors::{
-    codes::*, AddToDiagnostic, Diagnostic, DiagnosticArgFromDisplay, SubdiagnosticMessageOp,
+    codes::*, AddToDiagnostic, DiagnosticArgFromDisplay, DiagnosticBuilder, EmissionGuarantee,
+    SubdiagnosticMessageOp,
 };
 use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_span::{symbol::Ident, Span, Symbol};
@@ -41,7 +42,11 @@ pub struct InvalidAbi {
 pub struct InvalidAbiReason(pub &'static str);
 
 impl AddToDiagnostic for InvalidAbiReason {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _: F,
+    ) {
         #[allow(rustc::untranslatable_diagnostic)]
         diag.note(self.0);
     }
diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs
index 9662c73ca85..e5153c89790 100644
--- a/compiler/rustc_ast_passes/src/errors.rs
+++ b/compiler/rustc_ast_passes/src/errors.rs
@@ -1,7 +1,10 @@
 //! Errors emitted by ast_passes.
 
 use rustc_ast::ParamKindOrd;
-use rustc_errors::{codes::*, AddToDiagnostic, Applicability, Diagnostic, SubdiagnosticMessageOp};
+use rustc_errors::{
+    codes::*, AddToDiagnostic, Applicability, DiagnosticBuilder, EmissionGuarantee,
+    SubdiagnosticMessageOp,
+};
 use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_span::{symbol::Ident, Span, Symbol};
 
@@ -372,7 +375,11 @@ pub struct EmptyLabelManySpans(pub Vec<Span>);
 
 // The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
 impl AddToDiagnostic for EmptyLabelManySpans {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _: F,
+    ) {
         diag.span_labels(self.0, "");
     }
 }
@@ -729,7 +736,11 @@ pub struct StableFeature {
 }
 
 impl AddToDiagnostic for StableFeature {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _: F,
+    ) {
         diag.arg("name", self.name);
         diag.arg("since", self.since);
         diag.help(fluent::ast_passes_stable_since);
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs
index 409aef9185d..1b0dd9acc37 100644
--- a/compiler/rustc_ast_passes/src/feature_gate.rs
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs
@@ -22,6 +22,9 @@ macro_rules! gate {
     }};
     ($visitor:expr, $feature:ident, $span:expr, $explain:expr, $help:expr) => {{
         if !$visitor.features.$feature && !$span.allows_unstable(sym::$feature) {
+            // FIXME: make this translatable
+            #[allow(rustc::diagnostic_outside_of_impl)]
+            #[allow(rustc::untranslatable_diagnostic)]
             feature_err(&$visitor.sess, sym::$feature, $span, $explain).with_help($help).emit();
         }
     }};
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
index 2b0c0e939f5..e1509da913a 100644
--- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
@@ -6,9 +6,7 @@
 use either::Either;
 use rustc_data_structures::captures::Captures;
 use rustc_data_structures::fx::FxIndexSet;
-use rustc_errors::{
-    codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan,
-};
+use rustc_errors::{codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, MultiSpan};
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
 use rustc_hir::intravisit::{walk_block, walk_expr, Visitor};
@@ -635,7 +633,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
 
     fn suggest_assign_value(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         moved_place: PlaceRef<'tcx>,
         sugg_span: Span,
     ) {
@@ -674,7 +672,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
 
     fn suggest_borrow_fn_like(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         ty: Ty<'tcx>,
         move_sites: &[MoveSite],
         value_name: &str,
@@ -742,7 +740,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
 
     fn suggest_cloning(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         ty: Ty<'tcx>,
         expr: &hir::Expr<'_>,
         span: Span,
@@ -778,7 +776,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
         }
     }
 
-    fn suggest_adding_copy_bounds(&self, err: &mut Diagnostic, ty: Ty<'tcx>, span: Span) {
+    fn suggest_adding_copy_bounds(
+        &self,
+        err: &mut DiagnosticBuilder<'_>,
+        ty: Ty<'tcx>,
+        span: Span,
+    ) {
         let tcx = self.infcx.tcx;
         let generics = tcx.generics_of(self.mir_def_id());
 
@@ -1225,7 +1228,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
     #[instrument(level = "debug", skip(self, err))]
     fn suggest_using_local_if_applicable(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         location: Location,
         issued_borrow: &BorrowData<'tcx>,
         explanation: BorrowExplanation<'tcx>,
@@ -1321,7 +1324,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
 
     fn suggest_slice_method_if_applicable(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         place: Place<'tcx>,
         borrowed_place: Place<'tcx>,
     ) {
@@ -1430,7 +1433,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
     /// ```
     pub(crate) fn explain_iterator_advancement_in_for_loop_if_applicable(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         issued_spans: &UseSpans<'tcx>,
     ) {
@@ -1617,7 +1620,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
     /// ```
     fn suggest_using_closure_argument_instead_of_capture(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         borrowed_place: Place<'tcx>,
         issued_spans: &UseSpans<'tcx>,
     ) {
@@ -1751,7 +1754,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
 
     fn suggest_binding_for_closure_capture_self(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         issued_spans: &UseSpans<'tcx>,
     ) {
         let UseSpans::ClosureUse { capture_kind_span, .. } = issued_spans else { return };
@@ -2997,7 +3000,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
         self.buffer_error(err);
     }
 
-    fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut Diagnostic) {
+    fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut DiagnosticBuilder<'_>) {
         let tcx = self.infcx.tcx;
         if let (
             Some(Terminator {
@@ -3532,7 +3535,11 @@ enum AnnotatedBorrowFnSignature<'tcx> {
 impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
     /// Annotate the provided diagnostic with information about borrow from the fn signature that
     /// helps explain.
-    pub(crate) fn emit(&self, cx: &mut MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diagnostic) -> String {
+    pub(crate) fn emit(
+        &self,
+        cx: &mut MirBorrowckCtxt<'_, 'tcx>,
+        diag: &mut DiagnosticBuilder<'_>,
+    ) -> String {
         match self {
             &AnnotatedBorrowFnSignature::Closure { argument_ty, argument_span } => {
                 diag.span_label(
diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
index 483ecee850b..f7b59ec5fe0 100644
--- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
@@ -3,7 +3,7 @@
 #![allow(rustc::diagnostic_outside_of_impl)]
 #![allow(rustc::untranslatable_diagnostic)]
 
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir as hir;
 use rustc_hir::intravisit::Visitor;
 use rustc_index::IndexSlice;
@@ -65,7 +65,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
         tcx: TyCtxt<'tcx>,
         body: &Body<'tcx>,
         local_names: &IndexSlice<Local, Option<Symbol>>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         borrow_desc: &str,
         borrow_span: Option<Span>,
         multiple_borrow_span: Option<(Span, Span)>,
@@ -306,7 +306,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
     fn add_object_lifetime_default_note(
         &self,
         tcx: TyCtxt<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         unsize_ty: Ty<'tcx>,
     ) {
         if let ty::Adt(def, args) = unsize_ty.kind() {
@@ -359,7 +359,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
 
     fn add_lifetime_bound_suggestion_to_diagnostic(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         category: &ConstraintCategory<'tcx>,
         span: Span,
         region_name: &RegionName,
diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs
index 4ca854c857d..db0d69b6eaa 100644
--- a/compiler/rustc_borrowck/src/diagnostics/mod.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs
@@ -5,7 +5,7 @@ use crate::session_diagnostics::{
     CaptureVarKind, CaptureVarPathUseCause, OnClosureNote,
 };
 use itertools::Itertools;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir as hir;
 use rustc_hir::def::{CtorKind, Namespace};
 use rustc_hir::CoroutineKind;
@@ -80,7 +80,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
         &self,
         location: Location,
         place: PlaceRef<'tcx>,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
     ) -> bool {
         debug!("add_moved_or_invoked_closure_note: location={:?} place={:?}", location, place);
         let mut target = place.local_or_deref_local();
@@ -588,7 +588,7 @@ impl UseSpans<'_> {
     pub(super) fn args_subdiag(
         self,
         dcx: &rustc_errors::DiagCtxt,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         f: impl FnOnce(Span) -> CaptureArgLabel,
     ) {
         if let UseSpans::ClosureUse { args_span, .. } = self {
@@ -601,7 +601,7 @@ impl UseSpans<'_> {
     pub(super) fn var_path_only_subdiag(
         self,
         dcx: &rustc_errors::DiagCtxt,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         action: crate::InitializationRequiringAction,
     ) {
         use crate::InitializationRequiringAction::*;
@@ -638,7 +638,7 @@ impl UseSpans<'_> {
     pub(super) fn var_subdiag(
         self,
         dcx: &rustc_errors::DiagCtxt,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         kind: Option<rustc_middle::mir::BorrowKind>,
         f: impl FnOnce(hir::ClosureKind, Span) -> CaptureVarCause,
     ) {
@@ -1010,7 +1010,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
 
     fn explain_captures(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         move_span: Span,
         move_spans: UseSpans<'tcx>,
diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
index dad20690d02..3478a73254a 100644
--- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
@@ -1,7 +1,7 @@
 #![allow(rustc::diagnostic_outside_of_impl)]
 #![allow(rustc::untranslatable_diagnostic)]
 
-use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_middle::mir::*;
 use rustc_middle::ty::{self, Ty};
 use rustc_mir_dataflow::move_paths::{LookupResult, MovePathIndex};
@@ -437,7 +437,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
         err
     }
 
-    fn add_move_hints(&self, error: GroupedMoveError<'tcx>, err: &mut Diagnostic, span: Span) {
+    fn add_move_hints(
+        &self,
+        error: GroupedMoveError<'tcx>,
+        err: &mut DiagnosticBuilder<'_>,
+        span: Span,
+    ) {
         match error {
             GroupedMoveError::MovesFromPlace { mut binds_to, move_from, .. } => {
                 self.add_borrow_suggestions(err, span);
@@ -500,7 +505,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
         }
     }
 
-    fn add_borrow_suggestions(&self, err: &mut Diagnostic, span: Span) {
+    fn add_borrow_suggestions(&self, err: &mut DiagnosticBuilder<'_>, span: Span) {
         match self.infcx.tcx.sess.source_map().span_to_snippet(span) {
             Ok(snippet) if snippet.starts_with('*') => {
                 err.span_suggestion_verbose(
@@ -521,7 +526,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
         }
     }
 
-    fn add_move_error_suggestions(&self, err: &mut Diagnostic, binds_to: &[Local]) {
+    fn add_move_error_suggestions(&self, err: &mut DiagnosticBuilder<'_>, binds_to: &[Local]) {
         let mut suggestions: Vec<(Span, String, String)> = Vec::new();
         for local in binds_to {
             let bind_to = &self.body.local_decls[*local];
@@ -573,7 +578,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
         }
     }
 
-    fn add_move_error_details(&self, err: &mut Diagnostic, binds_to: &[Local]) {
+    fn add_move_error_details(&self, err: &mut DiagnosticBuilder<'_>, binds_to: &[Local]) {
         for (j, local) in binds_to.iter().enumerate() {
             let bind_to = &self.body.local_decls[*local];
             let binding_span = bind_to.source_info.span;
@@ -610,7 +615,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
     /// expansion of a packed struct.
     /// Such errors happen because derive macro expansions shy away from taking
     /// references to the struct's fields since doing so would be undefined behaviour
-    fn add_note_for_packed_struct_derive(&self, err: &mut Diagnostic, local: Local) {
+    fn add_note_for_packed_struct_derive(&self, err: &mut DiagnosticBuilder<'_>, local: Local) {
         let local_place: PlaceRef<'tcx> = local.into();
         let local_ty = local_place.ty(self.body.local_decls(), self.infcx.tcx).ty.peel_refs();
 
diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
index 514e9c39eb4..b8257ba0adc 100644
--- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
@@ -2,7 +2,7 @@
 #![allow(rustc::untranslatable_diagnostic)]
 
 use hir::ExprKind;
-use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir as hir;
 use rustc_hir::intravisit::Visitor;
 use rustc_hir::Node;
@@ -540,7 +540,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
         }
     }
 
-    fn suggest_map_index_mut_alternatives(&self, ty: Ty<'tcx>, err: &mut Diagnostic, span: Span) {
+    fn suggest_map_index_mut_alternatives(
+        &self,
+        ty: Ty<'tcx>,
+        err: &mut DiagnosticBuilder<'tcx>,
+        span: Span,
+    ) {
         let Some(adt) = ty.ty_adt_def() else { return };
         let did = adt.did();
         if self.infcx.tcx.is_diagnostic_item(sym::HashMap, did)
@@ -548,7 +553,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
         {
             struct V<'a, 'tcx> {
                 assign_span: Span,
-                err: &'a mut Diagnostic,
+                err: &'a mut DiagnosticBuilder<'tcx>,
                 ty: Ty<'tcx>,
                 suggested: bool,
             }
@@ -790,7 +795,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
         tcx: TyCtxt<'_>,
         closure_local_def_id: hir::def_id::LocalDefId,
         the_place_err: PlaceRef<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) {
         let tables = tcx.typeck(closure_local_def_id);
         if let Some((span, closure_kind_origin)) = tcx.closure_kind_origin(closure_local_def_id) {
@@ -852,7 +857,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
 
     // Attempt to search similar mutable associated items for suggestion.
     // In the future, attempt in all path but initially for RHS of for_loop
-    fn suggest_similar_mut_method_for_for_loop(&self, err: &mut Diagnostic, span: Span) {
+    fn suggest_similar_mut_method_for_for_loop(&self, err: &mut DiagnosticBuilder<'_>, span: Span) {
         use hir::{
             BorrowKind, Expr,
             ExprKind::{AddrOf, Block, Call, MethodCall},
@@ -936,7 +941,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
     }
 
     /// Targeted error when encountering an `FnMut` closure where an `Fn` closure was expected.
-    fn expected_fn_found_fn_mut_call(&self, err: &mut Diagnostic, sp: Span, act: &str) {
+    fn expected_fn_found_fn_mut_call(&self, err: &mut DiagnosticBuilder<'_>, sp: Span, act: &str) {
         err.span_label(sp, format!("cannot {act}"));
 
         let hir = self.infcx.tcx.hir();
diff --git a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs
index 93e28a5f3f3..b2c7a98142e 100644
--- a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs
@@ -5,7 +5,7 @@
 #![allow(rustc::untranslatable_diagnostic)]
 
 use rustc_data_structures::fx::FxIndexSet;
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_middle::ty::RegionVid;
 use smallvec::SmallVec;
 use std::collections::BTreeMap;
@@ -158,13 +158,13 @@ impl OutlivesSuggestionBuilder {
         self.constraints_to_add.entry(fr).or_default().push(outlived_fr);
     }
 
-    /// Emit an intermediate note on the given `Diagnostic` if the involved regions are
+    /// Emit an intermediate note on the given `DiagnosticBuilder` if the involved regions are
     /// suggestable.
     pub(crate) fn intermediate_suggestion(
         &mut self,
         mbcx: &MirBorrowckCtxt<'_, '_>,
         errci: &ErrorConstraintInfo<'_>,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
     ) {
         // Emit an intermediate note.
         let fr_name = self.region_vid_to_name(mbcx, errci.fr);
diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs
index e8effd5c163..50d22881c3e 100644
--- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs
@@ -1,7 +1,7 @@
 //! Error reporting machinery for lifetime errors.
 
 use rustc_data_structures::fx::FxIndexSet;
-use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, MultiSpan};
+use rustc_errors::{Applicability, DiagnosticBuilder, MultiSpan};
 use rustc_hir as hir;
 use rustc_hir::def::Res::Def;
 use rustc_hir::def_id::DefId;
@@ -251,6 +251,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
 
         hrtb_bounds.iter().for_each(|bound| {
             let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }, _) = bound else { return; };
+            // FIXME: make this translatable
+            #[allow(rustc::diagnostic_outside_of_impl)]
+            #[allow(rustc::untranslatable_diagnostic)]
             diag.span_note(
                 *trait_span,
                 "due to current limitations in the borrow checker, this implies a `'static` lifetime"
@@ -421,6 +424,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
     /// ```
     ///
     /// Here we would be invoked with `fr = 'a` and `outlived_fr = 'b`.
+    // FIXME: make this translatable
+    #[allow(rustc::diagnostic_outside_of_impl)]
+    #[allow(rustc::untranslatable_diagnostic)]
     pub(crate) fn report_region_error(
         &mut self,
         fr: RegionVid,
@@ -685,12 +691,18 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
             borrowck_errors::borrowed_data_escapes_closure(self.infcx.tcx, *span, escapes_from);
 
         if let Some((Some(outlived_fr_name), outlived_fr_span)) = outlived_fr_name_and_span {
+            // FIXME: make this translatable
+            #[allow(rustc::diagnostic_outside_of_impl)]
+            #[allow(rustc::untranslatable_diagnostic)]
             diag.span_label(
                 outlived_fr_span,
                 format!("`{outlived_fr_name}` declared here, outside of the {escapes_from} body",),
             );
         }
 
+        // FIXME: make this translatable
+        #[allow(rustc::diagnostic_outside_of_impl)]
+        #[allow(rustc::untranslatable_diagnostic)]
         if let Some((Some(fr_name), fr_span)) = fr_name_and_span {
             diag.span_label(
                 fr_span,
@@ -714,6 +726,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
                 let outlived_fr_region_name = self.give_region_a_name(errci.outlived_fr).unwrap();
                 outlived_fr_region_name.highlight_region_name(&mut diag);
 
+                // FIXME: make this translatable
+                #[allow(rustc::diagnostic_outside_of_impl)]
+                #[allow(rustc::untranslatable_diagnostic)]
                 diag.span_label(
                     *span,
                     format!(
@@ -808,7 +823,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
     /// ```
     fn add_static_impl_trait_suggestion(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         fr: RegionVid,
         // We need to pass `fr_name` - computing it again will label it twice.
         fr_name: RegionName,
@@ -897,7 +912,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
 
     fn maybe_suggest_constrain_dyn_trait_impl(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         f: Region<'tcx>,
         o: Region<'tcx>,
         category: &ConstraintCategory<'tcx>,
@@ -959,7 +974,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
     #[instrument(skip(self, err), level = "debug")]
     fn suggest_constrain_dyn_trait_in_impl(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         found_dids: &FxIndexSet<DefId>,
         ident: Ident,
         self_ty: &hir::Ty<'_>,
@@ -994,7 +1009,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
 
     fn suggest_adding_lifetime_params(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         sub: RegionVid,
         sup: RegionVid,
     ) {
@@ -1023,7 +1038,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
         suggest_adding_lifetime_params(self.infcx.tcx, sub, ty_sup, ty_sub, diag);
     }
 
-    fn suggest_move_on_borrowing_closure(&self, diag: &mut Diagnostic) {
+    fn suggest_move_on_borrowing_closure(&self, diag: &mut DiagnosticBuilder<'_>) {
         let map = self.infcx.tcx.hir();
         let body_id = map.body_owned_by(self.mir_def_id());
         let expr = &map.body(body_id).value.peel_blocks();
diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs
index e008d230656..5b235066ea6 100644
--- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs
@@ -5,7 +5,7 @@ use std::fmt::{self, Display};
 use std::iter;
 
 use rustc_data_structures::fx::IndexEntry;
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
 use rustc_middle::ty::print::RegionHighlightMode;
@@ -106,7 +106,7 @@ impl RegionName {
         }
     }
 
-    pub(crate) fn highlight_region_name(&self, diag: &mut Diagnostic) {
+    pub(crate) fn highlight_region_name(&self, diag: &mut DiagnosticBuilder<'_>) {
         match &self.source {
             RegionNameSource::NamedLateParamRegion(span)
             | RegionNameSource::NamedEarlyParamRegion(span) => {
diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs
index 6c2a511538d..dbaa9e5bcfa 100644
--- a/compiler/rustc_borrowck/src/lib.rs
+++ b/compiler/rustc_borrowck/src/lib.rs
@@ -2497,6 +2497,8 @@ mod diags {
             }
             for (_, (mut diag, count)) in std::mem::take(&mut self.diags.buffered_mut_errors) {
                 if count > 10 {
+                    #[allow(rustc::diagnostic_outside_of_impl)]
+                    #[allow(rustc::untranslatable_diagnostic)]
                     diag.note(format!("...and {} other attempted mutable borrows", count - 10));
                 }
                 self.diags.buffered_diags.push(BufferedDiag::Error(diag));
diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs
index 34d60fc8f6e..ce2c0dbaff7 100644
--- a/compiler/rustc_borrowck/src/region_infer/mod.rs
+++ b/compiler/rustc_borrowck/src/region_infer/mod.rs
@@ -5,7 +5,7 @@ use rustc_data_structures::binary_search_util;
 use rustc_data_structures::frozen::Frozen;
 use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
 use rustc_data_structures::graph::scc::Sccs;
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_hir::def_id::CRATE_DEF_ID;
 use rustc_index::{IndexSlice, IndexVec};
 use rustc_infer::infer::outlives::test_type_match;
@@ -592,7 +592,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
     }
 
     /// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`.
-    pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diagnostic) {
+    pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut DiagnosticBuilder<'_, ()>) {
         self.universal_regions.annotate(tcx, err)
     }
 
diff --git a/compiler/rustc_borrowck/src/type_check/canonical.rs b/compiler/rustc_borrowck/src/type_check/canonical.rs
index fc600af1b76..e5ebf97cfc4 100644
--- a/compiler/rustc_borrowck/src/type_check/canonical.rs
+++ b/compiler/rustc_borrowck/src/type_check/canonical.rs
@@ -100,7 +100,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
         locations: Locations,
     ) {
         for (predicate, span) in instantiated_predicates {
-            debug!(?predicate);
+            debug!(?span, ?predicate);
             let category = ConstraintCategory::Predicate(span);
             let predicate = self.normalize_with_category(predicate, locations, category);
             self.prove_predicate(predicate, locations, category);
diff --git a/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs b/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
index c97e3170166..de75a9857f8 100644
--- a/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
+++ b/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
@@ -8,7 +8,7 @@ use rustc_middle::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, Const
 use rustc_middle::traits::query::NoSolution;
 use rustc_middle::traits::ObligationCause;
 use rustc_middle::ty::{self, GenericArgKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
-use rustc_span::{Span, DUMMY_SP};
+use rustc_span::Span;
 use rustc_trait_selection::solve::deeply_normalize;
 use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
 use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
@@ -183,7 +183,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
 
                         // we don't actually use this for anything, but
                         // the `TypeOutlives` code needs an origin.
-                        let origin = infer::RelateParamBound(DUMMY_SP, t1, None);
+                        let origin = infer::RelateParamBound(self.span, t1, None);
 
                         TypeOutlives::new(
                             &mut *self,
diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
index 2e0caf44819..356f0024c07 100644
--- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
+++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
@@ -10,7 +10,7 @@ use rustc_middle::mir::ConstraintCategory;
 use rustc_middle::traits::query::OutlivesBound;
 use rustc_middle::traits::ObligationCause;
 use rustc_middle::ty::{self, RegionVid, Ty, TypeVisitableExt};
-use rustc_span::{ErrorGuaranteed, DUMMY_SP};
+use rustc_span::{ErrorGuaranteed, Span};
 use rustc_trait_selection::solve::deeply_normalize;
 use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt;
 use rustc_trait_selection::traits::query::type_op::{self, TypeOp};
@@ -269,7 +269,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
             debug!("build: input_or_output={:?}", ty);
             // We add implied bounds from both the unnormalized and normalized ty.
             // See issue #87748
-            let constraints_unnorm = self.add_implied_bounds(ty);
+            let constraints_unnorm = self.add_implied_bounds(ty, span);
             if let Some(c) = constraints_unnorm {
                 constraints.push(c)
             }
@@ -299,7 +299,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
             // ```
             // Both &Self::Bar and &() are WF
             if ty != norm_ty {
-                let constraints_norm = self.add_implied_bounds(norm_ty);
+                let constraints_norm = self.add_implied_bounds(norm_ty, span);
                 if let Some(c) = constraints_norm {
                     constraints.push(c)
                 }
@@ -323,7 +323,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
 
                 // We currently add implied bounds from the normalized ty only.
                 // This is more conservative and matches wfcheck behavior.
-                let c = self.add_implied_bounds(norm_ty);
+                let c = self.add_implied_bounds(norm_ty, span);
                 constraints.extend(c);
             }
         }
@@ -361,11 +361,15 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
     /// the same time, compute and add any implied bounds that come
     /// from this local.
     #[instrument(level = "debug", skip(self))]
-    fn add_implied_bounds(&mut self, ty: Ty<'tcx>) -> Option<&'tcx QueryRegionConstraints<'tcx>> {
+    fn add_implied_bounds(
+        &mut self,
+        ty: Ty<'tcx>,
+        span: Span,
+    ) -> Option<&'tcx QueryRegionConstraints<'tcx>> {
         let TypeOpOutput { output: bounds, constraints, .. } = self
             .param_env
             .and(type_op::implied_outlives_bounds::ImpliedOutlivesBounds { ty })
-            .fully_perform(self.infcx, DUMMY_SP)
+            .fully_perform(self.infcx, span)
             .map_err(|_: ErrorGuaranteed| debug!("failed to compute implied bounds {:?}", ty))
             .ok()?;
         debug!(?bounds, ?constraints);
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index 64469727d0d..f96c2cbd8c0 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -37,7 +37,7 @@ use rustc_mir_dataflow::points::DenseLocationMap;
 use rustc_span::def_id::CRATE_DEF_ID;
 use rustc_span::source_map::Spanned;
 use rustc_span::symbol::sym;
-use rustc_span::{Span, DUMMY_SP};
+use rustc_span::Span;
 use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
 use rustc_trait_selection::traits::query::type_op::custom::scrape_region_constraints;
 use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
@@ -1014,7 +1014,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
     ) -> Self {
         let mut checker = Self {
             infcx,
-            last_span: DUMMY_SP,
+            last_span: body.span,
             body,
             user_type_annotations: &body.user_type_annotations,
             param_env,
@@ -2766,7 +2766,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                 self.param_env,
                 self.known_type_outlives_obligations,
                 locations,
-                DUMMY_SP,                   // irrelevant; will be overridden.
+                self.body.span,             // irrelevant; will be overridden.
                 ConstraintCategory::Boring, // same as above.
                 self.borrowck_context.constraints,
             )
diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs
index ee0bd13109b..a60175d9896 100644
--- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs
+++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs
@@ -143,22 +143,6 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
         reg
     }
 
-    #[instrument(skip(self), level = "debug")]
-    fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
-        let reg = self.type_checker.infcx.next_nll_region_var_in_universe(
-            NllRegionVariableOrigin::Existential { from_forall: false },
-            universe,
-        );
-
-        if cfg!(debug_assertions) {
-            let mut var_to_origin = self.type_checker.infcx.reg_var_to_origin.borrow_mut();
-            let prev = var_to_origin.insert(reg.as_var(), RegionCtxt::Existential(None));
-            assert_eq!(prev, None);
-        }
-
-        reg
-    }
-
     fn push_outlives(
         &mut self,
         sup: ty::Region<'tcx>,
diff --git a/compiler/rustc_borrowck/src/universal_regions.rs b/compiler/rustc_borrowck/src/universal_regions.rs
index a69f5335f71..e7439481034 100644
--- a/compiler/rustc_borrowck/src/universal_regions.rs
+++ b/compiler/rustc_borrowck/src/universal_regions.rs
@@ -16,7 +16,7 @@
 #![allow(rustc::untranslatable_diagnostic)]
 
 use rustc_data_structures::fx::FxIndexMap;
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_hir::lang_items::LangItem;
 use rustc_hir::BodyOwnerKind;
@@ -343,7 +343,7 @@ impl<'tcx> UniversalRegions<'tcx> {
     /// that this region imposes on others. The methods in this file
     /// handle the part about dumping the inference context internal
     /// state.
-    pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diagnostic) {
+    pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut DiagnosticBuilder<'_, ()>) {
         match self.defining_ty {
             DefiningTy::Closure(def_id, args) => {
                 let v = with_no_trimmed_paths!(
diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs
index 8d2e06bf30d..f304a37be85 100644
--- a/compiler/rustc_builtin_macros/src/errors.rs
+++ b/compiler/rustc_builtin_macros/src/errors.rs
@@ -1,6 +1,6 @@
 use rustc_errors::{
-    codes::*, AddToDiagnostic, DiagCtxt, Diagnostic, DiagnosticBuilder, EmissionGuarantee,
-    IntoDiagnostic, Level, MultiSpan, SingleLabelManySpans, SubdiagnosticMessageOp,
+    codes::*, AddToDiagnostic, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic,
+    Level, MultiSpan, SingleLabelManySpans, SubdiagnosticMessageOp,
 };
 use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_span::{symbol::Ident, Span, Symbol};
@@ -611,7 +611,11 @@ pub(crate) struct FormatUnusedArg {
 // Allow the singular form to be a subdiagnostic of the multiple-unused
 // form of diagnostic.
 impl AddToDiagnostic for FormatUnusedArg {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         diag.arg("named", self.named);
         let msg = f(diag, crate::fluent_generated::builtin_macros_format_unused_arg.into());
         diag.span_label(self.span, msg);
diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml
index c4aaf421444..e144b1dc1bd 100644
--- a/compiler/rustc_codegen_ssa/Cargo.toml
+++ b/compiler/rustc_codegen_ssa/Cargo.toml
@@ -51,5 +51,5 @@ default-features = false
 features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write"]
 
 [target.'cfg(windows)'.dependencies.windows]
-version = "0.48.0"
+version = "0.52.0"
 features = ["Win32_Globalization"]
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index 24fdd013509..7a981217b52 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -1856,9 +1856,7 @@ impl SharedEmitterMain {
                 Ok(SharedEmitterMessage::Diagnostic(diag)) => {
                     let dcx = sess.dcx();
                     let mut d = rustc_errors::Diagnostic::new_with_messages(diag.lvl, diag.msgs);
-                    if let Some(code) = diag.code {
-                        d.code(code);
-                    }
+                    d.code = diag.code; // may be `None`, that's ok
                     d.replace_args(diag.args);
                     dcx.emit_diagnostic(d);
                 }
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index a3c4734f0a3..26ef083219f 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -249,7 +249,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
         let secondary_errors = mem::take(&mut self.secondary_errors);
         if self.error_emitted.is_none() {
             for error in secondary_errors {
-                error.emit();
+                self.error_emitted = Some(error.emit());
             }
         } else {
             assert!(self.tcx.dcx().has_errors().is_some());
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
index 25ddd5e85f9..5b4bbf8510b 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
@@ -93,6 +93,9 @@ pub struct FnCallNonConst<'tcx> {
 }
 
 impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
+    // FIXME: make this translatable
+    #[allow(rustc::diagnostic_outside_of_impl)]
+    #[allow(rustc::untranslatable_diagnostic)]
     fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, _: Span) -> DiagnosticBuilder<'tcx> {
         let FnCallNonConst { caller, callee, args, span, call_source, feature } = *self;
         let ConstCx { tcx, param_env, .. } = *ccx;
@@ -321,6 +324,8 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
             .dcx()
             .create_err(errors::UnstableConstFn { span, def_path: ccx.tcx.def_path_str(def_id) });
 
+        // FIXME: make this translatable
+        #[allow(rustc::untranslatable_diagnostic)]
         if ccx.is_const_stable_const_fn() {
             err.help("const-stable functions can only call other const-stable functions");
         } else if ccx.tcx.sess.is_nightly_build() {
@@ -591,6 +596,8 @@ impl<'tcx> NonConstOp<'tcx> for StaticAccess {
             span,
             format!("referencing statics in {}s is unstable", ccx.const_kind(),),
         );
+        // FIXME: make this translatable
+        #[allow(rustc::untranslatable_diagnostic)]
         err
             .note("`static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.")
             .help("to fix this, the value can be extracted to a `const` and then used.");
diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml
index 0635d8552ae..80b6e72e49b 100644
--- a/compiler/rustc_data_structures/Cargo.toml
+++ b/compiler/rustc_data_structures/Cargo.toml
@@ -33,7 +33,7 @@ tracing = "0.1"
 version = "0.12"
 
 [target.'cfg(windows)'.dependencies.windows]
-version = "0.48.0"
+version = "0.52.0"
 features = [
     "Win32_Foundation",
     "Win32_Storage_FileSystem",
diff --git a/compiler/rustc_data_structures/src/flock/windows.rs b/compiler/rustc_data_structures/src/flock/windows.rs
index da128f464a6..9be1065135a 100644
--- a/compiler/rustc_data_structures/src/flock/windows.rs
+++ b/compiler/rustc_data_structures/src/flock/windows.rs
@@ -69,7 +69,6 @@ impl Lock {
                 &mut overlapped,
             )
         }
-        .ok()
         .map_err(|e| {
             let err = io::Error::from_raw_os_error(e.code().0);
             debug!("failed acquiring file lock: {}", err);
diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs
index e29d4811980..2569684df3f 100644
--- a/compiler/rustc_data_structures/src/profiling.rs
+++ b/compiler/rustc_data_structures/src/profiling.rs
@@ -866,16 +866,14 @@ cfg_match! {
             use std::mem;
 
             use windows::{
-                // FIXME: change back to K32GetProcessMemoryInfo when windows crate
-                // updated to 0.49.0+ to drop dependency on psapi.dll
-                Win32::System::ProcessStatus::{GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS},
+                Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS},
                 Win32::System::Threading::GetCurrentProcess,
             };
 
             let mut pmc = PROCESS_MEMORY_COUNTERS::default();
             let pmc_size = mem::size_of_val(&pmc);
             unsafe {
-                GetProcessMemoryInfo(
+                K32GetProcessMemoryInfo(
                     GetCurrentProcess(),
                     &mut pmc,
                     pmc_size as u32,
diff --git a/compiler/rustc_driver_impl/Cargo.toml b/compiler/rustc_driver_impl/Cargo.toml
index bfdd871455c..242aa06fe3e 100644
--- a/compiler/rustc_driver_impl/Cargo.toml
+++ b/compiler/rustc_driver_impl/Cargo.toml
@@ -60,7 +60,7 @@ libc = "0.2"
 # tidy-alphabetical-end
 
 [target.'cfg(windows)'.dependencies.windows]
-version = "0.48.0"
+version = "0.52.0"
 features = [
     "Win32_System_Diagnostics_Debug",
 ]
diff --git a/compiler/rustc_errors/Cargo.toml b/compiler/rustc_errors/Cargo.toml
index a2d1fd2a924..cc114fdcd8c 100644
--- a/compiler/rustc_errors/Cargo.toml
+++ b/compiler/rustc_errors/Cargo.toml
@@ -30,7 +30,7 @@ unicode-width = "0.1.4"
 # tidy-alphabetical-end
 
 [target.'cfg(windows)'.dependencies.windows]
-version = "0.48.0"
+version = "0.52.0"
 features = [
     "Win32_Foundation",
     "Win32_Security",
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 034636bea48..57610635ee6 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -12,6 +12,7 @@ use rustc_span::{Span, DUMMY_SP};
 use std::borrow::Cow;
 use std::fmt::{self, Debug};
 use std::hash::{Hash, Hasher};
+use std::ops::{Deref, DerefMut};
 use std::panic::Location;
 
 /// Error type for `Diagnostic`'s `suggestions` field, indicating that
@@ -71,17 +72,21 @@ where
     Self: Sized,
 {
     /// Add a subdiagnostic to an existing diagnostic.
-    fn add_to_diagnostic(self, diag: &mut Diagnostic) {
+    fn add_to_diagnostic<G: EmissionGuarantee>(self, diag: &mut DiagnosticBuilder<'_, G>) {
         self.add_to_diagnostic_with(diag, |_, m| m);
     }
 
     /// Add a subdiagnostic to an existing diagnostic where `f` is invoked on every message used
     /// (to optionally perform eager translation).
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F);
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    );
 }
 
-pub trait SubdiagnosticMessageOp =
-    Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage;
+pub trait SubdiagnosticMessageOp<G> =
+    Fn(&mut DiagnosticBuilder<'_, G>, SubdiagnosticMessage) -> SubdiagnosticMessage;
 
 /// Trait implemented by lint types. This should not be implemented manually. Instead, use
 /// `#[derive(LintDiagnostic)]` -- see [rustc_macros::LintDiagnostic].
@@ -93,6 +98,10 @@ pub trait DecorateLint<'a, G: EmissionGuarantee> {
     fn msg(&self) -> DiagnosticMessage;
 }
 
+/// The main part of a diagnostic. Note that `DiagnosticBuilder`, which wraps
+/// this type, is used for most operations, and should be used instead whenever
+/// possible. This type should only be used when `DiagnosticBuilder`'s lifetime
+/// causes difficulties, e.g. when storing diagnostics within `DiagCtxt`.
 #[must_use]
 #[derive(Clone, Debug, Encodable, Decodable)]
 pub struct Diagnostic {
@@ -289,6 +298,90 @@ impl Diagnostic {
         }
     }
 
+    // See comment on `DiagnosticBuilder::subdiagnostic_message_to_diagnostic_message`.
+    pub(crate) fn subdiagnostic_message_to_diagnostic_message(
+        &self,
+        attr: impl Into<SubdiagnosticMessage>,
+    ) -> DiagnosticMessage {
+        let msg =
+            self.messages.iter().map(|(msg, _)| msg).next().expect("diagnostic with no messages");
+        msg.with_subdiagnostic_message(attr.into())
+    }
+
+    pub(crate) fn sub(
+        &mut self,
+        level: Level,
+        message: impl Into<SubdiagnosticMessage>,
+        span: MultiSpan,
+    ) {
+        let sub = SubDiagnostic {
+            level,
+            messages: vec![(
+                self.subdiagnostic_message_to_diagnostic_message(message),
+                Style::NoStyle,
+            )],
+            span,
+        };
+        self.children.push(sub);
+    }
+
+    pub(crate) fn arg(&mut self, name: impl Into<DiagnosticArgName>, arg: impl IntoDiagnosticArg) {
+        self.args.insert(name.into(), arg.into_diagnostic_arg());
+    }
+
+    pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_>> {
+        self.args.iter()
+    }
+
+    pub fn replace_args(&mut self, args: FxIndexMap<DiagnosticArgName, DiagnosticArgValue>) {
+        self.args = args;
+    }
+}
+
+/// `DiagnosticBuilder` impls many `&mut self -> &mut Self` methods. Each one
+/// modifies an existing diagnostic, either in a standalone fashion, e.g.
+/// `err.code(code);`, or in a chained fashion to make multiple modifications,
+/// e.g. `err.code(code).span(span);`.
+///
+/// This macro creates an equivalent `self -> Self` method, with a `with_`
+/// prefix. This can be used in a chained fashion when making a new diagnostic,
+/// e.g. `let err = struct_err(msg).with_code(code);`, or emitting a new
+/// diagnostic, e.g. `struct_err(msg).with_code(code).emit();`.
+///
+/// Although the latter method can be used to modify an existing diagnostic,
+/// e.g. `err = err.with_code(code);`, this should be avoided because the former
+/// method gives shorter code, e.g. `err.code(code);`.
+///
+/// Note: the `with_` methods are added only when needed. If you want to use
+/// one and it's not defined, feel free to add it.
+///
+/// Note: any doc comments must be within the `with_fn!` call.
+macro_rules! with_fn {
+    {
+        $with_f:ident,
+        $(#[$attrs:meta])*
+        pub fn $f:ident(&mut $self:ident, $($name:ident: $ty:ty),* $(,)?) -> &mut Self {
+            $($body:tt)*
+        }
+    } => {
+        // The original function.
+        $(#[$attrs])*
+        #[doc = concat!("See [`DiagnosticBuilder::", stringify!($f), "()`].")]
+        pub fn $f(&mut $self, $($name: $ty),*) -> &mut Self {
+            $($body)*
+        }
+
+        // The `with_*` variant.
+        $(#[$attrs])*
+        #[doc = concat!("See [`DiagnosticBuilder::", stringify!($f), "()`].")]
+        pub fn $with_f(mut $self, $($name: $ty),*) -> Self {
+            $self.$f($($name),*);
+            $self
+        }
+    };
+}
+
+impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
     /// Delay emission of this diagnostic as a bug.
     ///
     /// This can be useful in contexts where an error indicates a bug but
@@ -309,6 +402,7 @@ impl Diagnostic {
         self.level = Level::DelayedBug;
     }
 
+    with_fn! { with_span_label,
     /// Appends a labeled span to the diagnostic.
     ///
     /// Labels are used to convey additional context for the diagnostic's primary span. They will
@@ -323,10 +417,12 @@ impl Diagnostic {
     /// primary.
     #[rustc_lint_diagnostics]
     pub fn span_label(&mut self, span: Span, label: impl Into<SubdiagnosticMessage>) -> &mut Self {
-        self.span.push_span_label(span, self.subdiagnostic_message_to_diagnostic_message(label));
+        let msg = self.subdiagnostic_message_to_diagnostic_message(label);
+        self.span.push_span_label(span, msg);
         self
-    }
+    } }
 
+    with_fn! { with_span_labels,
     /// Labels all the given spans with the provided label.
     /// See [`Self::span_label()`] for more information.
     pub fn span_labels(&mut self, spans: impl IntoIterator<Item = Span>, label: &str) -> &mut Self {
@@ -334,7 +430,7 @@ impl Diagnostic {
             self.span_label(span, label.to_string());
         }
         self
-    }
+    } }
 
     pub fn replace_span_with(&mut self, after: Span, keep_label: bool) -> &mut Self {
         let before = self.span.clone();
@@ -412,39 +508,40 @@ impl Diagnostic {
         self
     }
 
+    with_fn! { with_note,
     /// Add a note attached to this diagnostic.
     #[rustc_lint_diagnostics]
     pub fn note(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
         self.sub(Level::Note, msg, MultiSpan::new());
         self
-    }
+    } }
 
     fn highlighted_note(&mut self, msg: Vec<StringPart>) -> &mut Self {
         self.sub_with_highlights(Level::Note, msg, MultiSpan::new());
         self
     }
 
-    /// Prints the span with a note above it.
-    /// This is like [`Diagnostic::note()`], but it gets its own span.
+    /// This is like [`DiagnosticBuilder::note()`], but it's only printed once.
     pub fn note_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
         self.sub(Level::OnceNote, msg, MultiSpan::new());
         self
     }
 
+    with_fn! { with_span_note,
     /// Prints the span with a note above it.
-    /// This is like [`Diagnostic::note()`], but it gets its own span.
+    /// This is like [`DiagnosticBuilder::note()`], but it gets its own span.
     #[rustc_lint_diagnostics]
-    pub fn span_note<S: Into<MultiSpan>>(
+    pub fn span_note(
         &mut self,
-        sp: S,
+        sp: impl Into<MultiSpan>,
         msg: impl Into<SubdiagnosticMessage>,
     ) -> &mut Self {
         self.sub(Level::Note, msg, sp.into());
         self
-    }
+    } }
 
     /// Prints the span with a note above it.
-    /// This is like [`Diagnostic::note()`], but it gets its own span.
+    /// This is like [`DiagnosticBuilder::note_once()`], but it gets its own span.
     pub fn span_note_once<S: Into<MultiSpan>>(
         &mut self,
         sp: S,
@@ -454,15 +551,16 @@ impl Diagnostic {
         self
     }
 
+    with_fn! { with_warn,
     /// Add a warning attached to this diagnostic.
     #[rustc_lint_diagnostics]
     pub fn warn(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
         self.sub(Level::Warning, msg, MultiSpan::new());
         self
-    }
+    } }
 
     /// Prints the span with a warning above it.
-    /// This is like [`Diagnostic::warn()`], but it gets its own span.
+    /// This is like [`DiagnosticBuilder::warn()`], but it gets its own span.
     #[rustc_lint_diagnostics]
     pub fn span_warn<S: Into<MultiSpan>>(
         &mut self,
@@ -473,15 +571,15 @@ impl Diagnostic {
         self
     }
 
+    with_fn! { with_help,
     /// Add a help message attached to this diagnostic.
     #[rustc_lint_diagnostics]
     pub fn help(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
         self.sub(Level::Help, msg, MultiSpan::new());
         self
-    }
+    } }
 
-    /// Prints the span with a help above it.
-    /// This is like [`Diagnostic::help()`], but it gets its own span.
+    /// This is like [`DiagnosticBuilder::help()`], but it's only printed once.
     pub fn help_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
         self.sub(Level::OnceHelp, msg, MultiSpan::new());
         self
@@ -494,7 +592,7 @@ impl Diagnostic {
     }
 
     /// Prints the span with some help above it.
-    /// This is like [`Diagnostic::help()`], but it gets its own span.
+    /// This is like [`DiagnosticBuilder::help()`], but it gets its own span.
     #[rustc_lint_diagnostics]
     pub fn span_help<S: Into<MultiSpan>>(
         &mut self,
@@ -531,6 +629,7 @@ impl Diagnostic {
         }
     }
 
+    with_fn! { with_multipart_suggestion,
     /// Show a suggestion that has multiple parts to it.
     /// In other words, multiple changes need to be applied as part of this suggestion.
     pub fn multipart_suggestion(
@@ -545,7 +644,7 @@ impl Diagnostic {
             applicability,
             SuggestionStyle::ShowCode,
         )
-    }
+    } }
 
     /// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
     /// In other words, multiple changes need to be applied as part of this suggestion.
@@ -562,7 +661,8 @@ impl Diagnostic {
             SuggestionStyle::ShowAlways,
         )
     }
-    /// [`Diagnostic::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
+
+    /// [`DiagnosticBuilder::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
     pub fn multipart_suggestion_with_style(
         &mut self,
         msg: impl Into<SubdiagnosticMessage>,
@@ -619,6 +719,7 @@ impl Diagnostic {
         )
     }
 
+    with_fn! { with_span_suggestion,
     /// Prints out a message with a suggested edit of the code.
     ///
     /// In case of short messages and a simple suggestion, rustc displays it as a label:
@@ -651,9 +752,9 @@ impl Diagnostic {
             SuggestionStyle::ShowCode,
         );
         self
-    }
+    } }
 
-    /// [`Diagnostic::span_suggestion()`] but you can set the [`SuggestionStyle`].
+    /// [`DiagnosticBuilder::span_suggestion()`] but you can set the [`SuggestionStyle`].
     pub fn span_suggestion_with_style(
         &mut self,
         sp: Span,
@@ -677,6 +778,7 @@ impl Diagnostic {
         self
     }
 
+    with_fn! { with_span_suggestion_verbose,
     /// Always show the suggested change.
     pub fn span_suggestion_verbose(
         &mut self,
@@ -693,10 +795,11 @@ impl Diagnostic {
             SuggestionStyle::ShowAlways,
         );
         self
-    }
+    } }
 
+    with_fn! { with_span_suggestions,
     /// Prints out a message with multiple suggested edits of the code.
-    /// See also [`Diagnostic::span_suggestion()`].
+    /// See also [`DiagnosticBuilder::span_suggestion()`].
     pub fn span_suggestions(
         &mut self,
         sp: Span,
@@ -711,9 +814,8 @@ impl Diagnostic {
             applicability,
             SuggestionStyle::ShowCode,
         )
-    }
+    } }
 
-    /// [`Diagnostic::span_suggestions()`] but you can set the [`SuggestionStyle`].
     pub fn span_suggestions_with_style(
         &mut self,
         sp: Span,
@@ -743,7 +845,7 @@ impl Diagnostic {
 
     /// Prints out a message with multiple suggested edits of the code, where each edit consists of
     /// multiple parts.
-    /// See also [`Diagnostic::multipart_suggestion()`].
+    /// See also [`DiagnosticBuilder::multipart_suggestion()`].
     pub fn multipart_suggestions(
         &mut self,
         msg: impl Into<SubdiagnosticMessage>,
@@ -785,6 +887,7 @@ impl Diagnostic {
         self
     }
 
+    with_fn! { with_span_suggestion_short,
     /// Prints out a message with a suggested edit of the code. If the suggestion is presented
     /// inline, it will only show the message and not the suggestion.
     ///
@@ -804,7 +907,7 @@ impl Diagnostic {
             SuggestionStyle::HideCodeInline,
         );
         self
-    }
+    } }
 
     /// Prints out a message for a suggestion without showing the suggested code.
     ///
@@ -829,6 +932,7 @@ impl Diagnostic {
         self
     }
 
+    with_fn! { with_tool_only_span_suggestion,
     /// Adds a suggestion to the JSON output that will not be shown in the CLI.
     ///
     /// This is intended to be used for suggestions that are *very* obvious in what the changes
@@ -849,7 +953,7 @@ impl Diagnostic {
             SuggestionStyle::CompletelyHidden,
         );
         self
-    }
+    } }
 
     /// Add a subdiagnostic from a type that implements `Subdiagnostic` (see
     /// [rustc_macros::Subdiagnostic]). Performs eager translation of any translatable messages
@@ -868,45 +972,45 @@ impl Diagnostic {
         self
     }
 
-    pub fn span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self {
+    with_fn! { with_span,
+    /// Add a span.
+    pub fn span(&mut self, sp: impl Into<MultiSpan>) -> &mut Self {
         self.span = sp.into();
         if let Some(span) = self.span.primary_span() {
             self.sort_span = span;
         }
         self
-    }
+    } }
 
     pub fn is_lint(&mut self, name: String, has_future_breakage: bool) -> &mut Self {
         self.is_lint = Some(IsLint { name, has_future_breakage });
         self
     }
 
+    with_fn! { with_code,
+    /// Add an error code.
     pub fn code(&mut self, code: ErrCode) -> &mut Self {
         self.code = Some(code);
         self
-    }
+    } }
 
+    with_fn! { with_primary_message,
+    /// Add a primary message.
     pub fn primary_message(&mut self, msg: impl Into<DiagnosticMessage>) -> &mut Self {
         self.messages[0] = (msg.into(), Style::NoStyle);
         self
-    }
-
-    pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_>> {
-        self.args.iter()
-    }
+    } }
 
+    with_fn! { with_arg,
+    /// Add an argument.
     pub fn arg(
         &mut self,
         name: impl Into<DiagnosticArgName>,
         arg: impl IntoDiagnosticArg,
     ) -> &mut Self {
-        self.args.insert(name.into(), arg.into_diagnostic_arg());
+        self.deref_mut().arg(name, arg);
         self
-    }
-
-    pub fn replace_args(&mut self, args: FxIndexMap<DiagnosticArgName, DiagnosticArgValue>) {
-        self.args = args;
-    }
+    } }
 
     /// Helper function that takes a `SubdiagnosticMessage` and returns a `DiagnosticMessage` by
     /// combining it with the primary message of the diagnostic (if translatable, otherwise it just
@@ -915,9 +1019,7 @@ impl Diagnostic {
         &self,
         attr: impl Into<SubdiagnosticMessage>,
     ) -> DiagnosticMessage {
-        let msg =
-            self.messages.iter().map(|(msg, _)| msg).next().expect("diagnostic with no messages");
-        msg.with_subdiagnostic_message(attr.into())
+        self.deref().subdiagnostic_message_to_diagnostic_message(attr)
     }
 
     /// Convenience function for internal use, clients should use one of the
@@ -925,15 +1027,7 @@ impl Diagnostic {
     ///
     /// Used by `proc_macro_server` for implementing `server::Diagnostic`.
     pub fn sub(&mut self, level: Level, message: impl Into<SubdiagnosticMessage>, span: MultiSpan) {
-        let sub = SubDiagnostic {
-            level,
-            messages: vec![(
-                self.subdiagnostic_message_to_diagnostic_message(message),
-                Style::NoStyle,
-            )],
-            span,
-        };
-        self.children.push(sub);
+        self.deref_mut().sub(level, message, span);
     }
 
     /// Convenience function for internal use, clients should use one of the
@@ -946,7 +1040,9 @@ impl Diagnostic {
         let sub = SubDiagnostic { level, messages, span };
         self.children.push(sub);
     }
+}
 
+impl Diagnostic {
     /// Fields used for Hash, and PartialEq trait
     fn keys(
         &self,
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs
index 0572df69ca9..3a6a494af95 100644
--- a/compiler/rustc_errors/src/diagnostic_builder.rs
+++ b/compiler/rustc_errors/src/diagnostic_builder.rs
@@ -1,14 +1,8 @@
-use crate::diagnostic::IntoDiagnosticArg;
-use crate::{DiagCtxt, Level, MultiSpan, StashKey};
 use crate::{
-    Diagnostic, DiagnosticMessage, DiagnosticStyledString, ErrCode, ErrorGuaranteed, ExplicitBug,
-    SubdiagnosticMessage,
+    DiagCtxt, Diagnostic, DiagnosticMessage, ErrorGuaranteed, ExplicitBug, Level, StashKey,
 };
-use rustc_lint_defs::Applicability;
 use rustc_span::source_map::Spanned;
-
 use rustc_span::Span;
-use std::borrow::Cow;
 use std::fmt::{self, Debug};
 use std::marker::PhantomData;
 use std::ops::{Deref, DerefMut};
@@ -35,6 +29,11 @@ where
 }
 
 /// Used for emitting structured error messages and other diagnostic information.
+/// Wraps a `Diagnostic`, adding some useful things.
+/// - The `dcx` field, allowing it to (a) emit itself, and (b) do a drop check
+///   that it has been emitted or cancelled.
+/// - The `EmissionGuarantee`, which determines the type returned from `emit`.
+///
 /// Each constructed `DiagnosticBuilder` must be consumed by a function such as
 /// `emit`, `cancel`, `delay_as_bug`, or `into_diagnostic`. A panic occurrs if a
 /// `DiagnosticBuilder` is dropped without being consumed by one of these
@@ -56,9 +55,11 @@ pub struct DiagnosticBuilder<'a, G: EmissionGuarantee = ErrorGuaranteed> {
     /// often used as a return value, especially within the frequently-used
     /// `PResult` type. In theory, return value optimization (RVO) should avoid
     /// unnecessary copying. In practice, it does not (at the time of writing).
-    diag: Option<Box<Diagnostic>>,
+    // FIXME(nnethercote) Make private once this moves to diagnostic.rs.
+    pub(crate) diag: Option<Box<Diagnostic>>,
 
-    _marker: PhantomData<G>,
+    // FIXME(nnethercote) Make private once this moves to diagnostic.rs.
+    pub(crate) _marker: PhantomData<G>,
 }
 
 // Cloning a `DiagnosticBuilder` is a recipe for a diagnostic being emitted
@@ -88,18 +89,21 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
     /// Takes the diagnostic. For use by methods that consume the
     /// DiagnosticBuilder: `emit`, `cancel`, etc. Afterwards, `drop` is the
     /// only code that will be run on `self`.
-    fn take_diag(&mut self) -> Diagnostic {
+    // FIXME(nnethercote) Make private once this moves to diagnostic.rs.
+    pub(crate) fn take_diag(&mut self) -> Diagnostic {
         Box::into_inner(self.diag.take().unwrap())
     }
 
     /// Most `emit_producing_guarantee` functions use this as a starting point.
-    fn emit_producing_nothing(mut self) {
+    // FIXME(nnethercote) Make private once this moves to diagnostic.rs.
+    pub(crate) fn emit_producing_nothing(mut self) {
         let diag = self.take_diag();
         self.dcx.emit_diagnostic(diag);
     }
 
     /// `ErrorGuaranteed::emit_producing_guarantee` uses this.
-    fn emit_producing_error_guaranteed(mut self) -> ErrorGuaranteed {
+    // FIXME(nnethercote) Make private once this moves to diagnostic.rs.
+    pub(crate) fn emit_producing_error_guaranteed(mut self) -> ErrorGuaranteed {
         let diag = self.take_diag();
 
         // The only error levels that produce `ErrorGuaranteed` are
@@ -168,40 +172,6 @@ impl EmissionGuarantee for rustc_span::fatal_error::FatalError {
     }
 }
 
-/// `DiagnosticBuilder` impls `DerefMut`, which allows access to the fields and
-/// methods of the embedded `Diagnostic`. However, that doesn't allow method
-/// chaining at the `DiagnosticBuilder` level. Each use of this macro defines
-/// two builder methods at that level, both of which wrap the equivalent method
-/// in `Diagnostic`.
-/// - A `&mut self -> &mut Self` method, with the same name as the underlying
-///   `Diagnostic` method. It is mostly to modify existing diagnostics, either
-///   in a standalone fashion, e.g. `err.code(code)`, or in a chained fashion
-///   to make multiple modifications, e.g. `err.code(code).span(span)`.
-/// - A `self -> Self` method, which has a `with_` prefix added.
-///   It is mostly used in a chained fashion when producing a new diagnostic,
-///   e.g. `let err = struct_err(msg).with_code(code)`, or when emitting a new
-///   diagnostic , e.g. `struct_err(msg).with_code(code).emit()`.
-///
-/// Although the latter method can be used to modify an existing diagnostic,
-/// e.g. `err = err.with_code(code)`, this should be avoided because the former
-/// method gives shorter code, e.g. `err.code(code)`.
-macro_rules! forward {
-    (
-        ($f:ident, $with_f:ident)($($name:ident: $ty:ty),* $(,)?)
-    ) => {
-        #[doc = concat!("See [`Diagnostic::", stringify!($f), "()`].")]
-        pub fn $f(&mut self, $($name: $ty),*) -> &mut Self {
-            self.diag.as_mut().unwrap().$f($($name),*);
-            self
-        }
-        #[doc = concat!("See [`Diagnostic::", stringify!($f), "()`].")]
-        pub fn $with_f(mut self, $($name: $ty),*) -> Self {
-            self.diag.as_mut().unwrap().$f($($name),*);
-            self
-        }
-    };
-}
-
 impl<G: EmissionGuarantee> Deref for DiagnosticBuilder<'_, G> {
     type Target = Diagnostic;
 
@@ -278,135 +248,6 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
         self.downgrade_to_delayed_bug();
         self.emit()
     }
-
-    forward!((span_label, with_span_label)(
-        span: Span,
-        label: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((span_labels, with_span_labels)(
-        spans: impl IntoIterator<Item = Span>,
-        label: &str,
-    ));
-    forward!((note_expected_found, with_note_expected_found)(
-        expected_label: &dyn fmt::Display,
-        expected: DiagnosticStyledString,
-        found_label: &dyn fmt::Display,
-        found: DiagnosticStyledString,
-    ));
-    forward!((note_expected_found_extra, with_note_expected_found_extra)(
-        expected_label: &dyn fmt::Display,
-        expected: DiagnosticStyledString,
-        found_label: &dyn fmt::Display,
-        found: DiagnosticStyledString,
-        expected_extra: &dyn fmt::Display,
-        found_extra: &dyn fmt::Display,
-    ));
-    forward!((note, with_note)(
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((note_once, with_note_once)(
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((span_note, with_span_note)(
-        sp: impl Into<MultiSpan>,
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((span_note_once, with_span_note_once)(
-        sp: impl Into<MultiSpan>,
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((warn, with_warn)(
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((span_warn, with_span_warn)(
-        sp: impl Into<MultiSpan>,
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((help, with_help)(
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((help_once, with_help_once)(
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((span_help, with_span_help_once)(
-        sp: impl Into<MultiSpan>,
-        msg: impl Into<SubdiagnosticMessage>,
-    ));
-    forward!((multipart_suggestion, with_multipart_suggestion)(
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestion: Vec<(Span, String)>,
-        applicability: Applicability,
-    ));
-    forward!((multipart_suggestion_verbose, with_multipart_suggestion_verbose)(
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestion: Vec<(Span, String)>,
-        applicability: Applicability,
-    ));
-    forward!((tool_only_multipart_suggestion, with_tool_only_multipart_suggestion)(
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestion: Vec<(Span, String)>,
-        applicability: Applicability,
-    ));
-    forward!((span_suggestion, with_span_suggestion)(
-        sp: Span,
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestion: impl ToString,
-        applicability: Applicability,
-    ));
-    forward!((span_suggestions, with_span_suggestions)(
-        sp: Span,
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestions: impl IntoIterator<Item = String>,
-        applicability: Applicability,
-    ));
-    forward!((multipart_suggestions, with_multipart_suggestions)(
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestions: impl IntoIterator<Item = Vec<(Span, String)>>,
-        applicability: Applicability,
-    ));
-    forward!((span_suggestion_short, with_span_suggestion_short)(
-        sp: Span,
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestion: impl ToString,
-        applicability: Applicability,
-    ));
-    forward!((span_suggestion_verbose, with_span_suggestion_verbose)(
-        sp: Span,
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestion: impl ToString,
-        applicability: Applicability,
-    ));
-    forward!((span_suggestion_hidden, with_span_suggestion_hidden)(
-        sp: Span,
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestion: impl ToString,
-        applicability: Applicability,
-    ));
-    forward!((tool_only_span_suggestion, with_tool_only_span_suggestion)(
-        sp: Span,
-        msg: impl Into<SubdiagnosticMessage>,
-        suggestion: impl ToString,
-        applicability: Applicability,
-    ));
-    forward!((primary_message, with_primary_message)(
-        msg: impl Into<DiagnosticMessage>,
-    ));
-    forward!((span, with_span)(
-        sp: impl Into<MultiSpan>,
-    ));
-    forward!((is_lint, with_is_lint)(
-        name: String, has_future_breakage: bool,
-    ));
-    forward!((code, with_code)(
-        code: ErrCode,
-    ));
-    forward!((arg, with_arg)(
-        name: impl Into<Cow<'static, str>>, arg: impl IntoDiagnosticArg,
-    ));
-    forward!((subdiagnostic, with_subdiagnostic)(
-        dcx: &DiagCtxt,
-        subdiagnostic: impl crate::AddToDiagnostic,
-    ));
 }
 
 impl<G: EmissionGuarantee> Debug for DiagnosticBuilder<'_, G> {
diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs
index eaf75539f59..bc1e81642ff 100644
--- a/compiler/rustc_errors/src/diagnostic_impls.rs
+++ b/compiler/rustc_errors/src/diagnostic_impls.rs
@@ -299,7 +299,11 @@ pub struct SingleLabelManySpans {
     pub label: &'static str,
 }
 impl AddToDiagnostic for SingleLabelManySpans {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut crate::Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _: F,
+    ) {
         diag.span_labels(self.spans, self.label);
     }
 }
@@ -312,23 +316,6 @@ pub struct ExpectedLifetimeParameter {
     pub count: usize,
 }
 
-#[derive(Subdiagnostic)]
-#[note(errors_delayed_at_with_newline)]
-pub struct DelayedAtWithNewline {
-    #[primary_span]
-    pub span: Span,
-    pub emitted_at: DiagnosticLocation,
-    pub note: Backtrace,
-}
-#[derive(Subdiagnostic)]
-#[note(errors_delayed_at_without_newline)]
-pub struct DelayedAtWithoutNewline {
-    #[primary_span]
-    pub span: Span,
-    pub emitted_at: DiagnosticLocation,
-    pub note: Backtrace,
-}
-
 impl IntoDiagnosticArg for DiagnosticLocation {
     fn into_diagnostic_arg(self) -> DiagnosticArgValue {
         DiagnosticArgValue::Str(Cow::from(self.to_string()))
@@ -341,13 +328,6 @@ impl IntoDiagnosticArg for Backtrace {
     }
 }
 
-#[derive(Subdiagnostic)]
-#[note(errors_invalid_flushed_delayed_diagnostic_level)]
-pub struct InvalidFlushedDelayedDiagnosticLevel {
-    #[primary_span]
-    pub span: Span,
-    pub level: Level,
-}
 impl IntoDiagnosticArg for Level {
     fn into_diagnostic_arg(self) -> DiagnosticArgValue {
         DiagnosticArgValue::Str(Cow::from(self.to_string()))
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index e09c041c1d0..df94b69004b 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -599,7 +599,7 @@ impl Emitter for SilentEmitter {
 
     fn emit_diagnostic(&mut self, mut diag: Diagnostic) {
         if diag.level == Level::Fatal {
-            diag.note(self.fatal_note.clone());
+            diag.sub(Level::Note, self.fatal_note.clone(), MultiSpan::new());
             self.fatal_dcx.emit_diagnostic(diag);
         }
     }
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index 064ea8d7516..73cda64f1cc 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -46,7 +46,7 @@ pub use diagnostic_builder::{
 };
 pub use diagnostic_impls::{
     DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter,
-    IndicateAnonymousLifetime, InvalidFlushedDelayedDiagnosticLevel, SingleLabelManySpans,
+    IndicateAnonymousLifetime, SingleLabelManySpans,
 };
 pub use emitter::ColorConfig;
 pub use rustc_error_messages::{
@@ -62,7 +62,6 @@ pub use snippet::Style;
 // See https://github.com/rust-lang/rust/pull/115393.
 pub use termcolor::{Color, ColorSpec, WriteColor};
 
-use crate::diagnostic_impls::{DelayedAtWithNewline, DelayedAtWithoutNewline};
 use emitter::{is_case_difference, DynEmitter, Emitter, HumanEmitter};
 use registry::Registry;
 use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
@@ -1395,9 +1394,8 @@ impl DiagCtxtInner {
                 };
                 diagnostic.children.extract_if(already_emitted_sub).for_each(|_| {});
                 if already_emitted {
-                    diagnostic.note(
-                        "duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`",
-                    );
+                    let msg = "duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`";
+                    diagnostic.sub(Level::Note, msg, MultiSpan::new());
                 }
 
                 if is_error {
@@ -1483,6 +1481,16 @@ impl DiagCtxtInner {
         self.emitter.translate_message(&message, &args).map_err(Report::new).unwrap().to_string()
     }
 
+    fn eagerly_translate_for_subdiag(
+        &self,
+        diag: &Diagnostic,
+        msg: impl Into<SubdiagnosticMessage>,
+    ) -> SubdiagnosticMessage {
+        let args = diag.args();
+        let msg = diag.subdiagnostic_message_to_diagnostic_message(msg);
+        self.eagerly_translate(msg, args)
+    }
+
     fn flush_delayed(&mut self) {
         if self.delayed_bugs.is_empty() {
             return;
@@ -1527,17 +1535,14 @@ impl DiagCtxtInner {
             if bug.level != DelayedBug {
                 // NOTE(eddyb) not panicking here because we're already producing
                 // an ICE, and the more information the merrier.
-                let subdiag = InvalidFlushedDelayedDiagnosticLevel {
-                    span: bug.span.primary_span().unwrap(),
-                    level: bug.level,
-                };
-                // FIXME: Cannot use `Diagnostic::subdiagnostic` which takes `DiagCtxt`, but it
-                // just uses `DiagCtxtInner` functions.
-                subdiag.add_to_diagnostic_with(&mut bug, |diag, msg| {
-                    let args = diag.args();
-                    let msg = diag.subdiagnostic_message_to_diagnostic_message(msg);
-                    self.eagerly_translate(msg, args)
-                });
+                //
+                // We are at the `Diagnostic`/`DiagCtxtInner` level rather than
+                // the usual `DiagnosticBuilder`/`DiagCtxt` level, so we must
+                // augment `bug` in a lower-level fashion.
+                bug.arg("level", bug.level);
+                let msg = crate::fluent_generated::errors_invalid_flushed_delayed_diagnostic_level;
+                let msg = self.eagerly_translate_for_subdiag(&bug, msg); // after the `arg` call
+                bug.sub(Level::Note, msg, bug.span.primary_span().unwrap().into());
             }
             bug.level = Bug;
 
@@ -1571,39 +1576,22 @@ impl DelayedDiagnostic {
         DelayedDiagnostic { inner: diagnostic, note: backtrace }
     }
 
-    fn decorate(mut self, dcx: &DiagCtxtInner) -> Diagnostic {
-        // FIXME: Cannot use `Diagnostic::subdiagnostic` which takes `DiagCtxt`, but it
-        // just uses `DiagCtxtInner` functions.
-        let subdiag_with = |diag: &mut Diagnostic, msg| {
-            let args = diag.args();
-            let msg = diag.subdiagnostic_message_to_diagnostic_message(msg);
-            dcx.eagerly_translate(msg, args)
-        };
-
-        match self.note.status() {
-            BacktraceStatus::Captured => {
-                let inner = &self.inner;
-                let subdiag = DelayedAtWithNewline {
-                    span: inner.span.primary_span().unwrap_or(DUMMY_SP),
-                    emitted_at: inner.emitted_at.clone(),
-                    note: self.note,
-                };
-                subdiag.add_to_diagnostic_with(&mut self.inner, subdiag_with);
-            }
+    fn decorate(self, dcx: &DiagCtxtInner) -> Diagnostic {
+        // We are at the `Diagnostic`/`DiagCtxtInner` level rather than the
+        // usual `DiagnosticBuilder`/`DiagCtxt` level, so we must construct
+        // `diag` in a lower-level fashion.
+        let mut diag = self.inner;
+        let msg = match self.note.status() {
+            BacktraceStatus::Captured => crate::fluent_generated::errors_delayed_at_with_newline,
             // Avoid the needless newline when no backtrace has been captured,
             // the display impl should just be a single line.
-            _ => {
-                let inner = &self.inner;
-                let subdiag = DelayedAtWithoutNewline {
-                    span: inner.span.primary_span().unwrap_or(DUMMY_SP),
-                    emitted_at: inner.emitted_at.clone(),
-                    note: self.note,
-                };
-                subdiag.add_to_diagnostic_with(&mut self.inner, subdiag_with);
-            }
-        }
-
-        self.inner
+            _ => crate::fluent_generated::errors_delayed_at_without_newline,
+        };
+        diag.arg("emitted_at", diag.emitted_at.clone());
+        diag.arg("note", self.note);
+        let msg = dcx.eagerly_translate_for_subdiag(&diag, msg); // after the `arg` calls
+        diag.sub(Level::Note, msg, diag.span.primary_span().unwrap_or(DUMMY_SP).into());
+        diag
     }
 }
 
@@ -1745,9 +1733,9 @@ impl Level {
 }
 
 // FIXME(eddyb) this doesn't belong here AFAICT, should be moved to callsite.
-pub fn add_elided_lifetime_in_path_suggestion<E: EmissionGuarantee>(
+pub fn add_elided_lifetime_in_path_suggestion<G: EmissionGuarantee>(
     source_map: &SourceMap,
-    diag: &mut DiagnosticBuilder<'_, E>,
+    diag: &mut DiagnosticBuilder<'_, G>,
     n: usize,
     path_span: Span,
     incl_angl_brckt: bool,
diff --git a/compiler/rustc_errors/src/lock.rs b/compiler/rustc_errors/src/lock.rs
index bd5cf49b56b..0aeb511214b 100644
--- a/compiler/rustc_errors/src/lock.rs
+++ b/compiler/rustc_errors/src/lock.rs
@@ -27,7 +27,8 @@ pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
     impl Drop for Handle {
         fn drop(&mut self) {
             unsafe {
-                CloseHandle(self.0);
+                // FIXME can panic here
+                CloseHandle(self.0).unwrap();
             }
         }
     }
@@ -37,7 +38,8 @@ pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
     impl Drop for Guard {
         fn drop(&mut self) {
             unsafe {
-                ReleaseMutex((self.0).0);
+                // FIXME can panic here
+                ReleaseMutex((self.0).0).unwrap();
             }
         }
     }
diff --git a/compiler/rustc_expand/messages.ftl b/compiler/rustc_expand/messages.ftl
index 3e3b4814300..5a3303327db 100644
--- a/compiler/rustc_expand/messages.ftl
+++ b/compiler/rustc_expand/messages.ftl
@@ -61,6 +61,11 @@ expand_invalid_cfg_multiple_predicates = multiple `cfg` predicates are specified
 expand_invalid_cfg_no_parens = `cfg` is not followed by parentheses
 expand_invalid_cfg_no_predicate = `cfg` predicate is not specified
 expand_invalid_cfg_predicate_literal = `cfg` predicate key cannot be a literal
+
+expand_invalid_fragment_specifier =
+    invalid fragment specifier `{$fragment}`
+    .help = {$help}
+
 expand_macro_body_stability =
     macros cannot have body stability attributes
     .label = invalid body stability attribute
diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs
index 09144523658..1c8d18bec65 100644
--- a/compiler/rustc_expand/src/base.rs
+++ b/compiler/rustc_expand/src/base.rs
@@ -96,7 +96,7 @@ impl Annotatable {
         }
     }
 
-    pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V) {
+    pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V) -> V::Result {
         match self {
             Annotatable::Item(item) => visitor.visit_item(item),
             Annotatable::TraitItem(item) => visitor.visit_assoc_item(item, AssocCtxt::Trait),
@@ -1176,6 +1176,8 @@ impl<'a> ExtCtxt<'a> {
         for (span, notes) in self.expansions.iter() {
             let mut db = self.dcx().create_note(errors::TraceMacro { span: *span });
             for note in notes {
+                // FIXME: make this translatable
+                #[allow(rustc::untranslatable_diagnostic)]
                 db.note(note.clone());
             }
             db.emit();
diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs
index 781186764fa..435135d1959 100644
--- a/compiler/rustc_expand/src/config.rs
+++ b/compiler/rustc_expand/src/config.rs
@@ -384,6 +384,7 @@ impl<'a> StripUnconfigured<'a> {
             );
 
             if attr.is_doc_comment() {
+                #[allow(rustc::untranslatable_diagnostic)]
                 err.help("`///` is for documentation comments. For a plain comment, use `//`.");
             }
 
diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs
index 2584ff62e98..929f3479466 100644
--- a/compiler/rustc_expand/src/errors.rs
+++ b/compiler/rustc_expand/src/errors.rs
@@ -408,3 +408,13 @@ pub struct DuplicateMatcherBinding {
     #[label(expand_label2)]
     pub prev: Span,
 }
+
+#[derive(Diagnostic)]
+#[diag(expand_invalid_fragment_specifier)]
+#[help]
+pub struct InvalidFragmentSpecifier {
+    #[primary_span]
+    pub span: Span,
+    pub fragment: Ident,
+    pub help: String,
+}
diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs
index 9c411be9ff9..2752d3ebd68 100644
--- a/compiler/rustc_expand/src/expand.rs
+++ b/compiler/rustc_expand/src/expand.rs
@@ -14,7 +14,8 @@ use rustc_ast::mut_visit::*;
 use rustc_ast::ptr::P;
 use rustc_ast::token::{self, Delimiter};
 use rustc_ast::tokenstream::TokenStream;
-use rustc_ast::visit::{self, AssocCtxt, Visitor};
+use rustc_ast::visit::{self, AssocCtxt, Visitor, VisitorResult};
+use rustc_ast::{try_visit, walk_list};
 use rustc_ast::{AssocItemKind, AstNodeWrapper, AttrArgs, AttrStyle, AttrVec, ExprKind};
 use rustc_ast::{ForeignItemKind, HasAttrs, HasNodeId};
 use rustc_ast::{Inline, ItemKind, MacStmtStyle, MetaItemKind, ModKind};
@@ -143,16 +144,15 @@ macro_rules! ast_fragments {
                 }
             }
 
-            pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V) {
+            pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V) -> V::Result {
                 match self {
-                    AstFragment::OptExpr(Some(expr)) => visitor.visit_expr(expr),
+                    AstFragment::OptExpr(Some(expr)) => try_visit!(visitor.visit_expr(expr)),
                     AstFragment::OptExpr(None) => {}
-                    AstFragment::MethodReceiverExpr(expr) => visitor.visit_method_receiver_expr(expr),
-                    $($(AstFragment::$Kind(ast) => visitor.$visit_ast(ast),)?)*
-                    $($(AstFragment::$Kind(ast) => for ast_elt in &ast[..] {
-                        visitor.$visit_ast_elt(ast_elt, $($args)*);
-                    })?)*
+                    AstFragment::MethodReceiverExpr(expr) => try_visit!(visitor.visit_method_receiver_expr(expr)),
+                    $($(AstFragment::$Kind(ast) => try_visit!(visitor.$visit_ast(ast)),)?)*
+                    $($(AstFragment::$Kind(ast) => walk_list!(visitor, $visit_ast_elt, &ast[..], $($args)*),)?)*
                 }
+                V::Result::output()
             }
         }
 
diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs
index 4da86d77dc8..0e73abc9ed8 100644
--- a/compiler/rustc_expand/src/lib.rs
+++ b/compiler/rustc_expand/src/lib.rs
@@ -6,6 +6,7 @@
 #![feature(if_let_guard)]
 #![feature(let_chains)]
 #![feature(macro_metavar_expr)]
+#![feature(map_try_insert)]
 #![feature(proc_macro_diagnostic)]
 #![feature(proc_macro_internals)]
 #![feature(proc_macro_span)]
diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs
index e7197c5768b..25af974d326 100644
--- a/compiler/rustc_expand/src/mbe/diagnostics.rs
+++ b/compiler/rustc_expand/src/mbe/diagnostics.rs
@@ -7,7 +7,7 @@ use crate::mbe::{
 use rustc_ast::token::{self, Token, TokenKind};
 use rustc_ast::tokenstream::TokenStream;
 use rustc_ast_pretty::pprust;
-use rustc_errors::{Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder, DiagnosticMessage};
+use rustc_errors::{Applicability, DiagCtxt, DiagnosticBuilder, DiagnosticMessage};
 use rustc_parse::parser::{Parser, Recovery};
 use rustc_span::source_map::SourceMap;
 use rustc_span::symbol::Ident;
@@ -285,7 +285,11 @@ pub(super) fn emit_frag_parse_err(
     e.emit();
 }
 
-pub(crate) fn annotate_err_with_kind(err: &mut Diagnostic, kind: AstFragmentKind, span: Span) {
+pub(crate) fn annotate_err_with_kind(
+    err: &mut DiagnosticBuilder<'_>,
+    kind: AstFragmentKind,
+    span: Span,
+) {
     match kind {
         AstFragmentKind::Ty => {
             err.span_label(span, "this macro call doesn't expand to a type");
@@ -313,7 +317,7 @@ enum ExplainDocComment {
 
 pub(super) fn annotate_doc_comment(
     dcx: &DiagCtxt,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     sm: &SourceMap,
     span: Span,
 ) {
diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs
index 4824b67d277..0fdfa563138 100644
--- a/compiler/rustc_expand/src/mbe/quoted.rs
+++ b/compiler/rustc_expand/src/mbe/quoted.rs
@@ -1,3 +1,4 @@
+use crate::errors;
 use crate::mbe::macro_parser::count_metavar_decls;
 use crate::mbe::{Delimited, KleeneOp, KleeneToken, MetaVarExpr, SequenceRepetition, TokenTree};
 
@@ -60,11 +61,11 @@ pub(super) fn parse(
                     Some(&tokenstream::TokenTree::Token(Token { kind: token::Colon, span }, _)) => {
                         match trees.next() {
                             Some(tokenstream::TokenTree::Token(token, _)) => match token.ident() {
-                                Some((frag, _)) => {
+                                Some((fragment, _)) => {
                                     let span = token.span.with_lo(start_sp.lo());
 
                                     let kind =
-                                        token::NonterminalKind::from_symbol(frag.name, || {
+                                        token::NonterminalKind::from_symbol(fragment.name, || {
                                             // FIXME(#85708) - once we properly decode a foreign
                                             // crate's `SyntaxContext::root`, then we can replace
                                             // this with just `span.edition()`. A
@@ -81,14 +82,13 @@ pub(super) fn parse(
                                         })
                                         .unwrap_or_else(
                                             || {
-                                                let msg = format!(
-                                                    "invalid fragment specifier `{}`",
-                                                    frag.name
+                                                sess.dcx().emit_err(
+                                                    errors::InvalidFragmentSpecifier {
+                                                        span,
+                                                        fragment,
+                                                        help: VALID_FRAGMENT_NAMES_MSG.into(),
+                                                    },
                                                 );
-                                                sess.dcx()
-                                                    .struct_span_err(span, msg)
-                                                    .with_help(VALID_FRAGMENT_NAMES_MSG)
-                                                    .emit();
                                                 token::NonterminalKind::Ident
                                             },
                                         );
diff --git a/compiler/rustc_expand/src/mbe/transcribe.rs b/compiler/rustc_expand/src/mbe/transcribe.rs
index 434891ebc76..519e4a634d8 100644
--- a/compiler/rustc_expand/src/mbe/transcribe.rs
+++ b/compiler/rustc_expand/src/mbe/transcribe.rs
@@ -13,7 +13,7 @@ use rustc_errors::DiagnosticBuilder;
 use rustc_errors::{pluralize, PResult};
 use rustc_span::hygiene::{LocalExpnId, Transparency};
 use rustc_span::symbol::{sym, Ident, MacroRulesNormalizedIdent};
-use rustc_span::{Span, SyntaxContext};
+use rustc_span::{with_metavar_spans, Span, SyntaxContext};
 
 use smallvec::{smallvec, SmallVec};
 use std::mem;
@@ -254,7 +254,8 @@ pub(super) fn transcribe<'a>(
                         MatchedTokenTree(tt) => {
                             // `tt`s are emitted into the output stream directly as "raw tokens",
                             // without wrapping them into groups.
-                            result.push(maybe_use_metavar_location(cx, &stack, sp, tt));
+                            let tt = maybe_use_metavar_location(cx, &stack, sp, tt, &mut marker);
+                            result.push(tt);
                         }
                         MatchedNonterminal(nt) => {
                             // Other variables are emitted into the output stream as groups with
@@ -319,6 +320,17 @@ pub(super) fn transcribe<'a>(
     }
 }
 
+/// Store the metavariable span for this original span into a side table.
+/// FIXME: Try to put the metavariable span into `SpanData` instead of a side table (#118517).
+/// An optimal encoding for inlined spans will need to be selected to minimize regressions.
+/// The side table approach is relatively good, but not perfect due to collisions.
+/// In particular, collisions happen when token is passed as an argument through several macro
+/// calls, like in recursive macros.
+/// The old heuristic below is used to improve spans in case of collisions, but diagnostics are
+/// still degraded sometimes in those cases.
+///
+/// The old heuristic:
+///
 /// Usually metavariables `$var` produce interpolated tokens, which have an additional place for
 /// keeping both the original span and the metavariable span. For `tt` metavariables that's not the
 /// case however, and there's no place for keeping a second span. So we try to give the single
@@ -338,15 +350,12 @@ pub(super) fn transcribe<'a>(
 ///   These are typically used for passing larger amounts of code, and tokens in that code usually
 ///   combine with each other and not with tokens outside of the sequence.
 /// - The metavariable span comes from a different crate, then we prefer the more local span.
-///
-/// FIXME: Find a way to keep both original and metavariable spans for all tokens without
-/// regressing compilation time too much. Several experiments for adding such spans were made in
-/// the past (PR #95580, #118517, #118671) and all showed some regressions.
 fn maybe_use_metavar_location(
     cx: &ExtCtxt<'_>,
     stack: &[Frame<'_>],
-    metavar_span: Span,
+    mut metavar_span: Span,
     orig_tt: &TokenTree,
+    marker: &mut Marker,
 ) -> TokenTree {
     let undelimited_seq = matches!(
         stack.last(),
@@ -357,18 +366,44 @@ fn maybe_use_metavar_location(
             ..
         })
     );
-    if undelimited_seq || cx.source_map().is_imported(metavar_span) {
+    if undelimited_seq {
+        // Do not record metavar spans for tokens from undelimited sequences, for perf reasons.
+        return orig_tt.clone();
+    }
+
+    let insert = |mspans: &mut FxHashMap<_, _>, s, ms| match mspans.try_insert(s, ms) {
+        Ok(_) => true,
+        Err(err) => *err.entry.get() == ms, // Tried to insert the same span, still success
+    };
+    marker.visit_span(&mut metavar_span);
+    let no_collision = match orig_tt {
+        TokenTree::Token(token, ..) => {
+            with_metavar_spans(|mspans| insert(mspans, token.span, metavar_span))
+        }
+        TokenTree::Delimited(dspan, ..) => with_metavar_spans(|mspans| {
+            insert(mspans, dspan.open, metavar_span)
+                && insert(mspans, dspan.close, metavar_span)
+                && insert(mspans, dspan.entire(), metavar_span)
+        }),
+    };
+    if no_collision || cx.source_map().is_imported(metavar_span) {
         return orig_tt.clone();
     }
 
+    // Setting metavar spans for the heuristic spans gives better opportunities for combining them
+    // with neighboring spans even despite their different syntactic contexts.
     match orig_tt {
         TokenTree::Token(Token { kind, span }, spacing) => {
             let span = metavar_span.with_ctxt(span.ctxt());
+            with_metavar_spans(|mspans| insert(mspans, span, metavar_span));
             TokenTree::Token(Token { kind: kind.clone(), span }, *spacing)
         }
         TokenTree::Delimited(dspan, dspacing, delimiter, tts) => {
-            let open = metavar_span.shrink_to_lo().with_ctxt(dspan.open.ctxt());
-            let close = metavar_span.shrink_to_hi().with_ctxt(dspan.close.ctxt());
+            let open = metavar_span.with_ctxt(dspan.open.ctxt());
+            let close = metavar_span.with_ctxt(dspan.close.ctxt());
+            with_metavar_spans(|mspans| {
+                insert(mspans, open, metavar_span) && insert(mspans, close, metavar_span)
+            });
             let dspan = DelimSpan::from_pair(open, close);
             TokenTree::Delimited(dspan, *dspacing, *delimiter, tts.clone())
         }
diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs
index 8f31b5801da..b80ecbc9c65 100644
--- a/compiler/rustc_expand/src/proc_macro_server.rs
+++ b/compiler/rustc_expand/src/proc_macro_server.rs
@@ -10,7 +10,7 @@ use rustc_ast::util::literal::escape_byte_str_symbol;
 use rustc_ast_pretty::pprust;
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::sync::Lrc;
-use rustc_errors::{ErrorGuaranteed, MultiSpan, PResult};
+use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, MultiSpan, PResult};
 use rustc_parse::lexer::nfc_normalize;
 use rustc_parse::parse_stream_from_source_str;
 use rustc_session::parse::ParseSess;
@@ -509,13 +509,14 @@ impl server::FreeFunctions for Rustc<'_, '_> {
     }
 
     fn emit_diagnostic(&mut self, diagnostic: Diagnostic<Self::Span>) {
-        let mut diag =
-            rustc_errors::Diagnostic::new(diagnostic.level.to_internal(), diagnostic.message);
+        let message = rustc_errors::DiagnosticMessage::from(diagnostic.message);
+        let mut diag: DiagnosticBuilder<'_, rustc_errors::ErrorGuaranteed> =
+            DiagnosticBuilder::new(&self.sess().dcx, diagnostic.level.to_internal(), message);
         diag.span(MultiSpan::from_spans(diagnostic.spans));
         for child in diagnostic.children {
             diag.sub(child.level.to_internal(), child.message, MultiSpan::from_spans(child.spans));
         }
-        self.sess().dcx.emit_diagnostic(diag);
+        diag.emit();
     }
 }
 
diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs
index e9337dd3586..1c38a45d3a3 100644
--- a/compiler/rustc_hir/src/intravisit.rs
+++ b/compiler/rustc_hir/src/intravisit.rs
@@ -65,7 +65,8 @@
 //! example coroutine inference, and possibly also HIR borrowck.
 
 use crate::hir::*;
-use rustc_ast::walk_list;
+use rustc_ast::visit::VisitorResult;
+use rustc_ast::{try_visit, visit_opt, walk_list};
 use rustc_ast::{Attribute, Label};
 use rustc_span::def_id::LocalDefId;
 use rustc_span::symbol::{Ident, Symbol};
@@ -216,6 +217,10 @@ pub trait Visitor<'v>: Sized {
     /// and fixed appropriately.
     type NestedFilter: NestedFilter<'v> = nested_filter::None;
 
+    /// The result type of the `visit_*` methods. Can be either `()`,
+    /// or `ControlFlow<T>`.
+    type Result: VisitorResult = ();
+
     /// If `type NestedFilter` is set to visit nested items, this method
     /// must also be overridden to provide a map to retrieve nested items.
     fn nested_visit_map(&mut self) -> Self::Map {
@@ -233,287 +238,299 @@ pub trait Visitor<'v>: Sized {
     /// [`rustc_hir::intravisit`]. The only reason to override
     /// this method is if you want a nested pattern but cannot supply a
     /// [`Map`]; see `nested_visit_map` for advice.
-    fn visit_nested_item(&mut self, id: ItemId) {
+    fn visit_nested_item(&mut self, id: ItemId) -> Self::Result {
         if Self::NestedFilter::INTER {
             let item = self.nested_visit_map().item(id);
-            self.visit_item(item);
+            try_visit!(self.visit_item(item));
         }
+        Self::Result::output()
     }
 
     /// Like `visit_nested_item()`, but for trait items. See
     /// `visit_nested_item()` for advice on when to override this
     /// method.
-    fn visit_nested_trait_item(&mut self, id: TraitItemId) {
+    fn visit_nested_trait_item(&mut self, id: TraitItemId) -> Self::Result {
         if Self::NestedFilter::INTER {
             let item = self.nested_visit_map().trait_item(id);
-            self.visit_trait_item(item);
+            try_visit!(self.visit_trait_item(item));
         }
+        Self::Result::output()
     }
 
     /// Like `visit_nested_item()`, but for impl items. See
     /// `visit_nested_item()` for advice on when to override this
     /// method.
-    fn visit_nested_impl_item(&mut self, id: ImplItemId) {
+    fn visit_nested_impl_item(&mut self, id: ImplItemId) -> Self::Result {
         if Self::NestedFilter::INTER {
             let item = self.nested_visit_map().impl_item(id);
-            self.visit_impl_item(item);
+            try_visit!(self.visit_impl_item(item));
         }
+        Self::Result::output()
     }
 
     /// Like `visit_nested_item()`, but for foreign items. See
     /// `visit_nested_item()` for advice on when to override this
     /// method.
-    fn visit_nested_foreign_item(&mut self, id: ForeignItemId) {
+    fn visit_nested_foreign_item(&mut self, id: ForeignItemId) -> Self::Result {
         if Self::NestedFilter::INTER {
             let item = self.nested_visit_map().foreign_item(id);
-            self.visit_foreign_item(item);
+            try_visit!(self.visit_foreign_item(item));
         }
+        Self::Result::output()
     }
 
     /// Invoked to visit the body of a function, method or closure. Like
     /// `visit_nested_item`, does nothing by default unless you override
     /// `Self::NestedFilter`.
-    fn visit_nested_body(&mut self, id: BodyId) {
+    fn visit_nested_body(&mut self, id: BodyId) -> Self::Result {
         if Self::NestedFilter::INTRA {
             let body = self.nested_visit_map().body(id);
-            self.visit_body(body);
+            try_visit!(self.visit_body(body));
         }
+        Self::Result::output()
     }
 
-    fn visit_param(&mut self, param: &'v Param<'v>) {
+    fn visit_param(&mut self, param: &'v Param<'v>) -> Self::Result {
         walk_param(self, param)
     }
 
     /// Visits the top-level item and (optionally) nested items / impl items. See
     /// `visit_nested_item` for details.
-    fn visit_item(&mut self, i: &'v Item<'v>) {
+    fn visit_item(&mut self, i: &'v Item<'v>) -> Self::Result {
         walk_item(self, i)
     }
 
-    fn visit_body(&mut self, b: &'v Body<'v>) {
-        walk_body(self, b);
+    fn visit_body(&mut self, b: &'v Body<'v>) -> Self::Result {
+        walk_body(self, b)
     }
 
     ///////////////////////////////////////////////////////////////////////////
 
-    fn visit_id(&mut self, _hir_id: HirId) {
-        // Nothing to do.
+    fn visit_id(&mut self, _hir_id: HirId) -> Self::Result {
+        Self::Result::output()
     }
-    fn visit_name(&mut self, _name: Symbol) {
-        // Nothing to do.
+    fn visit_name(&mut self, _name: Symbol) -> Self::Result {
+        Self::Result::output()
     }
-    fn visit_ident(&mut self, ident: Ident) {
+    fn visit_ident(&mut self, ident: Ident) -> Self::Result {
         walk_ident(self, ident)
     }
-    fn visit_mod(&mut self, m: &'v Mod<'v>, _s: Span, n: HirId) {
+    fn visit_mod(&mut self, m: &'v Mod<'v>, _s: Span, n: HirId) -> Self::Result {
         walk_mod(self, m, n)
     }
-    fn visit_foreign_item(&mut self, i: &'v ForeignItem<'v>) {
+    fn visit_foreign_item(&mut self, i: &'v ForeignItem<'v>) -> Self::Result {
         walk_foreign_item(self, i)
     }
-    fn visit_local(&mut self, l: &'v Local<'v>) {
+    fn visit_local(&mut self, l: &'v Local<'v>) -> Self::Result {
         walk_local(self, l)
     }
-    fn visit_block(&mut self, b: &'v Block<'v>) {
+    fn visit_block(&mut self, b: &'v Block<'v>) -> Self::Result {
         walk_block(self, b)
     }
-    fn visit_stmt(&mut self, s: &'v Stmt<'v>) {
+    fn visit_stmt(&mut self, s: &'v Stmt<'v>) -> Self::Result {
         walk_stmt(self, s)
     }
-    fn visit_arm(&mut self, a: &'v Arm<'v>) {
+    fn visit_arm(&mut self, a: &'v Arm<'v>) -> Self::Result {
         walk_arm(self, a)
     }
-    fn visit_pat(&mut self, p: &'v Pat<'v>) {
+    fn visit_pat(&mut self, p: &'v Pat<'v>) -> Self::Result {
         walk_pat(self, p)
     }
-    fn visit_pat_field(&mut self, f: &'v PatField<'v>) {
+    fn visit_pat_field(&mut self, f: &'v PatField<'v>) -> Self::Result {
         walk_pat_field(self, f)
     }
-    fn visit_array_length(&mut self, len: &'v ArrayLen) {
+    fn visit_array_length(&mut self, len: &'v ArrayLen) -> Self::Result {
         walk_array_len(self, len)
     }
-    fn visit_anon_const(&mut self, c: &'v AnonConst) {
+    fn visit_anon_const(&mut self, c: &'v AnonConst) -> Self::Result {
         walk_anon_const(self, c)
     }
-    fn visit_inline_const(&mut self, c: &'v ConstBlock) {
+    fn visit_inline_const(&mut self, c: &'v ConstBlock) -> Self::Result {
         walk_inline_const(self, c)
     }
-    fn visit_expr(&mut self, ex: &'v Expr<'v>) {
+    fn visit_expr(&mut self, ex: &'v Expr<'v>) -> Self::Result {
         walk_expr(self, ex)
     }
-    fn visit_expr_field(&mut self, field: &'v ExprField<'v>) {
+    fn visit_expr_field(&mut self, field: &'v ExprField<'v>) -> Self::Result {
         walk_expr_field(self, field)
     }
-    fn visit_ty(&mut self, t: &'v Ty<'v>) {
+    fn visit_ty(&mut self, t: &'v Ty<'v>) -> Self::Result {
         walk_ty(self, t)
     }
-    fn visit_generic_param(&mut self, p: &'v GenericParam<'v>) {
+    fn visit_generic_param(&mut self, p: &'v GenericParam<'v>) -> Self::Result {
         walk_generic_param(self, p)
     }
-    fn visit_const_param_default(&mut self, _param: HirId, ct: &'v AnonConst) {
+    fn visit_const_param_default(&mut self, _param: HirId, ct: &'v AnonConst) -> Self::Result {
         walk_const_param_default(self, ct)
     }
-    fn visit_generics(&mut self, g: &'v Generics<'v>) {
+    fn visit_generics(&mut self, g: &'v Generics<'v>) -> Self::Result {
         walk_generics(self, g)
     }
-    fn visit_where_predicate(&mut self, predicate: &'v WherePredicate<'v>) {
+    fn visit_where_predicate(&mut self, predicate: &'v WherePredicate<'v>) -> Self::Result {
         walk_where_predicate(self, predicate)
     }
-    fn visit_fn_ret_ty(&mut self, ret_ty: &'v FnRetTy<'v>) {
+    fn visit_fn_ret_ty(&mut self, ret_ty: &'v FnRetTy<'v>) -> Self::Result {
         walk_fn_ret_ty(self, ret_ty)
     }
-    fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>) {
+    fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>) -> Self::Result {
         walk_fn_decl(self, fd)
     }
-    fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl<'v>, b: BodyId, _: Span, id: LocalDefId) {
+    fn visit_fn(
+        &mut self,
+        fk: FnKind<'v>,
+        fd: &'v FnDecl<'v>,
+        b: BodyId,
+        _: Span,
+        id: LocalDefId,
+    ) -> Self::Result {
         walk_fn(self, fk, fd, b, id)
     }
-    fn visit_use(&mut self, path: &'v UsePath<'v>, hir_id: HirId) {
+    fn visit_use(&mut self, path: &'v UsePath<'v>, hir_id: HirId) -> Self::Result {
         walk_use(self, path, hir_id)
     }
-    fn visit_trait_item(&mut self, ti: &'v TraitItem<'v>) {
+    fn visit_trait_item(&mut self, ti: &'v TraitItem<'v>) -> Self::Result {
         walk_trait_item(self, ti)
     }
-    fn visit_trait_item_ref(&mut self, ii: &'v TraitItemRef) {
+    fn visit_trait_item_ref(&mut self, ii: &'v TraitItemRef) -> Self::Result {
         walk_trait_item_ref(self, ii)
     }
-    fn visit_impl_item(&mut self, ii: &'v ImplItem<'v>) {
+    fn visit_impl_item(&mut self, ii: &'v ImplItem<'v>) -> Self::Result {
         walk_impl_item(self, ii)
     }
-    fn visit_foreign_item_ref(&mut self, ii: &'v ForeignItemRef) {
+    fn visit_foreign_item_ref(&mut self, ii: &'v ForeignItemRef) -> Self::Result {
         walk_foreign_item_ref(self, ii)
     }
-    fn visit_impl_item_ref(&mut self, ii: &'v ImplItemRef) {
+    fn visit_impl_item_ref(&mut self, ii: &'v ImplItemRef) -> Self::Result {
         walk_impl_item_ref(self, ii)
     }
-    fn visit_trait_ref(&mut self, t: &'v TraitRef<'v>) {
+    fn visit_trait_ref(&mut self, t: &'v TraitRef<'v>) -> Self::Result {
         walk_trait_ref(self, t)
     }
-    fn visit_param_bound(&mut self, bounds: &'v GenericBound<'v>) {
+    fn visit_param_bound(&mut self, bounds: &'v GenericBound<'v>) -> Self::Result {
         walk_param_bound(self, bounds)
     }
-    fn visit_poly_trait_ref(&mut self, t: &'v PolyTraitRef<'v>) {
+    fn visit_poly_trait_ref(&mut self, t: &'v PolyTraitRef<'v>) -> Self::Result {
         walk_poly_trait_ref(self, t)
     }
-    fn visit_variant_data(&mut self, s: &'v VariantData<'v>) {
+    fn visit_variant_data(&mut self, s: &'v VariantData<'v>) -> Self::Result {
         walk_struct_def(self, s)
     }
-    fn visit_field_def(&mut self, s: &'v FieldDef<'v>) {
+    fn visit_field_def(&mut self, s: &'v FieldDef<'v>) -> Self::Result {
         walk_field_def(self, s)
     }
-    fn visit_enum_def(&mut self, enum_definition: &'v EnumDef<'v>, item_id: HirId) {
+    fn visit_enum_def(&mut self, enum_definition: &'v EnumDef<'v>, item_id: HirId) -> Self::Result {
         walk_enum_def(self, enum_definition, item_id)
     }
-    fn visit_variant(&mut self, v: &'v Variant<'v>) {
+    fn visit_variant(&mut self, v: &'v Variant<'v>) -> Self::Result {
         walk_variant(self, v)
     }
-    fn visit_label(&mut self, label: &'v Label) {
+    fn visit_label(&mut self, label: &'v Label) -> Self::Result {
         walk_label(self, label)
     }
-    fn visit_infer(&mut self, inf: &'v InferArg) {
-        walk_inf(self, inf);
+    fn visit_infer(&mut self, inf: &'v InferArg) -> Self::Result {
+        walk_inf(self, inf)
     }
-    fn visit_generic_arg(&mut self, generic_arg: &'v GenericArg<'v>) {
-        walk_generic_arg(self, generic_arg);
+    fn visit_generic_arg(&mut self, generic_arg: &'v GenericArg<'v>) -> Self::Result {
+        walk_generic_arg(self, generic_arg)
     }
-    fn visit_lifetime(&mut self, lifetime: &'v Lifetime) {
+    fn visit_lifetime(&mut self, lifetime: &'v Lifetime) -> Self::Result {
         walk_lifetime(self, lifetime)
     }
     // The span is that of the surrounding type/pattern/expr/whatever.
-    fn visit_qpath(&mut self, qpath: &'v QPath<'v>, id: HirId, _span: Span) {
+    fn visit_qpath(&mut self, qpath: &'v QPath<'v>, id: HirId, _span: Span) -> Self::Result {
         walk_qpath(self, qpath, id)
     }
-    fn visit_path(&mut self, path: &Path<'v>, _id: HirId) {
+    fn visit_path(&mut self, path: &Path<'v>, _id: HirId) -> Self::Result {
         walk_path(self, path)
     }
-    fn visit_path_segment(&mut self, path_segment: &'v PathSegment<'v>) {
+    fn visit_path_segment(&mut self, path_segment: &'v PathSegment<'v>) -> Self::Result {
         walk_path_segment(self, path_segment)
     }
-    fn visit_generic_args(&mut self, generic_args: &'v GenericArgs<'v>) {
+    fn visit_generic_args(&mut self, generic_args: &'v GenericArgs<'v>) -> Self::Result {
         walk_generic_args(self, generic_args)
     }
-    fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding<'v>) {
+    fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding<'v>) -> Self::Result {
         walk_assoc_type_binding(self, type_binding)
     }
-    fn visit_attribute(&mut self, _attr: &'v Attribute) {}
-    fn visit_associated_item_kind(&mut self, kind: &'v AssocItemKind) {
-        walk_associated_item_kind(self, kind);
+    fn visit_attribute(&mut self, _attr: &'v Attribute) -> Self::Result {
+        Self::Result::output()
+    }
+    fn visit_associated_item_kind(&mut self, kind: &'v AssocItemKind) -> Self::Result {
+        walk_associated_item_kind(self, kind)
     }
-    fn visit_defaultness(&mut self, defaultness: &'v Defaultness) {
-        walk_defaultness(self, defaultness);
+    fn visit_defaultness(&mut self, defaultness: &'v Defaultness) -> Self::Result {
+        walk_defaultness(self, defaultness)
     }
-    fn visit_inline_asm(&mut self, asm: &'v InlineAsm<'v>, id: HirId) {
-        walk_inline_asm(self, asm, id);
+    fn visit_inline_asm(&mut self, asm: &'v InlineAsm<'v>, id: HirId) -> Self::Result {
+        walk_inline_asm(self, asm, id)
     }
 }
 
-pub fn walk_param<'v, V: Visitor<'v>>(visitor: &mut V, param: &'v Param<'v>) {
-    visitor.visit_id(param.hir_id);
-    visitor.visit_pat(param.pat);
+pub fn walk_param<'v, V: Visitor<'v>>(visitor: &mut V, param: &'v Param<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(param.hir_id));
+    visitor.visit_pat(param.pat)
 }
 
-pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
-    visitor.visit_ident(item.ident);
+pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::Result {
+    try_visit!(visitor.visit_ident(item.ident));
     match item.kind {
         ItemKind::ExternCrate(orig_name) => {
-            visitor.visit_id(item.hir_id());
-            if let Some(orig_name) = orig_name {
-                visitor.visit_name(orig_name);
-            }
+            try_visit!(visitor.visit_id(item.hir_id()));
+            visit_opt!(visitor, visit_name, orig_name);
         }
         ItemKind::Use(ref path, _) => {
-            visitor.visit_use(path, item.hir_id());
+            try_visit!(visitor.visit_use(path, item.hir_id()));
         }
         ItemKind::Static(ref typ, _, body) => {
-            visitor.visit_id(item.hir_id());
-            visitor.visit_ty(typ);
-            visitor.visit_nested_body(body);
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_ty(typ));
+            try_visit!(visitor.visit_nested_body(body));
         }
         ItemKind::Const(ref typ, ref generics, body) => {
-            visitor.visit_id(item.hir_id());
-            visitor.visit_ty(typ);
-            visitor.visit_generics(generics);
-            visitor.visit_nested_body(body);
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_ty(typ));
+            try_visit!(visitor.visit_generics(generics));
+            try_visit!(visitor.visit_nested_body(body));
         }
         ItemKind::Fn(ref sig, ref generics, body_id) => {
-            visitor.visit_id(item.hir_id());
-            visitor.visit_fn(
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_fn(
                 FnKind::ItemFn(item.ident, generics, sig.header),
                 sig.decl,
                 body_id,
                 item.span,
                 item.owner_id.def_id,
-            )
+            ));
         }
         ItemKind::Macro(..) => {
-            visitor.visit_id(item.hir_id());
+            try_visit!(visitor.visit_id(item.hir_id()));
         }
         ItemKind::Mod(ref module) => {
             // `visit_mod()` takes care of visiting the `Item`'s `HirId`.
-            visitor.visit_mod(module, item.span, item.hir_id())
+            try_visit!(visitor.visit_mod(module, item.span, item.hir_id()));
         }
         ItemKind::ForeignMod { abi: _, items } => {
-            visitor.visit_id(item.hir_id());
+            try_visit!(visitor.visit_id(item.hir_id()));
             walk_list!(visitor, visit_foreign_item_ref, items);
         }
         ItemKind::GlobalAsm(asm) => {
-            visitor.visit_id(item.hir_id());
-            visitor.visit_inline_asm(asm, item.hir_id());
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_inline_asm(asm, item.hir_id()));
         }
         ItemKind::TyAlias(ref ty, ref generics) => {
-            visitor.visit_id(item.hir_id());
-            visitor.visit_ty(ty);
-            visitor.visit_generics(generics)
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_ty(ty));
+            try_visit!(visitor.visit_generics(generics));
         }
         ItemKind::OpaqueTy(&OpaqueTy { generics, bounds, .. }) => {
-            visitor.visit_id(item.hir_id());
-            walk_generics(visitor, generics);
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(walk_generics(visitor, generics));
             walk_list!(visitor, visit_param_bound, bounds);
         }
         ItemKind::Enum(ref enum_definition, ref generics) => {
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_generics(generics));
             // `visit_enum_def()` takes care of visiting the `Item`'s `HirId`.
-            visitor.visit_enum_def(enum_definition, item.hir_id())
+            try_visit!(visitor.visit_enum_def(enum_definition, item.hir_id()));
         }
         ItemKind::Impl(Impl {
             unsafety: _,
@@ -525,85 +542,91 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
             ref self_ty,
             items,
         }) => {
-            visitor.visit_id(item.hir_id());
-            visitor.visit_generics(generics);
-            walk_list!(visitor, visit_trait_ref, of_trait);
-            visitor.visit_ty(self_ty);
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_generics(generics));
+            visit_opt!(visitor, visit_trait_ref, of_trait);
+            try_visit!(visitor.visit_ty(self_ty));
             walk_list!(visitor, visit_impl_item_ref, *items);
         }
         ItemKind::Struct(ref struct_definition, ref generics)
         | ItemKind::Union(ref struct_definition, ref generics) => {
-            visitor.visit_generics(generics);
-            visitor.visit_id(item.hir_id());
-            visitor.visit_variant_data(struct_definition);
+            try_visit!(visitor.visit_generics(generics));
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_variant_data(struct_definition));
         }
         ItemKind::Trait(.., ref generics, bounds, trait_item_refs) => {
-            visitor.visit_id(item.hir_id());
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_generics(generics));
             walk_list!(visitor, visit_param_bound, bounds);
             walk_list!(visitor, visit_trait_item_ref, trait_item_refs);
         }
         ItemKind::TraitAlias(ref generics, bounds) => {
-            visitor.visit_id(item.hir_id());
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_id(item.hir_id()));
+            try_visit!(visitor.visit_generics(generics));
             walk_list!(visitor, visit_param_bound, bounds);
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_body<'v, V: Visitor<'v>>(visitor: &mut V, body: &'v Body<'v>) {
+pub fn walk_body<'v, V: Visitor<'v>>(visitor: &mut V, body: &'v Body<'v>) -> V::Result {
     walk_list!(visitor, visit_param, body.params);
-    visitor.visit_expr(body.value);
+    visitor.visit_expr(body.value)
 }
 
-pub fn walk_ident<'v, V: Visitor<'v>>(visitor: &mut V, ident: Ident) {
-    visitor.visit_name(ident.name);
+pub fn walk_ident<'v, V: Visitor<'v>>(visitor: &mut V, ident: Ident) -> V::Result {
+    visitor.visit_name(ident.name)
 }
 
-pub fn walk_mod<'v, V: Visitor<'v>>(visitor: &mut V, module: &'v Mod<'v>, mod_hir_id: HirId) {
-    visitor.visit_id(mod_hir_id);
-    for &item_id in module.item_ids {
-        visitor.visit_nested_item(item_id);
-    }
+pub fn walk_mod<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    module: &'v Mod<'v>,
+    mod_hir_id: HirId,
+) -> V::Result {
+    try_visit!(visitor.visit_id(mod_hir_id));
+    walk_list!(visitor, visit_nested_item, module.item_ids.iter().copied());
+    V::Result::output()
 }
 
-pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v ForeignItem<'v>) {
-    visitor.visit_id(foreign_item.hir_id());
-    visitor.visit_ident(foreign_item.ident);
+pub fn walk_foreign_item<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    foreign_item: &'v ForeignItem<'v>,
+) -> V::Result {
+    try_visit!(visitor.visit_id(foreign_item.hir_id()));
+    try_visit!(visitor.visit_ident(foreign_item.ident));
 
     match foreign_item.kind {
         ForeignItemKind::Fn(ref function_declaration, param_names, ref generics) => {
-            visitor.visit_generics(generics);
-            visitor.visit_fn_decl(function_declaration);
-            for &param_name in param_names {
-                visitor.visit_ident(param_name);
-            }
+            try_visit!(visitor.visit_generics(generics));
+            try_visit!(visitor.visit_fn_decl(function_declaration));
+            walk_list!(visitor, visit_ident, param_names.iter().copied());
         }
-        ForeignItemKind::Static(ref typ, _) => visitor.visit_ty(typ),
+        ForeignItemKind::Static(ref typ, _) => try_visit!(visitor.visit_ty(typ)),
         ForeignItemKind::Type => (),
     }
+    V::Result::output()
 }
 
-pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v Local<'v>) {
+pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v Local<'v>) -> V::Result {
     // Intentionally visiting the expr first - the initialization expr
     // dominates the local's definition.
-    walk_list!(visitor, visit_expr, &local.init);
-    visitor.visit_id(local.hir_id);
-    visitor.visit_pat(local.pat);
-    if let Some(els) = local.els {
-        visitor.visit_block(els);
-    }
-    walk_list!(visitor, visit_ty, &local.ty);
+    visit_opt!(visitor, visit_expr, local.init);
+    try_visit!(visitor.visit_id(local.hir_id));
+    try_visit!(visitor.visit_pat(local.pat));
+    visit_opt!(visitor, visit_block, local.els);
+    visit_opt!(visitor, visit_ty, local.ty);
+    V::Result::output()
 }
 
-pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block<'v>) {
-    visitor.visit_id(block.hir_id);
+pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(block.hir_id));
     walk_list!(visitor, visit_stmt, block.stmts);
-    walk_list!(visitor, visit_expr, &block.expr);
+    visit_opt!(visitor, visit_expr, block.expr);
+    V::Result::output()
 }
 
-pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt<'v>) {
-    visitor.visit_id(statement.hir_id);
+pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(statement.hir_id));
     match statement.kind {
         StmtKind::Local(ref local) => visitor.visit_local(local),
         StmtKind::Item(item) => visitor.visit_nested_item(item),
@@ -613,27 +636,25 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt<'v>) {
     }
 }
 
-pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm<'v>) {
-    visitor.visit_id(arm.hir_id);
-    visitor.visit_pat(arm.pat);
-    if let Some(ref e) = arm.guard {
-        visitor.visit_expr(e);
-    }
-    visitor.visit_expr(arm.body);
+pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(arm.hir_id));
+    try_visit!(visitor.visit_pat(arm.pat));
+    visit_opt!(visitor, visit_expr, arm.guard);
+    visitor.visit_expr(arm.body)
 }
 
-pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat<'v>) {
-    visitor.visit_id(pattern.hir_id);
+pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(pattern.hir_id));
     match pattern.kind {
         PatKind::TupleStruct(ref qpath, children, _) => {
-            visitor.visit_qpath(qpath, pattern.hir_id, pattern.span);
+            try_visit!(visitor.visit_qpath(qpath, pattern.hir_id, pattern.span));
             walk_list!(visitor, visit_pat, children);
         }
         PatKind::Path(ref qpath) => {
-            visitor.visit_qpath(qpath, pattern.hir_id, pattern.span);
+            try_visit!(visitor.visit_qpath(qpath, pattern.hir_id, pattern.span));
         }
         PatKind::Struct(ref qpath, fields, _) => {
-            visitor.visit_qpath(qpath, pattern.hir_id, pattern.span);
+            try_visit!(visitor.visit_qpath(qpath, pattern.hir_id, pattern.span));
             walk_list!(visitor, visit_pat_field, fields);
         }
         PatKind::Or(pats) => walk_list!(visitor, visit_pat, pats),
@@ -641,33 +662,34 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat<'v>) {
             walk_list!(visitor, visit_pat, tuple_elements);
         }
         PatKind::Box(ref subpattern) | PatKind::Ref(ref subpattern, _) => {
-            visitor.visit_pat(subpattern)
+            try_visit!(visitor.visit_pat(subpattern));
         }
         PatKind::Binding(_, _hir_id, ident, ref optional_subpattern) => {
-            visitor.visit_ident(ident);
-            walk_list!(visitor, visit_pat, optional_subpattern);
+            try_visit!(visitor.visit_ident(ident));
+            visit_opt!(visitor, visit_pat, optional_subpattern);
         }
-        PatKind::Lit(ref expression) => visitor.visit_expr(expression),
+        PatKind::Lit(ref expression) => try_visit!(visitor.visit_expr(expression)),
         PatKind::Range(ref lower_bound, ref upper_bound, _) => {
-            walk_list!(visitor, visit_expr, lower_bound);
-            walk_list!(visitor, visit_expr, upper_bound);
+            visit_opt!(visitor, visit_expr, lower_bound);
+            visit_opt!(visitor, visit_expr, upper_bound);
         }
         PatKind::Never | PatKind::Wild | PatKind::Err(_) => (),
         PatKind::Slice(prepatterns, ref slice_pattern, postpatterns) => {
             walk_list!(visitor, visit_pat, prepatterns);
-            walk_list!(visitor, visit_pat, slice_pattern);
+            visit_opt!(visitor, visit_pat, slice_pattern);
             walk_list!(visitor, visit_pat, postpatterns);
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_pat_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v PatField<'v>) {
-    visitor.visit_id(field.hir_id);
-    visitor.visit_ident(field.ident);
+pub fn walk_pat_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v PatField<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(field.hir_id));
+    try_visit!(visitor.visit_ident(field.ident));
     visitor.visit_pat(field.pat)
 }
 
-pub fn walk_array_len<'v, V: Visitor<'v>>(visitor: &mut V, len: &'v ArrayLen) {
+pub fn walk_array_len<'v, V: Visitor<'v>>(visitor: &mut V, len: &'v ArrayLen) -> V::Result {
     match len {
         // FIXME: Use `visit_infer` here.
         ArrayLen::Infer(InferArg { hir_id, span: _ }) => visitor.visit_id(*hir_id),
@@ -675,75 +697,80 @@ pub fn walk_array_len<'v, V: Visitor<'v>>(visitor: &mut V, len: &'v ArrayLen) {
     }
 }
 
-pub fn walk_anon_const<'v, V: Visitor<'v>>(visitor: &mut V, constant: &'v AnonConst) {
-    visitor.visit_id(constant.hir_id);
-    visitor.visit_nested_body(constant.body);
+pub fn walk_anon_const<'v, V: Visitor<'v>>(visitor: &mut V, constant: &'v AnonConst) -> V::Result {
+    try_visit!(visitor.visit_id(constant.hir_id));
+    visitor.visit_nested_body(constant.body)
 }
 
-pub fn walk_inline_const<'v, V: Visitor<'v>>(visitor: &mut V, constant: &'v ConstBlock) {
-    visitor.visit_id(constant.hir_id);
-    visitor.visit_nested_body(constant.body);
+pub fn walk_inline_const<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    constant: &'v ConstBlock,
+) -> V::Result {
+    try_visit!(visitor.visit_id(constant.hir_id));
+    visitor.visit_nested_body(constant.body)
 }
 
-pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>) {
-    visitor.visit_id(expression.hir_id);
+pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(expression.hir_id));
     match expression.kind {
         ExprKind::Array(subexpressions) => {
             walk_list!(visitor, visit_expr, subexpressions);
         }
-        ExprKind::ConstBlock(ref const_block) => visitor.visit_inline_const(const_block),
+        ExprKind::ConstBlock(ref const_block) => {
+            try_visit!(visitor.visit_inline_const(const_block))
+        }
         ExprKind::Repeat(ref element, ref count) => {
-            visitor.visit_expr(element);
-            visitor.visit_array_length(count)
+            try_visit!(visitor.visit_expr(element));
+            try_visit!(visitor.visit_array_length(count));
         }
         ExprKind::Struct(ref qpath, fields, ref optional_base) => {
-            visitor.visit_qpath(qpath, expression.hir_id, expression.span);
+            try_visit!(visitor.visit_qpath(qpath, expression.hir_id, expression.span));
             walk_list!(visitor, visit_expr_field, fields);
-            walk_list!(visitor, visit_expr, optional_base);
+            visit_opt!(visitor, visit_expr, optional_base);
         }
         ExprKind::Tup(subexpressions) => {
             walk_list!(visitor, visit_expr, subexpressions);
         }
         ExprKind::Call(ref callee_expression, arguments) => {
-            visitor.visit_expr(callee_expression);
+            try_visit!(visitor.visit_expr(callee_expression));
             walk_list!(visitor, visit_expr, arguments);
         }
         ExprKind::MethodCall(ref segment, receiver, arguments, _) => {
-            visitor.visit_path_segment(segment);
-            visitor.visit_expr(receiver);
+            try_visit!(visitor.visit_path_segment(segment));
+            try_visit!(visitor.visit_expr(receiver));
             walk_list!(visitor, visit_expr, arguments);
         }
         ExprKind::Binary(_, ref left_expression, ref right_expression) => {
-            visitor.visit_expr(left_expression);
-            visitor.visit_expr(right_expression)
+            try_visit!(visitor.visit_expr(left_expression));
+            try_visit!(visitor.visit_expr(right_expression));
         }
         ExprKind::AddrOf(_, _, ref subexpression) | ExprKind::Unary(_, ref subexpression) => {
-            visitor.visit_expr(subexpression)
+            try_visit!(visitor.visit_expr(subexpression));
         }
         ExprKind::Cast(ref subexpression, ref typ) | ExprKind::Type(ref subexpression, ref typ) => {
-            visitor.visit_expr(subexpression);
-            visitor.visit_ty(typ)
+            try_visit!(visitor.visit_expr(subexpression));
+            try_visit!(visitor.visit_ty(typ));
         }
         ExprKind::DropTemps(ref subexpression) => {
-            visitor.visit_expr(subexpression);
+            try_visit!(visitor.visit_expr(subexpression));
         }
         ExprKind::Let(Let { span: _, pat, ty, init, is_recovered: _ }) => {
             // match the visit order in walk_local
-            visitor.visit_expr(init);
-            visitor.visit_pat(pat);
-            walk_list!(visitor, visit_ty, ty);
+            try_visit!(visitor.visit_expr(init));
+            try_visit!(visitor.visit_pat(pat));
+            visit_opt!(visitor, visit_ty, ty);
         }
         ExprKind::If(ref cond, ref then, ref else_opt) => {
-            visitor.visit_expr(cond);
-            visitor.visit_expr(then);
-            walk_list!(visitor, visit_expr, else_opt);
+            try_visit!(visitor.visit_expr(cond));
+            try_visit!(visitor.visit_expr(then));
+            visit_opt!(visitor, visit_expr, else_opt);
         }
         ExprKind::Loop(ref block, ref opt_label, _, _) => {
-            walk_list!(visitor, visit_label, opt_label);
-            visitor.visit_block(block);
+            visit_opt!(visitor, visit_label, opt_label);
+            try_visit!(visitor.visit_block(block));
         }
         ExprKind::Match(ref subexpression, arms, _) => {
-            visitor.visit_expr(subexpression);
+            try_visit!(visitor.visit_expr(subexpression));
             walk_list!(visitor, visit_arm, arms);
         }
         ExprKind::Closure(&Closure {
@@ -759,71 +786,72 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
             constness: _,
         }) => {
             walk_list!(visitor, visit_generic_param, bound_generic_params);
-            visitor.visit_fn(FnKind::Closure, fn_decl, body, expression.span, def_id)
+            try_visit!(visitor.visit_fn(FnKind::Closure, fn_decl, body, expression.span, def_id));
         }
         ExprKind::Block(ref block, ref opt_label) => {
-            walk_list!(visitor, visit_label, opt_label);
-            visitor.visit_block(block);
+            visit_opt!(visitor, visit_label, opt_label);
+            try_visit!(visitor.visit_block(block));
         }
         ExprKind::Assign(ref lhs, ref rhs, _) => {
-            visitor.visit_expr(rhs);
-            visitor.visit_expr(lhs)
+            try_visit!(visitor.visit_expr(rhs));
+            try_visit!(visitor.visit_expr(lhs));
         }
         ExprKind::AssignOp(_, ref left_expression, ref right_expression) => {
-            visitor.visit_expr(right_expression);
-            visitor.visit_expr(left_expression);
+            try_visit!(visitor.visit_expr(right_expression));
+            try_visit!(visitor.visit_expr(left_expression));
         }
         ExprKind::Field(ref subexpression, ident) => {
-            visitor.visit_expr(subexpression);
-            visitor.visit_ident(ident);
+            try_visit!(visitor.visit_expr(subexpression));
+            try_visit!(visitor.visit_ident(ident));
         }
         ExprKind::Index(ref main_expression, ref index_expression, _) => {
-            visitor.visit_expr(main_expression);
-            visitor.visit_expr(index_expression)
+            try_visit!(visitor.visit_expr(main_expression));
+            try_visit!(visitor.visit_expr(index_expression));
         }
         ExprKind::Path(ref qpath) => {
-            visitor.visit_qpath(qpath, expression.hir_id, expression.span);
+            try_visit!(visitor.visit_qpath(qpath, expression.hir_id, expression.span));
         }
         ExprKind::Break(ref destination, ref opt_expr) => {
-            walk_list!(visitor, visit_label, &destination.label);
-            walk_list!(visitor, visit_expr, opt_expr);
+            visit_opt!(visitor, visit_label, &destination.label);
+            visit_opt!(visitor, visit_expr, opt_expr);
         }
         ExprKind::Continue(ref destination) => {
-            walk_list!(visitor, visit_label, &destination.label);
+            visit_opt!(visitor, visit_label, &destination.label);
         }
         ExprKind::Ret(ref optional_expression) => {
-            walk_list!(visitor, visit_expr, optional_expression);
+            visit_opt!(visitor, visit_expr, optional_expression);
         }
-        ExprKind::Become(ref expr) => visitor.visit_expr(expr),
+        ExprKind::Become(ref expr) => try_visit!(visitor.visit_expr(expr)),
         ExprKind::InlineAsm(ref asm) => {
-            visitor.visit_inline_asm(asm, expression.hir_id);
+            try_visit!(visitor.visit_inline_asm(asm, expression.hir_id));
         }
         ExprKind::OffsetOf(ref container, ref fields) => {
-            visitor.visit_ty(container);
+            try_visit!(visitor.visit_ty(container));
             walk_list!(visitor, visit_ident, fields.iter().copied());
         }
         ExprKind::Yield(ref subexpression, _) => {
-            visitor.visit_expr(subexpression);
+            try_visit!(visitor.visit_expr(subexpression));
         }
         ExprKind::Lit(_) | ExprKind::Err(_) => {}
     }
+    V::Result::output()
 }
 
-pub fn walk_expr_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v ExprField<'v>) {
-    visitor.visit_id(field.hir_id);
-    visitor.visit_ident(field.ident);
+pub fn walk_expr_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v ExprField<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(field.hir_id));
+    try_visit!(visitor.visit_ident(field.ident));
     visitor.visit_expr(field.expr)
 }
 
-pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
-    visitor.visit_id(typ.hir_id);
+pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(typ.hir_id));
 
     match typ.kind {
-        TyKind::Slice(ref ty) => visitor.visit_ty(ty),
-        TyKind::Ptr(ref mutable_type) => visitor.visit_ty(mutable_type.ty),
+        TyKind::Slice(ref ty) => try_visit!(visitor.visit_ty(ty)),
+        TyKind::Ptr(ref mutable_type) => try_visit!(visitor.visit_ty(mutable_type.ty)),
         TyKind::Ref(ref lifetime, ref mutable_type) => {
-            visitor.visit_lifetime(lifetime);
-            visitor.visit_ty(mutable_type.ty)
+            try_visit!(visitor.visit_lifetime(lifetime));
+            try_visit!(visitor.visit_ty(mutable_type.ty));
         }
         TyKind::Never => {}
         TyKind::Tup(tuple_element_types) => {
@@ -831,64 +859,71 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
         }
         TyKind::BareFn(ref function_declaration) => {
             walk_list!(visitor, visit_generic_param, function_declaration.generic_params);
-            visitor.visit_fn_decl(function_declaration.decl);
+            try_visit!(visitor.visit_fn_decl(function_declaration.decl));
         }
         TyKind::Path(ref qpath) => {
-            visitor.visit_qpath(qpath, typ.hir_id, typ.span);
+            try_visit!(visitor.visit_qpath(qpath, typ.hir_id, typ.span));
         }
         TyKind::OpaqueDef(item_id, lifetimes, _in_trait) => {
-            visitor.visit_nested_item(item_id);
+            try_visit!(visitor.visit_nested_item(item_id));
             walk_list!(visitor, visit_generic_arg, lifetimes);
         }
         TyKind::Array(ref ty, ref length) => {
-            visitor.visit_ty(ty);
-            visitor.visit_array_length(length)
+            try_visit!(visitor.visit_ty(ty));
+            try_visit!(visitor.visit_array_length(length));
         }
         TyKind::TraitObject(bounds, ref lifetime, _syntax) => {
-            for bound in bounds {
-                visitor.visit_poly_trait_ref(bound);
-            }
-            visitor.visit_lifetime(lifetime);
+            walk_list!(visitor, visit_poly_trait_ref, bounds);
+            try_visit!(visitor.visit_lifetime(lifetime));
         }
-        TyKind::Typeof(ref expression) => visitor.visit_anon_const(expression),
+        TyKind::Typeof(ref expression) => try_visit!(visitor.visit_anon_const(expression)),
         TyKind::Infer | TyKind::InferDelegation(..) | TyKind::Err(_) => {}
         TyKind::AnonAdt(item_id) => {
-            visitor.visit_nested_item(item_id);
+            try_visit!(visitor.visit_nested_item(item_id));
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_generic_param<'v, V: Visitor<'v>>(visitor: &mut V, param: &'v GenericParam<'v>) {
-    visitor.visit_id(param.hir_id);
+pub fn walk_generic_param<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    param: &'v GenericParam<'v>,
+) -> V::Result {
+    try_visit!(visitor.visit_id(param.hir_id));
     match param.name {
-        ParamName::Plain(ident) => visitor.visit_ident(ident),
+        ParamName::Plain(ident) => try_visit!(visitor.visit_ident(ident)),
         ParamName::Error | ParamName::Fresh => {}
     }
     match param.kind {
         GenericParamKind::Lifetime { .. } => {}
-        GenericParamKind::Type { ref default, .. } => walk_list!(visitor, visit_ty, default),
+        GenericParamKind::Type { ref default, .. } => visit_opt!(visitor, visit_ty, default),
         GenericParamKind::Const { ref ty, ref default, is_host_effect: _ } => {
-            visitor.visit_ty(ty);
+            try_visit!(visitor.visit_ty(ty));
             if let Some(ref default) = default {
                 visitor.visit_const_param_default(param.hir_id, default);
             }
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_const_param_default<'v, V: Visitor<'v>>(visitor: &mut V, ct: &'v AnonConst) {
+pub fn walk_const_param_default<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    ct: &'v AnonConst,
+) -> V::Result {
     visitor.visit_anon_const(ct)
 }
 
-pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics<'v>) {
+pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics<'v>) -> V::Result {
     walk_list!(visitor, visit_generic_param, generics.params);
     walk_list!(visitor, visit_where_predicate, generics.predicates);
+    V::Result::output()
 }
 
 pub fn walk_where_predicate<'v, V: Visitor<'v>>(
     visitor: &mut V,
     predicate: &'v WherePredicate<'v>,
-) {
+) -> V::Result {
     match *predicate {
         WherePredicate::BoundPredicate(WhereBoundPredicate {
             hir_id,
@@ -898,8 +933,8 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>(
             origin: _,
             span: _,
         }) => {
-            visitor.visit_id(hir_id);
-            visitor.visit_ty(bounded_ty);
+            try_visit!(visitor.visit_id(hir_id));
+            try_visit!(visitor.visit_ty(bounded_ty));
             walk_list!(visitor, visit_param_bound, bounds);
             walk_list!(visitor, visit_generic_param, bound_generic_params);
         }
@@ -909,27 +944,30 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>(
             span: _,
             in_where_clause: _,
         }) => {
-            visitor.visit_lifetime(lifetime);
+            try_visit!(visitor.visit_lifetime(lifetime));
             walk_list!(visitor, visit_param_bound, bounds);
         }
         WherePredicate::EqPredicate(WhereEqPredicate { ref lhs_ty, ref rhs_ty, span: _ }) => {
-            visitor.visit_ty(lhs_ty);
-            visitor.visit_ty(rhs_ty);
+            try_visit!(visitor.visit_ty(lhs_ty));
+            try_visit!(visitor.visit_ty(rhs_ty));
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_fn_decl<'v, V: Visitor<'v>>(visitor: &mut V, function_declaration: &'v FnDecl<'v>) {
-    for ty in function_declaration.inputs {
-        visitor.visit_ty(ty)
-    }
+pub fn walk_fn_decl<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    function_declaration: &'v FnDecl<'v>,
+) -> V::Result {
+    walk_list!(visitor, visit_ty, function_declaration.inputs);
     visitor.visit_fn_ret_ty(&function_declaration.output)
 }
 
-pub fn walk_fn_ret_ty<'v, V: Visitor<'v>>(visitor: &mut V, ret_ty: &'v FnRetTy<'v>) {
-    if let FnRetTy::Return(ref output_ty) = *ret_ty {
-        visitor.visit_ty(output_ty)
+pub fn walk_fn_ret_ty<'v, V: Visitor<'v>>(visitor: &mut V, ret_ty: &'v FnRetTy<'v>) -> V::Result {
+    if let FnRetTy::Return(output_ty) = *ret_ty {
+        try_visit!(visitor.visit_ty(output_ty));
     }
+    V::Result::output()
 }
 
 pub fn walk_fn<'v, V: Visitor<'v>>(
@@ -938,73 +976,87 @@ pub fn walk_fn<'v, V: Visitor<'v>>(
     function_declaration: &'v FnDecl<'v>,
     body_id: BodyId,
     _: LocalDefId,
-) {
-    visitor.visit_fn_decl(function_declaration);
-    walk_fn_kind(visitor, function_kind);
+) -> V::Result {
+    try_visit!(visitor.visit_fn_decl(function_declaration));
+    try_visit!(walk_fn_kind(visitor, function_kind));
     visitor.visit_nested_body(body_id)
 }
 
-pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V, function_kind: FnKind<'v>) {
+pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V, function_kind: FnKind<'v>) -> V::Result {
     match function_kind {
         FnKind::ItemFn(_, generics, ..) => {
-            visitor.visit_generics(generics);
+            try_visit!(visitor.visit_generics(generics));
         }
         FnKind::Closure | FnKind::Method(..) => {}
     }
+    V::Result::output()
 }
 
-pub fn walk_use<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v UsePath<'v>, hir_id: HirId) {
-    visitor.visit_id(hir_id);
+pub fn walk_use<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    path: &'v UsePath<'v>,
+    hir_id: HirId,
+) -> V::Result {
+    try_visit!(visitor.visit_id(hir_id));
     let UsePath { segments, ref res, span } = *path;
     for &res in res {
-        visitor.visit_path(&Path { segments, res, span }, hir_id);
+        try_visit!(visitor.visit_path(&Path { segments, res, span }, hir_id));
     }
+    V::Result::output()
 }
 
-pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v TraitItem<'v>) {
+pub fn walk_trait_item<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    trait_item: &'v TraitItem<'v>,
+) -> V::Result {
     // N.B., deliberately force a compilation error if/when new fields are added.
     let TraitItem { ident, generics, ref defaultness, ref kind, span, owner_id: _ } = *trait_item;
     let hir_id = trait_item.hir_id();
-    visitor.visit_ident(ident);
-    visitor.visit_generics(&generics);
-    visitor.visit_defaultness(&defaultness);
-    visitor.visit_id(hir_id);
+    try_visit!(visitor.visit_ident(ident));
+    try_visit!(visitor.visit_generics(&generics));
+    try_visit!(visitor.visit_defaultness(&defaultness));
+    try_visit!(visitor.visit_id(hir_id));
     match *kind {
         TraitItemKind::Const(ref ty, default) => {
-            visitor.visit_ty(ty);
-            walk_list!(visitor, visit_nested_body, default);
+            try_visit!(visitor.visit_ty(ty));
+            visit_opt!(visitor, visit_nested_body, default);
         }
         TraitItemKind::Fn(ref sig, TraitFn::Required(param_names)) => {
-            visitor.visit_fn_decl(sig.decl);
-            for &param_name in param_names {
-                visitor.visit_ident(param_name);
-            }
+            try_visit!(visitor.visit_fn_decl(sig.decl));
+            walk_list!(visitor, visit_ident, param_names.iter().copied());
         }
         TraitItemKind::Fn(ref sig, TraitFn::Provided(body_id)) => {
-            visitor.visit_fn(
+            try_visit!(visitor.visit_fn(
                 FnKind::Method(ident, sig),
                 sig.decl,
                 body_id,
                 span,
                 trait_item.owner_id.def_id,
-            );
+            ));
         }
         TraitItemKind::Type(bounds, ref default) => {
             walk_list!(visitor, visit_param_bound, bounds);
-            walk_list!(visitor, visit_ty, default);
+            visit_opt!(visitor, visit_ty, default);
         }
     }
+    V::Result::output()
 }
 
-pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref: &'v TraitItemRef) {
+pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    trait_item_ref: &'v TraitItemRef,
+) -> V::Result {
     // N.B., deliberately force a compilation error if/when new fields are added.
     let TraitItemRef { id, ident, ref kind, span: _ } = *trait_item_ref;
-    visitor.visit_nested_trait_item(id);
-    visitor.visit_ident(ident);
-    visitor.visit_associated_item_kind(kind);
+    try_visit!(visitor.visit_nested_trait_item(id));
+    try_visit!(visitor.visit_ident(ident));
+    visitor.visit_associated_item_kind(kind)
 }
 
-pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplItem<'v>) {
+pub fn walk_impl_item<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    impl_item: &'v ImplItem<'v>,
+) -> V::Result {
     // N.B., deliberately force a compilation error if/when new fields are added.
     let ImplItem {
         owner_id: _,
@@ -1016,106 +1068,118 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
         vis_span: _,
     } = *impl_item;
 
-    visitor.visit_ident(ident);
-    visitor.visit_generics(generics);
-    visitor.visit_defaultness(defaultness);
-    visitor.visit_id(impl_item.hir_id());
+    try_visit!(visitor.visit_ident(ident));
+    try_visit!(visitor.visit_generics(generics));
+    try_visit!(visitor.visit_defaultness(defaultness));
+    try_visit!(visitor.visit_id(impl_item.hir_id()));
     match *kind {
         ImplItemKind::Const(ref ty, body) => {
-            visitor.visit_ty(ty);
-            visitor.visit_nested_body(body);
-        }
-        ImplItemKind::Fn(ref sig, body_id) => {
-            visitor.visit_fn(
-                FnKind::Method(impl_item.ident, sig),
-                sig.decl,
-                body_id,
-                impl_item.span,
-                impl_item.owner_id.def_id,
-            );
-        }
-        ImplItemKind::Type(ref ty) => {
-            visitor.visit_ty(ty);
-        }
+            try_visit!(visitor.visit_ty(ty));
+            visitor.visit_nested_body(body)
+        }
+        ImplItemKind::Fn(ref sig, body_id) => visitor.visit_fn(
+            FnKind::Method(impl_item.ident, sig),
+            sig.decl,
+            body_id,
+            impl_item.span,
+            impl_item.owner_id.def_id,
+        ),
+        ImplItemKind::Type(ref ty) => visitor.visit_ty(ty),
     }
 }
 
 pub fn walk_foreign_item_ref<'v, V: Visitor<'v>>(
     visitor: &mut V,
     foreign_item_ref: &'v ForeignItemRef,
-) {
+) -> V::Result {
     // N.B., deliberately force a compilation error if/when new fields are added.
     let ForeignItemRef { id, ident, span: _ } = *foreign_item_ref;
-    visitor.visit_nested_foreign_item(id);
-    visitor.visit_ident(ident);
+    try_visit!(visitor.visit_nested_foreign_item(id));
+    visitor.visit_ident(ident)
 }
 
-pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'v ImplItemRef) {
+pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    impl_item_ref: &'v ImplItemRef,
+) -> V::Result {
     // N.B., deliberately force a compilation error if/when new fields are added.
     let ImplItemRef { id, ident, ref kind, span: _, trait_item_def_id: _ } = *impl_item_ref;
-    visitor.visit_nested_impl_item(id);
-    visitor.visit_ident(ident);
-    visitor.visit_associated_item_kind(kind);
+    try_visit!(visitor.visit_nested_impl_item(id));
+    try_visit!(visitor.visit_ident(ident));
+    visitor.visit_associated_item_kind(kind)
 }
 
-pub fn walk_trait_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_ref: &'v TraitRef<'v>) {
-    visitor.visit_id(trait_ref.hir_ref_id);
+pub fn walk_trait_ref<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    trait_ref: &'v TraitRef<'v>,
+) -> V::Result {
+    try_visit!(visitor.visit_id(trait_ref.hir_ref_id));
     visitor.visit_path(trait_ref.path, trait_ref.hir_ref_id)
 }
 
-pub fn walk_param_bound<'v, V: Visitor<'v>>(visitor: &mut V, bound: &'v GenericBound<'v>) {
+pub fn walk_param_bound<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    bound: &'v GenericBound<'v>,
+) -> V::Result {
     match *bound {
-        GenericBound::Trait(ref typ, _modifier) => {
-            visitor.visit_poly_trait_ref(typ);
-        }
+        GenericBound::Trait(ref typ, _modifier) => visitor.visit_poly_trait_ref(typ),
         GenericBound::Outlives(ref lifetime) => visitor.visit_lifetime(lifetime),
     }
 }
 
-pub fn walk_poly_trait_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_ref: &'v PolyTraitRef<'v>) {
+pub fn walk_poly_trait_ref<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    trait_ref: &'v PolyTraitRef<'v>,
+) -> V::Result {
     walk_list!(visitor, visit_generic_param, trait_ref.bound_generic_params);
-    visitor.visit_trait_ref(&trait_ref.trait_ref);
+    visitor.visit_trait_ref(&trait_ref.trait_ref)
 }
 
 pub fn walk_struct_def<'v, V: Visitor<'v>>(
     visitor: &mut V,
     struct_definition: &'v VariantData<'v>,
-) {
-    walk_list!(visitor, visit_id, struct_definition.ctor_hir_id());
+) -> V::Result {
+    visit_opt!(visitor, visit_id, struct_definition.ctor_hir_id());
     walk_list!(visitor, visit_field_def, struct_definition.fields());
+    V::Result::output()
 }
 
-pub fn walk_field_def<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v FieldDef<'v>) {
-    visitor.visit_id(field.hir_id);
-    visitor.visit_ident(field.ident);
-    visitor.visit_ty(field.ty);
+pub fn walk_field_def<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v FieldDef<'v>) -> V::Result {
+    try_visit!(visitor.visit_id(field.hir_id));
+    try_visit!(visitor.visit_ident(field.ident));
+    visitor.visit_ty(field.ty)
 }
 
 pub fn walk_enum_def<'v, V: Visitor<'v>>(
     visitor: &mut V,
     enum_definition: &'v EnumDef<'v>,
     item_id: HirId,
-) {
-    visitor.visit_id(item_id);
+) -> V::Result {
+    try_visit!(visitor.visit_id(item_id));
     walk_list!(visitor, visit_variant, enum_definition.variants);
+    V::Result::output()
 }
 
-pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V, variant: &'v Variant<'v>) {
-    visitor.visit_ident(variant.ident);
-    visitor.visit_id(variant.hir_id);
-    visitor.visit_variant_data(&variant.data);
-    walk_list!(visitor, visit_anon_const, &variant.disr_expr);
+pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V, variant: &'v Variant<'v>) -> V::Result {
+    try_visit!(visitor.visit_ident(variant.ident));
+    try_visit!(visitor.visit_id(variant.hir_id));
+    try_visit!(visitor.visit_variant_data(&variant.data));
+    visit_opt!(visitor, visit_anon_const, &variant.disr_expr);
+    V::Result::output()
 }
 
-pub fn walk_label<'v, V: Visitor<'v>>(visitor: &mut V, label: &'v Label) {
-    visitor.visit_ident(label.ident);
+pub fn walk_label<'v, V: Visitor<'v>>(visitor: &mut V, label: &'v Label) -> V::Result {
+    visitor.visit_ident(label.ident)
 }
 
-pub fn walk_inf<'v, V: Visitor<'v>>(visitor: &mut V, inf: &'v InferArg) {
-    visitor.visit_id(inf.hir_id);
+pub fn walk_inf<'v, V: Visitor<'v>>(visitor: &mut V, inf: &'v InferArg) -> V::Result {
+    visitor.visit_id(inf.hir_id)
 }
 
-pub fn walk_generic_arg<'v, V: Visitor<'v>>(visitor: &mut V, generic_arg: &'v GenericArg<'v>) {
+pub fn walk_generic_arg<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    generic_arg: &'v GenericArg<'v>,
+) -> V::Result {
     match generic_arg {
         GenericArg::Lifetime(lt) => visitor.visit_lifetime(lt),
         GenericArg::Type(ty) => visitor.visit_ty(ty),
@@ -1124,92 +1188,109 @@ pub fn walk_generic_arg<'v, V: Visitor<'v>>(visitor: &mut V, generic_arg: &'v Ge
     }
 }
 
-pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime) {
-    visitor.visit_id(lifetime.hir_id);
-    visitor.visit_ident(lifetime.ident);
+pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime) -> V::Result {
+    try_visit!(visitor.visit_id(lifetime.hir_id));
+    visitor.visit_ident(lifetime.ident)
 }
 
-pub fn walk_qpath<'v, V: Visitor<'v>>(visitor: &mut V, qpath: &'v QPath<'v>, id: HirId) {
+pub fn walk_qpath<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    qpath: &'v QPath<'v>,
+    id: HirId,
+) -> V::Result {
     match *qpath {
         QPath::Resolved(ref maybe_qself, ref path) => {
-            walk_list!(visitor, visit_ty, maybe_qself);
+            visit_opt!(visitor, visit_ty, maybe_qself);
             visitor.visit_path(path, id)
         }
         QPath::TypeRelative(ref qself, ref segment) => {
-            visitor.visit_ty(qself);
-            visitor.visit_path_segment(segment);
+            try_visit!(visitor.visit_ty(qself));
+            visitor.visit_path_segment(segment)
         }
-        QPath::LangItem(..) => {}
+        QPath::LangItem(..) => V::Result::output(),
     }
 }
 
-pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &Path<'v>) {
-    for segment in path.segments {
-        visitor.visit_path_segment(segment);
-    }
+pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &Path<'v>) -> V::Result {
+    walk_list!(visitor, visit_path_segment, path.segments);
+    V::Result::output()
 }
 
-pub fn walk_path_segment<'v, V: Visitor<'v>>(visitor: &mut V, segment: &'v PathSegment<'v>) {
-    visitor.visit_ident(segment.ident);
-    visitor.visit_id(segment.hir_id);
-    if let Some(ref args) = segment.args {
-        visitor.visit_generic_args(args);
-    }
+pub fn walk_path_segment<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    segment: &'v PathSegment<'v>,
+) -> V::Result {
+    try_visit!(visitor.visit_ident(segment.ident));
+    try_visit!(visitor.visit_id(segment.hir_id));
+    visit_opt!(visitor, visit_generic_args, segment.args);
+    V::Result::output()
 }
 
-pub fn walk_generic_args<'v, V: Visitor<'v>>(visitor: &mut V, generic_args: &'v GenericArgs<'v>) {
+pub fn walk_generic_args<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    generic_args: &'v GenericArgs<'v>,
+) -> V::Result {
     walk_list!(visitor, visit_generic_arg, generic_args.args);
     walk_list!(visitor, visit_assoc_type_binding, generic_args.bindings);
+    V::Result::output()
 }
 
 pub fn walk_assoc_type_binding<'v, V: Visitor<'v>>(
     visitor: &mut V,
     type_binding: &'v TypeBinding<'v>,
-) {
-    visitor.visit_id(type_binding.hir_id);
-    visitor.visit_ident(type_binding.ident);
-    visitor.visit_generic_args(type_binding.gen_args);
+) -> V::Result {
+    try_visit!(visitor.visit_id(type_binding.hir_id));
+    try_visit!(visitor.visit_ident(type_binding.ident));
+    try_visit!(visitor.visit_generic_args(type_binding.gen_args));
     match type_binding.kind {
         TypeBindingKind::Equality { ref term } => match term {
-            Term::Ty(ref ty) => visitor.visit_ty(ty),
-            Term::Const(ref c) => visitor.visit_anon_const(c),
+            Term::Ty(ref ty) => try_visit!(visitor.visit_ty(ty)),
+            Term::Const(ref c) => try_visit!(visitor.visit_anon_const(c)),
         },
         TypeBindingKind::Constraint { bounds } => walk_list!(visitor, visit_param_bound, bounds),
     }
+    V::Result::output()
 }
 
-pub fn walk_associated_item_kind<'v, V: Visitor<'v>>(_: &mut V, _: &'v AssocItemKind) {
+pub fn walk_associated_item_kind<'v, V: Visitor<'v>>(_: &mut V, _: &'v AssocItemKind) -> V::Result {
     // No visitable content here: this fn exists so you can call it if
     // the right thing to do, should content be added in the future,
     // would be to walk it.
+    V::Result::output()
 }
 
-pub fn walk_defaultness<'v, V: Visitor<'v>>(_: &mut V, _: &'v Defaultness) {
+pub fn walk_defaultness<'v, V: Visitor<'v>>(_: &mut V, _: &'v Defaultness) -> V::Result {
     // No visitable content here: this fn exists so you can call it if
     // the right thing to do, should content be added in the future,
     // would be to walk it.
+    V::Result::output()
 }
 
-pub fn walk_inline_asm<'v, V: Visitor<'v>>(visitor: &mut V, asm: &'v InlineAsm<'v>, id: HirId) {
+pub fn walk_inline_asm<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    asm: &'v InlineAsm<'v>,
+    id: HirId,
+) -> V::Result {
     for (op, op_sp) in asm.operands {
         match op {
             InlineAsmOperand::In { expr, .. } | InlineAsmOperand::InOut { expr, .. } => {
-                visitor.visit_expr(expr)
+                try_visit!(visitor.visit_expr(expr));
             }
             InlineAsmOperand::Out { expr, .. } => {
-                if let Some(expr) = expr {
-                    visitor.visit_expr(expr);
-                }
+                visit_opt!(visitor, visit_expr, expr);
             }
             InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
-                visitor.visit_expr(in_expr);
-                if let Some(out_expr) = out_expr {
-                    visitor.visit_expr(out_expr);
-                }
+                try_visit!(visitor.visit_expr(in_expr));
+                visit_opt!(visitor, visit_expr, out_expr);
             }
             InlineAsmOperand::Const { anon_const, .. }
-            | InlineAsmOperand::SymFn { anon_const, .. } => visitor.visit_anon_const(anon_const),
-            InlineAsmOperand::SymStatic { path, .. } => visitor.visit_qpath(path, id, *op_sp),
+            | InlineAsmOperand::SymFn { anon_const, .. } => {
+                try_visit!(visitor.visit_anon_const(anon_const));
+            }
+            InlineAsmOperand::SymStatic { path, .. } => {
+                try_visit!(visitor.visit_qpath(path, id, *op_sp));
+            }
         }
     }
+    V::Result::output()
 }
diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index 0a26e6fc6d7..89cd37e757f 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -469,6 +469,7 @@ hir_analysis_unrecognized_atomic_operation =
 hir_analysis_unrecognized_intrinsic_function =
     unrecognized intrinsic function: `{$name}`
     .label = unrecognized intrinsic
+    .help = if you're adding an intrinsic, be sure to update `check_intrinsic_type`
 
 hir_analysis_unused_associated_type_bounds =
     unnecessary associated type bound for not object safe associated type
diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/astconv/errors.rs
index ad34c31ef8f..214d9602968 100644
--- a/compiler/rustc_hir_analysis/src/astconv/errors.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/errors.rs
@@ -9,7 +9,7 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
 use rustc_data_structures::sorted_map::SortedMap;
 use rustc_data_structures::unord::UnordMap;
 use rustc_errors::{
-    codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, ErrorGuaranteed,
+    codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
 };
 use rustc_hir as hir;
 use rustc_hir::def_id::{DefId, LocalDefId};
@@ -371,7 +371,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
     // FIXME(fmease): Heavily adapted from `rustc_hir_typeck::method::suggest`. Deduplicate.
     fn note_ambiguous_inherent_assoc_type(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         candidates: Vec<DefId>,
         span: Span,
     ) {
@@ -429,7 +429,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
         let tcx = self.tcx();
 
         let adt_did = self_ty.ty_adt_def().map(|def| def.did());
-        let add_def_label = |err: &mut Diagnostic| {
+        let add_def_label = |err: &mut DiagnosticBuilder<'_>| {
             if let Some(did) = adt_did {
                 err.span_label(
                     tcx.def_span(did),
diff --git a/compiler/rustc_hir_analysis/src/astconv/generics.rs b/compiler/rustc_hir_analysis/src/astconv/generics.rs
index 614e5f9d32b..b20326ae5e1 100644
--- a/compiler/rustc_hir_analysis/src/astconv/generics.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/generics.rs
@@ -6,7 +6,7 @@ use crate::astconv::{
 use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs};
 use rustc_ast::ast::ParamKindOrd;
 use rustc_errors::{
-    codes::*, struct_span_code_err, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan,
+    codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan,
 };
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
@@ -47,7 +47,7 @@ fn generic_arg_mismatch_err(
         }
     }
 
-    let add_braces_suggestion = |arg: &GenericArg<'_>, err: &mut Diagnostic| {
+    let add_braces_suggestion = |arg: &GenericArg<'_>, err: &mut DiagnosticBuilder<'_>| {
         let suggestions = vec![
             (arg.span().shrink_to_lo(), String::from("{ ")),
             (arg.span().shrink_to_hi(), String::from(" }")),
diff --git a/compiler/rustc_hir_analysis/src/astconv/lint.rs b/compiler/rustc_hir_analysis/src/astconv/lint.rs
index cee7c84adb2..cee29b152e8 100644
--- a/compiler/rustc_hir_analysis/src/astconv/lint.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/lint.rs
@@ -1,5 +1,5 @@
 use rustc_ast::TraitObjectSyntax;
-use rustc_errors::{codes::*, Diagnostic, StashKey};
+use rustc_errors::{codes::*, DiagnosticBuilder, EmissionGuarantee, StashKey};
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
 use rustc_lint_defs::{builtin::BARE_TRAIT_OBJECTS, Applicability};
@@ -10,10 +10,10 @@ use super::AstConv;
 
 impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
     /// Make sure that we are in the condition to suggest the blanket implementation.
-    pub(super) fn maybe_lint_blanket_trait_impl(
+    pub(super) fn maybe_lint_blanket_trait_impl<G: EmissionGuarantee>(
         &self,
         self_ty: &hir::Ty<'_>,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_, G>,
     ) {
         let tcx = self.tcx();
         let parent_id = tcx.hir().get_parent_item(self_ty.hir_id).def_id;
@@ -75,7 +75,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
     }
 
     /// Make sure that we are in the condition to suggest `impl Trait`.
-    fn maybe_lint_impl_trait(&self, self_ty: &hir::Ty<'_>, diag: &mut Diagnostic) -> bool {
+    fn maybe_lint_impl_trait(
+        &self,
+        self_ty: &hir::Ty<'_>,
+        diag: &mut DiagnosticBuilder<'_>,
+    ) -> bool {
         let tcx = self.tcx();
         let parent_id = tcx.hir().get_parent_item(self_ty.hir_id).def_id;
         let (sig, generics, owner) = match tcx.hir_node_by_def_id(parent_id) {
diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs
index 3ccf78567ed..502e83db654 100644
--- a/compiler/rustc_hir_analysis/src/astconv/mod.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs
@@ -18,8 +18,8 @@ use crate::require_c_abi_if_c_variadic;
 use rustc_ast::TraitObjectSyntax;
 use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
 use rustc_errors::{
-    codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
-    FatalError, MultiSpan,
+    codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError,
+    MultiSpan,
 };
 use rustc_hir as hir;
 use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
@@ -1425,17 +1425,16 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
             vec![]
         };
 
-        let (impl_, (assoc_item, def_scope)) =
-            crate::traits::project::with_replaced_escaping_bound_vars(
-                infcx,
-                &mut universes,
-                self_ty,
-                |self_ty| {
-                    self.select_inherent_assoc_type_candidates(
-                        infcx, name, span, self_ty, param_env, candidates,
-                    )
-                },
-            )?;
+        let (impl_, (assoc_item, def_scope)) = crate::traits::with_replaced_escaping_bound_vars(
+            infcx,
+            &mut universes,
+            self_ty,
+            |self_ty| {
+                self.select_inherent_assoc_type_candidates(
+                    infcx, name, span, self_ty, param_env, candidates,
+                )
+            },
+        )?;
 
         self.check_assoc_ty(assoc_item, name, def_scope, block, span);
 
@@ -1725,7 +1724,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
     pub fn prohibit_generics<'a>(
         &self,
         segments: impl Iterator<Item = &'a hir::PathSegment<'a>> + Clone,
-        extend: impl Fn(&mut Diagnostic),
+        extend: impl Fn(&mut DiagnosticBuilder<'_>),
     ) -> bool {
         let args = segments.clone().flat_map(|segment| segment.args().args);
 
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index c3948b1b6bd..b3700013f9c 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -1248,7 +1248,7 @@ fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
 fn detect_discriminant_duplicate<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>) {
     // Helper closure to reduce duplicate code. This gets called everytime we detect a duplicate.
     // Here `idx` refers to the order of which the discriminant appears, and its index in `vs`
-    let report = |dis: Discr<'tcx>, idx, err: &mut Diagnostic| {
+    let report = |dis: Discr<'tcx>, idx, err: &mut DiagnosticBuilder<'_>| {
         let var = adt.variant(idx); // HIR for the duplicate discriminant
         let (span, display_discr) = match var.discr {
             ty::VariantDiscr::Explicit(discr_def_id) => {
diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs
index b9052672a26..36a92a4cf7c 100644
--- a/compiler/rustc_hir_analysis/src/check/mod.rs
+++ b/compiler/rustc_hir_analysis/src/check/mod.rs
@@ -78,7 +78,7 @@ use std::num::NonZero;
 
 use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
 use rustc_errors::ErrorGuaranteed;
-use rustc_errors::{pluralize, struct_span_code_err, Diagnostic, DiagnosticBuilder};
+use rustc_errors::{pluralize, struct_span_code_err, DiagnosticBuilder};
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_hir::intravisit::Visitor;
 use rustc_index::bit_set::BitSet;
diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs
index 45641be52d2..07bbaa1926e 100644
--- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs
+++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs
@@ -1,20 +1,12 @@
 //! Orphan checker: every impl either implements a trait defined in this
 //! crate or pertains to a type defined in this crate.
 
-use rustc_data_structures::fx::FxHashSet;
-use rustc_errors::{DelayDm, ErrorGuaranteed};
+use rustc_errors::ErrorGuaranteed;
 use rustc_hir as hir;
-use rustc_middle::ty::util::CheckRegions;
-use rustc_middle::ty::GenericArgs;
-use rustc_middle::ty::{
-    self, AliasKind, ImplPolarity, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
-    TypeVisitor,
-};
-use rustc_session::lint;
-use rustc_span::def_id::{DefId, LocalDefId};
+use rustc_middle::ty::{self, AliasKind, Ty, TyCtxt, TypeVisitableExt};
+use rustc_span::def_id::LocalDefId;
 use rustc_span::Span;
 use rustc_trait_selection::traits;
-use std::ops::ControlFlow;
 
 use crate::errors;
 
@@ -26,30 +18,17 @@ pub(crate) fn orphan_check_impl(
     let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap().instantiate_identity();
     trait_ref.error_reported()?;
 
-    let ret = do_orphan_check_impl(tcx, trait_ref, impl_def_id);
-    if tcx.trait_is_auto(trait_ref.def_id) {
-        lint_auto_trait_impl(tcx, trait_ref, impl_def_id);
-    }
-
-    ret
-}
-
-fn do_orphan_check_impl<'tcx>(
-    tcx: TyCtxt<'tcx>,
-    trait_ref: ty::TraitRef<'tcx>,
-    def_id: LocalDefId,
-) -> Result<(), ErrorGuaranteed> {
     let trait_def_id = trait_ref.def_id;
 
-    match traits::orphan_check(tcx, def_id.to_def_id()) {
+    match traits::orphan_check(tcx, impl_def_id.to_def_id()) {
         Ok(()) => {}
         Err(err) => {
-            let item = tcx.hir().expect_item(def_id);
+            let item = tcx.hir().expect_item(impl_def_id);
             let hir::ItemKind::Impl(impl_) = item.kind else {
-                bug!("{:?} is not an impl: {:?}", def_id, item);
+                bug!("{:?} is not an impl: {:?}", impl_def_id, item);
             };
             let tr = impl_.of_trait.as_ref().unwrap();
-            let sp = tcx.def_span(def_id);
+            let sp = tcx.def_span(impl_def_id);
 
             emit_orphan_check_error(
                 tcx,
@@ -193,7 +172,7 @@ fn do_orphan_check_impl<'tcx>(
             // impl<T> AutoTrait for T {}
             // impl<T: ?Sized> AutoTrait for T {}
             ty::Param(..) => (
-                if self_ty.is_sized(tcx, tcx.param_env(def_id)) {
+                if self_ty.is_sized(tcx, tcx.param_env(impl_def_id)) {
                     LocalImpl::Allow
                 } else {
                     LocalImpl::Disallow { problematic_kind: "generic type" }
@@ -250,7 +229,7 @@ fn do_orphan_check_impl<'tcx>(
             | ty::Bound(..)
             | ty::Placeholder(..)
             | ty::Infer(..) => {
-                let sp = tcx.def_span(def_id);
+                let sp = tcx.def_span(impl_def_id);
                 span_bug!(sp, "weird self type for autotrait impl")
             }
 
@@ -262,7 +241,7 @@ fn do_orphan_check_impl<'tcx>(
                 LocalImpl::Allow => {}
                 LocalImpl::Disallow { problematic_kind } => {
                     return Err(tcx.dcx().emit_err(errors::TraitsWithDefaultImpl {
-                        span: tcx.def_span(def_id),
+                        span: tcx.def_span(impl_def_id),
                         traits: tcx.def_path_str(trait_def_id),
                         problematic_kind,
                         self_ty,
@@ -274,13 +253,13 @@ fn do_orphan_check_impl<'tcx>(
                 NonlocalImpl::Allow => {}
                 NonlocalImpl::DisallowBecauseNonlocal => {
                     return Err(tcx.dcx().emit_err(errors::CrossCrateTraitsDefined {
-                        span: tcx.def_span(def_id),
+                        span: tcx.def_span(impl_def_id),
                         traits: tcx.def_path_str(trait_def_id),
                     }));
                 }
                 NonlocalImpl::DisallowOther => {
                     return Err(tcx.dcx().emit_err(errors::CrossCrateTraits {
-                        span: tcx.def_span(def_id),
+                        span: tcx.def_span(impl_def_id),
                         traits: tcx.def_path_str(trait_def_id),
                         self_ty,
                     }));
@@ -445,146 +424,3 @@ fn emit_orphan_check_error<'tcx>(
         }
     })
 }
-
-/// Lint impls of auto traits if they are likely to have
-/// unsound or surprising effects on auto impls.
-fn lint_auto_trait_impl<'tcx>(
-    tcx: TyCtxt<'tcx>,
-    trait_ref: ty::TraitRef<'tcx>,
-    impl_def_id: LocalDefId,
-) {
-    if trait_ref.args.len() != 1 {
-        tcx.dcx().span_delayed_bug(
-            tcx.def_span(impl_def_id),
-            "auto traits cannot have generic parameters",
-        );
-        return;
-    }
-    let self_ty = trait_ref.self_ty();
-    let (self_type_did, args) = match self_ty.kind() {
-        ty::Adt(def, args) => (def.did(), args),
-        _ => {
-            // FIXME: should also lint for stuff like `&i32` but
-            // considering that auto traits are unstable, that
-            // isn't too important for now as this only affects
-            // crates using `nightly`, and std.
-            return;
-        }
-    };
-
-    // Impls which completely cover a given root type are fine as they
-    // disable auto impls entirely. So only lint if the args
-    // are not a permutation of the identity args.
-    let Err(arg) = tcx.uses_unique_generic_params(args, CheckRegions::No) else {
-        // ok
-        return;
-    };
-
-    // Ideally:
-    //
-    // - compute the requirements for the auto impl candidate
-    // - check whether these are implied by the non covering impls
-    // - if not, emit the lint
-    //
-    // What we do here is a bit simpler:
-    //
-    // - badly check if an auto impl candidate definitely does not apply
-    //   for the given simplified type
-    // - if so, do not lint
-    if fast_reject_auto_impl(tcx, trait_ref.def_id, self_ty) {
-        // ok
-        return;
-    }
-
-    tcx.node_span_lint(
-        lint::builtin::SUSPICIOUS_AUTO_TRAIT_IMPLS,
-        tcx.local_def_id_to_hir_id(impl_def_id),
-        tcx.def_span(impl_def_id),
-        DelayDm(|| {
-            format!(
-                "cross-crate traits with a default impl, like `{}`, \
-                         should not be specialized",
-                tcx.def_path_str(trait_ref.def_id),
-            )
-        }),
-        |lint| {
-            let item_span = tcx.def_span(self_type_did);
-            let self_descr = tcx.def_descr(self_type_did);
-            match arg {
-                ty::util::NotUniqueParam::DuplicateParam(arg) => {
-                    lint.note(format!("`{arg}` is mentioned multiple times"));
-                }
-                ty::util::NotUniqueParam::NotParam(arg) => {
-                    lint.note(format!("`{arg}` is not a generic parameter"));
-                }
-            }
-            lint.span_note(
-                item_span,
-                format!(
-                    "try using the same sequence of generic parameters as the {self_descr} definition",
-                ),
-            );
-        },
-    );
-}
-
-fn fast_reject_auto_impl<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, self_ty: Ty<'tcx>) -> bool {
-    struct DisableAutoTraitVisitor<'tcx> {
-        tcx: TyCtxt<'tcx>,
-        trait_def_id: DefId,
-        self_ty_root: Ty<'tcx>,
-        seen: FxHashSet<DefId>,
-    }
-
-    impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for DisableAutoTraitVisitor<'tcx> {
-        type BreakTy = ();
-        fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
-            let tcx = self.tcx;
-            if ty != self.self_ty_root {
-                for impl_def_id in tcx.non_blanket_impls_for_ty(self.trait_def_id, ty) {
-                    match tcx.impl_polarity(impl_def_id) {
-                        ImplPolarity::Negative => return ControlFlow::Break(()),
-                        ImplPolarity::Reservation => {}
-                        // FIXME(@lcnr): That's probably not good enough, idk
-                        //
-                        // We might just want to take the rustdoc code and somehow avoid
-                        // explicit impls for `Self`.
-                        ImplPolarity::Positive => return ControlFlow::Continue(()),
-                    }
-                }
-            }
-
-            match ty.kind() {
-                ty::Adt(def, args) if def.is_phantom_data() => args.visit_with(self),
-                ty::Adt(def, args) => {
-                    // @lcnr: This is the only place where cycles can happen. We avoid this
-                    // by only visiting each `DefId` once.
-                    //
-                    // This will be is incorrect in subtle cases, but I don't care :)
-                    if self.seen.insert(def.did()) {
-                        for ty in def.all_fields().map(|field| field.ty(tcx, args)) {
-                            ty.visit_with(self)?;
-                        }
-                    }
-
-                    ControlFlow::Continue(())
-                }
-                _ => ty.super_visit_with(self),
-            }
-        }
-    }
-
-    let self_ty_root = match self_ty.kind() {
-        ty::Adt(def, _) => Ty::new_adt(tcx, *def, GenericArgs::identity_for_item(tcx, def.did())),
-        _ => unimplemented!("unexpected self ty {:?}", self_ty),
-    };
-
-    self_ty_root
-        .visit_with(&mut DisableAutoTraitVisitor {
-            tcx,
-            self_ty_root,
-            trait_def_id,
-            seen: FxHashSet::default(),
-        })
-        .is_break()
-}
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index a5ef1490bce..cffb88a1365 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -1630,7 +1630,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>(
 #[instrument(level = "debug", skip(tcx))]
 fn predicates_defined_on(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
     let mut result = tcx.explicit_predicates_of(def_id);
-    debug!("predicates_defined_on: explicit_predicates_of({:?}) = {:?}", def_id, result,);
+    debug!("predicates_defined_on: explicit_predicates_of({:?}) = {:?}", def_id, result);
     let inferred_outlives = tcx.inferred_outlives_of(def_id);
     if !inferred_outlives.is_empty() {
         debug!(
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index 03ec8e163d6..d217d16ed84 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -143,6 +143,7 @@ pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
 
 #[derive(Diagnostic)]
 #[diag(hir_analysis_unrecognized_intrinsic_function, code = E0093)]
+#[help]
 pub struct UnrecognizedIntrinsicFunction {
     #[primary_span]
     #[label]
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
index e53f922ad10..7cb103626da 100644
--- a/compiler/rustc_hir_analysis/src/lib.rs
+++ b/compiler/rustc_hir_analysis/src/lib.rs
@@ -198,6 +198,17 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
         collect::test_opaque_hidden_types(tcx)?;
     }
 
+    // Make sure we evaluate all static and (non-associated) const items, even if unused.
+    // If any of these fail to evaluate, we do not want this crate to pass compilation.
+    tcx.hir().par_body_owners(|item_def_id| {
+        let def_kind = tcx.def_kind(item_def_id);
+        match def_kind {
+            DefKind::Static(_) => tcx.ensure().eval_static_initializer(item_def_id),
+            DefKind::Const => tcx.ensure().const_eval_poly(item_def_id.into()),
+            _ => (),
+        }
+    });
+
     // Freeze definitions as we don't add new ones at this point. This improves performance by
     // allowing lock-free access to them.
     tcx.untracked().definitions.freeze();
diff --git a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs
index f9d57d402b1..8e0c2ea5ca7 100644
--- a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs
+++ b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs
@@ -1,5 +1,5 @@
 use crate::structured_errors::StructuredDiagnostic;
-use rustc_errors::{codes::*, pluralize, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan};
+use rustc_errors::{codes::*, pluralize, Applicability, DiagnosticBuilder, MultiSpan};
 use rustc_hir as hir;
 use rustc_middle::ty::{self as ty, AssocItems, AssocKind, TyCtxt};
 use rustc_session::Session;
@@ -525,7 +525,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
     }
 
     /// Builds the `expected 1 type argument / supplied 2 type arguments` message.
-    fn notify(&self, err: &mut Diagnostic) {
+    fn notify(&self, err: &mut DiagnosticBuilder<'_>) {
         let (quantifier, bound) = self.get_quantifier_and_bound();
         let provided_args = self.num_provided_args();
 
@@ -577,7 +577,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
         }
     }
 
-    fn suggest(&self, err: &mut Diagnostic) {
+    fn suggest(&self, err: &mut DiagnosticBuilder<'_>) {
         debug!(
             "suggest(self.provided {:?}, self.gen_args.span(): {:?})",
             self.num_provided_args(),
@@ -605,7 +605,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
     /// ```text
     /// type Map = HashMap<String>;
     /// ```
-    fn suggest_adding_args(&self, err: &mut Diagnostic) {
+    fn suggest_adding_args(&self, err: &mut DiagnosticBuilder<'_>) {
         if self.gen_args.parenthesized != hir::GenericArgsParentheses::No {
             return;
         }
@@ -624,7 +624,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
         }
     }
 
-    fn suggest_adding_lifetime_args(&self, err: &mut Diagnostic) {
+    fn suggest_adding_lifetime_args(&self, err: &mut DiagnosticBuilder<'_>) {
         debug!("suggest_adding_lifetime_args(path_segment: {:?})", self.path_segment);
         let num_missing_args = self.num_missing_lifetime_args();
         let num_params_to_take = num_missing_args;
@@ -678,7 +678,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
         }
     }
 
-    fn suggest_adding_type_and_const_args(&self, err: &mut Diagnostic) {
+    fn suggest_adding_type_and_const_args(&self, err: &mut DiagnosticBuilder<'_>) {
         let num_missing_args = self.num_missing_type_or_const_args();
         let msg = format!("add missing {} argument{}", self.kind(), pluralize!(num_missing_args));
 
@@ -738,7 +738,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
     /// ```compile_fail
     /// Into::into::<Option<_>>(42) // suggests considering `Into::<Option<_>>::into(42)`
     /// ```
-    fn suggest_moving_args_from_assoc_fn_to_trait(&self, err: &mut Diagnostic) {
+    fn suggest_moving_args_from_assoc_fn_to_trait(&self, err: &mut DiagnosticBuilder<'_>) {
         let trait_ = match self.tcx.trait_of_item(self.def_id) {
             Some(def_id) => def_id,
             None => return,
@@ -794,7 +794,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
 
     fn suggest_moving_args_from_assoc_fn_to_trait_for_qualified_path(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         qpath: &'tcx hir::QPath<'tcx>,
         msg: String,
         num_assoc_fn_excess_args: usize,
@@ -827,7 +827,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
 
     fn suggest_moving_args_from_assoc_fn_to_trait_for_method_call(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_def_id: DefId,
         expr: &'tcx hir::Expr<'tcx>,
         msg: String,
@@ -881,7 +881,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
     /// ```text
     /// type Map = HashMap<String, String, String, String>;
     /// ```
-    fn suggest_removing_args_or_generics(&self, err: &mut Diagnostic) {
+    fn suggest_removing_args_or_generics(&self, err: &mut DiagnosticBuilder<'_>) {
         let num_provided_lt_args = self.num_provided_lifetime_args();
         let num_provided_type_const_args = self.num_provided_type_or_const_args();
         let unbound_types = self.get_unbound_associated_types();
@@ -899,7 +899,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
         let provided_args_matches_unbound_traits =
             unbound_types.len() == num_redundant_type_or_const_args;
 
-        let remove_lifetime_args = |err: &mut Diagnostic| {
+        let remove_lifetime_args = |err: &mut DiagnosticBuilder<'_>| {
             let mut lt_arg_spans = Vec::new();
             let mut found_redundant = false;
             for arg in self.gen_args.args {
@@ -940,7 +940,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
             );
         };
 
-        let remove_type_or_const_args = |err: &mut Diagnostic| {
+        let remove_type_or_const_args = |err: &mut DiagnosticBuilder<'_>| {
             let mut gen_arg_spans = Vec::new();
             let mut found_redundant = false;
             for arg in self.gen_args.args {
@@ -1037,7 +1037,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
     }
 
     /// Builds the `type defined here` message.
-    fn show_definition(&self, err: &mut Diagnostic) {
+    fn show_definition(&self, err: &mut DiagnosticBuilder<'_>) {
         let mut spans: MultiSpan = if let Some(def_span) = self.tcx.def_ident_span(self.def_id) {
             if self.tcx.sess.source_map().is_span_accessible(def_span) {
                 def_span.into()
@@ -1088,7 +1088,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
     }
 
     /// Add note if `impl Trait` is explicitly specified.
-    fn note_synth_provided(&self, err: &mut Diagnostic) {
+    fn note_synth_provided(&self, err: &mut DiagnosticBuilder<'_>) {
         if !self.is_synth_provided() {
             return;
         }
diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs
index 18adf37d08c..cb131f1d166 100644
--- a/compiler/rustc_hir_typeck/src/_match.rs
+++ b/compiler/rustc_hir_typeck/src/_match.rs
@@ -1,6 +1,6 @@
 use crate::coercion::{AsCoercionSite, CoerceMany};
 use crate::{Diverges, Expectation, FnCtxt, Needs};
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir::{
     self as hir,
     def::{CtorOf, DefKind, Res},
@@ -177,7 +177,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn explain_never_type_coerced_to_unit(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         arm: &hir::Arm<'tcx>,
         arm_ty: Ty<'tcx>,
         prior_arm: Option<(Option<hir::HirId>, Ty<'tcx>, Span)>,
@@ -209,7 +209,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn suggest_removing_semicolon_for_coerce(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         arm_ty: Ty<'tcx>,
         prior_arm: Option<(Option<hir::HirId>, Ty<'tcx>, Span)>,
@@ -303,7 +303,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// `if let PAT = EXPR {}` expressions that could be turned into `let PAT = EXPR;`.
     fn explain_if_expr(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         ret_reason: Option<(Span, String)>,
         if_span: Span,
         cond_expr: &'tcx hir::Expr<'tcx>,
diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs
index 27614634c6b..69bcb6b8c15 100644
--- a/compiler/rustc_hir_typeck/src/callee.rs
+++ b/compiler/rustc_hir_typeck/src/callee.rs
@@ -4,7 +4,7 @@ use super::{Expectation, FnCtxt, TupleArgumentsFlag};
 
 use crate::errors;
 use rustc_ast::util::parser::PREC_POSTFIX;
-use rustc_errors::{Applicability, Diagnostic, ErrorGuaranteed, StashKey};
+use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, StashKey};
 use rustc_hir as hir;
 use rustc_hir::def::{self, CtorKind, Namespace, Res};
 use rustc_hir::def_id::DefId;
@@ -347,7 +347,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// likely intention is to call the closure, suggest `(||{})()`. (#55851)
     fn identify_bad_closure_def_and_call(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         hir_id: hir::HirId,
         callee_node: &hir::ExprKind<'_>,
         callee_span: Span,
@@ -410,7 +410,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// likely intention is to create an array containing tuples.
     fn maybe_suggest_bad_array_definition(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         call_expr: &'tcx hir::Expr<'tcx>,
         callee_expr: &'tcx hir::Expr<'tcx>,
     ) -> bool {
@@ -601,7 +601,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// and suggesting the fix if the method probe is successful.
     fn suggest_call_as_method(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_, ()>,
         segment: &'tcx hir::PathSegment<'tcx>,
         arg_exprs: &'tcx [hir::Expr<'tcx>],
         call_expr: &'tcx hir::Expr<'tcx>,
diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs
index 042dd576c5b..48fc2900b0d 100644
--- a/compiler/rustc_hir_typeck/src/cast.rs
+++ b/compiler/rustc_hir_typeck/src/cast.rs
@@ -33,7 +33,7 @@ use super::FnCtxt;
 use crate::errors;
 use crate::type_error_struct;
 use hir::ExprKind;
-use rustc_errors::{codes::*, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed};
+use rustc_errors::{codes::*, Applicability, DiagnosticBuilder, ErrorGuaranteed};
 use rustc_hir as hir;
 use rustc_macros::{TypeFoldable, TypeVisitable};
 use rustc_middle::mir::Mutability;
@@ -983,7 +983,11 @@ impl<'a, 'tcx> CastCheck<'tcx> {
 
     /// Attempt to suggest using `.is_empty` when trying to cast from a
     /// collection type to a boolean.
-    fn try_suggest_collection_to_bool(&self, fcx: &FnCtxt<'a, 'tcx>, err: &mut Diagnostic) {
+    fn try_suggest_collection_to_bool(
+        &self,
+        fcx: &FnCtxt<'a, 'tcx>,
+        err: &mut DiagnosticBuilder<'_>,
+    ) {
         if self.cast_ty.is_bool() {
             let derefed = fcx
                 .autoderef(self.expr_span, self.expr_ty)
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs
index 6bab8f75d24..9f6175eac13 100644
--- a/compiler/rustc_hir_typeck/src/coercion.rs
+++ b/compiler/rustc_hir_typeck/src/coercion.rs
@@ -36,9 +36,7 @@
 //! ```
 
 use crate::FnCtxt;
-use rustc_errors::{
-    codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan,
-};
+use rustc_errors::{codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, MultiSpan};
 use rustc_hir as hir;
 use rustc_hir::def_id::DefId;
 use rustc_hir::intravisit::{self, Visitor};
@@ -1439,7 +1437,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
         &mut self,
         fcx: &FnCtxt<'a, 'tcx>,
         cause: &ObligationCause<'tcx>,
-        augment_error: impl FnOnce(&mut Diagnostic),
+        augment_error: impl FnOnce(&mut DiagnosticBuilder<'_>),
         label_unit_as_expected: bool,
     ) {
         self.coerce_inner(
@@ -1462,7 +1460,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
         cause: &ObligationCause<'tcx>,
         expression: Option<&'tcx hir::Expr<'tcx>>,
         mut expression_ty: Ty<'tcx>,
-        augment_error: impl FnOnce(&mut Diagnostic),
+        augment_error: impl FnOnce(&mut DiagnosticBuilder<'_>),
         label_expression_as_expected: bool,
     ) {
         // Incorporate whatever type inference information we have
@@ -1673,7 +1671,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
 
     fn note_unreachable_loop_return(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         tcx: TyCtxt<'tcx>,
         expr: &hir::Expr<'tcx>,
         ret_exprs: &Vec<&'tcx hir::Expr<'tcx>>,
diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs
index fdb2cb69ee7..98e3fbb8b11 100644
--- a/compiler/rustc_hir_typeck/src/demand.rs
+++ b/compiler/rustc_hir_typeck/src/demand.rs
@@ -1,6 +1,6 @@
 use crate::FnCtxt;
 use rustc_errors::MultiSpan;
-use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir as hir;
 use rustc_hir::def::Res;
 use rustc_hir::intravisit::Visitor;
@@ -19,7 +19,7 @@ use super::method::probe;
 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     pub fn emit_type_mismatch_suggestions(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         expr_ty: Ty<'tcx>,
         expected: Ty<'tcx>,
@@ -70,7 +70,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub fn emit_coerce_suggestions(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         expr_ty: Ty<'tcx>,
         expected: Ty<'tcx>,
@@ -280,7 +280,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// with some expectation given by `source`.
     pub fn note_source_of_type_mismatch_constraint(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         source: TypeMismatchSource<'tcx>,
     ) -> bool {
@@ -550,7 +550,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     // expected type.
     pub fn annotate_loop_expected_due_to_inference(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         error: Option<TypeError<'tcx>>,
     ) {
@@ -673,7 +673,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn annotate_expected_due_to_let_ty(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         error: Option<TypeError<'tcx>>,
     ) {
@@ -782,7 +782,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn annotate_alternative_method_deref(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         error: Option<TypeError<'tcx>>,
     ) {
@@ -1029,7 +1029,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn explain_self_literal(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
@@ -1082,7 +1082,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn note_wrong_return_ty_due_to_generic_arg(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         checked_ty: Ty<'tcx>,
     ) {
diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs
index 1af0b75bd23..f609d0f7e8f 100644
--- a/compiler/rustc_hir_typeck/src/errors.rs
+++ b/compiler/rustc_hir_typeck/src/errors.rs
@@ -3,8 +3,8 @@ use std::borrow::Cow;
 
 use crate::fluent_generated as fluent;
 use rustc_errors::{
-    codes::*, AddToDiagnostic, Applicability, Diagnostic, DiagnosticArgValue, IntoDiagnosticArg,
-    MultiSpan, SubdiagnosticMessageOp,
+    codes::*, AddToDiagnostic, Applicability, DiagnosticArgValue, DiagnosticBuilder,
+    EmissionGuarantee, IntoDiagnosticArg, MultiSpan, SubdiagnosticMessageOp,
 };
 use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
 use rustc_middle::ty::Ty;
@@ -195,7 +195,11 @@ pub struct TypeMismatchFruTypo {
 }
 
 impl AddToDiagnostic for TypeMismatchFruTypo {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         diag.arg("expr", self.expr.as_deref().unwrap_or("NONE"));
 
         // Only explain that `a ..b` is a range if it's split up
@@ -370,7 +374,11 @@ pub struct RemoveSemiForCoerce {
 }
 
 impl AddToDiagnostic for RemoveSemiForCoerce {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         let mut multispan: MultiSpan = self.semi.into();
         multispan.push_span_label(self.expr, fluent::hir_typeck_remove_semi_for_coerce_expr);
         multispan.push_span_label(self.ret, fluent::hir_typeck_remove_semi_for_coerce_ret);
@@ -541,8 +549,12 @@ pub enum CastUnknownPointerSub {
     From(Span),
 }
 
-impl AddToDiagnostic for CastUnknownPointerSub {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F) {
+impl rustc_errors::AddToDiagnostic for CastUnknownPointerSub {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         match self {
             CastUnknownPointerSub::To(span) => {
                 let msg = f(diag, crate::fluent_generated::hir_typeck_label_to);
diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs
index a946d59ff2b..0f6544c3e1f 100644
--- a/compiler/rustc_hir_typeck/src/expr.rs
+++ b/compiler/rustc_hir_typeck/src/expr.rs
@@ -26,8 +26,8 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_data_structures::stack::ensure_sufficient_stack;
 use rustc_data_structures::unord::UnordMap;
 use rustc_errors::{
-    codes::*, pluralize, struct_span_code_err, AddToDiagnostic, Applicability, Diagnostic,
-    DiagnosticBuilder, ErrorGuaranteed, StashKey,
+    codes::*, pluralize, struct_span_code_err, AddToDiagnostic, Applicability, DiagnosticBuilder,
+    ErrorGuaranteed, StashKey,
 };
 use rustc_hir as hir;
 use rustc_hir::def::{CtorKind, DefKind, Res};
@@ -69,7 +69,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         &self,
         expr: &'tcx hir::Expr<'tcx>,
         expected_ty: Ty<'tcx>,
-        extend_err: impl FnOnce(&mut Diagnostic),
+        extend_err: impl FnOnce(&mut DiagnosticBuilder<'_>),
     ) -> Ty<'tcx> {
         let mut ty = self.check_expr_with_expectation(expr, ExpectHasType(expected_ty));
 
@@ -958,7 +958,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         lhs: &'tcx hir::Expr<'tcx>,
         code: ErrCode,
         op_span: Span,
-        adjust_err: impl FnOnce(&mut Diagnostic),
+        adjust_err: impl FnOnce(&mut DiagnosticBuilder<'_>),
     ) {
         if lhs.is_syntactic_place_expr() {
             return;
@@ -1223,7 +1223,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
         let lhs_ty = self.check_expr_with_needs(lhs, Needs::MutPlace);
 
-        let suggest_deref_binop = |err: &mut Diagnostic, rhs_ty: Ty<'tcx>| {
+        let suggest_deref_binop = |err: &mut DiagnosticBuilder<'_>, rhs_ty: Ty<'tcx>| {
             if let Some(lhs_deref_ty) = self.deref_once_mutably_for_diagnostic(lhs_ty) {
                 // Can only assign if the type is sized, so if `DerefMut` yields a type that is
                 // unsized, do not suggest dereferencing it.
@@ -2008,7 +2008,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         last_expr_field: &hir::ExprField<'tcx>,
         variant: &ty::VariantDef,
         args: GenericArgsRef<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) {
         // I don't use 'is_range_literal' because only double-sided, half-open ranges count.
         if let ExprKind::Struct(QPath::LangItem(LangItem::Range, ..), [range_start, range_end], _) =
@@ -2524,7 +2524,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn suggest_await_on_field_access(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         field_ident: Ident,
         base: &'tcx hir::Expr<'tcx>,
         ty: Ty<'tcx>,
@@ -2723,7 +2723,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         err.emit()
     }
 
-    fn point_at_param_definition(&self, err: &mut Diagnostic, param: ty::ParamTy) {
+    fn point_at_param_definition(&self, err: &mut DiagnosticBuilder<'_>, param: ty::ParamTy) {
         let generics = self.tcx.generics_of(self.body_id);
         let generic_param = generics.type_param(&param, self.tcx);
         if let ty::GenericParamDefKind::Type { synthetic: true, .. } = generic_param.kind {
@@ -2742,7 +2742,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn maybe_suggest_array_indexing(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         base: &hir::Expr<'_>,
         field: Ident,
@@ -2766,7 +2766,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn suggest_first_deref_field(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         base: &hir::Expr<'_>,
         field: Ident,
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
index ce8b62d19b4..986af2f5c9e 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
@@ -5,7 +5,7 @@ use crate::rvalue_scopes;
 use crate::{BreakableCtxt, Diverges, Expectation, FnCtxt, LoweredTy};
 use rustc_data_structures::captures::Captures;
 use rustc_data_structures::fx::FxHashSet;
-use rustc_errors::{Applicability, Diagnostic, ErrorGuaranteed, MultiSpan, StashKey};
+use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan, StashKey};
 use rustc_hir as hir;
 use rustc_hir::def::{CtorOf, DefKind, Res};
 use rustc_hir::def_id::DefId;
@@ -1020,7 +1020,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(in super::super) fn note_internal_mutation_in_method(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expected: Option<Ty<'tcx>>,
         found: Ty<'tcx>,
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
index d8d3d45dd40..2d9ec9f6bab 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
@@ -13,7 +13,7 @@ use itertools::Itertools;
 use rustc_ast as ast;
 use rustc_data_structures::fx::FxIndexSet;
 use rustc_errors::{
-    codes::*, pluralize, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan, StashKey,
+    codes::*, pluralize, Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan, StashKey,
 };
 use rustc_hir as hir;
 use rustc_hir::def::{CtorOf, DefKind, Res};
@@ -740,8 +740,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         });
 
         // We're done if we found errors, but we already emitted them.
-        if let Some(reported) = reported {
-            assert!(errors.is_empty());
+        if let Some(reported) = reported
+            && errors.is_empty()
+        {
             return reported;
         }
         assert!(!errors.is_empty());
@@ -1935,7 +1936,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn label_fn_like(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         callable_def_id: Option<DefId>,
         callee_ty: Option<Ty<'tcx>>,
         call_expr: &'tcx hir::Expr<'tcx>,
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
index c1a32a1afa3..e57717c25d9 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
@@ -12,7 +12,7 @@ use core::cmp::min;
 use core::iter;
 use rustc_ast::util::parser::{ExprPrecedence, PREC_POSTFIX};
 use rustc_data_structures::packed::Pu128;
-use rustc_errors::{Applicability, Diagnostic, MultiSpan};
+use rustc_errors::{Applicability, DiagnosticBuilder, MultiSpan};
 use rustc_hir as hir;
 use rustc_hir::def::Res;
 use rustc_hir::def::{CtorKind, CtorOf, DefKind};
@@ -48,7 +48,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             .copied()
     }
 
-    pub(in super::super) fn suggest_semicolon_at_end(&self, span: Span, err: &mut Diagnostic) {
+    pub(in super::super) fn suggest_semicolon_at_end(
+        &self,
+        span: Span,
+        err: &mut DiagnosticBuilder<'_>,
+    ) {
         // This suggestion is incorrect for
         // fn foo() -> bool { match () { () => true } || match () { () => true } }
         err.span_suggestion_short(
@@ -66,7 +70,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// - Possible missing return type if the return type is the default, and not `fn main()`.
     pub fn suggest_mismatched_types_on_tail(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &'tcx hir::Expr<'tcx>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
@@ -97,7 +101,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// ```
     pub(crate) fn suggest_fn_call(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         found: Ty<'tcx>,
         can_satisfy: impl FnOnce(Ty<'tcx>) -> bool,
@@ -179,7 +183,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub fn suggest_two_fn_call(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         lhs_expr: &'tcx hir::Expr<'tcx>,
         lhs_ty: Ty<'tcx>,
         rhs_expr: &'tcx hir::Expr<'tcx>,
@@ -253,7 +257,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub fn suggest_remove_last_method_call(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         expected: Ty<'tcx>,
     ) -> bool {
@@ -282,7 +286,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub fn suggest_deref_ref_or_into(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
@@ -540,7 +544,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// in the heap by calling `Box::new()`.
     pub(in super::super) fn suggest_boxing_when_appropriate(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         hir_id: HirId,
         expected: Ty<'tcx>,
@@ -583,7 +587,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// suggest a non-capturing closure
     pub(in super::super) fn suggest_no_capture_closure(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
     ) -> bool {
@@ -620,7 +624,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     #[instrument(skip(self, err))]
     pub(in super::super) fn suggest_calling_boxed_future_when_appropriate(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
@@ -732,7 +736,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// block is needed to be added too (`|| { expr; }`). This is denoted by `needs_block`.
     pub fn suggest_missing_semicolon(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expression: &'tcx hir::Expr<'tcx>,
         expected: Ty<'tcx>,
         needs_block: bool,
@@ -791,7 +795,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     #[instrument(level = "trace", skip(self, err))]
     pub(in super::super) fn suggest_missing_return_type(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         fn_decl: &hir::FnDecl<'tcx>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
@@ -909,7 +913,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// ```
     fn try_suggest_return_impl_trait(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
         fn_id: hir::HirId,
@@ -1014,7 +1018,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(in super::super) fn suggest_missing_break_or_return_expr(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &'tcx hir::Expr<'tcx>,
         fn_decl: &hir::FnDecl<'tcx>,
         expected: Ty<'tcx>,
@@ -1118,7 +1122,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(in super::super) fn suggest_missing_parentheses(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
     ) -> bool {
         let sp = self.tcx.sess.source_map().start_point(expr.span).with_parent(None);
@@ -1136,7 +1140,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// if it was possibly mistaken array syntax.
     pub(crate) fn suggest_block_to_brackets_peeling_refs(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         mut expr: &hir::Expr<'_>,
         mut expr_ty: Ty<'tcx>,
         mut expected_ty: Ty<'tcx>,
@@ -1163,7 +1167,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_clone_for_ref(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expr_ty: Ty<'tcx>,
         expected_ty: Ty<'tcx>,
@@ -1198,7 +1202,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_copied_cloned_or_as_ref(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expr_ty: Ty<'tcx>,
         expected_ty: Ty<'tcx>,
@@ -1248,7 +1252,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_into(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expr_ty: Ty<'tcx>,
         expected_ty: Ty<'tcx>,
@@ -1311,7 +1315,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// When expecting a `bool` and finding an `Option`, suggests using `let Some(..)` or `.is_some()`
     pub(crate) fn suggest_option_to_bool(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expr_ty: Ty<'tcx>,
         expected_ty: Ty<'tcx>,
@@ -1368,7 +1372,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// in case the block was mistaken array syntax, e.g. `{ 1 }` -> `[ 1 ]`.
     pub(crate) fn suggest_block_to_brackets(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         blk: &hir::Block<'_>,
         blk_ty: Ty<'tcx>,
         expected_ty: Ty<'tcx>,
@@ -1408,7 +1412,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     #[instrument(skip(self, err))]
     pub(crate) fn suggest_floating_point_literal(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expected_ty: Ty<'tcx>,
     ) -> bool {
@@ -1479,7 +1483,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     #[instrument(skip(self, err))]
     pub(crate) fn suggest_null_ptr_for_literal_zero_given_to_ptr_arg(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expected_ty: Ty<'tcx>,
     ) -> bool {
@@ -1517,7 +1521,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_associated_const(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         expected_ty: Ty<'tcx>,
     ) -> bool {
@@ -1611,7 +1615,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// which is a side-effect of autoref.
     pub(crate) fn note_type_is_not_clone(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         expected_ty: Ty<'tcx>,
         found_ty: Ty<'tcx>,
         expr: &hir::Expr<'_>,
@@ -1811,7 +1815,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         &self,
         blk: &'tcx hir::Block<'tcx>,
         expected_ty: Ty<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) -> bool {
         if let Some((span_semi, boxed)) = self.err_ctxt().could_remove_semicolon(blk, expected_ty) {
             if let StatementAsExpression::NeedsBoxing = boxed {
@@ -1856,7 +1860,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_missing_unwrap_expect(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
@@ -1939,7 +1943,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_coercing_result_via_try_operator(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
@@ -1986,7 +1990,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// sole field is of the found type, suggest such variants. (Issue #42764)
     pub(crate) fn suggest_compatible_variants(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expected: Ty<'tcx>,
         expr_ty: Ty<'tcx>,
@@ -2175,7 +2179,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_non_zero_new_unwrap(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         expected: Ty<'tcx>,
         expr_ty: Ty<'tcx>,
@@ -2719,7 +2723,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_cast(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         checked_ty: Ty<'tcx>,
         expected_ty: Ty<'tcx>,
@@ -2847,7 +2851,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         let in_const_context = self.tcx.hir().is_inside_const_context(expr.hir_id);
 
         let suggest_fallible_into_or_lhs_from =
-            |err: &mut Diagnostic, exp_to_found_is_fallible: bool| {
+            |err: &mut DiagnosticBuilder<'_>, exp_to_found_is_fallible: bool| {
                 // If we know the expression the expected type is derived from, we might be able
                 // to suggest a widening conversion rather than a narrowing one (which may
                 // panic). For example, given x: u8 and y: u32, if we know the span of "x",
@@ -2887,7 +2891,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             };
 
         let suggest_to_change_suffix_or_into =
-            |err: &mut Diagnostic,
+            |err: &mut DiagnosticBuilder<'_>,
              found_to_exp_is_fallible: bool,
              exp_to_found_is_fallible: bool| {
                 let exp_is_lhs = expected_ty_expr.is_some_and(|e| self.tcx.hir().is_lhs(e.hir_id));
@@ -3085,7 +3089,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// Identify when the user has written `foo..bar()` instead of `foo.bar()`.
     pub(crate) fn suggest_method_call_on_range_literal(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'tcx>,
         checked_ty: Ty<'tcx>,
         expected_ty: Ty<'tcx>,
@@ -3163,7 +3167,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// block without a tail expression.
     pub(crate) fn suggest_return_binding_for_missing_tail_expr(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         checked_ty: Ty<'tcx>,
         expected_ty: Ty<'tcx>,
diff --git a/compiler/rustc_hir_typeck/src/method/mod.rs b/compiler/rustc_hir_typeck/src/method/mod.rs
index fb969c82d8a..f8d0911a2eb 100644
--- a/compiler/rustc_hir_typeck/src/method/mod.rs
+++ b/compiler/rustc_hir_typeck/src/method/mod.rs
@@ -11,7 +11,7 @@ pub use self::suggest::SelfSource;
 pub use self::MethodError::*;
 
 use crate::FnCtxt;
-use rustc_errors::{Applicability, Diagnostic, SubdiagnosticMessage};
+use rustc_errors::{Applicability, DiagnosticBuilder, SubdiagnosticMessage};
 use rustc_hir as hir;
 use rustc_hir::def::{CtorOf, DefKind, Namespace};
 use rustc_hir::def_id::DefId;
@@ -126,7 +126,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     #[instrument(level = "debug", skip(self, err, call_expr))]
     pub(crate) fn suggest_method_call(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         msg: impl Into<SubdiagnosticMessage> + std::fmt::Debug,
         method_name: Ident,
         self_ty: Ty<'tcx>,
diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs
index 4151298b42f..005d217fdc4 100644
--- a/compiler/rustc_hir_typeck/src/method/suggest.rs
+++ b/compiler/rustc_hir_typeck/src/method/suggest.rs
@@ -12,8 +12,8 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
 use rustc_data_structures::sorted_map::SortedMap;
 use rustc_data_structures::unord::UnordSet;
 use rustc_errors::{
-    codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
-    MultiSpan, StashKey,
+    codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, MultiSpan,
+    StashKey,
 };
 use rustc_hir as hir;
 use rustc_hir::def::DefKind;
@@ -1127,7 +1127,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             }
         }
 
-        let label_span_not_found = |err: &mut Diagnostic| {
+        let label_span_not_found = |err: &mut DiagnosticBuilder<'_>| {
             if unsatisfied_predicates.is_empty() {
                 err.span_label(span, format!("{item_kind} not found in `{ty_str}`"));
                 let is_string_or_ref_str = match rcvr_ty.kind() {
@@ -1438,7 +1438,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         self_source: SelfSource<'tcx>,
         args: Option<&'tcx [hir::Expr<'tcx>]>,
         span: Span,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         sources: &mut Vec<CandidateSource>,
         sugg_span: Option<Span>,
     ) {
@@ -1584,7 +1584,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     /// Look at all the associated functions without receivers in the type's inherent impls
     /// to look for builders that return `Self`, `Option<Self>` or `Result<Self, _>`.
-    fn find_builder_fn(&self, err: &mut Diagnostic, rcvr_ty: Ty<'tcx>) {
+    fn find_builder_fn(&self, err: &mut DiagnosticBuilder<'_>, rcvr_ty: Ty<'tcx>) {
         let ty::Adt(adt_def, _) = rcvr_ty.kind() else {
             return;
         };
@@ -1665,7 +1665,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// doesn't take a `self` receiver.
     fn suggest_associated_call_syntax(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         static_candidates: &Vec<CandidateSource>,
         rcvr_ty: Ty<'tcx>,
         source: SelfSource<'tcx>,
@@ -1809,7 +1809,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         rcvr_ty: Ty<'tcx>,
         expr: &hir::Expr<'_>,
         item_name: Ident,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) -> bool {
         let tcx = self.tcx;
         let field_receiver = self.autoderef(span, rcvr_ty).find_map(|(ty, _)| match ty.kind() {
@@ -2132,7 +2132,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// Suggest calling a method on a field i.e. `a.field.bar()` instead of `a.bar()`
     fn suggest_calling_method_on_field(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: SelfSource<'tcx>,
         span: Span,
         actual: Ty<'tcx>,
@@ -2212,7 +2212,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn suggest_unwrapping_inner_self(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: SelfSource<'tcx>,
         actual: Ty<'tcx>,
         item_name: Ident,
@@ -2401,7 +2401,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn note_unmet_impls_on_type(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         errors: Vec<FulfillmentError<'tcx>>,
         suggest_derive: bool,
     ) {
@@ -2484,7 +2484,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn note_predicate_source_and_get_derives(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         unsatisfied_predicates: &[(
             ty::Predicate<'tcx>,
             Option<ty::Predicate<'tcx>>,
@@ -2566,7 +2566,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     pub(crate) fn suggest_derive(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         unsatisfied_predicates: &[(
             ty::Predicate<'tcx>,
             Option<ty::Predicate<'tcx>>,
@@ -2602,7 +2602,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn note_derefed_ty_has_method(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         self_source: SelfSource<'tcx>,
         rcvr_ty: Ty<'tcx>,
         item_name: Ident,
@@ -2682,7 +2682,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn suggest_await_before_method(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         item_name: Ident,
         ty: Ty<'tcx>,
         call: &hir::Expr<'_>,
@@ -2705,7 +2705,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         }
     }
 
-    fn suggest_use_candidates(&self, err: &mut Diagnostic, msg: String, candidates: Vec<DefId>) {
+    fn suggest_use_candidates(
+        &self,
+        err: &mut DiagnosticBuilder<'_>,
+        msg: String,
+        candidates: Vec<DefId>,
+    ) {
         let parent_map = self.tcx.visible_parent_map(());
 
         // Separate out candidates that must be imported with a glob, because they are named `_`
@@ -2752,7 +2757,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn suggest_valid_traits(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         valid_out_of_scope_traits: Vec<DefId>,
         explain: bool,
     ) -> bool {
@@ -2793,7 +2798,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn suggest_traits_to_import(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         rcvr_ty: Ty<'tcx>,
         item_name: Ident,
@@ -3332,7 +3337,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     /// FIXME: currently not working for suggesting `map_or_else`, see #102408
     pub(crate) fn suggest_else_fn_with_closure(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         expr: &hir::Expr<'_>,
         found: Ty<'tcx>,
         expected: Ty<'tcx>,
@@ -3458,7 +3463,7 @@ pub fn all_traits(tcx: TyCtxt<'_>) -> Vec<TraitInfo> {
 
 fn print_disambiguation_help<'tcx>(
     tcx: TyCtxt<'tcx>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     source: SelfSource<'tcx>,
     args: Option<&'tcx [hir::Expr<'tcx>]>,
     trait_ref: ty::TraitRef<'tcx>,
diff --git a/compiler/rustc_hir_typeck/src/op.rs b/compiler/rustc_hir_typeck/src/op.rs
index 929b3557f52..fba240bf752 100644
--- a/compiler/rustc_hir_typeck/src/op.rs
+++ b/compiler/rustc_hir_typeck/src/op.rs
@@ -5,7 +5,7 @@ use super::FnCtxt;
 use crate::Expectation;
 use rustc_ast as ast;
 use rustc_data_structures::packed::Pu128;
-use rustc_errors::{codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder};
+use rustc_errors::{codes::*, struct_span_code_err, Applicability, DiagnosticBuilder};
 use rustc_hir as hir;
 use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
 use rustc_infer::traits::ObligationCauseCode;
@@ -695,7 +695,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         rhs_expr: &'tcx hir::Expr<'tcx>,
         lhs_ty: Ty<'tcx>,
         rhs_ty: Ty<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         is_assign: IsAssign,
         op: hir::BinOp,
     ) -> bool {
diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs
index 5026fbe4b80..73689b45b95 100644
--- a/compiler/rustc_hir_typeck/src/pat.rs
+++ b/compiler/rustc_hir_typeck/src/pat.rs
@@ -3,8 +3,8 @@ use crate::{errors, FnCtxt, LoweredTy};
 use rustc_ast as ast;
 use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::{
-    codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
-    ErrorGuaranteed, MultiSpan,
+    codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
+    MultiSpan,
 };
 use rustc_hir as hir;
 use rustc_hir::def::{CtorKind, DefKind, Res};
@@ -529,7 +529,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         ty
     }
 
-    fn endpoint_has_type(&self, err: &mut Diagnostic, span: Span, ty: Ty<'_>) {
+    fn endpoint_has_type(&self, err: &mut DiagnosticBuilder<'_>, span: Span, ty: Ty<'_>) {
         if !ty.references_error() {
             err.span_label(span, format!("this is of type `{ty}`"));
         }
@@ -683,7 +683,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn suggest_adding_missing_ref_or_removing_ref(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         expected: Ty<'tcx>,
         actual: Ty<'tcx>,
@@ -715,7 +715,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     }
 
     // Precondition: pat is a Ref(_) pattern
-    fn borrow_pat_suggestion(&self, err: &mut Diagnostic, pat: &Pat<'_>) {
+    fn borrow_pat_suggestion(&self, err: &mut DiagnosticBuilder<'_>, pat: &Pat<'_>) {
         let tcx = self.tcx;
         if let PatKind::Ref(inner, mutbl) = pat.kind
             && let PatKind::Binding(_, _, binding, ..) = inner.kind
@@ -933,7 +933,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
     fn maybe_suggest_range_literal(
         &self,
-        e: &mut Diagnostic,
+        e: &mut DiagnosticBuilder<'_>,
         opt_def_id: Option<hir::def_id::DefId>,
         ident: Ident,
     ) -> bool {
diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs
index 8bfc05d6a96..f29ba70be98 100644
--- a/compiler/rustc_infer/src/errors/mod.rs
+++ b/compiler/rustc_infer/src/errors/mod.rs
@@ -1,7 +1,8 @@
 use hir::GenericParamKind;
 use rustc_errors::{
-    codes::*, AddToDiagnostic, Applicability, Diagnostic, DiagnosticMessage,
-    DiagnosticStyledString, IntoDiagnosticArg, MultiSpan, SubdiagnosticMessageOp,
+    codes::*, AddToDiagnostic, Applicability, DiagnosticBuilder, DiagnosticMessage,
+    DiagnosticStyledString, EmissionGuarantee, IntoDiagnosticArg, MultiSpan,
+    SubdiagnosticMessageOp,
 };
 use rustc_hir as hir;
 use rustc_hir::FnRetTy;
@@ -225,7 +226,11 @@ pub enum RegionOriginNote<'a> {
 }
 
 impl AddToDiagnostic for RegionOriginNote<'_> {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         let mut label_or_note = |span, msg: DiagnosticMessage| {
             let sub_count = diag.children.iter().filter(|d| d.span.is_dummy()).count();
             let expanded_sub_count = diag.children.iter().filter(|d| !d.span.is_dummy()).count();
@@ -286,7 +291,11 @@ pub enum LifetimeMismatchLabels {
 }
 
 impl AddToDiagnostic for LifetimeMismatchLabels {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         match self {
             LifetimeMismatchLabels::InRet { param_span, ret_span, span, label_var1 } => {
                 diag.span_label(param_span, fluent::infer_declared_different);
@@ -330,7 +339,11 @@ pub struct AddLifetimeParamsSuggestion<'a> {
 }
 
 impl AddToDiagnostic for AddLifetimeParamsSuggestion<'_> {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         let mut mk_suggestion = || {
             let (
                 hir::Ty { kind: hir::TyKind::Ref(lifetime_sub, _), .. },
@@ -428,7 +441,11 @@ pub struct IntroducesStaticBecauseUnmetLifetimeReq {
 }
 
 impl AddToDiagnostic for IntroducesStaticBecauseUnmetLifetimeReq {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(mut self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        mut self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         self.unmet_requirements
             .push_span_label(self.binding_span, fluent::infer_msl_introduces_static);
         diag.span_note(self.unmet_requirements, fluent::infer_msl_unmet_req);
@@ -743,7 +760,11 @@ pub struct ConsiderBorrowingParamHelp {
 }
 
 impl AddToDiagnostic for ConsiderBorrowingParamHelp {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         let mut type_param_span: MultiSpan = self.spans.clone().into();
         for &span in &self.spans {
             // Seems like we can't call f() here as Into<DiagnosticMessage> is required
@@ -784,7 +805,11 @@ pub struct DynTraitConstraintSuggestion {
 }
 
 impl AddToDiagnostic for DynTraitConstraintSuggestion {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         let mut multi_span: MultiSpan = vec![self.span].into();
         multi_span.push_span_label(self.span, fluent::infer_dtcs_has_lifetime_req_label);
         multi_span.push_span_label(self.ident.span, fluent::infer_dtcs_introduces_requirement);
@@ -827,7 +852,11 @@ pub struct ReqIntroducedLocations {
 }
 
 impl AddToDiagnostic for ReqIntroducedLocations {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(mut self, diag: &mut Diagnostic, f: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        mut self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         for sp in self.spans {
             self.span.push_span_label(sp, fluent::infer_ril_introduced_here);
         }
@@ -846,7 +875,11 @@ pub struct MoreTargeted {
 }
 
 impl AddToDiagnostic for MoreTargeted {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _f: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         diag.code(E0772);
         diag.primary_message(fluent::infer_more_targeted);
         diag.arg("ident", self.ident);
@@ -1265,7 +1298,11 @@ pub struct SuggestTuplePatternMany {
 }
 
 impl AddToDiagnostic for SuggestTuplePatternMany {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         diag.arg("path", self.path);
         let message = f(diag, crate::fluent_generated::infer_stp_wrap_many.into());
         diag.multipart_suggestions(
diff --git a/compiler/rustc_infer/src/errors/note_and_explain.rs b/compiler/rustc_infer/src/errors/note_and_explain.rs
index a59a4df7729..c272aa63b08 100644
--- a/compiler/rustc_infer/src/errors/note_and_explain.rs
+++ b/compiler/rustc_infer/src/errors/note_and_explain.rs
@@ -1,6 +1,9 @@
 use crate::fluent_generated as fluent;
 use crate::infer::error_reporting::nice_region_error::find_anon_type;
-use rustc_errors::{AddToDiagnostic, Diagnostic, IntoDiagnosticArg, SubdiagnosticMessageOp};
+use rustc_errors::{
+    AddToDiagnostic, DiagnosticBuilder, EmissionGuarantee, IntoDiagnosticArg,
+    SubdiagnosticMessageOp,
+};
 use rustc_middle::ty::{self, TyCtxt};
 use rustc_span::{symbol::kw, Span};
 
@@ -160,7 +163,11 @@ impl RegionExplanation<'_> {
 }
 
 impl AddToDiagnostic for RegionExplanation<'_> {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         diag.arg("pref_kind", self.prefix);
         diag.arg("suff_kind", self.suffix);
         diag.arg("desc_kind", self.desc.kind);
diff --git a/compiler/rustc_infer/src/infer/canonical/query_response.rs b/compiler/rustc_infer/src/infer/canonical/query_response.rs
index 56a45586c9d..5a2795e790d 100644
--- a/compiler/rustc_infer/src/infer/canonical/query_response.rs
+++ b/compiler/rustc_infer/src/infer/canonical/query_response.rs
@@ -405,7 +405,7 @@ impl<'tcx> InferCtxt<'tcx> {
     /// will instantiate fresh inference variables for each canonical
     /// variable instead. Therefore, the result of this method must be
     /// properly unified
-    #[instrument(level = "debug", skip(self, cause, param_env))]
+    #[instrument(level = "debug", skip(self, param_env))]
     fn query_response_instantiation_guess<R>(
         &self,
         cause: &ObligationCause<'tcx>,
@@ -731,13 +731,6 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
         ty::Region::new_placeholder(self.infcx.tcx, placeholder)
     }
 
-    fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
-        self.infcx.next_nll_region_var_in_universe(
-            NllRegionVariableOrigin::Existential { from_forall: false },
-            universe,
-        )
-    }
-
     fn push_outlives(
         &mut self,
         sup: ty::Region<'tcx>,
diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs
index 9bfaeb5ee32..4f2a576c573 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs
@@ -60,8 +60,8 @@ use crate::traits::{
 
 use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
 use rustc_errors::{
-    codes::*, pluralize, struct_span_code_err, Applicability, DiagCtxt, Diagnostic,
-    DiagnosticBuilder, DiagnosticStyledString, ErrorGuaranteed, IntoDiagnosticArg,
+    codes::*, pluralize, struct_span_code_err, Applicability, DiagCtxt, DiagnosticBuilder,
+    DiagnosticStyledString, ErrorGuaranteed, IntoDiagnosticArg,
 };
 use rustc_hir as hir;
 use rustc_hir::def::DefKind;
@@ -155,7 +155,7 @@ impl<'tcx> Deref for TypeErrCtxt<'_, 'tcx> {
 
 pub(super) fn note_and_explain_region<'tcx>(
     tcx: TyCtxt<'tcx>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     prefix: &str,
     region: ty::Region<'tcx>,
     suffix: &str,
@@ -180,7 +180,7 @@ pub(super) fn note_and_explain_region<'tcx>(
 
 fn explain_free_region<'tcx>(
     tcx: TyCtxt<'tcx>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     prefix: &str,
     region: ty::Region<'tcx>,
     suffix: &str,
@@ -262,7 +262,7 @@ fn msg_span_from_named_region<'tcx>(
 }
 
 fn emit_msg_span(
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     prefix: &str,
     description: String,
     span: Option<Span>,
@@ -278,7 +278,7 @@ fn emit_msg_span(
 }
 
 fn label_msg_span(
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     prefix: &str,
     description: String,
     span: Option<Span>,
@@ -577,7 +577,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     }
 
     /// Adds a note if the types come from similarly named crates
-    fn check_and_note_conflicting_crates(&self, err: &mut Diagnostic, terr: TypeError<'tcx>) {
+    fn check_and_note_conflicting_crates(
+        &self,
+        err: &mut DiagnosticBuilder<'_>,
+        terr: TypeError<'tcx>,
+    ) {
         use hir::def_id::CrateNum;
         use rustc_hir::definitions::DisambiguatedDefPathData;
         use ty::print::Printer;
@@ -651,7 +655,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
             }
         }
 
-        let report_path_match = |err: &mut Diagnostic, did1: DefId, did2: DefId| {
+        let report_path_match = |err: &mut DiagnosticBuilder<'_>, did1: DefId, did2: DefId| {
             // Only report definitions from different crates. If both definitions
             // are from a local module we could have false positives, e.g.
             // let _ = [{struct Foo; Foo}, {struct Foo; Foo}];
@@ -701,7 +705,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
 
     fn note_error_origin(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         cause: &ObligationCause<'tcx>,
         exp_found: Option<ty::error::ExpectedFound<Ty<'tcx>>>,
         terr: TypeError<'tcx>,
@@ -1535,7 +1539,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     )]
     pub fn note_type_err(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         cause: &ObligationCause<'tcx>,
         secondary_span: Option<(Span, Cow<'static, str>)>,
         mut values: Option<ValuePairs<'tcx>>,
@@ -1582,14 +1586,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
                 types_visitor
             }
 
-            fn report(&self, err: &mut Diagnostic) {
+            fn report(&self, err: &mut DiagnosticBuilder<'_>) {
                 self.add_labels_for_types(err, "expected", &self.expected);
                 self.add_labels_for_types(err, "found", &self.found);
             }
 
             fn add_labels_for_types(
                 &self,
-                err: &mut Diagnostic,
+                err: &mut DiagnosticBuilder<'_>,
                 target: &str,
                 types: &FxIndexMap<TyCategory, FxIndexSet<Span>>,
             ) {
@@ -1803,7 +1807,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
                         |prim: Ty<'tcx>,
                          shadow: Ty<'tcx>,
                          defid: DefId,
-                         diagnostic: &mut Diagnostic| {
+                         diagnostic: &mut DiagnosticBuilder<'_>| {
                             let name = shadow.sort_string(self.tcx);
                             diagnostic.note(format!(
                             "{prim} and {name} have similar names, but are actually distinct types"
@@ -1823,7 +1827,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
                     let diagnose_adts =
                         |expected_adt: ty::AdtDef<'tcx>,
                          found_adt: ty::AdtDef<'tcx>,
-                         diagnostic: &mut Diagnostic| {
+                         diagnostic: &mut DiagnosticBuilder<'_>| {
                             let found_name = values.found.sort_string(self.tcx);
                             let expected_name = values.expected.sort_string(self.tcx);
 
diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs
index adb3267d5be..cf8ac544106 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs
@@ -12,7 +12,7 @@ use crate::infer::SubregionOrigin;
 use crate::infer::TyCtxt;
 
 use rustc_errors::AddToDiagnostic;
-use rustc_errors::{Diagnostic, ErrorGuaranteed};
+use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed};
 use rustc_hir::Ty;
 use rustc_middle::ty::Region;
 
@@ -142,7 +142,7 @@ pub fn suggest_adding_lifetime_params<'tcx>(
     sub: Region<'tcx>,
     ty_sup: &'tcx Ty<'_>,
     ty_sub: &'tcx Ty<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
 ) {
     let suggestion = AddLifetimeParamsSuggestion { tcx, sub, ty_sup, ty_sub, add_note: false };
     suggestion.add_to_diagnostic(err);
diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs
index c8fd4e3a692..83e0b763d24 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs
@@ -9,7 +9,7 @@ use crate::infer::lexical_region_resolve::RegionResolutionError;
 use crate::infer::{SubregionOrigin, TypeTrace};
 use crate::traits::{ObligationCauseCode, UnifyReceiverContext};
 use rustc_data_structures::fx::FxIndexSet;
-use rustc_errors::{AddToDiagnostic, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan};
+use rustc_errors::{AddToDiagnostic, Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan};
 use rustc_hir::def_id::DefId;
 use rustc_hir::intravisit::{walk_ty, Visitor};
 use rustc_hir::{
@@ -261,7 +261,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
 
 pub fn suggest_new_region_bound(
     tcx: TyCtxt<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     fn_returns: Vec<&rustc_hir::Ty<'_>>,
     lifetime_name: String,
     arg: Option<String>,
@@ -488,7 +488,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
     /// `'static` obligation. Suggest relaxing that implicit bound.
     fn find_impl_on_dyn_trait(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         ty: Ty<'_>,
         ctxt: &UnifyReceiverContext<'tcx>,
     ) -> bool {
@@ -521,7 +521,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
 
     fn suggest_constrain_dyn_trait_in_impl(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         found_dids: &FxIndexSet<DefId>,
         ident: Ident,
         self_ty: &hir::Ty<'_>,
diff --git a/compiler/rustc_infer/src/infer/error_reporting/note.rs b/compiler/rustc_infer/src/infer/error_reporting/note.rs
index 50ac6235deb..0878505e85e 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/note.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/note.rs
@@ -5,7 +5,7 @@ use crate::errors::{
 use crate::fluent_generated as fluent;
 use crate::infer::error_reporting::{note_and_explain_region, TypeErrCtxt};
 use crate::infer::{self, SubregionOrigin};
-use rustc_errors::{AddToDiagnostic, Diagnostic, DiagnosticBuilder};
+use rustc_errors::{AddToDiagnostic, DiagnosticBuilder};
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_middle::traits::ObligationCauseCode;
 use rustc_middle::ty::error::TypeError;
@@ -15,7 +15,11 @@ use rustc_span::symbol::kw;
 use super::ObligationCauseAsDiagArg;
 
 impl<'tcx> TypeErrCtxt<'_, 'tcx> {
-    pub(super) fn note_region_origin(&self, err: &mut Diagnostic, origin: &SubregionOrigin<'tcx>) {
+    pub(super) fn note_region_origin(
+        &self,
+        err: &mut DiagnosticBuilder<'_>,
+        origin: &SubregionOrigin<'tcx>,
+    ) {
         match *origin {
             infer::Subtype(ref trace) => RegionOriginNote::WithRequirement {
                 span: trace.cause.span,
@@ -290,7 +294,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         &self,
         trait_item_def_id: DefId,
         impl_item_def_id: LocalDefId,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) {
         // FIXME(compiler-errors): Right now this is only being used for region
         // predicate mismatches. Ideally, we'd use it for *all* predicate mismatches,
diff --git a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs
index 3c42f13141d..9df2f929501 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs
@@ -1,6 +1,6 @@
 use super::TypeErrCtxt;
 use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect};
-use rustc_errors::{pluralize, Diagnostic, MultiSpan};
+use rustc_errors::{pluralize, DiagnosticBuilder, MultiSpan};
 use rustc_hir as hir;
 use rustc_hir::def::DefKind;
 use rustc_middle::traits::ObligationCauseCode;
@@ -15,7 +15,7 @@ use rustc_span::{def_id::DefId, sym, BytePos, Span, Symbol};
 impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     pub fn note_and_explain_type_err(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         err: TypeError<'tcx>,
         cause: &ObligationCause<'tcx>,
         sp: Span,
@@ -522,7 +522,7 @@ impl<T> Trait<T> for X {
 
     fn suggest_constraint(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         msg: impl Fn() -> String,
         body_owner_def_id: DefId,
         proj_ty: &ty::AliasTy<'tcx>,
@@ -595,7 +595,7 @@ impl<T> Trait<T> for X {
     ///    fn that returns the type.
     fn expected_projection(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         proj_ty: &ty::AliasTy<'tcx>,
         values: ExpectedFound<Ty<'tcx>>,
         body_owner_def_id: DefId,
@@ -705,7 +705,7 @@ fn foo(&self) -> Self::T { String::new() }
     /// a return type. This can occur when dealing with `TryStream` (#71035).
     fn suggest_constraining_opaque_associated_type(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         msg: impl Fn() -> String,
         proj_ty: &ty::AliasTy<'tcx>,
         ty: Ty<'tcx>,
@@ -740,7 +740,7 @@ fn foo(&self) -> Self::T { String::new() }
 
     fn point_at_methods_that_satisfy_associated_type(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         assoc_container_id: DefId,
         current_method_ident: Option<Symbol>,
         proj_ty_item_def_id: DefId,
@@ -798,7 +798,7 @@ fn foo(&self) -> Self::T { String::new() }
 
     fn point_at_associated_type(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         body_owner_def_id: DefId,
         found: Ty<'tcx>,
     ) -> bool {
@@ -879,7 +879,7 @@ fn foo(&self) -> Self::T { String::new() }
     /// type is defined on a supertrait of the one present in the bounds.
     fn constrain_generic_bound_associated_type_structured_suggestion(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         trait_ref: &ty::TraitRef<'tcx>,
         bounds: hir::GenericBounds<'_>,
         assoc: ty::AssocItem,
@@ -916,7 +916,7 @@ fn foo(&self) -> Self::T { String::new() }
     /// associated type to a given type `ty`.
     fn constrain_associated_type_structured_suggestion(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         span: Span,
         assoc: ty::AssocItem,
         assoc_args: &[ty::GenericArg<'tcx>],
diff --git a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs
index 15834c78413..f7102ab6205 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs
@@ -1,7 +1,7 @@
 use hir::def::CtorKind;
 use hir::intravisit::{walk_expr, walk_stmt, Visitor};
 use rustc_data_structures::fx::FxIndexSet;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir as hir;
 use rustc_middle::traits::{
     IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
@@ -76,7 +76,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
 
     pub(super) fn suggest_boxing_for_return_impl_trait(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         return_sp: Span,
         arm_spans: impl Iterator<Item = Span>,
     ) {
@@ -100,7 +100,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         &self,
         cause: &ObligationCause<'tcx>,
         exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
     ) {
         // Heavily inspired by `FnCtxt::suggest_compatible_variants`, with
         // some modifications due to that being in typeck and this being in infer.
@@ -177,7 +177,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         cause: &ObligationCause<'tcx>,
         exp_span: Span,
         exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
     ) {
         debug!(
             "suggest_await_on_expect_found: exp_span={:?}, expected_ty={:?}, found_ty={:?}",
@@ -258,7 +258,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         &self,
         cause: &ObligationCause<'tcx>,
         exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
     ) {
         debug!(
             "suggest_accessing_field_where_appropriate(cause={:?}, exp_found={:?})",
@@ -298,7 +298,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         cause: &ObligationCause<'tcx>,
         span: Span,
         exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
     ) {
         debug!("suggest_function_pointers(cause={:?}, exp_found={:?})", cause, exp_found);
         let ty::error::ExpectedFound { expected, found } = exp_found;
@@ -532,7 +532,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         span: Span,
         hir: hir::Node<'_>,
         exp_found: &ty::error::ExpectedFound<ty::PolyTraitRef<'tcx>>,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
     ) {
         // 0. Extract fn_decl from hir
         let hir::Node::Expr(hir::Expr {
@@ -818,7 +818,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         &self,
         blk: &'tcx hir::Block<'tcx>,
         expected_ty: Ty<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) -> bool {
         let diag = self.consider_returning_binding_diag(blk, expected_ty);
         match diag {
diff --git a/compiler/rustc_infer/src/infer/relate/combine.rs b/compiler/rustc_infer/src/infer/relate/combine.rs
index 7edfbf02a68..454de4f9785 100644
--- a/compiler/rustc_infer/src/infer/relate/combine.rs
+++ b/compiler/rustc_infer/src/infer/relate/combine.rs
@@ -23,19 +23,18 @@
 //! this should be correctly updated.
 
 use super::equate::Equate;
-use super::generalize::{self, CombineDelegate, Generalization};
 use super::glb::Glb;
 use super::lub::Lub;
 use super::sub::Sub;
 use crate::infer::{DefineOpaqueTypes, InferCtxt, TypeTrace};
 use crate::traits::{Obligation, PredicateObligations};
 use rustc_middle::infer::canonical::OriginalQueryValues;
-use rustc_middle::infer::unify_key::{ConstVariableValue, EffectVarValue};
+use rustc_middle::infer::unify_key::EffectVarValue;
 use rustc_middle::ty::error::{ExpectedFound, TypeError};
 use rustc_middle::ty::relate::{RelateResult, TypeRelation};
 use rustc_middle::ty::{self, InferConst, ToPredicate, Ty, TyCtxt, TypeVisitableExt};
-use rustc_middle::ty::{AliasRelationDirection, TyVar};
 use rustc_middle::ty::{IntType, UintType};
+use rustc_span::Span;
 
 #[derive(Clone)]
 pub struct CombineFields<'infcx, 'tcx> {
@@ -221,11 +220,11 @@ impl<'tcx> InferCtxt<'tcx> {
             }
 
             (ty::ConstKind::Infer(InferConst::Var(vid)), _) => {
-                return self.unify_const_variable(vid, b);
+                return self.instantiate_const_var(vid, b);
             }
 
             (_, ty::ConstKind::Infer(InferConst::Var(vid))) => {
-                return self.unify_const_variable(vid, a);
+                return self.instantiate_const_var(vid, a);
             }
 
             (ty::ConstKind::Infer(InferConst::EffectVar(vid)), _) => {
@@ -259,69 +258,6 @@ impl<'tcx> InferCtxt<'tcx> {
         ty::relate::structurally_relate_consts(relation, a, b)
     }
 
-    /// Unifies the const variable `target_vid` with the given constant.
-    ///
-    /// This also tests if the given const `ct` contains an inference variable which was previously
-    /// unioned with `target_vid`. If this is the case, inferring `target_vid` to `ct`
-    /// would result in an infinite type as we continuously replace an inference variable
-    /// in `ct` with `ct` itself.
-    ///
-    /// This is especially important as unevaluated consts use their parents generics.
-    /// They therefore often contain unused args, making these errors far more likely.
-    ///
-    /// A good example of this is the following:
-    ///
-    /// ```compile_fail,E0308
-    /// #![feature(generic_const_exprs)]
-    ///
-    /// fn bind<const N: usize>(value: [u8; N]) -> [u8; 3 + 4] {
-    ///     todo!()
-    /// }
-    ///
-    /// fn main() {
-    ///     let mut arr = Default::default();
-    ///     arr = bind(arr);
-    /// }
-    /// ```
-    ///
-    /// Here `3 + 4` ends up as `ConstKind::Unevaluated` which uses the generics
-    /// of `fn bind` (meaning that its args contain `N`).
-    ///
-    /// `bind(arr)` now infers that the type of `arr` must be `[u8; N]`.
-    /// The assignment `arr = bind(arr)` now tries to equate `N` with `3 + 4`.
-    ///
-    /// As `3 + 4` contains `N` in its args, this must not succeed.
-    ///
-    /// See `tests/ui/const-generics/occurs-check/` for more examples where this is relevant.
-    #[instrument(level = "debug", skip(self))]
-    fn unify_const_variable(
-        &self,
-        target_vid: ty::ConstVid,
-        ct: ty::Const<'tcx>,
-    ) -> RelateResult<'tcx, ty::Const<'tcx>> {
-        let span = match self.inner.borrow_mut().const_unification_table().probe_value(target_vid) {
-            ConstVariableValue::Known { value } => {
-                bug!("instantiating a known const var: {target_vid:?} {value} {ct}")
-            }
-            ConstVariableValue::Unknown { origin, universe: _ } => origin.span,
-        };
-        // FIXME(generic_const_exprs): Occurs check failures for unevaluated
-        // constants and generic expressions are not yet handled correctly.
-        let Generalization { value_may_be_infer: value, needs_wf: _ } = generalize::generalize(
-            self,
-            &mut CombineDelegate { infcx: self, span },
-            ct,
-            target_vid,
-            ty::Variance::Invariant,
-        )?;
-
-        self.inner
-            .borrow_mut()
-            .const_unification_table()
-            .union_value(target_vid, ConstVariableValue::Known { value });
-        Ok(value)
-    }
-
     fn unify_integral_variable(
         &self,
         vid_is_expected: bool,
@@ -383,131 +319,6 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
         Glb::new(self, a_is_expected)
     }
 
-    /// Here, `dir` is either `EqTo`, `SubtypeOf`, or `SupertypeOf`.
-    /// The idea is that we should ensure that the type `a_ty` is equal
-    /// to, a subtype of, or a supertype of (respectively) the type
-    /// to which `b_vid` is bound.
-    ///
-    /// Since `b_vid` has not yet been instantiated with a type, we
-    /// will first instantiate `b_vid` with a *generalized* version
-    /// of `a_ty`. Generalization introduces other inference
-    /// variables wherever subtyping could occur.
-    #[instrument(skip(self), level = "debug")]
-    pub fn instantiate(
-        &mut self,
-        a_ty: Ty<'tcx>,
-        ambient_variance: ty::Variance,
-        b_vid: ty::TyVid,
-        a_is_expected: bool,
-    ) -> RelateResult<'tcx, ()> {
-        // Get the actual variable that b_vid has been inferred to
-        debug_assert!(self.infcx.inner.borrow_mut().type_variables().probe(b_vid).is_unknown());
-
-        // Generalize type of `a_ty` appropriately depending on the
-        // direction. As an example, assume:
-        //
-        // - `a_ty == &'x ?1`, where `'x` is some free region and `?1` is an
-        //   inference variable,
-        // - and `dir` == `SubtypeOf`.
-        //
-        // Then the generalized form `b_ty` would be `&'?2 ?3`, where
-        // `'?2` and `?3` are fresh region/type inference
-        // variables. (Down below, we will relate `a_ty <: b_ty`,
-        // adding constraints like `'x: '?2` and `?1 <: ?3`.)
-        let Generalization { value_may_be_infer: b_ty, needs_wf } = generalize::generalize(
-            self.infcx,
-            &mut CombineDelegate { infcx: self.infcx, span: self.trace.span() },
-            a_ty,
-            b_vid,
-            ambient_variance,
-        )?;
-
-        // Constrain `b_vid` to the generalized type `b_ty`.
-        if let &ty::Infer(TyVar(b_ty_vid)) = b_ty.kind() {
-            self.infcx.inner.borrow_mut().type_variables().equate(b_vid, b_ty_vid);
-        } else {
-            self.infcx.inner.borrow_mut().type_variables().instantiate(b_vid, b_ty);
-        }
-
-        if needs_wf {
-            self.obligations.push(Obligation::new(
-                self.tcx(),
-                self.trace.cause.clone(),
-                self.param_env,
-                ty::Binder::dummy(ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(
-                    b_ty.into(),
-                ))),
-            ));
-        }
-
-        // Finally, relate `b_ty` to `a_ty`, as described in previous comment.
-        //
-        // FIXME(#16847): This code is non-ideal because all these subtype
-        // relations wind up attributed to the same spans. We need
-        // to associate causes/spans with each of the relations in
-        // the stack to get this right.
-        if b_ty.is_ty_var() {
-            // This happens for cases like `<?0 as Trait>::Assoc == ?0`.
-            // We can't instantiate `?0` here as that would result in a
-            // cyclic type. We instead delay the unification in case
-            // the alias can be normalized to something which does not
-            // mention `?0`.
-            if self.infcx.next_trait_solver() {
-                let (lhs, rhs, direction) = match ambient_variance {
-                    ty::Variance::Invariant => {
-                        (a_ty.into(), b_ty.into(), AliasRelationDirection::Equate)
-                    }
-                    ty::Variance::Covariant => {
-                        (a_ty.into(), b_ty.into(), AliasRelationDirection::Subtype)
-                    }
-                    ty::Variance::Contravariant => {
-                        (b_ty.into(), a_ty.into(), AliasRelationDirection::Subtype)
-                    }
-                    ty::Variance::Bivariant => unreachable!("bivariant generalization"),
-                };
-                self.obligations.push(Obligation::new(
-                    self.tcx(),
-                    self.trace.cause.clone(),
-                    self.param_env,
-                    ty::PredicateKind::AliasRelate(lhs, rhs, direction),
-                ));
-            } else {
-                match a_ty.kind() {
-                    &ty::Alias(ty::Projection, data) => {
-                        // FIXME: This does not handle subtyping correctly, we could
-                        // instead create a new inference variable for `a_ty`, emitting
-                        // `Projection(a_ty, a_infer)` and `a_infer <: b_ty`.
-                        self.obligations.push(Obligation::new(
-                            self.tcx(),
-                            self.trace.cause.clone(),
-                            self.param_env,
-                            ty::ProjectionPredicate { projection_ty: data, term: b_ty.into() },
-                        ))
-                    }
-                    // The old solver only accepts projection predicates for associated types.
-                    ty::Alias(ty::Inherent | ty::Weak | ty::Opaque, _) => {
-                        return Err(TypeError::CyclicTy(a_ty));
-                    }
-                    _ => bug!("generalizated `{a_ty:?} to infer, not an alias"),
-                }
-            }
-        } else {
-            match ambient_variance {
-                ty::Variance::Invariant => self.equate(a_is_expected).relate(a_ty, b_ty),
-                ty::Variance::Covariant => self.sub(a_is_expected).relate(a_ty, b_ty),
-                ty::Variance::Contravariant => self.sub(a_is_expected).relate_with_variance(
-                    ty::Contravariant,
-                    ty::VarianceDiagInfo::default(),
-                    a_ty,
-                    b_ty,
-                ),
-                ty::Variance::Bivariant => unreachable!("bivariant generalization"),
-            }?;
-        }
-
-        Ok(())
-    }
-
     pub fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
         self.obligations.extend(obligations);
     }
@@ -520,6 +331,8 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
 }
 
 pub trait ObligationEmittingRelation<'tcx>: TypeRelation<'tcx> {
+    fn span(&self) -> Span;
+
     fn param_env(&self) -> ty::ParamEnv<'tcx>;
 
     /// Register obligations that must hold in order for this relation to hold
diff --git a/compiler/rustc_infer/src/infer/relate/equate.rs b/compiler/rustc_infer/src/infer/relate/equate.rs
index cb62f258373..aefa9a5a0d6 100644
--- a/compiler/rustc_infer/src/infer/relate/equate.rs
+++ b/compiler/rustc_infer/src/infer/relate/equate.rs
@@ -8,6 +8,7 @@ use rustc_middle::ty::TyVar;
 use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
 
 use rustc_hir::def_id::DefId;
+use rustc_span::Span;
 
 /// Ensures `a` is made equal to `b`. Returns `a` on success.
 pub struct Equate<'combine, 'infcx, 'tcx> {
@@ -81,12 +82,17 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
                 infcx.inner.borrow_mut().type_variables().equate(a_id, b_id);
             }
 
-            (&ty::Infer(TyVar(a_id)), _) => {
-                self.fields.instantiate(b, ty::Invariant, a_id, self.a_is_expected)?;
+            (&ty::Infer(TyVar(a_vid)), _) => {
+                infcx.instantiate_ty_var(self, self.a_is_expected, a_vid, ty::Invariant, b)?;
             }
 
-            (_, &ty::Infer(TyVar(b_id))) => {
-                self.fields.instantiate(a, ty::Invariant, b_id, self.a_is_expected)?;
+            (_, &ty::Infer(TyVar(b_vid))) => {
+                infcx.instantiate_ty_var(self, !self.a_is_expected, b_vid, ty::Invariant, a)?;
+            }
+
+            (&ty::Error(e), _) | (_, &ty::Error(e)) => {
+                infcx.set_tainted_by_errors(e);
+                return Ok(Ty::new_error(self.tcx(), e));
             }
 
             (
@@ -170,6 +176,10 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
 }
 
 impl<'tcx> ObligationEmittingRelation<'tcx> for Equate<'_, '_, 'tcx> {
+    fn span(&self) -> Span {
+        self.fields.trace.span()
+    }
+
     fn param_env(&self) -> ty::ParamEnv<'tcx> {
         self.fields.param_env
     }
diff --git a/compiler/rustc_infer/src/infer/relate/generalize.rs b/compiler/rustc_infer/src/infer/relate/generalize.rs
index bc16d613ccb..c0cb02916fe 100644
--- a/compiler/rustc_infer/src/infer/relate/generalize.rs
+++ b/compiler/rustc_infer/src/infer/relate/generalize.rs
@@ -1,5 +1,7 @@
 use std::mem;
 
+use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind, TypeVariableValue};
+use crate::infer::{InferCtxt, ObligationEmittingRelation, RegionVariableOrigin};
 use rustc_data_structures::sso::SsoHashMap;
 use rustc_data_structures::stack::ensure_sufficient_stack;
 use rustc_hir::def_id::DefId;
@@ -7,98 +9,225 @@ use rustc_middle::infer::unify_key::ConstVariableValue;
 use rustc_middle::ty::error::TypeError;
 use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation};
 use rustc_middle::ty::visit::MaxUniverse;
-use rustc_middle::ty::{self, InferConst, Term, Ty, TyCtxt, TypeVisitable, TypeVisitableExt};
+use rustc_middle::ty::{self, Ty, TyCtxt};
+use rustc_middle::ty::{AliasRelationDirection, InferConst, Term, TypeVisitable, TypeVisitableExt};
 use rustc_span::Span;
 
-use crate::infer::nll_relate::TypeRelatingDelegate;
-use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind, TypeVariableValue};
-use crate::infer::{InferCtxt, RegionVariableOrigin};
-
-/// Attempts to generalize `term` for the type variable `for_vid`.
-/// This checks for cycles -- that is, whether the type `term`
-/// references `for_vid`.
-pub fn generalize<'tcx, D: GeneralizerDelegate<'tcx>, T: Into<Term<'tcx>> + Relate<'tcx>>(
-    infcx: &InferCtxt<'tcx>,
-    delegate: &mut D,
-    term: T,
-    for_vid: impl Into<ty::TermVid>,
-    ambient_variance: ty::Variance,
-) -> RelateResult<'tcx, Generalization<T>> {
-    let (for_universe, root_vid) = match for_vid.into() {
-        ty::TermVid::Ty(ty_vid) => (
-            infcx.probe_ty_var(ty_vid).unwrap_err(),
-            ty::TermVid::Ty(infcx.inner.borrow_mut().type_variables().sub_root_var(ty_vid)),
-        ),
-        ty::TermVid::Const(ct_vid) => (
-            infcx.probe_const_var(ct_vid).unwrap_err(),
-            ty::TermVid::Const(infcx.inner.borrow_mut().const_unification_table().find(ct_vid).vid),
-        ),
-    };
-
-    let mut generalizer = Generalizer {
-        infcx,
-        delegate,
-        ambient_variance,
-        root_vid,
-        for_universe,
-        root_term: term.into(),
-        in_alias: false,
-        needs_wf: false,
-        cache: Default::default(),
-    };
-
-    assert!(!term.has_escaping_bound_vars());
-    let value_may_be_infer = generalizer.relate(term, term)?;
-    let needs_wf = generalizer.needs_wf;
-    Ok(Generalization { value_may_be_infer, needs_wf })
-}
-
-/// Abstracts the handling of region vars between HIR and MIR/NLL typechecking
-/// in the generalizer code.
-pub trait GeneralizerDelegate<'tcx> {
-    fn forbid_inference_vars() -> bool;
-
-    fn span(&self) -> Span;
+impl<'tcx> InferCtxt<'tcx> {
+    /// The idea is that we should ensure that the type variable `target_vid`
+    /// is equal to, a subtype of, or a supertype of `source_ty`.
+    ///
+    /// For this, we will instantiate `target_vid` with a *generalized* version
+    /// of `source_ty`. Generalization introduces other inference variables wherever
+    /// subtyping could occur. This also does the occurs checks, detecting whether
+    /// instantiating `target_vid` would result in a cyclic type. We eagerly error
+    /// in this case.
+    #[instrument(skip(self, relation, target_is_expected), level = "debug")]
+    pub(super) fn instantiate_ty_var<R: ObligationEmittingRelation<'tcx>>(
+        &self,
+        relation: &mut R,
+        target_is_expected: bool,
+        target_vid: ty::TyVid,
+        ambient_variance: ty::Variance,
+        source_ty: Ty<'tcx>,
+    ) -> RelateResult<'tcx, ()> {
+        debug_assert!(self.inner.borrow_mut().type_variables().probe(target_vid).is_unknown());
+
+        // Generalize `source_ty` depending on the current variance. As an example, assume
+        // `?target <: &'x ?1`, where `'x` is some free region and `?1` is an inference
+        // variable.
+        //
+        // Then the `generalized_ty` would be `&'?2 ?3`, where `'?2` and `?3` are fresh
+        // region/type inference variables.
+        //
+        // We then relate `generalized_ty <: source_ty`,adding constraints like `'x: '?2` and `?1 <: ?3`.
+        let Generalization { value_may_be_infer: generalized_ty, has_unconstrained_ty_var } =
+            self.generalize(relation.span(), target_vid, ambient_variance, source_ty)?;
+
+        // Constrain `b_vid` to the generalized type `generalized_ty`.
+        if let &ty::Infer(ty::TyVar(generalized_vid)) = generalized_ty.kind() {
+            self.inner.borrow_mut().type_variables().equate(target_vid, generalized_vid);
+        } else {
+            self.inner.borrow_mut().type_variables().instantiate(target_vid, generalized_ty);
+        }
 
-    fn generalize_region(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx>;
-}
+        // See the comment on `Generalization::has_unconstrained_ty_var`.
+        if has_unconstrained_ty_var {
+            relation.register_predicates([ty::ClauseKind::WellFormed(generalized_ty.into())]);
+        }
 
-pub struct CombineDelegate<'cx, 'tcx> {
-    pub infcx: &'cx InferCtxt<'tcx>,
-    pub span: Span,
-}
+        // Finally, relate `generalized_ty` to `source_ty`, as described in previous comment.
+        //
+        // FIXME(#16847): This code is non-ideal because all these subtype
+        // relations wind up attributed to the same spans. We need
+        // to associate causes/spans with each of the relations in
+        // the stack to get this right.
+        if generalized_ty.is_ty_var() {
+            // This happens for cases like `<?0 as Trait>::Assoc == ?0`.
+            // We can't instantiate `?0` here as that would result in a
+            // cyclic type. We instead delay the unification in case
+            // the alias can be normalized to something which does not
+            // mention `?0`.
+            if self.next_trait_solver() {
+                let (lhs, rhs, direction) = match ambient_variance {
+                    ty::Variance::Invariant => {
+                        (generalized_ty.into(), source_ty.into(), AliasRelationDirection::Equate)
+                    }
+                    ty::Variance::Covariant => {
+                        (generalized_ty.into(), source_ty.into(), AliasRelationDirection::Subtype)
+                    }
+                    ty::Variance::Contravariant => {
+                        (source_ty.into(), generalized_ty.into(), AliasRelationDirection::Subtype)
+                    }
+                    ty::Variance::Bivariant => unreachable!("bivariant generalization"),
+                };
 
-impl<'tcx> GeneralizerDelegate<'tcx> for CombineDelegate<'_, 'tcx> {
-    fn forbid_inference_vars() -> bool {
-        false
-    }
+                relation.register_predicates([ty::PredicateKind::AliasRelate(lhs, rhs, direction)]);
+            } else {
+                match source_ty.kind() {
+                    &ty::Alias(ty::Projection, data) => {
+                        // FIXME: This does not handle subtyping correctly, we could
+                        // instead create a new inference variable `?normalized_source`, emitting
+                        // `Projection(normalized_source, ?ty_normalized)` and `?normalized_source <: generalized_ty`.
+                        relation.register_predicates([ty::ProjectionPredicate {
+                            projection_ty: data,
+                            term: generalized_ty.into(),
+                        }]);
+                    }
+                    // The old solver only accepts projection predicates for associated types.
+                    ty::Alias(ty::Inherent | ty::Weak | ty::Opaque, _) => {
+                        return Err(TypeError::CyclicTy(source_ty));
+                    }
+                    _ => bug!("generalized `{source_ty:?} to infer, not an alias"),
+                }
+            }
+        } else {
+            // HACK: make sure that we `a_is_expected` continues to be
+            // correct when relating the generalized type with the source.
+            if target_is_expected == relation.a_is_expected() {
+                relation.relate_with_variance(
+                    ambient_variance,
+                    ty::VarianceDiagInfo::default(),
+                    generalized_ty,
+                    source_ty,
+                )?;
+            } else {
+                relation.relate_with_variance(
+                    ambient_variance.xform(ty::Contravariant),
+                    ty::VarianceDiagInfo::default(),
+                    source_ty,
+                    generalized_ty,
+                )?;
+            }
+        }
 
-    fn span(&self) -> Span {
-        self.span
+        Ok(())
     }
 
-    fn generalize_region(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
-        // FIXME: This is non-ideal because we don't give a
-        // very descriptive origin for this region variable.
-        self.infcx
-            .next_region_var_in_universe(RegionVariableOrigin::MiscVariable(self.span), universe)
-    }
-}
+    /// Instantiates the const variable `target_vid` with the given constant.
+    ///
+    /// This also tests if the given const `ct` contains an inference variable which was previously
+    /// unioned with `target_vid`. If this is the case, inferring `target_vid` to `ct`
+    /// would result in an infinite type as we continuously replace an inference variable
+    /// in `ct` with `ct` itself.
+    ///
+    /// This is especially important as unevaluated consts use their parents generics.
+    /// They therefore often contain unused args, making these errors far more likely.
+    ///
+    /// A good example of this is the following:
+    ///
+    /// ```compile_fail,E0308
+    /// #![feature(generic_const_exprs)]
+    ///
+    /// fn bind<const N: usize>(value: [u8; N]) -> [u8; 3 + 4] {
+    ///     todo!()
+    /// }
+    ///
+    /// fn main() {
+    ///     let mut arr = Default::default();
+    ///     arr = bind(arr);
+    /// }
+    /// ```
+    ///
+    /// Here `3 + 4` ends up as `ConstKind::Unevaluated` which uses the generics
+    /// of `fn bind` (meaning that its args contain `N`).
+    ///
+    /// `bind(arr)` now infers that the type of `arr` must be `[u8; N]`.
+    /// The assignment `arr = bind(arr)` now tries to equate `N` with `3 + 4`.
+    ///
+    /// As `3 + 4` contains `N` in its args, this must not succeed.
+    ///
+    /// See `tests/ui/const-generics/occurs-check/` for more examples where this is relevant.
+    #[instrument(level = "debug", skip(self))]
+    pub(super) fn instantiate_const_var(
+        &self,
+        target_vid: ty::ConstVid,
+        source_ct: ty::Const<'tcx>,
+    ) -> RelateResult<'tcx, ty::Const<'tcx>> {
+        let span = match self.inner.borrow_mut().const_unification_table().probe_value(target_vid) {
+            ConstVariableValue::Known { value } => {
+                bug!("instantiating a known const var: {target_vid:?} {value} {source_ct}")
+            }
+            ConstVariableValue::Unknown { origin, universe: _ } => origin.span,
+        };
+        // FIXME(generic_const_exprs): Occurs check failures for unevaluated
+        // constants and generic expressions are not yet handled correctly.
+        let Generalization { value_may_be_infer: generalized_ct, has_unconstrained_ty_var } =
+            self.generalize(span, target_vid, ty::Variance::Invariant, source_ct)?;
+
+        debug_assert!(!generalized_ct.is_ct_infer());
+        if has_unconstrained_ty_var {
+            span_bug!(span, "unconstrained ty var when generalizing `{source_ct:?}`");
+        }
 
-impl<'tcx, T> GeneralizerDelegate<'tcx> for T
-where
-    T: TypeRelatingDelegate<'tcx>,
-{
-    fn forbid_inference_vars() -> bool {
-        <Self as TypeRelatingDelegate<'tcx>>::forbid_inference_vars()
-    }
+        self.inner
+            .borrow_mut()
+            .const_unification_table()
+            .union_value(target_vid, ConstVariableValue::Known { value: generalized_ct });
 
-    fn span(&self) -> Span {
-        <Self as TypeRelatingDelegate<'tcx>>::span(&self)
+        // FIXME(generic_const_exprs): We have to make sure we actually equate
+        // `generalized_ct` and `source_ct` here.
+        Ok(generalized_ct)
     }
 
-    fn generalize_region(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
-        <Self as TypeRelatingDelegate<'tcx>>::generalize_existential(self, universe)
+    /// Attempts to generalize `source_term` for the type variable `target_vid`.
+    /// This checks for cycles -- that is, whether `source_term` references `target_vid`.
+    fn generalize<T: Into<Term<'tcx>> + Relate<'tcx>>(
+        &self,
+        span: Span,
+        target_vid: impl Into<ty::TermVid>,
+        ambient_variance: ty::Variance,
+        source_term: T,
+    ) -> RelateResult<'tcx, Generalization<T>> {
+        assert!(!source_term.has_escaping_bound_vars());
+        let (for_universe, root_vid) = match target_vid.into() {
+            ty::TermVid::Ty(ty_vid) => (
+                self.probe_ty_var(ty_vid).unwrap_err(),
+                ty::TermVid::Ty(self.inner.borrow_mut().type_variables().sub_root_var(ty_vid)),
+            ),
+            ty::TermVid::Const(ct_vid) => (
+                self.probe_const_var(ct_vid).unwrap_err(),
+                ty::TermVid::Const(
+                    self.inner.borrow_mut().const_unification_table().find(ct_vid).vid,
+                ),
+            ),
+        };
+
+        let mut generalizer = Generalizer {
+            infcx: self,
+            span,
+            root_vid,
+            for_universe,
+            ambient_variance,
+            root_term: source_term.into(),
+            in_alias: false,
+            has_unconstrained_ty_var: false,
+            cache: Default::default(),
+        };
+
+        let value_may_be_infer = generalizer.relate(source_term, source_term)?;
+        let has_unconstrained_ty_var = generalizer.has_unconstrained_ty_var;
+        Ok(Generalization { value_may_be_infer, has_unconstrained_ty_var })
     }
 }
 
@@ -115,18 +244,10 @@ where
 /// establishes `'0: 'x` as a constraint.
 ///
 /// [blog post]: https://is.gd/0hKvIr
-struct Generalizer<'me, 'tcx, D> {
+struct Generalizer<'me, 'tcx> {
     infcx: &'me InferCtxt<'tcx>,
 
-    /// This is used to abstract the behaviors of the three previous
-    /// generalizer-like implementations (`Generalizer`, `TypeGeneralizer`,
-    /// and `ConstInferUnifier`). See [`GeneralizerDelegate`] for more
-    /// information.
-    delegate: &'me mut D,
-
-    /// After we generalize this type, we are going to relate it to
-    /// some other type. What will be the variance at this point?
-    ambient_variance: ty::Variance,
+    span: Span,
 
     /// The vid of the type variable that is in the process of being
     /// instantiated. If we find this within the value we are folding,
@@ -138,6 +259,10 @@ struct Generalizer<'me, 'tcx, D> {
     /// we reject the relation.
     for_universe: ty::UniverseIndex,
 
+    /// After we generalize this type, we are going to relate it to
+    /// some other type. What will be the variance at this point?
+    ambient_variance: ty::Variance,
+
     /// The root term (const or type) we're generalizing. Used for cycle errors.
     root_term: Term<'tcx>,
 
@@ -150,11 +275,11 @@ struct Generalizer<'me, 'tcx, D> {
     /// hold by either normalizing the outer or the inner associated type.
     in_alias: bool,
 
-    /// See the field `needs_wf` in `Generalization`.
-    needs_wf: bool,
+    /// See the field `has_unconstrained_ty_var` in `Generalization`.
+    has_unconstrained_ty_var: bool,
 }
 
-impl<'tcx, D> Generalizer<'_, 'tcx, D> {
+impl<'tcx> Generalizer<'_, 'tcx> {
     /// Create an error that corresponds to the term kind in `root_term`
     fn cyclic_term_error(&self) -> TypeError<'tcx> {
         match self.root_term.unpack() {
@@ -164,10 +289,7 @@ impl<'tcx, D> Generalizer<'_, 'tcx, D> {
     }
 }
 
-impl<'tcx, D> TypeRelation<'tcx> for Generalizer<'_, 'tcx, D>
-where
-    D: GeneralizerDelegate<'tcx>,
-{
+impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
     fn tcx(&self) -> TyCtxt<'tcx> {
         self.infcx.tcx
     }
@@ -236,12 +358,6 @@ where
         // subtyping. This is basically our "occurs check", preventing
         // us from creating infinitely sized types.
         let g = match *t.kind() {
-            ty::Infer(ty::TyVar(_)) | ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_))
-                if D::forbid_inference_vars() =>
-            {
-                bug!("unexpected inference variable encountered in NLL generalization: {t}");
-            }
-
             ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
                 bug!("unexpected infer type: {t}")
             }
@@ -272,11 +388,10 @@ where
                                     }
                                 }
 
-                                // Bivariant: make a fresh var, but we
-                                // may need a WF predicate. See
-                                // comment on `needs_wf` field for
-                                // more info.
-                                ty::Bivariant => self.needs_wf = true,
+                                // Bivariant: make a fresh var, but remember that
+                                // it is unconstrained. See the comment in
+                                // `Generalization`.
+                                ty::Bivariant => self.has_unconstrained_ty_var = true,
 
                                 // Co/contravariant: this will be
                                 // sufficiently constrained later on.
@@ -345,7 +460,7 @@ where
                             Ok(self.infcx.next_ty_var_in_universe(
                                 TypeVariableOrigin {
                                     kind: TypeVariableOriginKind::MiscVariable,
-                                    span: self.delegate.span(),
+                                    span: self.span,
                                 },
                                 self.for_universe,
                             ))
@@ -403,7 +518,10 @@ where
             }
         }
 
-        Ok(self.delegate.generalize_region(self.for_universe))
+        Ok(self.infcx.next_region_var_in_universe(
+            RegionVariableOrigin::MiscVariable(self.span),
+            self.for_universe,
+        ))
     }
 
     #[instrument(level = "debug", skip(self, c2), ret)]
@@ -415,9 +533,6 @@ where
         assert_eq!(c, c2); // we are misusing TypeRelation here; both LHS and RHS ought to be ==
 
         match c.kind() {
-            ty::ConstKind::Infer(InferConst::Var(_)) if D::forbid_inference_vars() => {
-                bug!("unexpected inference variable encountered in NLL generalization: {:?}", c);
-            }
             ty::ConstKind::Infer(InferConst::Var(vid)) => {
                 // If root const vids are equal, then `root_vid` and
                 // `vid` are related and we'd be inferring an infinitely
@@ -452,6 +567,9 @@ where
                 }
             }
             ty::ConstKind::Infer(InferConst::EffectVar(_)) => Ok(c),
+            // FIXME: Unevaluated constants are also not rigid, so the current
+            // approach of always relating them structurally is incomplete.
+            //
             // FIXME: remove this branch once `structurally_relate_consts` is fully
             // structural.
             ty::ConstKind::Unevaluated(ty::UnevaluatedConst { def, args }) => {
@@ -511,30 +629,27 @@ pub struct Generalization<T> {
     /// recursion.
     pub value_may_be_infer: T,
 
-    /// If true, then the generalized type may not be well-formed,
-    /// even if the source type is well-formed, so we should add an
-    /// additional check to enforce that it is. This arises in
-    /// particular around 'bivariant' type parameters that are only
-    /// constrained by a where-clause. As an example, imagine a type:
+    /// In general, we do not check whether all types which occur during
+    /// type checking are well-formed. We only check wf of user-provided types
+    /// and when actually using a type, e.g. for method calls.
+    ///
+    /// This means that when subtyping, we may end up with unconstrained
+    /// inference variables if a generalized type has bivariant parameters.
+    /// A parameter may only be bivariant if it is constrained by a projection
+    /// bound in a where-clause. As an example, imagine a type:
     ///
     ///     struct Foo<A, B> where A: Iterator<Item = B> {
     ///         data: A
     ///     }
     ///
-    /// here, `A` will be covariant, but `B` is
-    /// unconstrained. However, whatever it is, for `Foo` to be WF, it
-    /// must be equal to `A::Item`. If we have an input `Foo<?A, ?B>`,
-    /// then after generalization we will wind up with a type like
-    /// `Foo<?C, ?D>`. When we enforce that `Foo<?A, ?B> <: Foo<?C,
-    /// ?D>` (or `>:`), we will wind up with the requirement that `?A
-    /// <: ?C`, but no particular relationship between `?B` and `?D`
-    /// (after all, we do not know the variance of the normalized form
-    /// of `A::Item` with respect to `A`). If we do nothing else, this
-    /// may mean that `?D` goes unconstrained (as in #41677). So, in
-    /// this scenario where we create a new type variable in a
-    /// bivariant context, we set the `needs_wf` flag to true. This
-    /// will force the calling code to check that `WF(Foo<?C, ?D>)`
-    /// holds, which in turn implies that `?C::Item == ?D`. So once
-    /// `?C` is constrained, that should suffice to restrict `?D`.
-    pub needs_wf: bool,
+    /// here, `A` will be covariant, but `B` is unconstrained.
+    ///
+    /// However, whatever it is, for `Foo` to be WF, it must be equal to `A::Item`.
+    /// If we have an input `Foo<?A, ?B>`, then after generalization we will wind
+    /// up with a type like `Foo<?C, ?D>`. When we enforce `Foo<?A, ?B> <: Foo<?C, ?D>`,
+    /// we will wind up with the requirement that `?A <: ?C`, but no particular
+    /// relationship between `?B` and `?D` (after all, these types may be completely
+    /// different). If we do nothing else, this may mean that `?D` goes unconstrained
+    /// (as in #41677). To avoid this we emit a `WellFormed` obligation in these cases.
+    pub has_unconstrained_ty_var: bool,
 }
diff --git a/compiler/rustc_infer/src/infer/relate/glb.rs b/compiler/rustc_infer/src/infer/relate/glb.rs
index aa89124301e..6cf51354599 100644
--- a/compiler/rustc_infer/src/infer/relate/glb.rs
+++ b/compiler/rustc_infer/src/infer/relate/glb.rs
@@ -2,6 +2,7 @@
 
 use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
 use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
+use rustc_span::Span;
 
 use super::combine::{CombineFields, ObligationEmittingRelation};
 use super::lattice::{self, LatticeDir};
@@ -134,6 +135,10 @@ impl<'combine, 'infcx, 'tcx> LatticeDir<'infcx, 'tcx> for Glb<'combine, 'infcx,
 }
 
 impl<'tcx> ObligationEmittingRelation<'tcx> for Glb<'_, '_, 'tcx> {
+    fn span(&self) -> Span {
+        self.fields.trace.span()
+    }
+
     fn param_env(&self) -> ty::ParamEnv<'tcx> {
         self.fields.param_env
     }
diff --git a/compiler/rustc_infer/src/infer/relate/lub.rs b/compiler/rustc_infer/src/infer/relate/lub.rs
index 87d777530c8..5b4f80fd73a 100644
--- a/compiler/rustc_infer/src/infer/relate/lub.rs
+++ b/compiler/rustc_infer/src/infer/relate/lub.rs
@@ -7,6 +7,7 @@ use crate::traits::{ObligationCause, PredicateObligations};
 
 use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
 use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
+use rustc_span::Span;
 
 /// "Least upper bound" (common supertype)
 pub struct Lub<'combine, 'infcx, 'tcx> {
@@ -134,6 +135,10 @@ impl<'combine, 'infcx, 'tcx> LatticeDir<'infcx, 'tcx> for Lub<'combine, 'infcx,
 }
 
 impl<'tcx> ObligationEmittingRelation<'tcx> for Lub<'_, '_, 'tcx> {
+    fn span(&self) -> Span {
+        self.fields.trace.span()
+    }
+
     fn param_env(&self) -> ty::ParamEnv<'tcx> {
         self.fields.param_env
     }
diff --git a/compiler/rustc_infer/src/infer/relate/mod.rs b/compiler/rustc_infer/src/infer/relate/mod.rs
index f688c2b74a6..26270c77f1a 100644
--- a/compiler/rustc_infer/src/infer/relate/mod.rs
+++ b/compiler/rustc_infer/src/infer/relate/mod.rs
@@ -3,7 +3,7 @@
 
 pub(super) mod combine;
 mod equate;
-pub(super) mod generalize;
+mod generalize;
 mod glb;
 mod higher_ranked;
 mod lattice;
diff --git a/compiler/rustc_infer/src/infer/relate/nll.rs b/compiler/rustc_infer/src/infer/relate/nll.rs
index 5e2d2af9b85..4ba4bd38e9f 100644
--- a/compiler/rustc_infer/src/infer/relate/nll.rs
+++ b/compiler/rustc_infer/src/infer/relate/nll.rs
@@ -25,13 +25,11 @@ use rustc_data_structures::fx::FxHashMap;
 use rustc_middle::traits::ObligationCause;
 use rustc_middle::ty::fold::FnMutDelegate;
 use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
-use rustc_middle::ty::visit::TypeVisitableExt;
+use rustc_middle::ty::TypeVisitableExt;
 use rustc_middle::ty::{self, InferConst, Ty, TyCtxt};
 use rustc_span::{Span, Symbol};
-use std::fmt::Debug;
 
 use super::combine::ObligationEmittingRelation;
-use super::generalize::{self, Generalization};
 use crate::infer::InferCtxt;
 use crate::infer::{TypeVariableOrigin, TypeVariableOriginKind};
 use crate::traits::{Obligation, PredicateObligations};
@@ -99,15 +97,6 @@ pub trait TypeRelatingDelegate<'tcx> {
     /// placeholder region.
     fn next_placeholder_region(&mut self, placeholder: ty::PlaceholderRegion) -> ty::Region<'tcx>;
 
-    /// Creates a new existential region in the given universe. This
-    /// is used when handling subtyping and type variables -- if we
-    /// have that `?X <: Foo<'a>`, for example, we would instantiate
-    /// `?X` with a type like `Foo<'?0>` where `'?0` is a fresh
-    /// existential variable created by this function. We would then
-    /// relate `Foo<'?0>` with `Foo<'a>` (and probably add an outlives
-    /// relation stating that `'?0: 'a`).
-    fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx>;
-
     /// Enables some optimizations if we do not expect inference variables
     /// in the RHS of the relation.
     fn forbid_inference_vars() -> bool;
@@ -153,112 +142,44 @@ where
         self.delegate.push_outlives(sup, sub, info);
     }
 
-    /// Relate a type inference variable with a value type. This works
-    /// by creating a "generalization" G of the value where all the
-    /// lifetimes are replaced with fresh inference values. This
-    /// generalization G becomes the value of the inference variable,
-    /// and is then related in turn to the value. So e.g. if you had
-    /// `vid = ?0` and `value = &'a u32`, we might first instantiate
-    /// `?0` to a type like `&'0 u32` where `'0` is a fresh variable,
-    /// and then relate `&'0 u32` with `&'a u32` (resulting in
-    /// relations between `'0` and `'a`).
-    ///
-    /// The variable `pair` can be either a `(vid, ty)` or `(ty, vid)`
-    /// -- in other words, it is always an (unresolved) inference
-    /// variable `vid` and a type `ty` that are being related, but the
-    /// vid may appear either as the "a" type or the "b" type,
-    /// depending on where it appears in the tuple. The trait
-    /// `VidValuePair` lets us work with the vid/type while preserving
-    /// the "sidedness" when necessary -- the sidedness is relevant in
-    /// particular for the variance and set of in-scope things.
-    fn relate_ty_var<PAIR: VidValuePair<'tcx>>(
-        &mut self,
-        pair: PAIR,
-    ) -> RelateResult<'tcx, Ty<'tcx>> {
-        debug!("relate_ty_var({:?})", pair);
-
-        let vid = pair.vid();
-        let value_ty = pair.value_ty();
-
-        // FIXME(invariance) -- this logic assumes invariance, but that is wrong.
-        // This only presently applies to chalk integration, as NLL
-        // doesn't permit type variables to appear on both sides (and
-        // doesn't use lazy norm).
-        match *value_ty.kind() {
-            ty::Infer(ty::TyVar(value_vid)) => {
-                // Two type variables: just equate them.
-                self.infcx.inner.borrow_mut().type_variables().equate(vid, value_vid);
-                return Ok(value_ty);
-            }
-
-            _ => (),
-        }
-
-        let generalized_ty = self.generalize(value_ty, vid)?;
-        debug!("relate_ty_var: generalized_ty = {:?}", generalized_ty);
-
-        if D::forbid_inference_vars() {
-            // In NLL, we don't have type inference variables
-            // floating around, so we can do this rather imprecise
-            // variant of the occurs-check.
-            assert!(!generalized_ty.has_non_region_infer());
-        }
-
-        self.infcx.inner.borrow_mut().type_variables().instantiate(vid, generalized_ty);
-
-        // Relate the generalized kind to the original one.
-        let result = pair.relate_generalized_ty(self, generalized_ty);
-
-        debug!("relate_ty_var: complete, result = {:?}", result);
-        result
-    }
-
-    fn generalize(&mut self, ty: Ty<'tcx>, for_vid: ty::TyVid) -> RelateResult<'tcx, Ty<'tcx>> {
-        let Generalization { value_may_be_infer: ty, needs_wf: _ } = generalize::generalize(
-            self.infcx,
-            &mut self.delegate,
-            ty,
-            for_vid,
-            self.ambient_variance,
-        )?;
-
-        if ty.is_ty_var() {
-            span_bug!(self.delegate.span(), "occurs check failure in MIR typeck");
-        }
-        Ok(ty)
-    }
-
-    fn relate_opaques(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
+    fn relate_opaques(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, ()> {
+        let infcx = self.infcx;
+        debug_assert!(!infcx.next_trait_solver());
         let (a, b) = if self.a_is_expected() { (a, b) } else { (b, a) };
-        let mut generalize = |ty, ty_is_expected| {
-            let var = self.infcx.next_ty_var_id_in_universe(
+        // `handle_opaque_type` cannot handle subtyping, so to support subtyping
+        // we instead eagerly generalize here. This is a bit of a mess but will go
+        // away once we're using the new solver.
+        let mut enable_subtyping = |ty, ty_is_expected| {
+            let ty_vid = infcx.next_ty_var_id_in_universe(
                 TypeVariableOrigin {
                     kind: TypeVariableOriginKind::MiscVariable,
                     span: self.delegate.span(),
                 },
                 ty::UniverseIndex::ROOT,
             );
-            if ty_is_expected {
-                self.relate_ty_var((ty, var))
+
+            let variance = if ty_is_expected {
+                self.ambient_variance
             } else {
-                self.relate_ty_var((var, ty))
-            }
+                self.ambient_variance.xform(ty::Contravariant)
+            };
+
+            self.infcx.instantiate_ty_var(self, ty_is_expected, ty_vid, variance, ty)?;
+            Ok(infcx.resolve_vars_if_possible(Ty::new_infer(infcx.tcx, ty::TyVar(ty_vid))))
         };
+
         let (a, b) = match (a.kind(), b.kind()) {
-            (&ty::Alias(ty::Opaque, ..), _) => (a, generalize(b, false)?),
-            (_, &ty::Alias(ty::Opaque, ..)) => (generalize(a, true)?, b),
+            (&ty::Alias(ty::Opaque, ..), _) => (a, enable_subtyping(b, false)?),
+            (_, &ty::Alias(ty::Opaque, ..)) => (enable_subtyping(a, true)?, b),
             _ => unreachable!(
                 "expected at least one opaque type in `relate_opaques`, got {a} and {b}."
             ),
         };
         let cause = ObligationCause::dummy_with_span(self.delegate.span());
-        let obligations = self
-            .infcx
-            .handle_opaque_type(a, b, true, &cause, self.delegate.param_env())?
-            .obligations;
+        let obligations =
+            infcx.handle_opaque_type(a, b, true, &cause, self.delegate.param_env())?.obligations;
         self.delegate.register_obligations(obligations);
-        trace!(a = ?a.kind(), b = ?b.kind(), "opaque type instantiated");
-        Ok(a)
+        Ok(())
     }
 
     fn enter_forall<T, U>(
@@ -356,76 +277,6 @@ where
     }
 }
 
-/// When we instantiate an inference variable with a value in
-/// `relate_ty_var`, we always have the pair of a `TyVid` and a `Ty`,
-/// but the ordering may vary (depending on whether the inference
-/// variable was found on the `a` or `b` sides). Therefore, this trait
-/// allows us to factor out common code, while preserving the order
-/// when needed.
-trait VidValuePair<'tcx>: Debug {
-    /// Extract the inference variable (which could be either the
-    /// first or second part of the tuple).
-    fn vid(&self) -> ty::TyVid;
-
-    /// Extract the value it is being related to (which will be the
-    /// opposite part of the tuple from the vid).
-    fn value_ty(&self) -> Ty<'tcx>;
-
-    /// Given a generalized type G that should replace the vid, relate
-    /// G to the value, putting G on whichever side the vid would have
-    /// appeared.
-    fn relate_generalized_ty<D>(
-        &self,
-        relate: &mut TypeRelating<'_, 'tcx, D>,
-        generalized_ty: Ty<'tcx>,
-    ) -> RelateResult<'tcx, Ty<'tcx>>
-    where
-        D: TypeRelatingDelegate<'tcx>;
-}
-
-impl<'tcx> VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) {
-    fn vid(&self) -> ty::TyVid {
-        self.0
-    }
-
-    fn value_ty(&self) -> Ty<'tcx> {
-        self.1
-    }
-
-    fn relate_generalized_ty<D>(
-        &self,
-        relate: &mut TypeRelating<'_, 'tcx, D>,
-        generalized_ty: Ty<'tcx>,
-    ) -> RelateResult<'tcx, Ty<'tcx>>
-    where
-        D: TypeRelatingDelegate<'tcx>,
-    {
-        relate.relate(generalized_ty, self.value_ty())
-    }
-}
-
-// In this case, the "vid" is the "b" type.
-impl<'tcx> VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) {
-    fn vid(&self) -> ty::TyVid {
-        self.1
-    }
-
-    fn value_ty(&self) -> Ty<'tcx> {
-        self.0
-    }
-
-    fn relate_generalized_ty<D>(
-        &self,
-        relate: &mut TypeRelating<'_, 'tcx, D>,
-        generalized_ty: Ty<'tcx>,
-    ) -> RelateResult<'tcx, Ty<'tcx>>
-    where
-        D: TypeRelatingDelegate<'tcx>,
-    {
-        relate.relate(self.value_ty(), generalized_ty)
-    }
-}
-
 impl<'tcx, D> TypeRelation<'tcx> for TypeRelating<'_, 'tcx, D>
 where
     D: TypeRelatingDelegate<'tcx>,
@@ -472,6 +323,8 @@ where
 
         if !D::forbid_inference_vars() {
             b = self.infcx.shallow_resolve(b);
+        } else {
+            assert!(!b.has_non_region_infer(), "unexpected inference var {:?}", b);
         }
 
         if a == b {
@@ -479,22 +332,30 @@ where
         }
 
         match (a.kind(), b.kind()) {
-            (_, &ty::Infer(ty::TyVar(vid))) => {
-                if D::forbid_inference_vars() {
-                    // Forbid inference variables in the RHS.
-                    bug!("unexpected inference var {:?}", b)
-                } else {
-                    self.relate_ty_var((a, vid))
+            (&ty::Infer(ty::TyVar(a_vid)), &ty::Infer(ty::TyVar(b_vid))) => {
+                match self.ambient_variance {
+                    ty::Invariant => infcx.inner.borrow_mut().type_variables().equate(a_vid, b_vid),
+                    _ => unimplemented!(),
                 }
             }
 
-            (&ty::Infer(ty::TyVar(vid)), _) => self.relate_ty_var((vid, b)),
+            (&ty::Infer(ty::TyVar(a_vid)), _) => {
+                infcx.instantiate_ty_var(self, true, a_vid, self.ambient_variance, b)?
+            }
+
+            (_, &ty::Infer(ty::TyVar(b_vid))) => infcx.instantiate_ty_var(
+                self,
+                false,
+                b_vid,
+                self.ambient_variance.xform(ty::Contravariant),
+                a,
+            )?,
 
             (
                 &ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
                 &ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),
             ) if a_def_id == b_def_id || infcx.next_trait_solver() => {
-                infcx.super_combine_tys(self, a, b).or_else(|err| {
+                infcx.super_combine_tys(self, a, b).map(|_| ()).or_else(|err| {
                     // This behavior is only there for the old solver, the new solver
                     // shouldn't ever fail. Instead, it unconditionally emits an
                     // alias-relate goal.
@@ -504,22 +365,24 @@ where
                         "failure to relate an opaque to itself should result in an error later on",
                     );
                     if a_def_id.is_local() { self.relate_opaques(a, b) } else { Err(err) }
-                })
+                })?;
             }
             (&ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }), _)
             | (_, &ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }))
                 if def_id.is_local() && !self.infcx.next_trait_solver() =>
             {
-                self.relate_opaques(a, b)
+                self.relate_opaques(a, b)?;
             }
 
             _ => {
                 debug!(?a, ?b, ?self.ambient_variance);
 
                 // Will also handle unification of `IntVar` and `FloatVar`.
-                self.infcx.super_combine_tys(self, a, b)
+                self.infcx.super_combine_tys(self, a, b)?;
             }
         }
+
+        Ok(a)
     }
 
     #[instrument(skip(self), level = "trace")]
@@ -669,6 +532,10 @@ impl<'tcx, D> ObligationEmittingRelation<'tcx> for TypeRelating<'_, 'tcx, D>
 where
     D: TypeRelatingDelegate<'tcx>,
 {
+    fn span(&self) -> Span {
+        self.delegate.span()
+    }
+
     fn param_env(&self) -> ty::ParamEnv<'tcx> {
         self.delegate.param_env()
     }
diff --git a/compiler/rustc_infer/src/infer/relate/sub.rs b/compiler/rustc_infer/src/infer/relate/sub.rs
index 36876acd7c0..5bd3a238a67 100644
--- a/compiler/rustc_infer/src/infer/relate/sub.rs
+++ b/compiler/rustc_infer/src/infer/relate/sub.rs
@@ -6,6 +6,7 @@ use rustc_middle::ty::relate::{Cause, Relate, RelateResult, TypeRelation};
 use rustc_middle::ty::visit::TypeVisitableExt;
 use rustc_middle::ty::TyVar;
 use rustc_middle::ty::{self, Ty, TyCtxt};
+use rustc_span::Span;
 use std::mem;
 
 /// Ensures `a` is made a subtype of `b`. Returns `a` on success.
@@ -103,12 +104,12 @@ impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
 
                 Ok(a)
             }
-            (&ty::Infer(TyVar(a_id)), _) => {
-                self.fields.instantiate(b, ty::Contravariant, a_id, !self.a_is_expected)?;
+            (&ty::Infer(TyVar(a_vid)), _) => {
+                infcx.instantiate_ty_var(self, self.a_is_expected, a_vid, ty::Covariant, b)?;
                 Ok(a)
             }
-            (_, &ty::Infer(TyVar(b_id))) => {
-                self.fields.instantiate(a, ty::Covariant, b_id, self.a_is_expected)?;
+            (_, &ty::Infer(TyVar(b_vid))) => {
+                infcx.instantiate_ty_var(self, !self.a_is_expected, b_vid, ty::Contravariant, a)?;
                 Ok(a)
             }
 
@@ -199,6 +200,10 @@ impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
 }
 
 impl<'tcx> ObligationEmittingRelation<'tcx> for Sub<'_, '_, 'tcx> {
+    fn span(&self) -> Span {
+        self.fields.trace.span()
+    }
+
     fn param_env(&self) -> ty::ParamEnv<'tcx> {
         self.fields.param_env
     }
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index faa35f51cd4..f9149f54e92 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -1542,32 +1542,6 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
     }
 }
 
-declare_lint_pass!(
-    /// Lint constants that are erroneous.
-    /// Without this lint, we might not get any diagnostic if the constant is
-    /// unused within this crate, even though downstream crates can't use it
-    /// without producing an error.
-    UnusedBrokenConst => []
-);
-
-impl<'tcx> LateLintPass<'tcx> for UnusedBrokenConst {
-    fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
-        match it.kind {
-            hir::ItemKind::Const(_, _, body_id) => {
-                let def_id = cx.tcx.hir().body_owner_def_id(body_id).to_def_id();
-                // trigger the query once for all constants since that will already report the errors
-                // FIXME(generic_const_items): Does this work properly with generic const items?
-                cx.tcx.ensure().const_eval_poly(def_id);
-            }
-            hir::ItemKind::Static(_, _, body_id) => {
-                let def_id = cx.tcx.hir().body_owner_def_id(body_id).to_def_id();
-                cx.tcx.ensure().eval_static_initializer(def_id);
-            }
-            _ => {}
-        }
-    }
-}
-
 declare_lint! {
     /// The `trivial_bounds` lint detects trait bounds that don't depend on
     /// any type parameters.
diff --git a/compiler/rustc_lint/src/context/diagnostics.rs b/compiler/rustc_lint/src/context/diagnostics.rs
index 5af2b6daec1..86434002e2c 100644
--- a/compiler/rustc_lint/src/context/diagnostics.rs
+++ b/compiler/rustc_lint/src/context/diagnostics.rs
@@ -1,3 +1,6 @@
+#![allow(rustc::diagnostic_outside_of_impl)]
+#![allow(rustc::untranslatable_diagnostic)]
+
 use rustc_ast::util::unicode::TEXT_FLOW_CONTROL_CHARS;
 use rustc_errors::{add_elided_lifetime_in_path_suggestion, DiagnosticBuilder};
 use rustc_errors::{Applicability, SuggestionStyle};
diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs
index 21d4b6fa65b..bcff20fc260 100644
--- a/compiler/rustc_lint/src/errors.rs
+++ b/compiler/rustc_lint/src/errors.rs
@@ -1,5 +1,7 @@
 use crate::fluent_generated as fluent;
-use rustc_errors::{codes::*, AddToDiagnostic, Diagnostic, SubdiagnosticMessageOp};
+use rustc_errors::{
+    codes::*, AddToDiagnostic, DiagnosticBuilder, EmissionGuarantee, SubdiagnosticMessageOp,
+};
 use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_session::lint::Level;
 use rustc_span::{Span, Symbol};
@@ -24,7 +26,11 @@ pub enum OverruledAttributeSub {
 }
 
 impl AddToDiagnostic for OverruledAttributeSub {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         match self {
             OverruledAttributeSub::DefaultSource { id } => {
                 diag.note(fluent::lint_default_source);
diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs
index 40fb12b2107..c1a083bde8d 100644
--- a/compiler/rustc_lint/src/levels.rs
+++ b/compiler/rustc_lint/src/levels.rs
@@ -1062,6 +1062,9 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
                 if self.lint_added_lints {
                     let lint = builtin::UNKNOWN_LINTS;
                     let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS);
+                    // FIXME: make this translatable
+                    #[allow(rustc::diagnostic_outside_of_impl)]
+                    #[allow(rustc::untranslatable_diagnostic)]
                     lint_level(
                         self.sess,
                         lint,
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index e50f4ca338b..d8e12c04f75 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -213,8 +213,6 @@ late_lint_methods!(
             ExplicitOutlivesRequirements: ExplicitOutlivesRequirements,
             InvalidValue: InvalidValue,
             DerefNullPtr: DerefNullPtr,
-            // May Depend on constants elsewhere
-            UnusedBrokenConst: UnusedBrokenConst,
             UnstableFeatures: UnstableFeatures,
             UngatedAsyncFnTrackCaller: UngatedAsyncFnTrackCaller,
             ArrayIntoIter: ArrayIntoIter::default(),
@@ -524,6 +522,11 @@ fn register_builtins(store: &mut LintStore) {
         "no longer needed, see RFC #3535 \
          <https://rust-lang.github.io/rfcs/3535-constants-in-patterns.html> for more information",
     );
+    store.register_removed(
+        "suspicious_auto_trait_impls",
+        "no longer needed, see #93367 \
+         <https://github.com/rust-lang/rust/issues/93367> for more information",
+    );
 }
 
 fn register_internals(store: &mut LintStore) {
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs
index c204c67fc1f..e4a7eb1d953 100644
--- a/compiler/rustc_lint/src/lints.rs
+++ b/compiler/rustc_lint/src/lints.rs
@@ -5,8 +5,8 @@ use std::num::NonZero;
 use crate::errors::RequestedLevel;
 use crate::fluent_generated as fluent;
 use rustc_errors::{
-    codes::*, AddToDiagnostic, Applicability, DecorateLint, Diagnostic, DiagnosticBuilder,
-    DiagnosticMessage, DiagnosticStyledString, SubdiagnosticMessageOp, SuggestionStyle,
+    codes::*, AddToDiagnostic, Applicability, DecorateLint, DiagnosticBuilder, DiagnosticMessage,
+    DiagnosticStyledString, EmissionGuarantee, SubdiagnosticMessageOp, SuggestionStyle,
 };
 use rustc_hir::def_id::DefId;
 use rustc_macros::{LintDiagnostic, Subdiagnostic};
@@ -267,17 +267,21 @@ pub struct SuggestChangingAssocTypes<'a, 'b> {
     pub ty: &'a rustc_hir::Ty<'b>,
 }
 
-impl AddToDiagnostic for SuggestChangingAssocTypes<'_, '_> {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+impl<'a, 'b> AddToDiagnostic for SuggestChangingAssocTypes<'a, 'b> {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         // Access to associates types should use `<T as Bound>::Assoc`, which does not need a
         // bound. Let's see if this type does that.
 
         // We use a HIR visitor to walk the type.
         use rustc_hir::intravisit::{self, Visitor};
-        struct WalkAssocTypes<'a> {
-            err: &'a mut Diagnostic,
+        struct WalkAssocTypes<'a, 'b, G: EmissionGuarantee> {
+            err: &'a mut DiagnosticBuilder<'b, G>,
         }
-        impl Visitor<'_> for WalkAssocTypes<'_> {
+        impl<'a, 'b, G: EmissionGuarantee> Visitor<'_> for WalkAssocTypes<'a, 'b, G> {
             fn visit_qpath(
                 &mut self,
                 qpath: &rustc_hir::QPath<'_>,
@@ -320,7 +324,11 @@ pub struct BuiltinTypeAliasGenericBoundsSuggestion {
 }
 
 impl AddToDiagnostic for BuiltinTypeAliasGenericBoundsSuggestion {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         diag.multipart_suggestion(
             fluent::lint_suggestion,
             self.suggestions,
@@ -437,7 +445,11 @@ pub struct BuiltinUnpermittedTypeInitSub {
 }
 
 impl AddToDiagnostic for BuiltinUnpermittedTypeInitSub {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         let mut err = self.err;
         loop {
             if let Some(span) = err.span {
@@ -488,7 +500,11 @@ pub struct BuiltinClashingExternSub<'a> {
 }
 
 impl AddToDiagnostic for BuiltinClashingExternSub<'_> {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         let mut expected_str = DiagnosticStyledString::new();
         expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
         let mut found_str = DiagnosticStyledString::new();
@@ -766,7 +782,11 @@ pub struct HiddenUnicodeCodepointsDiagLabels {
 }
 
 impl AddToDiagnostic for HiddenUnicodeCodepointsDiagLabels {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         for (c, span) in self.spans {
             diag.span_label(span, format!("{c:?}"));
         }
@@ -780,7 +800,11 @@ pub enum HiddenUnicodeCodepointsDiagSub {
 
 // Used because of multiple multipart_suggestion and note
 impl AddToDiagnostic for HiddenUnicodeCodepointsDiagSub {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         match self {
             HiddenUnicodeCodepointsDiagSub::Escape { spans } => {
                 diag.multipart_suggestion_with_style(
@@ -928,7 +952,11 @@ pub struct NonBindingLetSub {
 }
 
 impl AddToDiagnostic for NonBindingLetSub {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         let can_suggest_binding = self.drop_fn_start_end.is_some() || !self.is_assign_desugar;
 
         if can_suggest_binding {
@@ -1208,7 +1236,11 @@ pub enum NonSnakeCaseDiagSub {
 }
 
 impl AddToDiagnostic for NonSnakeCaseDiagSub {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         match self {
             NonSnakeCaseDiagSub::Label { span } => {
                 diag.span_label(span, fluent::lint_label);
@@ -1401,7 +1433,11 @@ pub enum OverflowingBinHexSign {
 }
 
 impl AddToDiagnostic for OverflowingBinHexSign {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         match self {
             OverflowingBinHexSign::Positive => {
                 diag.note(fluent::lint_positive_note);
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 3f5d3c25971..84a050a242a 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -90,7 +90,6 @@ declare_lint_pass! {
         SOFT_UNSTABLE,
         STABLE_FEATURES,
         STATIC_MUT_REFS,
-        SUSPICIOUS_AUTO_TRAIT_IMPLS,
         TEST_UNSTABLE_LINT,
         TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
         TRIVIAL_CASTS,
@@ -1503,7 +1502,7 @@ declare_lint! {
     Warn,
     "distinct impls distinguished only by the leak-check code",
     @future_incompatible = FutureIncompatibleInfo {
-        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
+        reason: FutureIncompatibilityReason::Custom("the behavior may change in a future release"),
         reference: "issue #56105 <https://github.com/rust-lang/rust/issues/56105>",
     };
 }
@@ -4033,40 +4032,6 @@ declare_lint! {
 }
 
 declare_lint! {
-    /// The `suspicious_auto_trait_impls` lint checks for potentially incorrect
-    /// implementations of auto traits.
-    ///
-    /// ### Example
-    ///
-    /// ```rust
-    /// struct Foo<T>(T);
-    ///
-    /// unsafe impl<T> Send for Foo<*const T> {}
-    /// ```
-    ///
-    /// {{produces}}
-    ///
-    /// ### Explanation
-    ///
-    /// A type can implement auto traits, e.g. `Send`, `Sync` and `Unpin`,
-    /// in two different ways: either by writing an explicit impl or if
-    /// all fields of the type implement that auto trait.
-    ///
-    /// The compiler disables the automatic implementation if an explicit one
-    /// exists for given type constructor. The exact rules governing this
-    /// were previously unsound, quite subtle, and have been recently modified.
-    /// This change caused the automatic implementation to be disabled in more
-    /// cases, potentially breaking some code.
-    pub SUSPICIOUS_AUTO_TRAIT_IMPLS,
-    Warn,
-    "the rules governing auto traits have recently changed resulting in potential breakage",
-    @future_incompatible = FutureIncompatibleInfo {
-        reason: FutureIncompatibilityReason::FutureReleaseSemanticsChange,
-        reference: "issue #93367 <https://github.com/rust-lang/rust/issues/93367>",
-    };
-}
-
-declare_lint! {
     /// The `deprecated_where_clause_location` lint detects when a where clause in front of the equals
     /// in an associated type.
     ///
diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs
index 09b1f03f151..d4e5c78c492 100644
--- a/compiler/rustc_lint_defs/src/lib.rs
+++ b/compiler/rustc_lint_defs/src/lib.rs
@@ -227,8 +227,8 @@ impl Level {
     }
 
     /// Converts a lower-case string to a level. This will never construct the expect
-    /// level as that would require a [`LintExpectationId`]
-    pub fn from_str(x: &str) -> Option<Level> {
+    /// level as that would require a [`LintExpectationId`].
+    pub fn from_str(x: &str) -> Option<Self> {
         match x {
             "allow" => Some(Level::Allow),
             "warn" => Some(Level::Warn),
@@ -238,17 +238,21 @@ impl Level {
         }
     }
 
-    /// Converts a symbol to a level.
-    pub fn from_attr(attr: &Attribute) -> Option<Level> {
-        match attr.name_or_empty() {
-            sym::allow => Some(Level::Allow),
-            sym::expect => Some(Level::Expect(LintExpectationId::Unstable {
-                attr_id: attr.id,
-                lint_index: None,
-            })),
-            sym::warn => Some(Level::Warn),
-            sym::deny => Some(Level::Deny),
-            sym::forbid => Some(Level::Forbid),
+    /// Converts an `Attribute` to a level.
+    pub fn from_attr(attr: &Attribute) -> Option<Self> {
+        Self::from_symbol(attr.name_or_empty(), Some(attr.id))
+    }
+
+    /// Converts a `Symbol` to a level.
+    pub fn from_symbol(s: Symbol, id: Option<AttrId>) -> Option<Self> {
+        match (s, id) {
+            (sym::allow, _) => Some(Level::Allow),
+            (sym::expect, Some(attr_id)) => {
+                Some(Level::Expect(LintExpectationId::Unstable { attr_id, lint_index: None }))
+            }
+            (sym::warn, _) => Some(Level::Warn),
+            (sym::deny, _) => Some(Level::Deny),
+            (sym::forbid, _) => Some(Level::Forbid),
             _ => None,
         }
     }
diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
index 3a5f289559e..323614c222f 100644
--- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
+++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
@@ -87,9 +87,13 @@ impl SubdiagnosticDeriveBuilder {
         let f = &self.f;
         let ret = structure.gen_impl(quote! {
             gen impl rustc_errors::AddToDiagnostic for @Self {
-                fn add_to_diagnostic_with<__F>(self, #diag: &mut rustc_errors::Diagnostic, #f: __F)
-                where
-                    __F: rustc_errors::SubdiagnosticMessageOp,
+                fn add_to_diagnostic_with<__G, __F>(
+                    self,
+                    #diag: &mut rustc_errors::DiagnosticBuilder<'_, __G>,
+                    #f: __F
+                ) where
+                    __G: rustc_errors::EmissionGuarantee,
+                    __F: rustc_errors::SubdiagnosticMessageOp<__G>,
                 {
                     #implementation
                 }
diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs
index d17bf0cf708..7e0a4fb72d4 100644
--- a/compiler/rustc_metadata/src/errors.rs
+++ b/compiler/rustc_metadata/src/errors.rs
@@ -505,6 +505,8 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for MultipleCandidates {
         diag.code(E0464);
         diag.span(self.span);
         for (i, candidate) in self.candidates.iter().enumerate() {
+            // FIXME: make this translatable
+            #[allow(rustc::untranslatable_diagnostic)]
             diag.note(format!("candidate #{}: {}", i + 1, candidate.display()));
         }
         diag
@@ -601,6 +603,8 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for InvalidMetadataFiles {
         diag.code(E0786);
         diag.span(self.span);
         for crate_rejection in self.crate_rejections {
+            // FIXME: make this translatable
+            #[allow(rustc::untranslatable_diagnostic)]
             diag.note(crate_rejection);
         }
         diag
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs
index e7d9dc04886..db27e2bd630 100644
--- a/compiler/rustc_middle/src/hir/map/mod.rs
+++ b/compiler/rustc_middle/src/hir/map/mod.rs
@@ -3,6 +3,8 @@ use crate::middle::debugger_visualizer::DebuggerVisualizerFile;
 use crate::query::LocalCrate;
 use crate::ty::TyCtxt;
 use rustc_ast as ast;
+use rustc_ast::visit::VisitorResult;
+use rustc_ast::walk_list;
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
 use rustc_data_structures::svh::Svh;
@@ -431,23 +433,28 @@ impl<'hir> Map<'hir> {
     }
 
     /// Walks the contents of the local crate. See also `visit_all_item_likes_in_crate`.
-    pub fn walk_toplevel_module(self, visitor: &mut impl Visitor<'hir>) {
+    pub fn walk_toplevel_module<V>(self, visitor: &mut V) -> V::Result
+    where
+        V: Visitor<'hir>,
+    {
         let (top_mod, span, hir_id) = self.get_module(LocalModDefId::CRATE_DEF_ID);
-        visitor.visit_mod(top_mod, span, hir_id);
+        visitor.visit_mod(top_mod, span, hir_id)
     }
 
     /// Walks the attributes in a crate.
-    pub fn walk_attributes(self, visitor: &mut impl Visitor<'hir>) {
+    pub fn walk_attributes<V>(self, visitor: &mut V) -> V::Result
+    where
+        V: Visitor<'hir>,
+    {
         let krate = self.krate();
         for info in krate.owners.iter() {
             if let MaybeOwner::Owner(info) = info {
                 for attrs in info.attrs.map.values() {
-                    for a in *attrs {
-                        visitor.visit_attribute(a)
-                    }
+                    walk_list!(visitor, visit_attribute, *attrs);
                 }
             }
         }
+        V::Result::output()
     }
 
     /// Visits all item-likes in the crate in some deterministic (but unspecified) order. If you
@@ -460,52 +467,38 @@ impl<'hir> Map<'hir> {
     /// provided by `tcx.hir_crate_items(())`.
     ///
     /// Please see the notes in `intravisit.rs` for more information.
-    pub fn visit_all_item_likes_in_crate<V>(self, visitor: &mut V)
+    pub fn visit_all_item_likes_in_crate<V>(self, visitor: &mut V) -> V::Result
     where
         V: Visitor<'hir>,
     {
         let krate = self.tcx.hir_crate_items(());
-
-        for id in krate.items() {
-            visitor.visit_item(self.item(id));
-        }
-
-        for id in krate.trait_items() {
-            visitor.visit_trait_item(self.trait_item(id));
-        }
-
-        for id in krate.impl_items() {
-            visitor.visit_impl_item(self.impl_item(id));
-        }
-
-        for id in krate.foreign_items() {
-            visitor.visit_foreign_item(self.foreign_item(id));
-        }
+        walk_list!(visitor, visit_item, krate.items().map(|id| self.item(id)));
+        walk_list!(visitor, visit_trait_item, krate.trait_items().map(|id| self.trait_item(id)));
+        walk_list!(visitor, visit_impl_item, krate.impl_items().map(|id| self.impl_item(id)));
+        walk_list!(
+            visitor,
+            visit_foreign_item,
+            krate.foreign_items().map(|id| self.foreign_item(id))
+        );
+        V::Result::output()
     }
 
     /// This method is the equivalent of `visit_all_item_likes_in_crate` but restricted to
     /// item-likes in a single module.
-    pub fn visit_item_likes_in_module<V>(self, module: LocalModDefId, visitor: &mut V)
+    pub fn visit_item_likes_in_module<V>(self, module: LocalModDefId, visitor: &mut V) -> V::Result
     where
         V: Visitor<'hir>,
     {
         let module = self.tcx.hir_module_items(module);
-
-        for id in module.items() {
-            visitor.visit_item(self.item(id));
-        }
-
-        for id in module.trait_items() {
-            visitor.visit_trait_item(self.trait_item(id));
-        }
-
-        for id in module.impl_items() {
-            visitor.visit_impl_item(self.impl_item(id));
-        }
-
-        for id in module.foreign_items() {
-            visitor.visit_foreign_item(self.foreign_item(id));
-        }
+        walk_list!(visitor, visit_item, module.items().map(|id| self.item(id)));
+        walk_list!(visitor, visit_trait_item, module.trait_items().map(|id| self.trait_item(id)));
+        walk_list!(visitor, visit_impl_item, module.impl_items().map(|id| self.impl_item(id)));
+        walk_list!(
+            visitor,
+            visit_foreign_item,
+            module.foreign_items().map(|id| self.foreign_item(id))
+        );
+        V::Result::output()
     }
 
     pub fn for_each_module(self, mut f: impl FnMut(LocalModDefId)) {
diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs
index 2a6f473cd32..1e9e9947db5 100644
--- a/compiler/rustc_middle/src/lint.rs
+++ b/compiler/rustc_middle/src/lint.rs
@@ -2,7 +2,7 @@ use std::cmp;
 
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::sorted_map::SortedMap;
-use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticMessage, MultiSpan};
+use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, MultiSpan};
 use rustc_hir::{HirId, ItemLocalId};
 use rustc_session::lint::{
     builtin::{self, FORBIDDEN_LINT_GROUPS},
@@ -204,7 +204,7 @@ pub fn explain_lint_level_source(
     lint: &'static Lint,
     level: Level,
     src: LintLevelSource,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_, ()>,
 ) {
     let name = lint.name_lower();
     if let Level::Allow = level {
@@ -359,7 +359,7 @@ pub fn lint_level(
         // Lint diagnostics that are covered by the expect level will not be emitted outside
         // the compiler. It is therefore not necessary to add any information for the user.
         // This will therefore directly call the decorate function which will in turn emit
-        // the `Diagnostic`.
+        // the diagnostic.
         if let Level::Expect(_) = level {
             decorate(&mut err);
             err.emit();
@@ -401,7 +401,7 @@ pub fn lint_level(
 
         // Finally, run `decorate`.
         decorate(&mut err);
-        explain_lint_level_source(lint, level, src, &mut *err);
+        explain_lint_level_source(lint, level, src, &mut err);
         err.emit()
     }
     lint_level_impl(sess, lint, level, src, span, msg, Box::new(decorate))
diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs
index 2f624ab0527..5f3ecf34416 100644
--- a/compiler/rustc_middle/src/middle/stability.rs
+++ b/compiler/rustc_middle/src/middle/stability.rs
@@ -9,7 +9,7 @@ use rustc_attr::{
     self as attr, ConstStability, DefaultBodyStability, DeprecatedSince, Deprecation, Stability,
 };
 use rustc_data_structures::unord::UnordMap;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_feature::GateIssue;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{DefId, LocalDefId, LocalDefIdMap};
@@ -125,7 +125,7 @@ pub fn report_unstable(
 }
 
 pub fn deprecation_suggestion(
-    diag: &mut Diagnostic,
+    diag: &mut DiagnosticBuilder<'_, ()>,
     kind: &str,
     suggestion: Option<Symbol>,
     span: Span,
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs
index 119e0a49acf..b3c09d1d152 100644
--- a/compiler/rustc_middle/src/traits/mod.rs
+++ b/compiler/rustc_middle/src/traits/mod.rs
@@ -16,7 +16,7 @@ use crate::ty::GenericArgsRef;
 use crate::ty::{self, AdtKind, Ty};
 
 use rustc_data_structures::sync::Lrc;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder, EmissionGuarantee};
 use rustc_hir as hir;
 use rustc_hir::def_id::DefId;
 use rustc_span::def_id::{LocalDefId, CRATE_DEF_ID};
@@ -908,7 +908,7 @@ pub enum ObjectSafetyViolationSolution {
 }
 
 impl ObjectSafetyViolationSolution {
-    pub fn add_to(self, err: &mut Diagnostic) {
+    pub fn add_to<G: EmissionGuarantee>(self, err: &mut DiagnosticBuilder<'_, G>) {
         match self {
             ObjectSafetyViolationSolution::None => {}
             ObjectSafetyViolationSolution::AddSelfOrMakeSized {
diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs
index 7cb326ce696..f379cf27a5f 100644
--- a/compiler/rustc_middle/src/ty/diagnostics.rs
+++ b/compiler/rustc_middle/src/ty/diagnostics.rs
@@ -11,7 +11,7 @@ use crate::ty::{
 };
 
 use rustc_data_structures::fx::FxHashMap;
-use rustc_errors::{Applicability, Diagnostic, DiagnosticArgValue, IntoDiagnosticArg};
+use rustc_errors::{Applicability, DiagnosticArgValue, DiagnosticBuilder, IntoDiagnosticArg};
 use rustc_hir as hir;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::DefId;
@@ -111,7 +111,7 @@ where
 pub fn suggest_arbitrary_trait_bound<'tcx>(
     tcx: TyCtxt<'tcx>,
     generics: &hir::Generics<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     trait_pred: PolyTraitPredicate<'tcx>,
     associated_ty: Option<(&'static str, Ty<'tcx>)>,
 ) -> bool {
@@ -216,7 +216,7 @@ fn suggest_changing_unsized_bound(
 pub fn suggest_constraining_type_param(
     tcx: TyCtxt<'_>,
     generics: &hir::Generics<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     param_name: &str,
     constraint: &str,
     def_id: Option<DefId>,
@@ -235,7 +235,7 @@ pub fn suggest_constraining_type_param(
 pub fn suggest_constraining_type_params<'a>(
     tcx: TyCtxt<'_>,
     generics: &hir::Generics<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     param_names_and_constraints: impl Iterator<Item = (&'a str, &'a str, Option<DefId>)>,
     span_to_replace: Option<Span>,
 ) -> bool {
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs
index 0bc5fe6ef89..2a42dae289b 100644
--- a/compiler/rustc_mir_build/src/errors.rs
+++ b/compiler/rustc_mir_build/src/errors.rs
@@ -1,7 +1,7 @@
 use crate::fluent_generated as fluent;
 use rustc_errors::DiagnosticArgValue;
 use rustc_errors::{
-    codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
+    codes::*, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee,
     IntoDiagnostic, Level, MultiSpan, SubdiagnosticMessageOp,
 };
 use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
@@ -420,7 +420,11 @@ pub struct UnsafeNotInheritedLintNote {
 }
 
 impl AddToDiagnostic for UnsafeNotInheritedLintNote {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         diag.span_note(self.signature_span, fluent::mir_build_unsafe_fn_safe_body);
         let body_start = self.body_span.shrink_to_lo();
         let body_end = self.body_span.shrink_to_hi();
@@ -863,7 +867,11 @@ pub struct Variant {
 }
 
 impl<'tcx> AddToDiagnostic for AdtDefinedHere<'tcx> {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         diag.arg("ty", self.ty);
         let mut spans = MultiSpan::from(self.adt_def_span);
 
diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs
deleted file mode 100644
index eba62aae60f..00000000000
--- a/compiler/rustc_mir_transform/src/const_prop.rs
+++ /dev/null
@@ -1,161 +0,0 @@
-//! Propagates constants for early reporting of statically known
-//! assertion failures
-
-use rustc_index::bit_set::BitSet;
-use rustc_index::IndexVec;
-use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
-use rustc_middle::mir::*;
-use rustc_middle::ty::{ParamEnv, TyCtxt};
-use rustc_target::abi::Size;
-
-/// The maximum number of bytes that we'll allocate space for a local or the return value.
-/// Needed for #66397, because otherwise we eval into large places and that can cause OOM or just
-/// Severely regress performance.
-const MAX_ALLOC_LIMIT: u64 = 1024;
-
-/// Macro for machine-specific `InterpError` without allocation.
-/// (These will never be shown to the user, but they help diagnose ICEs.)
-pub(crate) macro throw_machine_stop_str($($tt:tt)*) {{
-    // We make a new local type for it. The type itself does not carry any information,
-    // but its vtable (for the `MachineStopType` trait) does.
-    #[derive(Debug)]
-    struct Zst;
-    // Printing this type shows the desired string.
-    impl std::fmt::Display for Zst {
-        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-            write!(f, $($tt)*)
-        }
-    }
-
-    impl rustc_middle::mir::interpret::MachineStopType for Zst {
-        fn diagnostic_message(&self) -> rustc_errors::DiagnosticMessage {
-            self.to_string().into()
-        }
-
-        fn add_args(
-            self: Box<Self>,
-            _: &mut dyn FnMut(rustc_errors::DiagnosticArgName, rustc_errors::DiagnosticArgValue),
-        ) {}
-    }
-    throw_machine_stop!(Zst)
-}}
-
-/// The mode that `ConstProp` is allowed to run in for a given `Local`.
-#[derive(Clone, Copy, Debug, PartialEq)]
-pub enum ConstPropMode {
-    /// The `Local` can be propagated into and reads of this `Local` can also be propagated.
-    FullConstProp,
-    /// The `Local` can only be propagated into and from its own block.
-    OnlyInsideOwnBlock,
-    /// The `Local` cannot be part of propagation at all. Any statement
-    /// referencing it either for reading or writing will not get propagated.
-    NoPropagation,
-}
-
-pub struct CanConstProp {
-    can_const_prop: IndexVec<Local, ConstPropMode>,
-    // False at the beginning. Once set, no more assignments are allowed to that local.
-    found_assignment: BitSet<Local>,
-}
-
-impl CanConstProp {
-    /// Returns true if `local` can be propagated
-    pub fn check<'tcx>(
-        tcx: TyCtxt<'tcx>,
-        param_env: ParamEnv<'tcx>,
-        body: &Body<'tcx>,
-    ) -> IndexVec<Local, ConstPropMode> {
-        let mut cpv = CanConstProp {
-            can_const_prop: IndexVec::from_elem(ConstPropMode::FullConstProp, &body.local_decls),
-            found_assignment: BitSet::new_empty(body.local_decls.len()),
-        };
-        for (local, val) in cpv.can_const_prop.iter_enumerated_mut() {
-            let ty = body.local_decls[local].ty;
-            match tcx.layout_of(param_env.and(ty)) {
-                Ok(layout) if layout.size < Size::from_bytes(MAX_ALLOC_LIMIT) => {}
-                // Either the layout fails to compute, then we can't use this local anyway
-                // or the local is too large, then we don't want to.
-                _ => {
-                    *val = ConstPropMode::NoPropagation;
-                    continue;
-                }
-            }
-        }
-        // Consider that arguments are assigned on entry.
-        for arg in body.args_iter() {
-            cpv.found_assignment.insert(arg);
-        }
-        cpv.visit_body(body);
-        cpv.can_const_prop
-    }
-}
-
-impl<'tcx> Visitor<'tcx> for CanConstProp {
-    fn visit_place(&mut self, place: &Place<'tcx>, mut context: PlaceContext, loc: Location) {
-        use rustc_middle::mir::visit::PlaceContext::*;
-
-        // Dereferencing just read the addess of `place.local`.
-        if place.projection.first() == Some(&PlaceElem::Deref) {
-            context = NonMutatingUse(NonMutatingUseContext::Copy);
-        }
-
-        self.visit_local(place.local, context, loc);
-        self.visit_projection(place.as_ref(), context, loc);
-    }
-
-    fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) {
-        use rustc_middle::mir::visit::PlaceContext::*;
-        match context {
-            // These are just stores, where the storing is not propagatable, but there may be later
-            // mutations of the same local via `Store`
-            | MutatingUse(MutatingUseContext::Call)
-            | MutatingUse(MutatingUseContext::AsmOutput)
-            | MutatingUse(MutatingUseContext::Deinit)
-            // Actual store that can possibly even propagate a value
-            | MutatingUse(MutatingUseContext::Store)
-            | MutatingUse(MutatingUseContext::SetDiscriminant) => {
-                if !self.found_assignment.insert(local) {
-                    match &mut self.can_const_prop[local] {
-                        // If the local can only get propagated in its own block, then we don't have
-                        // to worry about multiple assignments, as we'll nuke the const state at the
-                        // end of the block anyway, and inside the block we overwrite previous
-                        // states as applicable.
-                        ConstPropMode::OnlyInsideOwnBlock => {}
-                        ConstPropMode::NoPropagation => {}
-                        other @ ConstPropMode::FullConstProp => {
-                            trace!(
-                                "local {:?} can't be propagated because of multiple assignments. Previous state: {:?}",
-                                local, other,
-                            );
-                            *other = ConstPropMode::OnlyInsideOwnBlock;
-                        }
-                    }
-                }
-            }
-            // Reading constants is allowed an arbitrary number of times
-            NonMutatingUse(NonMutatingUseContext::Copy)
-            | NonMutatingUse(NonMutatingUseContext::Move)
-            | NonMutatingUse(NonMutatingUseContext::Inspect)
-            | NonMutatingUse(NonMutatingUseContext::PlaceMention)
-            | NonUse(_) => {}
-
-            // These could be propagated with a smarter analysis or just some careful thinking about
-            // whether they'd be fine right now.
-            MutatingUse(MutatingUseContext::Yield)
-            | MutatingUse(MutatingUseContext::Drop)
-            | MutatingUse(MutatingUseContext::Retag)
-            // These can't ever be propagated under any scheme, as we can't reason about indirect
-            // mutation.
-            | NonMutatingUse(NonMutatingUseContext::SharedBorrow)
-            | NonMutatingUse(NonMutatingUseContext::FakeBorrow)
-            | NonMutatingUse(NonMutatingUseContext::AddressOf)
-            | MutatingUse(MutatingUseContext::Borrow)
-            | MutatingUse(MutatingUseContext::AddressOf) => {
-                trace!("local {:?} can't be propagated because it's used: {:?}", local, context);
-                self.can_const_prop[local] = ConstPropMode::NoPropagation;
-            }
-            MutatingUse(MutatingUseContext::Projection)
-            | NonMutatingUse(NonMutatingUseContext::Projection) => bug!("visit_place should not pass {context:?} for {local:?}"),
-        }
-    }
-}
diff --git a/compiler/rustc_mir_transform/src/const_prop_lint.rs b/compiler/rustc_mir_transform/src/const_prop_lint.rs
index 6212155a8fe..6f2ef8f9a4f 100644
--- a/compiler/rustc_mir_transform/src/const_prop_lint.rs
+++ b/compiler/rustc_mir_transform/src/const_prop_lint.rs
@@ -9,17 +9,14 @@ use rustc_const_eval::interpret::{
 use rustc_data_structures::fx::FxHashSet;
 use rustc_hir::def::DefKind;
 use rustc_hir::HirId;
-use rustc_index::bit_set::BitSet;
-use rustc_index::{Idx, IndexVec};
-use rustc_middle::mir::visit::Visitor;
+use rustc_index::{bit_set::BitSet, Idx, IndexVec};
+use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
 use rustc_middle::mir::*;
 use rustc_middle::ty::layout::{LayoutError, LayoutOf, LayoutOfHelpers, TyAndLayout};
 use rustc_middle::ty::{self, ConstInt, ParamEnv, ScalarInt, Ty, TyCtxt, TypeVisitableExt};
 use rustc_span::Span;
 use rustc_target::abi::{Abi, FieldIdx, HasDataLayout, Size, TargetDataLayout, VariantIdx};
 
-use crate::const_prop::CanConstProp;
-use crate::const_prop::ConstPropMode;
 use crate::dataflow_const_prop::DummyMachine;
 use crate::errors::{AssertLint, AssertLintKind};
 use crate::MirLint;
@@ -849,3 +846,128 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
         }
     }
 }
+
+/// The maximum number of bytes that we'll allocate space for a local or the return value.
+/// Needed for #66397, because otherwise we eval into large places and that can cause OOM or just
+/// Severely regress performance.
+const MAX_ALLOC_LIMIT: u64 = 1024;
+
+/// The mode that `ConstProp` is allowed to run in for a given `Local`.
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub enum ConstPropMode {
+    /// The `Local` can be propagated into and reads of this `Local` can also be propagated.
+    FullConstProp,
+    /// The `Local` can only be propagated into and from its own block.
+    OnlyInsideOwnBlock,
+    /// The `Local` cannot be part of propagation at all. Any statement
+    /// referencing it either for reading or writing will not get propagated.
+    NoPropagation,
+}
+
+pub struct CanConstProp {
+    can_const_prop: IndexVec<Local, ConstPropMode>,
+    // False at the beginning. Once set, no more assignments are allowed to that local.
+    found_assignment: BitSet<Local>,
+}
+
+impl CanConstProp {
+    /// Returns true if `local` can be propagated
+    pub fn check<'tcx>(
+        tcx: TyCtxt<'tcx>,
+        param_env: ParamEnv<'tcx>,
+        body: &Body<'tcx>,
+    ) -> IndexVec<Local, ConstPropMode> {
+        let mut cpv = CanConstProp {
+            can_const_prop: IndexVec::from_elem(ConstPropMode::FullConstProp, &body.local_decls),
+            found_assignment: BitSet::new_empty(body.local_decls.len()),
+        };
+        for (local, val) in cpv.can_const_prop.iter_enumerated_mut() {
+            let ty = body.local_decls[local].ty;
+            match tcx.layout_of(param_env.and(ty)) {
+                Ok(layout) if layout.size < Size::from_bytes(MAX_ALLOC_LIMIT) => {}
+                // Either the layout fails to compute, then we can't use this local anyway
+                // or the local is too large, then we don't want to.
+                _ => {
+                    *val = ConstPropMode::NoPropagation;
+                    continue;
+                }
+            }
+        }
+        // Consider that arguments are assigned on entry.
+        for arg in body.args_iter() {
+            cpv.found_assignment.insert(arg);
+        }
+        cpv.visit_body(body);
+        cpv.can_const_prop
+    }
+}
+
+impl<'tcx> Visitor<'tcx> for CanConstProp {
+    fn visit_place(&mut self, place: &Place<'tcx>, mut context: PlaceContext, loc: Location) {
+        use rustc_middle::mir::visit::PlaceContext::*;
+
+        // Dereferencing just read the addess of `place.local`.
+        if place.projection.first() == Some(&PlaceElem::Deref) {
+            context = NonMutatingUse(NonMutatingUseContext::Copy);
+        }
+
+        self.visit_local(place.local, context, loc);
+        self.visit_projection(place.as_ref(), context, loc);
+    }
+
+    fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) {
+        use rustc_middle::mir::visit::PlaceContext::*;
+        match context {
+            // These are just stores, where the storing is not propagatable, but there may be later
+            // mutations of the same local via `Store`
+            | MutatingUse(MutatingUseContext::Call)
+            | MutatingUse(MutatingUseContext::AsmOutput)
+            | MutatingUse(MutatingUseContext::Deinit)
+            // Actual store that can possibly even propagate a value
+            | MutatingUse(MutatingUseContext::Store)
+            | MutatingUse(MutatingUseContext::SetDiscriminant) => {
+                if !self.found_assignment.insert(local) {
+                    match &mut self.can_const_prop[local] {
+                        // If the local can only get propagated in its own block, then we don't have
+                        // to worry about multiple assignments, as we'll nuke the const state at the
+                        // end of the block anyway, and inside the block we overwrite previous
+                        // states as applicable.
+                        ConstPropMode::OnlyInsideOwnBlock => {}
+                        ConstPropMode::NoPropagation => {}
+                        other @ ConstPropMode::FullConstProp => {
+                            trace!(
+                                "local {:?} can't be propagated because of multiple assignments. Previous state: {:?}",
+                                local, other,
+                            );
+                            *other = ConstPropMode::OnlyInsideOwnBlock;
+                        }
+                    }
+                }
+            }
+            // Reading constants is allowed an arbitrary number of times
+            NonMutatingUse(NonMutatingUseContext::Copy)
+            | NonMutatingUse(NonMutatingUseContext::Move)
+            | NonMutatingUse(NonMutatingUseContext::Inspect)
+            | NonMutatingUse(NonMutatingUseContext::PlaceMention)
+            | NonUse(_) => {}
+
+            // These could be propagated with a smarter analysis or just some careful thinking about
+            // whether they'd be fine right now.
+            MutatingUse(MutatingUseContext::Yield)
+            | MutatingUse(MutatingUseContext::Drop)
+            | MutatingUse(MutatingUseContext::Retag)
+            // These can't ever be propagated under any scheme, as we can't reason about indirect
+            // mutation.
+            | NonMutatingUse(NonMutatingUseContext::SharedBorrow)
+            | NonMutatingUse(NonMutatingUseContext::FakeBorrow)
+            | NonMutatingUse(NonMutatingUseContext::AddressOf)
+            | MutatingUse(MutatingUseContext::Borrow)
+            | MutatingUse(MutatingUseContext::AddressOf) => {
+                trace!("local {:?} can't be propagated because it's used: {:?}", local, context);
+                self.can_const_prop[local] = ConstPropMode::NoPropagation;
+            }
+            MutatingUse(MutatingUseContext::Projection)
+            | NonMutatingUse(NonMutatingUseContext::Projection) => bug!("visit_place should not pass {context:?} for {local:?}"),
+        }
+    }
+}
diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
index 86e99a8a5b5..9dc7a50eca9 100644
--- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
+++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
@@ -21,7 +21,32 @@ use rustc_span::def_id::DefId;
 use rustc_span::DUMMY_SP;
 use rustc_target::abi::{Abi, FieldIdx, Size, VariantIdx, FIRST_VARIANT};
 
-use crate::const_prop::throw_machine_stop_str;
+/// Macro for machine-specific `InterpError` without allocation.
+/// (These will never be shown to the user, but they help diagnose ICEs.)
+pub(crate) macro throw_machine_stop_str($($tt:tt)*) {{
+    // We make a new local type for it. The type itself does not carry any information,
+    // but its vtable (for the `MachineStopType` trait) does.
+    #[derive(Debug)]
+    struct Zst;
+    // Printing this type shows the desired string.
+    impl std::fmt::Display for Zst {
+        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+            write!(f, $($tt)*)
+        }
+    }
+
+    impl rustc_middle::mir::interpret::MachineStopType for Zst {
+        fn diagnostic_message(&self) -> rustc_errors::DiagnosticMessage {
+            self.to_string().into()
+        }
+
+        fn add_args(
+            self: Box<Self>,
+            _: &mut dyn FnMut(rustc_errors::DiagnosticArgName, rustc_errors::DiagnosticArgValue),
+        ) {}
+    }
+    throw_machine_stop!(Zst)
+}}
 
 // These constants are somewhat random guesses and have not been optimized.
 // If `tcx.sess.mir_opt_level() >= 4`, we ignore the limits (this can become very expensive).
diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/errors.rs
index ff4918df9a2..af2d7d4946f 100644
--- a/compiler/rustc_mir_transform/src/errors.rs
+++ b/compiler/rustc_mir_transform/src/errors.rs
@@ -87,6 +87,9 @@ pub(crate) struct RequiresUnsafeDetail {
 }
 
 impl RequiresUnsafeDetail {
+    // FIXME: make this translatable
+    #[allow(rustc::diagnostic_outside_of_impl)]
+    #[allow(rustc::untranslatable_diagnostic)]
     fn add_subdiagnostics<G: EmissionGuarantee>(&self, diag: &mut DiagnosticBuilder<'_, G>) {
         use UnsafetyViolationDetails::*;
         match self.violation {
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index 7f0e6f90dbb..74b36eb5ee8 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -59,7 +59,6 @@ mod remove_place_mention;
 mod add_subtyping_projections;
 pub mod cleanup_post_borrowck;
 mod const_debuginfo;
-mod const_prop;
 mod const_prop_lint;
 mod copy_prop;
 mod coroutine;
diff --git a/compiler/rustc_monomorphize/src/errors.rs b/compiler/rustc_monomorphize/src/errors.rs
index bd89874b5cc..e4c30679146 100644
--- a/compiler/rustc_monomorphize/src/errors.rs
+++ b/compiler/rustc_monomorphize/src/errors.rs
@@ -56,6 +56,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for UnusedGenericParamsHint {
             // FIXME: I can figure out how to do a label with a fluent string with a fixed message,
             // or a label with a dynamic value in a hard-coded string, but I haven't figured out
             // how to combine the two. 😢
+            #[allow(rustc::untranslatable_diagnostic)]
             diag.span_label(span, format!("generic parameter `{name}` is unused"));
         }
         diag
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs
index 674f7218ea6..fde67ac089a 100644
--- a/compiler/rustc_parse/src/errors.rs
+++ b/compiler/rustc_parse/src/errors.rs
@@ -3,7 +3,7 @@ use std::borrow::Cow;
 use rustc_ast::token::Token;
 use rustc_ast::{Path, Visibility};
 use rustc_errors::{
-    codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
+    codes::*, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee,
     IntoDiagnostic, Level, SubdiagnosticMessageOp,
 };
 use rustc_macros::{Diagnostic, Subdiagnostic};
@@ -1475,7 +1475,11 @@ pub(crate) struct FnTraitMissingParen {
 }
 
 impl AddToDiagnostic for FnTraitMissingParen {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _: F,
+    ) {
         diag.span_label(self.span, crate::fluent_generated::parse_fn_trait_missing_paren);
         let applicability = if self.machine_applicable {
             Applicability::MachineApplicable
diff --git a/compiler/rustc_parse/src/lexer/diagnostics.rs b/compiler/rustc_parse/src/lexer/diagnostics.rs
index b1bd4ac75e5..52a029b20f6 100644
--- a/compiler/rustc_parse/src/lexer/diagnostics.rs
+++ b/compiler/rustc_parse/src/lexer/diagnostics.rs
@@ -1,6 +1,6 @@
 use super::UnmatchedDelim;
 use rustc_ast::token::Delimiter;
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_span::source_map::SourceMap;
 use rustc_span::Span;
 
@@ -31,7 +31,7 @@ pub fn same_indentation_level(sm: &SourceMap, open_sp: Span, close_sp: Span) ->
 // When we get a `)` or `]` for `{`, we should emit help message here
 // it's more friendly compared to report `unmatched error` in later phase
 pub fn report_missing_open_delim(
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     unmatched_delims: &[UnmatchedDelim],
 ) -> bool {
     let mut reported_missing_open = false;
@@ -55,7 +55,7 @@ pub fn report_missing_open_delim(
 }
 
 pub fn report_suspicious_mismatch_block(
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     diag_info: &TokenTreeDiagInfo,
     sm: &SourceMap,
     delim: Delimiter,
diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs
index 98e062dd784..6545429b95b 100644
--- a/compiler/rustc_parse/src/parser/attr.rs
+++ b/compiler/rustc_parse/src/parser/attr.rs
@@ -8,7 +8,7 @@ use super::{AttrWrapper, Capturing, FnParseMode, ForceCollect, Parser, PathStyle
 use rustc_ast as ast;
 use rustc_ast::attr;
 use rustc_ast::token::{self, Delimiter, Nonterminal};
-use rustc_errors::{codes::*, Diagnostic, PResult};
+use rustc_errors::{codes::*, DiagnosticBuilder, PResult};
 use rustc_span::{sym, BytePos, Span};
 use thin_vec::ThinVec;
 use tracing::debug;
@@ -141,7 +141,7 @@ impl<'a> Parser<'a> {
 
     fn annotate_following_item_if_applicable(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         attr_type: OuterAttributeType,
     ) -> Option<Span> {
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index 659716548d9..0cc2170714c 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -34,8 +34,8 @@ use rustc_ast::{
 use rustc_ast_pretty::pprust;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::{
-    pluralize, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
-    ErrorGuaranteed, FatalError, PErr, PResult,
+    pluralize, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, ErrorGuaranteed,
+    FatalError, PErr, PResult,
 };
 use rustc_session::errors::ExprParenthesesNeeded;
 use rustc_span::source_map::Spanned;
@@ -208,11 +208,11 @@ struct MultiSugg {
 }
 
 impl MultiSugg {
-    fn emit(self, err: &mut Diagnostic) {
+    fn emit(self, err: &mut DiagnosticBuilder<'_>) {
         err.multipart_suggestion(self.msg, self.patches, self.applicability);
     }
 
-    fn emit_verbose(self, err: &mut Diagnostic) {
+    fn emit_verbose(self, err: &mut DiagnosticBuilder<'_>) {
         err.multipart_suggestion_verbose(self.msg, self.patches, self.applicability);
     }
 }
@@ -846,7 +846,7 @@ impl<'a> Parser<'a> {
         err.emit();
     }
 
-    fn check_too_many_raw_str_terminators(&mut self, err: &mut Diagnostic) -> bool {
+    fn check_too_many_raw_str_terminators(&mut self, err: &mut DiagnosticBuilder<'_>) -> bool {
         let sm = self.sess.source_map();
         match (&self.prev_token.kind, &self.token.kind) {
             (
@@ -2179,7 +2179,7 @@ impl<'a> Parser<'a> {
 
     pub(super) fn parameter_without_type(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         pat: P<ast::Pat>,
         require_name: bool,
         first_param: bool,
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 20b9581f2ef..8826c06bebd 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -25,9 +25,7 @@ use rustc_ast::{Arm, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLim
 use rustc_ast::{ClosureBinder, MetaItemLit, StmtKind};
 use rustc_ast_pretty::pprust;
 use rustc_data_structures::stack::ensure_sufficient_stack;
-use rustc_errors::{
-    AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, PResult, StashKey,
-};
+use rustc_errors::{AddToDiagnostic, Applicability, DiagnosticBuilder, PResult, StashKey};
 use rustc_lexer::unescape::unescape_char;
 use rustc_macros::Subdiagnostic;
 use rustc_session::errors::{report_lit_error, ExprParenthesesNeeded};
@@ -865,7 +863,7 @@ impl<'a> Parser<'a> {
             );
             let mut err = self.dcx().struct_span_err(span, msg);
 
-            let suggest_parens = |err: &mut Diagnostic| {
+            let suggest_parens = |err: &mut DiagnosticBuilder<'_>| {
                 let suggestions = vec![
                     (span.shrink_to_lo(), "(".to_string()),
                     (span.shrink_to_hi(), ")".to_string()),
@@ -3437,7 +3435,7 @@ impl<'a> Parser<'a> {
         let mut recover_async = false;
         let in_if_guard = self.restrictions.contains(Restrictions::IN_IF_GUARD);
 
-        let mut async_block_err = |e: &mut Diagnostic, span: Span| {
+        let mut async_block_err = |e: &mut DiagnosticBuilder<'_>, span: Span| {
             recover_async = true;
             errors::AsyncBlockIn2015 { span }.add_to_diagnostic(e);
             errors::HelpUseLatestEdition::new().add_to_diagnostic(e);
diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs
index 3676eb92a3f..02792491f5e 100644
--- a/compiler/rustc_passes/src/check_const.rs
+++ b/compiler/rustc_passes/src/check_const.rs
@@ -156,9 +156,12 @@ impl<'tcx> CheckConstVisitor<'tcx> {
                 // is a pretty narrow case, however.
                 if tcx.sess.is_nightly_build() {
                     for gate in missing_secondary {
-                        let note =
-                            format!("add `#![feature({gate})]` to the crate attributes to enable",);
-                        err.help(note);
+                        // FIXME: make this translatable
+                        #[allow(rustc::diagnostic_outside_of_impl)]
+                        #[allow(rustc::untranslatable_diagnostic)]
+                        err.help(format!(
+                            "add `#![feature({gate})]` to the crate attributes to enable"
+                        ));
                     }
                 }
 
diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs
index a732bdbca51..982def54d30 100644
--- a/compiler/rustc_passes/src/errors.rs
+++ b/compiler/rustc_passes/src/errors.rs
@@ -6,9 +6,8 @@ use std::{
 use crate::fluent_generated as fluent;
 use rustc_ast::Label;
 use rustc_errors::{
-    codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
-    DiagnosticSymbolList, EmissionGuarantee, IntoDiagnostic, Level, MultiSpan,
-    SubdiagnosticMessageOp,
+    codes::*, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, DiagnosticSymbolList,
+    EmissionGuarantee, IntoDiagnostic, Level, MultiSpan, SubdiagnosticMessageOp,
 };
 use rustc_hir::{self as hir, ExprKind, Target};
 use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
@@ -1754,7 +1753,11 @@ pub struct UnusedVariableStringInterp {
 }
 
 impl AddToDiagnostic for UnusedVariableStringInterp {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         diag.span_label(self.lit, crate::fluent_generated::passes_maybe_string_interpolation);
         diag.multipart_suggestion(
             crate::fluent_generated::passes_string_interpolation_only_works,
diff --git a/compiler/rustc_pattern_analysis/src/errors.rs b/compiler/rustc_pattern_analysis/src/errors.rs
index 2dffdc9846c..27619b74a66 100644
--- a/compiler/rustc_pattern_analysis/src/errors.rs
+++ b/compiler/rustc_pattern_analysis/src/errors.rs
@@ -1,4 +1,4 @@
-use rustc_errors::{AddToDiagnostic, Diagnostic, SubdiagnosticMessageOp};
+use rustc_errors::{AddToDiagnostic, DiagnosticBuilder, EmissionGuarantee, SubdiagnosticMessageOp};
 use rustc_macros::{LintDiagnostic, Subdiagnostic};
 use rustc_middle::thir::Pat;
 use rustc_middle::ty::Ty;
@@ -62,7 +62,11 @@ pub struct Overlap<'tcx> {
 }
 
 impl<'tcx> AddToDiagnostic for Overlap<'tcx> {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _: F,
+    ) {
         let Overlap { span, range } = self;
 
         // FIXME(mejrs) unfortunately `#[derive(LintDiagnostic)]`
diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs
index d35b0248e41..a24da448766 100644
--- a/compiler/rustc_pattern_analysis/src/usefulness.rs
+++ b/compiler/rustc_pattern_analysis/src/usefulness.rs
@@ -760,9 +760,6 @@ impl<'a, Cx: TypeCx> PlaceCtxt<'a, Cx> {
     fn ctor_arity(&self, ctor: &Constructor<Cx>) -> usize {
         self.cx.ctor_arity(ctor, self.ty)
     }
-    fn ctors_for_ty(&self) -> Result<ConstructorSet<Cx>, Cx::Error> {
-        self.cx.ctors_for_ty(self.ty)
-    }
     fn wild_from_ctor(&self, ctor: Constructor<Cx>) -> WitnessPat<Cx> {
         WitnessPat::wild_from_ctor(self.cx, ctor, self.ty.clone())
     }
@@ -815,7 +812,8 @@ impl fmt::Display for ValidityConstraint {
     }
 }
 
-/// Data about a place under investigation.
+/// Data about a place under investigation. Its methods contain a lot of the logic used to analyze
+/// the constructors in the matrix.
 struct PlaceInfo<Cx: TypeCx> {
     /// The type of the place.
     ty: Cx::Ty,
@@ -826,6 +824,8 @@ struct PlaceInfo<Cx: TypeCx> {
 }
 
 impl<Cx: TypeCx> PlaceInfo<Cx> {
+    /// Given a constructor for the current place, we return one `PlaceInfo` for each field of the
+    /// constructor.
     fn specialize<'a>(
         &'a self,
         cx: &'a Cx,
@@ -839,6 +839,77 @@ impl<Cx: TypeCx> PlaceInfo<Cx> {
             is_scrutinee: false,
         })
     }
+
+    /// This analyzes a column of constructors corresponding to the current place. It returns a pair
+    /// `(split_ctors, missing_ctors)`.
+    ///
+    /// `split_ctors` is a splitted list of constructors that cover the whole type. This will be
+    /// used to specialize the matrix.
+    ///
+    /// `missing_ctors` is a list of the constructors not found in the column, for reporting
+    /// purposes.
+    fn split_column_ctors<'a>(
+        &self,
+        cx: &Cx,
+        ctors: impl Iterator<Item = &'a Constructor<Cx>> + Clone,
+    ) -> Result<(SmallVec<[Constructor<Cx>; 1]>, Vec<Constructor<Cx>>), Cx::Error>
+    where
+        Cx: 'a,
+    {
+        let ctors_for_ty = cx.ctors_for_ty(&self.ty)?;
+
+        // We treat match scrutinees of type `!` or `EmptyEnum` differently.
+        let is_toplevel_exception =
+            self.is_scrutinee && matches!(ctors_for_ty, ConstructorSet::NoConstructors);
+        // Whether empty patterns are counted as useful or not. We only warn an empty arm unreachable if
+        // it is guaranteed unreachable by the opsem (i.e. if the place is `known_valid`).
+        let empty_arms_are_unreachable = self.validity.is_known_valid()
+            && (is_toplevel_exception
+                || cx.is_exhaustive_patterns_feature_on()
+                || cx.is_min_exhaustive_patterns_feature_on());
+        // Whether empty patterns can be omitted for exhaustiveness. We ignore place validity in the
+        // toplevel exception and `exhaustive_patterns` cases for backwards compatibility.
+        let can_omit_empty_arms = empty_arms_are_unreachable
+            || is_toplevel_exception
+            || cx.is_exhaustive_patterns_feature_on();
+
+        // Analyze the constructors present in this column.
+        let mut split_set = ctors_for_ty.split(ctors);
+        let all_missing = split_set.present.is_empty();
+
+        // Build the set of constructors we will specialize with. It must cover the whole type, so
+        // we add `Missing` to represent the missing ones. This is explained under "Constructor
+        // Splitting" at the top of this file.
+        let mut split_ctors = split_set.present;
+        if !(split_set.missing.is_empty()
+            && (split_set.missing_empty.is_empty() || empty_arms_are_unreachable))
+        {
+            split_ctors.push(Constructor::Missing);
+        }
+
+        // Which empty constructors are considered missing. We ensure that
+        // `!missing_ctors.is_empty() => split_ctors.contains(Missing)`. The converse usually holds
+        // except when `!self.validity.is_known_valid()`.
+        let mut missing_ctors = split_set.missing;
+        if !can_omit_empty_arms {
+            missing_ctors.append(&mut split_set.missing_empty);
+        }
+
+        // Whether we should report "Enum::A and Enum::C are missing" or "_ is missing". At the top
+        // level we prefer to list all constructors.
+        let report_individual_missing_ctors = self.is_scrutinee || !all_missing;
+        if !missing_ctors.is_empty() && !report_individual_missing_ctors {
+            // Report `_` as missing.
+            missing_ctors = vec![Constructor::Wildcard];
+        } else if missing_ctors.iter().any(|c| c.is_non_exhaustive()) {
+            // We need to report a `_` anyway, so listing other constructors would be redundant.
+            // `NonExhaustive` is displayed as `_` just like `Wildcard`, but it will be picked
+            // up by diagnostics to add a note about why `_` is required here.
+            missing_ctors = vec![Constructor::NonExhaustive];
+        }
+
+        Ok((split_ctors, missing_ctors))
+    }
 }
 
 impl<Cx: TypeCx> Clone for PlaceInfo<Cx> {
@@ -1314,40 +1385,23 @@ impl<Cx: TypeCx> WitnessMatrix<Cx> {
         pcx: &PlaceCtxt<'_, Cx>,
         missing_ctors: &[Constructor<Cx>],
         ctor: &Constructor<Cx>,
-        report_individual_missing_ctors: bool,
     ) {
         if self.is_empty() {
             return;
         }
         if matches!(ctor, Constructor::Missing) {
             // We got the special `Missing` constructor that stands for the constructors not present
-            // in the match.
-            if missing_ctors.is_empty() {
-                // Nothing to report.
-                *self = Self::empty();
-            } else if !report_individual_missing_ctors {
-                // Report `_` as missing.
-                let pat = pcx.wild_from_ctor(Constructor::Wildcard);
-                self.push_pattern(pat);
-            } else if missing_ctors.iter().any(|c| c.is_non_exhaustive()) {
-                // We need to report a `_` anyway, so listing other constructors would be redundant.
-                // `NonExhaustive` is displayed as `_` just like `Wildcard`, but it will be picked
-                // up by diagnostics to add a note about why `_` is required here.
-                let pat = pcx.wild_from_ctor(Constructor::NonExhaustive);
-                self.push_pattern(pat);
-            } else {
-                // For each missing constructor `c`, we add a `c(_, _, _)` witness appropriately
-                // filled with wildcards.
-                let mut ret = Self::empty();
-                for ctor in missing_ctors {
-                    let pat = pcx.wild_from_ctor(ctor.clone());
-                    // Clone `self` and add `c(_, _, _)` to each of its witnesses.
-                    let mut wit_matrix = self.clone();
-                    wit_matrix.push_pattern(pat);
-                    ret.extend(wit_matrix);
-                }
-                *self = ret;
+            // in the match. For each missing constructor `c`, we add a `c(_, _, _)` witness
+            // appropriately filled with wildcards.
+            let mut ret = Self::empty();
+            for ctor in missing_ctors {
+                let pat = pcx.wild_from_ctor(ctor.clone());
+                // Clone `self` and add `c(_, _, _)` to each of its witnesses.
+                let mut wit_matrix = self.clone();
+                wit_matrix.push_pattern(pat);
+                ret.extend(wit_matrix);
             }
+            *self = ret;
         } else {
             // Any other constructor we unspecialize as expected.
             for witness in self.0.iter_mut() {
@@ -1479,51 +1533,13 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
         };
     };
 
-    let ty = &place.ty.clone(); // Clone it out so we can mutate `matrix` later.
-    let pcx = &PlaceCtxt { cx: mcx.tycx, ty };
-    debug!("ty: {:?}", pcx.ty);
-    let ctors_for_ty = pcx.ctors_for_ty()?;
-
-    // We treat match scrutinees of type `!` or `EmptyEnum` differently.
-    let is_toplevel_exception =
-        place.is_scrutinee && matches!(ctors_for_ty, ConstructorSet::NoConstructors);
-    // Whether empty patterns are counted as useful or not. We only warn an empty arm unreachable if
-    // it is guaranteed unreachable by the opsem (i.e. if the place is `known_valid`).
-    let empty_arms_are_unreachable = place.validity.is_known_valid()
-        && (is_toplevel_exception
-            || mcx.tycx.is_exhaustive_patterns_feature_on()
-            || mcx.tycx.is_min_exhaustive_patterns_feature_on());
-    // Whether empty patterns can be omitted for exhaustiveness. We ignore place validity in the
-    // toplevel exception and `exhaustive_patterns` cases for backwards compatibility.
-    let can_omit_empty_arms = empty_arms_are_unreachable
-        || is_toplevel_exception
-        || mcx.tycx.is_exhaustive_patterns_feature_on();
-
     // Analyze the constructors present in this column.
+    debug!("ty: {:?}", place.ty);
     let ctors = matrix.heads().map(|p| p.ctor());
-    let mut split_set = ctors_for_ty.split(ctors);
-    let all_missing = split_set.present.is_empty();
-    // Build the set of constructors we will specialize with. It must cover the whole type.
-    // We need to iterate over a full set of constructors, so we add `Missing` to represent the
-    // missing ones. This is explained under "Constructor Splitting" at the top of this file.
-    let mut split_ctors = split_set.present;
-    if !(split_set.missing.is_empty()
-        && (split_set.missing_empty.is_empty() || empty_arms_are_unreachable))
-    {
-        split_ctors.push(Constructor::Missing);
-    }
-
-    // Whether we should report "Enum::A and Enum::C are missing" or "_ is missing". At the top
-    // level we prefer to list all constructors.
-    let report_individual_missing_ctors = place.is_scrutinee || !all_missing;
-    // Which constructors are considered missing. We ensure that `!missing_ctors.is_empty() =>
-    // split_ctors.contains(Missing)`. The converse usually holds except when
-    // `!place_validity.is_known_valid()`.
-    let mut missing_ctors = split_set.missing;
-    if !can_omit_empty_arms {
-        missing_ctors.append(&mut split_set.missing_empty);
-    }
+    let (split_ctors, missing_ctors) = place.split_column_ctors(mcx.tycx, ctors)?;
 
+    let ty = &place.ty.clone(); // Clone it out so we can mutate `matrix` later.
+    let pcx = &PlaceCtxt { cx: mcx.tycx, ty };
     let mut ret = WitnessMatrix::empty();
     for ctor in split_ctors {
         // Dig into rows that match `ctor`.
@@ -1538,7 +1554,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
         })?;
 
         // Transform witnesses for `spec_matrix` into witnesses for `matrix`.
-        witnesses.apply_constructor(pcx, &missing_ctors, &ctor, report_individual_missing_ctors);
+        witnesses.apply_constructor(pcx, &missing_ctors, &ctor);
         // Accumulate the found witnesses.
         ret.extend(witnesses);
 
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 4b978fefa10..d64a3b43aad 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -7,7 +7,7 @@ use rustc_ast_pretty::pprust;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::{
     codes::*, pluralize, report_ambiguity_error, struct_span_code_err, Applicability, DiagCtxt,
-    Diagnostic, DiagnosticBuilder, ErrorGuaranteed, MultiSpan, SuggestionStyle,
+    DiagnosticBuilder, ErrorGuaranteed, MultiSpan, SuggestionStyle,
 };
 use rustc_feature::BUILTIN_ATTRIBUTES;
 use rustc_hir::def::Namespace::{self, *};
@@ -360,7 +360,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
     /// ```
     fn add_suggestion_for_rename_of_use(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         name: Symbol,
         import: Import<'_>,
         binding_span: Span,
@@ -436,7 +436,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
     /// as characters expected by span manipulations won't be present.
     fn add_suggestion_for_duplicate_nested_use(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         import: Import<'_>,
         binding_span: Span,
     ) {
@@ -1399,7 +1399,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
 
     pub(crate) fn unresolved_macro_suggestions(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         macro_kind: MacroKind,
         parent_scope: &ParentScope<'a>,
         ident: Ident,
@@ -1515,7 +1515,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
 
     pub(crate) fn add_typo_suggestion(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         suggestion: Option<TypoSuggestion>,
         span: Span,
     ) -> bool {
@@ -2461,7 +2461,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
     /// Finds a cfg-ed out item inside `module` with the matching name.
     pub(crate) fn find_cfg_stripped(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         segment: &Symbol,
         module: DefId,
     ) {
@@ -2670,7 +2670,7 @@ pub(crate) enum DiagnosticMode {
 
 pub(crate) fn import_candidates(
     tcx: TyCtxt<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     // This is `None` if all placement locations are inside expansions
     use_placement_span: Option<Span>,
     candidates: &[ImportSuggestion],
@@ -2696,7 +2696,7 @@ pub(crate) fn import_candidates(
 /// found and suggested, returns `true`, otherwise returns `false`.
 fn show_candidates(
     tcx: TyCtxt<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
     // This is `None` if all placement locations are inside expansions
     use_placement_span: Option<Span>,
     candidates: &[ImportSuggestion],
diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs
index f71f7ccecab..335bf0949d6 100644
--- a/compiler/rustc_resolve/src/late/diagnostics.rs
+++ b/compiler/rustc_resolve/src/late/diagnostics.rs
@@ -1,3 +1,5 @@
+// ignore-tidy-filelength
+
 use crate::diagnostics::{ImportSuggestion, LabelSuggestion, TypoSuggestion};
 use crate::late::{AliasPossibility, LateResolutionVisitor, RibKind};
 use crate::late::{LifetimeBinderKind, LifetimeRes, LifetimeRibKind, LifetimeUseSet};
@@ -16,8 +18,8 @@ use rustc_ast::{
 use rustc_ast_pretty::pprust::where_bound_predicate_to_string;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::{
-    codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
-    ErrorGuaranteed, MultiSpan, SuggestionStyle,
+    codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
+    MultiSpan, SuggestionStyle,
 };
 use rustc_hir as hir;
 use rustc_hir::def::{self, CtorKind, CtorOf, DefKind};
@@ -496,7 +498,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn detect_assoc_type_constraint_meant_as_path(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         base_error: &BaseError,
     ) {
         let Some(ty) = self.diagnostic_metadata.current_type_path else {
@@ -537,7 +539,12 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
         }
     }
 
-    fn suggest_self_or_self_ref(&mut self, err: &mut Diagnostic, path: &[Segment], span: Span) {
+    fn suggest_self_or_self_ref(
+        &mut self,
+        err: &mut DiagnosticBuilder<'_>,
+        path: &[Segment],
+        span: Span,
+    ) {
         if !self.self_type_is_available() {
             return;
         }
@@ -582,7 +589,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn try_lookup_name_relaxed(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         path: &[Segment],
         following_seg: Option<&Segment>,
@@ -786,7 +793,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_trait_and_bounds(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         res: Option<Res>,
         span: Span,
@@ -863,7 +870,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_typo(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         path: &[Segment],
         following_seg: Option<&Segment>,
@@ -903,7 +910,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_shadowed(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         path: &[Segment],
         following_seg: Option<&Segment>,
@@ -936,7 +943,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn err_code_special_cases(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         path: &[Segment],
         span: Span,
@@ -981,7 +988,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
     /// Emit special messages for unresolved `Self` and `self`.
     fn suggest_self_ty(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         path: &[Segment],
         span: Span,
@@ -1008,7 +1015,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_self_value(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         path: &[Segment],
         span: Span,
@@ -1090,7 +1097,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_at_operator_in_slice_pat_with_range(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         path: &[Segment],
     ) {
         let Some(pat) = self.diagnostic_metadata.current_pat else { return };
@@ -1129,7 +1136,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_swapping_misplaced_self_ty_and_trait(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         res: Option<Res>,
         span: Span,
@@ -1155,7 +1162,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
         }
     }
 
-    fn suggest_bare_struct_literal(&mut self, err: &mut Diagnostic) {
+    fn suggest_bare_struct_literal(&mut self, err: &mut DiagnosticBuilder<'_>) {
         if let Some(span) = self.diagnostic_metadata.current_block_could_be_bare_struct_literal {
             err.multipart_suggestion(
                 "you might have meant to write a `struct` literal",
@@ -1170,7 +1177,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_changing_type_to_const_param(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         res: Option<Res>,
         source: PathSource<'_>,
         span: Span,
@@ -1222,7 +1229,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_pattern_match_with_let(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         span: Span,
     ) -> bool {
@@ -1277,7 +1284,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
     }
 
     /// Given `where <T as Bar>::Baz: String`, suggest `where T: Bar<Baz = String>`.
-    fn restrict_assoc_type_in_where_clause(&mut self, span: Span, err: &mut Diagnostic) -> bool {
+    fn restrict_assoc_type_in_where_clause(
+        &mut self,
+        span: Span,
+        err: &mut DiagnosticBuilder<'_>,
+    ) -> bool {
         // Detect that we are actually in a `where` predicate.
         let (bounded_ty, bounds, where_span) =
             if let Some(ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate {
@@ -1410,7 +1421,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
     /// Returns `true` if able to provide context-dependent help.
     fn smart_resolve_context_dependent_help(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         source: PathSource<'_>,
         path: &[Segment],
@@ -1421,50 +1432,52 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
         let ns = source.namespace();
         let is_expected = &|res| source.is_expected(res);
 
-        let path_sep = |this: &mut Self, err: &mut Diagnostic, expr: &Expr, kind: DefKind| {
-            const MESSAGE: &str = "use the path separator to refer to an item";
+        let path_sep =
+            |this: &mut Self, err: &mut DiagnosticBuilder<'_>, expr: &Expr, kind: DefKind| {
+                const MESSAGE: &str = "use the path separator to refer to an item";
 
-            let (lhs_span, rhs_span) = match &expr.kind {
-                ExprKind::Field(base, ident) => (base.span, ident.span),
-                ExprKind::MethodCall(box MethodCall { receiver, span, .. }) => {
-                    (receiver.span, *span)
-                }
-                _ => return false,
-            };
+                let (lhs_span, rhs_span) = match &expr.kind {
+                    ExprKind::Field(base, ident) => (base.span, ident.span),
+                    ExprKind::MethodCall(box MethodCall { receiver, span, .. }) => {
+                        (receiver.span, *span)
+                    }
+                    _ => return false,
+                };
 
-            if lhs_span.eq_ctxt(rhs_span) {
-                err.span_suggestion(
-                    lhs_span.between(rhs_span),
-                    MESSAGE,
-                    "::",
-                    Applicability::MaybeIncorrect,
-                );
-                true
-            } else if kind == DefKind::Struct
-                && let Some(lhs_source_span) = lhs_span.find_ancestor_inside(expr.span)
-                && let Ok(snippet) = this.r.tcx.sess.source_map().span_to_snippet(lhs_source_span)
-            {
-                // The LHS is a type that originates from a macro call.
-                // We have to add angle brackets around it.
+                if lhs_span.eq_ctxt(rhs_span) {
+                    err.span_suggestion(
+                        lhs_span.between(rhs_span),
+                        MESSAGE,
+                        "::",
+                        Applicability::MaybeIncorrect,
+                    );
+                    true
+                } else if kind == DefKind::Struct
+                    && let Some(lhs_source_span) = lhs_span.find_ancestor_inside(expr.span)
+                    && let Ok(snippet) =
+                        this.r.tcx.sess.source_map().span_to_snippet(lhs_source_span)
+                {
+                    // The LHS is a type that originates from a macro call.
+                    // We have to add angle brackets around it.
 
-                err.span_suggestion_verbose(
-                    lhs_source_span.until(rhs_span),
-                    MESSAGE,
-                    format!("<{snippet}>::"),
-                    Applicability::MaybeIncorrect,
-                );
-                true
-            } else {
-                // Either we were unable to obtain the source span / the snippet or
-                // the LHS originates from a macro call and it is not a type and thus
-                // there is no way to replace `.` with `::` and still somehow suggest
-                // valid Rust code.
+                    err.span_suggestion_verbose(
+                        lhs_source_span.until(rhs_span),
+                        MESSAGE,
+                        format!("<{snippet}>::"),
+                        Applicability::MaybeIncorrect,
+                    );
+                    true
+                } else {
+                    // Either we were unable to obtain the source span / the snippet or
+                    // the LHS originates from a macro call and it is not a type and thus
+                    // there is no way to replace `.` with `::` and still somehow suggest
+                    // valid Rust code.
 
-                false
-            }
-        };
+                    false
+                }
+            };
 
-        let find_span = |source: &PathSource<'_>, err: &mut Diagnostic| {
+        let find_span = |source: &PathSource<'_>, err: &mut DiagnosticBuilder<'_>| {
             match source {
                 PathSource::Expr(Some(Expr { span, kind: ExprKind::Call(_, _), .. }))
                 | PathSource::TupleStruct(span, _) => {
@@ -1820,7 +1833,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
     fn suggest_alternative_construction_methods(
         &mut self,
         def_id: DefId,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         path_span: Span,
         call_span: Span,
         args: &[P<Expr>],
@@ -2250,7 +2263,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     // try to give a suggestion for this pattern: `name = blah`, which is common in other languages
     // suggest `let name = blah` to introduce a new binding
-    fn let_binding_suggestion(&mut self, err: &mut Diagnostic, ident_span: Span) -> bool {
+    fn let_binding_suggestion(
+        &mut self,
+        err: &mut DiagnosticBuilder<'_>,
+        ident_span: Span,
+    ) -> bool {
         if let Some(Expr { kind: ExprKind::Assign(lhs, ..), .. }) =
             self.diagnostic_metadata.in_assignment
             && let ast::ExprKind::Path(None, ref path) = lhs.kind
@@ -2351,7 +2368,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
     /// Adds a suggestion for using an enum's variant when an enum is used instead.
     fn suggest_using_enum_variant(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         source: PathSource<'_>,
         def_id: DefId,
         span: Span,
@@ -2727,9 +2744,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn suggest_introducing_lifetime(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         name: Option<&str>,
-        suggest: impl Fn(&mut Diagnostic, bool, Span, Cow<'static, str>, String) -> bool,
+        suggest: impl Fn(&mut DiagnosticBuilder<'_>, bool, Span, Cow<'static, str>, String) -> bool,
     ) {
         let mut suggest_note = true;
         for rib in self.lifetime_ribs.iter().rev() {
@@ -2887,7 +2904,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
 
     fn add_missing_lifetime_specifiers_label(
         &mut self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         lifetime_refs: Vec<MissingLifetime>,
         function_param_lifetimes: Option<(Vec<MissingLifetime>, Vec<ElisionFnParameter>)>,
     ) {
diff --git a/compiler/rustc_session/Cargo.toml b/compiler/rustc_session/Cargo.toml
index ba8f67982f5..721a9275d01 100644
--- a/compiler/rustc_session/Cargo.toml
+++ b/compiler/rustc_session/Cargo.toml
@@ -30,7 +30,7 @@ libc = "0.2"
 # tidy-alphabetical-end
 
 [target.'cfg(windows)'.dependencies.windows]
-version = "0.48.0"
+version = "0.52.0"
 features = [
     "Win32_Foundation",
     "Win32_System_LibraryLoader",
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index ef0512bf686..0a330da87b0 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -2468,6 +2468,9 @@ pub fn parse_externs(
             ));
             let adjusted_name = name.replace('-', "_");
             if is_ascii_ident(&adjusted_name) {
+                // FIXME: make this translatable
+                #[allow(rustc::diagnostic_outside_of_impl)]
+                #[allow(rustc::untranslatable_diagnostic)]
                 error.help(format!(
                     "consider replacing the dashes with underscores: `{adjusted_name}`"
                 ));
diff --git a/compiler/rustc_session/src/filesearch.rs b/compiler/rustc_session/src/filesearch.rs
index 6e459ac45d3..2456b4b3a15 100644
--- a/compiler/rustc_session/src/filesearch.rs
+++ b/compiler/rustc_session/src/filesearch.rs
@@ -143,7 +143,6 @@ fn current_dll_path() -> Result<PathBuf, String> {
             &mut module,
         )
     }
-    .ok()
     .map_err(|e| e.to_string())?;
 
     let mut filename = vec![0; 1024];
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs
index 701c5bf375f..b011ca4dd50 100644
--- a/compiler/rustc_session/src/parse.rs
+++ b/compiler/rustc_session/src/parse.rs
@@ -15,7 +15,8 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
 use rustc_data_structures::sync::{AppendOnlyVec, Lock, Lrc};
 use rustc_errors::{emitter::SilentEmitter, DiagCtxt};
 use rustc_errors::{
-    fallback_fluent_bundle, Diagnostic, DiagnosticBuilder, DiagnosticMessage, MultiSpan, StashKey,
+    fallback_fluent_bundle, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, MultiSpan,
+    StashKey,
 };
 use rustc_feature::{find_feature_issue, GateIssue, UnstableFeatures};
 use rustc_span::edition::Edition;
@@ -156,7 +157,11 @@ pub fn feature_warn_issue(
 }
 
 /// Adds the diagnostics for a feature to an existing error.
-pub fn add_feature_diagnostics(err: &mut Diagnostic, sess: &Session, feature: Symbol) {
+pub fn add_feature_diagnostics<G: EmissionGuarantee>(
+    err: &mut DiagnosticBuilder<'_, G>,
+    sess: &Session,
+    feature: Symbol,
+) {
     add_feature_diagnostics_for_issue(err, sess, feature, GateIssue::Language, false);
 }
 
@@ -165,8 +170,8 @@ pub fn add_feature_diagnostics(err: &mut Diagnostic, sess: &Session, feature: Sy
 /// This variant allows you to control whether it is a library or language feature.
 /// Almost always, you want to use this for a language feature. If so, prefer
 /// `add_feature_diagnostics`.
-pub fn add_feature_diagnostics_for_issue(
-    err: &mut Diagnostic,
+pub fn add_feature_diagnostics_for_issue<G: EmissionGuarantee>(
+    err: &mut DiagnosticBuilder<'_, G>,
     sess: &Session,
     feature: Symbol,
     issue: GateIssue,
diff --git a/compiler/rustc_smir/src/rustc_internal/mod.rs b/compiler/rustc_smir/src/rustc_internal/mod.rs
index 6bb8c5452b9..6e870728baf 100644
--- a/compiler/rustc_smir/src/rustc_internal/mod.rs
+++ b/compiler/rustc_smir/src/rustc_internal/mod.rs
@@ -347,8 +347,14 @@ macro_rules! run_driver {
                         Err(CompilerError::Interrupted(value))
                     }
                     (Ok(Ok(_)), None) => Err(CompilerError::Skipped),
-                    (Ok(Err(_)), _) => Err(CompilerError::CompilationFailed),
-                    (Err(_), _) => Err(CompilerError::ICE),
+                    // Two cases here:
+                    // - `run` finished normally and returned `Err`
+                    // - `run` panicked with `FatalErr`
+                    // You might think that normal compile errors cause the former, and
+                    // ICEs cause the latter. But some normal compiler errors also cause
+                    // the latter. So we can't meaningfully distinguish them, and group
+                    // them together.
+                    (Ok(Err(_)), _) | (Err(_), _) => Err(CompilerError::Failed),
                 }
             }
         }
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index 49ae9f16c8e..616a7ccc7c6 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -72,6 +72,7 @@ pub mod fatal_error;
 
 pub mod profiling;
 
+use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::stable_hasher::{Hash128, Hash64, HashStable, StableHasher};
 use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock, Lrc};
 
@@ -98,6 +99,9 @@ mod tests;
 pub struct SessionGlobals {
     symbol_interner: symbol::Interner,
     span_interner: Lock<span_encoding::SpanInterner>,
+    /// Maps a macro argument token into use of the corresponding metavariable in the macro body.
+    /// Collisions are possible and processed in `maybe_use_metavar_location` on best effort basis.
+    metavar_spans: Lock<FxHashMap<Span, Span>>,
     hygiene_data: Lock<hygiene::HygieneData>,
 
     /// A reference to the source map in the `Session`. It's an `Option`
@@ -115,6 +119,7 @@ impl SessionGlobals {
         SessionGlobals {
             symbol_interner: symbol::Interner::fresh(),
             span_interner: Lock::new(span_encoding::SpanInterner::default()),
+            metavar_spans: Default::default(),
             hygiene_data: Lock::new(hygiene::HygieneData::new(edition)),
             source_map: Lock::new(None),
         }
@@ -168,6 +173,11 @@ pub fn create_default_session_globals_then<R>(f: impl FnOnce() -> R) -> R {
 // deserialization.
 scoped_tls::scoped_thread_local!(static SESSION_GLOBALS: SessionGlobals);
 
+#[inline]
+pub fn with_metavar_spans<R>(f: impl FnOnce(&mut FxHashMap<Span, Span>) -> R) -> R {
+    with_session_globals(|session_globals| f(&mut session_globals.metavar_spans.lock()))
+}
+
 // FIXME: We should use this enum or something like it to get rid of the
 // use of magic `/rust/1.x/...` paths across the board.
 #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Decodable)]
@@ -824,29 +834,64 @@ impl Span {
         )
     }
 
+    /// Check if you can select metavar spans for the given spans to get matching contexts.
+    fn try_metavars(a: SpanData, b: SpanData, a_orig: Span, b_orig: Span) -> (SpanData, SpanData) {
+        let get = |mspans: &FxHashMap<_, _>, s| mspans.get(&s).copied();
+        match with_metavar_spans(|mspans| (get(mspans, a_orig), get(mspans, b_orig))) {
+            (None, None) => {}
+            (Some(meta_a), None) => {
+                let meta_a = meta_a.data();
+                if meta_a.ctxt == b.ctxt {
+                    return (meta_a, b);
+                }
+            }
+            (None, Some(meta_b)) => {
+                let meta_b = meta_b.data();
+                if a.ctxt == meta_b.ctxt {
+                    return (a, meta_b);
+                }
+            }
+            (Some(meta_a), Some(meta_b)) => {
+                let meta_b = meta_b.data();
+                if a.ctxt == meta_b.ctxt {
+                    return (a, meta_b);
+                }
+                let meta_a = meta_a.data();
+                if meta_a.ctxt == b.ctxt {
+                    return (meta_a, b);
+                } else if meta_a.ctxt == meta_b.ctxt {
+                    return (meta_a, meta_b);
+                }
+            }
+        }
+
+        (a, b)
+    }
+
     /// Prepare two spans to a combine operation like `to` or `between`.
-    /// FIXME: consider using declarative macro metavariable spans for the given spans if they are
-    /// better suitable for combining (#119412).
     fn prepare_to_combine(
         a_orig: Span,
         b_orig: Span,
     ) -> Result<(SpanData, SpanData, Option<LocalDefId>), Span> {
         let (a, b) = (a_orig.data(), b_orig.data());
+        if a.ctxt == b.ctxt {
+            return Ok((a, b, if a.parent == b.parent { a.parent } else { None }));
+        }
 
-        if a.ctxt != b.ctxt {
-            // Context mismatches usually happen when procedural macros combine spans copied from
-            // the macro input with spans produced by the macro (`Span::*_site`).
-            // In that case we consider the combined span to be produced by the macro and return
-            // the original macro-produced span as the result.
-            // Otherwise we just fall back to returning the first span.
-            // Combining locations typically doesn't make sense in case of context mismatches.
-            // `is_root` here is a fast path optimization.
-            let a_is_callsite = a.ctxt.is_root() || a.ctxt == b.span().source_callsite().ctxt();
-            return Err(if a_is_callsite { b_orig } else { a_orig });
+        let (a, b) = Span::try_metavars(a, b, a_orig, b_orig);
+        if a.ctxt == b.ctxt {
+            return Ok((a, b, if a.parent == b.parent { a.parent } else { None }));
         }
 
-        let parent = if a.parent == b.parent { a.parent } else { None };
-        Ok((a, b, parent))
+        // Context mismatches usually happen when procedural macros combine spans copied from
+        // the macro input with spans produced by the macro (`Span::*_site`).
+        // In that case we consider the combined span to be produced by the macro and return
+        // the original macro-produced span as the result.
+        // Otherwise we just fall back to returning the first span.
+        // Combining locations typically doesn't make sense in case of context mismatches.
+        // `is_root` here is a fast path optimization.
+        let a_is_callsite = a.ctxt.is_root() || a.ctxt == b.span().source_callsite().ctxt();
+        Err(if a_is_callsite { b_orig } else { a_orig })
     }
 
     /// This span, but in a larger context, may switch to the metavariable span if suitable.
diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs
index aee5d60626e..dd75377ead2 100644
--- a/compiler/rustc_target/src/spec/base/apple/mod.rs
+++ b/compiler/rustc_target/src/spec/base/apple/mod.rs
@@ -97,28 +97,39 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
         _ => os.into(),
     };
 
-    let platform_version: StaticCow<str> = match os {
-        "ios" => ios_lld_platform_version(arch),
-        "tvos" => tvos_lld_platform_version(),
-        "watchos" => watchos_lld_platform_version(),
-        "macos" => macos_lld_platform_version(arch),
-        _ => unreachable!(),
-    }
-    .into();
-
-    let arch = arch.target_name();
+    let min_version: StaticCow<str> = {
+        let (major, minor) = match os {
+            "ios" => ios_deployment_target(arch, abi),
+            "tvos" => tvos_deployment_target(),
+            "watchos" => watchos_deployment_target(),
+            "macos" => macos_deployment_target(arch),
+            _ => unreachable!(),
+        };
+        format!("{major}.{minor}").into()
+    };
+    let sdk_version = min_version.clone();
 
     let mut args = TargetOptions::link_args(
         LinkerFlavor::Darwin(Cc::No, Lld::No),
-        &["-arch", arch, "-platform_version"],
+        &["-arch", arch.target_name(), "-platform_version"],
     );
     add_link_args_iter(
         &mut args,
         LinkerFlavor::Darwin(Cc::No, Lld::No),
-        [platform_name, platform_version.clone(), platform_version].into_iter(),
+        [platform_name, min_version, sdk_version].into_iter(),
     );
     if abi != "macabi" {
-        add_link_args(&mut args, LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-arch", arch]);
+        add_link_args(
+            &mut args,
+            LinkerFlavor::Darwin(Cc::Yes, Lld::No),
+            &["-arch", arch.target_name()],
+        );
+    } else {
+        add_link_args_iter(
+            &mut args,
+            LinkerFlavor::Darwin(Cc::Yes, Lld::No),
+            ["-target".into(), mac_catalyst_llvm_target(arch).into()].into_iter(),
+        );
     }
 
     args
@@ -131,7 +142,7 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
         abi: abi.into(),
         os: os.into(),
         cpu: arch.target_cpu().into(),
-        link_env_remove: link_env_remove(arch, os),
+        link_env_remove: link_env_remove(os),
         vendor: "apple".into(),
         linker_flavor: LinkerFlavor::Darwin(Cc::Yes, Lld::No),
         // macOS has -dead_strip, which doesn't rely on function_sections
@@ -220,16 +231,13 @@ pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
             };
             macos_deployment_target(arch)
         }
-        "ios" => match &*target.abi {
-            "macabi" => mac_catalyst_deployment_target(),
-            _ => {
-                let arch = match target.arch.as_ref() {
-                    "arm64e" => Arm64e,
-                    _ => Arm64,
-                };
-                ios_deployment_target(arch)
-            }
-        },
+        "ios" => {
+            let arch = match target.arch.as_ref() {
+                "arm64e" => Arm64e,
+                _ => Arm64,
+            };
+            ios_deployment_target(arch, &target.abi)
+        }
         "watchos" => watchos_deployment_target(),
         "tvos" => tvos_deployment_target(),
         _ => return None,
@@ -260,17 +268,12 @@ fn macos_deployment_target(arch: Arch) -> (u32, u32) {
         .unwrap_or_else(|| macos_default_deployment_target(arch))
 }
 
-fn macos_lld_platform_version(arch: Arch) -> String {
-    let (major, minor) = macos_deployment_target(arch);
-    format!("{major}.{minor}")
-}
-
 pub fn macos_llvm_target(arch: Arch) -> String {
     let (major, minor) = macos_deployment_target(arch);
     format!("{}-apple-macosx{}.{}.0", arch.target_name(), major, minor)
 }
 
-fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]> {
+fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
     // Apple platforms only officially support macOS as a host for any compilation.
     //
     // If building for macOS, we go ahead and remove any erroneous environment state
@@ -298,29 +301,23 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
         env_remove.push("TVOS_DEPLOYMENT_TARGET".into());
         env_remove.into()
     } else {
-        // Otherwise if cross-compiling for a different OS/SDK, remove any part
+        // Otherwise if cross-compiling for a different OS/SDK (including Mac Catalyst), remove any part
         // of the linking environment that's wrong and reversed.
-        match arch {
-            Armv7k | Armv7s | Arm64 | Arm64e | Arm64_32 | I386 | I386_sim | I686 | X86_64
-            | X86_64_sim | X86_64h | Arm64_sim => {
-                cvs!["MACOSX_DEPLOYMENT_TARGET"]
-            }
-            X86_64_macabi | Arm64_macabi => cvs!["IPHONEOS_DEPLOYMENT_TARGET"],
-        }
+        cvs!["MACOSX_DEPLOYMENT_TARGET"]
     }
 }
 
-fn ios_deployment_target(arch: Arch) -> (u32, u32) {
+fn ios_deployment_target(arch: Arch, abi: &str) -> (u32, u32) {
     // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
-    let (major, minor) = if arch == Arm64e { (14, 0) } else { (10, 0) };
+    let (major, minor) = match (arch, abi) {
+        (Arm64e, _) => (14, 0),
+        // Mac Catalyst defaults to 13.1 in Clang.
+        (_, "macabi") => (13, 1),
+        _ => (10, 0),
+    };
     from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((major, minor))
 }
 
-fn mac_catalyst_deployment_target() -> (u32, u32) {
-    // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
-    from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((14, 0))
-}
-
 pub fn ios_llvm_target(arch: Arch) -> String {
     // Modern iOS tooling extracts information about deployment target
     // from LC_BUILD_VERSION. This load command will only be emitted when
@@ -328,17 +325,17 @@ pub fn ios_llvm_target(arch: Arch) -> String {
     // set high enough. Luckily one LC_BUILD_VERSION is enough, for Xcode
     // to pick it up (since std and core are still built with the fallback
     // of version 7.0 and hence emit the old LC_IPHONE_MIN_VERSION).
-    let (major, minor) = ios_deployment_target(arch);
+    let (major, minor) = ios_deployment_target(arch, "");
     format!("{}-apple-ios{}.{}.0", arch.target_name(), major, minor)
 }
 
-fn ios_lld_platform_version(arch: Arch) -> String {
-    let (major, minor) = ios_deployment_target(arch);
-    format!("{major}.{minor}")
+pub fn mac_catalyst_llvm_target(arch: Arch) -> String {
+    let (major, minor) = ios_deployment_target(arch, "macabi");
+    format!("{}-apple-ios{}.{}.0-macabi", arch.target_name(), major, minor)
 }
 
 pub fn ios_sim_llvm_target(arch: Arch) -> String {
-    let (major, minor) = ios_deployment_target(arch);
+    let (major, minor) = ios_deployment_target(arch, "sim");
     format!("{}-apple-ios{}.{}.0-simulator", arch.target_name(), major, minor)
 }
 
@@ -347,11 +344,6 @@ fn tvos_deployment_target() -> (u32, u32) {
     from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((10, 0))
 }
 
-fn tvos_lld_platform_version() -> String {
-    let (major, minor) = tvos_deployment_target();
-    format!("{major}.{minor}")
-}
-
 pub fn tvos_llvm_target(arch: Arch) -> String {
     let (major, minor) = tvos_deployment_target();
     format!("{}-apple-tvos{}.{}.0", arch.target_name(), major, minor)
@@ -367,11 +359,6 @@ fn watchos_deployment_target() -> (u32, u32) {
     from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
 }
 
-fn watchos_lld_platform_version() -> String {
-    let (major, minor) = watchos_deployment_target();
-    format!("{major}.{minor}")
-}
-
 pub fn watchos_sim_llvm_target(arch: Arch) -> String {
     let (major, minor) = watchos_deployment_target();
     format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor)
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
index 78067a138a9..300e3014079 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
@@ -1,16 +1,13 @@
-use crate::spec::base::apple::{opts, Arch};
-use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
+use crate::spec::base::apple::{mac_catalyst_llvm_target, opts, Arch};
+use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
 
 pub fn target() -> Target {
-    let llvm_target = "arm64-apple-ios14.0-macabi";
-
     let arch = Arch::Arm64_macabi;
     let mut base = opts("ios", arch);
-    base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-target", llvm_target]);
     base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
 
     Target {
-        llvm_target: llvm_target.into(),
+        llvm_target: mac_catalyst_llvm_target(arch).into(),
         pointer_width: 64,
         data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
         arch: arch.target_arch(),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
index ff21e489333..e59f41185de 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
@@ -1,16 +1,13 @@
-use crate::spec::base::apple::{opts, Arch};
-use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
+use crate::spec::base::apple::{mac_catalyst_llvm_target, opts, Arch};
+use crate::spec::{SanitizerSet, Target, TargetOptions};
 
 pub fn target() -> Target {
-    let llvm_target = "x86_64-apple-ios14.0-macabi";
-
     let arch = Arch::X86_64_macabi;
     let mut base = opts("ios", arch);
-    base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-target", llvm_target]);
     base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
 
     Target {
-        llvm_target: llvm_target.into(),
+        llvm_target: mac_catalyst_llvm_target(arch).into(),
         pointer_width: 64,
         data_layout:
             "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs
index 407fff03e15..10911c0d002 100644
--- a/compiler/rustc_trait_selection/src/errors.rs
+++ b/compiler/rustc_trait_selection/src/errors.rs
@@ -1,7 +1,7 @@
 use crate::fluent_generated as fluent;
 use rustc_errors::{
-    codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
-    EmissionGuarantee, IntoDiagnostic, Level, SubdiagnosticMessageOp,
+    codes::*, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee,
+    IntoDiagnostic, Level, SubdiagnosticMessageOp,
 };
 use rustc_macros::Diagnostic;
 use rustc_middle::ty::{self, ClosureKind, PolyTraitRef, Ty};
@@ -102,7 +102,11 @@ pub enum AdjustSignatureBorrow {
 }
 
 impl AddToDiagnostic for AdjustSignatureBorrow {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        _f: F,
+    ) {
         match self {
             AdjustSignatureBorrow::Borrow { to_borrow } => {
                 diag.arg("len", to_borrow.len());
diff --git a/compiler/rustc_trait_selection/src/solve/normalize.rs b/compiler/rustc_trait_selection/src/solve/normalize.rs
index d87cc89954a..b07702e8421 100644
--- a/compiler/rustc_trait_selection/src/solve/normalize.rs
+++ b/compiler/rustc_trait_selection/src/solve/normalize.rs
@@ -1,6 +1,6 @@
 use crate::traits::error_reporting::TypeErrCtxtExt;
 use crate::traits::query::evaluate_obligation::InferCtxtExt;
-use crate::traits::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};
+use crate::traits::{BoundVarReplacer, PlaceholderReplacer};
 use rustc_data_structures::stack::ensure_sufficient_stack;
 use rustc_infer::infer::at::At;
 use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
@@ -205,10 +205,9 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for NormalizationFolder<'_, 'tcx> {
     }
 
     fn try_fold_const(&mut self, ct: ty::Const<'tcx>) -> Result<ty::Const<'tcx>, Self::Error> {
-        let reveal = self.at.param_env.reveal();
         let infcx = self.at.infcx;
         debug_assert_eq!(ct, infcx.shallow_resolve(ct));
-        if !needs_normalization(&ct, reveal) {
+        if !ct.has_projections() {
             return Ok(ct);
         }
 
diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs
index f663f02f872..3619d02438d 100644
--- a/compiler/rustc_trait_selection/src/traits/coherence.rs
+++ b/compiler/rustc_trait_selection/src/traits/coherence.rs
@@ -18,7 +18,7 @@ use crate::traits::{
     Obligation, ObligationCause, PredicateObligation, PredicateObligations, SelectionContext,
 };
 use rustc_data_structures::fx::FxIndexSet;
-use rustc_errors::Diagnostic;
+use rustc_errors::{DiagnosticBuilder, EmissionGuarantee};
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{DefId, LOCAL_CRATE};
 use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, TyCtxtInferExt};
@@ -58,7 +58,7 @@ pub struct OverlapResult<'tcx> {
     pub involves_placeholder: bool,
 }
 
-pub fn add_placeholder_note(err: &mut Diagnostic) {
+pub fn add_placeholder_note<G: EmissionGuarantee>(err: &mut DiagnosticBuilder<'_, G>) {
     err.note(
         "this behavior recently changed as a result of a bug fix; \
          see rust-lang/rust#56105 for details",
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index 2d85f84f480..101460789ee 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -13,7 +13,7 @@ use hir::def::CtorOf;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::stack::ensure_sufficient_stack;
 use rustc_errors::{
-    codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
+    codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, EmissionGuarantee,
     MultiSpan, Style, SuggestionStyle,
 };
 use rustc_hir as hir;
@@ -116,12 +116,12 @@ fn predicate_constraint(generics: &hir::Generics<'_>, pred: ty::Predicate<'_>) -
 /// Type parameter needs more bounds. The trivial case is `T` `where T: Bound`, but
 /// it can also be an `impl Trait` param that needs to be decomposed to a type
 /// param for cleaner code.
-pub fn suggest_restriction<'tcx>(
+pub fn suggest_restriction<'tcx, G: EmissionGuarantee>(
     tcx: TyCtxt<'tcx>,
     item_id: LocalDefId,
     hir_generics: &hir::Generics<'tcx>,
     msg: &str,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_, G>,
     fn_sig: Option<&hir::FnSig<'_>>,
     projection: Option<&ty::AliasTy<'_>>,
     trait_pred: ty::PolyTraitPredicate<'tcx>,
@@ -240,7 +240,7 @@ pub fn suggest_restriction<'tcx>(
 impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_restricting_param_bound(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
         associated_ty: Option<(&'static str, Ty<'tcx>)>,
         mut body_id: LocalDefId,
@@ -450,7 +450,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_dereferences(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) -> bool {
         let mut code = obligation.cause.code();
@@ -743,22 +743,23 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn get_closure_name(
         &self,
         def_id: DefId,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         msg: Cow<'static, str>,
     ) -> Option<Symbol> {
-        let get_name = |err: &mut Diagnostic, kind: &hir::PatKind<'_>| -> Option<Symbol> {
-            // Get the local name of this closure. This can be inaccurate because
-            // of the possibility of reassignment, but this should be good enough.
-            match &kind {
-                hir::PatKind::Binding(hir::BindingAnnotation::NONE, _, ident, None) => {
-                    Some(ident.name)
-                }
-                _ => {
-                    err.note(msg);
-                    None
+        let get_name =
+            |err: &mut DiagnosticBuilder<'_>, kind: &hir::PatKind<'_>| -> Option<Symbol> {
+                // Get the local name of this closure. This can be inaccurate because
+                // of the possibility of reassignment, but this should be good enough.
+                match &kind {
+                    hir::PatKind::Binding(hir::BindingAnnotation::NONE, _, ident, None) => {
+                        Some(ident.name)
+                    }
+                    _ => {
+                        err.note(msg);
+                        None
+                    }
                 }
-            }
-        };
+            };
 
         let hir_id = self.tcx.local_def_id_to_hir_id(def_id.as_local()?);
         match self.tcx.parent_hir_node(hir_id) {
@@ -778,7 +779,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_fn_call(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) -> bool {
         // It doesn't make sense to make this suggestion outside of typeck...
@@ -894,7 +895,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn check_for_binding_assigned_block_without_tail_expression(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) {
         let mut span = obligation.cause.span;
@@ -971,7 +972,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_add_clone_to_arg(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) -> bool {
         let self_ty = self.resolve_vars_if_possible(trait_pred.self_ty());
@@ -1156,7 +1157,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_add_reference_to_arg(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         poly_trait_pred: ty::PolyTraitPredicate<'tcx>,
         has_custom_message: bool,
     ) -> bool {
@@ -1374,7 +1375,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     // Suggest borrowing the type
     fn suggest_borrowing_for_object_cast(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         obligation: &PredicateObligation<'tcx>,
         self_ty: Ty<'tcx>,
         target_ty: Ty<'tcx>,
@@ -1410,7 +1411,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_remove_reference(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) -> bool {
         let mut span = obligation.cause.span;
@@ -1529,7 +1530,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         false
     }
 
-    fn suggest_remove_await(&self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic) {
+    fn suggest_remove_await(
+        &self,
+        obligation: &PredicateObligation<'tcx>,
+        err: &mut DiagnosticBuilder<'_>,
+    ) {
         let hir = self.tcx.hir();
         if let ObligationCauseCode::AwaitableExpr(hir_id) = obligation.cause.code().peel_derives()
             && let hir::Node::Expr(expr) = self.tcx.hir_node(*hir_id)
@@ -1599,7 +1604,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_change_mut(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) {
         let points_at_arg = matches!(
@@ -1677,7 +1682,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_semicolon_removal(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) -> bool {
@@ -1731,7 +1736,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     /// emitted.
     fn suggest_impl_trait(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         obligation: &PredicateObligation<'tcx>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) -> bool {
@@ -1913,7 +1918,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
 
     fn note_conflicting_fn_args(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         cause: &ObligationCauseCode<'tcx>,
         expected: Ty<'tcx>,
         found: Ty<'tcx>,
@@ -2120,7 +2125,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
 
     fn suggest_fully_qualified_path(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         item_def_id: DefId,
         span: Span,
         trait_ref: DefId,
@@ -2185,9 +2190,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     ///
     /// Returns `true` if an async-await specific note was added to the diagnostic.
     #[instrument(level = "debug", skip_all, fields(?obligation.predicate, ?obligation.cause.span))]
-    fn maybe_note_obligation_cause_for_async_await(
+    fn maybe_note_obligation_cause_for_async_await<G: EmissionGuarantee>(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_, G>,
         obligation: &PredicateObligation<'tcx>,
     ) -> bool {
         let hir = self.tcx.hir();
@@ -2421,9 +2426,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     /// Unconditionally adds the diagnostic note described in
     /// `maybe_note_obligation_cause_for_async_await`'s documentation comment.
     #[instrument(level = "debug", skip_all)]
-    fn note_obligation_cause_for_async_await(
+    fn note_obligation_cause_for_async_await<G: EmissionGuarantee>(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_, G>,
         interior_or_upvar_span: CoroutineInteriorOrUpvar,
         is_async: bool,
         outer_coroutine: Option<DefId>,
@@ -2656,10 +2661,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         );
     }
 
-    fn note_obligation_cause_code<T>(
+    fn note_obligation_cause_code<G: EmissionGuarantee, T>(
         &self,
         body_id: LocalDefId,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_, G>,
         predicate: T,
         param_env: ty::ParamEnv<'tcx>,
         cause_code: &ObligationCauseCode<'tcx>,
@@ -3507,7 +3512,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     )]
     fn suggest_await_before_try(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         obligation: &PredicateObligation<'tcx>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
         span: Span,
@@ -3565,7 +3570,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_floating_point_literal(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_ref: &ty::PolyTraitRef<'tcx>,
     ) {
         let rhs_span = match obligation.cause.code() {
@@ -3589,7 +3594,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_derive(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) {
         let Some(diagnostic_name) = self.tcx.get_diagnostic_name(trait_pred.def_id()) else {
@@ -3655,7 +3660,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn suggest_dereferencing_index(
         &self,
         obligation: &PredicateObligation<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_pred: ty::PolyTraitPredicate<'tcx>,
     ) {
         if let ObligationCauseCode::ImplDerivedObligation(_) = obligation.cause.code()
@@ -3675,10 +3680,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         }
     }
 
-    fn note_function_argument_obligation(
+    fn note_function_argument_obligation<G: EmissionGuarantee>(
         &self,
         body_id: LocalDefId,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_, G>,
         arg_hir_id: HirId,
         parent_code: &ObligationCauseCode<'tcx>,
         param_env: ty::ParamEnv<'tcx>,
@@ -3860,11 +3865,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         }
     }
 
-    fn suggest_option_method_if_applicable(
+    fn suggest_option_method_if_applicable<G: EmissionGuarantee>(
         &self,
         failed_pred: ty::Predicate<'tcx>,
         param_env: ty::ParamEnv<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_, G>,
         expr: &hir::Expr<'_>,
     ) {
         let tcx = self.tcx;
@@ -3934,7 +3939,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         }
     }
 
-    fn look_for_iterator_item_mistakes(
+    fn look_for_iterator_item_mistakes<G: EmissionGuarantee>(
         &self,
         assocs_in_this_method: &[Option<(Span, (DefId, Ty<'tcx>))>],
         typeck_results: &TypeckResults<'tcx>,
@@ -3942,7 +3947,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         param_env: ty::ParamEnv<'tcx>,
         path_segment: &hir::PathSegment<'_>,
         args: &[hir::Expr<'_>],
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_, G>,
     ) {
         let tcx = self.tcx;
         // Special case for iterator chains, we look at potential failures of `Iterator::Item`
@@ -4037,13 +4042,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         }
     }
 
-    fn point_at_chain(
+    fn point_at_chain<G: EmissionGuarantee>(
         &self,
         expr: &hir::Expr<'_>,
         typeck_results: &TypeckResults<'tcx>,
         type_diffs: Vec<TypeError<'tcx>>,
         param_env: ty::ParamEnv<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_, G>,
     ) {
         let mut primary_spans = vec![];
         let mut span_labels = vec![];
@@ -4279,7 +4284,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     /// the array into a slice.
     fn suggest_convert_to_slice(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         obligation: &PredicateObligation<'tcx>,
         trait_ref: ty::PolyTraitRef<'tcx>,
         candidate_impls: &[ImplCandidate<'tcx>],
@@ -4351,7 +4356,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
 
     fn explain_hrtb_projection(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         pred: ty::PolyTraitPredicate<'tcx>,
         param_env: ty::ParamEnv<'tcx>,
         cause: &ObligationCause<'tcx>,
@@ -4417,7 +4422,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
 
     fn suggest_desugaring_async_fn_in_trait(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_ref: ty::PolyTraitRef<'tcx>,
     ) {
         // Don't suggest if RTN is active -- we should prefer a where-clause bound instead.
@@ -4508,7 +4513,7 @@ fn hint_missing_borrow<'tcx>(
     found: Ty<'tcx>,
     expected: Ty<'tcx>,
     found_node: Node<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_>,
 ) {
     if matches!(found_node, Node::TraitItem(..)) {
         return;
@@ -4867,9 +4872,9 @@ pub fn suggest_desugaring_async_fn_to_impl_future_in_trait<'tcx>(
 
 /// On `impl` evaluation cycles, look for `Self::AssocTy` restrictions in `where` clauses, explain
 /// they are not allowed and if possible suggest alternatives.
-fn point_at_assoc_type_restriction(
+fn point_at_assoc_type_restriction<G: EmissionGuarantee>(
     tcx: TyCtxt<'_>,
-    err: &mut Diagnostic,
+    err: &mut DiagnosticBuilder<'_, G>,
     self_ty_str: &str,
     trait_name: &str,
     predicate: ty::Predicate<'_>,
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
index 67bd18d7404..4f674ac7583 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
@@ -21,8 +21,8 @@ use crate::traits::{
 };
 use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
 use rustc_errors::{
-    codes::*, pluralize, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder,
-    ErrorGuaranteed, MultiSpan, StashKey, StringPart,
+    codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
+    MultiSpan, StashKey, StringPart,
 };
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Namespace, Res};
@@ -185,7 +185,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         predicate: &T,
         span: Span,
         suggest_increasing_limit: bool,
-        mutate: impl FnOnce(&mut Diagnostic),
+        mutate: impl FnOnce(&mut DiagnosticBuilder<'_>),
     ) -> !
     where
         T: fmt::Display + TypeFoldable<TyCtxt<'tcx>> + Print<'tcx, FmtPrinter<'tcx, 'tcx>>,
@@ -272,7 +272,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         );
     }
 
-    fn suggest_new_overflow_limit(&self, err: &mut Diagnostic) {
+    fn suggest_new_overflow_limit(&self, err: &mut DiagnosticBuilder<'_>) {
         let suggested_limit = match self.tcx.recursion_limit() {
             Limit(0) => Limit(2),
             limit => limit * 2,
@@ -1020,7 +1020,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         &self,
         obligation: &PredicateObligation<'tcx>,
         trait_ref: ty::TraitRef<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) -> bool {
         let span = obligation.cause.span;
         struct V<'v> {
@@ -1810,7 +1810,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         impl_candidates: &[ImplCandidate<'tcx>],
         trait_ref: ty::PolyTraitRef<'tcx>,
         body_def_id: LocalDefId,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         other: bool,
         param_env: ty::ParamEnv<'tcx>,
     ) -> bool {
@@ -1897,7 +1897,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         }
 
         let other = if other { "other " } else { "" };
-        let report = |candidates: Vec<TraitRef<'tcx>>, err: &mut Diagnostic| {
+        let report = |candidates: Vec<TraitRef<'tcx>>, err: &mut DiagnosticBuilder<'_>| {
             if candidates.is_empty() {
                 return false;
             }
@@ -2032,7 +2032,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         obligation: &PredicateObligation<'tcx>,
         trait_predicate: ty::Binder<'tcx, ty::TraitPredicate<'tcx>>,
         body_def_id: LocalDefId,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) {
         // This is *almost* equivalent to
         // `obligation.cause.code().peel_derives()`, but it gives us the
@@ -2103,7 +2103,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     /// a probable version mismatch is added to `err`
     fn note_version_mismatch(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         trait_ref: &ty::PolyTraitRef<'tcx>,
     ) -> bool {
         let get_trait_impls = |trait_def_id| {
@@ -2572,7 +2572,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
 
     fn annotate_source_of_ambiguity(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         ambiguities: &[ambiguity::Ambiguity],
         predicate: ty::Predicate<'tcx>,
     ) {
@@ -2715,7 +2715,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         })
     }
 
-    fn note_obligation_cause(&self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>) {
+    fn note_obligation_cause(
+        &self,
+        err: &mut DiagnosticBuilder<'_>,
+        obligation: &PredicateObligation<'tcx>,
+    ) {
         // First, attempt to add note to this error with an async-await-specific
         // message, and fall back to regular note otherwise.
         if !self.maybe_note_obligation_cause_for_async_await(err, obligation) {
@@ -2744,7 +2748,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     #[instrument(level = "debug", skip_all)]
     fn suggest_unsized_bound_if_applicable(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         obligation: &PredicateObligation<'tcx>,
     ) {
         let ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) =
@@ -2770,7 +2774,12 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     }
 
     #[instrument(level = "debug", skip_all)]
-    fn maybe_suggest_unsized_generics(&self, err: &mut Diagnostic, span: Span, node: Node<'tcx>) {
+    fn maybe_suggest_unsized_generics(
+        &self,
+        err: &mut DiagnosticBuilder<'_>,
+        span: Span,
+        node: Node<'tcx>,
+    ) {
         let Some(generics) = node.generics() else {
             return;
         };
@@ -2822,7 +2831,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
 
     fn maybe_indirection_for_unsized(
         &self,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         item: &Item<'tcx>,
         param: &GenericParam<'tcx>,
     ) -> bool {
@@ -3016,7 +3025,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn add_tuple_trait_message(
         &self,
         obligation_cause_code: &ObligationCauseCode<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
     ) {
         match obligation_cause_code {
             ObligationCauseCode::RustCall => {
@@ -3041,7 +3050,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
         obligation: &PredicateObligation<'tcx>,
         trait_ref: ty::PolyTraitRef<'tcx>,
         trait_predicate: &ty::PolyTraitPredicate<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         span: Span,
         is_fn_trait: bool,
         suggested: bool,
@@ -3122,7 +3131,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn add_help_message_for_fn_trait(
         &self,
         trait_ref: ty::PolyTraitRef<'tcx>,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_>,
         implemented_kind: ty::ClosureKind,
         params: ty::Binder<'tcx, Ty<'tcx>>,
     ) {
@@ -3178,7 +3187,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     fn maybe_add_note_for_unsatisfied_const(
         &self,
         _trait_predicate: &ty::PolyTraitPredicate<'tcx>,
-        _err: &mut Diagnostic,
+        _err: &mut DiagnosticBuilder<'_>,
         _span: Span,
     ) -> UnsatisfiedConst {
         let unsatisfied_const = UnsatisfiedConst(false);
diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs
index 7ad94274634..fd981130af8 100644
--- a/compiler/rustc_trait_selection/src/traits/fulfill.rs
+++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs
@@ -1,5 +1,6 @@
 use crate::infer::{InferCtxt, TyOrConstInferVar};
 use crate::traits::error_reporting::TypeErrCtxtExt;
+use crate::traits::normalize::normalize_with_depth_to;
 use rustc_data_structures::captures::Captures;
 use rustc_data_structures::obligation_forest::ProcessResult;
 use rustc_data_structures::obligation_forest::{Error, ForestObligation, Outcome};
@@ -312,7 +313,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
 
         if obligation.predicate.has_projections() {
             let mut obligations = Vec::new();
-            let predicate = crate::traits::project::try_normalize_with_depth_to(
+            let predicate = normalize_with_depth_to(
                 &mut self.selcx,
                 obligation.param_env,
                 obligation.cause.clone(),
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs
index 7caaccab63b..9eec60ea06c 100644
--- a/compiler/rustc_trait_selection/src/traits/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/mod.rs
@@ -9,6 +9,7 @@ mod engine;
 pub mod error_reporting;
 mod fulfill;
 pub mod misc;
+pub mod normalize;
 mod object_safety;
 pub mod outlives_bounds;
 pub mod project;
@@ -40,17 +41,15 @@ use rustc_span::Span;
 use std::fmt::Debug;
 use std::ops::ControlFlow;
 
-pub(crate) use self::project::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};
-
 pub use self::coherence::{add_placeholder_note, orphan_check, overlapping_impls};
 pub use self::coherence::{OrphanCheckErr, OverlapResult};
 pub use self::engine::{ObligationCtxt, TraitEngineExt};
 pub use self::fulfill::{FulfillmentContext, PendingPredicateObligation};
+pub use self::normalize::NormalizeExt;
 pub use self::object_safety::astconv_object_safety_violations;
 pub use self::object_safety::is_vtable_safe_method;
 pub use self::object_safety::object_safety_violations_for_assoc_item;
 pub use self::object_safety::ObjectSafetyViolation;
-pub use self::project::NormalizeExt;
 pub use self::project::{normalize_inherent_projection, normalize_projection_type};
 pub use self::select::{EvaluationCache, SelectionCache, SelectionContext};
 pub use self::select::{EvaluationResult, IntercrateAmbiguityCause, OverflowError};
@@ -68,6 +67,7 @@ pub use self::util::{
 };
 pub use self::util::{expand_trait_aliases, TraitAliasExpander};
 pub use self::util::{get_vtable_index_of_object_method, impl_item_is_final, upcast_choices};
+pub use self::util::{with_replaced_escaping_bound_vars, BoundVarReplacer, PlaceholderReplacer};
 
 pub use rustc_infer::traits::*;
 
@@ -119,9 +119,7 @@ pub fn predicates_for_generics<'tcx>(
 
 /// Determines whether the type `ty` is known to meet `bound` and
 /// returns true if so. Returns false if `ty` either does not meet
-/// `bound` or is not known to meet bound (note that this is
-/// conservative towards *no impl*, which is the opposite of the
-/// `evaluate` methods).
+/// `bound` or is not known to meet bound.
 pub fn type_known_to_meet_bound_modulo_regions<'tcx>(
     infcx: &InferCtxt<'tcx>,
     param_env: ty::ParamEnv<'tcx>,
@@ -129,50 +127,8 @@ pub fn type_known_to_meet_bound_modulo_regions<'tcx>(
     def_id: DefId,
 ) -> bool {
     let trait_ref = ty::TraitRef::new(infcx.tcx, def_id, [ty]);
-    pred_known_to_hold_modulo_regions(infcx, param_env, trait_ref)
-}
-
-/// FIXME(@lcnr): this function doesn't seem right and shouldn't exist?
-///
-/// Ping me on zulip if you want to use this method and need help with finding
-/// an appropriate replacement.
-#[instrument(level = "debug", skip(infcx, param_env, pred), ret)]
-fn pred_known_to_hold_modulo_regions<'tcx>(
-    infcx: &InferCtxt<'tcx>,
-    param_env: ty::ParamEnv<'tcx>,
-    pred: impl ToPredicate<'tcx>,
-) -> bool {
-    let obligation = Obligation::new(infcx.tcx, ObligationCause::dummy(), param_env, pred);
-
-    let result = infcx.evaluate_obligation_no_overflow(&obligation);
-    debug!(?result);
-
-    if result.must_apply_modulo_regions() {
-        true
-    } else if result.may_apply() {
-        // Sometimes obligations are ambiguous because the recursive evaluator
-        // is not smart enough, so we fall back to fulfillment when we're not certain
-        // that an obligation holds or not. Even still, we must make sure that
-        // the we do no inference in the process of checking this obligation.
-        let goal = infcx.resolve_vars_if_possible((obligation.predicate, obligation.param_env));
-        infcx.probe(|_| {
-            let ocx = ObligationCtxt::new(infcx);
-            ocx.register_obligation(obligation);
-
-            let errors = ocx.select_all_or_error();
-            match errors.as_slice() {
-                // Only known to hold if we did no inference.
-                [] => infcx.shallow_resolve(goal) == goal,
-
-                errors => {
-                    debug!(?errors);
-                    false
-                }
-            }
-        })
-    } else {
-        false
-    }
+    let obligation = Obligation::new(infcx.tcx, ObligationCause::dummy(), param_env, trait_ref);
+    infcx.predicate_must_hold_modulo_regions(&obligation)
 }
 
 #[instrument(level = "debug", skip(tcx, elaborated_env))]
diff --git a/compiler/rustc_trait_selection/src/traits/normalize.rs b/compiler/rustc_trait_selection/src/traits/normalize.rs
new file mode 100644
index 00000000000..ac62f875fb9
--- /dev/null
+++ b/compiler/rustc_trait_selection/src/traits/normalize.rs
@@ -0,0 +1,423 @@
+//! Deeply normalize types using the old trait solver.
+use rustc_data_structures::stack::ensure_sufficient_stack;
+use rustc_infer::infer::at::At;
+use rustc_infer::infer::InferOk;
+use rustc_infer::traits::PredicateObligation;
+use rustc_infer::traits::{FulfillmentError, Normalized, Obligation, TraitEngine};
+use rustc_middle::traits::{ObligationCause, ObligationCauseCode, Reveal};
+use rustc_middle::ty::{self, Ty, TyCtxt, TypeFolder};
+use rustc_middle::ty::{TypeFoldable, TypeSuperFoldable, TypeVisitable, TypeVisitableExt};
+
+use super::error_reporting::TypeErrCtxtExt;
+use super::SelectionContext;
+use super::{project, with_replaced_escaping_bound_vars, BoundVarReplacer, PlaceholderReplacer};
+
+#[extension(pub trait NormalizeExt<'tcx>)]
+impl<'tcx> At<'_, 'tcx> {
+    /// Normalize a value using the `AssocTypeNormalizer`.
+    ///
+    /// This normalization should be used when the type contains inference variables or the
+    /// projection may be fallible.
+    fn normalize<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> InferOk<'tcx, T> {
+        if self.infcx.next_trait_solver() {
+            InferOk { value, obligations: Vec::new() }
+        } else {
+            let mut selcx = SelectionContext::new(self.infcx);
+            let Normalized { value, obligations } =
+                normalize_with_depth(&mut selcx, self.param_env, self.cause.clone(), 0, value);
+            InferOk { value, obligations }
+        }
+    }
+
+    /// Deeply normalizes `value`, replacing all aliases which can by normalized in
+    /// the current environment. In the new solver this errors in case normalization
+    /// fails or is ambiguous.
+    ///
+    /// In the old solver this simply uses `normalizes` and adds the nested obligations
+    /// to the `fulfill_cx`. This is necessary as we otherwise end up recomputing the
+    /// same goals in both a temporary and the shared context which negatively impacts
+    /// performance as these don't share caching.
+    ///
+    /// FIXME(-Znext-solver): This has the same behavior as `traits::fully_normalize`
+    /// in the new solver, but because of performance reasons, we currently reuse an
+    /// existing fulfillment context in the old solver. Once we also eagerly prove goals with
+    /// the old solver or have removed the old solver, remove `traits::fully_normalize` and
+    /// rename this function to `At::fully_normalize`.
+    fn deeply_normalize<T: TypeFoldable<TyCtxt<'tcx>>>(
+        self,
+        value: T,
+        fulfill_cx: &mut dyn TraitEngine<'tcx>,
+    ) -> Result<T, Vec<FulfillmentError<'tcx>>> {
+        if self.infcx.next_trait_solver() {
+            crate::solve::deeply_normalize(self, value)
+        } else {
+            let value = self
+                .normalize(value)
+                .into_value_registering_obligations(self.infcx, &mut *fulfill_cx);
+            let errors = fulfill_cx.select_where_possible(self.infcx);
+            let value = self.infcx.resolve_vars_if_possible(value);
+            if errors.is_empty() { Ok(value) } else { Err(errors) }
+        }
+    }
+}
+
+/// As `normalize`, but with a custom depth.
+pub(crate) fn normalize_with_depth<'a, 'b, 'tcx, T>(
+    selcx: &'a mut SelectionContext<'b, 'tcx>,
+    param_env: ty::ParamEnv<'tcx>,
+    cause: ObligationCause<'tcx>,
+    depth: usize,
+    value: T,
+) -> Normalized<'tcx, T>
+where
+    T: TypeFoldable<TyCtxt<'tcx>>,
+{
+    let mut obligations = Vec::new();
+    let value = normalize_with_depth_to(selcx, param_env, cause, depth, value, &mut obligations);
+    Normalized { value, obligations }
+}
+
+#[instrument(level = "info", skip(selcx, param_env, cause, obligations))]
+pub(crate) fn normalize_with_depth_to<'a, 'b, 'tcx, T>(
+    selcx: &'a mut SelectionContext<'b, 'tcx>,
+    param_env: ty::ParamEnv<'tcx>,
+    cause: ObligationCause<'tcx>,
+    depth: usize,
+    value: T,
+    obligations: &mut Vec<PredicateObligation<'tcx>>,
+) -> T
+where
+    T: TypeFoldable<TyCtxt<'tcx>>,
+{
+    debug!(obligations.len = obligations.len());
+    let mut normalizer = AssocTypeNormalizer::new(selcx, param_env, cause, depth, obligations);
+    let result = ensure_sufficient_stack(|| normalizer.fold(value));
+    debug!(?result, obligations.len = normalizer.obligations.len());
+    debug!(?normalizer.obligations,);
+    result
+}
+
+pub(super) fn needs_normalization<'tcx, T: TypeVisitable<TyCtxt<'tcx>>>(
+    value: &T,
+    reveal: Reveal,
+) -> bool {
+    match reveal {
+        Reveal::UserFacing => value.has_type_flags(
+            ty::TypeFlags::HAS_TY_PROJECTION
+                | ty::TypeFlags::HAS_TY_INHERENT
+                | ty::TypeFlags::HAS_CT_PROJECTION,
+        ),
+        Reveal::All => value.has_type_flags(
+            ty::TypeFlags::HAS_TY_PROJECTION
+                | ty::TypeFlags::HAS_TY_INHERENT
+                | ty::TypeFlags::HAS_TY_OPAQUE
+                | ty::TypeFlags::HAS_CT_PROJECTION,
+        ),
+    }
+}
+
+struct AssocTypeNormalizer<'a, 'b, 'tcx> {
+    selcx: &'a mut SelectionContext<'b, 'tcx>,
+    param_env: ty::ParamEnv<'tcx>,
+    cause: ObligationCause<'tcx>,
+    obligations: &'a mut Vec<PredicateObligation<'tcx>>,
+    depth: usize,
+    universes: Vec<Option<ty::UniverseIndex>>,
+}
+
+impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
+    fn new(
+        selcx: &'a mut SelectionContext<'b, 'tcx>,
+        param_env: ty::ParamEnv<'tcx>,
+        cause: ObligationCause<'tcx>,
+        depth: usize,
+        obligations: &'a mut Vec<PredicateObligation<'tcx>>,
+    ) -> AssocTypeNormalizer<'a, 'b, 'tcx> {
+        debug_assert!(!selcx.infcx.next_trait_solver());
+        AssocTypeNormalizer { selcx, param_env, cause, obligations, depth, universes: vec![] }
+    }
+
+    fn fold<T: TypeFoldable<TyCtxt<'tcx>>>(&mut self, value: T) -> T {
+        let value = self.selcx.infcx.resolve_vars_if_possible(value);
+        debug!(?value);
+
+        assert!(
+            !value.has_escaping_bound_vars(),
+            "Normalizing {value:?} without wrapping in a `Binder`"
+        );
+
+        if !needs_normalization(&value, self.param_env.reveal()) {
+            value
+        } else {
+            value.fold_with(self)
+        }
+    }
+}
+
+impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx> {
+    fn interner(&self) -> TyCtxt<'tcx> {
+        self.selcx.tcx()
+    }
+
+    fn fold_binder<T: TypeFoldable<TyCtxt<'tcx>>>(
+        &mut self,
+        t: ty::Binder<'tcx, T>,
+    ) -> ty::Binder<'tcx, T> {
+        self.universes.push(None);
+        let t = t.super_fold_with(self);
+        self.universes.pop();
+        t
+    }
+
+    fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
+        if !needs_normalization(&ty, self.param_env.reveal()) {
+            return ty;
+        }
+
+        let (kind, data) = match *ty.kind() {
+            ty::Alias(kind, alias_ty) => (kind, alias_ty),
+            _ => return ty.super_fold_with(self),
+        };
+
+        // We try to be a little clever here as a performance optimization in
+        // cases where there are nested projections under binders.
+        // For example:
+        // ```
+        // for<'a> fn(<T as Foo>::One<'a, Box<dyn Bar<'a, Item=<T as Foo>::Two<'a>>>>)
+        // ```
+        // We normalize the args on the projection before the projecting, but
+        // if we're naive, we'll
+        //   replace bound vars on inner, project inner, replace placeholders on inner,
+        //   replace bound vars on outer, project outer, replace placeholders on outer
+        //
+        // However, if we're a bit more clever, we can replace the bound vars
+        // on the entire type before normalizing nested projections, meaning we
+        //   replace bound vars on outer, project inner,
+        //   project outer, replace placeholders on outer
+        //
+        // This is possible because the inner `'a` will already be a placeholder
+        // when we need to normalize the inner projection
+        //
+        // On the other hand, this does add a bit of complexity, since we only
+        // replace bound vars if the current type is a `Projection` and we need
+        // to make sure we don't forget to fold the args regardless.
+
+        match kind {
+            ty::Opaque => {
+                // Only normalize `impl Trait` outside of type inference, usually in codegen.
+                match self.param_env.reveal() {
+                    Reveal::UserFacing => ty.super_fold_with(self),
+
+                    Reveal::All => {
+                        let recursion_limit = self.interner().recursion_limit();
+                        if !recursion_limit.value_within_limit(self.depth) {
+                            self.selcx.infcx.err_ctxt().report_overflow_error(
+                                &ty,
+                                self.cause.span,
+                                true,
+                                |_| {},
+                            );
+                        }
+
+                        let args = data.args.fold_with(self);
+                        let generic_ty = self.interner().type_of(data.def_id);
+                        let concrete_ty = generic_ty.instantiate(self.interner(), args);
+                        self.depth += 1;
+                        let folded_ty = self.fold_ty(concrete_ty);
+                        self.depth -= 1;
+                        folded_ty
+                    }
+                }
+            }
+
+            ty::Projection if !data.has_escaping_bound_vars() => {
+                // This branch is *mostly* just an optimization: when we don't
+                // have escaping bound vars, we don't need to replace them with
+                // placeholders (see branch below). *Also*, we know that we can
+                // register an obligation to *later* project, since we know
+                // there won't be bound vars there.
+                let data = data.fold_with(self);
+                let normalized_ty = project::normalize_projection_type(
+                    self.selcx,
+                    self.param_env,
+                    data,
+                    self.cause.clone(),
+                    self.depth,
+                    self.obligations,
+                );
+                debug!(
+                    ?self.depth,
+                    ?ty,
+                    ?normalized_ty,
+                    obligations.len = ?self.obligations.len(),
+                    "AssocTypeNormalizer: normalized type"
+                );
+                normalized_ty.ty().unwrap()
+            }
+
+            ty::Projection => {
+                // If there are escaping bound vars, we temporarily replace the
+                // bound vars with placeholders. Note though, that in the case
+                // that we still can't project for whatever reason (e.g. self
+                // type isn't known enough), we *can't* register an obligation
+                // and return an inference variable (since then that obligation
+                // would have bound vars and that's a can of worms). Instead,
+                // we just give up and fall back to pretending like we never tried!
+                //
+                // Note: this isn't necessarily the final approach here; we may
+                // want to figure out how to register obligations with escaping vars
+                // or handle this some other way.
+
+                let infcx = self.selcx.infcx;
+                let (data, mapped_regions, mapped_types, mapped_consts) =
+                    BoundVarReplacer::replace_bound_vars(infcx, &mut self.universes, data);
+                let data = data.fold_with(self);
+                let normalized_ty = project::opt_normalize_projection_type(
+                    self.selcx,
+                    self.param_env,
+                    data,
+                    self.cause.clone(),
+                    self.depth,
+                    self.obligations,
+                )
+                .ok()
+                .flatten()
+                .map(|term| term.ty().unwrap())
+                .map(|normalized_ty| {
+                    PlaceholderReplacer::replace_placeholders(
+                        infcx,
+                        mapped_regions,
+                        mapped_types,
+                        mapped_consts,
+                        &self.universes,
+                        normalized_ty,
+                    )
+                })
+                .unwrap_or_else(|| ty.super_fold_with(self));
+
+                debug!(
+                    ?self.depth,
+                    ?ty,
+                    ?normalized_ty,
+                    obligations.len = ?self.obligations.len(),
+                    "AssocTypeNormalizer: normalized type"
+                );
+                normalized_ty
+            }
+            ty::Weak => {
+                let recursion_limit = self.interner().recursion_limit();
+                if !recursion_limit.value_within_limit(self.depth) {
+                    self.selcx.infcx.err_ctxt().report_overflow_error(
+                        &ty,
+                        self.cause.span,
+                        false,
+                        |diag| {
+                            diag.note(crate::fluent_generated::trait_selection_ty_alias_overflow);
+                        },
+                    );
+                }
+
+                let infcx = self.selcx.infcx;
+                self.obligations.extend(
+                    infcx.tcx.predicates_of(data.def_id).instantiate_own(infcx.tcx, data.args).map(
+                        |(mut predicate, span)| {
+                            if data.has_escaping_bound_vars() {
+                                (predicate, ..) = BoundVarReplacer::replace_bound_vars(
+                                    infcx,
+                                    &mut self.universes,
+                                    predicate,
+                                );
+                            }
+                            let mut cause = self.cause.clone();
+                            cause.map_code(|code| {
+                                ObligationCauseCode::TypeAlias(code, span, data.def_id)
+                            });
+                            Obligation::new(infcx.tcx, cause, self.param_env, predicate)
+                        },
+                    ),
+                );
+                self.depth += 1;
+                let res = infcx
+                    .tcx
+                    .type_of(data.def_id)
+                    .instantiate(infcx.tcx, data.args)
+                    .fold_with(self);
+                self.depth -= 1;
+                res
+            }
+
+            ty::Inherent if !data.has_escaping_bound_vars() => {
+                // This branch is *mostly* just an optimization: when we don't
+                // have escaping bound vars, we don't need to replace them with
+                // placeholders (see branch below). *Also*, we know that we can
+                // register an obligation to *later* project, since we know
+                // there won't be bound vars there.
+
+                let data = data.fold_with(self);
+
+                // FIXME(inherent_associated_types): Do we need to honor `self.eager_inference_replacement`
+                // here like `ty::Projection`?
+                project::normalize_inherent_projection(
+                    self.selcx,
+                    self.param_env,
+                    data,
+                    self.cause.clone(),
+                    self.depth,
+                    self.obligations,
+                )
+            }
+
+            ty::Inherent => {
+                let infcx = self.selcx.infcx;
+                let (data, mapped_regions, mapped_types, mapped_consts) =
+                    BoundVarReplacer::replace_bound_vars(infcx, &mut self.universes, data);
+                let data = data.fold_with(self);
+                let ty = project::normalize_inherent_projection(
+                    self.selcx,
+                    self.param_env,
+                    data,
+                    self.cause.clone(),
+                    self.depth,
+                    self.obligations,
+                );
+
+                PlaceholderReplacer::replace_placeholders(
+                    infcx,
+                    mapped_regions,
+                    mapped_types,
+                    mapped_consts,
+                    &self.universes,
+                    ty,
+                )
+            }
+        }
+    }
+
+    #[instrument(skip(self), level = "debug")]
+    fn fold_const(&mut self, constant: ty::Const<'tcx>) -> ty::Const<'tcx> {
+        let tcx = self.selcx.tcx();
+        if tcx.features().generic_const_exprs
+            || !needs_normalization(&constant, self.param_env.reveal())
+        {
+            constant
+        } else {
+            let constant = constant.super_fold_with(self);
+            debug!(?constant, ?self.param_env);
+            with_replaced_escaping_bound_vars(
+                self.selcx.infcx,
+                &mut self.universes,
+                constant,
+                |constant| constant.normalize(tcx, self.param_env),
+            )
+        }
+    }
+
+    #[inline]
+    fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
+        if p.allow_normalization() && needs_normalization(&p, self.param_env.reveal()) {
+            p.super_fold_with(self)
+        } else {
+            p
+        }
+    }
+}
diff --git a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
index 6825dd4ac71..8b2e8b54aee 100644
--- a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
+++ b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
@@ -62,9 +62,10 @@ fn implied_outlives_bounds<'a, 'tcx>(
     };
 
     let mut constraints = QueryRegionConstraints::default();
+    let span = infcx.tcx.def_span(body_id);
     let Ok(InferOk { value: mut bounds, obligations }) = infcx
         .instantiate_nll_query_response_and_region_obligations(
-            &ObligationCause::dummy(),
+            &ObligationCause::dummy_with_span(span),
             param_env,
             &canonical_var_values,
             canonical_result,
@@ -80,8 +81,6 @@ fn implied_outlives_bounds<'a, 'tcx>(
     bounds.retain(|bound| !bound.has_placeholders());
 
     if !constraints.is_empty() {
-        let span = infcx.tcx.def_span(body_id);
-
         debug!(?constraints);
         if !constraints.member_constraints.is_empty() {
             span_bug!(span, "{:#?}", constraints.member_constraints);
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index 279c0003187..9c532ea4d8d 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -1,5 +1,7 @@
 //! Code for projecting associated types out of trait references.
 
+use std::ops::ControlFlow;
+
 use super::check_args_compatible;
 use super::specialization_graph;
 use super::translate_args;
@@ -18,8 +20,9 @@ use rustc_middle::traits::ImplSourceUserDefinedData;
 
 use crate::errors::InherentProjectionNormalizationOverflow;
 use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
-use crate::infer::{BoundRegionConversionTime, InferCtxt, InferOk};
-use crate::traits::error_reporting::TypeErrCtxtExt as _;
+use crate::infer::{BoundRegionConversionTime, InferOk};
+use crate::traits::normalize::normalize_with_depth;
+use crate::traits::normalize::normalize_with_depth_to;
 use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
 use crate::traits::select::ProjectionMatchesProjection;
 use rustc_data_structures::sso::SsoHashSet;
@@ -27,21 +30,14 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
 use rustc_errors::ErrorGuaranteed;
 use rustc_hir::def::DefKind;
 use rustc_hir::lang_items::LangItem;
-use rustc_infer::infer::at::At;
 use rustc_infer::infer::resolve::OpportunisticRegionResolver;
 use rustc_infer::infer::DefineOpaqueTypes;
-use rustc_infer::traits::FulfillmentError;
-use rustc_infer::traits::ObligationCauseCode;
-use rustc_infer::traits::TraitEngine;
 use rustc_middle::traits::select::OverflowError;
-use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
+use rustc_middle::ty::fold::TypeFoldable;
 use rustc_middle::ty::visit::{MaxUniverse, TypeVisitable, TypeVisitableExt};
 use rustc_middle::ty::{self, Term, ToPredicate, Ty, TyCtxt};
 use rustc_span::symbol::sym;
 
-use std::collections::BTreeMap;
-use std::ops::ControlFlow;
-
 pub use rustc_middle::traits::Reveal;
 
 pub type PolyProjectionObligation<'tcx> = Obligation<'tcx, ty::PolyProjectionPredicate<'tcx>>;
@@ -52,55 +48,6 @@ pub type ProjectionTyObligation<'tcx> = Obligation<'tcx, ty::AliasTy<'tcx>>;
 
 pub(super) struct InProgress;
 
-#[extension(pub trait NormalizeExt<'tcx>)]
-impl<'tcx> At<'_, 'tcx> {
-    /// Normalize a value using the `AssocTypeNormalizer`.
-    ///
-    /// This normalization should be used when the type contains inference variables or the
-    /// projection may be fallible.
-    fn normalize<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> InferOk<'tcx, T> {
-        if self.infcx.next_trait_solver() {
-            InferOk { value, obligations: Vec::new() }
-        } else {
-            let mut selcx = SelectionContext::new(self.infcx);
-            let Normalized { value, obligations } =
-                normalize_with_depth(&mut selcx, self.param_env, self.cause.clone(), 0, value);
-            InferOk { value, obligations }
-        }
-    }
-
-    /// Deeply normalizes `value`, replacing all aliases which can by normalized in
-    /// the current environment. In the new solver this errors in case normalization
-    /// fails or is ambiguous. This only normalizes opaque types with `Reveal::All`.
-    ///
-    /// In the old solver this simply uses `normalizes` and adds the nested obligations
-    /// to the `fulfill_cx`. This is necessary as we otherwise end up recomputing the
-    /// same goals in both a temporary and the shared context which negatively impacts
-    /// performance as these don't share caching.
-    ///
-    /// FIXME(-Znext-solver): This has the same behavior as `traits::fully_normalize`
-    /// in the new solver, but because of performance reasons, we currently reuse an
-    /// existing fulfillment context in the old solver. Once we also eagerly prove goals with
-    /// the old solver or have removed the old solver, remove `traits::fully_normalize` and
-    /// rename this function to `At::fully_normalize`.
-    fn deeply_normalize<T: TypeFoldable<TyCtxt<'tcx>>>(
-        self,
-        value: T,
-        fulfill_cx: &mut dyn TraitEngine<'tcx>,
-    ) -> Result<T, Vec<FulfillmentError<'tcx>>> {
-        if self.infcx.next_trait_solver() {
-            crate::solve::deeply_normalize(self, value)
-        } else {
-            let value = self
-                .normalize(value)
-                .into_value_registering_obligations(self.infcx, &mut *fulfill_cx);
-            let errors = fulfill_cx.select_where_possible(self.infcx);
-            let value = self.infcx.resolve_vars_if_possible(value);
-            if errors.is_empty() { Ok(value) } else { Err(errors) }
-        }
-    }
-}
-
 /// When attempting to resolve `<T as TraitRef>::Name` ...
 #[derive(Debug)]
 pub enum ProjectionError<'tcx> {
@@ -338,770 +285,6 @@ fn project_and_unify_type<'cx, 'tcx>(
     }
 }
 
-/// As `normalize`, but with a custom depth.
-pub(crate) fn normalize_with_depth<'a, 'b, 'tcx, T>(
-    selcx: &'a mut SelectionContext<'b, 'tcx>,
-    param_env: ty::ParamEnv<'tcx>,
-    cause: ObligationCause<'tcx>,
-    depth: usize,
-    value: T,
-) -> Normalized<'tcx, T>
-where
-    T: TypeFoldable<TyCtxt<'tcx>>,
-{
-    let mut obligations = Vec::new();
-    let value = normalize_with_depth_to(selcx, param_env, cause, depth, value, &mut obligations);
-    Normalized { value, obligations }
-}
-
-#[instrument(level = "info", skip(selcx, param_env, cause, obligations))]
-pub(crate) fn normalize_with_depth_to<'a, 'b, 'tcx, T>(
-    selcx: &'a mut SelectionContext<'b, 'tcx>,
-    param_env: ty::ParamEnv<'tcx>,
-    cause: ObligationCause<'tcx>,
-    depth: usize,
-    value: T,
-    obligations: &mut Vec<PredicateObligation<'tcx>>,
-) -> T
-where
-    T: TypeFoldable<TyCtxt<'tcx>>,
-{
-    debug!(obligations.len = obligations.len());
-    let mut normalizer = AssocTypeNormalizer::new(selcx, param_env, cause, depth, obligations);
-    let result = ensure_sufficient_stack(|| normalizer.fold(value));
-    debug!(?result, obligations.len = normalizer.obligations.len());
-    debug!(?normalizer.obligations,);
-    result
-}
-
-#[instrument(level = "info", skip(selcx, param_env, cause, obligations))]
-pub(crate) fn try_normalize_with_depth_to<'a, 'b, 'tcx, T>(
-    selcx: &'a mut SelectionContext<'b, 'tcx>,
-    param_env: ty::ParamEnv<'tcx>,
-    cause: ObligationCause<'tcx>,
-    depth: usize,
-    value: T,
-    obligations: &mut Vec<PredicateObligation<'tcx>>,
-) -> T
-where
-    T: TypeFoldable<TyCtxt<'tcx>>,
-{
-    debug!(obligations.len = obligations.len());
-    let mut normalizer = AssocTypeNormalizer::new_without_eager_inference_replacement(
-        selcx,
-        param_env,
-        cause,
-        depth,
-        obligations,
-    );
-    let result = ensure_sufficient_stack(|| normalizer.fold(value));
-    debug!(?result, obligations.len = normalizer.obligations.len());
-    debug!(?normalizer.obligations,);
-    result
-}
-
-pub(crate) fn needs_normalization<'tcx, T: TypeVisitable<TyCtxt<'tcx>>>(
-    value: &T,
-    reveal: Reveal,
-) -> bool {
-    match reveal {
-        Reveal::UserFacing => value.has_type_flags(
-            ty::TypeFlags::HAS_TY_PROJECTION
-                | ty::TypeFlags::HAS_TY_INHERENT
-                | ty::TypeFlags::HAS_CT_PROJECTION,
-        ),
-        Reveal::All => value.has_type_flags(
-            ty::TypeFlags::HAS_TY_PROJECTION
-                | ty::TypeFlags::HAS_TY_INHERENT
-                | ty::TypeFlags::HAS_TY_OPAQUE
-                | ty::TypeFlags::HAS_CT_PROJECTION,
-        ),
-    }
-}
-
-struct AssocTypeNormalizer<'a, 'b, 'tcx> {
-    selcx: &'a mut SelectionContext<'b, 'tcx>,
-    param_env: ty::ParamEnv<'tcx>,
-    cause: ObligationCause<'tcx>,
-    obligations: &'a mut Vec<PredicateObligation<'tcx>>,
-    depth: usize,
-    universes: Vec<Option<ty::UniverseIndex>>,
-    /// If true, when a projection is unable to be completed, an inference
-    /// variable will be created and an obligation registered to project to that
-    /// inference variable. Also, constants will be eagerly evaluated.
-    eager_inference_replacement: bool,
-}
-
-impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
-    fn new(
-        selcx: &'a mut SelectionContext<'b, 'tcx>,
-        param_env: ty::ParamEnv<'tcx>,
-        cause: ObligationCause<'tcx>,
-        depth: usize,
-        obligations: &'a mut Vec<PredicateObligation<'tcx>>,
-    ) -> AssocTypeNormalizer<'a, 'b, 'tcx> {
-        debug_assert!(!selcx.infcx.next_trait_solver());
-        AssocTypeNormalizer {
-            selcx,
-            param_env,
-            cause,
-            obligations,
-            depth,
-            universes: vec![],
-            eager_inference_replacement: true,
-        }
-    }
-
-    fn new_without_eager_inference_replacement(
-        selcx: &'a mut SelectionContext<'b, 'tcx>,
-        param_env: ty::ParamEnv<'tcx>,
-        cause: ObligationCause<'tcx>,
-        depth: usize,
-        obligations: &'a mut Vec<PredicateObligation<'tcx>>,
-    ) -> AssocTypeNormalizer<'a, 'b, 'tcx> {
-        AssocTypeNormalizer {
-            selcx,
-            param_env,
-            cause,
-            obligations,
-            depth,
-            universes: vec![],
-            eager_inference_replacement: false,
-        }
-    }
-
-    fn fold<T: TypeFoldable<TyCtxt<'tcx>>>(&mut self, value: T) -> T {
-        let value = self.selcx.infcx.resolve_vars_if_possible(value);
-        debug!(?value);
-
-        assert!(
-            !value.has_escaping_bound_vars(),
-            "Normalizing {value:?} without wrapping in a `Binder`"
-        );
-
-        if !needs_normalization(&value, self.param_env.reveal()) {
-            value
-        } else {
-            value.fold_with(self)
-        }
-    }
-}
-
-impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx> {
-    fn interner(&self) -> TyCtxt<'tcx> {
-        self.selcx.tcx()
-    }
-
-    fn fold_binder<T: TypeFoldable<TyCtxt<'tcx>>>(
-        &mut self,
-        t: ty::Binder<'tcx, T>,
-    ) -> ty::Binder<'tcx, T> {
-        self.universes.push(None);
-        let t = t.super_fold_with(self);
-        self.universes.pop();
-        t
-    }
-
-    fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
-        if !needs_normalization(&ty, self.param_env.reveal()) {
-            return ty;
-        }
-
-        let (kind, data) = match *ty.kind() {
-            ty::Alias(kind, alias_ty) => (kind, alias_ty),
-            _ => return ty.super_fold_with(self),
-        };
-
-        // We try to be a little clever here as a performance optimization in
-        // cases where there are nested projections under binders.
-        // For example:
-        // ```
-        // for<'a> fn(<T as Foo>::One<'a, Box<dyn Bar<'a, Item=<T as Foo>::Two<'a>>>>)
-        // ```
-        // We normalize the args on the projection before the projecting, but
-        // if we're naive, we'll
-        //   replace bound vars on inner, project inner, replace placeholders on inner,
-        //   replace bound vars on outer, project outer, replace placeholders on outer
-        //
-        // However, if we're a bit more clever, we can replace the bound vars
-        // on the entire type before normalizing nested projections, meaning we
-        //   replace bound vars on outer, project inner,
-        //   project outer, replace placeholders on outer
-        //
-        // This is possible because the inner `'a` will already be a placeholder
-        // when we need to normalize the inner projection
-        //
-        // On the other hand, this does add a bit of complexity, since we only
-        // replace bound vars if the current type is a `Projection` and we need
-        // to make sure we don't forget to fold the args regardless.
-
-        match kind {
-            ty::Opaque => {
-                // Only normalize `impl Trait` outside of type inference, usually in codegen.
-                match self.param_env.reveal() {
-                    Reveal::UserFacing => ty.super_fold_with(self),
-
-                    Reveal::All => {
-                        let recursion_limit = self.interner().recursion_limit();
-                        if !recursion_limit.value_within_limit(self.depth) {
-                            self.selcx.infcx.err_ctxt().report_overflow_error(
-                                &ty,
-                                self.cause.span,
-                                true,
-                                |_| {},
-                            );
-                        }
-
-                        let args = data.args.fold_with(self);
-                        let generic_ty = self.interner().type_of(data.def_id);
-                        let concrete_ty = generic_ty.instantiate(self.interner(), args);
-                        self.depth += 1;
-                        let folded_ty = self.fold_ty(concrete_ty);
-                        self.depth -= 1;
-                        folded_ty
-                    }
-                }
-            }
-
-            ty::Projection if !data.has_escaping_bound_vars() => {
-                // This branch is *mostly* just an optimization: when we don't
-                // have escaping bound vars, we don't need to replace them with
-                // placeholders (see branch below). *Also*, we know that we can
-                // register an obligation to *later* project, since we know
-                // there won't be bound vars there.
-                let data = data.fold_with(self);
-                let normalized_ty = if self.eager_inference_replacement {
-                    normalize_projection_type(
-                        self.selcx,
-                        self.param_env,
-                        data,
-                        self.cause.clone(),
-                        self.depth,
-                        self.obligations,
-                    )
-                } else {
-                    opt_normalize_projection_type(
-                        self.selcx,
-                        self.param_env,
-                        data,
-                        self.cause.clone(),
-                        self.depth,
-                        self.obligations,
-                    )
-                    .ok()
-                    .flatten()
-                    .unwrap_or_else(|| ty.super_fold_with(self).into())
-                };
-                debug!(
-                    ?self.depth,
-                    ?ty,
-                    ?normalized_ty,
-                    obligations.len = ?self.obligations.len(),
-                    "AssocTypeNormalizer: normalized type"
-                );
-                normalized_ty.ty().unwrap()
-            }
-
-            ty::Projection => {
-                // If there are escaping bound vars, we temporarily replace the
-                // bound vars with placeholders. Note though, that in the case
-                // that we still can't project for whatever reason (e.g. self
-                // type isn't known enough), we *can't* register an obligation
-                // and return an inference variable (since then that obligation
-                // would have bound vars and that's a can of worms). Instead,
-                // we just give up and fall back to pretending like we never tried!
-                //
-                // Note: this isn't necessarily the final approach here; we may
-                // want to figure out how to register obligations with escaping vars
-                // or handle this some other way.
-
-                let infcx = self.selcx.infcx;
-                let (data, mapped_regions, mapped_types, mapped_consts) =
-                    BoundVarReplacer::replace_bound_vars(infcx, &mut self.universes, data);
-                let data = data.fold_with(self);
-                let normalized_ty = opt_normalize_projection_type(
-                    self.selcx,
-                    self.param_env,
-                    data,
-                    self.cause.clone(),
-                    self.depth,
-                    self.obligations,
-                )
-                .ok()
-                .flatten()
-                .map(|term| term.ty().unwrap())
-                .map(|normalized_ty| {
-                    PlaceholderReplacer::replace_placeholders(
-                        infcx,
-                        mapped_regions,
-                        mapped_types,
-                        mapped_consts,
-                        &self.universes,
-                        normalized_ty,
-                    )
-                })
-                .unwrap_or_else(|| ty.super_fold_with(self));
-
-                debug!(
-                    ?self.depth,
-                    ?ty,
-                    ?normalized_ty,
-                    obligations.len = ?self.obligations.len(),
-                    "AssocTypeNormalizer: normalized type"
-                );
-                normalized_ty
-            }
-            ty::Weak => {
-                let recursion_limit = self.interner().recursion_limit();
-                if !recursion_limit.value_within_limit(self.depth) {
-                    self.selcx.infcx.err_ctxt().report_overflow_error(
-                        &ty,
-                        self.cause.span,
-                        false,
-                        |diag| {
-                            diag.note(crate::fluent_generated::trait_selection_ty_alias_overflow);
-                        },
-                    );
-                }
-
-                let infcx = self.selcx.infcx;
-                self.obligations.extend(
-                    infcx.tcx.predicates_of(data.def_id).instantiate_own(infcx.tcx, data.args).map(
-                        |(mut predicate, span)| {
-                            if data.has_escaping_bound_vars() {
-                                (predicate, ..) = BoundVarReplacer::replace_bound_vars(
-                                    infcx,
-                                    &mut self.universes,
-                                    predicate,
-                                );
-                            }
-                            let mut cause = self.cause.clone();
-                            cause.map_code(|code| {
-                                ObligationCauseCode::TypeAlias(code, span, data.def_id)
-                            });
-                            Obligation::new(infcx.tcx, cause, self.param_env, predicate)
-                        },
-                    ),
-                );
-                self.depth += 1;
-                let res = infcx
-                    .tcx
-                    .type_of(data.def_id)
-                    .instantiate(infcx.tcx, data.args)
-                    .fold_with(self);
-                self.depth -= 1;
-                res
-            }
-
-            ty::Inherent if !data.has_escaping_bound_vars() => {
-                // This branch is *mostly* just an optimization: when we don't
-                // have escaping bound vars, we don't need to replace them with
-                // placeholders (see branch below). *Also*, we know that we can
-                // register an obligation to *later* project, since we know
-                // there won't be bound vars there.
-
-                let data = data.fold_with(self);
-
-                // FIXME(inherent_associated_types): Do we need to honor `self.eager_inference_replacement`
-                // here like `ty::Projection`?
-                normalize_inherent_projection(
-                    self.selcx,
-                    self.param_env,
-                    data,
-                    self.cause.clone(),
-                    self.depth,
-                    self.obligations,
-                )
-            }
-
-            ty::Inherent => {
-                let infcx = self.selcx.infcx;
-                let (data, mapped_regions, mapped_types, mapped_consts) =
-                    BoundVarReplacer::replace_bound_vars(infcx, &mut self.universes, data);
-                let data = data.fold_with(self);
-                let ty = normalize_inherent_projection(
-                    self.selcx,
-                    self.param_env,
-                    data,
-                    self.cause.clone(),
-                    self.depth,
-                    self.obligations,
-                );
-
-                PlaceholderReplacer::replace_placeholders(
-                    infcx,
-                    mapped_regions,
-                    mapped_types,
-                    mapped_consts,
-                    &self.universes,
-                    ty,
-                )
-            }
-        }
-    }
-
-    #[instrument(skip(self), level = "debug")]
-    fn fold_const(&mut self, constant: ty::Const<'tcx>) -> ty::Const<'tcx> {
-        let tcx = self.selcx.tcx();
-        if tcx.features().generic_const_exprs
-            || !needs_normalization(&constant, self.param_env.reveal())
-        {
-            constant
-        } else {
-            let constant = constant.super_fold_with(self);
-            debug!(?constant, ?self.param_env);
-            with_replaced_escaping_bound_vars(
-                self.selcx.infcx,
-                &mut self.universes,
-                constant,
-                |constant| constant.normalize(tcx, self.param_env),
-            )
-        }
-    }
-
-    #[inline]
-    fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
-        if p.allow_normalization() && needs_normalization(&p, self.param_env.reveal()) {
-            p.super_fold_with(self)
-        } else {
-            p
-        }
-    }
-}
-
-pub struct BoundVarReplacer<'me, 'tcx> {
-    infcx: &'me InferCtxt<'tcx>,
-    // These three maps track the bound variable that were replaced by placeholders. It might be
-    // nice to remove these since we already have the `kind` in the placeholder; we really just need
-    // the `var` (but we *could* bring that into scope if we were to track them as we pass them).
-    mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
-    mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
-    mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
-    // The current depth relative to *this* folding, *not* the entire normalization. In other words,
-    // the depth of binders we've passed here.
-    current_index: ty::DebruijnIndex,
-    // The `UniverseIndex` of the binding levels above us. These are optional, since we are lazy:
-    // we don't actually create a universe until we see a bound var we have to replace.
-    universe_indices: &'me mut Vec<Option<ty::UniverseIndex>>,
-}
-
-/// Executes `f` on `value` after replacing all escaping bound variables with placeholders
-/// and then replaces these placeholders with the original bound variables in the result.
-///
-/// In most places, bound variables should be replaced right when entering a binder, making
-/// this function unnecessary. However, normalization currently does not do that, so we have
-/// to do this lazily.
-///
-/// You should not add any additional uses of this function, at least not without first
-/// discussing it with t-types.
-///
-/// FIXME(@lcnr): We may even consider experimenting with eagerly replacing bound vars during
-/// normalization as well, at which point this function will be unnecessary and can be removed.
-pub fn with_replaced_escaping_bound_vars<
-    'a,
-    'tcx,
-    T: TypeFoldable<TyCtxt<'tcx>>,
-    R: TypeFoldable<TyCtxt<'tcx>>,
->(
-    infcx: &'a InferCtxt<'tcx>,
-    universe_indices: &'a mut Vec<Option<ty::UniverseIndex>>,
-    value: T,
-    f: impl FnOnce(T) -> R,
-) -> R {
-    if value.has_escaping_bound_vars() {
-        let (value, mapped_regions, mapped_types, mapped_consts) =
-            BoundVarReplacer::replace_bound_vars(infcx, universe_indices, value);
-        let result = f(value);
-        PlaceholderReplacer::replace_placeholders(
-            infcx,
-            mapped_regions,
-            mapped_types,
-            mapped_consts,
-            universe_indices,
-            result,
-        )
-    } else {
-        f(value)
-    }
-}
-
-impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
-    /// Returns `Some` if we *were* able to replace bound vars. If there are any bound vars that
-    /// use a binding level above `universe_indices.len()`, we fail.
-    pub fn replace_bound_vars<T: TypeFoldable<TyCtxt<'tcx>>>(
-        infcx: &'me InferCtxt<'tcx>,
-        universe_indices: &'me mut Vec<Option<ty::UniverseIndex>>,
-        value: T,
-    ) -> (
-        T,
-        BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
-        BTreeMap<ty::PlaceholderType, ty::BoundTy>,
-        BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
-    ) {
-        let mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion> = BTreeMap::new();
-        let mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy> = BTreeMap::new();
-        let mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar> = BTreeMap::new();
-
-        let mut replacer = BoundVarReplacer {
-            infcx,
-            mapped_regions,
-            mapped_types,
-            mapped_consts,
-            current_index: ty::INNERMOST,
-            universe_indices,
-        };
-
-        let value = value.fold_with(&mut replacer);
-
-        (value, replacer.mapped_regions, replacer.mapped_types, replacer.mapped_consts)
-    }
-
-    fn universe_for(&mut self, debruijn: ty::DebruijnIndex) -> ty::UniverseIndex {
-        let infcx = self.infcx;
-        let index =
-            self.universe_indices.len() + self.current_index.as_usize() - debruijn.as_usize() - 1;
-        let universe = self.universe_indices[index].unwrap_or_else(|| {
-            for i in self.universe_indices.iter_mut().take(index + 1) {
-                *i = i.or_else(|| Some(infcx.create_next_universe()))
-            }
-            self.universe_indices[index].unwrap()
-        });
-        universe
-    }
-}
-
-impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
-    fn interner(&self) -> TyCtxt<'tcx> {
-        self.infcx.tcx
-    }
-
-    fn fold_binder<T: TypeFoldable<TyCtxt<'tcx>>>(
-        &mut self,
-        t: ty::Binder<'tcx, T>,
-    ) -> ty::Binder<'tcx, T> {
-        self.current_index.shift_in(1);
-        let t = t.super_fold_with(self);
-        self.current_index.shift_out(1);
-        t
-    }
-
-    fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
-        match *r {
-            ty::ReBound(debruijn, _)
-                if debruijn.as_usize()
-                    >= self.current_index.as_usize() + self.universe_indices.len() =>
-            {
-                bug!(
-                    "Bound vars {r:#?} outside of `self.universe_indices`: {:#?}",
-                    self.universe_indices
-                );
-            }
-            ty::ReBound(debruijn, br) if debruijn >= self.current_index => {
-                let universe = self.universe_for(debruijn);
-                let p = ty::PlaceholderRegion { universe, bound: br };
-                self.mapped_regions.insert(p, br);
-                ty::Region::new_placeholder(self.infcx.tcx, p)
-            }
-            _ => r,
-        }
-    }
-
-    fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
-        match *t.kind() {
-            ty::Bound(debruijn, _)
-                if debruijn.as_usize() + 1
-                    > self.current_index.as_usize() + self.universe_indices.len() =>
-            {
-                bug!(
-                    "Bound vars {t:#?} outside of `self.universe_indices`: {:#?}",
-                    self.universe_indices
-                );
-            }
-            ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
-                let universe = self.universe_for(debruijn);
-                let p = ty::PlaceholderType { universe, bound: bound_ty };
-                self.mapped_types.insert(p, bound_ty);
-                Ty::new_placeholder(self.infcx.tcx, p)
-            }
-            _ if t.has_vars_bound_at_or_above(self.current_index) => t.super_fold_with(self),
-            _ => t,
-        }
-    }
-
-    fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
-        match ct.kind() {
-            ty::ConstKind::Bound(debruijn, _)
-                if debruijn.as_usize() + 1
-                    > self.current_index.as_usize() + self.universe_indices.len() =>
-            {
-                bug!(
-                    "Bound vars {ct:#?} outside of `self.universe_indices`: {:#?}",
-                    self.universe_indices
-                );
-            }
-            ty::ConstKind::Bound(debruijn, bound_const) if debruijn >= self.current_index => {
-                let universe = self.universe_for(debruijn);
-                let p = ty::PlaceholderConst { universe, bound: bound_const };
-                self.mapped_consts.insert(p, bound_const);
-                ty::Const::new_placeholder(self.infcx.tcx, p, ct.ty())
-            }
-            _ => ct.super_fold_with(self),
-        }
-    }
-
-    fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
-        if p.has_vars_bound_at_or_above(self.current_index) { p.super_fold_with(self) } else { p }
-    }
-}
-
-/// The inverse of [`BoundVarReplacer`]: replaces placeholders with the bound vars from which they came.
-pub struct PlaceholderReplacer<'me, 'tcx> {
-    infcx: &'me InferCtxt<'tcx>,
-    mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
-    mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
-    mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
-    universe_indices: &'me [Option<ty::UniverseIndex>],
-    current_index: ty::DebruijnIndex,
-}
-
-impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
-    pub fn replace_placeholders<T: TypeFoldable<TyCtxt<'tcx>>>(
-        infcx: &'me InferCtxt<'tcx>,
-        mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
-        mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
-        mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
-        universe_indices: &'me [Option<ty::UniverseIndex>],
-        value: T,
-    ) -> T {
-        let mut replacer = PlaceholderReplacer {
-            infcx,
-            mapped_regions,
-            mapped_types,
-            mapped_consts,
-            universe_indices,
-            current_index: ty::INNERMOST,
-        };
-        value.fold_with(&mut replacer)
-    }
-}
-
-impl<'tcx> TypeFolder<TyCtxt<'tcx>> for PlaceholderReplacer<'_, 'tcx> {
-    fn interner(&self) -> TyCtxt<'tcx> {
-        self.infcx.tcx
-    }
-
-    fn fold_binder<T: TypeFoldable<TyCtxt<'tcx>>>(
-        &mut self,
-        t: ty::Binder<'tcx, T>,
-    ) -> ty::Binder<'tcx, T> {
-        if !t.has_placeholders() && !t.has_infer() {
-            return t;
-        }
-        self.current_index.shift_in(1);
-        let t = t.super_fold_with(self);
-        self.current_index.shift_out(1);
-        t
-    }
-
-    fn fold_region(&mut self, r0: ty::Region<'tcx>) -> ty::Region<'tcx> {
-        let r1 = match *r0 {
-            ty::ReVar(vid) => self
-                .infcx
-                .inner
-                .borrow_mut()
-                .unwrap_region_constraints()
-                .opportunistic_resolve_var(self.infcx.tcx, vid),
-            _ => r0,
-        };
-
-        let r2 = match *r1 {
-            ty::RePlaceholder(p) => {
-                let replace_var = self.mapped_regions.get(&p);
-                match replace_var {
-                    Some(replace_var) => {
-                        let index = self
-                            .universe_indices
-                            .iter()
-                            .position(|u| matches!(u, Some(pu) if *pu == p.universe))
-                            .unwrap_or_else(|| bug!("Unexpected placeholder universe."));
-                        let db = ty::DebruijnIndex::from_usize(
-                            self.universe_indices.len() - index + self.current_index.as_usize() - 1,
-                        );
-                        ty::Region::new_bound(self.interner(), db, *replace_var)
-                    }
-                    None => r1,
-                }
-            }
-            _ => r1,
-        };
-
-        debug!(?r0, ?r1, ?r2, "fold_region");
-
-        r2
-    }
-
-    fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
-        let ty = self.infcx.shallow_resolve(ty);
-        match *ty.kind() {
-            ty::Placeholder(p) => {
-                let replace_var = self.mapped_types.get(&p);
-                match replace_var {
-                    Some(replace_var) => {
-                        let index = self
-                            .universe_indices
-                            .iter()
-                            .position(|u| matches!(u, Some(pu) if *pu == p.universe))
-                            .unwrap_or_else(|| bug!("Unexpected placeholder universe."));
-                        let db = ty::DebruijnIndex::from_usize(
-                            self.universe_indices.len() - index + self.current_index.as_usize() - 1,
-                        );
-                        Ty::new_bound(self.infcx.tcx, db, *replace_var)
-                    }
-                    None => {
-                        if ty.has_infer() {
-                            ty.super_fold_with(self)
-                        } else {
-                            ty
-                        }
-                    }
-                }
-            }
-
-            _ if ty.has_placeholders() || ty.has_infer() => ty.super_fold_with(self),
-            _ => ty,
-        }
-    }
-
-    fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
-        let ct = self.infcx.shallow_resolve(ct);
-        if let ty::ConstKind::Placeholder(p) = ct.kind() {
-            let replace_var = self.mapped_consts.get(&p);
-            match replace_var {
-                Some(replace_var) => {
-                    let index = self
-                        .universe_indices
-                        .iter()
-                        .position(|u| matches!(u, Some(pu) if *pu == p.universe))
-                        .unwrap_or_else(|| bug!("Unexpected placeholder universe."));
-                    let db = ty::DebruijnIndex::from_usize(
-                        self.universe_indices.len() - index + self.current_index.as_usize() - 1,
-                    );
-                    ty::Const::new_bound(self.infcx.tcx, db, *replace_var, ct.ty())
-                }
-                None => {
-                    if ct.has_infer() {
-                        ct.super_fold_with(self)
-                    } else {
-                        ct
-                    }
-                }
-            }
-        } else {
-            ct.super_fold_with(self)
-        }
-    }
-}
-
 /// The guts of `normalize`: normalize a specific projection like `<T
 /// as Trait>::Item`. The result is always a type (and possibly
 /// additional obligations). If ambiguity arises, which implies that
@@ -1146,7 +329,7 @@ pub fn normalize_projection_type<'a, 'b, 'tcx>(
 /// function takes an obligations vector and appends to it directly, which is
 /// slightly uglier but avoids the need for an extra short-lived allocation.
 #[instrument(level = "debug", skip(selcx, param_env, cause, obligations))]
-fn opt_normalize_projection_type<'a, 'b, 'tcx>(
+pub(super) fn opt_normalize_projection_type<'a, 'b, 'tcx>(
     selcx: &'a mut SelectionContext<'b, 'tcx>,
     param_env: ty::ParamEnv<'tcx>,
     projection_ty: ty::AliasTy<'tcx>,
@@ -1250,14 +433,14 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
             let projected_term = selcx.infcx.resolve_vars_if_possible(projected_term);
 
             let mut result = if projected_term.has_projections() {
-                let mut normalizer = AssocTypeNormalizer::new(
+                let normalized_ty = normalize_with_depth_to(
                     selcx,
                     param_env,
                     cause,
                     depth + 1,
+                    projected_term,
                     &mut projected_obligations,
                 );
-                let normalized_ty = normalizer.fold(projected_term);
 
                 Normalized { value: normalized_ty, obligations: projected_obligations }
             } else {
diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs
index 0f6c0abd280..26da065246d 100644
--- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs
@@ -6,7 +6,8 @@ use crate::infer::at::At;
 use crate::infer::canonical::OriginalQueryValues;
 use crate::infer::{InferCtxt, InferOk};
 use crate::traits::error_reporting::TypeErrCtxtExt;
-use crate::traits::project::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};
+use crate::traits::normalize::needs_normalization;
+use crate::traits::{BoundVarReplacer, PlaceholderReplacer};
 use crate::traits::{ObligationCause, PredicateObligation, Reveal};
 use rustc_data_structures::sso::SsoHashMap;
 use rustc_data_structures::stack::ensure_sufficient_stack;
@@ -335,7 +336,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
 
         let constant = constant.try_super_fold_with(self)?;
         debug!(?constant, ?self.param_env);
-        Ok(crate::traits::project::with_replaced_escaping_bound_vars(
+        Ok(crate::traits::with_replaced_escaping_bound_vars(
             self.infcx,
             &mut self.universes,
             constant,
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
index e4a70c537d2..f76be876948 100644
--- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
@@ -18,7 +18,7 @@ use rustc_middle::ty::{
 };
 use rustc_span::def_id::DefId;
 
-use crate::traits::project::{normalize_with_depth, normalize_with_depth_to};
+use crate::traits::normalize::{normalize_with_depth, normalize_with_depth_to};
 use crate::traits::util::{self, closure_trait_ref_and_return_type};
 use crate::traits::vtable::{
     count_own_vtable_entries, prepare_vtable_segments, vtable_trait_first_method_offset,
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 5bcf46a96ed..1146f869fc1 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -8,7 +8,6 @@ use self::SelectionCandidate::*;
 use super::coherence::{self, Conflict};
 use super::const_evaluatable;
 use super::project;
-use super::project::normalize_with_depth_to;
 use super::project::ProjectionTyObligation;
 use super::util;
 use super::util::closure_trait_ref_and_return_type;
@@ -22,14 +21,15 @@ use super::{
 use crate::infer::{InferCtxt, InferOk, TypeFreshener};
 use crate::solve::InferCtxtSelectExt;
 use crate::traits::error_reporting::TypeErrCtxtExt;
-use crate::traits::project::try_normalize_with_depth_to;
+use crate::traits::normalize::normalize_with_depth;
+use crate::traits::normalize::normalize_with_depth_to;
 use crate::traits::project::ProjectAndUnifyResult;
 use crate::traits::project::ProjectionCacheKeyExt;
 use crate::traits::ProjectionCacheKey;
 use crate::traits::Unimplemented;
 use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
 use rustc_data_structures::stack::ensure_sufficient_stack;
-use rustc_errors::Diagnostic;
+use rustc_errors::{DiagnosticBuilder, EmissionGuarantee};
 use rustc_hir as hir;
 use rustc_hir::def_id::DefId;
 use rustc_infer::infer::BoundRegionConversionTime;
@@ -70,7 +70,10 @@ pub enum IntercrateAmbiguityCause<'tcx> {
 impl<'tcx> IntercrateAmbiguityCause<'tcx> {
     /// Emits notes when the overlap is caused by complex intercrate ambiguities.
     /// See #23980 for details.
-    pub fn add_intercrate_ambiguity_hint(&self, err: &mut Diagnostic) {
+    pub fn add_intercrate_ambiguity_hint<G: EmissionGuarantee>(
+        &self,
+        err: &mut DiagnosticBuilder<'_, G>,
+    ) {
         err.note(self.intercrate_ambiguity_hint());
     }
 
@@ -1070,7 +1073,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 && fresh_trait_pred.is_global()
             {
                 let mut nested_obligations = Vec::new();
-                let predicate = try_normalize_with_depth_to(
+                let predicate = normalize_with_depth_to(
                     this,
                     param_env,
                     obligation.cause.clone(),
@@ -1662,7 +1665,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         }
 
         let Normalized { value: trait_bound, obligations: _ } = ensure_sufficient_stack(|| {
-            project::normalize_with_depth(
+            normalize_with_depth(
                 self,
                 obligation.param_env,
                 obligation.cause.clone(),
@@ -1718,7 +1721,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         );
         let infer_projection = if potentially_unnormalized_candidates {
             ensure_sufficient_stack(|| {
-                project::normalize_with_depth_to(
+                normalize_with_depth_to(
                     self,
                     obligation.param_env,
                     obligation.cause.clone(),
@@ -2383,7 +2386,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
                 let placeholder_ty = self.infcx.enter_forall_and_leak_universe(ty);
                 let Normalized { value: normalized_ty, mut obligations } =
                     ensure_sufficient_stack(|| {
-                        project::normalize_with_depth(
+                        normalize_with_depth(
                             self,
                             param_env,
                             cause.clone(),
@@ -2480,7 +2483,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
 
         let Normalized { value: impl_trait_ref, obligations: mut nested_obligations } =
             ensure_sufficient_stack(|| {
-                project::normalize_with_depth(
+                normalize_with_depth(
                     self,
                     obligation.param_env,
                     obligation.cause.clone(),
diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
index e1a49ecf1b6..56bc2f2cf25 100644
--- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
@@ -20,7 +20,7 @@ use crate::traits::{
     self, coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt,
 };
 use rustc_data_structures::fx::FxIndexSet;
-use rustc_errors::{codes::*, DelayDm, Diagnostic};
+use rustc_errors::{codes::*, DelayDm, DiagnosticBuilder, EmissionGuarantee};
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt, TypeVisitableExt};
 use rustc_middle::ty::{GenericArgs, GenericArgsRef};
@@ -395,11 +395,11 @@ fn report_conflicting_impls<'tcx>(
     // Work to be done after we've built the DiagnosticBuilder. We have to define it
     // now because the lint emit methods don't return back the DiagnosticBuilder
     // that's passed in.
-    fn decorate<'tcx>(
+    fn decorate<'tcx, G: EmissionGuarantee>(
         tcx: TyCtxt<'tcx>,
         overlap: &OverlapError<'tcx>,
         impl_span: Span,
-        err: &mut Diagnostic,
+        err: &mut DiagnosticBuilder<'_, G>,
     ) {
         if (overlap.trait_ref, overlap.self_ty).references_error() {
             err.downgrade_to_delayed_bug();
diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs
index af172eb0713..d66c4004ef5 100644
--- a/compiler/rustc_trait_selection/src/traits/util.rs
+++ b/compiler/rustc_trait_selection/src/traits/util.rs
@@ -1,11 +1,14 @@
+use std::collections::BTreeMap;
+
 use super::NormalizeExt;
 use super::{ObligationCause, PredicateObligation, SelectionContext};
 use rustc_data_structures::fx::FxHashSet;
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_hir::def_id::DefId;
-use rustc_infer::infer::InferOk;
+use rustc_infer::infer::{InferCtxt, InferOk};
 use rustc_middle::ty::GenericArgsRef;
 use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitableExt};
+use rustc_middle::ty::{TypeFoldable, TypeFolder, TypeSuperFoldable};
 use rustc_span::Span;
 use smallvec::SmallVec;
 
@@ -43,7 +46,7 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> {
     /// trait aliases.
     pub fn label_with_exp_info(
         &self,
-        diag: &mut Diagnostic,
+        diag: &mut DiagnosticBuilder<'_>,
         top_label: &'static str,
         use_desc: &str,
     ) {
@@ -382,3 +385,336 @@ pub fn check_args_compatible<'tcx>(
     let args = &args[0..generics.count().min(args.len())];
     check_args_compatible_inner(tcx, generics, args)
 }
+
+/// Executes `f` on `value` after replacing all escaping bound variables with placeholders
+/// and then replaces these placeholders with the original bound variables in the result.
+///
+/// In most places, bound variables should be replaced right when entering a binder, making
+/// this function unnecessary. However, normalization currently does not do that, so we have
+/// to do this lazily.
+///
+/// You should not add any additional uses of this function, at least not without first
+/// discussing it with t-types.
+///
+/// FIXME(@lcnr): We may even consider experimenting with eagerly replacing bound vars during
+/// normalization as well, at which point this function will be unnecessary and can be removed.
+pub fn with_replaced_escaping_bound_vars<
+    'a,
+    'tcx,
+    T: TypeFoldable<TyCtxt<'tcx>>,
+    R: TypeFoldable<TyCtxt<'tcx>>,
+>(
+    infcx: &'a InferCtxt<'tcx>,
+    universe_indices: &'a mut Vec<Option<ty::UniverseIndex>>,
+    value: T,
+    f: impl FnOnce(T) -> R,
+) -> R {
+    if value.has_escaping_bound_vars() {
+        let (value, mapped_regions, mapped_types, mapped_consts) =
+            BoundVarReplacer::replace_bound_vars(infcx, universe_indices, value);
+        let result = f(value);
+        PlaceholderReplacer::replace_placeholders(
+            infcx,
+            mapped_regions,
+            mapped_types,
+            mapped_consts,
+            universe_indices,
+            result,
+        )
+    } else {
+        f(value)
+    }
+}
+
+pub struct BoundVarReplacer<'me, 'tcx> {
+    infcx: &'me InferCtxt<'tcx>,
+    // These three maps track the bound variable that were replaced by placeholders. It might be
+    // nice to remove these since we already have the `kind` in the placeholder; we really just need
+    // the `var` (but we *could* bring that into scope if we were to track them as we pass them).
+    mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
+    mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
+    mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
+    // The current depth relative to *this* folding, *not* the entire normalization. In other words,
+    // the depth of binders we've passed here.
+    current_index: ty::DebruijnIndex,
+    // The `UniverseIndex` of the binding levels above us. These are optional, since we are lazy:
+    // we don't actually create a universe until we see a bound var we have to replace.
+    universe_indices: &'me mut Vec<Option<ty::UniverseIndex>>,
+}
+
+impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
+    /// Returns `Some` if we *were* able to replace bound vars. If there are any bound vars that
+    /// use a binding level above `universe_indices.len()`, we fail.
+    pub fn replace_bound_vars<T: TypeFoldable<TyCtxt<'tcx>>>(
+        infcx: &'me InferCtxt<'tcx>,
+        universe_indices: &'me mut Vec<Option<ty::UniverseIndex>>,
+        value: T,
+    ) -> (
+        T,
+        BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
+        BTreeMap<ty::PlaceholderType, ty::BoundTy>,
+        BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
+    ) {
+        let mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion> = BTreeMap::new();
+        let mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy> = BTreeMap::new();
+        let mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar> = BTreeMap::new();
+
+        let mut replacer = BoundVarReplacer {
+            infcx,
+            mapped_regions,
+            mapped_types,
+            mapped_consts,
+            current_index: ty::INNERMOST,
+            universe_indices,
+        };
+
+        let value = value.fold_with(&mut replacer);
+
+        (value, replacer.mapped_regions, replacer.mapped_types, replacer.mapped_consts)
+    }
+
+    fn universe_for(&mut self, debruijn: ty::DebruijnIndex) -> ty::UniverseIndex {
+        let infcx = self.infcx;
+        let index =
+            self.universe_indices.len() + self.current_index.as_usize() - debruijn.as_usize() - 1;
+        let universe = self.universe_indices[index].unwrap_or_else(|| {
+            for i in self.universe_indices.iter_mut().take(index + 1) {
+                *i = i.or_else(|| Some(infcx.create_next_universe()))
+            }
+            self.universe_indices[index].unwrap()
+        });
+        universe
+    }
+}
+
+impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
+    fn interner(&self) -> TyCtxt<'tcx> {
+        self.infcx.tcx
+    }
+
+    fn fold_binder<T: TypeFoldable<TyCtxt<'tcx>>>(
+        &mut self,
+        t: ty::Binder<'tcx, T>,
+    ) -> ty::Binder<'tcx, T> {
+        self.current_index.shift_in(1);
+        let t = t.super_fold_with(self);
+        self.current_index.shift_out(1);
+        t
+    }
+
+    fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
+        match *r {
+            ty::ReBound(debruijn, _)
+                if debruijn.as_usize()
+                    >= self.current_index.as_usize() + self.universe_indices.len() =>
+            {
+                bug!(
+                    "Bound vars {r:#?} outside of `self.universe_indices`: {:#?}",
+                    self.universe_indices
+                );
+            }
+            ty::ReBound(debruijn, br) if debruijn >= self.current_index => {
+                let universe = self.universe_for(debruijn);
+                let p = ty::PlaceholderRegion { universe, bound: br };
+                self.mapped_regions.insert(p, br);
+                ty::Region::new_placeholder(self.infcx.tcx, p)
+            }
+            _ => r,
+        }
+    }
+
+    fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
+        match *t.kind() {
+            ty::Bound(debruijn, _)
+                if debruijn.as_usize() + 1
+                    > self.current_index.as_usize() + self.universe_indices.len() =>
+            {
+                bug!(
+                    "Bound vars {t:#?} outside of `self.universe_indices`: {:#?}",
+                    self.universe_indices
+                );
+            }
+            ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
+                let universe = self.universe_for(debruijn);
+                let p = ty::PlaceholderType { universe, bound: bound_ty };
+                self.mapped_types.insert(p, bound_ty);
+                Ty::new_placeholder(self.infcx.tcx, p)
+            }
+            _ if t.has_vars_bound_at_or_above(self.current_index) => t.super_fold_with(self),
+            _ => t,
+        }
+    }
+
+    fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
+        match ct.kind() {
+            ty::ConstKind::Bound(debruijn, _)
+                if debruijn.as_usize() + 1
+                    > self.current_index.as_usize() + self.universe_indices.len() =>
+            {
+                bug!(
+                    "Bound vars {ct:#?} outside of `self.universe_indices`: {:#?}",
+                    self.universe_indices
+                );
+            }
+            ty::ConstKind::Bound(debruijn, bound_const) if debruijn >= self.current_index => {
+                let universe = self.universe_for(debruijn);
+                let p = ty::PlaceholderConst { universe, bound: bound_const };
+                self.mapped_consts.insert(p, bound_const);
+                ty::Const::new_placeholder(self.infcx.tcx, p, ct.ty())
+            }
+            _ => ct.super_fold_with(self),
+        }
+    }
+
+    fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
+        if p.has_vars_bound_at_or_above(self.current_index) { p.super_fold_with(self) } else { p }
+    }
+}
+
+/// The inverse of [`BoundVarReplacer`]: replaces placeholders with the bound vars from which they came.
+pub struct PlaceholderReplacer<'me, 'tcx> {
+    infcx: &'me InferCtxt<'tcx>,
+    mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
+    mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
+    mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
+    universe_indices: &'me [Option<ty::UniverseIndex>],
+    current_index: ty::DebruijnIndex,
+}
+
+impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
+    pub fn replace_placeholders<T: TypeFoldable<TyCtxt<'tcx>>>(
+        infcx: &'me InferCtxt<'tcx>,
+        mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
+        mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
+        mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
+        universe_indices: &'me [Option<ty::UniverseIndex>],
+        value: T,
+    ) -> T {
+        let mut replacer = PlaceholderReplacer {
+            infcx,
+            mapped_regions,
+            mapped_types,
+            mapped_consts,
+            universe_indices,
+            current_index: ty::INNERMOST,
+        };
+        value.fold_with(&mut replacer)
+    }
+}
+
+impl<'tcx> TypeFolder<TyCtxt<'tcx>> for PlaceholderReplacer<'_, 'tcx> {
+    fn interner(&self) -> TyCtxt<'tcx> {
+        self.infcx.tcx
+    }
+
+    fn fold_binder<T: TypeFoldable<TyCtxt<'tcx>>>(
+        &mut self,
+        t: ty::Binder<'tcx, T>,
+    ) -> ty::Binder<'tcx, T> {
+        if !t.has_placeholders() && !t.has_infer() {
+            return t;
+        }
+        self.current_index.shift_in(1);
+        let t = t.super_fold_with(self);
+        self.current_index.shift_out(1);
+        t
+    }
+
+    fn fold_region(&mut self, r0: ty::Region<'tcx>) -> ty::Region<'tcx> {
+        let r1 = match *r0 {
+            ty::ReVar(vid) => self
+                .infcx
+                .inner
+                .borrow_mut()
+                .unwrap_region_constraints()
+                .opportunistic_resolve_var(self.infcx.tcx, vid),
+            _ => r0,
+        };
+
+        let r2 = match *r1 {
+            ty::RePlaceholder(p) => {
+                let replace_var = self.mapped_regions.get(&p);
+                match replace_var {
+                    Some(replace_var) => {
+                        let index = self
+                            .universe_indices
+                            .iter()
+                            .position(|u| matches!(u, Some(pu) if *pu == p.universe))
+                            .unwrap_or_else(|| bug!("Unexpected placeholder universe."));
+                        let db = ty::DebruijnIndex::from_usize(
+                            self.universe_indices.len() - index + self.current_index.as_usize() - 1,
+                        );
+                        ty::Region::new_bound(self.interner(), db, *replace_var)
+                    }
+                    None => r1,
+                }
+            }
+            _ => r1,
+        };
+
+        debug!(?r0, ?r1, ?r2, "fold_region");
+
+        r2
+    }
+
+    fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
+        let ty = self.infcx.shallow_resolve(ty);
+        match *ty.kind() {
+            ty::Placeholder(p) => {
+                let replace_var = self.mapped_types.get(&p);
+                match replace_var {
+                    Some(replace_var) => {
+                        let index = self
+                            .universe_indices
+                            .iter()
+                            .position(|u| matches!(u, Some(pu) if *pu == p.universe))
+                            .unwrap_or_else(|| bug!("Unexpected placeholder universe."));
+                        let db = ty::DebruijnIndex::from_usize(
+                            self.universe_indices.len() - index + self.current_index.as_usize() - 1,
+                        );
+                        Ty::new_bound(self.infcx.tcx, db, *replace_var)
+                    }
+                    None => {
+                        if ty.has_infer() {
+                            ty.super_fold_with(self)
+                        } else {
+                            ty
+                        }
+                    }
+                }
+            }
+
+            _ if ty.has_placeholders() || ty.has_infer() => ty.super_fold_with(self),
+            _ => ty,
+        }
+    }
+
+    fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
+        let ct = self.infcx.shallow_resolve(ct);
+        if let ty::ConstKind::Placeholder(p) = ct.kind() {
+            let replace_var = self.mapped_consts.get(&p);
+            match replace_var {
+                Some(replace_var) => {
+                    let index = self
+                        .universe_indices
+                        .iter()
+                        .position(|u| matches!(u, Some(pu) if *pu == p.universe))
+                        .unwrap_or_else(|| bug!("Unexpected placeholder universe."));
+                    let db = ty::DebruijnIndex::from_usize(
+                        self.universe_indices.len() - index + self.current_index.as_usize() - 1,
+                    );
+                    ty::Const::new_bound(self.infcx.tcx, db, *replace_var, ct.ty())
+                }
+                None => {
+                    if ct.has_infer() {
+                        ct.super_fold_with(self)
+                    } else {
+                        ct
+                    }
+                }
+            }
+        } else {
+            ct.super_fold_with(self)
+        }
+    }
+}
diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs
index c727ef53d55..15059bc6613 100644
--- a/compiler/rustc_trait_selection/src/traits/wf.rs
+++ b/compiler/rustc_trait_selection/src/traits/wf.rs
@@ -313,7 +313,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
             // Don't normalize the whole obligation, the param env is either
             // already normalized, or we're currently normalizing the
             // param_env. Either way we should only normalize the predicate.
-            let normalized_predicate = traits::project::normalize_with_depth_to(
+            let normalized_predicate = traits::normalize::normalize_with_depth_to(
                 &mut selcx,
                 param_env,
                 cause.clone(),
diff --git a/compiler/rustc_traits/src/normalize_projection_ty.rs b/compiler/rustc_traits/src/normalize_projection_ty.rs
index 07089d5f19e..94df28a1454 100644
--- a/compiler/rustc_traits/src/normalize_projection_ty.rs
+++ b/compiler/rustc_traits/src/normalize_projection_ty.rs
@@ -25,10 +25,10 @@ fn normalize_projection_ty<'tcx>(
     goal: CanonicalProjectionGoal<'tcx>,
 ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> {
     debug!("normalize_provider(goal={:#?})", goal);
-
     tcx.infer_ctxt().enter_canonical_trait_query(
         &goal,
         |ocx, ParamEnvAnd { param_env, value: goal }| {
+            debug_assert!(!ocx.infcx.next_trait_solver());
             let selcx = &mut SelectionContext::new(ocx.infcx);
             let cause = ObligationCause::dummy();
             let mut obligations = vec![];
@@ -45,23 +45,22 @@ fn normalize_projection_ty<'tcx>(
             // are recursive (given some generic parameters of the opaque's type variables).
             // In that case, we may only realize a cycle error when calling
             // `normalize_erasing_regions` in mono.
-            if !ocx.infcx.next_trait_solver() {
-                let errors = ocx.select_where_possible();
-                if !errors.is_empty() {
-                    // Rustdoc may attempt to normalize type alias types which are not
-                    // well-formed. Rustdoc also normalizes types that are just not
-                    // well-formed, since we don't do as much HIR analysis (checking
-                    // that impl vars are constrained by the signature, for example).
-                    if !tcx.sess.opts.actually_rustdoc {
-                        for error in &errors {
-                            if let FulfillmentErrorCode::Cycle(cycle) = &error.code {
-                                ocx.infcx.err_ctxt().report_overflow_obligation_cycle(cycle);
-                            }
+            let errors = ocx.select_where_possible();
+            if !errors.is_empty() {
+                // Rustdoc may attempt to normalize type alias types which are not
+                // well-formed. Rustdoc also normalizes types that are just not
+                // well-formed, since we don't do as much HIR analysis (checking
+                // that impl vars are constrained by the signature, for example).
+                if !tcx.sess.opts.actually_rustdoc {
+                    for error in &errors {
+                        if let FulfillmentErrorCode::Cycle(cycle) = &error.code {
+                            ocx.infcx.err_ctxt().report_overflow_obligation_cycle(cycle);
                         }
                     }
-                    return Err(NoSolution);
                 }
+                return Err(NoSolution);
             }
+
             // FIXME(associated_const_equality): All users of normalize_projection_ty expected
             // a type, but there is the possibility it could've been a const now. Maybe change
             // it to a Term later?
diff --git a/compiler/stable_mir/src/error.rs b/compiler/stable_mir/src/error.rs
index 7085fa937c9..9e3f4936944 100644
--- a/compiler/stable_mir/src/error.rs
+++ b/compiler/stable_mir/src/error.rs
@@ -15,10 +15,8 @@ macro_rules! error {
 /// An error type used to represent an error that has already been reported by the compiler.
 #[derive(Clone, Copy, PartialEq, Eq)]
 pub enum CompilerError<T> {
-    /// Internal compiler error (I.e.: Compiler crashed).
-    ICE,
-    /// Compilation failed.
-    CompilationFailed,
+    /// Compilation failed, either due to normal errors or ICE.
+    Failed,
     /// Compilation was interrupted.
     Interrupted(T),
     /// Compilation skipped. This happens when users invoke rustc to retrieve information such as
@@ -54,8 +52,7 @@ where
 {
     fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
         match self {
-            CompilerError::ICE => write!(f, "Internal Compiler Error"),
-            CompilerError::CompilationFailed => write!(f, "Compilation Failed"),
+            CompilerError::Failed => write!(f, "Compilation Failed"),
             CompilerError::Interrupted(reason) => write!(f, "Compilation Interrupted: {reason}"),
             CompilerError::Skipped => write!(f, "Compilation Skipped"),
         }
@@ -68,8 +65,7 @@ where
 {
     fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
         match self {
-            CompilerError::ICE => write!(f, "Internal Compiler Error"),
-            CompilerError::CompilationFailed => write!(f, "Compilation Failed"),
+            CompilerError::Failed => write!(f, "Compilation Failed"),
             CompilerError::Interrupted(reason) => write!(f, "Compilation Interrupted: {reason:?}"),
             CompilerError::Skipped => write!(f, "Compilation Skipped"),
         }
diff --git a/config.example.toml b/config.example.toml
index 098811195d7..cef33a7905a 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -612,6 +612,10 @@
 # Indicates whether symbols should be stripped using `-Cstrip=symbols`.
 #strip = false
 
+# Forces frame pointers to be used with `-Cforce-frame-pointers`.
+# This can be helpful for profiling at a small performance cost.
+# frame-pointers = false
+
 # Indicates whether stack protectors should be used
 # via the unstable option `-Zstack-protector`.
 #
@@ -829,7 +833,7 @@
 # target triples containing `-none`, `nvptx`, `switch`, or `-uefi`.
 #no-std = <platform-specific> (bool)
 
-# This is an array of the codegen backends that will be compiled a rustc
+# This is an array of the codegen backends that will be
 # compiled for this target, overriding the global rust.codegen-backends option.
 # See that option for more info.
 #codegen-backends = rust.codegen-backends (array)
diff --git a/library/alloc/src/raw_vec.rs b/library/alloc/src/raw_vec.rs
index 49f5f53f9b3..dd8d6f6c7e6 100644
--- a/library/alloc/src/raw_vec.rs
+++ b/library/alloc/src/raw_vec.rs
@@ -261,7 +261,7 @@ impl<T, A: Allocator> RawVec<T, A> {
             // and could hypothetically handle differences between stride and size, but this memory
             // has already been allocated so we know it can't overflow and currently rust does not
             // support such types. So we can do better by skipping some checks and avoid an unwrap.
-            let _: () = const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
+            const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
             unsafe {
                 let align = mem::align_of::<T>();
                 let size = mem::size_of::<T>().unchecked_mul(self.cap.0);
@@ -465,7 +465,7 @@ impl<T, A: Allocator> RawVec<T, A> {
 
         let (ptr, layout) = if let Some(mem) = self.current_memory() { mem } else { return Ok(()) };
         // See current_memory() why this assert is here
-        let _: () = const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
+        const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
 
         // If shrinking to 0, deallocate the buffer. We don't reach this point
         // for the T::IS_ZST case since current_memory() will have returned
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index ce1876d5a2f..9ee61f97c91 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -2693,6 +2693,7 @@ pub(crate) fn is_valid_allocation_size(size: usize, len: usize) -> bool {
 
 /// Checks whether the regions of memory starting at `src` and `dst` of size
 /// `count * size` do *not* overlap.
+#[inline]
 pub(crate) fn is_nonoverlapping(src: *const (), dst: *const (), size: usize, count: usize) -> bool {
     let src_usize = src.addr();
     let dst_usize = dst.addr();
diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs
index 047cb64ce50..47e16018a47 100644
--- a/library/core/src/num/f32.rs
+++ b/library/core/src/num/f32.rs
@@ -32,6 +32,7 @@ use crate::num::FpCategory;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `RADIX` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_radix"]
 pub const RADIX: u32 = f32::RADIX;
 
 /// Number of significant digits in base 2.
@@ -52,6 +53,7 @@ pub const RADIX: u32 = f32::RADIX;
     since = "TBD",
     note = "replaced by the `MANTISSA_DIGITS` associated constant on `f32`"
 )]
+#[rustc_diagnostic_item = "f32_legacy_const_mantissa_dig"]
 pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
 
 /// Approximate number of significant digits in base 10.
@@ -69,6 +71,7 @@ pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `DIGITS` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_digits"]
 pub const DIGITS: u32 = f32::DIGITS;
 
 /// [Machine epsilon] value for `f32`.
@@ -90,6 +93,7 @@ pub const DIGITS: u32 = f32::DIGITS;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `EPSILON` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_epsilon"]
 pub const EPSILON: f32 = f32::EPSILON;
 
 /// Smallest finite `f32` value.
@@ -107,6 +111,7 @@ pub const EPSILON: f32 = f32::EPSILON;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_min"]
 pub const MIN: f32 = f32::MIN;
 
 /// Smallest positive normal `f32` value.
@@ -124,6 +129,7 @@ pub const MIN: f32 = f32::MIN;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MIN_POSITIVE` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_min_positive"]
 pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
 
 /// Largest finite `f32` value.
@@ -141,6 +147,7 @@ pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_max"]
 pub const MAX: f32 = f32::MAX;
 
 /// One greater than the minimum possible normal power of 2 exponent.
@@ -158,6 +165,7 @@ pub const MAX: f32 = f32::MAX;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MIN_EXP` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_min_exp"]
 pub const MIN_EXP: i32 = f32::MIN_EXP;
 
 /// Maximum possible power of 2 exponent.
@@ -175,6 +183,7 @@ pub const MIN_EXP: i32 = f32::MIN_EXP;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MAX_EXP` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_max_exp"]
 pub const MAX_EXP: i32 = f32::MAX_EXP;
 
 /// Minimum possible normal power of 10 exponent.
@@ -192,6 +201,7 @@ pub const MAX_EXP: i32 = f32::MAX_EXP;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MIN_10_EXP` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_min_10_exp"]
 pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
 
 /// Maximum possible power of 10 exponent.
@@ -209,6 +219,7 @@ pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MAX_10_EXP` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_max_10_exp"]
 pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
 
 /// Not a Number (NaN).
@@ -226,6 +237,7 @@ pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `NAN` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_nan"]
 pub const NAN: f32 = f32::NAN;
 
 /// Infinity (∞).
@@ -243,6 +255,7 @@ pub const NAN: f32 = f32::NAN;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `INFINITY` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_infinity"]
 pub const INFINITY: f32 = f32::INFINITY;
 
 /// Negative infinity (−∞).
@@ -260,6 +273,7 @@ pub const INFINITY: f32 = f32::INFINITY;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `NEG_INFINITY` associated constant on `f32`")]
+#[rustc_diagnostic_item = "f32_legacy_const_neg_infinity"]
 pub const NEG_INFINITY: f32 = f32::NEG_INFINITY;
 
 /// Basic mathematical constants.
diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs
index 16d81941935..cd69e758d28 100644
--- a/library/core/src/num/f64.rs
+++ b/library/core/src/num/f64.rs
@@ -32,6 +32,7 @@ use crate::num::FpCategory;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `RADIX` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_radix"]
 pub const RADIX: u32 = f64::RADIX;
 
 /// Number of significant digits in base 2.
@@ -52,6 +53,7 @@ pub const RADIX: u32 = f64::RADIX;
     since = "TBD",
     note = "replaced by the `MANTISSA_DIGITS` associated constant on `f64`"
 )]
+#[rustc_diagnostic_item = "f64_legacy_const_mantissa_dig"]
 pub const MANTISSA_DIGITS: u32 = f64::MANTISSA_DIGITS;
 
 /// Approximate number of significant digits in base 10.
@@ -69,6 +71,7 @@ pub const MANTISSA_DIGITS: u32 = f64::MANTISSA_DIGITS;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `DIGITS` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_digits"]
 pub const DIGITS: u32 = f64::DIGITS;
 
 /// [Machine epsilon] value for `f64`.
@@ -90,6 +93,7 @@ pub const DIGITS: u32 = f64::DIGITS;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `EPSILON` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_epsilon"]
 pub const EPSILON: f64 = f64::EPSILON;
 
 /// Smallest finite `f64` value.
@@ -107,6 +111,7 @@ pub const EPSILON: f64 = f64::EPSILON;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_min"]
 pub const MIN: f64 = f64::MIN;
 
 /// Smallest positive normal `f64` value.
@@ -124,6 +129,7 @@ pub const MIN: f64 = f64::MIN;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MIN_POSITIVE` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_min_positive"]
 pub const MIN_POSITIVE: f64 = f64::MIN_POSITIVE;
 
 /// Largest finite `f64` value.
@@ -141,6 +147,7 @@ pub const MIN_POSITIVE: f64 = f64::MIN_POSITIVE;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_max"]
 pub const MAX: f64 = f64::MAX;
 
 /// One greater than the minimum possible normal power of 2 exponent.
@@ -158,6 +165,7 @@ pub const MAX: f64 = f64::MAX;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MIN_EXP` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_min_exp"]
 pub const MIN_EXP: i32 = f64::MIN_EXP;
 
 /// Maximum possible power of 2 exponent.
@@ -175,6 +183,7 @@ pub const MIN_EXP: i32 = f64::MIN_EXP;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MAX_EXP` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_max_exp"]
 pub const MAX_EXP: i32 = f64::MAX_EXP;
 
 /// Minimum possible normal power of 10 exponent.
@@ -192,6 +201,7 @@ pub const MAX_EXP: i32 = f64::MAX_EXP;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MIN_10_EXP` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_min_10_exp"]
 pub const MIN_10_EXP: i32 = f64::MIN_10_EXP;
 
 /// Maximum possible power of 10 exponent.
@@ -209,6 +219,7 @@ pub const MIN_10_EXP: i32 = f64::MIN_10_EXP;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `MAX_10_EXP` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_max_10_exp"]
 pub const MAX_10_EXP: i32 = f64::MAX_10_EXP;
 
 /// Not a Number (NaN).
@@ -226,6 +237,7 @@ pub const MAX_10_EXP: i32 = f64::MAX_10_EXP;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `NAN` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_nan"]
 pub const NAN: f64 = f64::NAN;
 
 /// Infinity (∞).
@@ -243,6 +255,7 @@ pub const NAN: f64 = f64::NAN;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `INFINITY` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_infinity"]
 pub const INFINITY: f64 = f64::INFINITY;
 
 /// Negative infinity (−∞).
@@ -260,6 +273,7 @@ pub const INFINITY: f64 = f64::INFINITY;
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[deprecated(since = "TBD", note = "replaced by the `NEG_INFINITY` associated constant on `f64`")]
+#[rustc_diagnostic_item = "f64_legacy_const_neg_infinity"]
 pub const NEG_INFINITY: f64 = f64::NEG_INFINITY;
 
 /// Basic mathematical constants.
diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs
index 434bcace616..fa37ee4ffb2 100644
--- a/library/core/src/num/int_macros.rs
+++ b/library/core/src/num/int_macros.rs
@@ -3507,6 +3507,7 @@ macro_rules! int_impl {
         #[rustc_promotable]
         #[rustc_const_stable(feature = "const_min_value", since = "1.32.0")]
         #[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on this type")]
+        #[rustc_diagnostic_item = concat!(stringify!($SelfT), "_legacy_fn_min_value")]
         pub const fn min_value() -> Self {
             Self::MIN
         }
@@ -3520,6 +3521,7 @@ macro_rules! int_impl {
         #[rustc_promotable]
         #[rustc_const_stable(feature = "const_max_value", since = "1.32.0")]
         #[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on this type")]
+        #[rustc_diagnostic_item = concat!(stringify!($SelfT), "_legacy_fn_max_value")]
         pub const fn max_value() -> Self {
             Self::MAX
         }
diff --git a/library/core/src/num/shells/int_macros.rs b/library/core/src/num/shells/int_macros.rs
index 2b1133e11a5..8ae9b7abae3 100644
--- a/library/core/src/num/shells/int_macros.rs
+++ b/library/core/src/num/shells/int_macros.rs
@@ -20,6 +20,7 @@ macro_rules! int_module {
         ///
         #[$attr]
         #[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on this type")]
+        #[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_const_min")]
         pub const MIN: $T = $T::MIN;
 
         #[doc = concat!(
@@ -39,6 +40,7 @@ macro_rules! int_module {
         ///
         #[$attr]
         #[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on this type")]
+        #[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_const_max")]
         pub const MAX: $T = $T::MAX;
     )
 }
diff --git a/library/core/src/prelude/mod.rs b/library/core/src/prelude/mod.rs
index 12f762ef193..b4791c2c022 100644
--- a/library/core/src/prelude/mod.rs
+++ b/library/core/src/prelude/mod.rs
@@ -49,9 +49,13 @@ pub mod rust_2021 {
 /// The 2024 edition of the core prelude.
 ///
 /// See the [module-level documentation](self) for more.
-#[unstable(feature = "prelude_2024", issue = "none")]
+#[unstable(feature = "prelude_2024", issue = "121042")]
 pub mod rust_2024 {
-    #[unstable(feature = "prelude_2024", issue = "none")]
+    #[unstable(feature = "prelude_2024", issue = "121042")]
     #[doc(no_inline)]
     pub use super::rust_2021::*;
+
+    #[unstable(feature = "prelude_2024", issue = "121042")]
+    #[doc(no_inline)]
+    pub use crate::future::{Future, IntoFuture};
 }
diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs
index caa54e00f31..cc66da25795 100644
--- a/library/core/src/str/pattern.rs
+++ b/library/core/src/str/pattern.rs
@@ -40,6 +40,7 @@
 
 use crate::cmp;
 use crate::cmp::Ordering;
+use crate::convert::TryInto as _;
 use crate::fmt;
 use crate::slice::memchr;
 
@@ -370,11 +371,17 @@ pub struct CharSearcher<'a> {
 
     // safety invariant: `utf8_size` must be less than 5
     /// The number of bytes `needle` takes up when encoded in utf8.
-    utf8_size: usize,
+    utf8_size: u8,
     /// A utf8 encoded copy of the `needle`
     utf8_encoded: [u8; 4],
 }
 
+impl CharSearcher<'_> {
+    fn utf8_size(&self) -> usize {
+        self.utf8_size.into()
+    }
+}
+
 unsafe impl<'a> Searcher<'a> for CharSearcher<'a> {
     #[inline]
     fn haystack(&self) -> &'a str {
@@ -414,7 +421,7 @@ unsafe impl<'a> Searcher<'a> for CharSearcher<'a> {
             let bytes = self.haystack.as_bytes().get(self.finger..self.finger_back)?;
             // the last byte of the utf8 encoded needle
             // SAFETY: we have an invariant that `utf8_size < 5`
-            let last_byte = unsafe { *self.utf8_encoded.get_unchecked(self.utf8_size - 1) };
+            let last_byte = unsafe { *self.utf8_encoded.get_unchecked(self.utf8_size() - 1) };
             if let Some(index) = memchr::memchr(last_byte, bytes) {
                 // The new finger is the index of the byte we found,
                 // plus one, since we memchr'd for the last byte of the character.
@@ -434,10 +441,10 @@ unsafe impl<'a> Searcher<'a> for CharSearcher<'a> {
                 // find something. When we find something the `finger` will be set
                 // to a UTF8 boundary.
                 self.finger += index + 1;
-                if self.finger >= self.utf8_size {
-                    let found_char = self.finger - self.utf8_size;
+                if self.finger >= self.utf8_size() {
+                    let found_char = self.finger - self.utf8_size();
                     if let Some(slice) = self.haystack.as_bytes().get(found_char..self.finger) {
-                        if slice == &self.utf8_encoded[0..self.utf8_size] {
+                        if slice == &self.utf8_encoded[0..self.utf8_size()] {
                             return Some((found_char, self.finger));
                         }
                     }
@@ -482,7 +489,7 @@ unsafe impl<'a> ReverseSearcher<'a> for CharSearcher<'a> {
             let bytes = haystack.get(self.finger..self.finger_back)?;
             // the last byte of the utf8 encoded needle
             // SAFETY: we have an invariant that `utf8_size < 5`
-            let last_byte = unsafe { *self.utf8_encoded.get_unchecked(self.utf8_size - 1) };
+            let last_byte = unsafe { *self.utf8_encoded.get_unchecked(self.utf8_size() - 1) };
             if let Some(index) = memchr::memrchr(last_byte, bytes) {
                 // we searched a slice that was offset by self.finger,
                 // add self.finger to recoup the original index
@@ -493,14 +500,14 @@ unsafe impl<'a> ReverseSearcher<'a> for CharSearcher<'a> {
                 // char in the paradigm of reverse iteration). For
                 // multibyte chars we need to skip down by the number of more
                 // bytes they have than ASCII
-                let shift = self.utf8_size - 1;
+                let shift = self.utf8_size() - 1;
                 if index >= shift {
                     let found_char = index - shift;
-                    if let Some(slice) = haystack.get(found_char..(found_char + self.utf8_size)) {
-                        if slice == &self.utf8_encoded[0..self.utf8_size] {
+                    if let Some(slice) = haystack.get(found_char..(found_char + self.utf8_size())) {
+                        if slice == &self.utf8_encoded[0..self.utf8_size()] {
                             // move finger to before the character found (i.e., at its start index)
                             self.finger_back = found_char;
-                            return Some((self.finger_back, self.finger_back + self.utf8_size));
+                            return Some((self.finger_back, self.finger_back + self.utf8_size()));
                         }
                     }
                 }
@@ -542,7 +549,12 @@ impl<'a> Pattern<'a> for char {
     #[inline]
     fn into_searcher(self, haystack: &'a str) -> Self::Searcher {
         let mut utf8_encoded = [0; 4];
-        let utf8_size = self.encode_utf8(&mut utf8_encoded).len();
+        let utf8_size = self
+            .encode_utf8(&mut utf8_encoded)
+            .len()
+            .try_into()
+            .expect("char len should be less than 255");
+
         CharSearcher {
             haystack,
             finger: 0,
diff --git a/library/portable-simd/crates/core_simd/src/intrinsics.rs b/library/portable-simd/crates/core_simd/src/intrinsics.rs
deleted file mode 100644
index b27893bc729..00000000000
--- a/library/portable-simd/crates/core_simd/src/intrinsics.rs
+++ /dev/null
@@ -1,169 +0,0 @@
-//! This module contains the LLVM intrinsics bindings that provide the functionality for this
-//! crate.
-//!
-//! The LLVM assembly language is documented here: <https://llvm.org/docs/LangRef.html>
-//!
-//! A quick glossary of jargon that may appear in this module, mostly paraphrasing LLVM's LangRef:
-//! - poison: "undefined behavior as a value". specifically, it is like uninit memory (such as padding bytes). it is "safe" to create poison, BUT
-//!   poison MUST NOT be observed from safe code, as operations on poison return poison, like NaN. unlike NaN, which has defined comparisons,
-//!   poison is neither true nor false, and LLVM may also convert it to undef (at which point it is both). so, it can't be conditioned on, either.
-//! - undef: "a value that is every value". functionally like poison, insofar as Rust is concerned. poison may become this. note:
-//!   this means that division by poison or undef is like division by zero, which means it inflicts...
-//! - "UB": poison and undef cover most of what people call "UB". "UB" means this operation immediately invalidates the program:
-//!   LLVM is allowed to lower it to `ud2` or other opcodes that may cause an illegal instruction exception, and this is the "good end".
-//!   The "bad end" is that LLVM may reverse time to the moment control flow diverged on a path towards undefined behavior,
-//!   and destroy the other branch, potentially deleting safe code and violating Rust's `unsafe` contract.
-//!
-//! Note that according to LLVM, vectors are not arrays, but they are equivalent when stored to and loaded from memory.
-//!
-//! Unless stated otherwise, all intrinsics for binary operations require SIMD vectors of equal types and lengths.
-
-// These intrinsics aren't linked directly from LLVM and are mostly undocumented, however they are
-// mostly lowered to the matching LLVM instructions by the compiler in a fairly straightforward manner.
-// The associated LLVM instruction or intrinsic is documented alongside each Rust intrinsic function.
-extern "platform-intrinsic" {
-    /// add/fadd
-    pub(crate) fn simd_add<T>(x: T, y: T) -> T;
-
-    /// sub/fsub
-    pub(crate) fn simd_sub<T>(lhs: T, rhs: T) -> T;
-
-    /// mul/fmul
-    pub(crate) fn simd_mul<T>(x: T, y: T) -> T;
-
-    /// udiv/sdiv/fdiv
-    /// ints and uints: {s,u}div incur UB if division by zero occurs.
-    /// ints: sdiv is UB for int::MIN / -1.
-    /// floats: fdiv is never UB, but may create NaNs or infinities.
-    pub(crate) fn simd_div<T>(lhs: T, rhs: T) -> T;
-
-    /// urem/srem/frem
-    /// ints and uints: {s,u}rem incur UB if division by zero occurs.
-    /// ints: srem is UB for int::MIN / -1.
-    /// floats: frem is equivalent to libm::fmod in the "default" floating point environment, sans errno.
-    pub(crate) fn simd_rem<T>(lhs: T, rhs: T) -> T;
-
-    /// shl
-    /// for (u)ints. poison if rhs >= lhs::BITS
-    pub(crate) fn simd_shl<T>(lhs: T, rhs: T) -> T;
-
-    /// ints: ashr
-    /// uints: lshr
-    /// poison if rhs >= lhs::BITS
-    pub(crate) fn simd_shr<T>(lhs: T, rhs: T) -> T;
-
-    /// and
-    pub(crate) fn simd_and<T>(x: T, y: T) -> T;
-
-    /// or
-    pub(crate) fn simd_or<T>(x: T, y: T) -> T;
-
-    /// xor
-    pub(crate) fn simd_xor<T>(x: T, y: T) -> T;
-
-    /// fptoui/fptosi/uitofp/sitofp
-    /// casting floats to integers is truncating, so it is safe to convert values like e.g. 1.5
-    /// but the truncated value must fit in the target type or the result is poison.
-    /// use `simd_as` instead for a cast that performs a saturating conversion.
-    pub(crate) fn simd_cast<T, U>(x: T) -> U;
-    /// follows Rust's `T as U` semantics, including saturating float casts
-    /// which amounts to the same as `simd_cast` for many cases
-    pub(crate) fn simd_as<T, U>(x: T) -> U;
-
-    /// neg/fneg
-    /// ints: ultimately becomes a call to cg_ssa's BuilderMethods::neg. cg_llvm equates this to `simd_sub(Simd::splat(0), x)`.
-    /// floats: LLVM's fneg, which changes the floating point sign bit. Some arches have instructions for it.
-    /// Rust panics for Neg::neg(int::MIN) due to overflow, but it is not UB in LLVM without `nsw`.
-    pub(crate) fn simd_neg<T>(x: T) -> T;
-
-    /// fabs
-    pub(crate) fn simd_fabs<T>(x: T) -> T;
-
-    // minnum/maxnum
-    pub(crate) fn simd_fmin<T>(x: T, y: T) -> T;
-    pub(crate) fn simd_fmax<T>(x: T, y: T) -> T;
-
-    // these return Simd<int, N> with the same BITS size as the inputs
-    pub(crate) fn simd_eq<T, U>(x: T, y: T) -> U;
-    pub(crate) fn simd_ne<T, U>(x: T, y: T) -> U;
-    pub(crate) fn simd_lt<T, U>(x: T, y: T) -> U;
-    pub(crate) fn simd_le<T, U>(x: T, y: T) -> U;
-    pub(crate) fn simd_gt<T, U>(x: T, y: T) -> U;
-    pub(crate) fn simd_ge<T, U>(x: T, y: T) -> U;
-
-    // shufflevector
-    // idx: LLVM calls it a "shuffle mask vector constant", a vector of i32s
-    pub(crate) fn simd_shuffle<T, U, V>(x: T, y: T, idx: U) -> V;
-
-    /// llvm.masked.gather
-    /// like a loop of pointer reads
-    /// val: vector of values to select if a lane is masked
-    /// ptr: vector of pointers to read from
-    /// mask: a "wide" mask of integers, selects as if simd_select(mask, read(ptr), val)
-    /// note, the LLVM intrinsic accepts a mask vector of `<N x i1>`
-    /// FIXME: review this if/when we fix up our mask story in general?
-    pub(crate) fn simd_gather<T, U, V>(val: T, ptr: U, mask: V) -> T;
-    /// llvm.masked.scatter
-    /// like gather, but more spicy, as it writes instead of reads
-    pub(crate) fn simd_scatter<T, U, V>(val: T, ptr: U, mask: V);
-
-    // {s,u}add.sat
-    pub(crate) fn simd_saturating_add<T>(x: T, y: T) -> T;
-
-    // {s,u}sub.sat
-    pub(crate) fn simd_saturating_sub<T>(lhs: T, rhs: T) -> T;
-
-    // reductions
-    // llvm.vector.reduce.{add,fadd}
-    pub(crate) fn simd_reduce_add_ordered<T, U>(x: T, y: U) -> U;
-    // llvm.vector.reduce.{mul,fmul}
-    pub(crate) fn simd_reduce_mul_ordered<T, U>(x: T, y: U) -> U;
-    #[allow(unused)]
-    pub(crate) fn simd_reduce_all<T>(x: T) -> bool;
-    #[allow(unused)]
-    pub(crate) fn simd_reduce_any<T>(x: T) -> bool;
-    pub(crate) fn simd_reduce_max<T, U>(x: T) -> U;
-    pub(crate) fn simd_reduce_min<T, U>(x: T) -> U;
-    pub(crate) fn simd_reduce_and<T, U>(x: T) -> U;
-    pub(crate) fn simd_reduce_or<T, U>(x: T) -> U;
-    pub(crate) fn simd_reduce_xor<T, U>(x: T) -> U;
-
-    // truncate integer vector to bitmask
-    // `fn simd_bitmask(vector) -> unsigned integer` takes a vector of integers and
-    // returns either an unsigned integer or array of `u8`.
-    // Every element in the vector becomes a single bit in the returned bitmask.
-    // If the vector has less than 8 lanes, a u8 is returned with zeroed trailing bits.
-    // The bit order of the result depends on the byte endianness. LSB-first for little
-    // endian and MSB-first for big endian.
-    //
-    // UB if called on a vector with values other than 0 and -1.
-    #[allow(unused)]
-    pub(crate) fn simd_bitmask<T, U>(x: T) -> U;
-
-    // select
-    // first argument is a vector of integers, -1 (all bits 1) is "true"
-    // logically equivalent to (yes & m) | (no & (m^-1),
-    // but you can use it on floats.
-    pub(crate) fn simd_select<M, T>(m: M, yes: T, no: T) -> T;
-    #[allow(unused)]
-    pub(crate) fn simd_select_bitmask<M, T>(m: M, yes: T, no: T) -> T;
-
-    /// getelementptr (without inbounds)
-    /// equivalent to wrapping_offset
-    pub(crate) fn simd_arith_offset<T, U>(ptr: T, offset: U) -> T;
-
-    /// equivalent to `T as U` semantics, specifically for pointers
-    pub(crate) fn simd_cast_ptr<T, U>(ptr: T) -> U;
-
-    /// expose a pointer as an address
-    pub(crate) fn simd_expose_addr<T, U>(ptr: T) -> U;
-
-    /// convert an exposed address back to a pointer
-    pub(crate) fn simd_from_exposed_addr<T, U>(addr: T) -> U;
-
-    // Integer operations
-    pub(crate) fn simd_bswap<T>(x: T) -> T;
-    pub(crate) fn simd_bitreverse<T>(x: T) -> T;
-    pub(crate) fn simd_ctlz<T>(x: T) -> T;
-    pub(crate) fn simd_cttz<T>(x: T) -> T;
-}
diff --git a/library/portable-simd/crates/core_simd/src/lib.rs b/library/portable-simd/crates/core_simd/src/lib.rs
index 64ba9705ef5..a25723e11ce 100644
--- a/library/portable-simd/crates/core_simd/src/lib.rs
+++ b/library/portable-simd/crates/core_simd/src/lib.rs
@@ -1,20 +1,38 @@
 #![no_std]
 #![feature(
+    const_intrinsic_copy,
     const_refs_to_cell,
     const_maybe_uninit_as_mut_ptr,
     const_mut_refs,
     convert_float_to_int,
+    core_intrinsics,
     decl_macro,
     inline_const,
     intra_doc_pointers,
-    platform_intrinsics,
     repr_simd,
     simd_ffi,
     staged_api,
-    stdsimd,
     strict_provenance,
     ptr_metadata
 )]
+#![cfg_attr(
+    all(
+        any(target_arch = "aarch64", target_arch = "arm",),
+        any(
+            all(target_feature = "v6", not(target_feature = "mclass")),
+            all(target_feature = "mclass", target_feature = "dsp"),
+        )
+    ),
+    feature(stdarch_arm_dsp)
+)]
+#![cfg_attr(
+    all(target_arch = "arm", target_feature = "v7"),
+    feature(stdarch_arm_neon_intrinsics)
+)]
+#![cfg_attr(
+    any(target_arch = "powerpc", target_arch = "powerpc64"),
+    feature(stdarch_powerpc)
+)]
 #![warn(missing_docs, clippy::missing_inline_in_public_items)] // basically all items, really
 #![deny(unsafe_op_in_unsafe_fn, clippy::undocumented_unsafe_blocks)]
 #![allow(internal_features)]
diff --git a/library/portable-simd/crates/core_simd/src/masks.rs b/library/portable-simd/crates/core_simd/src/masks.rs
index 0623d2bf3d1..e480c25a51e 100644
--- a/library/portable-simd/crates/core_simd/src/masks.rs
+++ b/library/portable-simd/crates/core_simd/src/masks.rs
@@ -12,9 +12,7 @@
 )]
 mod mask_impl;
 
-use crate::simd::{
-    cmp::SimdPartialEq, intrinsics, LaneCount, Simd, SimdCast, SimdElement, SupportedLaneCount,
-};
+use crate::simd::{LaneCount, Simd, SimdCast, SimdElement, SupportedLaneCount};
 use core::cmp::Ordering;
 use core::{fmt, mem};
 
@@ -35,7 +33,7 @@ mod sealed {
 
         fn eq(self, other: Self) -> bool;
 
-        fn as_usize(self) -> usize;
+        fn to_usize(self) -> usize;
 
         type Unsigned: SimdElement;
 
@@ -60,14 +58,23 @@ macro_rules! impl_element {
             where
                 LaneCount<N>: SupportedLaneCount,
             {
-                (value.simd_eq(Simd::splat(0 as _)) | value.simd_eq(Simd::splat(-1 as _))).all()
+                // We can't use `Simd` directly, because `Simd`'s functions call this function and
+                // we will end up with an infinite loop.
+                // Safety: `value` is an integer vector
+                unsafe {
+                    use core::intrinsics::simd;
+                    let falses: Simd<Self, N> = simd::simd_eq(value, Simd::splat(0 as _));
+                    let trues: Simd<Self, N> = simd::simd_eq(value, Simd::splat(-1 as _));
+                    let valid: Simd<Self, N> = simd::simd_or(falses, trues);
+                    simd::simd_reduce_all(valid)
+                }
             }
 
             #[inline]
             fn eq(self, other: Self) -> bool { self == other }
 
             #[inline]
-            fn as_usize(self) -> usize {
+            fn to_usize(self) -> usize {
                 self as usize
             }
 
@@ -141,8 +148,9 @@ where
         // but these are "dependently-sized" types, so copy elision it is!
         unsafe {
             let bytes: [u8; N] = mem::transmute_copy(&array);
-            let bools: Simd<i8, N> = intrinsics::simd_ne(Simd::from_array(bytes), Simd::splat(0u8));
-            Mask::from_int_unchecked(intrinsics::simd_cast(bools))
+            let bools: Simd<i8, N> =
+                core::intrinsics::simd::simd_ne(Simd::from_array(bytes), Simd::splat(0u8));
+            Mask::from_int_unchecked(core::intrinsics::simd::simd_cast(bools))
         }
     }
 
@@ -160,7 +168,7 @@ where
         // This would be hypothetically valid as an "in-place" transmute,
         // but these are "dependently-sized" types, so copy elision it is!
         unsafe {
-            let mut bytes: Simd<i8, N> = intrinsics::simd_cast(self.to_int());
+            let mut bytes: Simd<i8, N> = core::intrinsics::simd::simd_cast(self.to_int());
             bytes &= Simd::splat(1i8);
             mem::transmute_copy(&bytes)
         }
@@ -175,7 +183,10 @@ where
     #[must_use = "method returns a new mask and does not mutate the original value"]
     pub unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
         // Safety: the caller must confirm this invariant
-        unsafe { Self(mask_impl::Mask::from_int_unchecked(value)) }
+        unsafe {
+            core::intrinsics::assume(<T as Sealed>::valid(value));
+            Self(mask_impl::Mask::from_int_unchecked(value))
+        }
     }
 
     /// Converts a vector of integers to a mask, where 0 represents `false` and -1
@@ -374,15 +385,17 @@ where
         );
 
         // Safety: the input and output are integer vectors
-        let index: Simd<T, N> = unsafe { intrinsics::simd_cast(index) };
+        let index: Simd<T, N> = unsafe { core::intrinsics::simd::simd_cast(index) };
 
         let masked_index = self.select(index, Self::splat(true).to_int());
 
         // Safety: the input and output are integer vectors
-        let masked_index: Simd<T::Unsigned, N> = unsafe { intrinsics::simd_cast(masked_index) };
+        let masked_index: Simd<T::Unsigned, N> =
+            unsafe { core::intrinsics::simd::simd_cast(masked_index) };
 
         // Safety: the input is an integer vector
-        let min_index: T::Unsigned = unsafe { intrinsics::simd_reduce_min(masked_index) };
+        let min_index: T::Unsigned =
+            unsafe { core::intrinsics::simd::simd_reduce_min(masked_index) };
 
         // Safety: the return value is the unsigned version of T
         let min_index: T = unsafe { core::mem::transmute_copy(&min_index) };
@@ -390,7 +403,7 @@ where
         if min_index.eq(T::TRUE) {
             None
         } else {
-            Some(min_index.as_usize())
+            Some(min_index.to_usize())
         }
     }
 }
diff --git a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
index 6ddff07fea2..96c553426ee 100644
--- a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
+++ b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
@@ -1,6 +1,5 @@
 #![allow(unused_imports)]
 use super::MaskElement;
-use crate::simd::intrinsics;
 use crate::simd::{LaneCount, Simd, SupportedLaneCount};
 use core::marker::PhantomData;
 
@@ -109,14 +108,18 @@ where
     #[must_use = "method returns a new vector and does not mutate the original value"]
     pub fn to_int(self) -> Simd<T, N> {
         unsafe {
-            intrinsics::simd_select_bitmask(self.0, Simd::splat(T::TRUE), Simd::splat(T::FALSE))
+            core::intrinsics::simd::simd_select_bitmask(
+                self.0,
+                Simd::splat(T::TRUE),
+                Simd::splat(T::FALSE),
+            )
         }
     }
 
     #[inline]
     #[must_use = "method returns a new mask and does not mutate the original value"]
     pub unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
-        unsafe { Self(intrinsics::simd_bitmask(value), PhantomData) }
+        unsafe { Self(core::intrinsics::simd::simd_bitmask(value), PhantomData) }
     }
 
     #[inline]
diff --git a/library/portable-simd/crates/core_simd/src/masks/full_masks.rs b/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
index 63964f455e0..87f031a9f36 100644
--- a/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
+++ b/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
@@ -1,6 +1,5 @@
 //! Masks that take up full SIMD vector registers.
 
-use crate::simd::intrinsics;
 use crate::simd::{LaneCount, MaskElement, Simd, SupportedLaneCount};
 
 #[repr(transparent)]
@@ -138,7 +137,7 @@ where
         U: MaskElement,
     {
         // Safety: masks are simply integer vectors of 0 and -1, and we can cast the element type.
-        unsafe { Mask(intrinsics::simd_cast(self.0)) }
+        unsafe { Mask(core::intrinsics::simd::simd_cast(self.0)) }
     }
 
     #[inline]
@@ -150,13 +149,16 @@ where
         unsafe {
             // Compute the bitmask
             let mut bytes: <LaneCount<N> as SupportedLaneCount>::BitMask =
-                intrinsics::simd_bitmask(self.0);
+                core::intrinsics::simd::simd_bitmask(self.0);
 
             // LLVM assumes bit order should match endianness
             if cfg!(target_endian = "big") {
                 for x in bytes.as_mut() {
                     *x = x.reverse_bits()
                 }
+                if N % 8 > 0 {
+                    bytes.as_mut()[N / 8] >>= 8 - N % 8;
+                }
             }
 
             bitmask.as_mut_array()[..bytes.as_ref().len()].copy_from_slice(bytes.as_ref());
@@ -180,10 +182,13 @@ where
                 for x in bytes.as_mut() {
                     *x = x.reverse_bits();
                 }
+                if N % 8 > 0 {
+                    bytes.as_mut()[N / 8] >>= 8 - N % 8;
+                }
             }
 
             // Compute the regular mask
-            Self::from_int_unchecked(intrinsics::simd_select_bitmask(
+            Self::from_int_unchecked(core::intrinsics::simd::simd_select_bitmask(
                 bytes,
                 Self::splat(true).to_int(),
                 Self::splat(false).to_int(),
@@ -199,7 +204,7 @@ where
         let resized = self.to_int().resize::<M>(T::FALSE);
 
         // Safety: `resized` is an integer vector with length M, which must match T
-        let bitmask: U = unsafe { intrinsics::simd_bitmask(resized) };
+        let bitmask: U = unsafe { core::intrinsics::simd::simd_bitmask(resized) };
 
         // LLVM assumes bit order should match endianness
         if cfg!(target_endian = "big") {
@@ -223,7 +228,7 @@ where
 
         // SAFETY: `mask` is the correct bitmask type for a u64 bitmask
         let mask: Simd<T, M> = unsafe {
-            intrinsics::simd_select_bitmask(
+            core::intrinsics::simd::simd_select_bitmask(
                 bitmask,
                 Simd::<T, M>::splat(T::TRUE),
                 Simd::<T, M>::splat(T::FALSE),
@@ -274,14 +279,14 @@ where
     #[must_use = "method returns a new bool and does not mutate the original value"]
     pub fn any(self) -> bool {
         // Safety: use `self` as an integer vector
-        unsafe { intrinsics::simd_reduce_any(self.to_int()) }
+        unsafe { core::intrinsics::simd::simd_reduce_any(self.to_int()) }
     }
 
     #[inline]
     #[must_use = "method returns a new vector and does not mutate the original value"]
     pub fn all(self) -> bool {
         // Safety: use `self` as an integer vector
-        unsafe { intrinsics::simd_reduce_all(self.to_int()) }
+        unsafe { core::intrinsics::simd::simd_reduce_all(self.to_int()) }
     }
 }
 
@@ -306,7 +311,7 @@ where
     #[must_use = "method returns a new mask and does not mutate the original value"]
     fn bitand(self, rhs: Self) -> Self {
         // Safety: `self` is an integer vector
-        unsafe { Self(intrinsics::simd_and(self.0, rhs.0)) }
+        unsafe { Self(core::intrinsics::simd::simd_and(self.0, rhs.0)) }
     }
 }
 
@@ -320,7 +325,7 @@ where
     #[must_use = "method returns a new mask and does not mutate the original value"]
     fn bitor(self, rhs: Self) -> Self {
         // Safety: `self` is an integer vector
-        unsafe { Self(intrinsics::simd_or(self.0, rhs.0)) }
+        unsafe { Self(core::intrinsics::simd::simd_or(self.0, rhs.0)) }
     }
 }
 
@@ -334,7 +339,7 @@ where
     #[must_use = "method returns a new mask and does not mutate the original value"]
     fn bitxor(self, rhs: Self) -> Self {
         // Safety: `self` is an integer vector
-        unsafe { Self(intrinsics::simd_xor(self.0, rhs.0)) }
+        unsafe { Self(core::intrinsics::simd::simd_xor(self.0, rhs.0)) }
     }
 }
 
diff --git a/library/portable-simd/crates/core_simd/src/mod.rs b/library/portable-simd/crates/core_simd/src/mod.rs
index fd016f1c6f7..45b1a0f9751 100644
--- a/library/portable-simd/crates/core_simd/src/mod.rs
+++ b/library/portable-simd/crates/core_simd/src/mod.rs
@@ -1,8 +1,6 @@
 #[macro_use]
 mod swizzle;
 
-pub(crate) mod intrinsics;
-
 mod alias;
 mod cast;
 mod fmt;
@@ -27,8 +25,6 @@ pub mod simd {
 
     pub mod cmp;
 
-    pub(crate) use crate::core_simd::intrinsics;
-
     pub use crate::core_simd::alias::*;
     pub use crate::core_simd::cast::*;
     pub use crate::core_simd::lane_count::{LaneCount, SupportedLaneCount};
diff --git a/library/portable-simd/crates/core_simd/src/ops.rs b/library/portable-simd/crates/core_simd/src/ops.rs
index 8a1b083f039..d8e10eeaa1a 100644
--- a/library/portable-simd/crates/core_simd/src/ops.rs
+++ b/library/portable-simd/crates/core_simd/src/ops.rs
@@ -37,7 +37,7 @@ where
 macro_rules! unsafe_base {
     ($lhs:ident, $rhs:ident, {$simd_call:ident}, $($_:tt)*) => {
         // Safety: $lhs and $rhs are vectors
-        unsafe { $crate::simd::intrinsics::$simd_call($lhs, $rhs) }
+        unsafe { core::intrinsics::simd::$simd_call($lhs, $rhs) }
     };
 }
 
@@ -55,7 +55,7 @@ macro_rules! wrap_bitshift {
         #[allow(clippy::suspicious_arithmetic_impl)]
         // Safety: $lhs and the bitand result are vectors
         unsafe {
-            $crate::simd::intrinsics::$simd_call(
+            core::intrinsics::simd::$simd_call(
                 $lhs,
                 $rhs.bitand(Simd::splat(<$int>::BITS as $int - 1)),
             )
@@ -97,7 +97,7 @@ macro_rules! int_divrem_guard {
                 $rhs
             };
             // Safety: $lhs and rhs are vectors
-            unsafe { $crate::simd::intrinsics::$simd_call($lhs, rhs) }
+            unsafe { core::intrinsics::simd::$simd_call($lhs, rhs) }
         }
     };
 }
diff --git a/library/portable-simd/crates/core_simd/src/ops/unary.rs b/library/portable-simd/crates/core_simd/src/ops/unary.rs
index a651aa73e95..bdae96332a3 100644
--- a/library/portable-simd/crates/core_simd/src/ops/unary.rs
+++ b/library/portable-simd/crates/core_simd/src/ops/unary.rs
@@ -1,4 +1,3 @@
-use crate::simd::intrinsics;
 use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount};
 use core::ops::{Neg, Not}; // unary ops
 
@@ -15,7 +14,7 @@ macro_rules! neg {
             #[must_use = "operator returns a new vector without mutating the input"]
             fn neg(self) -> Self::Output {
                 // Safety: `self` is a signed vector
-                unsafe { intrinsics::simd_neg(self) }
+                unsafe { core::intrinsics::simd::simd_neg(self) }
             }
         })*
     }
diff --git a/library/portable-simd/crates/core_simd/src/select.rs b/library/portable-simd/crates/core_simd/src/select.rs
index cdcf8eeec81..f33aa261a92 100644
--- a/library/portable-simd/crates/core_simd/src/select.rs
+++ b/library/portable-simd/crates/core_simd/src/select.rs
@@ -1,4 +1,3 @@
-use crate::simd::intrinsics;
 use crate::simd::{LaneCount, Mask, MaskElement, Simd, SimdElement, SupportedLaneCount};
 
 impl<T, const N: usize> Mask<T, N>
@@ -29,7 +28,7 @@ where
     {
         // Safety: The mask has been cast to a vector of integers,
         // and the operands to select between are vectors of the same type and length.
-        unsafe { intrinsics::simd_select(self.to_int(), true_values, false_values) }
+        unsafe { core::intrinsics::simd::simd_select(self.to_int(), true_values, false_values) }
     }
 
     /// Choose elements from two masks.
diff --git a/library/portable-simd/crates/core_simd/src/simd/cmp/eq.rs b/library/portable-simd/crates/core_simd/src/simd/cmp/eq.rs
index f132fa2cc0c..5b4615ce51d 100644
--- a/library/portable-simd/crates/core_simd/src/simd/cmp/eq.rs
+++ b/library/portable-simd/crates/core_simd/src/simd/cmp/eq.rs
@@ -1,5 +1,4 @@
 use crate::simd::{
-    intrinsics,
     ptr::{SimdConstPtr, SimdMutPtr},
     LaneCount, Mask, Simd, SimdElement, SupportedLaneCount,
 };
@@ -31,14 +30,14 @@ macro_rules! impl_number {
             fn simd_eq(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_eq(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_eq(self, other)) }
             }
 
             #[inline]
             fn simd_ne(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_ne(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_ne(self, other)) }
             }
         }
         )*
@@ -60,14 +59,14 @@ macro_rules! impl_mask {
             fn simd_eq(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Self::from_int_unchecked(intrinsics::simd_eq(self.to_int(), other.to_int())) }
+                unsafe { Self::from_int_unchecked(core::intrinsics::simd::simd_eq(self.to_int(), other.to_int())) }
             }
 
             #[inline]
             fn simd_ne(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Self::from_int_unchecked(intrinsics::simd_ne(self.to_int(), other.to_int())) }
+                unsafe { Self::from_int_unchecked(core::intrinsics::simd::simd_ne(self.to_int(), other.to_int())) }
             }
         }
         )*
diff --git a/library/portable-simd/crates/core_simd/src/simd/cmp/ord.rs b/library/portable-simd/crates/core_simd/src/simd/cmp/ord.rs
index 4e9d49ea221..899f00a8316 100644
--- a/library/portable-simd/crates/core_simd/src/simd/cmp/ord.rs
+++ b/library/portable-simd/crates/core_simd/src/simd/cmp/ord.rs
@@ -1,6 +1,5 @@
 use crate::simd::{
     cmp::SimdPartialEq,
-    intrinsics,
     ptr::{SimdConstPtr, SimdMutPtr},
     LaneCount, Mask, Simd, SupportedLaneCount,
 };
@@ -57,28 +56,28 @@ macro_rules! impl_integer {
             fn simd_lt(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_lt(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_lt(self, other)) }
             }
 
             #[inline]
             fn simd_le(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_le(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_le(self, other)) }
             }
 
             #[inline]
             fn simd_gt(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_gt(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_gt(self, other)) }
             }
 
             #[inline]
             fn simd_ge(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_ge(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_ge(self, other)) }
             }
         }
 
@@ -123,28 +122,28 @@ macro_rules! impl_float {
             fn simd_lt(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_lt(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_lt(self, other)) }
             }
 
             #[inline]
             fn simd_le(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_le(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_le(self, other)) }
             }
 
             #[inline]
             fn simd_gt(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_gt(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_gt(self, other)) }
             }
 
             #[inline]
             fn simd_ge(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Mask::from_int_unchecked(intrinsics::simd_ge(self, other)) }
+                unsafe { Mask::from_int_unchecked(core::intrinsics::simd::simd_ge(self, other)) }
             }
         }
         )*
@@ -164,28 +163,28 @@ macro_rules! impl_mask {
             fn simd_lt(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Self::from_int_unchecked(intrinsics::simd_lt(self.to_int(), other.to_int())) }
+                unsafe { Self::from_int_unchecked(core::intrinsics::simd::simd_lt(self.to_int(), other.to_int())) }
             }
 
             #[inline]
             fn simd_le(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Self::from_int_unchecked(intrinsics::simd_le(self.to_int(), other.to_int())) }
+                unsafe { Self::from_int_unchecked(core::intrinsics::simd::simd_le(self.to_int(), other.to_int())) }
             }
 
             #[inline]
             fn simd_gt(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Self::from_int_unchecked(intrinsics::simd_gt(self.to_int(), other.to_int())) }
+                unsafe { Self::from_int_unchecked(core::intrinsics::simd::simd_gt(self.to_int(), other.to_int())) }
             }
 
             #[inline]
             fn simd_ge(self, other: Self) -> Self::Mask {
                 // Safety: `self` is a vector, and the result of the comparison
                 // is always a valid mask.
-                unsafe { Self::from_int_unchecked(intrinsics::simd_ge(self.to_int(), other.to_int())) }
+                unsafe { Self::from_int_unchecked(core::intrinsics::simd::simd_ge(self.to_int(), other.to_int())) }
             }
         }
 
diff --git a/library/portable-simd/crates/core_simd/src/simd/num/float.rs b/library/portable-simd/crates/core_simd/src/simd/num/float.rs
index fc0b99e87a6..59e43851ea8 100644
--- a/library/portable-simd/crates/core_simd/src/simd/num/float.rs
+++ b/library/portable-simd/crates/core_simd/src/simd/num/float.rs
@@ -1,7 +1,7 @@
 use super::sealed::Sealed;
 use crate::simd::{
     cmp::{SimdPartialEq, SimdPartialOrd},
-    intrinsics, LaneCount, Mask, Simd, SimdCast, SimdElement, SupportedLaneCount,
+    LaneCount, Mask, Simd, SimdCast, SimdElement, SupportedLaneCount,
 };
 
 /// Operations on SIMD vectors of floats.
@@ -259,7 +259,7 @@ macro_rules! impl_trait {
             fn cast<T: SimdCast>(self) -> Self::Cast<T>
             {
                 // Safety: supported types are guaranteed by SimdCast
-                unsafe { intrinsics::simd_as(self) }
+                unsafe { core::intrinsics::simd::simd_as(self) }
             }
 
             #[inline]
@@ -269,7 +269,7 @@ macro_rules! impl_trait {
                 Self::Scalar: core::convert::FloatToInt<I>,
             {
                 // Safety: supported types are guaranteed by SimdCast, the caller is responsible for the extra invariants
-                unsafe { intrinsics::simd_cast(self) }
+                unsafe { core::intrinsics::simd::simd_cast(self) }
             }
 
             #[inline]
@@ -289,7 +289,7 @@ macro_rules! impl_trait {
             #[inline]
             fn abs(self) -> Self {
                 // Safety: `self` is a float vector
-                unsafe { intrinsics::simd_fabs(self) }
+                unsafe { core::intrinsics::simd::simd_fabs(self) }
             }
 
             #[inline]
@@ -363,13 +363,13 @@ macro_rules! impl_trait {
             #[inline]
             fn simd_min(self, other: Self) -> Self {
                 // Safety: `self` and `other` are float vectors
-                unsafe { intrinsics::simd_fmin(self, other) }
+                unsafe { core::intrinsics::simd::simd_fmin(self, other) }
             }
 
             #[inline]
             fn simd_max(self, other: Self) -> Self {
                 // Safety: `self` and `other` are floating point vectors
-                unsafe { intrinsics::simd_fmax(self, other) }
+                unsafe { core::intrinsics::simd::simd_fmax(self, other) }
             }
 
             #[inline]
@@ -391,7 +391,7 @@ macro_rules! impl_trait {
                     self.as_array().iter().sum()
                 } else {
                     // Safety: `self` is a float vector
-                    unsafe { intrinsics::simd_reduce_add_ordered(self, 0.) }
+                    unsafe { core::intrinsics::simd::simd_reduce_add_ordered(self, 0.) }
                 }
             }
 
@@ -402,20 +402,20 @@ macro_rules! impl_trait {
                     self.as_array().iter().product()
                 } else {
                     // Safety: `self` is a float vector
-                    unsafe { intrinsics::simd_reduce_mul_ordered(self, 1.) }
+                    unsafe { core::intrinsics::simd::simd_reduce_mul_ordered(self, 1.) }
                 }
             }
 
             #[inline]
             fn reduce_max(self) -> Self::Scalar {
                 // Safety: `self` is a float vector
-                unsafe { intrinsics::simd_reduce_max(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_max(self) }
             }
 
             #[inline]
             fn reduce_min(self) -> Self::Scalar {
                 // Safety: `self` is a float vector
-                unsafe { intrinsics::simd_reduce_min(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_min(self) }
             }
         }
         )*
diff --git a/library/portable-simd/crates/core_simd/src/simd/num/int.rs b/library/portable-simd/crates/core_simd/src/simd/num/int.rs
index 1f1aa272782..d7598d9ceaf 100644
--- a/library/portable-simd/crates/core_simd/src/simd/num/int.rs
+++ b/library/portable-simd/crates/core_simd/src/simd/num/int.rs
@@ -1,6 +1,6 @@
 use super::sealed::Sealed;
 use crate::simd::{
-    cmp::SimdPartialOrd, intrinsics, num::SimdUint, LaneCount, Mask, Simd, SimdCast, SimdElement,
+    cmp::SimdPartialOrd, num::SimdUint, LaneCount, Mask, Simd, SimdCast, SimdElement,
     SupportedLaneCount,
 };
 
@@ -237,19 +237,19 @@ macro_rules! impl_trait {
             #[inline]
             fn cast<T: SimdCast>(self) -> Self::Cast<T> {
                 // Safety: supported types are guaranteed by SimdCast
-                unsafe { intrinsics::simd_as(self) }
+                unsafe { core::intrinsics::simd::simd_as(self) }
             }
 
             #[inline]
             fn saturating_add(self, second: Self) -> Self {
                 // Safety: `self` is a vector
-                unsafe { intrinsics::simd_saturating_add(self, second) }
+                unsafe { core::intrinsics::simd::simd_saturating_add(self, second) }
             }
 
             #[inline]
             fn saturating_sub(self, second: Self) -> Self {
                 // Safety: `self` is a vector
-                unsafe { intrinsics::simd_saturating_sub(self, second) }
+                unsafe { core::intrinsics::simd::simd_saturating_sub(self, second) }
             }
 
             #[inline]
@@ -293,55 +293,55 @@ macro_rules! impl_trait {
             #[inline]
             fn reduce_sum(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_add_ordered(self, 0) }
+                unsafe { core::intrinsics::simd::simd_reduce_add_ordered(self, 0) }
             }
 
             #[inline]
             fn reduce_product(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_mul_ordered(self, 1) }
+                unsafe { core::intrinsics::simd::simd_reduce_mul_ordered(self, 1) }
             }
 
             #[inline]
             fn reduce_max(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_max(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_max(self) }
             }
 
             #[inline]
             fn reduce_min(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_min(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_min(self) }
             }
 
             #[inline]
             fn reduce_and(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_and(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_and(self) }
             }
 
             #[inline]
             fn reduce_or(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_or(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_or(self) }
             }
 
             #[inline]
             fn reduce_xor(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_xor(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_xor(self) }
             }
 
             #[inline]
             fn swap_bytes(self) -> Self {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_bswap(self) }
+                unsafe { core::intrinsics::simd::simd_bswap(self) }
             }
 
             #[inline]
             fn reverse_bits(self) -> Self {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_bitreverse(self) }
+                unsafe { core::intrinsics::simd::simd_bitreverse(self) }
             }
 
             #[inline]
diff --git a/library/portable-simd/crates/core_simd/src/simd/num/uint.rs b/library/portable-simd/crates/core_simd/src/simd/num/uint.rs
index c955ee8fe8b..53dd97f501c 100644
--- a/library/portable-simd/crates/core_simd/src/simd/num/uint.rs
+++ b/library/portable-simd/crates/core_simd/src/simd/num/uint.rs
@@ -1,5 +1,5 @@
 use super::sealed::Sealed;
-use crate::simd::{intrinsics, LaneCount, Simd, SimdCast, SimdElement, SupportedLaneCount};
+use crate::simd::{LaneCount, Simd, SimdCast, SimdElement, SupportedLaneCount};
 
 /// Operations on SIMD vectors of unsigned integers.
 pub trait SimdUint: Copy + Sealed {
@@ -117,7 +117,7 @@ macro_rules! impl_trait {
             #[inline]
             fn cast<T: SimdCast>(self) -> Self::Cast<T> {
                 // Safety: supported types are guaranteed by SimdCast
-                unsafe { intrinsics::simd_as(self) }
+                unsafe { core::intrinsics::simd::simd_as(self) }
             }
 
             #[inline]
@@ -129,79 +129,79 @@ macro_rules! impl_trait {
             #[inline]
             fn saturating_add(self, second: Self) -> Self {
                 // Safety: `self` is a vector
-                unsafe { intrinsics::simd_saturating_add(self, second) }
+                unsafe { core::intrinsics::simd::simd_saturating_add(self, second) }
             }
 
             #[inline]
             fn saturating_sub(self, second: Self) -> Self {
                 // Safety: `self` is a vector
-                unsafe { intrinsics::simd_saturating_sub(self, second) }
+                unsafe { core::intrinsics::simd::simd_saturating_sub(self, second) }
             }
 
             #[inline]
             fn reduce_sum(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_add_ordered(self, 0) }
+                unsafe { core::intrinsics::simd::simd_reduce_add_ordered(self, 0) }
             }
 
             #[inline]
             fn reduce_product(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_mul_ordered(self, 1) }
+                unsafe { core::intrinsics::simd::simd_reduce_mul_ordered(self, 1) }
             }
 
             #[inline]
             fn reduce_max(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_max(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_max(self) }
             }
 
             #[inline]
             fn reduce_min(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_min(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_min(self) }
             }
 
             #[inline]
             fn reduce_and(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_and(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_and(self) }
             }
 
             #[inline]
             fn reduce_or(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_or(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_or(self) }
             }
 
             #[inline]
             fn reduce_xor(self) -> Self::Scalar {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_reduce_xor(self) }
+                unsafe { core::intrinsics::simd::simd_reduce_xor(self) }
             }
 
             #[inline]
             fn swap_bytes(self) -> Self {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_bswap(self) }
+                unsafe { core::intrinsics::simd::simd_bswap(self) }
             }
 
             #[inline]
             fn reverse_bits(self) -> Self {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_bitreverse(self) }
+                unsafe { core::intrinsics::simd::simd_bitreverse(self) }
             }
 
             #[inline]
             fn leading_zeros(self) -> Self {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_ctlz(self) }
+                unsafe { core::intrinsics::simd::simd_ctlz(self) }
             }
 
             #[inline]
             fn trailing_zeros(self) -> Self {
                 // Safety: `self` is an integer vector
-                unsafe { intrinsics::simd_cttz(self) }
+                unsafe { core::intrinsics::simd::simd_cttz(self) }
             }
 
             #[inline]
diff --git a/library/portable-simd/crates/core_simd/src/simd/ptr/const_ptr.rs b/library/portable-simd/crates/core_simd/src/simd/ptr/const_ptr.rs
index 97fe3fb600d..e217d1c8c87 100644
--- a/library/portable-simd/crates/core_simd/src/simd/ptr/const_ptr.rs
+++ b/library/portable-simd/crates/core_simd/src/simd/ptr/const_ptr.rs
@@ -1,7 +1,5 @@
 use super::sealed::Sealed;
-use crate::simd::{
-    cmp::SimdPartialEq, intrinsics, num::SimdUint, LaneCount, Mask, Simd, SupportedLaneCount,
-};
+use crate::simd::{cmp::SimdPartialEq, num::SimdUint, LaneCount, Mask, Simd, SupportedLaneCount};
 
 /// Operations on SIMD vectors of constant pointers.
 pub trait SimdConstPtr: Copy + Sealed {
@@ -103,13 +101,13 @@ where
         assert_eq!(size_of::<<U as Pointee>::Metadata>(), 0);
 
         // Safety: pointers can be cast
-        unsafe { intrinsics::simd_cast_ptr(self) }
+        unsafe { core::intrinsics::simd::simd_cast_ptr(self) }
     }
 
     #[inline]
     fn cast_mut(self) -> Self::MutPtr {
         // Safety: pointers can be cast
-        unsafe { intrinsics::simd_cast_ptr(self) }
+        unsafe { core::intrinsics::simd::simd_cast_ptr(self) }
     }
 
     #[inline]
@@ -135,19 +133,19 @@ where
     #[inline]
     fn expose_addr(self) -> Self::Usize {
         // Safety: `self` is a pointer vector
-        unsafe { intrinsics::simd_expose_addr(self) }
+        unsafe { core::intrinsics::simd::simd_expose_addr(self) }
     }
 
     #[inline]
     fn from_exposed_addr(addr: Self::Usize) -> Self {
         // Safety: `self` is a pointer vector
-        unsafe { intrinsics::simd_from_exposed_addr(addr) }
+        unsafe { core::intrinsics::simd::simd_from_exposed_addr(addr) }
     }
 
     #[inline]
     fn wrapping_offset(self, count: Self::Isize) -> Self {
         // Safety: simd_arith_offset takes a vector of pointers and a vector of offsets
-        unsafe { intrinsics::simd_arith_offset(self, count) }
+        unsafe { core::intrinsics::simd::simd_arith_offset(self, count) }
     }
 
     #[inline]
diff --git a/library/portable-simd/crates/core_simd/src/simd/ptr/mut_ptr.rs b/library/portable-simd/crates/core_simd/src/simd/ptr/mut_ptr.rs
index e35633d0433..5cb27af4fde 100644
--- a/library/portable-simd/crates/core_simd/src/simd/ptr/mut_ptr.rs
+++ b/library/portable-simd/crates/core_simd/src/simd/ptr/mut_ptr.rs
@@ -1,7 +1,5 @@
 use super::sealed::Sealed;
-use crate::simd::{
-    cmp::SimdPartialEq, intrinsics, num::SimdUint, LaneCount, Mask, Simd, SupportedLaneCount,
-};
+use crate::simd::{cmp::SimdPartialEq, num::SimdUint, LaneCount, Mask, Simd, SupportedLaneCount};
 
 /// Operations on SIMD vectors of mutable pointers.
 pub trait SimdMutPtr: Copy + Sealed {
@@ -100,13 +98,13 @@ where
         assert_eq!(size_of::<<U as Pointee>::Metadata>(), 0);
 
         // Safety: pointers can be cast
-        unsafe { intrinsics::simd_cast_ptr(self) }
+        unsafe { core::intrinsics::simd::simd_cast_ptr(self) }
     }
 
     #[inline]
     fn cast_const(self) -> Self::ConstPtr {
         // Safety: pointers can be cast
-        unsafe { intrinsics::simd_cast_ptr(self) }
+        unsafe { core::intrinsics::simd::simd_cast_ptr(self) }
     }
 
     #[inline]
@@ -132,19 +130,19 @@ where
     #[inline]
     fn expose_addr(self) -> Self::Usize {
         // Safety: `self` is a pointer vector
-        unsafe { intrinsics::simd_expose_addr(self) }
+        unsafe { core::intrinsics::simd::simd_expose_addr(self) }
     }
 
     #[inline]
     fn from_exposed_addr(addr: Self::Usize) -> Self {
         // Safety: `self` is a pointer vector
-        unsafe { intrinsics::simd_from_exposed_addr(addr) }
+        unsafe { core::intrinsics::simd::simd_from_exposed_addr(addr) }
     }
 
     #[inline]
     fn wrapping_offset(self, count: Self::Isize) -> Self {
         // Safety: simd_arith_offset takes a vector of pointers and a vector of offsets
-        unsafe { intrinsics::simd_arith_offset(self, count) }
+        unsafe { core::intrinsics::simd::simd_arith_offset(self, count) }
     }
 
     #[inline]
diff --git a/library/portable-simd/crates/core_simd/src/swizzle.rs b/library/portable-simd/crates/core_simd/src/swizzle.rs
index ec8548d5574..71110bb2820 100644
--- a/library/portable-simd/crates/core_simd/src/swizzle.rs
+++ b/library/portable-simd/crates/core_simd/src/swizzle.rs
@@ -1,4 +1,3 @@
-use crate::simd::intrinsics;
 use crate::simd::{LaneCount, Mask, MaskElement, Simd, SimdElement, SupportedLaneCount};
 
 /// Constructs a new SIMD vector by copying elements from selected elements in other vectors.
@@ -88,7 +87,7 @@ pub trait Swizzle<const N: usize> {
     {
         // Safety: `vector` is a vector, and the index is a const array of u32.
         unsafe {
-            intrinsics::simd_shuffle(
+            core::intrinsics::simd::simd_shuffle(
                 vector,
                 vector,
                 const {
@@ -124,7 +123,7 @@ pub trait Swizzle<const N: usize> {
     {
         // Safety: `first` and `second` are vectors, and the index is a const array of u32.
         unsafe {
-            intrinsics::simd_shuffle(
+            core::intrinsics::simd::simd_shuffle(
                 first,
                 second,
                 const {
diff --git a/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs b/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs
index dac013cc98d..ae9ff6894b0 100644
--- a/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs
+++ b/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs
@@ -44,7 +44,7 @@ where
                 ))]
                 8 => transize(vtbl1_u8, self, idxs),
                 #[cfg(target_feature = "ssse3")]
-                16 => transize(x86::_mm_shuffle_epi8, self, idxs),
+                16 => transize(x86::_mm_shuffle_epi8, self, zeroing_idxs(idxs)),
                 #[cfg(target_feature = "simd128")]
                 16 => transize(wasm::i8x16_swizzle, self, idxs),
                 #[cfg(all(
@@ -54,9 +54,9 @@ where
                 ))]
                 16 => transize(vqtbl1q_u8, self, idxs),
                 #[cfg(all(target_feature = "avx2", not(target_feature = "avx512vbmi")))]
-                32 => transize_raw(avx2_pshufb, self, idxs),
+                32 => transize(avx2_pshufb, self, idxs),
                 #[cfg(all(target_feature = "avx512vl", target_feature = "avx512vbmi"))]
-                32 => transize(x86::_mm256_permutexvar_epi8, self, idxs),
+                32 => transize(x86::_mm256_permutexvar_epi8, zeroing_idxs(idxs), self),
                 // Notable absence: avx512bw shuffle
                 // If avx512bw is available, odds of avx512vbmi are good
                 // FIXME: initial AVX512VBMI variant didn't actually pass muster
@@ -129,45 +129,25 @@ unsafe fn avx2_pshufb(bytes: Simd<u8, 32>, idxs: Simd<u8, 32>) -> Simd<u8, 32> {
 #[inline(always)]
 unsafe fn transize<T, const N: usize>(
     f: unsafe fn(T, T) -> T,
-    bytes: Simd<u8, N>,
-    idxs: Simd<u8, N>,
+    a: Simd<u8, N>,
+    b: Simd<u8, N>,
 ) -> Simd<u8, N>
 where
     LaneCount<N>: SupportedLaneCount,
 {
-    let idxs = zeroing_idxs(idxs);
     // SAFETY: Same obligation to use this function as to use mem::transmute_copy.
-    unsafe { mem::transmute_copy(&f(mem::transmute_copy(&bytes), mem::transmute_copy(&idxs))) }
+    unsafe { mem::transmute_copy(&f(mem::transmute_copy(&a), mem::transmute_copy(&b))) }
 }
 
-/// Make indices that yield 0 for this architecture
+/// Make indices that yield 0 for x86
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+#[allow(unused)]
 #[inline(always)]
 fn zeroing_idxs<const N: usize>(idxs: Simd<u8, N>) -> Simd<u8, N>
 where
     LaneCount<N>: SupportedLaneCount,
 {
-    // On x86, make sure the top bit is set.
-    #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-    let idxs = {
-        use crate::simd::cmp::SimdPartialOrd;
-        idxs.simd_lt(Simd::splat(N as u8))
-            .select(idxs, Simd::splat(u8::MAX))
-    };
-    // Simply do nothing on most architectures.
-    idxs
-}
-
-/// As transize but no implicit call to `zeroing_idxs`.
-#[allow(dead_code)]
-#[inline(always)]
-unsafe fn transize_raw<T, const N: usize>(
-    f: unsafe fn(T, T) -> T,
-    bytes: Simd<u8, N>,
-    idxs: Simd<u8, N>,
-) -> Simd<u8, N>
-where
-    LaneCount<N>: SupportedLaneCount,
-{
-    // SAFETY: Same obligation to use this function as to use mem::transmute_copy.
-    unsafe { mem::transmute_copy(&f(mem::transmute_copy(&bytes), mem::transmute_copy(&idxs))) }
+    use crate::simd::cmp::SimdPartialOrd;
+    idxs.simd_lt(Simd::splat(N as u8))
+        .select(idxs, Simd::splat(u8::MAX))
 }
diff --git a/library/portable-simd/crates/core_simd/src/vector.rs b/library/portable-simd/crates/core_simd/src/vector.rs
index 105c06741c5..9e97a3161bb 100644
--- a/library/portable-simd/crates/core_simd/src/vector.rs
+++ b/library/portable-simd/crates/core_simd/src/vector.rs
@@ -1,6 +1,5 @@
 use crate::simd::{
     cmp::SimdPartialOrd,
-    intrinsics,
     ptr::{SimdConstPtr, SimdMutPtr},
     LaneCount, Mask, MaskElement, SupportedLaneCount, Swizzle,
 };
@@ -194,7 +193,7 @@ where
     /// With padding, `read_unaligned` will read past the end of an array of N elements.
     ///
     /// # Safety
-    /// Reading `ptr` must be safe, as if by `<*const [T; N]>::read_unaligned`.
+    /// Reading `ptr` must be safe, as if by `<*const [T; N]>::read`.
     #[inline]
     const unsafe fn load(ptr: *const [T; N]) -> Self {
         // There are potentially simpler ways to write this function, but this should result in
@@ -215,7 +214,7 @@ where
     /// See `load` as to why this function is necessary.
     ///
     /// # Safety
-    /// Writing to `ptr` must be safe, as if by `<*mut [T; N]>::write_unaligned`.
+    /// Writing to `ptr` must be safe, as if by `<*mut [T; N]>::write`.
     #[inline]
     const unsafe fn store(self, ptr: *mut [T; N]) {
         // There are potentially simpler ways to write this function, but this should result in
@@ -491,7 +490,7 @@ where
         or: Self,
     ) -> Self {
         // Safety: The caller is responsible for upholding all invariants
-        unsafe { intrinsics::simd_gather(or, source, enable.to_int()) }
+        unsafe { core::intrinsics::simd::simd_gather(or, source, enable.to_int()) }
     }
 
     /// Writes the values in a SIMD vector to potentially discontiguous indices in `slice`.
@@ -650,7 +649,7 @@ where
     #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
     pub unsafe fn scatter_select_ptr(self, dest: Simd<*mut T, N>, enable: Mask<isize, N>) {
         // Safety: The caller is responsible for upholding all invariants
-        unsafe { intrinsics::simd_scatter(self, dest, enable.to_int()) }
+        unsafe { core::intrinsics::simd::simd_scatter(self, dest, enable.to_int()) }
     }
 }
 
@@ -692,7 +691,8 @@ where
     fn eq(&self, other: &Self) -> bool {
         // Safety: All SIMD vectors are SimdPartialEq, and the comparison produces a valid mask.
         let mask = unsafe {
-            let tfvec: Simd<<T as SimdElement>::Mask, N> = intrinsics::simd_eq(*self, *other);
+            let tfvec: Simd<<T as SimdElement>::Mask, N> =
+                core::intrinsics::simd::simd_eq(*self, *other);
             Mask::from_int_unchecked(tfvec)
         };
 
@@ -705,7 +705,8 @@ where
     fn ne(&self, other: &Self) -> bool {
         // Safety: All SIMD vectors are SimdPartialEq, and the comparison produces a valid mask.
         let mask = unsafe {
-            let tfvec: Simd<<T as SimdElement>::Mask, N> = intrinsics::simd_ne(*self, *other);
+            let tfvec: Simd<<T as SimdElement>::Mask, N> =
+                core::intrinsics::simd::simd_ne(*self, *other);
             Mask::from_int_unchecked(tfvec)
         };
 
diff --git a/library/portable-simd/crates/core_simd/tests/masks.rs b/library/portable-simd/crates/core_simd/tests/masks.rs
index 00fc2a24e27..fc6a3476b7c 100644
--- a/library/portable-simd/crates/core_simd/tests/masks.rs
+++ b/library/portable-simd/crates/core_simd/tests/masks.rs
@@ -99,6 +99,19 @@ macro_rules! test_mask_api {
                 assert_eq!(Mask::<$type, 2>::from_bitmask(bitmask), mask);
             }
 
+            #[cfg(feature = "all_lane_counts")]
+            #[test]
+            fn roundtrip_bitmask_conversion_odd() {
+                let values = [
+                    true, false, true, false, true, true, false, false, false, true, true,
+                ];
+                let mask = Mask::<$type, 11>::from_array(values);
+                let bitmask = mask.to_bitmask();
+                assert_eq!(bitmask, 0b11000110101);
+                assert_eq!(Mask::<$type, 11>::from_bitmask(bitmask), mask);
+            }
+
+
             #[test]
             fn cast() {
                 fn cast_impl<T: core_simd::simd::MaskElement>()
@@ -134,6 +147,35 @@ macro_rules! test_mask_api {
                 assert_eq!(bitmask.resize::<2>(0).to_ne_bytes()[..2], [0b01001001, 0b10000011]);
                 assert_eq!(Mask::<$type, 16>::from_bitmask_vector(bitmask), mask);
             }
+
+            // rust-lang/portable-simd#379
+            #[test]
+            fn roundtrip_bitmask_vector_conversion_small() {
+                use core_simd::simd::ToBytes;
+                let values = [
+                    true, false, true, true
+                ];
+                let mask = Mask::<$type, 4>::from_array(values);
+                let bitmask = mask.to_bitmask_vector();
+                assert_eq!(bitmask.resize::<1>(0).to_ne_bytes()[0], 0b00001101);
+                assert_eq!(Mask::<$type, 4>::from_bitmask_vector(bitmask), mask);
+            }
+
+            /* FIXME doesn't work with non-powers-of-two, yet
+            // rust-lang/portable-simd#379
+            #[cfg(feature = "all_lane_counts")]
+            #[test]
+            fn roundtrip_bitmask_vector_conversion_odd() {
+                use core_simd::simd::ToBytes;
+                let values = [
+                    true, false, true, false, true, true, false, false, false, true, true,
+                ];
+                let mask = Mask::<$type, 11>::from_array(values);
+                let bitmask = mask.to_bitmask_vector();
+                assert_eq!(bitmask.resize::<2>(0).to_ne_bytes()[..2], [0b00110101, 0b00000110]);
+                assert_eq!(Mask::<$type, 11>::from_bitmask_vector(bitmask), mask);
+            }
+            */
         }
     }
 }
diff --git a/library/portable-simd/crates/std_float/src/lib.rs b/library/portable-simd/crates/std_float/src/lib.rs
index 1fef17242ca..4c547777fde 100644
--- a/library/portable-simd/crates/std_float/src/lib.rs
+++ b/library/portable-simd/crates/std_float/src/lib.rs
@@ -1,7 +1,7 @@
 #![cfg_attr(feature = "as_crate", no_std)] // We are std!
 #![cfg_attr(
     feature = "as_crate",
-    feature(platform_intrinsics),
+    feature(core_intrinsics),
     feature(portable_simd),
     allow(internal_features)
 )]
@@ -10,6 +10,8 @@ use core::simd;
 #[cfg(feature = "as_crate")]
 use core_simd::simd;
 
+use core::intrinsics::simd as intrinsics;
+
 use simd::{LaneCount, Simd, SupportedLaneCount};
 
 #[cfg(feature = "as_crate")]
@@ -22,28 +24,6 @@ use experimental as sealed;
 
 use crate::sealed::Sealed;
 
-// "platform intrinsics" are essentially "codegen intrinsics"
-// each of these may be scalarized and lowered to a libm call
-extern "platform-intrinsic" {
-    // ceil
-    fn simd_ceil<T>(x: T) -> T;
-
-    // floor
-    fn simd_floor<T>(x: T) -> T;
-
-    // round
-    fn simd_round<T>(x: T) -> T;
-
-    // trunc
-    fn simd_trunc<T>(x: T) -> T;
-
-    // fsqrt
-    fn simd_fsqrt<T>(x: T) -> T;
-
-    // fma
-    fn simd_fma<T>(x: T, y: T, z: T) -> T;
-}
-
 /// This trait provides a possibly-temporary implementation of float functions
 /// that may, in the absence of hardware support, canonicalize to calling an
 /// operating system's `math.h` dynamically-loaded library (also known as a
@@ -74,7 +54,7 @@ pub trait StdFloat: Sealed + Sized {
     #[inline]
     #[must_use = "method returns a new vector and does not mutate the original value"]
     fn mul_add(self, a: Self, b: Self) -> Self {
-        unsafe { simd_fma(self, a, b) }
+        unsafe { intrinsics::simd_fma(self, a, b) }
     }
 
     /// Produces a vector where every lane has the square root value
@@ -82,35 +62,35 @@ pub trait StdFloat: Sealed + Sized {
     #[inline]
     #[must_use = "method returns a new vector and does not mutate the original value"]
     fn sqrt(self) -> Self {
-        unsafe { simd_fsqrt(self) }
+        unsafe { intrinsics::simd_fsqrt(self) }
     }
 
     /// Returns the smallest integer greater than or equal to each lane.
     #[must_use = "method returns a new vector and does not mutate the original value"]
     #[inline]
     fn ceil(self) -> Self {
-        unsafe { simd_ceil(self) }
+        unsafe { intrinsics::simd_ceil(self) }
     }
 
     /// Returns the largest integer value less than or equal to each lane.
     #[must_use = "method returns a new vector and does not mutate the original value"]
     #[inline]
     fn floor(self) -> Self {
-        unsafe { simd_floor(self) }
+        unsafe { intrinsics::simd_floor(self) }
     }
 
     /// Rounds to the nearest integer value. Ties round toward zero.
     #[must_use = "method returns a new vector and does not mutate the original value"]
     #[inline]
     fn round(self) -> Self {
-        unsafe { simd_round(self) }
+        unsafe { intrinsics::simd_round(self) }
     }
 
     /// Returns the floating point's integer value, with its fractional part removed.
     #[must_use = "method returns a new vector and does not mutate the original value"]
     #[inline]
     fn trunc(self) -> Self {
-        unsafe { simd_trunc(self) }
+        unsafe { intrinsics::simd_trunc(self) }
     }
 
     /// Returns the floating point's fractional value, with its integer part removed.
diff --git a/library/portable-simd/crates/test_helpers/src/lib.rs b/library/portable-simd/crates/test_helpers/src/lib.rs
index b80c745aaf2..51b860a8635 100644
--- a/library/portable-simd/crates/test_helpers/src/lib.rs
+++ b/library/portable-simd/crates/test_helpers/src/lib.rs
@@ -1,4 +1,8 @@
-#![feature(stdsimd, powerpc_target_feature)]
+#![feature(powerpc_target_feature)]
+#![cfg_attr(
+    any(target_arch = "powerpc", target_arch = "powerpc64"),
+    feature(stdarch_powerpc)
+)]
 
 pub mod array;
 
diff --git a/library/std/src/env.rs b/library/std/src/env.rs
index 30ac0512348..5bd20ebe208 100644
--- a/library/std/src/env.rs
+++ b/library/std/src/env.rs
@@ -78,7 +78,7 @@ pub fn current_dir() -> io::Result<PathBuf> {
 /// assert!(env::set_current_dir(&root).is_ok());
 /// println!("Successfully changed working directory to {}!", root.display());
 /// ```
-#[doc(alias = "chdir")]
+#[doc(alias = "chdir", alias = "SetCurrentDirectory", alias = "SetCurrentDirectoryW")]
 #[stable(feature = "env", since = "1.0.0")]
 pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
     os_imp::chdir(path.as_ref())
@@ -655,6 +655,7 @@ pub fn home_dir() -> Option<PathBuf> {
 /// }
 /// ```
 #[must_use]
+#[doc(alias = "GetTempPath", alias = "GetTempPath2")]
 #[stable(feature = "env", since = "1.0.0")]
 pub fn temp_dir() -> PathBuf {
     os_imp::temp_dir()
diff --git a/library/std/src/ffi/mod.rs b/library/std/src/ffi/mod.rs
index 97e78d17786..818571ddaaa 100644
--- a/library/std/src/ffi/mod.rs
+++ b/library/std/src/ffi/mod.rs
@@ -127,6 +127,11 @@
 //! trait, which provides a [`from_wide`] method to convert a native Windows
 //! string (without the terminating nul character) to an [`OsString`].
 //!
+//! ## Other platforms
+//!
+//! Many other platforms provide their own extension traits in a
+//! `std::os::*::ffi` module.
+//!
 //! ## On all platforms
 //!
 //! On all platforms, [`OsStr`] consists of a sequence of bytes that is encoded as a superset of
@@ -135,6 +140,8 @@
 //! For limited, inexpensive conversions from and to bytes, see [`OsStr::as_encoded_bytes`] and
 //! [`OsStr::from_encoded_bytes_unchecked`].
 //!
+//! For basic string processing, see [`OsStr::slice_encoded_bytes`].
+//!
 //! [Unicode scalar value]: https://www.unicode.org/glossary/#unicode_scalar_value
 //! [Unicode code point]: https://www.unicode.org/glossary/#code_point
 //! [`env::set_var()`]: crate::env::set_var "env::set_var"
diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs
index 81973182148..28747ad8f34 100644
--- a/library/std/src/ffi/os_str.rs
+++ b/library/std/src/ffi/os_str.rs
@@ -9,7 +9,7 @@ use crate::hash::{Hash, Hasher};
 use crate::ops::{self, Range};
 use crate::rc::Rc;
 use crate::slice;
-use crate::str::{from_utf8 as str_from_utf8, FromStr};
+use crate::str::FromStr;
 use crate::sync::Arc;
 
 use crate::sys::os_str::{Buf, Slice};
@@ -997,42 +997,15 @@ impl OsStr {
     /// ```
     #[unstable(feature = "os_str_slice", issue = "118485")]
     pub fn slice_encoded_bytes<R: ops::RangeBounds<usize>>(&self, range: R) -> &Self {
-        #[track_caller]
-        fn check_valid_boundary(bytes: &[u8], index: usize) {
-            if index == 0 || index == bytes.len() {
-                return;
-            }
-
-            // Fast path
-            if bytes[index - 1].is_ascii() || bytes[index].is_ascii() {
-                return;
-            }
-
-            let (before, after) = bytes.split_at(index);
-
-            // UTF-8 takes at most 4 bytes per codepoint, so we don't
-            // need to check more than that.
-            let after = after.get(..4).unwrap_or(after);
-            match str_from_utf8(after) {
-                Ok(_) => return,
-                Err(err) if err.valid_up_to() != 0 => return,
-                Err(_) => (),
-            }
-
-            for len in 2..=4.min(index) {
-                let before = &before[index - len..];
-                if str_from_utf8(before).is_ok() {
-                    return;
-                }
-            }
-
-            panic!("byte index {index} is not an OsStr boundary");
-        }
-
         let encoded_bytes = self.as_encoded_bytes();
         let Range { start, end } = slice::range(range, ..encoded_bytes.len());
-        check_valid_boundary(encoded_bytes, start);
-        check_valid_boundary(encoded_bytes, end);
+
+        // `check_public_boundary` should panic if the index does not lie on an
+        // `OsStr` boundary as described above. It's possible to do this in an
+        // encoding-agnostic way, but details of the internal encoding might
+        // permit a more efficient implementation.
+        self.inner.check_public_boundary(start);
+        self.inner.check_public_boundary(end);
 
         // SAFETY: `slice::range` ensures that `start` and `end` are valid
         let slice = unsafe { encoded_bytes.get_unchecked(start..end) };
diff --git a/library/std/src/ffi/os_str/tests.rs b/library/std/src/ffi/os_str/tests.rs
index 60cde376d32..b020e05eaab 100644
--- a/library/std/src/ffi/os_str/tests.rs
+++ b/library/std/src/ffi/os_str/tests.rs
@@ -194,15 +194,65 @@ fn slice_encoded_bytes() {
 }
 
 #[test]
-#[should_panic(expected = "byte index 2 is not an OsStr boundary")]
+#[should_panic]
+fn slice_out_of_bounds() {
+    let crab = OsStr::new("🦀");
+    let _ = crab.slice_encoded_bytes(..5);
+}
+
+#[test]
+#[should_panic]
 fn slice_mid_char() {
     let crab = OsStr::new("🦀");
     let _ = crab.slice_encoded_bytes(..2);
 }
 
+#[cfg(unix)]
+#[test]
+#[should_panic(expected = "byte index 1 is not an OsStr boundary")]
+fn slice_invalid_data() {
+    use crate::os::unix::ffi::OsStrExt;
+
+    let os_string = OsStr::from_bytes(b"\xFF\xFF");
+    let _ = os_string.slice_encoded_bytes(1..);
+}
+
+#[cfg(unix)]
+#[test]
+#[should_panic(expected = "byte index 1 is not an OsStr boundary")]
+fn slice_partial_utf8() {
+    use crate::os::unix::ffi::{OsStrExt, OsStringExt};
+
+    let part_crab = OsStr::from_bytes(&"🦀".as_bytes()[..3]);
+    let mut os_string = OsString::from_vec(vec![0xFF]);
+    os_string.push(part_crab);
+    let _ = os_string.slice_encoded_bytes(1..);
+}
+
+#[cfg(unix)]
+#[test]
+fn slice_invalid_edge() {
+    use crate::os::unix::ffi::{OsStrExt, OsStringExt};
+
+    let os_string = OsStr::from_bytes(b"a\xFFa");
+    assert_eq!(os_string.slice_encoded_bytes(..1), "a");
+    assert_eq!(os_string.slice_encoded_bytes(1..), OsStr::from_bytes(b"\xFFa"));
+    assert_eq!(os_string.slice_encoded_bytes(..2), OsStr::from_bytes(b"a\xFF"));
+    assert_eq!(os_string.slice_encoded_bytes(2..), "a");
+
+    let os_string = OsStr::from_bytes(&"abc🦀".as_bytes()[..6]);
+    assert_eq!(os_string.slice_encoded_bytes(..3), "abc");
+    assert_eq!(os_string.slice_encoded_bytes(3..), OsStr::from_bytes(b"\xF0\x9F\xA6"));
+
+    let mut os_string = OsString::from_vec(vec![0xFF]);
+    os_string.push("🦀");
+    assert_eq!(os_string.slice_encoded_bytes(..1), OsStr::from_bytes(b"\xFF"));
+    assert_eq!(os_string.slice_encoded_bytes(1..), "🦀");
+}
+
 #[cfg(windows)]
 #[test]
-#[should_panic(expected = "byte index 3 is not an OsStr boundary")]
+#[should_panic(expected = "byte index 3 lies between surrogate codepoints")]
 fn slice_between_surrogates() {
     use crate::os::windows::ffi::OsStringExt;
 
@@ -216,10 +266,14 @@ fn slice_between_surrogates() {
 fn slice_surrogate_edge() {
     use crate::os::windows::ffi::OsStringExt;
 
-    let os_string = OsString::from_wide(&[0xD800]);
-    let mut with_crab = os_string.clone();
-    with_crab.push("🦀");
+    let surrogate = OsString::from_wide(&[0xD800]);
+    let mut pre_crab = surrogate.clone();
+    pre_crab.push("🦀");
+    assert_eq!(pre_crab.slice_encoded_bytes(..3), surrogate);
+    assert_eq!(pre_crab.slice_encoded_bytes(3..), "🦀");
 
-    assert_eq!(with_crab.slice_encoded_bytes(..3), os_string);
-    assert_eq!(with_crab.slice_encoded_bytes(3..), "🦀");
+    let mut post_crab = OsString::from("🦀");
+    post_crab.push(&surrogate);
+    assert_eq!(post_crab.slice_encoded_bytes(..4), "🦀");
+    assert_eq!(post_crab.slice_encoded_bytes(4..), surrogate);
 }
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index db8de1b1e3d..6b1dd1b5af4 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -656,6 +656,7 @@ impl File {
     ///
     /// Note that this method alters the permissions of the underlying file,
     /// even though it takes `&self` rather than `&mut self`.
+    #[doc(alias = "fchmod", alias = "SetFileInformationByHandle")]
     #[stable(feature = "set_permissions_atomic", since = "1.16.0")]
     pub fn set_permissions(&self, perm: Permissions) -> io::Result<()> {
         self.inner.set_permissions(perm.0)
@@ -1314,6 +1315,7 @@ impl Metadata {
     ///     Ok(())
     /// }
     /// ```
+    #[doc(alias = "mtime", alias = "ftLastWriteTime")]
     #[stable(feature = "fs_time", since = "1.10.0")]
     pub fn modified(&self) -> io::Result<SystemTime> {
         self.0.modified().map(FromInner::from_inner)
@@ -1349,6 +1351,7 @@ impl Metadata {
     ///     Ok(())
     /// }
     /// ```
+    #[doc(alias = "atime", alias = "ftLastAccessTime")]
     #[stable(feature = "fs_time", since = "1.10.0")]
     pub fn accessed(&self) -> io::Result<SystemTime> {
         self.0.accessed().map(FromInner::from_inner)
@@ -1381,6 +1384,7 @@ impl Metadata {
     ///     Ok(())
     /// }
     /// ```
+    #[doc(alias = "btime", alias = "birthtime", alias = "ftCreationTime")]
     #[stable(feature = "fs_time", since = "1.10.0")]
     pub fn created(&self) -> io::Result<SystemTime> {
         self.0.created().map(FromInner::from_inner)
@@ -1879,6 +1883,7 @@ impl AsInner<fs_imp::DirEntry> for DirEntry {
 ///     Ok(())
 /// }
 /// ```
+#[doc(alias = "rm", alias = "unlink", alias = "DeleteFile")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
     fs_imp::unlink(path.as_ref())
@@ -1917,6 +1922,7 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
 ///     Ok(())
 /// }
 /// ```
+#[doc(alias = "stat")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
     fs_imp::stat(path.as_ref()).map(Metadata)
@@ -1951,6 +1957,7 @@ pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
 ///     Ok(())
 /// }
 /// ```
+#[doc(alias = "lstat")]
 #[stable(feature = "symlink_metadata", since = "1.1.0")]
 pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
     fs_imp::lstat(path.as_ref()).map(Metadata)
@@ -1994,6 +2001,7 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
 ///     Ok(())
 /// }
 /// ```
+#[doc(alias = "mv", alias = "MoveFile", alias = "MoveFileEx")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> {
     fs_imp::rename(from.as_ref(), to.as_ref())
@@ -2052,6 +2060,9 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
 ///     Ok(())
 /// }
 /// ```
+#[doc(alias = "cp")]
+#[doc(alias = "CopyFile", alias = "CopyFileEx")]
+#[doc(alias = "fclonefileat", alias = "fcopyfile")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
     fs_imp::copy(from.as_ref(), to.as_ref())
@@ -2096,6 +2107,7 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
 ///     Ok(())
 /// }
 /// ```
+#[doc(alias = "CreateHardLink", alias = "linkat")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> {
     fs_imp::link(original.as_ref(), link.as_ref())
@@ -2245,7 +2257,7 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
 ///     Ok(())
 /// }
 /// ```
-#[doc(alias = "mkdir")]
+#[doc(alias = "mkdir", alias = "CreateDirectory")]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[cfg_attr(not(test), rustc_diagnostic_item = "fs_create_dir")]
 pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
@@ -2326,7 +2338,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
 ///     Ok(())
 /// }
 /// ```
-#[doc(alias = "rmdir")]
+#[doc(alias = "rmdir", alias = "RemoveDirectory")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
     fs_imp::rmdir(path.as_ref())
@@ -2449,6 +2461,7 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
 ///     Ok(())
 /// }
 /// ```
+#[doc(alias = "ls", alias = "opendir", alias = "FindFirstFile", alias = "FindNextFile")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
     fs_imp::readdir(path.as_ref()).map(ReadDir)
@@ -2484,6 +2497,7 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
 ///     Ok(())
 /// }
 /// ```
+#[doc(alias = "chmod", alias = "SetFileAttributes")]
 #[stable(feature = "set_permissions", since = "1.1.0")]
 pub fn set_permissions<P: AsRef<Path>>(path: P, perm: Permissions) -> io::Result<()> {
     fs_imp::set_perm(path.as_ref(), perm.0)
diff --git a/library/std/src/io/buffered/bufreader.rs b/library/std/src/io/buffered/bufreader.rs
index e920500d7d0..e0dc9f96ae9 100644
--- a/library/std/src/io/buffered/bufreader.rs
+++ b/library/std/src/io/buffered/bufreader.rs
@@ -26,8 +26,7 @@ use buffer::Buffer;
 /// unwrapping the `BufReader<R>` with [`BufReader::into_inner`] can also cause
 /// data loss.
 ///
-// HACK(#78696): can't use `crate` for associated items
-/// [`TcpStream::read`]: super::super::super::net::TcpStream::read
+/// [`TcpStream::read`]: crate::net::TcpStream::read
 /// [`TcpStream`]: crate::net::TcpStream
 ///
 /// # Examples
diff --git a/library/std/src/io/buffered/bufwriter.rs b/library/std/src/io/buffered/bufwriter.rs
index 95ba82e1e07..665d8602c08 100644
--- a/library/std/src/io/buffered/bufwriter.rs
+++ b/library/std/src/io/buffered/bufwriter.rs
@@ -62,8 +62,7 @@ use crate::ptr;
 /// together by the buffer and will all be written out in one system call when
 /// the `stream` is flushed.
 ///
-// HACK(#78696): can't use `crate` for associated items
-/// [`TcpStream::write`]: super::super::super::net::TcpStream::write
+/// [`TcpStream::write`]: crate::net::TcpStream::write
 /// [`TcpStream`]: crate::net::TcpStream
 /// [`flush`]: BufWriter::flush
 #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index f842a0b6d55..102db62fced 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -2672,6 +2672,42 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
         }
         self.second.read_vectored(bufs)
     }
+
+    #[inline]
+    fn is_read_vectored(&self) -> bool {
+        self.first.is_read_vectored() || self.second.is_read_vectored()
+    }
+
+    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
+        let mut read = 0;
+        if !self.done_first {
+            read += self.first.read_to_end(buf)?;
+            self.done_first = true;
+        }
+        read += self.second.read_to_end(buf)?;
+        Ok(read)
+    }
+
+    // We don't override `read_to_string` here because an UTF-8 sequence could
+    // be split between the two parts of the chain
+
+    fn read_buf(&mut self, mut buf: BorrowedCursor<'_>) -> Result<()> {
+        if buf.capacity() == 0 {
+            return Ok(());
+        }
+
+        if !self.done_first {
+            let old_len = buf.written();
+            self.first.read_buf(buf.reborrow())?;
+
+            if buf.written() != old_len {
+                return Ok(());
+            } else {
+                self.done_first = true;
+            }
+        }
+        self.second.read_buf(buf)
+    }
 }
 
 #[stable(feature = "chain_bufread", since = "1.9.0")]
@@ -2679,9 +2715,7 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
     fn fill_buf(&mut self) -> Result<&[u8]> {
         if !self.done_first {
             match self.first.fill_buf()? {
-                buf if buf.is_empty() => {
-                    self.done_first = true;
-                }
+                buf if buf.is_empty() => self.done_first = true,
                 buf => return Ok(buf),
             }
         }
@@ -2691,6 +2725,24 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
     fn consume(&mut self, amt: usize) {
         if !self.done_first { self.first.consume(amt) } else { self.second.consume(amt) }
     }
+
+    fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
+        let mut read = 0;
+        if !self.done_first {
+            let n = self.first.read_until(byte, buf)?;
+            read += n;
+
+            match buf.last() {
+                Some(b) if *b == byte && n != 0 => return Ok(read),
+                _ => self.done_first = true,
+            }
+        }
+        read += self.second.read_until(byte, buf)?;
+        Ok(read)
+    }
+
+    // We don't override `read_line` here because an UTF-8 sequence could be
+    // split between the two parts of the chain
 }
 
 impl<T, U> SizeHint for Chain<T, U> {
diff --git a/library/std/src/io/tests.rs b/library/std/src/io/tests.rs
index fd7e51688cd..5396f7f6e21 100644
--- a/library/std/src/io/tests.rs
+++ b/library/std/src/io/tests.rs
@@ -262,6 +262,17 @@ fn chain_bufread() {
 }
 
 #[test]
+fn chain_splitted_char() {
+    let chain = b"\xc3".chain(b"\xa9".as_slice());
+    assert_eq!(crate::io::read_to_string(chain).unwrap(), "é");
+
+    let mut chain = b"\xc3".chain(b"\xa9\n".as_slice());
+    let mut buf = String::new();
+    assert_eq!(chain.read_line(&mut buf).unwrap(), 3);
+    assert_eq!(buf, "é\n");
+}
+
+#[test]
 fn bufreader_size_hint() {
     let testdata = b"ABCDEFGHIJKL";
     let mut buf_reader = BufReader::new(&testdata[..]);
diff --git a/library/std/src/os/wasi/fs.rs b/library/std/src/os/wasi/fs.rs
index 3da8c835511..4525c3aa914 100644
--- a/library/std/src/os/wasi/fs.rs
+++ b/library/std/src/os/wasi/fs.rs
@@ -173,51 +173,61 @@ pub trait FileExt {
     ///
     /// This corresponds to the `fd_tell` syscall and is similar to
     /// `seek` where you offset 0 bytes from the current position.
+    #[doc(alias = "fd_tell")]
     fn tell(&self) -> io::Result<u64>;
 
     /// Adjust the flags associated with this file.
     ///
     /// This corresponds to the `fd_fdstat_set_flags` syscall.
+    #[doc(alias = "fd_fdstat_set_flags")]
     fn fdstat_set_flags(&self, flags: u16) -> io::Result<()>;
 
     /// Adjust the rights associated with this file.
     ///
     /// This corresponds to the `fd_fdstat_set_rights` syscall.
+    #[doc(alias = "fd_fdstat_set_rights")]
     fn fdstat_set_rights(&self, rights: u64, inheriting: u64) -> io::Result<()>;
 
     /// Provide file advisory information on a file descriptor.
     ///
     /// This corresponds to the `fd_advise` syscall.
+    #[doc(alias = "fd_advise")]
     fn advise(&self, offset: u64, len: u64, advice: u8) -> io::Result<()>;
 
     /// Force the allocation of space in a file.
     ///
     /// This corresponds to the `fd_allocate` syscall.
+    #[doc(alias = "fd_allocate")]
     fn allocate(&self, offset: u64, len: u64) -> io::Result<()>;
 
     /// Create a directory.
     ///
     /// This corresponds to the `path_create_directory` syscall.
+    #[doc(alias = "path_create_directory")]
     fn create_directory<P: AsRef<Path>>(&self, dir: P) -> io::Result<()>;
 
     /// Read the contents of a symbolic link.
     ///
     /// This corresponds to the `path_readlink` syscall.
+    #[doc(alias = "path_readlink")]
     fn read_link<P: AsRef<Path>>(&self, path: P) -> io::Result<PathBuf>;
 
     /// Return the attributes of a file or directory.
     ///
     /// This corresponds to the `path_filestat_get` syscall.
+    #[doc(alias = "path_filestat_get")]
     fn metadata_at<P: AsRef<Path>>(&self, lookup_flags: u32, path: P) -> io::Result<Metadata>;
 
     /// Unlink a file.
     ///
     /// This corresponds to the `path_unlink_file` syscall.
+    #[doc(alias = "path_unlink_file")]
     fn remove_file<P: AsRef<Path>>(&self, path: P) -> io::Result<()>;
 
     /// Remove a directory.
     ///
     /// This corresponds to the `path_remove_directory` syscall.
+    #[doc(alias = "path_remove_directory")]
     fn remove_directory<P: AsRef<Path>>(&self, path: P) -> io::Result<()>;
 }
 
@@ -359,6 +369,7 @@ pub trait OpenOptionsExt {
     /// Open a file or directory.
     ///
     /// This corresponds to the `path_open` syscall.
+    #[doc(alias = "path_open")]
     fn open_at<P: AsRef<Path>>(&self, file: &File, path: P) -> io::Result<File>;
 }
 
@@ -500,6 +511,7 @@ impl DirEntryExt for fs::DirEntry {
 /// Create a hard link.
 ///
 /// This corresponds to the `path_link` syscall.
+#[doc(alias = "path_link")]
 pub fn link<P: AsRef<Path>, U: AsRef<Path>>(
     old_fd: &File,
     old_flags: u32,
@@ -518,6 +530,7 @@ pub fn link<P: AsRef<Path>, U: AsRef<Path>>(
 /// Rename a file or directory.
 ///
 /// This corresponds to the `path_rename` syscall.
+#[doc(alias = "path_rename")]
 pub fn rename<P: AsRef<Path>, U: AsRef<Path>>(
     old_fd: &File,
     old_path: P,
@@ -534,6 +547,7 @@ pub fn rename<P: AsRef<Path>, U: AsRef<Path>>(
 /// Create a symbolic link.
 ///
 /// This corresponds to the `path_symlink` syscall.
+#[doc(alias = "path_symlink")]
 pub fn symlink<P: AsRef<Path>, U: AsRef<Path>>(
     old_path: P,
     fd: &File,
diff --git a/library/std/src/prelude/mod.rs b/library/std/src/prelude/mod.rs
index 1b29c887d21..7d44d2e4b5d 100644
--- a/library/std/src/prelude/mod.rs
+++ b/library/std/src/prelude/mod.rs
@@ -132,13 +132,13 @@ pub mod rust_2021 {
 /// The 2024 version of the prelude of The Rust Standard Library.
 ///
 /// See the [module-level documentation](self) for more.
-#[unstable(feature = "prelude_2024", issue = "none")]
+#[unstable(feature = "prelude_2024", issue = "121042")]
 pub mod rust_2024 {
-    #[unstable(feature = "prelude_2024", issue = "none")]
+    #[unstable(feature = "prelude_2024", issue = "121042")]
     #[doc(no_inline)]
     pub use super::v1::*;
 
-    #[unstable(feature = "prelude_2024", issue = "none")]
+    #[unstable(feature = "prelude_2024", issue = "121042")]
     #[doc(no_inline)]
     pub use core::prelude::rust_2024::*;
 }
diff --git a/library/std/src/sys/pal/unix/locks/futex_condvar.rs b/library/std/src/sys/locks/condvar/futex.rs
index 4bd65dd25c2..3ad93ce07f7 100644
--- a/library/std/src/sys/pal/unix/locks/futex_condvar.rs
+++ b/library/std/src/sys/locks/condvar/futex.rs
@@ -1,6 +1,6 @@
-use super::Mutex;
 use crate::sync::atomic::{AtomicU32, Ordering::Relaxed};
 use crate::sys::futex::{futex_wait, futex_wake, futex_wake_all};
+use crate::sys::locks::Mutex;
 use crate::time::Duration;
 
 pub struct Condvar {
diff --git a/library/std/src/sys/pal/itron/condvar.rs b/library/std/src/sys/locks/condvar/itron.rs
index 7a47cc6696a..4c6f5e9dad2 100644
--- a/library/std/src/sys/pal/itron/condvar.rs
+++ b/library/std/src/sys/locks/condvar/itron.rs
@@ -1,5 +1,7 @@
 //! POSIX conditional variable implementation based on user-space wait queues.
-use super::{abi, error::expect_success_aborting, spin::SpinMutex, task, time::with_tmos_strong};
+use crate::sys::pal::itron::{
+    abi, error::expect_success_aborting, spin::SpinMutex, task, time::with_tmos_strong,
+};
 use crate::{mem::replace, ptr::NonNull, sys::locks::Mutex, time::Duration};
 
 // The implementation is inspired by the queue-based implementation shown in
diff --git a/library/std/src/sys/locks/condvar/mod.rs b/library/std/src/sys/locks/condvar/mod.rs
new file mode 100644
index 00000000000..126a42a2a4c
--- /dev/null
+++ b/library/std/src/sys/locks/condvar/mod.rs
@@ -0,0 +1,36 @@
+cfg_if::cfg_if! {
+    if #[cfg(any(
+        target_os = "linux",
+        target_os = "android",
+        target_os = "freebsd",
+        target_os = "openbsd",
+        target_os = "dragonfly",
+        target_os = "fuchsia",
+        all(target_family = "wasm", target_feature = "atomics"),
+        target_os = "hermit",
+    ))] {
+        mod futex;
+        pub use futex::Condvar;
+    } else if #[cfg(target_family = "unix")] {
+        mod pthread;
+        pub use pthread::Condvar;
+    } else if #[cfg(target_os = "windows")] {
+        mod windows;
+        pub use windows::Condvar;
+    } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
+        mod sgx;
+        pub use sgx::Condvar;
+    } else if #[cfg(target_os = "solid_asp3")] {
+        mod itron;
+        pub use itron::Condvar;
+    } else if #[cfg(target_os = "teeos")] {
+        mod teeos;
+        pub use teeos::Condvar;
+    } else if #[cfg(target_os = "xous")] {
+        mod xous;
+        pub use xous::Condvar;
+    } else {
+        mod no_threads;
+        pub use no_threads::Condvar;
+    }
+}
diff --git a/library/std/src/sys/pal/unsupported/locks/condvar.rs b/library/std/src/sys/locks/condvar/no_threads.rs
index 3f0943b50ee..3f0943b50ee 100644
--- a/library/std/src/sys/pal/unsupported/locks/condvar.rs
+++ b/library/std/src/sys/locks/condvar/no_threads.rs
diff --git a/library/std/src/sys/pal/unix/locks/pthread_condvar.rs b/library/std/src/sys/locks/condvar/pthread.rs
index 2dc1b0c601e..094738d5a3f 100644
--- a/library/std/src/sys/pal/unix/locks/pthread_condvar.rs
+++ b/library/std/src/sys/locks/condvar/pthread.rs
@@ -1,7 +1,7 @@
 use crate::cell::UnsafeCell;
 use crate::ptr;
 use crate::sync::atomic::{AtomicPtr, Ordering::Relaxed};
-use crate::sys::locks::{pthread_mutex, Mutex};
+use crate::sys::locks::{mutex, Mutex};
 #[cfg(not(target_os = "nto"))]
 use crate::sys::time::TIMESPEC_MAX;
 #[cfg(target_os = "nto")]
@@ -112,7 +112,7 @@ impl Condvar {
 
     #[inline]
     pub unsafe fn wait(&self, mutex: &Mutex) {
-        let mutex = pthread_mutex::raw(mutex);
+        let mutex = mutex::raw(mutex);
         self.verify(mutex);
         let r = libc::pthread_cond_wait(raw(self), mutex);
         debug_assert_eq!(r, 0);
@@ -134,7 +134,7 @@ impl Condvar {
     pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool {
         use crate::sys::time::Timespec;
 
-        let mutex = pthread_mutex::raw(mutex);
+        let mutex = mutex::raw(mutex);
         self.verify(mutex);
 
         #[cfg(not(target_os = "nto"))]
@@ -170,7 +170,7 @@ impl Condvar {
         use crate::sys::time::SystemTime;
         use crate::time::Instant;
 
-        let mutex = pthread_mutex::raw(mutex);
+        let mutex = mutex::raw(mutex);
         self.verify(mutex);
 
         // OSX implementation of `pthread_cond_timedwait` is buggy
diff --git a/library/std/src/sys/pal/sgx/condvar.rs b/library/std/src/sys/locks/condvar/sgx.rs
index aa1174664ae..cabd3250275 100644
--- a/library/std/src/sys/pal/sgx/condvar.rs
+++ b/library/std/src/sys/locks/condvar/sgx.rs
@@ -1,9 +1,8 @@
 use crate::sys::locks::Mutex;
+use crate::sys::pal::waitqueue::{SpinMutex, WaitQueue, WaitVariable};
 use crate::sys_common::lazy_box::{LazyBox, LazyInit};
 use crate::time::Duration;
 
-use super::waitqueue::{SpinMutex, WaitQueue, WaitVariable};
-
 /// FIXME: `UnsafeList` is not movable.
 struct AllocatedCondvar(SpinMutex<WaitVariable<()>>);
 
diff --git a/library/std/src/sys/pal/teeos/locks/condvar.rs b/library/std/src/sys/locks/condvar/teeos.rs
index c08e8145b8c..c08e8145b8c 100644
--- a/library/std/src/sys/pal/teeos/locks/condvar.rs
+++ b/library/std/src/sys/locks/condvar/teeos.rs
diff --git a/library/std/src/sys/pal/windows/locks/condvar.rs b/library/std/src/sys/locks/condvar/windows.rs
index 953bcc27dee..28a288335d2 100644
--- a/library/std/src/sys/pal/windows/locks/condvar.rs
+++ b/library/std/src/sys/locks/condvar/windows.rs
@@ -27,7 +27,7 @@ impl Condvar {
         let r = c::SleepConditionVariableSRW(
             self.inner.get(),
             mutex::raw(mutex),
-            crate::sys::pal::windows::dur2timeout(dur),
+            crate::sys::pal::dur2timeout(dur),
             0,
         );
         if r == 0 {
diff --git a/library/std/src/sys/pal/xous/locks/condvar.rs b/library/std/src/sys/locks/condvar/xous.rs
index 510235046e1..0e51449e0af 100644
--- a/library/std/src/sys/pal/xous/locks/condvar.rs
+++ b/library/std/src/sys/locks/condvar/xous.rs
@@ -1,6 +1,6 @@
-use super::mutex::Mutex;
 use crate::os::xous::ffi::{blocking_scalar, scalar};
 use crate::os::xous::services::{ticktimer_server, TicktimerScalar};
+use crate::sys::locks::Mutex;
 use crate::time::Duration;
 use core::sync::atomic::{AtomicUsize, Ordering};
 
diff --git a/library/std/src/sys/pal/unsupported/locks/mod.rs b/library/std/src/sys/locks/mod.rs
index 0e0f9eccb21..0bdc4a1e1db 100644
--- a/library/std/src/sys/pal/unsupported/locks/mod.rs
+++ b/library/std/src/sys/locks/mod.rs
@@ -1,6 +1,7 @@
 mod condvar;
 mod mutex;
 mod rwlock;
+
 pub use condvar::Condvar;
 pub use mutex::Mutex;
 pub use rwlock::RwLock;
diff --git a/library/std/src/sys/pal/unix/locks/fuchsia_mutex.rs b/library/std/src/sys/locks/mutex/fuchsia.rs
index 5d89e5a13fd..5d89e5a13fd 100644
--- a/library/std/src/sys/pal/unix/locks/fuchsia_mutex.rs
+++ b/library/std/src/sys/locks/mutex/fuchsia.rs
diff --git a/library/std/src/sys/pal/unix/locks/futex_mutex.rs b/library/std/src/sys/locks/mutex/futex.rs
index c01229586c3..c01229586c3 100644
--- a/library/std/src/sys/pal/unix/locks/futex_mutex.rs
+++ b/library/std/src/sys/locks/mutex/futex.rs
diff --git a/library/std/src/sys/pal/itron/mutex.rs b/library/std/src/sys/locks/mutex/itron.rs
index 1f6cc419476..a134eb2d1be 100644
--- a/library/std/src/sys/pal/itron/mutex.rs
+++ b/library/std/src/sys/locks/mutex/itron.rs
@@ -1,6 +1,6 @@
 //! Mutex implementation backed by μITRON mutexes. Assumes `acre_mtx` and
 //! `TA_INHERIT` are available.
-use super::{
+use crate::sys::pal::itron::{
     abi,
     error::{expect_success, expect_success_aborting, fail, ItronError},
     spin::SpinIdOnceCell,
@@ -66,20 +66,3 @@ impl Drop for Mutex {
         }
     }
 }
-
-pub(super) struct MutexGuard<'a>(&'a Mutex);
-
-impl<'a> MutexGuard<'a> {
-    #[inline]
-    pub(super) fn lock(x: &'a Mutex) -> Self {
-        x.lock();
-        Self(x)
-    }
-}
-
-impl Drop for MutexGuard<'_> {
-    #[inline]
-    fn drop(&mut self) {
-        unsafe { self.0.unlock() };
-    }
-}
diff --git a/library/std/src/sys/locks/mutex/mod.rs b/library/std/src/sys/locks/mutex/mod.rs
new file mode 100644
index 00000000000..710cb91fb14
--- /dev/null
+++ b/library/std/src/sys/locks/mutex/mod.rs
@@ -0,0 +1,38 @@
+cfg_if::cfg_if! {
+    if #[cfg(any(
+        target_os = "linux",
+        target_os = "android",
+        target_os = "freebsd",
+        target_os = "openbsd",
+        target_os = "dragonfly",
+        all(target_family = "wasm", target_feature = "atomics"),
+        target_os = "hermit",
+    ))] {
+        mod futex;
+        pub use futex::Mutex;
+    } else if #[cfg(target_os = "fuchsia")] {
+        mod fuchsia;
+        pub use fuchsia::Mutex;
+    } else if #[cfg(any(
+        target_family = "unix",
+        target_os = "teeos",
+    ))] {
+        mod pthread;
+        pub use pthread::{Mutex, raw};
+    } else if #[cfg(target_os = "windows")] {
+        mod windows;
+        pub use windows::{Mutex, raw};
+    } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
+        mod sgx;
+        pub use sgx::Mutex;
+    } else if #[cfg(target_os = "solid_asp3")] {
+        mod itron;
+        pub use itron::Mutex;
+    } else if #[cfg(target_os = "xous")] {
+        mod xous;
+        pub use xous::Mutex;
+    } else {
+        mod no_threads;
+        pub use no_threads::Mutex;
+    }
+}
diff --git a/library/std/src/sys/pal/unsupported/locks/mutex.rs b/library/std/src/sys/locks/mutex/no_threads.rs
index 4a13c55fb8b..4a13c55fb8b 100644
--- a/library/std/src/sys/pal/unsupported/locks/mutex.rs
+++ b/library/std/src/sys/locks/mutex/no_threads.rs
diff --git a/library/std/src/sys/pal/unix/locks/pthread_mutex.rs b/library/std/src/sys/locks/mutex/pthread.rs
index ee0794334fb..ee0794334fb 100644
--- a/library/std/src/sys/pal/unix/locks/pthread_mutex.rs
+++ b/library/std/src/sys/locks/mutex/pthread.rs
diff --git a/library/std/src/sys/pal/sgx/mutex.rs b/library/std/src/sys/locks/mutex/sgx.rs
index 0dbf020ebe0..d37bd02adf8 100644
--- a/library/std/src/sys/pal/sgx/mutex.rs
+++ b/library/std/src/sys/locks/mutex/sgx.rs
@@ -1,4 +1,4 @@
-use super::waitqueue::{try_lock_or_false, SpinMutex, WaitQueue, WaitVariable};
+use crate::sys::pal::waitqueue::{try_lock_or_false, SpinMutex, WaitQueue, WaitVariable};
 use crate::sys_common::lazy_box::{LazyBox, LazyInit};
 
 /// FIXME: `UnsafeList` is not movable.
diff --git a/library/std/src/sys/pal/windows/locks/mutex.rs b/library/std/src/sys/locks/mutex/windows.rs
index ef2f84082cd..ef2f84082cd 100644
--- a/library/std/src/sys/pal/windows/locks/mutex.rs
+++ b/library/std/src/sys/locks/mutex/windows.rs
diff --git a/library/std/src/sys/pal/xous/locks/mutex.rs b/library/std/src/sys/locks/mutex/xous.rs
index a8c9518ff0b..a8c9518ff0b 100644
--- a/library/std/src/sys/pal/xous/locks/mutex.rs
+++ b/library/std/src/sys/locks/mutex/xous.rs
diff --git a/library/std/src/sys/pal/unix/locks/futex_rwlock.rs b/library/std/src/sys/locks/rwlock/futex.rs
index aa0de900238..aa0de900238 100644
--- a/library/std/src/sys/pal/unix/locks/futex_rwlock.rs
+++ b/library/std/src/sys/locks/rwlock/futex.rs
diff --git a/library/std/src/sys/locks/rwlock/mod.rs b/library/std/src/sys/locks/rwlock/mod.rs
new file mode 100644
index 00000000000..0564f1fe6fa
--- /dev/null
+++ b/library/std/src/sys/locks/rwlock/mod.rs
@@ -0,0 +1,36 @@
+cfg_if::cfg_if! {
+    if #[cfg(any(
+        target_os = "linux",
+        target_os = "android",
+        target_os = "freebsd",
+        target_os = "openbsd",
+        target_os = "dragonfly",
+        target_os = "fuchsia",
+        all(target_family = "wasm", target_feature = "atomics"),
+        target_os = "hermit",
+    ))] {
+        mod futex;
+        pub use futex::RwLock;
+    } else if #[cfg(target_family = "unix")] {
+        mod queue;
+        pub use queue::RwLock;
+    } else if #[cfg(target_os = "windows")] {
+        mod windows;
+        pub use windows::RwLock;
+    } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
+        mod sgx;
+        pub use sgx::RwLock;
+    } else if #[cfg(target_os = "solid_asp3")] {
+        mod solid;
+        pub use solid::RwLock;
+    } else if #[cfg(target_os = "teeos")] {
+        mod teeos;
+        pub use teeos::RwLock;
+    } else if #[cfg(target_os = "xous")] {
+        mod xous;
+        pub use xous::RwLock;
+    } else {
+        mod no_threads;
+        pub use no_threads::RwLock;
+    }
+}
diff --git a/library/std/src/sys/pal/unsupported/locks/rwlock.rs b/library/std/src/sys/locks/rwlock/no_threads.rs
index 789ef9b29e5..789ef9b29e5 100644
--- a/library/std/src/sys/pal/unsupported/locks/rwlock.rs
+++ b/library/std/src/sys/locks/rwlock/no_threads.rs
diff --git a/library/std/src/sys/pal/unix/locks/queue_rwlock.rs b/library/std/src/sys/locks/rwlock/queue.rs
index 0f02a98dfdd..0f02a98dfdd 100644
--- a/library/std/src/sys/pal/unix/locks/queue_rwlock.rs
+++ b/library/std/src/sys/locks/rwlock/queue.rs
diff --git a/library/std/src/sys/pal/sgx/rwlock.rs b/library/std/src/sys/locks/rwlock/sgx.rs
index ebae1cff0ee..136dea597bb 100644
--- a/library/std/src/sys/pal/sgx/rwlock.rs
+++ b/library/std/src/sys/locks/rwlock/sgx.rs
@@ -1,13 +1,12 @@
 #[cfg(test)]
 mod tests;
 
+use crate::alloc::Layout;
 use crate::num::NonZero;
-use crate::sys_common::lazy_box::{LazyBox, LazyInit};
-
-use super::waitqueue::{
+use crate::sys::pal::waitqueue::{
     try_lock_or_false, NotifiedTcs, SpinMutex, SpinMutexGuard, WaitQueue, WaitVariable,
 };
-use crate::alloc::Layout;
+use crate::sys_common::lazy_box::{LazyBox, LazyInit};
 
 struct AllocatedRwLock {
     readers: SpinMutex<WaitVariable<Option<NonZero<usize>>>>,
diff --git a/library/std/src/sys/pal/solid/rwlock.rs b/library/std/src/sys/locks/rwlock/solid.rs
index ecb4eb83b9b..9bf6f5dbb73 100644
--- a/library/std/src/sys/pal/solid/rwlock.rs
+++ b/library/std/src/sys/locks/rwlock/solid.rs
@@ -1,5 +1,5 @@
 //! A readers-writer lock implementation backed by the SOLID kernel extension.
-use super::{
+use crate::sys::pal::{
     abi,
     itron::{
         error::{expect_success, expect_success_aborting, fail, ItronError},
diff --git a/library/std/src/sys/pal/teeos/locks/rwlock.rs b/library/std/src/sys/locks/rwlock/teeos.rs
index 27cdb88788f..27cdb88788f 100644
--- a/library/std/src/sys/pal/teeos/locks/rwlock.rs
+++ b/library/std/src/sys/locks/rwlock/teeos.rs
diff --git a/library/std/src/sys/pal/windows/locks/rwlock.rs b/library/std/src/sys/locks/rwlock/windows.rs
index e69415baac4..e69415baac4 100644
--- a/library/std/src/sys/pal/windows/locks/rwlock.rs
+++ b/library/std/src/sys/locks/rwlock/windows.rs
diff --git a/library/std/src/sys/pal/xous/locks/rwlock.rs b/library/std/src/sys/locks/rwlock/xous.rs
index ab45b33e1f6..ab45b33e1f6 100644
--- a/library/std/src/sys/pal/xous/locks/rwlock.rs
+++ b/library/std/src/sys/locks/rwlock/xous.rs
diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs
index fae21636897..d77ac7eb027 100644
--- a/library/std/src/sys/mod.rs
+++ b/library/std/src/sys/mod.rs
@@ -6,6 +6,7 @@ mod pal;
 mod personality;
 
 pub mod cmath;
+pub mod locks;
 pub mod os_str;
 pub mod path;
 
diff --git a/library/std/src/sys/os_str/bytes.rs b/library/std/src/sys/os_str/bytes.rs
index 3a75ce9ebb7..4ca3f1cd185 100644
--- a/library/std/src/sys/os_str/bytes.rs
+++ b/library/std/src/sys/os_str/bytes.rs
@@ -211,6 +211,49 @@ impl Slice {
         unsafe { mem::transmute(s) }
     }
 
+    #[track_caller]
+    #[inline]
+    pub fn check_public_boundary(&self, index: usize) {
+        if index == 0 || index == self.inner.len() {
+            return;
+        }
+        if index < self.inner.len()
+            && (self.inner[index - 1].is_ascii() || self.inner[index].is_ascii())
+        {
+            return;
+        }
+
+        slow_path(&self.inner, index);
+
+        /// We're betting that typical splits will involve an ASCII character.
+        ///
+        /// Putting the expensive checks in a separate function generates notably
+        /// better assembly.
+        #[track_caller]
+        #[inline(never)]
+        fn slow_path(bytes: &[u8], index: usize) {
+            let (before, after) = bytes.split_at(index);
+
+            // UTF-8 takes at most 4 bytes per codepoint, so we don't
+            // need to check more than that.
+            let after = after.get(..4).unwrap_or(after);
+            match str::from_utf8(after) {
+                Ok(_) => return,
+                Err(err) if err.valid_up_to() != 0 => return,
+                Err(_) => (),
+            }
+
+            for len in 2..=4.min(index) {
+                let before = &before[index - len..];
+                if str::from_utf8(before).is_ok() {
+                    return;
+                }
+            }
+
+            panic!("byte index {index} is not an OsStr boundary");
+        }
+    }
+
     #[inline]
     pub fn from_str(s: &str) -> &Slice {
         unsafe { Slice::from_encoded_bytes_unchecked(s.as_bytes()) }
diff --git a/library/std/src/sys/os_str/wtf8.rs b/library/std/src/sys/os_str/wtf8.rs
index 237854fac4e..352bd735903 100644
--- a/library/std/src/sys/os_str/wtf8.rs
+++ b/library/std/src/sys/os_str/wtf8.rs
@@ -6,7 +6,7 @@ use crate::fmt;
 use crate::mem;
 use crate::rc::Rc;
 use crate::sync::Arc;
-use crate::sys_common::wtf8::{Wtf8, Wtf8Buf};
+use crate::sys_common::wtf8::{check_utf8_boundary, Wtf8, Wtf8Buf};
 use crate::sys_common::{AsInner, FromInner, IntoInner};
 
 #[derive(Clone, Hash)]
@@ -171,6 +171,11 @@ impl Slice {
         mem::transmute(Wtf8::from_bytes_unchecked(s))
     }
 
+    #[track_caller]
+    pub fn check_public_boundary(&self, index: usize) {
+        check_utf8_boundary(&self.inner, index);
+    }
+
     #[inline]
     pub fn from_str(s: &str) -> &Slice {
         unsafe { mem::transmute(Wtf8::from_str(s)) }
diff --git a/library/std/src/sys/pal/common/small_c_string.rs b/library/std/src/sys/pal/common/small_c_string.rs
index af9b18e372d..37812fc0659 100644
--- a/library/std/src/sys/pal/common/small_c_string.rs
+++ b/library/std/src/sys/pal/common/small_c_string.rs
@@ -15,22 +15,28 @@ const NUL_ERR: io::Error =
     io::const_io_error!(io::ErrorKind::InvalidInput, "file name contained an unexpected NUL byte");
 
 #[inline]
-pub fn run_path_with_cstr<T, F>(path: &Path, f: F) -> io::Result<T>
-where
-    F: FnOnce(&CStr) -> io::Result<T>,
-{
+pub fn run_path_with_cstr<T>(path: &Path, f: &dyn Fn(&CStr) -> io::Result<T>) -> io::Result<T> {
     run_with_cstr(path.as_os_str().as_encoded_bytes(), f)
 }
 
 #[inline]
-pub fn run_with_cstr<T, F>(bytes: &[u8], f: F) -> io::Result<T>
-where
-    F: FnOnce(&CStr) -> io::Result<T>,
-{
+pub fn run_with_cstr<T>(bytes: &[u8], f: &dyn Fn(&CStr) -> io::Result<T>) -> io::Result<T> {
+    // Dispatch and dyn erase the closure type to prevent mono bloat.
+    // See https://github.com/rust-lang/rust/pull/121101.
     if bytes.len() >= MAX_STACK_ALLOCATION {
-        return run_with_cstr_allocating(bytes, f);
+        run_with_cstr_allocating(bytes, f)
+    } else {
+        unsafe { run_with_cstr_stack(bytes, f) }
     }
+}
 
+/// # Safety
+///
+/// `bytes` must have a length less than `MAX_STACK_ALLOCATION`.
+unsafe fn run_with_cstr_stack<T>(
+    bytes: &[u8],
+    f: &dyn Fn(&CStr) -> io::Result<T>,
+) -> io::Result<T> {
     let mut buf = MaybeUninit::<[u8; MAX_STACK_ALLOCATION]>::uninit();
     let buf_ptr = buf.as_mut_ptr() as *mut u8;
 
@@ -47,10 +53,7 @@ where
 
 #[cold]
 #[inline(never)]
-fn run_with_cstr_allocating<T, F>(bytes: &[u8], f: F) -> io::Result<T>
-where
-    F: FnOnce(&CStr) -> io::Result<T>,
-{
+fn run_with_cstr_allocating<T>(bytes: &[u8], f: &dyn Fn(&CStr) -> io::Result<T>) -> io::Result<T> {
     match CString::new(bytes) {
         Ok(s) => f(&s),
         Err(_) => Err(NUL_ERR),
diff --git a/library/std/src/sys/pal/common/tests.rs b/library/std/src/sys/pal/common/tests.rs
index 32dc18ee1cf..e72d02203da 100644
--- a/library/std/src/sys/pal/common/tests.rs
+++ b/library/std/src/sys/pal/common/tests.rs
@@ -7,7 +7,7 @@ use core::iter::repeat;
 #[test]
 fn stack_allocation_works() {
     let path = Path::new("abc");
-    let result = run_path_with_cstr(path, |p| {
+    let result = run_path_with_cstr(path, &|p| {
         assert_eq!(p, &*CString::new(path.as_os_str().as_encoded_bytes()).unwrap());
         Ok(42)
     });
@@ -17,14 +17,14 @@ fn stack_allocation_works() {
 #[test]
 fn stack_allocation_fails() {
     let path = Path::new("ab\0");
-    assert!(run_path_with_cstr::<(), _>(path, |_| unreachable!()).is_err());
+    assert!(run_path_with_cstr::<()>(path, &|_| unreachable!()).is_err());
 }
 
 #[test]
 fn heap_allocation_works() {
     let path = repeat("a").take(384).collect::<String>();
     let path = Path::new(&path);
-    let result = run_path_with_cstr(path, |p| {
+    let result = run_path_with_cstr(path, &|p| {
         assert_eq!(p, &*CString::new(path.as_os_str().as_encoded_bytes()).unwrap());
         Ok(42)
     });
@@ -36,7 +36,7 @@ fn heap_allocation_fails() {
     let mut path = repeat("a").take(384).collect::<String>();
     path.push('\0');
     let path = Path::new(&path);
-    assert!(run_path_with_cstr::<(), _>(path, |_| unreachable!()).is_err());
+    assert!(run_path_with_cstr::<()>(path, &|_| unreachable!()).is_err());
 }
 
 #[bench]
@@ -44,7 +44,7 @@ fn bench_stack_path_alloc(b: &mut test::Bencher) {
     let path = repeat("a").take(383).collect::<String>();
     let p = Path::new(&path);
     b.iter(|| {
-        run_path_with_cstr(p, |cstr| {
+        run_path_with_cstr(p, &|cstr| {
             black_box(cstr);
             Ok(())
         })
@@ -57,7 +57,7 @@ fn bench_heap_path_alloc(b: &mut test::Bencher) {
     let path = repeat("a").take(384).collect::<String>();
     let p = Path::new(&path);
     b.iter(|| {
-        run_path_with_cstr(p, |cstr| {
+        run_path_with_cstr(p, &|cstr| {
             black_box(cstr);
             Ok(())
         })
diff --git a/library/std/src/sys/pal/hermit/fs.rs b/library/std/src/sys/pal/hermit/fs.rs
index 694482a8a30..d4da53fd3df 100644
--- a/library/std/src/sys/pal/hermit/fs.rs
+++ b/library/std/src/sys/pal/hermit/fs.rs
@@ -269,7 +269,7 @@ impl OpenOptions {
 
 impl File {
     pub fn open(path: &Path, opts: &OpenOptions) -> io::Result<File> {
-        run_path_with_cstr(path, |path| File::open_c(&path, opts))
+        run_path_with_cstr(path, &|path| File::open_c(&path, opts))
     }
 
     pub fn open_c(path: &CStr, opts: &OpenOptions) -> io::Result<File> {
@@ -421,7 +421,7 @@ pub fn readdir(_p: &Path) -> io::Result<ReadDir> {
 }
 
 pub fn unlink(path: &Path) -> io::Result<()> {
-    run_path_with_cstr(path, |path| cvt(unsafe { abi::unlink(path.as_ptr()) }).map(|_| ()))
+    run_path_with_cstr(path, &|path| cvt(unsafe { abi::unlink(path.as_ptr()) }).map(|_| ()))
 }
 
 pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
diff --git a/library/std/src/sys/pal/hermit/mod.rs b/library/std/src/sys/pal/hermit/mod.rs
index 57cc656e266..ada408107dc 100644
--- a/library/std/src/sys/pal/hermit/mod.rs
+++ b/library/std/src/sys/pal/hermit/mod.rs
@@ -39,16 +39,6 @@ pub mod thread_local_dtor;
 pub mod thread_local_key;
 pub mod time;
 
-#[path = "../unix/locks"]
-pub mod locks {
-    mod futex_condvar;
-    mod futex_mutex;
-    mod futex_rwlock;
-    pub(crate) use futex_condvar::Condvar;
-    pub(crate) use futex_mutex::Mutex;
-    pub(crate) use futex_rwlock::RwLock;
-}
-
 use crate::io::ErrorKind;
 use crate::os::hermit::abi;
 
diff --git a/library/std/src/sys/pal/sgx/mod.rs b/library/std/src/sys/pal/sgx/mod.rs
index 46f3e5b401d..8ef3495884f 100644
--- a/library/std/src/sys/pal/sgx/mod.rs
+++ b/library/std/src/sys/pal/sgx/mod.rs
@@ -9,8 +9,6 @@ use crate::io::ErrorKind;
 use crate::sync::atomic::{AtomicBool, Ordering};
 
 pub mod abi;
-mod waitqueue;
-
 pub mod alloc;
 pub mod args;
 pub mod env;
@@ -31,16 +29,7 @@ pub mod thread;
 pub mod thread_local_key;
 pub mod thread_parking;
 pub mod time;
-
-mod condvar;
-mod mutex;
-mod rwlock;
-
-pub mod locks {
-    pub use super::condvar::*;
-    pub use super::mutex::*;
-    pub use super::rwlock::*;
-}
+pub mod waitqueue;
 
 // SAFETY: must be called only once during runtime initialization.
 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
diff --git a/library/std/src/sys/pal/solid/abi/fs.rs b/library/std/src/sys/pal/solid/abi/fs.rs
index 32800bd9a9d..49526f4c9cd 100644
--- a/library/std/src/sys/pal/solid/abi/fs.rs
+++ b/library/std/src/sys/pal/solid/abi/fs.rs
@@ -1,9 +1,8 @@
 //! `solid_fs.h`
 use crate::os::raw::{c_char, c_int, c_uchar};
 pub use libc::{
-    blksize_t, dev_t, ino_t, off_t, stat, time_t, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR,
-    O_TRUNC, O_WRONLY, SEEK_CUR, SEEK_END, SEEK_SET, S_IEXEC, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO,
-    S_IFMT, S_IFREG, S_IREAD, S_IWRITE,
+    ino_t, off_t, stat, time_t, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY,
+    SEEK_CUR, SEEK_END, SEEK_SET, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFMT, S_IFREG, S_IWRITE,
 };
 
 pub const O_ACCMODE: c_int = 0x3;
diff --git a/library/std/src/sys/pal/solid/abi/sockets.rs b/library/std/src/sys/pal/solid/abi/sockets.rs
index eb06a6dd927..11c430360ce 100644
--- a/library/std/src/sys/pal/solid/abi/sockets.rs
+++ b/library/std/src/sys/pal/solid/abi/sockets.rs
@@ -1,5 +1,5 @@
 use crate::os::raw::{c_char, c_uint, c_void};
-pub use libc::{c_int, c_long, size_t, ssize_t, suseconds_t, time_t, timeval};
+pub use libc::{c_int, c_long, size_t, ssize_t, timeval};
 
 pub const SOLID_NET_ERR_BASE: c_int = -2000;
 pub const EINPROGRESS: c_int = SOLID_NET_ERR_BASE - libc::EINPROGRESS;
diff --git a/library/std/src/sys/pal/solid/mod.rs b/library/std/src/sys/pal/solid/mod.rs
index be8e0033902..9ada7d130f0 100644
--- a/library/std/src/sys/pal/solid/mod.rs
+++ b/library/std/src/sys/pal/solid/mod.rs
@@ -2,19 +2,17 @@
 #![allow(missing_docs, nonstandard_style)]
 #![deny(unsafe_op_in_unsafe_fn)]
 
-mod abi;
+pub mod abi;
 
 #[path = "../itron"]
-mod itron {
-    pub(super) mod abi;
-    pub mod condvar;
-    pub(super) mod error;
-    pub mod mutex;
-    pub(super) mod spin;
-    pub(super) mod task;
+pub mod itron {
+    pub mod abi;
+    pub mod error;
+    pub mod spin;
+    pub mod task;
     pub mod thread;
     pub mod thread_parking;
-    pub(super) mod time;
+    pub mod time;
     use super::unsupported;
 }
 
@@ -41,14 +39,6 @@ pub mod thread_local_key;
 pub use self::itron::thread_parking;
 pub mod time;
 
-mod rwlock;
-
-pub mod locks {
-    pub use super::itron::condvar::*;
-    pub use super::itron::mutex::*;
-    pub use super::rwlock::*;
-}
-
 // SAFETY: must be called only once during runtime initialization.
 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
 pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
diff --git a/library/std/src/sys/pal/solid/os.rs b/library/std/src/sys/pal/solid/os.rs
index ff81544ba91..5ceab3b27e0 100644
--- a/library/std/src/sys/pal/solid/os.rs
+++ b/library/std/src/sys/pal/solid/os.rs
@@ -172,7 +172,7 @@ pub fn env() -> Env {
 pub fn getenv(k: &OsStr) -> Option<OsString> {
     // environment variables with a nul byte can't be set, so their value is
     // always None as well
-    run_with_cstr(k.as_bytes(), |k| {
+    run_with_cstr(k.as_bytes(), &|k| {
         let _guard = env_read_lock();
         let v = unsafe { libc::getenv(k.as_ptr()) } as *const libc::c_char;
 
@@ -190,8 +190,8 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
 }
 
 pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
-    run_with_cstr(k.as_bytes(), |k| {
-        run_with_cstr(v.as_bytes(), |v| {
+    run_with_cstr(k.as_bytes(), &|k| {
+        run_with_cstr(v.as_bytes(), &|v| {
             let _guard = ENV_LOCK.write();
             cvt_env(unsafe { libc::setenv(k.as_ptr(), v.as_ptr(), 1) }).map(drop)
         })
@@ -199,7 +199,7 @@ pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
 }
 
 pub fn unsetenv(n: &OsStr) -> io::Result<()> {
-    run_with_cstr(n.as_bytes(), |nbuf| {
+    run_with_cstr(n.as_bytes(), &|nbuf| {
         let _guard = ENV_LOCK.write();
         cvt_env(unsafe { libc::unsetenv(nbuf.as_ptr()) }).map(drop)
     })
diff --git a/library/std/src/sys/pal/teeos/locks/mod.rs b/library/std/src/sys/pal/teeos/locks/mod.rs
deleted file mode 100644
index c58e9c7fd45..00000000000
--- a/library/std/src/sys/pal/teeos/locks/mod.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-pub mod condvar;
-#[path = "../../unix/locks/pthread_mutex.rs"]
-pub mod mutex;
-pub mod rwlock;
-
-pub(crate) use condvar::Condvar;
-pub(crate) use mutex::Mutex;
-pub(crate) use rwlock::RwLock;
diff --git a/library/std/src/sys/pal/teeos/mod.rs b/library/std/src/sys/pal/teeos/mod.rs
index 7953104486c..51ef96a69a0 100644
--- a/library/std/src/sys/pal/teeos/mod.rs
+++ b/library/std/src/sys/pal/teeos/mod.rs
@@ -13,7 +13,6 @@ pub mod alloc;
 pub mod args;
 #[path = "../unsupported/env.rs"]
 pub mod env;
-pub mod locks;
 //pub mod fd;
 #[path = "../unsupported/fs.rs"]
 pub mod fs;
diff --git a/library/std/src/sys/pal/uefi/mod.rs b/library/std/src/sys/pal/uefi/mod.rs
index 5a96b8f1c3a..ff8e3bd32ad 100644
--- a/library/std/src/sys/pal/uefi/mod.rs
+++ b/library/std/src/sys/pal/uefi/mod.rs
@@ -19,8 +19,6 @@ pub mod env;
 pub mod fs;
 #[path = "../unsupported/io.rs"]
 pub mod io;
-#[path = "../unsupported/locks/mod.rs"]
-pub mod locks;
 #[path = "../unsupported/net.rs"]
 pub mod net;
 #[path = "../unsupported/once.rs"]
diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs
index 6d0b892ea2f..c75323ef775 100644
--- a/library/std/src/sys/pal/unix/fs.rs
+++ b/library/std/src/sys/pal/unix/fs.rs
@@ -1118,7 +1118,7 @@ impl OpenOptions {
 
 impl File {
     pub fn open(path: &Path, opts: &OpenOptions) -> io::Result<File> {
-        run_path_with_cstr(path, |path| File::open_c(path, opts))
+        run_path_with_cstr(path, &|path| File::open_c(path, opts))
     }
 
     pub fn open_c(path: &CStr, opts: &OpenOptions) -> io::Result<File> {
@@ -1394,7 +1394,7 @@ impl DirBuilder {
     }
 
     pub fn mkdir(&self, p: &Path) -> io::Result<()> {
-        run_path_with_cstr(p, |p| cvt(unsafe { libc::mkdir(p.as_ptr(), self.mode) }).map(|_| ()))
+        run_path_with_cstr(p, &|p| cvt(unsafe { libc::mkdir(p.as_ptr(), self.mode) }).map(|_| ()))
     }
 
     pub fn set_mode(&mut self, mode: u32) {
@@ -1575,7 +1575,7 @@ impl fmt::Debug for File {
 }
 
 pub fn readdir(path: &Path) -> io::Result<ReadDir> {
-    let ptr = run_path_with_cstr(path, |p| unsafe { Ok(libc::opendir(p.as_ptr())) })?;
+    let ptr = run_path_with_cstr(path, &|p| unsafe { Ok(libc::opendir(p.as_ptr())) })?;
     if ptr.is_null() {
         Err(Error::last_os_error())
     } else {
@@ -1586,27 +1586,27 @@ pub fn readdir(path: &Path) -> io::Result<ReadDir> {
 }
 
 pub fn unlink(p: &Path) -> io::Result<()> {
-    run_path_with_cstr(p, |p| cvt(unsafe { libc::unlink(p.as_ptr()) }).map(|_| ()))
+    run_path_with_cstr(p, &|p| cvt(unsafe { libc::unlink(p.as_ptr()) }).map(|_| ()))
 }
 
 pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
-    run_path_with_cstr(old, |old| {
-        run_path_with_cstr(new, |new| {
+    run_path_with_cstr(old, &|old| {
+        run_path_with_cstr(new, &|new| {
             cvt(unsafe { libc::rename(old.as_ptr(), new.as_ptr()) }).map(|_| ())
         })
     })
 }
 
 pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {
-    run_path_with_cstr(p, |p| cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) }).map(|_| ()))
+    run_path_with_cstr(p, &|p| cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) }).map(|_| ()))
 }
 
 pub fn rmdir(p: &Path) -> io::Result<()> {
-    run_path_with_cstr(p, |p| cvt(unsafe { libc::rmdir(p.as_ptr()) }).map(|_| ()))
+    run_path_with_cstr(p, &|p| cvt(unsafe { libc::rmdir(p.as_ptr()) }).map(|_| ()))
 }
 
 pub fn readlink(p: &Path) -> io::Result<PathBuf> {
-    run_path_with_cstr(p, |c_path| {
+    run_path_with_cstr(p, &|c_path| {
         let p = c_path.as_ptr();
 
         let mut buf = Vec::with_capacity(256);
@@ -1635,16 +1635,16 @@ pub fn readlink(p: &Path) -> io::Result<PathBuf> {
 }
 
 pub fn symlink(original: &Path, link: &Path) -> io::Result<()> {
-    run_path_with_cstr(original, |original| {
-        run_path_with_cstr(link, |link| {
+    run_path_with_cstr(original, &|original| {
+        run_path_with_cstr(link, &|link| {
             cvt(unsafe { libc::symlink(original.as_ptr(), link.as_ptr()) }).map(|_| ())
         })
     })
 }
 
 pub fn link(original: &Path, link: &Path) -> io::Result<()> {
-    run_path_with_cstr(original, |original| {
-        run_path_with_cstr(link, |link| {
+    run_path_with_cstr(original, &|original| {
+        run_path_with_cstr(link, &|link| {
             cfg_if::cfg_if! {
                 if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita"))] {
                     // VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves
@@ -1678,7 +1678,7 @@ pub fn link(original: &Path, link: &Path) -> io::Result<()> {
 }
 
 pub fn stat(p: &Path) -> io::Result<FileAttr> {
-    run_path_with_cstr(p, |p| {
+    run_path_with_cstr(p, &|p| {
         cfg_has_statx! {
             if let Some(ret) = unsafe { try_statx(
                 libc::AT_FDCWD,
@@ -1697,7 +1697,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
 }
 
 pub fn lstat(p: &Path) -> io::Result<FileAttr> {
-    run_path_with_cstr(p, |p| {
+    run_path_with_cstr(p, &|p| {
         cfg_has_statx! {
             if let Some(ret) = unsafe { try_statx(
                 libc::AT_FDCWD,
@@ -1716,7 +1716,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
 }
 
 pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
-    let r = run_path_with_cstr(p, |path| unsafe {
+    let r = run_path_with_cstr(p, &|path| unsafe {
         Ok(libc::realpath(path.as_ptr(), ptr::null_mut()))
     })?;
     if r.is_null() {
@@ -1879,7 +1879,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
     // Opportunistically attempt to create a copy-on-write clone of `from`
     // using `fclonefileat`.
     if HAS_FCLONEFILEAT.load(Ordering::Relaxed) {
-        let clonefile_result = run_path_with_cstr(to, |to| {
+        let clonefile_result = run_path_with_cstr(to, &|to| {
             cvt(unsafe { fclonefileat(reader.as_raw_fd(), libc::AT_FDCWD, to.as_ptr(), 0) })
         });
         match clonefile_result {
@@ -1925,7 +1925,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
 }
 
 pub fn chown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
-    run_path_with_cstr(path, |path| {
+    run_path_with_cstr(path, &|path| {
         cvt(unsafe { libc::chown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
             .map(|_| ())
     })
@@ -1937,7 +1937,7 @@ pub fn fchown(fd: c_int, uid: u32, gid: u32) -> io::Result<()> {
 }
 
 pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
-    run_path_with_cstr(path, |path| {
+    run_path_with_cstr(path, &|path| {
         cvt(unsafe { libc::lchown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
             .map(|_| ())
     })
@@ -1945,7 +1945,7 @@ pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
 
 #[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
 pub fn chroot(dir: &Path) -> io::Result<()> {
-    run_path_with_cstr(dir, |dir| cvt(unsafe { libc::chroot(dir.as_ptr()) }).map(|_| ()))
+    run_path_with_cstr(dir, &|dir| cvt(unsafe { libc::chroot(dir.as_ptr()) }).map(|_| ()))
 }
 
 pub use remove_dir_impl::remove_dir_all;
@@ -2140,7 +2140,7 @@ mod remove_dir_impl {
         if attr.file_type().is_symlink() {
             crate::fs::remove_file(p)
         } else {
-            run_path_with_cstr(p, |p| remove_dir_all_recursive(None, &p))
+            run_path_with_cstr(p, &|p| remove_dir_all_recursive(None, &p))
         }
     }
 
diff --git a/library/std/src/sys/pal/unix/locks/mod.rs b/library/std/src/sys/pal/unix/locks/mod.rs
deleted file mode 100644
index a49247310b5..00000000000
--- a/library/std/src/sys/pal/unix/locks/mod.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-cfg_if::cfg_if! {
-    if #[cfg(any(
-        target_os = "linux",
-        target_os = "android",
-        all(target_os = "emscripten", target_feature = "atomics"),
-        target_os = "freebsd",
-        target_os = "openbsd",
-        target_os = "dragonfly",
-    ))] {
-        mod futex_mutex;
-        mod futex_rwlock;
-        mod futex_condvar;
-        pub(crate) use futex_mutex::Mutex;
-        pub(crate) use futex_rwlock::RwLock;
-        pub(crate) use futex_condvar::Condvar;
-    } else if #[cfg(target_os = "fuchsia")] {
-        mod fuchsia_mutex;
-        mod futex_rwlock;
-        mod futex_condvar;
-        pub(crate) use fuchsia_mutex::Mutex;
-        pub(crate) use futex_rwlock::RwLock;
-        pub(crate) use futex_condvar::Condvar;
-    } else {
-        mod pthread_mutex;
-        mod pthread_condvar;
-        mod queue_rwlock;
-        pub(crate) use pthread_mutex::Mutex;
-        pub(crate) use queue_rwlock::RwLock;
-        pub(crate) use pthread_condvar::Condvar;
-    }
-}
diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs
index 976a437c17f..04b8c5ca916 100644
--- a/library/std/src/sys/pal/unix/mod.rs
+++ b/library/std/src/sys/pal/unix/mod.rs
@@ -20,7 +20,6 @@ pub mod io;
 pub mod kernel_copy;
 #[cfg(target_os = "l4re")]
 mod l4re;
-pub mod locks;
 pub mod memchr;
 #[cfg(not(target_os = "l4re"))]
 pub mod net;
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs
index 881b3a25c51..af2b9db4685 100644
--- a/library/std/src/sys/pal/unix/os.rs
+++ b/library/std/src/sys/pal/unix/os.rs
@@ -186,7 +186,7 @@ pub fn chdir(_p: &path::Path) -> io::Result<()> {
 
 #[cfg(not(target_os = "espidf"))]
 pub fn chdir(p: &path::Path) -> io::Result<()> {
-    let result = run_path_with_cstr(p, |p| unsafe { Ok(libc::chdir(p.as_ptr())) })?;
+    let result = run_path_with_cstr(p, &|p| unsafe { Ok(libc::chdir(p.as_ptr())) })?;
     if result == 0 { Ok(()) } else { Err(io::Error::last_os_error()) }
 }
 
@@ -643,7 +643,7 @@ pub fn env() -> Env {
 pub fn getenv(k: &OsStr) -> Option<OsString> {
     // environment variables with a nul byte can't be set, so their value is
     // always None as well
-    run_with_cstr(k.as_bytes(), |k| {
+    run_with_cstr(k.as_bytes(), &|k| {
         let _guard = env_read_lock();
         let v = unsafe { libc::getenv(k.as_ptr()) } as *const libc::c_char;
 
@@ -661,8 +661,8 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
 }
 
 pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
-    run_with_cstr(k.as_bytes(), |k| {
-        run_with_cstr(v.as_bytes(), |v| {
+    run_with_cstr(k.as_bytes(), &|k| {
+        run_with_cstr(v.as_bytes(), &|v| {
             let _guard = ENV_LOCK.write();
             cvt(unsafe { libc::setenv(k.as_ptr(), v.as_ptr(), 1) }).map(drop)
         })
@@ -670,7 +670,7 @@ pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
 }
 
 pub fn unsetenv(n: &OsStr) -> io::Result<()> {
-    run_with_cstr(n.as_bytes(), |nbuf| {
+    run_with_cstr(n.as_bytes(), &|nbuf| {
         let _guard = ENV_LOCK.write();
         cvt(unsafe { libc::unsetenv(nbuf.as_ptr()) }).map(drop)
     })
diff --git a/library/std/src/sys/pal/unsupported/mod.rs b/library/std/src/sys/pal/unsupported/mod.rs
index 88f939cbab9..9ce275ee72d 100644
--- a/library/std/src/sys/pal/unsupported/mod.rs
+++ b/library/std/src/sys/pal/unsupported/mod.rs
@@ -5,7 +5,6 @@ pub mod args;
 pub mod env;
 pub mod fs;
 pub mod io;
-pub mod locks;
 pub mod net;
 pub mod once;
 pub mod os;
diff --git a/library/std/src/sys/pal/wasi/fs.rs b/library/std/src/sys/pal/wasi/fs.rs
index e8238665452..529b82e0198 100644
--- a/library/std/src/sys/pal/wasi/fs.rs
+++ b/library/std/src/sys/pal/wasi/fs.rs
@@ -698,7 +698,7 @@ fn open_at(fd: &WasiFd, path: &Path, opts: &OpenOptions) -> io::Result<File> {
 /// Note that this can fail if `p` doesn't look like it can be opened relative
 /// to any pre-opened file descriptor.
 fn open_parent(p: &Path) -> io::Result<(ManuallyDrop<WasiFd>, PathBuf)> {
-    run_path_with_cstr(p, |p| {
+    run_path_with_cstr(p, &|p| {
         let mut buf = Vec::<u8>::with_capacity(512);
         loop {
             unsafe {
diff --git a/library/std/src/sys/pal/wasi/mod.rs b/library/std/src/sys/pal/wasi/mod.rs
index 116878ee996..084b8e0e216 100644
--- a/library/std/src/sys/pal/wasi/mod.rs
+++ b/library/std/src/sys/pal/wasi/mod.rs
@@ -43,20 +43,7 @@ pub mod thread_local_key;
 pub mod time;
 
 cfg_if::cfg_if! {
-    if #[cfg(target_feature = "atomics")] {
-        #[path = "../unix/locks"]
-        pub mod locks {
-            #![allow(unsafe_op_in_unsafe_fn)]
-            mod futex_condvar;
-            mod futex_mutex;
-            mod futex_rwlock;
-            pub(crate) use futex_condvar::Condvar;
-            pub(crate) use futex_mutex::Mutex;
-            pub(crate) use futex_rwlock::RwLock;
-        }
-    } else {
-        #[path = "../unsupported/locks/mod.rs"]
-        pub mod locks;
+    if #[cfg(not(target_feature = "atomics"))] {
         #[path = "../unsupported/once.rs"]
         pub mod once;
         #[path = "../unsupported/thread_parking.rs"]
diff --git a/library/std/src/sys/pal/wasi/os.rs b/library/std/src/sys/pal/wasi/os.rs
index 530d3602172..d62ff8a2f18 100644
--- a/library/std/src/sys/pal/wasi/os.rs
+++ b/library/std/src/sys/pal/wasi/os.rs
@@ -95,7 +95,7 @@ pub fn getcwd() -> io::Result<PathBuf> {
 }
 
 pub fn chdir(p: &path::Path) -> io::Result<()> {
-    let result = run_path_with_cstr(p, |p| unsafe { Ok(libc::chdir(p.as_ptr())) })?;
+    let result = run_path_with_cstr(p, &|p| unsafe { Ok(libc::chdir(p.as_ptr())) })?;
     match result == (0 as libc::c_int) {
         true => Ok(()),
         false => Err(io::Error::last_os_error()),
@@ -227,7 +227,7 @@ pub fn env() -> Env {
 pub fn getenv(k: &OsStr) -> Option<OsString> {
     // environment variables with a nul byte can't be set, so their value is
     // always None as well
-    run_with_cstr(k.as_bytes(), |k| {
+    run_with_cstr(k.as_bytes(), &|k| {
         let _guard = env_read_lock();
         let v = unsafe { libc::getenv(k.as_ptr()) } as *const libc::c_char;
 
@@ -245,8 +245,8 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
 }
 
 pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
-    run_with_cstr(k.as_bytes(), |k| {
-        run_with_cstr(v.as_bytes(), |v| unsafe {
+    run_with_cstr(k.as_bytes(), &|k| {
+        run_with_cstr(v.as_bytes(), &|v| unsafe {
             let _guard = env_write_lock();
             cvt(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(drop)
         })
@@ -254,7 +254,7 @@ pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
 }
 
 pub fn unsetenv(n: &OsStr) -> io::Result<()> {
-    run_with_cstr(n.as_bytes(), |nbuf| unsafe {
+    run_with_cstr(n.as_bytes(), &|nbuf| unsafe {
         let _guard = env_write_lock();
         cvt(libc::unsetenv(nbuf.as_ptr())).map(drop)
     })
diff --git a/library/std/src/sys/pal/wasm/mod.rs b/library/std/src/sys/pal/wasm/mod.rs
index 567555118d7..40b15120e6d 100644
--- a/library/std/src/sys/pal/wasm/mod.rs
+++ b/library/std/src/sys/pal/wasm/mod.rs
@@ -43,23 +43,11 @@ pub mod time;
 
 cfg_if::cfg_if! {
     if #[cfg(target_feature = "atomics")] {
-        #[path = "../unix/locks"]
-        pub mod locks {
-            #![allow(unsafe_op_in_unsafe_fn)]
-            mod futex_condvar;
-            mod futex_mutex;
-            mod futex_rwlock;
-            pub(crate) use futex_condvar::Condvar;
-            pub(crate) use futex_mutex::Mutex;
-            pub(crate) use futex_rwlock::RwLock;
-        }
         #[path = "atomics/futex.rs"]
         pub mod futex;
         #[path = "atomics/thread.rs"]
         pub mod thread;
     } else {
-        #[path = "../unsupported/locks/mod.rs"]
-        pub mod locks;
         #[path = "../unsupported/once.rs"]
         pub mod once;
         #[path = "../unsupported/thread.rs"]
diff --git a/library/std/src/sys/pal/windows/locks/mod.rs b/library/std/src/sys/pal/windows/locks/mod.rs
deleted file mode 100644
index 0e0f9eccb21..00000000000
--- a/library/std/src/sys/pal/windows/locks/mod.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-mod condvar;
-mod mutex;
-mod rwlock;
-pub use condvar::Condvar;
-pub use mutex::Mutex;
-pub use rwlock::RwLock;
diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs
index 726a4509f28..b47d213df34 100644
--- a/library/std/src/sys/pal/windows/mod.rs
+++ b/library/std/src/sys/pal/windows/mod.rs
@@ -19,7 +19,6 @@ pub mod env;
 pub mod fs;
 pub mod handle;
 pub mod io;
-pub mod locks;
 pub mod memchr;
 pub mod net;
 pub mod os;
diff --git a/library/std/src/sys/pal/xous/locks/mod.rs b/library/std/src/sys/pal/xous/locks/mod.rs
deleted file mode 100644
index f3c5c5d9fb0..00000000000
--- a/library/std/src/sys/pal/xous/locks/mod.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-mod condvar;
-mod mutex;
-mod rwlock;
-
-pub use condvar::*;
-pub use mutex::*;
-pub use rwlock::*;
diff --git a/library/std/src/sys/pal/xous/mod.rs b/library/std/src/sys/pal/xous/mod.rs
index c9bad4ef019..7914a255aea 100644
--- a/library/std/src/sys/pal/xous/mod.rs
+++ b/library/std/src/sys/pal/xous/mod.rs
@@ -9,7 +9,6 @@ pub mod env;
 pub mod fs;
 #[path = "../unsupported/io.rs"]
 pub mod io;
-pub mod locks;
 pub mod net;
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
diff --git a/library/std/src/sys/pal/zkvm/mod.rs b/library/std/src/sys/pal/zkvm/mod.rs
index e859269831a..016c977dc33 100644
--- a/library/std/src/sys/pal/zkvm/mod.rs
+++ b/library/std/src/sys/pal/zkvm/mod.rs
@@ -33,8 +33,6 @@ pub mod thread_local_key;
 #[path = "../unsupported/time.rs"]
 pub mod time;
 
-#[path = "../unsupported/locks/mod.rs"]
-pub mod locks;
 #[path = "../unsupported/thread.rs"]
 pub mod thread;
 
diff --git a/library/std/src/sys_common/net.rs b/library/std/src/sys_common/net.rs
index 8712bd2eca7..de7d31baaaf 100644
--- a/library/std/src/sys_common/net.rs
+++ b/library/std/src/sys_common/net.rs
@@ -199,7 +199,7 @@ impl<'a> TryFrom<(&'a str, u16)> for LookupHost {
     fn try_from((host, port): (&'a str, u16)) -> io::Result<LookupHost> {
         init();
 
-        run_with_cstr(host.as_bytes(), |c_host| {
+        run_with_cstr(host.as_bytes(), &|c_host| {
             let mut hints: c::addrinfo = unsafe { mem::zeroed() };
             hints.ai_socktype = c::SOCK_STREAM;
             let mut res = ptr::null_mut();
diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs
index 67db5ebd89c..2dbd19d7171 100644
--- a/library/std/src/sys_common/wtf8.rs
+++ b/library/std/src/sys_common/wtf8.rs
@@ -885,15 +885,43 @@ fn decode_surrogate_pair(lead: u16, trail: u16) -> char {
     unsafe { char::from_u32_unchecked(code_point) }
 }
 
-/// Copied from core::str::StrPrelude::is_char_boundary
+/// Copied from str::is_char_boundary
 #[inline]
 pub fn is_code_point_boundary(slice: &Wtf8, index: usize) -> bool {
-    if index == slice.len() {
+    if index == 0 {
         return true;
     }
     match slice.bytes.get(index) {
-        None => false,
-        Some(&b) => b < 128 || b >= 192,
+        None => index == slice.len(),
+        Some(&b) => (b as i8) >= -0x40,
+    }
+}
+
+/// Verify that `index` is at the edge of either a valid UTF-8 codepoint
+/// (i.e. a codepoint that's not a surrogate) or of the whole string.
+///
+/// These are the cases currently permitted by `OsStr::slice_encoded_bytes`.
+/// Splitting between surrogates is valid as far as WTF-8 is concerned, but
+/// we do not permit it in the public API because WTF-8 is considered an
+/// implementation detail.
+#[track_caller]
+#[inline]
+pub fn check_utf8_boundary(slice: &Wtf8, index: usize) {
+    if index == 0 {
+        return;
+    }
+    match slice.bytes.get(index) {
+        Some(0xED) => (), // Might be a surrogate
+        Some(&b) if (b as i8) >= -0x40 => return,
+        Some(_) => panic!("byte index {index} is not a codepoint boundary"),
+        None if index == slice.len() => return,
+        None => panic!("byte index {index} is out of bounds"),
+    }
+    if slice.bytes[index + 1] >= 0xA0 {
+        // There's a surrogate after index. Now check before index.
+        if index >= 3 && slice.bytes[index - 3] == 0xED && slice.bytes[index - 2] >= 0xA0 {
+            panic!("byte index {index} lies between surrogate codepoints");
+        }
     }
 }
 
diff --git a/library/std/src/sys_common/wtf8/tests.rs b/library/std/src/sys_common/wtf8/tests.rs
index 28a426648e5..6a1cc41a8fb 100644
--- a/library/std/src/sys_common/wtf8/tests.rs
+++ b/library/std/src/sys_common/wtf8/tests.rs
@@ -663,3 +663,65 @@ fn wtf8_to_owned() {
     assert_eq!(string.bytes, b"\xED\xA0\x80");
     assert!(!string.is_known_utf8);
 }
+
+#[test]
+fn wtf8_valid_utf8_boundaries() {
+    let mut string = Wtf8Buf::from_str("aé 💩");
+    string.push(CodePoint::from_u32(0xD800).unwrap());
+    string.push(CodePoint::from_u32(0xD800).unwrap());
+    check_utf8_boundary(&string, 0);
+    check_utf8_boundary(&string, 1);
+    check_utf8_boundary(&string, 3);
+    check_utf8_boundary(&string, 4);
+    check_utf8_boundary(&string, 8);
+    check_utf8_boundary(&string, 14);
+    assert_eq!(string.len(), 14);
+
+    string.push_char('a');
+    check_utf8_boundary(&string, 14);
+    check_utf8_boundary(&string, 15);
+
+    let mut string = Wtf8Buf::from_str("a");
+    string.push(CodePoint::from_u32(0xD800).unwrap());
+    check_utf8_boundary(&string, 1);
+
+    let mut string = Wtf8Buf::from_str("\u{D7FF}");
+    string.push(CodePoint::from_u32(0xD800).unwrap());
+    check_utf8_boundary(&string, 3);
+
+    let mut string = Wtf8Buf::new();
+    string.push(CodePoint::from_u32(0xD800).unwrap());
+    string.push_char('\u{D7FF}');
+    check_utf8_boundary(&string, 3);
+}
+
+#[test]
+#[should_panic(expected = "byte index 4 is out of bounds")]
+fn wtf8_utf8_boundary_out_of_bounds() {
+    let string = Wtf8::from_str("aé");
+    check_utf8_boundary(&string, 4);
+}
+
+#[test]
+#[should_panic(expected = "byte index 1 is not a codepoint boundary")]
+fn wtf8_utf8_boundary_inside_codepoint() {
+    let string = Wtf8::from_str("é");
+    check_utf8_boundary(&string, 1);
+}
+
+#[test]
+#[should_panic(expected = "byte index 1 is not a codepoint boundary")]
+fn wtf8_utf8_boundary_inside_surrogate() {
+    let mut string = Wtf8Buf::new();
+    string.push(CodePoint::from_u32(0xD800).unwrap());
+    check_utf8_boundary(&string, 1);
+}
+
+#[test]
+#[should_panic(expected = "byte index 3 lies between surrogate codepoints")]
+fn wtf8_utf8_boundary_between_surrogates() {
+    let mut string = Wtf8Buf::new();
+    string.push(CodePoint::from_u32(0xD800).unwrap());
+    string.push(CodePoint::from_u32(0xD800).unwrap());
+    check_utf8_boundary(&string, 3);
+}
diff --git a/library/stdarch b/library/stdarch
-Subproject 5ef6eb42bdcfef6891517a6e4c77a89c18722f1
+Subproject d5fab978fe1c2f0043db0451e9f4857eeba1743
diff --git a/src/bootstrap/defaults/config.codegen.toml b/src/bootstrap/defaults/config.codegen.toml
index 7c33ce958c9..cf336d7a636 100644
--- a/src/bootstrap/defaults/config.codegen.toml
+++ b/src/bootstrap/defaults/config.codegen.toml
@@ -23,3 +23,6 @@ incremental = true
 backtrace-on-ice = true
 # Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
 lto = "off"
+# Forces frame pointers to be used with `-Cforce-frame-pointers`.
+# This can be helpful for profiling at a small performance cost.
+frame-pointers = true
diff --git a/src/bootstrap/defaults/config.compiler.toml b/src/bootstrap/defaults/config.compiler.toml
index b27b524b873..5c2d476d98e 100644
--- a/src/bootstrap/defaults/config.compiler.toml
+++ b/src/bootstrap/defaults/config.compiler.toml
@@ -14,6 +14,9 @@ incremental = true
 backtrace-on-ice = true
 # Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
 lto = "off"
+# Forces frame pointers to be used with `-Cforce-frame-pointers`.
+# This can be helpful for profiling at a small performance cost.
+frame-pointers = true
 
 [llvm]
 # Will download LLVM from CI if available on your platform.
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index 6d56492e41b..750d3095ff6 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -398,10 +398,11 @@ impl Step for Rustc {
             let host = compiler.host;
             let src = builder.sysroot(compiler);
 
-            // Copy rustc/rustdoc binaries
+            // Copy rustc binary
             t!(fs::create_dir_all(image.join("bin")));
             builder.cp_r(&src.join("bin"), &image.join("bin"));
 
+            // If enabled, copy rustdoc binary
             if builder
                 .config
                 .tools
diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs
index 1c565e7f7cc..0225f8f24a5 100644
--- a/src/bootstrap/src/core/build_steps/install.rs
+++ b/src/bootstrap/src/core/build_steps/install.rs
@@ -95,7 +95,7 @@ fn install_sh(
     }
 
     let datadir = prefix.join(default_path(&builder.config.datadir, "share"));
-    let docdir = prefix.join(default_path(&builder.config.docdir, "share/doc/rust"));
+    let docdir = prefix.join(default_path(&builder.config.docdir, &format!("share/doc/{package}")));
     let mandir = prefix.join(default_path(&builder.config.mandir, "share/man"));
     let libdir = prefix.join(default_path(&builder.config.libdir, "lib"));
     let bindir = prefix.join(&builder.config.bindir); // Default in config.rs
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
index 2c4013d78bf..50264ca3b3a 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -858,6 +858,11 @@ impl<'a> Builder<'a> {
             Kind::Install => describe!(
                 install::Docs,
                 install::Std,
+                // During the Rust compiler (rustc) installation process, we copy the entire sysroot binary
+                // path (build/host/stage2/bin). Since the building tools also make their copy in the sysroot
+                // binary path, we must install rustc before the tools. Otherwise, the rust-installer will
+                // install the same binaries twice for each tool, leaving backup files (*.old) as a result.
+                install::Rustc,
                 install::Cargo,
                 install::RustAnalyzer,
                 install::Rustfmt,
@@ -866,7 +871,6 @@ impl<'a> Builder<'a> {
                 install::Miri,
                 install::LlvmTools,
                 install::Src,
-                install::Rustc,
             ),
             Kind::Run => describe!(
                 run::ExpandYamlAnchors,
@@ -1870,6 +1874,10 @@ impl<'a> Builder<'a> {
             rustflags.arg("-Wrustc::internal");
         }
 
+        if self.config.rust_frame_pointers {
+            rustflags.arg("-Cforce-frame-pointers=true");
+        }
+
         // If Control Flow Guard is enabled, pass the `control-flow-guard` flag to rustc
         // when compiling the standard library, since this might be linked into the final outputs
         // produced by rustc. Since this mitigation is only available on Windows, only enable it
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 05b9c734018..1605776f772 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -256,6 +256,7 @@ pub struct Config {
     pub rust_split_debuginfo: SplitDebuginfo,
     pub rust_rpath: bool,
     pub rust_strip: bool,
+    pub rust_frame_pointers: bool,
     pub rust_stack_protector: Option<String>,
     pub rustc_parallel: bool,
     pub rustc_default_linker: Option<String>,
@@ -1083,6 +1084,7 @@ define_config! {
         musl_root: Option<String> = "musl-root",
         rpath: Option<bool> = "rpath",
         strip: Option<bool> = "strip",
+        frame_pointers: Option<bool> = "frame-pointers",
         stack_protector: Option<String> = "stack-protector",
         verbose_tests: Option<bool> = "verbose-tests",
         optimize_tests: Option<bool> = "optimize-tests",
@@ -1561,6 +1563,7 @@ impl Config {
                 download_rustc,
                 lto,
                 validate_mir_opts,
+                frame_pointers,
                 stack_protector,
                 strip,
                 lld_mode,
@@ -1609,6 +1612,7 @@ impl Config {
             set(&mut config.codegen_tests, codegen_tests);
             set(&mut config.rust_rpath, rpath);
             set(&mut config.rust_strip, strip);
+            set(&mut config.rust_frame_pointers, frame_pointers);
             config.rust_stack_protector = stack_protector;
             set(&mut config.jemalloc, jemalloc);
             set(&mut config.test_compare_mode, test_compare_mode);
diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs
index ec62f9f1f8c..1625047d3e1 100644
--- a/src/bootstrap/src/utils/change_tracker.rs
+++ b/src/bootstrap/src/utils/change_tracker.rs
@@ -119,4 +119,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
         severity: ChangeSeverity::Info,
         summary: "New option `target.<triple>.codegen-backends` added to config.toml.",
     },
+    ChangeInfo {
+        change_id: 121203,
+        severity: ChangeSeverity::Info,
+        summary: "A new `rust.frame-pointers` option has been introduced and made the default in the compiler and codegen profiles.",
+    },
 ];
diff --git a/src/doc/unstable-book/src/compiler-flags/sanitizer.md b/src/doc/unstable-book/src/compiler-flags/sanitizer.md
index 502853f39ae..523617eb3e1 100644
--- a/src/doc/unstable-book/src/compiler-flags/sanitizer.md
+++ b/src/doc/unstable-book/src/compiler-flags/sanitizer.md
@@ -1,5 +1,14 @@
 # `sanitizer`
 
+Sanitizers are tools that help detect and prevent various types of bugs and
+vulnerabilities in software. They are available in compilers and work by
+instrumenting the code to add additional runtime checks. While they provide
+powerful tools for identifying bugs or security issues, it's important to note
+that using sanitizers can introduce runtime overhead and might not catch all
+possible issues. Therefore, they are typically used alongside other best
+practices in software development, such as testing and fuzzing, to ensure the
+highest level of software quality and security.
+
 The tracking issues for this feature are:
 
 * [#39699](https://github.com/rust-lang/rust/issues/39699).
@@ -9,21 +18,26 @@ The tracking issues for this feature are:
 
 This feature allows for use of one of following sanitizers:
 
-* [AddressSanitizer](#addresssanitizer) a fast memory error detector.
-* [ControlFlowIntegrity](#controlflowintegrity) LLVM Control Flow Integrity (CFI) provides
-  forward-edge control flow protection.
-* [HWAddressSanitizer](#hwaddresssanitizer) a memory error detector similar to
-  AddressSanitizer, but based on partial hardware assistance.
-* [KernelControlFlowIntegrity](#kernelcontrolflowintegrity) LLVM Kernel Control
-  Flow Integrity (KCFI) provides forward-edge control flow protection for
-  operating systems kernels.
-* [LeakSanitizer](#leaksanitizer) a run-time memory leak detector.
-* [MemorySanitizer](#memorysanitizer) a detector of uninitialized reads.
-* [MemTagSanitizer](#memtagsanitizer) fast memory error detector based on
-  Armv8.5-A Memory Tagging Extension.
-* [SafeStack](#safestack) provides backward-edge control flow protection by separating the stack into safe and unsafe regions.
-* [ShadowCallStack](#shadowcallstack) provides backward-edge control flow protection (aarch64 only).
-* [ThreadSanitizer](#threadsanitizer) a fast data race detector.
+* Those intended for testing or fuzzing (but not production use):
+  * [AddressSanitizer](#addresssanitizer) a fast memory error detector.
+  * [HWAddressSanitizer](#hwaddresssanitizer) a memory error detector similar to
+    AddressSanitizer, but based on partial hardware assistance.
+  * [LeakSanitizer](#leaksanitizer) a run-time memory leak detector.
+  * [MemorySanitizer](#memorysanitizer) a detector of uninitialized reads.
+  * [ThreadSanitizer](#threadsanitizer) a fast data race detector.
+
+* Those that apart from testing, may be used in production:
+  * [ControlFlowIntegrity](#controlflowintegrity) LLVM Control Flow Integrity
+    (CFI) provides forward-edge control flow protection.
+  * [KernelControlFlowIntegrity](#kernelcontrolflowintegrity) LLVM Kernel
+    Control Flow Integrity (KCFI) provides forward-edge control flow protection
+    for operating systems kernels.
+  * [MemTagSanitizer](#memtagsanitizer) fast memory error detector based on
+    Armv8.5-A Memory Tagging Extension.
+  * [SafeStack](#safestack) provides backward-edge control flow protection by
+    separating the stack into safe and unsafe regions.
+  * [ShadowCallStack](#shadowcallstack) provides backward-edge control flow
+    protection (aarch64 only).
 
 To enable a sanitizer compile with `-Zsanitizer=address`,`-Zsanitizer=cfi`,
 `-Zsanitizer=hwaddress`, `-Zsanitizer=leak`, `-Zsanitizer=memory`,
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index fe02611b5d4..a172580ac3f 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -8,7 +8,7 @@ use rustc_data_structures::{
     fx::{FxHashMap, FxHashSet},
     intern::Interned,
 };
-use rustc_errors::{Applicability, Diagnostic, DiagnosticMessage};
+use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticMessage};
 use rustc_hir::def::Namespace::*;
 use rustc_hir::def::{DefKind, Namespace, PerNS};
 use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
@@ -1173,21 +1173,22 @@ impl LinkCollector<'_, '_> {
     ) {
         // The resolved item did not match the disambiguator; give a better error than 'not found'
         let msg = format!("incompatible link kind for `{path_str}`");
-        let callback = |diag: &mut Diagnostic, sp: Option<rustc_span::Span>, link_range| {
-            let note = format!(
-                "this link resolved to {} {}, which is not {} {}",
-                resolved.article(),
-                resolved.descr(),
-                specified.article(),
-                specified.descr(),
-            );
-            if let Some(sp) = sp {
-                diag.span_label(sp, note);
-            } else {
-                diag.note(note);
-            }
-            suggest_disambiguator(resolved, diag, path_str, link_range, sp, diag_info);
-        };
+        let callback =
+            |diag: &mut DiagnosticBuilder<'_, ()>, sp: Option<rustc_span::Span>, link_range| {
+                let note = format!(
+                    "this link resolved to {} {}, which is not {} {}",
+                    resolved.article(),
+                    resolved.descr(),
+                    specified.article(),
+                    specified.descr(),
+                );
+                if let Some(sp) = sp {
+                    diag.span_label(sp, note);
+                } else {
+                    diag.note(note);
+                }
+                suggest_disambiguator(resolved, diag, path_str, link_range, sp, diag_info);
+            };
         report_diagnostic(self.cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, diag_info, callback);
     }
 
@@ -1676,7 +1677,7 @@ fn report_diagnostic(
     lint: &'static Lint,
     msg: impl Into<DiagnosticMessage> + Display,
     DiagnosticInfo { item, ori_link: _, dox, link_range }: &DiagnosticInfo<'_>,
-    decorate: impl FnOnce(&mut Diagnostic, Option<rustc_span::Span>, MarkdownLinkRange),
+    decorate: impl FnOnce(&mut DiagnosticBuilder<'_, ()>, Option<rustc_span::Span>, MarkdownLinkRange),
 ) {
     let Some(hir_id) = DocContext::as_local_hir_id(tcx, item.item_id) else {
         // If non-local, no need to check anything.
@@ -2124,7 +2125,7 @@ fn ambiguity_error(
 /// disambiguator.
 fn suggest_disambiguator(
     res: Res,
-    diag: &mut Diagnostic,
+    diag: &mut DiagnosticBuilder<'_, ()>,
     path_str: &str,
     link_range: MarkdownLinkRange,
     sp: Option<rustc_span::Span>,
diff --git a/src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs b/src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs
index f99a51e2b88..1543ae80399 100644
--- a/src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs
+++ b/src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs
@@ -4,7 +4,7 @@ use clippy_utils::expr_or_init;
 use clippy_utils::source::snippet;
 use clippy_utils::sugg::Sugg;
 use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize};
-use rustc_errors::{Applicability, Diagnostic, SuggestionStyle};
+use rustc_errors::{Applicability, DiagnosticBuilder, SuggestionStyle};
 use rustc_hir::def::{DefKind, Res};
 use rustc_hir::{BinOpKind, Expr, ExprKind};
 use rustc_lint::LateContext;
@@ -177,7 +177,7 @@ fn offer_suggestion(
     expr: &Expr<'_>,
     cast_expr: &Expr<'_>,
     cast_to_span: Span,
-    diag: &mut Diagnostic,
+    diag: &mut DiagnosticBuilder<'_, ()>,
 ) {
     let cast_to_snip = snippet(cx, cast_to_span, "..");
     let suggestion = if cast_to_snip == "_" {
diff --git a/src/tools/clippy/clippy_lints/src/functions/result.rs b/src/tools/clippy/clippy_lints/src/functions/result.rs
index f1200c2edc1..9505741e68f 100644
--- a/src/tools/clippy/clippy_lints/src/functions/result.rs
+++ b/src/tools/clippy/clippy_lints/src/functions/result.rs
@@ -1,4 +1,4 @@
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_hir as hir;
 use rustc_lint::{LateContext, LintContext};
 use rustc_middle::lint::in_external_macro;
@@ -135,7 +135,7 @@ fn check_result_large_err<'tcx>(cx: &LateContext<'tcx>, err_ty: Ty<'tcx>, hir_ty
                 RESULT_LARGE_ERR,
                 hir_ty_span,
                 "the `Err`-variant returned from this function is very large",
-                |diag: &mut Diagnostic| {
+                |diag: &mut DiagnosticBuilder<'_, ()>| {
                     diag.span_label(hir_ty_span, format!("the `Err`-variant is at least {ty_size} bytes"));
                     diag.help(format!("try reducing the size of `{err_ty}`, for example by boxing large elements or replacing it with `Box<{err_ty}>`"));
                 },
diff --git a/src/tools/clippy/clippy_lints/src/if_let_mutex.rs b/src/tools/clippy/clippy_lints/src/if_let_mutex.rs
index 5e354209cbf..61a322ea881 100644
--- a/src/tools/clippy/clippy_lints/src/if_let_mutex.rs
+++ b/src/tools/clippy/clippy_lints/src/if_let_mutex.rs
@@ -1,7 +1,7 @@
 use clippy_utils::diagnostics::span_lint_and_then;
 use clippy_utils::ty::is_type_diagnostic_item;
 use clippy_utils::{higher, SpanlessEq};
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_hir::intravisit::{self as visit, Visitor};
 use rustc_hir::{Expr, ExprKind};
 use rustc_lint::{LateContext, LateLintPass};
@@ -59,7 +59,7 @@ impl<'tcx> LateLintPass<'tcx> for IfLetMutex {
                 arm_visit.visit_expr(if_else);
 
                 if let Some(arm_mutex) = arm_visit.found_mutex_if_same_as(op_mutex) {
-                    let diag = |diag: &mut Diagnostic| {
+                    let diag = |diag: &mut DiagnosticBuilder<'_, ()>| {
                         diag.span_label(
                             op_mutex.span,
                             "this Mutex will remain locked for the entire `if let`-block...",
diff --git a/src/tools/clippy/clippy_lints/src/implicit_hasher.rs b/src/tools/clippy/clippy_lints/src/implicit_hasher.rs
index 87f6f5e7959..746de50c0fa 100644
--- a/src/tools/clippy/clippy_lints/src/implicit_hasher.rs
+++ b/src/tools/clippy/clippy_lints/src/implicit_hasher.rs
@@ -1,7 +1,7 @@
 use std::borrow::Cow;
 use std::collections::BTreeMap;
 
-use rustc_errors::Diagnostic;
+use rustc_errors::DiagnosticBuilder;
 use rustc_hir as hir;
 use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, Visitor};
 use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind};
@@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
 
         fn suggestion(
             cx: &LateContext<'_>,
-            diag: &mut Diagnostic,
+            diag: &mut DiagnosticBuilder<'_, ()>,
             generics_span: Span,
             generics_suggestion_span: Span,
             target: &ImplicitHasherType<'_>,
diff --git a/src/tools/clippy/clippy_lints/src/manual_clamp.rs b/src/tools/clippy/clippy_lints/src/manual_clamp.rs
index 0da309f9531..12bb80dfde2 100644
--- a/src/tools/clippy/clippy_lints/src/manual_clamp.rs
+++ b/src/tools/clippy/clippy_lints/src/manual_clamp.rs
@@ -9,7 +9,7 @@ use clippy_utils::{
     peel_blocks_with_stmt, MaybePath,
 };
 use itertools::Itertools;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir::def::Res;
 use rustc_hir::{Arm, BinOpKind, Block, Expr, ExprKind, HirId, PatKind, PathSegment, PrimTy, QPath, StmtKind};
 use rustc_lint::{LateContext, LateLintPass};
@@ -163,7 +163,7 @@ fn emit_suggestion<'tcx>(cx: &LateContext<'tcx>, suggestion: &ClampSuggestion<'t
     };
     let suggestion = format!("{assignment}{input}.clamp({min}, {max}){semicolon}");
     let msg = "clamp-like pattern without using clamp function";
-    let lint_builder = |d: &mut Diagnostic| {
+    let lint_builder = |d: &mut DiagnosticBuilder<'_, ()>| {
         d.span_suggestion(*span, "replace with clamp", suggestion, Applicability::MaybeIncorrect);
         if *is_float {
             d.note("clamp will panic if max < min, min.is_nan(), or max.is_nan()")
diff --git a/src/tools/clippy/clippy_lints/src/matches/significant_drop_in_scrutinee.rs b/src/tools/clippy/clippy_lints/src/matches/significant_drop_in_scrutinee.rs
index ee0fdb35313..a7e42fd2405 100644
--- a/src/tools/clippy/clippy_lints/src/matches/significant_drop_in_scrutinee.rs
+++ b/src/tools/clippy/clippy_lints/src/matches/significant_drop_in_scrutinee.rs
@@ -2,7 +2,7 @@ use crate::FxHashSet;
 use clippy_utils::diagnostics::span_lint_and_then;
 use clippy_utils::source::{indent_of, snippet};
 use clippy_utils::{get_attr, is_lint_allowed};
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir::intravisit::{walk_expr, Visitor};
 use rustc_hir::{Arm, Expr, ExprKind, MatchSource};
 use rustc_lint::{LateContext, LintContext};
@@ -37,7 +37,7 @@ pub(super) fn check<'tcx>(
     }
 }
 
-fn set_diagnostic<'tcx>(diag: &mut Diagnostic, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, found: FoundSigDrop) {
+fn set_diagnostic<'tcx>(diag: &mut DiagnosticBuilder<'_, ()>, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, found: FoundSigDrop) {
     if found.lint_suggestion == LintSuggestion::MoveAndClone {
         // If our suggestion is to move and clone, then we want to leave it to the user to
         // decide how to address this lint, since it may be that cloning is inappropriate.
diff --git a/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs b/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs
index b2c5987e43d..617d6d998fc 100644
--- a/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs
+++ b/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs
@@ -1,6 +1,6 @@
 use clippy_utils::diagnostics::span_lint_and_then;
 use clippy_utils::ty::is_type_diagnostic_item;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_lint::LateContext;
 use rustc_span::{sym, Span};
 use {rustc_ast as ast, rustc_hir as hir};
@@ -22,7 +22,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, recv: &'tcx hir::Expr<'_>, arg
             SUSPICIOUS_COMMAND_ARG_SPACE,
             arg.span,
             "single argument that looks like it should be multiple arguments",
-            |diag: &mut Diagnostic| {
+            |diag: &mut DiagnosticBuilder<'_, ()>| {
                 diag.multipart_suggestion_verbose(
                     "consider splitting the argument",
                     vec![(span, "args".to_string()), (arg.span, format!("[{arg1:?}, {arg2:?}]"))],
diff --git a/src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs b/src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs
index 0e4d39c9990..ab25dde7efe 100644
--- a/src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs
+++ b/src/tools/clippy/clippy_lints/src/missing_asserts_for_indexing.rs
@@ -9,7 +9,7 @@ use clippy_utils::{eq_expr_value, hash_expr, higher};
 use rustc_ast::{LitKind, RangeLimits};
 use rustc_data_structures::packed::Pu128;
 use rustc_data_structures::unhash::UnhashMap;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir::{BinOp, Block, Body, Expr, ExprKind, UnOp};
 use rustc_lint::{LateContext, LateLintPass};
 use rustc_session::declare_lint_pass;
@@ -67,7 +67,7 @@ declare_lint_pass!(MissingAssertsForIndexing => [MISSING_ASSERTS_FOR_INDEXING]);
 
 fn report_lint<F>(cx: &LateContext<'_>, full_span: Span, msg: &str, indexes: &[Span], f: F)
 where
-    F: FnOnce(&mut Diagnostic),
+    F: FnOnce(&mut DiagnosticBuilder<'_, ()>),
 {
     span_lint_and_then(cx, MISSING_ASSERTS_FOR_INDEXING, full_span, msg, |diag| {
         f(diag);
diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
index 384a402ce5b..6252f91b25f 100644
--- a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
+++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
@@ -6,7 +6,7 @@ use clippy_utils::ty::{
     implements_trait, implements_trait_with_env_from_iter, is_copy, is_type_diagnostic_item, is_type_lang_item,
 };
 use rustc_ast::ast::Attribute;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir::intravisit::FnKind;
 use rustc_hir::{
     BindingAnnotation, Body, FnDecl, GenericArg, HirId, HirIdSet, Impl, ItemKind, LangItem, Mutability, Node, PatKind,
@@ -196,7 +196,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
                 && !moved_vars.contains(&canonical_id)
             {
                 // Dereference suggestion
-                let sugg = |diag: &mut Diagnostic| {
+                let sugg = |diag: &mut DiagnosticBuilder<'_, ()>| {
                     if let ty::Adt(def, ..) = ty.kind() {
                         if let Some(span) = cx.tcx.hir().span_if_local(def.did()) {
                             if type_allowed_to_implement_copy(
diff --git a/src/tools/clippy/clippy_utils/src/diagnostics.rs b/src/tools/clippy/clippy_utils/src/diagnostics.rs
index 5199959c0f2..db94b60dc95 100644
--- a/src/tools/clippy/clippy_utils/src/diagnostics.rs
+++ b/src/tools/clippy/clippy_utils/src/diagnostics.rs
@@ -8,13 +8,13 @@
 //! Thank you!
 //! ~The `INTERNAL_METADATA_COLLECTOR` lint
 
-use rustc_errors::{Applicability, Diagnostic, MultiSpan};
+use rustc_errors::{Applicability, DiagnosticBuilder, MultiSpan};
 use rustc_hir::HirId;
 use rustc_lint::{LateContext, Lint, LintContext};
 use rustc_span::Span;
 use std::env;
 
-fn docs_link(diag: &mut Diagnostic, lint: &'static Lint) {
+fn docs_link(diag: &mut DiagnosticBuilder<'_, ()>, lint: &'static Lint) {
     if env::var("CLIPPY_DISABLE_DOCS_LINKS").is_err() {
         if let Some(lint) = lint.name_lower().strip_prefix("clippy::") {
             diag.help(format!(
@@ -143,7 +143,7 @@ pub fn span_lint_and_then<C, S, F>(cx: &C, lint: &'static Lint, sp: S, msg: &str
 where
     C: LintContext,
     S: Into<MultiSpan>,
-    F: FnOnce(&mut Diagnostic),
+    F: FnOnce(&mut DiagnosticBuilder<'_, ()>),
 {
     #[expect(clippy::disallowed_methods)]
     cx.span_lint(lint, sp, msg.to_string(), |diag| {
@@ -165,7 +165,7 @@ pub fn span_lint_hir_and_then(
     hir_id: HirId,
     sp: impl Into<MultiSpan>,
     msg: &str,
-    f: impl FnOnce(&mut Diagnostic),
+    f: impl FnOnce(&mut DiagnosticBuilder<'_, ()>),
 ) {
     #[expect(clippy::disallowed_methods)]
     cx.tcx.node_span_lint(lint, hir_id, sp, msg.to_string(), |diag| {
@@ -214,7 +214,7 @@ pub fn span_lint_and_sugg<T: LintContext>(
 /// appear once per
 /// replacement. In human-readable format though, it only appears once before
 /// the whole suggestion.
-pub fn multispan_sugg<I>(diag: &mut Diagnostic, help_msg: &str, sugg: I)
+pub fn multispan_sugg<I>(diag: &mut DiagnosticBuilder<'_, ()>, help_msg: &str, sugg: I)
 where
     I: IntoIterator<Item = (Span, String)>,
 {
@@ -227,7 +227,7 @@ where
 /// multiple spans. This is tracked in issue [rustfix#141](https://github.com/rust-lang/rustfix/issues/141).
 /// Suggestions with multiple spans will be silently ignored.
 pub fn multispan_sugg_with_applicability<I>(
-    diag: &mut Diagnostic,
+    diag: &mut DiagnosticBuilder<'_, ()>,
     help_msg: &str,
     applicability: Applicability,
     sugg: I,
diff --git a/src/tools/clippy/clippy_utils/src/sugg.rs b/src/tools/clippy/clippy_utils/src/sugg.rs
index c86362c427c..b355e66b7b1 100644
--- a/src/tools/clippy/clippy_utils/src/sugg.rs
+++ b/src/tools/clippy/clippy_utils/src/sugg.rs
@@ -683,7 +683,7 @@ fn indentation<T: LintContext>(cx: &T, span: Span) -> Option<String> {
         })
 }
 
-/// Convenience extension trait for `Diagnostic`.
+/// Convenience extension trait for `DiagnosticBuilder`.
 pub trait DiagnosticExt<T: LintContext> {
     /// Suggests to add an attribute to an item.
     ///
@@ -731,7 +731,7 @@ pub trait DiagnosticExt<T: LintContext> {
     fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str, applicability: Applicability);
 }
 
-impl<T: LintContext> DiagnosticExt<T> for rustc_errors::Diagnostic {
+impl<T: LintContext> DiagnosticExt<T> for rustc_errors::DiagnosticBuilder<'_, ()> {
     fn suggest_item_with_attr<D: Display + ?Sized>(
         &mut self,
         cx: &T,
diff --git a/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.rs b/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.rs
index 3edb3a10b76..4ae75544c60 100644
--- a/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.rs
+++ b/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.rs
@@ -13,8 +13,6 @@
 
 const ARR: [i32; 2] = [1, 2];
 const REF: &i32 = &ARR[idx()]; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
-const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
-//~^ ERROR: failed
 
 const fn idx() -> usize {
     1
@@ -35,9 +33,6 @@ fn main() {
     x[const { idx() }]; // Ok, should not produce stderr.
     x[const { idx4() }]; // Ok, let rustc's `unconditional_panic` lint handle `usize` indexing on arrays.
     const { &ARR[idx()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
-    const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
-    //
-    //~^^ ERROR: failed
 
     let y = &x;
     y[0]; // Ok, referencing shouldn't affect this lint. See the issue 6021
diff --git a/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr b/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr
index 84e7eff4557..d5ce891b680 100644
--- a/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr
+++ b/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr
@@ -1,17 +1,5 @@
-error[E0080]: evaluation of `main::{constant#3}` failed
-  --> $DIR/test.rs:38:14
-   |
-LL |     const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
-   |              ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
-
-note: erroneous constant encountered
-  --> $DIR/test.rs:38:5
-   |
-LL |     const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
-   |     ^^^^^^^^^^^^^^^^^^^^^^
-
 error: indexing may panic
-  --> $DIR/test.rs:29:5
+  --> $DIR/test.rs:27:5
    |
 LL |     x[index];
    |     ^^^^^^^^
@@ -21,7 +9,7 @@ LL |     x[index];
    = help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
 
 error: indexing may panic
-  --> $DIR/test.rs:47:5
+  --> $DIR/test.rs:42:5
    |
 LL |     v[0];
    |     ^^^^
@@ -29,7 +17,7 @@ LL |     v[0];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> $DIR/test.rs:48:5
+  --> $DIR/test.rs:43:5
    |
 LL |     v[10];
    |     ^^^^^
@@ -37,7 +25,7 @@ LL |     v[10];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> $DIR/test.rs:49:5
+  --> $DIR/test.rs:44:5
    |
 LL |     v[1 << 3];
    |     ^^^^^^^^^
@@ -45,7 +33,7 @@ LL |     v[1 << 3];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> $DIR/test.rs:55:5
+  --> $DIR/test.rs:50:5
    |
 LL |     v[N];
    |     ^^^^
@@ -53,19 +41,12 @@ LL |     v[N];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> $DIR/test.rs:56:5
+  --> $DIR/test.rs:51:5
    |
 LL |     v[M];
    |     ^^^^
    |
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
-error[E0080]: evaluation of constant value failed
-  --> $DIR/test.rs:16:24
-   |
-LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
-   |                        ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
-
-error: aborting due to 8 previous errors
+error: aborting due to 6 previous errors
 
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/tools/clippy/tests/ui/indexing_slicing_index.rs b/src/tools/clippy/tests/ui/indexing_slicing_index.rs
index 1ac0bb11014..2ababad7fc7 100644
--- a/src/tools/clippy/tests/ui/indexing_slicing_index.rs
+++ b/src/tools/clippy/tests/ui/indexing_slicing_index.rs
@@ -13,8 +13,6 @@
 const ARR: [i32; 2] = [1, 2];
 const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
 //~^ ERROR: indexing may panic
-const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
-//~^ ERROR: indexing may panic
 
 const fn idx() -> usize {
     1
diff --git a/src/tools/clippy/tests/ui/indexing_slicing_index.stderr b/src/tools/clippy/tests/ui/indexing_slicing_index.stderr
index 6d64fa1e6cf..2996e31a1aa 100644
--- a/src/tools/clippy/tests/ui/indexing_slicing_index.stderr
+++ b/src/tools/clippy/tests/ui/indexing_slicing_index.stderr
@@ -9,29 +9,20 @@ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-re
    = note: `-D clippy::indexing-slicing` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
 
-error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:16:24
-   |
-LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
-   |                        ^^^^^^^^^^^
-   |
-   = help: consider using `.get(n)` or `.get_mut(n)` instead
-   = note: the suggestion might not be applicable in constant blocks
-
 error[E0080]: evaluation of `main::{constant#3}` failed
-  --> $DIR/indexing_slicing_index.rs:48:14
+  --> $DIR/indexing_slicing_index.rs:46:14
    |
 LL |     const { &ARR[idx4()] };
    |              ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
 
 note: erroneous constant encountered
-  --> $DIR/indexing_slicing_index.rs:48:5
+  --> $DIR/indexing_slicing_index.rs:46:5
    |
 LL |     const { &ARR[idx4()] };
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:29:5
+  --> $DIR/indexing_slicing_index.rs:27:5
    |
 LL |     x[index];
    |     ^^^^^^^^
@@ -39,7 +30,7 @@ LL |     x[index];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: index is out of bounds
-  --> $DIR/indexing_slicing_index.rs:32:5
+  --> $DIR/indexing_slicing_index.rs:30:5
    |
 LL |     x[4];
    |     ^^^^
@@ -48,13 +39,13 @@ LL |     x[4];
    = help: to override `-D warnings` add `#[allow(clippy::out_of_bounds_indexing)]`
 
 error: index is out of bounds
-  --> $DIR/indexing_slicing_index.rs:34:5
+  --> $DIR/indexing_slicing_index.rs:32:5
    |
 LL |     x[1 << 3];
    |     ^^^^^^^^^
 
 error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:45:14
+  --> $DIR/indexing_slicing_index.rs:43:14
    |
 LL |     const { &ARR[idx()] };
    |              ^^^^^^^^^^
@@ -63,7 +54,7 @@ LL |     const { &ARR[idx()] };
    = note: the suggestion might not be applicable in constant blocks
 
 error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:48:14
+  --> $DIR/indexing_slicing_index.rs:46:14
    |
 LL |     const { &ARR[idx4()] };
    |              ^^^^^^^^^^^
@@ -72,13 +63,13 @@ LL |     const { &ARR[idx4()] };
    = note: the suggestion might not be applicable in constant blocks
 
 error: index is out of bounds
-  --> $DIR/indexing_slicing_index.rs:55:5
+  --> $DIR/indexing_slicing_index.rs:53:5
    |
 LL |     y[4];
    |     ^^^^
 
 error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:58:5
+  --> $DIR/indexing_slicing_index.rs:56:5
    |
 LL |     v[0];
    |     ^^^^
@@ -86,7 +77,7 @@ LL |     v[0];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:60:5
+  --> $DIR/indexing_slicing_index.rs:58:5
    |
 LL |     v[10];
    |     ^^^^^
@@ -94,7 +85,7 @@ LL |     v[10];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:62:5
+  --> $DIR/indexing_slicing_index.rs:60:5
    |
 LL |     v[1 << 3];
    |     ^^^^^^^^^
@@ -102,13 +93,13 @@ LL |     v[1 << 3];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: index is out of bounds
-  --> $DIR/indexing_slicing_index.rs:70:5
+  --> $DIR/indexing_slicing_index.rs:68:5
    |
 LL |     x[N];
    |     ^^^^
 
 error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:73:5
+  --> $DIR/indexing_slicing_index.rs:71:5
    |
 LL |     v[N];
    |     ^^^^
@@ -116,7 +107,7 @@ LL |     v[N];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> $DIR/indexing_slicing_index.rs:75:5
+  --> $DIR/indexing_slicing_index.rs:73:5
    |
 LL |     v[M];
    |     ^^^^
@@ -124,17 +115,11 @@ LL |     v[M];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: index is out of bounds
-  --> $DIR/indexing_slicing_index.rs:79:13
+  --> $DIR/indexing_slicing_index.rs:77:13
    |
 LL |     let _ = x[4];
    |             ^^^^
 
-error[E0080]: evaluation of constant value failed
-  --> $DIR/indexing_slicing_index.rs:16:24
-   |
-LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
-   |                        ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
-
-error: aborting due to 17 previous errors
+error: aborting due to 15 previous errors
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs b/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs
index c6855a09696..046ea70b08f 100644
--- a/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs
+++ b/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.rs
@@ -1,5 +1,4 @@
 #![warn(clippy::non_send_fields_in_send_ty)]
-#![allow(suspicious_auto_trait_impls)]
 #![feature(extern_types)]
 
 use std::cell::UnsafeCell;
diff --git a/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.stderr b/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.stderr
index 1ea76196af9..99fd4ea60b6 100644
--- a/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.stderr
+++ b/src/tools/clippy/tests/ui/non_send_fields_in_send_ty.stderr
@@ -1,11 +1,11 @@
 error: some fields in `RingBuffer<T>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:17:1
+  --> $DIR/non_send_fields_in_send_ty.rs:16:1
    |
 LL | unsafe impl<T> Send for RingBuffer<T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `data` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:12:5
+  --> $DIR/non_send_fields_in_send_ty.rs:11:5
    |
 LL |     data: Vec<UnsafeCell<T>>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -14,155 +14,155 @@ LL |     data: Vec<UnsafeCell<T>>,
    = help: to override `-D warnings` add `#[allow(clippy::non_send_fields_in_send_ty)]`
 
 error: some fields in `MvccRwLock<T>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:26:1
+  --> $DIR/non_send_fields_in_send_ty.rs:25:1
    |
 LL | unsafe impl<T> Send for MvccRwLock<T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `lock` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:23:5
+  --> $DIR/non_send_fields_in_send_ty.rs:22:5
    |
 LL |     lock: Mutex<Box<T>>,
    |     ^^^^^^^^^^^^^^^^^^^
    = help: add bounds on type parameter `T` that satisfy `Mutex<Box<T>>: Send`
 
 error: some fields in `ArcGuard<RC, T>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:35:1
+  --> $DIR/non_send_fields_in_send_ty.rs:34:1
    |
 LL | unsafe impl<RC, T: Send> Send for ArcGuard<RC, T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `head` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:32:5
+  --> $DIR/non_send_fields_in_send_ty.rs:31:5
    |
 LL |     head: Arc<RC>,
    |     ^^^^^^^^^^^^^
    = help: add bounds on type parameter `RC` that satisfy `Arc<RC>: Send`
 
 error: some fields in `DeviceHandle<T>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:52:1
+  --> $DIR/non_send_fields_in_send_ty.rs:51:1
    |
 LL | unsafe impl<T: UsbContext> Send for DeviceHandle<T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `context` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:48:5
+  --> $DIR/non_send_fields_in_send_ty.rs:47:5
    |
 LL |     context: T,
    |     ^^^^^^^^^^
    = help: add `T: Send` bound in `Send` impl
 
 error: some fields in `NoGeneric` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:60:1
+  --> $DIR/non_send_fields_in_send_ty.rs:59:1
    |
 LL | unsafe impl Send for NoGeneric {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `rc_is_not_send` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:57:5
+  --> $DIR/non_send_fields_in_send_ty.rs:56:5
    |
 LL |     rc_is_not_send: Rc<String>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: use a thread-safe type that implements `Send`
 
 error: some fields in `MultiField<T>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:69:1
+  --> $DIR/non_send_fields_in_send_ty.rs:68:1
    |
 LL | unsafe impl<T> Send for MultiField<T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `field1` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:64:5
+  --> $DIR/non_send_fields_in_send_ty.rs:63:5
    |
 LL |     field1: T,
    |     ^^^^^^^^^
    = help: add `T: Send` bound in `Send` impl
 note: it is not safe to send field `field2` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:65:5
+  --> $DIR/non_send_fields_in_send_ty.rs:64:5
    |
 LL |     field2: T,
    |     ^^^^^^^^^
    = help: add `T: Send` bound in `Send` impl
 note: it is not safe to send field `field3` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:66:5
+  --> $DIR/non_send_fields_in_send_ty.rs:65:5
    |
 LL |     field3: T,
    |     ^^^^^^^^^
    = help: add `T: Send` bound in `Send` impl
 
 error: some fields in `MyOption<T>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:77:1
+  --> $DIR/non_send_fields_in_send_ty.rs:76:1
    |
 LL | unsafe impl<T> Send for MyOption<T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `0` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:73:12
+  --> $DIR/non_send_fields_in_send_ty.rs:72:12
    |
 LL |     MySome(T),
    |            ^
    = help: add `T: Send` bound in `Send` impl
 
 error: some fields in `MultiParam<A, B>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:90:1
+  --> $DIR/non_send_fields_in_send_ty.rs:89:1
    |
 LL | unsafe impl<A, B> Send for MultiParam<A, B> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `vec` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:87:5
+  --> $DIR/non_send_fields_in_send_ty.rs:86:5
    |
 LL |     vec: Vec<(A, B)>,
    |     ^^^^^^^^^^^^^^^^
    = help: add bounds on type parameters `A, B` that satisfy `Vec<(A, B)>: Send`
 
 error: some fields in `HeuristicTest` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:109:1
+  --> $DIR/non_send_fields_in_send_ty.rs:108:1
    |
 LL | unsafe impl Send for HeuristicTest {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `field4` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:104:5
+  --> $DIR/non_send_fields_in_send_ty.rs:103:5
    |
 LL |     field4: (*const NonSend, Rc<u8>),
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: use a thread-safe type that implements `Send`
 
 error: some fields in `AttrTest3<T>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:129:1
+  --> $DIR/non_send_fields_in_send_ty.rs:128:1
    |
 LL | unsafe impl<T> Send for AttrTest3<T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `0` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:124:11
+  --> $DIR/non_send_fields_in_send_ty.rs:123:11
    |
 LL |     Enum2(T),
    |           ^
    = help: add `T: Send` bound in `Send` impl
 
 error: some fields in `Complex<P, u32>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:138:1
+  --> $DIR/non_send_fields_in_send_ty.rs:137:1
    |
 LL | unsafe impl<P> Send for Complex<P, u32> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `field1` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:134:5
+  --> $DIR/non_send_fields_in_send_ty.rs:133:5
    |
 LL |     field1: A,
    |     ^^^^^^^^^
    = help: add `P: Send` bound in `Send` impl
 
 error: some fields in `Complex<Q, MutexGuard<'static, bool>>` are not safe to be sent to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:142:1
+  --> $DIR/non_send_fields_in_send_ty.rs:141:1
    |
 LL | unsafe impl<Q: Send> Send for Complex<Q, MutexGuard<'static, bool>> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: it is not safe to send field `field2` to another thread
-  --> $DIR/non_send_fields_in_send_ty.rs:135:5
+  --> $DIR/non_send_fields_in_send_ty.rs:134:5
    |
 LL |     field2: B,
    |     ^^^^^^^^^
diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml
index 31c6353e675..62d0fcc1a60 100644
--- a/src/tools/compiletest/Cargo.toml
+++ b/src/tools/compiletest/Cargo.toml
@@ -34,7 +34,7 @@ libc = "0.2"
 miow = "0.6"
 
 [target.'cfg(windows)'.dependencies.windows]
-version = "0.48.0"
+version = "0.52.0"
 features = [
     "Win32_Foundation",
     "Win32_System_Diagnostics_Debug",
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 117828645a9..7f765fd86c8 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -55,7 +55,7 @@ impl EarlyProps {
             &mut poisoned,
             testfile,
             rdr,
-            &mut |_, _, ln, _| {
+            &mut |HeaderLine { directive: ln, .. }| {
                 config.push_name_value_directive(ln, directives::AUX_BUILD, &mut props.aux, |r| {
                     r.trim().to_string()
                 });
@@ -330,8 +330,8 @@ impl TestProps {
                 &mut poisoned,
                 testfile,
                 file,
-                &mut |revision, _, ln, _| {
-                    if revision.is_some() && revision != cfg {
+                &mut |HeaderLine { header_revision, directive: ln, .. }| {
+                    if header_revision.is_some() && header_revision != cfg {
                         return;
                     }
 
@@ -672,17 +672,6 @@ pub fn line_directive<'line>(
     }
 }
 
-fn iter_header<R: Read>(
-    mode: Mode,
-    suite: &str,
-    poisoned: &mut bool,
-    testfile: &Path,
-    rdr: R,
-    it: &mut dyn FnMut(Option<&str>, &str, &str, usize),
-) {
-    iter_header_extra(mode, suite, poisoned, testfile, rdr, &[], it)
-}
-
 /// This is generated by collecting directives from ui tests and then extracting their directive
 /// names. This is **not** an exhaustive list of all possible directives. Instead, this is a
 /// best-effort approximation for diagnostics.
@@ -801,23 +790,49 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[
     "unset-rustc-env",
 ];
 
-fn iter_header_extra(
+/// Arguments passed to the callback in [`iter_header`].
+struct HeaderLine<'ln> {
+    /// Contents of the square brackets preceding this header, if present.
+    header_revision: Option<&'ln str>,
+    /// Raw line from the test file, including comment prefix and any revision.
+    original_line: &'ln str,
+    /// Remainder of the directive line, after the initial comment prefix
+    /// (`//` or `//@` or `#`) and revision (if any) have been stripped.
+    directive: &'ln str,
+    line_number: usize,
+}
+
+fn iter_header(
     mode: Mode,
     suite: &str,
     poisoned: &mut bool,
     testfile: &Path,
     rdr: impl Read,
-    extra_directives: &[&str],
-    it: &mut dyn FnMut(Option<&str>, &str, &str, usize),
+    it: &mut dyn FnMut(HeaderLine<'_>),
 ) {
     if testfile.is_dir() {
         return;
     }
 
-    // Process any extra directives supplied by the caller (e.g. because they
-    // are implied by the test mode), with a dummy line number of 0.
-    for directive in extra_directives {
-        it(None, directive, directive, 0);
+    // Coverage tests in coverage-run mode always have these extra directives,
+    // without needing to specify them manually in every test file.
+    // (Some of the comments below have been copied over from the old
+    // `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
+    if mode == Mode::CoverageRun {
+        let extra_directives: &[&str] = &[
+            "needs-profiler-support",
+            // FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
+            // properly. Since we only have GCC on the CI ignore the test for now.
+            "ignore-windows-gnu",
+            // FIXME(pietroalbini): this test currently does not work on cross-compiled
+            // targets because remote-test is not capable of sending back the *.profraw
+            // files generated by the LLVM instrumentation.
+            "ignore-cross-compile",
+        ];
+        // Process the extra implied directives, with a dummy line number of 0.
+        for directive in extra_directives {
+            it(HeaderLine { header_revision: None, original_line: "", directive, line_number: 0 });
+        }
     }
 
     let comment = if testfile.extension().is_some_and(|e| e == "rs") {
@@ -843,14 +858,14 @@ fn iter_header_extra(
         // Assume that any directives will be found before the first
         // module or function. This doesn't seem to be an optimization
         // with a warm page cache. Maybe with a cold one.
-        let orig_ln = &ln;
+        let original_line = &ln;
         let ln = ln.trim();
         if ln.starts_with("fn") || ln.starts_with("mod") {
             return;
 
         // First try to accept `ui_test` style comments
-        } else if let Some((lncfg, ln)) = line_directive(comment, ln) {
-            it(lncfg, orig_ln, ln, line_number);
+        } else if let Some((header_revision, directive)) = line_directive(comment, ln) {
+            it(HeaderLine { header_revision, original_line, directive, line_number });
         } else if mode == Mode::Ui && suite == "ui" && !REVISION_MAGIC_COMMENT_RE.is_match(ln) {
             let Some((_, rest)) = line_directive("//", ln) else {
                 continue;
@@ -1150,37 +1165,16 @@ pub fn make_test_description<R: Read>(
     let mut ignore_message = None;
     let mut should_fail = false;
 
-    let extra_directives: &[&str] = match config.mode {
-        // The coverage-run tests are treated as having these extra directives,
-        // without needing to specify them manually in every test file.
-        // (Some of the comments below have been copied over from
-        // `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
-        Mode::CoverageRun => {
-            &[
-                "needs-profiler-support",
-                // FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
-                // properly. Since we only have GCC on the CI ignore the test for now.
-                "ignore-windows-gnu",
-                // FIXME(pietroalbini): this test currently does not work on cross-compiled
-                // targets because remote-test is not capable of sending back the *.profraw
-                // files generated by the LLVM instrumentation.
-                "ignore-cross-compile",
-            ]
-        }
-        _ => &[],
-    };
-
     let mut local_poisoned = false;
 
-    iter_header_extra(
+    iter_header(
         config.mode,
         &config.suite,
         &mut local_poisoned,
         path,
         src,
-        extra_directives,
-        &mut |revision, og_ln, ln, line_number| {
-            if revision.is_some() && revision != cfg {
+        &mut |HeaderLine { header_revision, original_line, directive: ln, line_number }| {
+            if header_revision.is_some() && header_revision != cfg {
                 return;
             }
 
@@ -1204,7 +1198,7 @@ pub fn make_test_description<R: Read>(
                 };
             }
 
-            if let Some((_, post)) = og_ln.trim_start().split_once("//") {
+            if let Some((_, post)) = original_line.trim_start().split_once("//") {
                 let post = post.trim_start();
                 if post.starts_with("ignore-tidy")
                     && config.mode == Mode::Ui
diff --git a/src/tools/miri/tests/fail/shims/fs/isolated_file.stderr b/src/tools/miri/tests/fail/shims/fs/isolated_file.stderr
index ec670c4a391..1f08649428a 100644
--- a/src/tools/miri/tests/fail/shims/fs/isolated_file.stderr
+++ b/src/tools/miri/tests/fail/shims/fs/isolated_file.stderr
@@ -11,8 +11,9 @@ LL |         let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode a
    = note: inside `std::sys::pal::PLATFORM::cvt_r::<i32, {closure@std::sys::pal::PLATFORM::fs::File::open_c::{closure#0}}>` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
    = note: inside `std::sys::pal::PLATFORM::fs::File::open_c` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
    = note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
-   = note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr::<std::sys::pal::PLATFORM::fs::File, {closure@std::sys::pal::PLATFORM::fs::File::open::{closure#0}}>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
-   = note: inside `std::sys::pal::PLATFORM::small_c_string::run_path_with_cstr::<std::sys::pal::PLATFORM::fs::File, {closure@std::sys::pal::PLATFORM::fs::File::open::{closure#0}}>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
+   = note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr_stack::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
+   = note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
+   = note: inside `std::sys::pal::PLATFORM::small_c_string::run_path_with_cstr::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
    = note: inside `std::sys::pal::PLATFORM::fs::File::open` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
    = note: inside `std::fs::OpenOptions::_open` at RUSTLIB/std/src/fs.rs:LL:CC
    = note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at RUSTLIB/std/src/fs.rs:LL:CC
diff --git a/src/tools/opt-dist/Cargo.toml b/src/tools/opt-dist/Cargo.toml
index 9e852b0645a..eb6f889a6f3 100644
--- a/src/tools/opt-dist/Cargo.toml
+++ b/src/tools/opt-dist/Cargo.toml
@@ -21,6 +21,6 @@ serde = { version = "1", features = ["derive"] }
 serde_json = "1"
 glob = "0.3"
 tempfile = "3.5"
-derive_builder = "0.12"
+derive_builder = "0.20"
 clap = { version = "4", features = ["derive"] }
 tabled = { version = "0.13", default-features = false, features = ["std"] }
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
index 2fc07933200..3329909e9da 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
@@ -503,10 +503,6 @@ pub const DEFAULT_LINTS: &[Lint] = &[
         description: r##"stable features found in `#[feature]` directive"##,
     },
     Lint {
-        label: "suspicious_auto_trait_impls",
-        description: r##"the rules governing auto traits have recently changed resulting in potential breakage"##,
-    },
-    Lint {
         label: "suspicious_double_ref_op",
         description: r##"suspicious call of trait method on `&&T`"##,
     },
@@ -778,7 +774,6 @@ pub const DEFAULT_LINT_GROUPS: &[LintGroup] = &[
             "repr_transparent_external_private_fields",
             "semicolon_in_expressions_from_macros",
             "soft_unstable",
-            "suspicious_auto_trait_impls",
             "uninhabited_static",
             "unstable_name_collisions",
             "unstable_syntax_pre_expansion",
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index d4642deb2c6..b36b6da308e 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -384,6 +384,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
     "winapi-util",
     "winapi-x86_64-pc-windows-gnu",
     "windows",
+    "windows-core",
     "windows-sys",
     "windows-targets",
     "windows_aarch64_gnullvm",
diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt
new file mode 100644
index 00000000000..81437473b2d
--- /dev/null
+++ b/src/tools/tidy/src/issues.txt
@@ -0,0 +1,4387 @@
+
+/*
+============================================================
+    ⚠️⚠️⚠️NOTHING SHOULD EVER BE ADDED TO THIS LIST⚠️⚠️⚠️
+============================================================
+*/
+[
+"ui/abi/issue-28676.rs",
+"ui/abi/issues/issue-22565-rust-call.rs",
+"ui/abi/issues/issue-62350-sysv-neg-reg-counts.rs",
+"ui/abi/issues/issue-97463-broken-abi-leaked-uninit-data.rs",
+"ui/argument-suggestions/issue-100154.rs",
+"ui/argument-suggestions/issue-100478.rs",
+"ui/argument-suggestions/issue-101097.rs",
+"ui/argument-suggestions/issue-109425.rs",
+"ui/argument-suggestions/issue-109831.rs",
+"ui/argument-suggestions/issue-112507.rs",
+"ui/argument-suggestions/issue-96638.rs",
+"ui/argument-suggestions/issue-97197.rs",
+"ui/argument-suggestions/issue-97484.rs",
+"ui/argument-suggestions/issue-98894.rs",
+"ui/argument-suggestions/issue-98897.rs",
+"ui/argument-suggestions/issue-99482.rs",
+"ui/array-slice-vec/issue-15730.rs",
+"ui/array-slice-vec/issue-18425.rs",
+"ui/array-slice-vec/issue-69103-extra-binding-subslice.rs",
+"ui/asm/issue-113788.rs",
+"ui/asm/issue-72570.rs",
+"ui/asm/issue-85247.rs",
+"ui/asm/issue-87802.rs",
+"ui/asm/issue-89305.rs",
+"ui/asm/issue-92378.rs",
+"ui/asm/issue-97490.rs",
+"ui/asm/issue-99071.rs",
+"ui/asm/issue-99122-2.rs",
+"ui/asm/issue-99122.rs",
+"ui/asm/x86_64/issue-82869.rs",
+"ui/asm/x86_64/issue-89875.rs",
+"ui/asm/x86_64/issue-96797.rs",
+"ui/associated-consts/issue-102335-const.rs",
+"ui/associated-consts/issue-105330.rs",
+"ui/associated-consts/issue-110933.rs",
+"ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.rs",
+"ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.rs",
+"ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.rs",
+"ui/associated-consts/issue-47814.rs",
+"ui/associated-consts/issue-58022.rs",
+"ui/associated-consts/issue-63496.rs",
+"ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs",
+"ui/associated-consts/issue-88599-ref-self.rs",
+"ui/associated-consts/issue-93775.rs",
+"ui/associated-consts/issue-93835.rs",
+"ui/associated-inherent-types/issue-104260.rs",
+"ui/associated-inherent-types/issue-109071.rs",
+"ui/associated-inherent-types/issue-109299-1.rs",
+"ui/associated-inherent-types/issue-109299.rs",
+"ui/associated-inherent-types/issue-109768.rs",
+"ui/associated-inherent-types/issue-109789.rs",
+"ui/associated-inherent-types/issue-109790.rs",
+"ui/associated-inherent-types/issue-111404-0.rs",
+"ui/associated-inherent-types/issue-111404-1.rs",
+"ui/associated-inherent-types/issue-111879-0.rs",
+"ui/associated-inherent-types/issue-111879-1.rs",
+"ui/associated-item/issue-105449.rs",
+"ui/associated-item/issue-48027.rs",
+"ui/associated-item/issue-87638.rs",
+"ui/associated-type-bounds/issue-102335-ty.rs",
+"ui/associated-type-bounds/issue-104916.rs",
+"ui/associated-type-bounds/issue-61752.rs",
+"ui/associated-type-bounds/issue-70292.rs",
+"ui/associated-type-bounds/issue-71443-1.rs",
+"ui/associated-type-bounds/issue-71443-2.rs",
+"ui/associated-type-bounds/issue-73818.rs",
+"ui/associated-type-bounds/issue-79949.rs",
+"ui/associated-type-bounds/issue-81193.rs",
+"ui/associated-type-bounds/issue-83017.rs",
+"ui/associated-type-bounds/issue-99828.rs",
+"ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs",
+"ui/associated-types/issue-18655.rs",
+"ui/associated-types/issue-19081.rs",
+"ui/associated-types/issue-19883.rs",
+"ui/associated-types/issue-20005.rs",
+"ui/associated-types/issue-20825-2.rs",
+"ui/associated-types/issue-20825.rs",
+"ui/associated-types/issue-21363.rs",
+"ui/associated-types/issue-21726.rs",
+"ui/associated-types/issue-22037.rs",
+"ui/associated-types/issue-22066.rs",
+"ui/associated-types/issue-22560.rs",
+"ui/associated-types/issue-22828.rs",
+"ui/associated-types/issue-23208.rs",
+"ui/associated-types/issue-23595-1.rs",
+"ui/associated-types/issue-23595-2.rs",
+"ui/associated-types/issue-24159.rs",
+"ui/associated-types/issue-24204.rs",
+"ui/associated-types/issue-24338.rs",
+"ui/associated-types/issue-25339.rs",
+"ui/associated-types/issue-25700-1.rs",
+"ui/associated-types/issue-25700-2.rs",
+"ui/associated-types/issue-25700.rs",
+"ui/associated-types/issue-26681.rs",
+"ui/associated-types/issue-27675-unchecked-bounds.rs",
+"ui/associated-types/issue-27901.rs",
+"ui/associated-types/issue-28871.rs",
+"ui/associated-types/issue-31597.rs",
+"ui/associated-types/issue-32323.rs",
+"ui/associated-types/issue-32350.rs",
+"ui/associated-types/issue-36499.rs",
+"ui/associated-types/issue-37808.rs",
+"ui/associated-types/issue-37883.rs",
+"ui/associated-types/issue-38821.rs",
+"ui/associated-types/issue-38917.rs",
+"ui/associated-types/issue-39532.rs",
+"ui/associated-types/issue-40093.rs",
+"ui/associated-types/issue-41868.rs",
+"ui/associated-types/issue-43475.rs",
+"ui/associated-types/issue-43784-associated-type.rs",
+"ui/associated-types/issue-43924.rs",
+"ui/associated-types/issue-44153.rs",
+"ui/associated-types/issue-47139-1.rs",
+"ui/associated-types/issue-47139-2.rs",
+"ui/associated-types/issue-47385.rs",
+"ui/associated-types/issue-47814.rs",
+"ui/associated-types/issue-48010.rs",
+"ui/associated-types/issue-48551.rs",
+"ui/associated-types/issue-50301.rs",
+"ui/associated-types/issue-54108.rs",
+"ui/associated-types/issue-54182-1.rs",
+"ui/associated-types/issue-54182-2.rs",
+"ui/associated-types/issue-54467.rs",
+"ui/associated-types/issue-55846.rs",
+"ui/associated-types/issue-59324.rs",
+"ui/associated-types/issue-62200.rs",
+"ui/associated-types/issue-63591.rs",
+"ui/associated-types/issue-63593.rs",
+"ui/associated-types/issue-64848.rs",
+"ui/associated-types/issue-64855-2.rs",
+"ui/associated-types/issue-64855.rs",
+"ui/associated-types/issue-65774-1.rs",
+"ui/associated-types/issue-65774-2.rs",
+"ui/associated-types/issue-65934.rs",
+"ui/associated-types/issue-67684.rs",
+"ui/associated-types/issue-69398.rs",
+"ui/associated-types/issue-71113.rs",
+"ui/associated-types/issue-72806.rs",
+"ui/associated-types/issue-76179.rs",
+"ui/associated-types/issue-82079.rs",
+"ui/associated-types/issue-85103-layout-debug.rs",
+"ui/associated-types/issue-87261.rs",
+"ui/associated-types/issue-88856.rs",
+"ui/associated-types/issue-91069.rs",
+"ui/associated-types/issue-91231.rs",
+"ui/associated-types/issue-91234.rs",
+"ui/async-await/auxiliary/issue-107036.rs",
+"ui/async-await/auxiliary/issue-72470-lib.rs",
+"ui/async-await/in-trait/issue-102138.rs",
+"ui/async-await/in-trait/issue-102219.rs",
+"ui/async-await/in-trait/issue-102310.rs",
+"ui/async-await/in-trait/issue-104678.rs",
+"ui/async-await/issue-101715.rs",
+"ui/async-await/issue-105501.rs",
+"ui/async-await/issue-107036.rs",
+"ui/async-await/issue-108572.rs",
+"ui/async-await/issue-54239-private-type-triggers-lint.rs",
+"ui/async-await/issue-60709.rs",
+"ui/async-await/issue-61076.rs",
+"ui/async-await/issue-61452.rs",
+"ui/async-await/issue-61793.rs",
+"ui/async-await/issue-62658.rs",
+"ui/async-await/issue-63832-await-short-temporary-lifetime-1.rs",
+"ui/async-await/issue-63832-await-short-temporary-lifetime.rs",
+"ui/async-await/issue-64130-1-sync.rs",
+"ui/async-await/issue-64130-2-send.rs",
+"ui/async-await/issue-64130-3-other.rs",
+"ui/async-await/issue-64130-4-async-move.rs",
+"ui/async-await/issue-64130-non-send-future-diags.rs",
+"ui/async-await/issue-64391.rs",
+"ui/async-await/issue-65634-raw-ident-suggestion.rs",
+"ui/async-await/issue-66312.rs",
+"ui/async-await/issue-66387-if-without-else.rs",
+"ui/async-await/issue-67252-unnamed-future.rs",
+"ui/async-await/issue-67651.rs",
+"ui/async-await/issue-67765-async-diagnostic.rs",
+"ui/async-await/issue-68112.rs",
+"ui/async-await/issue-68523-start.rs",
+"ui/async-await/issue-68523.rs",
+"ui/async-await/issue-69446-fnmut-capture.rs",
+"ui/async-await/issue-70594.rs",
+"ui/async-await/issue-70818.rs",
+"ui/async-await/issue-70935-complex-spans.rs",
+"ui/async-await/issue-71137.rs",
+"ui/async-await/issue-72442.rs",
+"ui/async-await/issue-72470-llvm-dominate.rs",
+"ui/async-await/issue-72590-type-error-sized.rs",
+"ui/async-await/issue-73050.rs",
+"ui/async-await/issue-73137.rs",
+"ui/async-await/issue-73541-1.rs",
+"ui/async-await/issue-73541-2.rs",
+"ui/async-await/issue-73541-3.rs",
+"ui/async-await/issue-73541.rs",
+"ui/async-await/issue-73741-type-err.rs",
+"ui/async-await/issue-74047.rs",
+"ui/async-await/issue-74072-lifetime-name-annotations.rs",
+"ui/async-await/issue-74497-lifetime-in-opaque.rs",
+"ui/async-await/issue-75785-confusing-named-region.rs",
+"ui/async-await/issue-76547.rs",
+"ui/async-await/issue-77993-2.rs",
+"ui/async-await/issue-78115.rs",
+"ui/async-await/issue-84841.rs",
+"ui/async-await/issue-86507.rs",
+"ui/async-await/issue-93197.rs",
+"ui/async-await/issue-93648.rs",
+"ui/async-await/issue-98634.rs",
+"ui/async-await/issues/auxiliary/issue-60674.rs",
+"ui/async-await/issues/auxiliary/issue_67893.rs",
+"ui/async-await/issues/issue-102206.rs",
+"ui/async-await/issues/issue-107280.rs",
+"ui/async-await/issues/issue-112225-1.rs",
+"ui/async-await/issues/issue-112225-2.rs",
+"ui/async-await/issues/issue-51719.rs",
+"ui/async-await/issues/issue-51751.rs",
+"ui/async-await/issues/issue-53249.rs",
+"ui/async-await/issues/issue-54752-async-block.rs",
+"ui/async-await/issues/issue-54974.rs",
+"ui/async-await/issues/issue-55324.rs",
+"ui/async-await/issues/issue-55809.rs",
+"ui/async-await/issues/issue-58885.rs",
+"ui/async-await/issues/issue-59001.rs",
+"ui/async-await/issues/issue-59972.rs",
+"ui/async-await/issues/issue-60518.rs",
+"ui/async-await/issues/issue-60655-latebound-regions.rs",
+"ui/async-await/issues/issue-60674.rs",
+"ui/async-await/issues/issue-61187.rs",
+"ui/async-await/issues/issue-61986.rs",
+"ui/async-await/issues/issue-62009-1.rs",
+"ui/async-await/issues/issue-62009-2.rs",
+"ui/async-await/issues/issue-62097.rs",
+"ui/async-await/issues/issue-62517-1.rs",
+"ui/async-await/issues/issue-62517-2.rs",
+"ui/async-await/issues/issue-63388-1.rs",
+"ui/async-await/issues/issue-63388-2.rs",
+"ui/async-await/issues/issue-63388-3.rs",
+"ui/async-await/issues/issue-63388-4.rs",
+"ui/async-await/issues/issue-64391-2.rs",
+"ui/async-await/issues/issue-64433.rs",
+"ui/async-await/issues/issue-64477-2.rs",
+"ui/async-await/issues/issue-64477.rs",
+"ui/async-await/issues/issue-64964.rs",
+"ui/async-await/issues/issue-65159.rs",
+"ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs",
+"ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs",
+"ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs",
+"ui/async-await/issues/issue-65436-raw-ptr-not-send.rs",
+"ui/async-await/issues/issue-66695-static-refs.rs",
+"ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs",
+"ui/async-await/issues/issue-67611-static-mut-refs.rs",
+"ui/async-await/issues/issue-67893.rs",
+"ui/async-await/issues/issue-69307-nested.rs",
+"ui/async-await/issues/issue-69307.rs",
+"ui/async-await/issues/issue-72312.rs",
+"ui/async-await/issues/issue-78600.rs",
+"ui/async-await/issues/issue-78654.rs",
+"ui/async-await/issues/issue-78938-async-block.rs",
+"ui/async-await/issues/issue-95307.rs",
+"ui/async-await/return-type-notation/issue-110963-early.rs",
+"ui/async-await/return-type-notation/issue-110963-late.rs",
+"ui/async-await/track-caller/issue-105134.rs",
+"ui/attributes/issue-100631.rs",
+"ui/attributes/issue-105594-invalid-attr-validation.rs",
+"ui/attributes/issue-115264-expr-field.rs",
+"ui/attributes/issue-115264-pat-field.rs",
+"ui/attributes/issue-40962.rs",
+"ui/attributes/issue-90873.rs",
+"ui/auto-traits/issue-117789.rs",
+"ui/auto-traits/issue-23080-2.rs",
+"ui/auto-traits/issue-23080.rs",
+"ui/auto-traits/issue-83857-ub.rs",
+"ui/auto-traits/issue-84075.rs",
+"ui/auxiliary/issue-13560-1.rs",
+"ui/auxiliary/issue-13560-2.rs",
+"ui/auxiliary/issue-13560-3.rs",
+"ui/auxiliary/issue-16822.rs",
+"ui/auxiliary/issue-18502.rs",
+"ui/auxiliary/issue-24106.rs",
+"ui/auxiliary/issue-76387.rs",
+"ui/bench/issue-32062.rs",
+"ui/binding/issue-53114-borrow-checks.rs",
+"ui/binding/issue-53114-safety-checks.rs",
+"ui/binop/issue-25916.rs",
+"ui/binop/issue-28837.rs",
+"ui/binop/issue-3820.rs",
+"ui/binop/issue-62375.rs",
+"ui/binop/issue-77910-1.rs",
+"ui/binop/issue-77910-2.rs",
+"ui/binop/issue-93927.rs",
+"ui/block-result/issue-11714.rs",
+"ui/block-result/issue-13428.rs",
+"ui/block-result/issue-13624.rs",
+"ui/block-result/issue-20862.rs",
+"ui/block-result/issue-22645.rs",
+"ui/block-result/issue-3563.rs",
+"ui/block-result/issue-5500.rs",
+"ui/borrowck/issue-101119.rs",
+"ui/borrowck/issue-102209.rs",
+"ui/borrowck/issue-103095.rs",
+"ui/borrowck/issue-103250.rs",
+"ui/borrowck/issue-103624.rs",
+"ui/borrowck/issue-104639-lifetime-order.rs",
+"ui/borrowck/issue-10876.rs",
+"ui/borrowck/issue-109271-pass-self-into-closure.rs",
+"ui/borrowck/issue-111554.rs",
+"ui/borrowck/issue-114374-invalid-help-fmt-args.rs",
+"ui/borrowck/issue-11493.rs",
+"ui/borrowck/issue-115259-suggest-iter-mut.rs",
+"ui/borrowck/issue-119915-bad-clone-suggestion.rs",
+"ui/borrowck/issue-17263.rs",
+"ui/borrowck/issue-17545.rs",
+"ui/borrowck/issue-17718-static-move.rs",
+"ui/borrowck/issue-20801.rs",
+"ui/borrowck/issue-23338-params-outlive-temps-of-body.rs",
+"ui/borrowck/issue-24267-flow-exit.rs",
+"ui/borrowck/issue-25793.rs",
+"ui/borrowck/issue-28934.rs",
+"ui/borrowck/issue-29166.rs",
+"ui/borrowck/issue-31287-drop-in-guard.rs",
+"ui/borrowck/issue-33819.rs",
+"ui/borrowck/issue-36082.rs",
+"ui/borrowck/issue-41962.rs",
+"ui/borrowck/issue-42344.rs",
+"ui/borrowck/issue-45199.rs",
+"ui/borrowck/issue-45983.rs",
+"ui/borrowck/issue-46095.rs",
+"ui/borrowck/issue-46471.rs",
+"ui/borrowck/issue-47215-ice-from-drop-elab.rs",
+"ui/borrowck/issue-47646.rs",
+"ui/borrowck/issue-51117.rs",
+"ui/borrowck/issue-51301.rs",
+"ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs",
+"ui/borrowck/issue-51415.rs",
+"ui/borrowck/issue-52713-bug.rs",
+"ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs",
+"ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.rs",
+"ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.rs",
+"ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs",
+"ui/borrowck/issue-54499-field-mutation-of-moved-out.rs",
+"ui/borrowck/issue-54499-field-mutation-of-never-init.rs",
+"ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs",
+"ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs",
+"ui/borrowck/issue-55552-ascribe-wildcard-to-structured-pattern.rs",
+"ui/borrowck/issue-58776-borrowck-scans-children.rs",
+"ui/borrowck/issue-62007-assign-box.rs",
+"ui/borrowck/issue-62007-assign-field.rs",
+"ui/borrowck/issue-62107-match-arm-scopes.rs",
+"ui/borrowck/issue-62387-suggest-iter-mut-2.rs",
+"ui/borrowck/issue-62387-suggest-iter-mut.rs",
+"ui/borrowck/issue-64453.rs",
+"ui/borrowck/issue-69789-iterator-mut-suggestion.rs",
+"ui/borrowck/issue-70919-drop-in-loop.rs",
+"ui/borrowck/issue-71546.rs",
+"ui/borrowck/issue-7573.rs",
+"ui/borrowck/issue-80772.rs",
+"ui/borrowck/issue-81365-1.rs",
+"ui/borrowck/issue-81365-10.rs",
+"ui/borrowck/issue-81365-11.rs",
+"ui/borrowck/issue-81365-2.rs",
+"ui/borrowck/issue-81365-3.rs",
+"ui/borrowck/issue-81365-4.rs",
+"ui/borrowck/issue-81365-5.rs",
+"ui/borrowck/issue-81365-6.rs",
+"ui/borrowck/issue-81365-7.rs",
+"ui/borrowck/issue-81365-8.rs",
+"ui/borrowck/issue-81365-9.rs",
+"ui/borrowck/issue-81899.rs",
+"ui/borrowck/issue-82032.rs",
+"ui/borrowck/issue-82126-mismatched-subst-and-hir.rs",
+"ui/borrowck/issue-82462.rs",
+"ui/borrowck/issue-83309-ice-immut-in-for-loop.rs",
+"ui/borrowck/issue-83760.rs",
+"ui/borrowck/issue-83924.rs",
+"ui/borrowck/issue-85581.rs",
+"ui/borrowck/issue-85765-closure.rs",
+"ui/borrowck/issue-85765.rs",
+"ui/borrowck/issue-87456-point-to-closure.rs",
+"ui/borrowck/issue-88434-minimal-example.rs",
+"ui/borrowck/issue-88434-removal-index-should-be-less.rs",
+"ui/borrowck/issue-91206.rs",
+"ui/borrowck/issue-92015.rs",
+"ui/borrowck/issue-92157.rs",
+"ui/borrowck/issue-93078.rs",
+"ui/borrowck/issue-93093.rs",
+"ui/borrowck/issue-95079-missing-move-in-nested-closure.rs",
+"ui/box/issue-82446.rs",
+"ui/box/issue-95036.rs",
+"ui/c-variadic/issue-32201.rs",
+"ui/c-variadic/issue-86053-1.rs",
+"ui/c-variadic/issue-86053-2.rs",
+"ui/cast/issue-106883-is-empty.rs",
+"ui/cast/issue-10991.rs",
+"ui/cast/issue-17444.rs",
+"ui/cast/issue-84213.rs",
+"ui/cast/issue-85586.rs",
+"ui/cast/issue-88621.rs",
+"ui/cast/issue-89497.rs",
+"ui/closure-expected-type/issue-24421.rs",
+"ui/closure_context/issue-26046-fn-mut.rs",
+"ui/closure_context/issue-26046-fn-once.rs",
+"ui/closure_context/issue-42065.rs",
+"ui/closures/2229_closure_analysis/issue-118144.rs",
+"ui/closures/2229_closure_analysis/issue-87378.rs",
+"ui/closures/2229_closure_analysis/issue-87987.rs",
+"ui/closures/2229_closure_analysis/issue-88118-2.rs",
+"ui/closures/2229_closure_analysis/issue-88476.rs",
+"ui/closures/2229_closure_analysis/issue-89606.rs",
+"ui/closures/2229_closure_analysis/issue-90465.rs",
+"ui/closures/2229_closure_analysis/issue-92724-needsdrop-query-cycle.rs",
+"ui/closures/2229_closure_analysis/issue_88118.rs",
+"ui/closures/2229_closure_analysis/match/issue-87097.rs",
+"ui/closures/2229_closure_analysis/match/issue-87426.rs",
+"ui/closures/2229_closure_analysis/match/issue-87988.rs",
+"ui/closures/2229_closure_analysis/match/issue-88331.rs",
+"ui/closures/2229_closure_analysis/migrations/issue-78720.rs",
+"ui/closures/2229_closure_analysis/migrations/issue-86753.rs",
+"ui/closures/2229_closure_analysis/migrations/issue-90024-adt-correct-subst.rs",
+"ui/closures/2229_closure_analysis/run_pass/issue-87378.rs",
+"ui/closures/2229_closure_analysis/run_pass/issue-88372.rs",
+"ui/closures/2229_closure_analysis/run_pass/issue-88431.rs",
+"ui/closures/2229_closure_analysis/run_pass/issue-88476.rs",
+"ui/closures/issue-101696.rs",
+"ui/closures/issue-102089-multiple-opaque-cast.rs",
+"ui/closures/issue-10398.rs",
+"ui/closures/issue-10682.rs",
+"ui/closures/issue-109188.rs",
+"ui/closures/issue-111932.rs",
+"ui/closures/issue-113087.rs",
+"ui/closures/issue-11873.rs",
+"ui/closures/issue-23012-supertrait-signature-inference.rs",
+"ui/closures/issue-25439.rs",
+"ui/closures/issue-41366.rs",
+"ui/closures/issue-42463.rs",
+"ui/closures/issue-46742.rs",
+"ui/closures/issue-48109.rs",
+"ui/closures/issue-52437.rs",
+"ui/closures/issue-67123.rs",
+"ui/closures/issue-6801.rs",
+"ui/closures/issue-68025.rs",
+"ui/closures/issue-72408-nested-closures-exponential.rs",
+"ui/closures/issue-78720.rs",
+"ui/closures/issue-80313-mutable-borrow-in-closure.rs",
+"ui/closures/issue-80313-mutable-borrow-in-move-closure.rs",
+"ui/closures/issue-80313-mutation-in-closure.rs",
+"ui/closures/issue-80313-mutation-in-move-closure.rs",
+"ui/closures/issue-81700-mut-borrow.rs",
+"ui/closures/issue-82438-mut-without-upvar.rs",
+"ui/closures/issue-84044-drop-non-mut.rs",
+"ui/closures/issue-84128.rs",
+"ui/closures/issue-868.rs",
+"ui/closures/issue-87461.rs",
+"ui/closures/issue-87814-1.rs",
+"ui/closures/issue-87814-2.rs",
+"ui/closures/issue-90871.rs",
+"ui/closures/issue-97607.rs",
+"ui/closures/issue-99565.rs",
+"ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs",
+"ui/codegen/auxiliary/issue-97708-aux.rs",
+"ui/codegen/issue-101585-128bit-repeat.rs",
+"ui/codegen/issue-16602-1.rs",
+"ui/codegen/issue-16602-2.rs",
+"ui/codegen/issue-16602-3.rs",
+"ui/codegen/issue-28950.rs",
+"ui/codegen/issue-55976.rs",
+"ui/codegen/issue-63787.rs",
+"ui/codegen/issue-64401.rs",
+"ui/codegen/issue-79865-llvm-miscompile.rs",
+"ui/codegen/issue-82833-slice-miscompile.rs",
+"ui/codegen/issue-82859-slice-miscompile.rs",
+"ui/codegen/issue-88043-bb-does-not-have-terminator.rs",
+"ui/codegen/issue-97708.rs",
+"ui/codegen/issue-99551.rs",
+"ui/codemap_tests/issue-11715.rs",
+"ui/codemap_tests/issue-28308.rs",
+"ui/coercion/auxiliary/issue-39823.rs",
+"ui/coercion/issue-101066.rs",
+"ui/coercion/issue-14589.rs",
+"ui/coercion/issue-26905-rpass.rs",
+"ui/coercion/issue-26905.rs",
+"ui/coercion/issue-36007.rs",
+"ui/coercion/issue-37655.rs",
+"ui/coercion/issue-3794.rs",
+"ui/coercion/issue-39823.rs",
+"ui/coercion/issue-53475.rs",
+"ui/coercion/issue-73886.rs",
+"ui/coercion/issue-88097.rs",
+"ui/coherence/issue-85026.rs",
+"ui/coherence/issue-99663-2.rs",
+"ui/coherence/issue-99663.rs",
+"ui/command/issue-10626.rs",
+"ui/compare-method/issue-90444.rs",
+"ui/conditional-compilation/issue-34028.rs",
+"ui/confuse-field-and-method/issue-18343.rs",
+"ui/confuse-field-and-method/issue-2392.rs",
+"ui/confuse-field-and-method/issue-32128.rs",
+"ui/confuse-field-and-method/issue-33784.rs",
+"ui/const-generics/generic_arg_infer/issue-91614.rs",
+"ui/const-generics/generic_const_exprs/auxiliary/issue-94287-aux.rs",
+"ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.rs",
+"ui/const-generics/generic_const_exprs/issue-100217.rs",
+"ui/const-generics/generic_const_exprs/issue-100360.rs",
+"ui/const-generics/generic_const_exprs/issue-102074.rs",
+"ui/const-generics/generic_const_exprs/issue-102768.rs",
+"ui/const-generics/generic_const_exprs/issue-105257.rs",
+"ui/const-generics/generic_const_exprs/issue-105608.rs",
+"ui/const-generics/generic_const_exprs/issue-109141.rs",
+"ui/const-generics/generic_const_exprs/issue-62504.rs",
+"ui/const-generics/generic_const_exprs/issue-69654.rs",
+"ui/const-generics/generic_const_exprs/issue-72787.rs",
+"ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.rs",
+"ui/const-generics/generic_const_exprs/issue-73298.rs",
+"ui/const-generics/generic_const_exprs/issue-73899.rs",
+"ui/const-generics/generic_const_exprs/issue-74634.rs",
+"ui/const-generics/generic_const_exprs/issue-74713.rs",
+"ui/const-generics/generic_const_exprs/issue-76595.rs",
+"ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs",
+"ui/const-generics/generic_const_exprs/issue-80561-incorrect-param-env.rs",
+"ui/const-generics/generic_const_exprs/issue-80742.rs",
+"ui/const-generics/generic_const_exprs/issue-82268.rs",
+"ui/const-generics/generic_const_exprs/issue-83765.rs",
+"ui/const-generics/generic_const_exprs/issue-83972.rs",
+"ui/const-generics/generic_const_exprs/issue-84408.rs",
+"ui/const-generics/generic_const_exprs/issue-84669.rs",
+"ui/const-generics/generic_const_exprs/issue-85848.rs",
+"ui/const-generics/generic_const_exprs/issue-86710.rs",
+"ui/const-generics/generic_const_exprs/issue-89851.rs",
+"ui/const-generics/generic_const_exprs/issue-90847.rs",
+"ui/const-generics/generic_const_exprs/issue-94287.rs",
+"ui/const-generics/generic_const_exprs/issue-94293.rs",
+"ui/const-generics/generic_const_exprs/issue-96699.rs",
+"ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs",
+"ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs",
+"ui/const-generics/generic_const_exprs/issue-99647.rs",
+"ui/const-generics/generic_const_exprs/issue-99705.rs",
+"ui/const-generics/infer/issue-77092.rs",
+"ui/const-generics/issue-102124.rs",
+"ui/const-generics/issue-105689.rs",
+"ui/const-generics/issue-106419-struct-with-multiple-const-params.rs",
+"ui/const-generics/issue-112505-overflow.rs",
+"ui/const-generics/issue-46511.rs",
+"ui/const-generics/issue-66451.rs",
+"ui/const-generics/issue-70408.rs",
+"ui/const-generics/issue-80471.rs",
+"ui/const-generics/issue-93647.rs",
+"ui/const-generics/issue-97007.rs",
+"ui/const-generics/issues/issue-100313.rs",
+"ui/const-generics/issues/issue-105037.rs",
+"ui/const-generics/issues/issue-105821.rs",
+"ui/const-generics/issues/issue-56445-1.rs",
+"ui/const-generics/issues/issue-56445-2.rs",
+"ui/const-generics/issues/issue-56445-3.rs",
+"ui/const-generics/issues/issue-60818-struct-constructors.rs",
+"ui/const-generics/issues/issue-61336-1.rs",
+"ui/const-generics/issues/issue-61336-2.rs",
+"ui/const-generics/issues/issue-61336.rs",
+"ui/const-generics/issues/issue-61422.rs",
+"ui/const-generics/issues/issue-61432.rs",
+"ui/const-generics/issues/issue-62187-encountered-polymorphic-const.rs",
+"ui/const-generics/issues/issue-62878.rs",
+"ui/const-generics/issues/issue-63322-forbid-dyn.rs",
+"ui/const-generics/issues/issue-64519.rs",
+"ui/const-generics/issues/issue-66596-impl-trait-for-str-const-arg.rs",
+"ui/const-generics/issues/issue-66906.rs",
+"ui/const-generics/issues/issue-67185-1.rs",
+"ui/const-generics/issues/issue-67185-2.rs",
+"ui/const-generics/issues/issue-67375.rs",
+"ui/const-generics/issues/issue-67739.rs",
+"ui/const-generics/issues/issue-67945-1.rs",
+"ui/const-generics/issues/issue-67945-2.rs",
+"ui/const-generics/issues/issue-67945-3.rs",
+"ui/const-generics/issues/issue-67945-4.rs",
+"ui/const-generics/issues/issue-68104-print-stack-overflow.rs",
+"ui/const-generics/issues/issue-68366.rs",
+"ui/const-generics/issues/issue-68596.rs",
+"ui/const-generics/issues/issue-68615-adt.rs",
+"ui/const-generics/issues/issue-68615-array.rs",
+"ui/const-generics/issues/issue-69654-run-pass.rs",
+"ui/const-generics/issues/issue-70125-1.rs",
+"ui/const-generics/issues/issue-70125-2.rs",
+"ui/const-generics/issues/issue-70167.rs",
+"ui/const-generics/issues/issue-70180-1-stalled_on.rs",
+"ui/const-generics/issues/issue-70180-2-stalled_on.rs",
+"ui/const-generics/issues/issue-70225.rs",
+"ui/const-generics/issues/issue-70273-assoc-fn.rs",
+"ui/const-generics/issues/issue-71169.rs",
+"ui/const-generics/issues/issue-71202.rs",
+"ui/const-generics/issues/issue-71381.rs",
+"ui/const-generics/issues/issue-71382.rs",
+"ui/const-generics/issues/issue-71547.rs",
+"ui/const-generics/issues/issue-71611.rs",
+"ui/const-generics/issues/issue-71986.rs",
+"ui/const-generics/issues/issue-72352.rs",
+"ui/const-generics/issues/issue-72845.rs",
+"ui/const-generics/issues/issue-73120.rs",
+"ui/const-generics/issues/issue-73260.rs",
+"ui/const-generics/issues/issue-73491.rs",
+"ui/const-generics/issues/issue-73727-static-reference-array-const-param.rs",
+"ui/const-generics/issues/issue-74101.rs",
+"ui/const-generics/issues/issue-74255.rs",
+"ui/const-generics/issues/issue-74906.rs",
+"ui/const-generics/issues/issue-74950.rs",
+"ui/const-generics/issues/issue-75047.rs",
+"ui/const-generics/issues/issue-75299.rs",
+"ui/const-generics/issues/issue-76701-ty-param-in-const.rs",
+"ui/const-generics/issues/issue-79674.rs",
+"ui/const-generics/issues/issue-80062.rs",
+"ui/const-generics/issues/issue-80375.rs",
+"ui/const-generics/issues/issue-82956.rs",
+"ui/const-generics/issues/issue-83249.rs",
+"ui/const-generics/issues/issue-83288.rs",
+"ui/const-generics/issues/issue-83466.rs",
+"ui/const-generics/issues/issue-83765.rs",
+"ui/const-generics/issues/issue-84659.rs",
+"ui/const-generics/issues/issue-85031-2.rs",
+"ui/const-generics/issues/issue-86033.rs",
+"ui/const-generics/issues/issue-86530.rs",
+"ui/const-generics/issues/issue-86535-2.rs",
+"ui/const-generics/issues/issue-86535.rs",
+"ui/const-generics/issues/issue-86820.rs",
+"ui/const-generics/issues/issue-87076.rs",
+"ui/const-generics/issues/issue-87470.rs",
+"ui/const-generics/issues/issue-87493.rs",
+"ui/const-generics/issues/issue-87964.rs",
+"ui/const-generics/issues/issue-88119.rs",
+"ui/const-generics/issues/issue-88468.rs",
+"ui/const-generics/issues/issue-88997.rs",
+"ui/const-generics/issues/issue-89146.rs",
+"ui/const-generics/issues/issue-89304.rs",
+"ui/const-generics/issues/issue-89320.rs",
+"ui/const-generics/issues/issue-89334.rs",
+"ui/const-generics/issues/issue-90318.rs",
+"ui/const-generics/issues/issue-90364.rs",
+"ui/const-generics/issues/issue-90455.rs",
+"ui/const-generics/issues/issue-92186.rs",
+"ui/const-generics/issues/issue-96654.rs",
+"ui/const-generics/issues/issue-97278.rs",
+"ui/const-generics/issues/issue-97634.rs",
+"ui/const-generics/issues/issue-98629.rs",
+"ui/const-generics/issues/issue-99641.rs",
+"ui/const-generics/parser-error-recovery/issue-89013-no-assoc.rs",
+"ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs",
+"ui/const-generics/parser-error-recovery/issue-89013-type.rs",
+"ui/const-generics/parser-error-recovery/issue-89013.rs",
+"ui/const-generics/type-dependent/issue-61936.rs",
+"ui/const-generics/type-dependent/issue-63695.rs",
+"ui/const-generics/type-dependent/issue-67144-1.rs",
+"ui/const-generics/type-dependent/issue-67144-2.rs",
+"ui/const-generics/type-dependent/issue-69816.rs",
+"ui/const-generics/type-dependent/issue-70217.rs",
+"ui/const-generics/type-dependent/issue-70507.rs",
+"ui/const-generics/type-dependent/issue-70586.rs",
+"ui/const-generics/type-dependent/issue-71348.rs",
+"ui/const-generics/type-dependent/issue-71382.rs",
+"ui/const-generics/type-dependent/issue-71805.rs",
+"ui/const-generics/type-dependent/issue-73730.rs",
+"ui/const_prop/issue-102553.rs",
+"ui/const_prop/issue-86351.rs",
+"ui/consts/auxiliary/issue-17718-aux.rs",
+"ui/consts/auxiliary/issue-63226.rs",
+"ui/consts/const-eval/issue-100878.rs",
+"ui/consts/const-eval/issue-104390.rs",
+"ui/consts/const-eval/issue-114994-fail.rs",
+"ui/consts/const-eval/issue-114994.rs",
+"ui/consts/const-eval/issue-43197.rs",
+"ui/consts/const-eval/issue-44578.rs",
+"ui/consts/const-eval/issue-47971.rs",
+"ui/consts/const-eval/issue-49296.rs",
+"ui/consts/const-eval/issue-50706.rs",
+"ui/consts/const-eval/issue-50814-2.rs",
+"ui/consts/const-eval/issue-50814.rs",
+"ui/consts/const-eval/issue-51300.rs",
+"ui/consts/const-eval/issue-52475.rs",
+"ui/consts/const-eval/issue-53157.rs",
+"ui/consts/const-eval/issue-53401.rs",
+"ui/consts/const-eval/issue-55541.rs",
+"ui/consts/const-eval/issue-64908.rs",
+"ui/consts/const-eval/issue-64970.rs",
+"ui/consts/const-eval/issue-65394.rs",
+"ui/consts/const-eval/issue-70723.rs",
+"ui/consts/const-eval/issue-70804-fn-subtyping.rs",
+"ui/consts/const-eval/issue-84957-const-str-as-bytes.rs",
+"ui/consts/const-eval/issue-85155.rs",
+"ui/consts/const-eval/issue-85907.rs",
+"ui/consts/const-eval/issue-91827-extern-types-field-offset.rs",
+"ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs",
+"ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.rs",
+"ui/consts/const-mut-refs/issue-76510.rs",
+"ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs",
+"ui/consts/const_in_pattern/issue-44333.rs",
+"ui/consts/const_in_pattern/issue-53708.rs",
+"ui/consts/const_in_pattern/issue-62614.rs",
+"ui/consts/const_in_pattern/issue-65466.rs",
+"ui/consts/const_in_pattern/issue-73431.rs",
+"ui/consts/control-flow/issue-46843.rs",
+"ui/consts/control-flow/issue-50577.rs",
+"ui/consts/extra-const-ub/issue-100771.rs",
+"ui/consts/extra-const-ub/issue-101034.rs",
+"ui/consts/issue-102117.rs",
+"ui/consts/issue-103790.rs",
+"ui/consts/issue-104155.rs",
+"ui/consts/issue-104396.rs",
+"ui/consts/issue-104609.rs",
+"ui/consts/issue-104768.rs",
+"ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs",
+"ui/consts/issue-116186.rs",
+"ui/consts/issue-13837.rs",
+"ui/consts/issue-13902.rs",
+"ui/consts/issue-16538.rs",
+"ui/consts/issue-17074.rs",
+"ui/consts/issue-17458.rs",
+"ui/consts/issue-17718-borrow-interior.rs",
+"ui/consts/issue-17718-const-bad-values.rs",
+"ui/consts/issue-17718-const-borrow.rs",
+"ui/consts/issue-17718-constants-not-static.rs",
+"ui/consts/issue-17718-references.rs",
+"ui/consts/issue-17718.rs",
+"ui/consts/issue-17756.rs",
+"ui/consts/issue-18294.rs",
+"ui/consts/issue-19244.rs",
+"ui/consts/issue-21562.rs",
+"ui/consts/issue-21721.rs",
+"ui/consts/issue-23833.rs",
+"ui/consts/issue-23968-const-not-overflow.rs",
+"ui/consts/issue-25826.rs",
+"ui/consts/issue-27890.rs",
+"ui/consts/issue-28113.rs",
+"ui/consts/issue-28822.rs",
+"ui/consts/issue-29798.rs",
+"ui/consts/issue-29914-2.rs",
+"ui/consts/issue-29914-3.rs",
+"ui/consts/issue-29914.rs",
+"ui/consts/issue-29927-1.rs",
+"ui/consts/issue-29927.rs",
+"ui/consts/issue-32829-2.rs",
+"ui/consts/issue-32829.rs",
+"ui/consts/issue-33537.rs",
+"ui/consts/issue-33903.rs",
+"ui/consts/issue-3521.rs",
+"ui/consts/issue-36163.rs",
+"ui/consts/issue-37222.rs",
+"ui/consts/issue-37550-1.rs",
+"ui/consts/issue-37550.rs",
+"ui/consts/issue-37991.rs",
+"ui/consts/issue-39161-bogus-error.rs",
+"ui/consts/issue-39974.rs",
+"ui/consts/issue-43105.rs",
+"ui/consts/issue-44255.rs",
+"ui/consts/issue-44415.rs",
+"ui/consts/issue-46553.rs",
+"ui/consts/issue-47789.rs",
+"ui/consts/issue-50439.rs",
+"ui/consts/issue-52023-array-size-pointer-cast.rs",
+"ui/consts/issue-52060.rs",
+"ui/consts/issue-54224.rs",
+"ui/consts/issue-54348.rs",
+"ui/consts/issue-54387.rs",
+"ui/consts/issue-54582.rs",
+"ui/consts/issue-54954.rs",
+"ui/consts/issue-56164.rs",
+"ui/consts/issue-58435-ice-with-assoc-const.rs",
+"ui/consts/issue-62045.rs",
+"ui/consts/issue-63226.rs",
+"ui/consts/issue-63952.rs",
+"ui/consts/issue-64059.rs",
+"ui/consts/issue-64506.rs",
+"ui/consts/issue-64662.rs",
+"ui/consts/issue-65348.rs",
+"ui/consts/issue-66342.rs",
+"ui/consts/issue-66345.rs",
+"ui/consts/issue-66397.rs",
+"ui/consts/issue-66693-panic-in-array-len.rs",
+"ui/consts/issue-66693.rs",
+"ui/consts/issue-66787.rs",
+"ui/consts/issue-67529.rs",
+"ui/consts/issue-67640.rs",
+"ui/consts/issue-67641.rs",
+"ui/consts/issue-67696-const-prop-ice.rs",
+"ui/consts/issue-67862.rs",
+"ui/consts/issue-68264-overflow.rs",
+"ui/consts/issue-68542-closure-in-array-len.rs",
+"ui/consts/issue-68684.rs",
+"ui/consts/issue-69191-ice-on-uninhabited-enum-field.rs",
+"ui/consts/issue-69310-array-size-lit-wrong-ty.rs",
+"ui/consts/issue-69312.rs",
+"ui/consts/issue-69488.rs",
+"ui/consts/issue-69532.rs",
+"ui/consts/issue-6991.rs",
+"ui/consts/issue-70773-mir-typeck-lt-norm.rs",
+"ui/consts/issue-70942-trait-vs-impl-mismatch.rs",
+"ui/consts/issue-73976-monomorphic.rs",
+"ui/consts/issue-73976-polymorphic.rs",
+"ui/consts/issue-76064.rs",
+"ui/consts/issue-77062-large-zst-array.rs",
+"ui/consts/issue-78655.rs",
+"ui/consts/issue-79137-monomorphic.rs",
+"ui/consts/issue-79137-toogeneric.rs",
+"ui/consts/issue-79152-const-array-index.rs",
+"ui/consts/issue-79690.rs",
+"ui/consts/issue-87046.rs",
+"ui/consts/issue-88071.rs",
+"ui/consts/issue-88649.rs",
+"ui/consts/issue-89088.rs",
+"ui/consts/issue-90762.rs",
+"ui/consts/issue-90870.rs",
+"ui/consts/issue-90878-2.rs",
+"ui/consts/issue-90878-3.rs",
+"ui/consts/issue-90878.rs",
+"ui/consts/issue-91434.rs",
+"ui/consts/issue-91560.rs",
+"ui/consts/issue-94371.rs",
+"ui/consts/issue-94675.rs",
+"ui/consts/issue-96169.rs",
+"ui/coroutine/issue-102645.rs",
+"ui/coroutine/issue-105084.rs",
+"ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs",
+"ui/coroutine/issue-113279.rs",
+"ui/coroutine/issue-44197.rs",
+"ui/coroutine/issue-45729-unsafe-in-coroutine.rs",
+"ui/coroutine/issue-48048.rs",
+"ui/coroutine/issue-52304.rs",
+"ui/coroutine/issue-52398.rs",
+"ui/coroutine/issue-53548-1.rs",
+"ui/coroutine/issue-53548.rs",
+"ui/coroutine/issue-57017.rs",
+"ui/coroutine/issue-57084.rs",
+"ui/coroutine/issue-57478.rs",
+"ui/coroutine/issue-58888.rs",
+"ui/coroutine/issue-61442-stmt-expr-with-drop.rs",
+"ui/coroutine/issue-62506-two_awaits.rs",
+"ui/coroutine/issue-64620-yield-array-element.rs",
+"ui/coroutine/issue-68112.rs",
+"ui/coroutine/issue-69017.rs",
+"ui/coroutine/issue-69039.rs",
+"ui/coroutine/issue-87142.rs",
+"ui/coroutine/issue-88653.rs",
+"ui/coroutine/issue-91477.rs",
+"ui/coroutine/issue-93161.rs",
+"ui/cross-crate/issue-64872/issue-64872.rs",
+"ui/cycle-trait/issue-12511.rs",
+"ui/debuginfo/issue-105386-debuginfo-ub.rs",
+"ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs",
+"ui/deprecation/issue-84637-deprecated-associated-function.rs",
+"ui/derived-errors/issue-30580.rs",
+"ui/derived-errors/issue-31997-1.rs",
+"ui/derived-errors/issue-31997.rs",
+"ui/derives/issue-36617.rs",
+"ui/derives/issue-43023.rs",
+"ui/derives/issue-91492.rs",
+"ui/derives/issue-91550.rs",
+"ui/derives/issue-97343.rs",
+"ui/deriving/issue-103157.rs",
+"ui/deriving/issue-15689-1.rs",
+"ui/deriving/issue-15689-2.rs",
+"ui/deriving/issue-19358.rs",
+"ui/deriving/issue-3935.rs",
+"ui/deriving/issue-58319.rs",
+"ui/deriving/issue-6341.rs",
+"ui/deriving/issue-89188-gat-hrtb.rs",
+"ui/did_you_mean/issue-103909.rs",
+"ui/did_you_mean/issue-105225-named-args.rs",
+"ui/did_you_mean/issue-105225.rs",
+"ui/did_you_mean/issue-114112.rs",
+"ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs",
+"ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs",
+"ui/did_you_mean/issue-31424.rs",
+"ui/did_you_mean/issue-34126.rs",
+"ui/did_you_mean/issue-34337.rs",
+"ui/did_you_mean/issue-35937.rs",
+"ui/did_you_mean/issue-36798.rs",
+"ui/did_you_mean/issue-36798_unknown_field.rs",
+"ui/did_you_mean/issue-37139.rs",
+"ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs",
+"ui/did_you_mean/issue-38147-1.rs",
+"ui/did_you_mean/issue-38147-2.rs",
+"ui/did_you_mean/issue-38147-3.rs",
+"ui/did_you_mean/issue-38147-4.rs",
+"ui/did_you_mean/issue-39544.rs",
+"ui/did_you_mean/issue-39802-show-5-trait-impls.rs",
+"ui/did_you_mean/issue-40006.rs",
+"ui/did_you_mean/issue-40396.rs",
+"ui/did_you_mean/issue-40823.rs",
+"ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs",
+"ui/did_you_mean/issue-42599_available_fields_note.rs",
+"ui/did_you_mean/issue-42764.rs",
+"ui/did_you_mean/issue-43871-enum-instead-of-variant.rs",
+"ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs",
+"ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.rs",
+"ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs",
+"ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs",
+"ui/did_you_mean/issue-53280-expected-float-found-integer-literal.rs",
+"ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs",
+"ui/did_you_mean/issue-54109-without-witness.rs",
+"ui/did_you_mean/issue-56028-there-is-an-enum-variant.rs",
+"ui/did_you_mean/issue-87830-try-brackets-for-arrays.rs",
+"ui/drop/auxiliary/issue-10028.rs",
+"ui/drop/issue-100276.rs",
+"ui/drop/issue-10028.rs",
+"ui/drop/issue-103107.rs",
+"ui/drop/issue-110682.rs",
+"ui/drop/issue-17718-const-destructors.rs",
+"ui/drop/issue-21486.rs",
+"ui/drop/issue-23338-ensure-param-drop-order.rs",
+"ui/drop/issue-2734.rs",
+"ui/drop/issue-2735-2.rs",
+"ui/drop/issue-2735-3.rs",
+"ui/drop/issue-2735.rs",
+"ui/drop/issue-30018-nopanic.rs",
+"ui/drop/issue-35546.rs",
+"ui/drop/issue-48962.rs",
+"ui/drop/issue-90752-raw-ptr-shenanigans.rs",
+"ui/drop/issue-90752.rs",
+"ui/drop/issue-979.rs",
+"ui/dropck/issue-24805-dropck-itemless.rs",
+"ui/dropck/issue-28498-ugeh-with-lifetime-param.rs",
+"ui/dropck/issue-28498-ugeh-with-passed-to-fn.rs",
+"ui/dropck/issue-28498-ugeh-with-trait-bound.rs",
+"ui/dropck/issue-29844.rs",
+"ui/dropck/issue-34053.rs",
+"ui/dropck/issue-38868.rs",
+"ui/dropck/issue-54943-1.rs",
+"ui/dropck/issue-54943-2.rs",
+"ui/dst/issue-113447.rs",
+"ui/dst/issue-90528-unsizing-not-suggestion-110063.rs",
+"ui/dst/issue-90528-unsizing-suggestion-1.rs",
+"ui/dst/issue-90528-unsizing-suggestion-2.rs",
+"ui/dst/issue-90528-unsizing-suggestion-3.rs",
+"ui/dst/issue-90528-unsizing-suggestion-4.rs",
+"ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs",
+"ui/dyn-star/issue-102430.rs",
+"ui/empty/issue-37026.rs",
+"ui/entry-point/issue-118772.rs",
+"ui/enum-discriminant/auxiliary/issue-41394.rs",
+"ui/enum-discriminant/issue-104519.rs",
+"ui/enum-discriminant/issue-41394-rpass.rs",
+"ui/enum-discriminant/issue-41394.rs",
+"ui/enum-discriminant/issue-43398.rs",
+"ui/enum-discriminant/issue-46519.rs",
+"ui/enum-discriminant/issue-50689.rs",
+"ui/enum-discriminant/issue-51582.rs",
+"ui/enum-discriminant/issue-61696.rs",
+"ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs",
+"ui/enum-discriminant/issue-70453-generics-in-discr-ice.rs",
+"ui/enum-discriminant/issue-70453-polymorphic-ctfe.rs",
+"ui/enum-discriminant/issue-70509-partial_eq.rs",
+"ui/enum-discriminant/issue-72554.rs",
+"ui/enum-discriminant/issue-90038.rs",
+"ui/enum/issue-1821.rs",
+"ui/enum/issue-42747.rs",
+"ui/enum/issue-67945-1.rs",
+"ui/enum/issue-67945-2.rs",
+"ui/error-codes/e0119/auxiliary/issue-23563-a.rs",
+"ui/error-codes/e0119/issue-23563.rs",
+"ui/error-codes/e0119/issue-27403.rs",
+"ui/error-codes/e0119/issue-28981.rs",
+"ui/errors/issue-104621-extern-bad-file.rs",
+"ui/errors/issue-104621-extern-not-file.rs",
+"ui/errors/issue-89280-emitter-overflow-splice-lines.rs",
+"ui/errors/issue-99572-impl-trait-on-pointer.rs",
+"ui/expr/if/issue-4201.rs",
+"ui/extenv/issue-110547.rs",
+"ui/extenv/issue-55897.rs",
+"ui/extern/auxiliary/issue-80074-macro-2.rs",
+"ui/extern/auxiliary/issue-80074-macro.rs",
+"ui/extern/issue-10025.rs",
+"ui/extern/issue-10763.rs",
+"ui/extern/issue-10764-rpass.rs",
+"ui/extern/issue-112363-extern-item-where-clauses-debug-ice.rs",
+"ui/extern/issue-116203.rs",
+"ui/extern/issue-1251.rs",
+"ui/extern/issue-13655.rs",
+"ui/extern/issue-16250.rs",
+"ui/extern/issue-18576.rs",
+"ui/extern/issue-18819.rs",
+"ui/extern/issue-28324.rs",
+"ui/extern/issue-36122-accessing-externed-dst.rs",
+"ui/extern/issue-47725.rs",
+"ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs",
+"ui/extern/issue-64655-extern-rust-must-allow-unwind.rs",
+"ui/extern/issue-80074.rs",
+"ui/extern/issue-95829.rs",
+"ui/feature-gates/issue-43106-gating-of-bench.rs",
+"ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs",
+"ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs",
+"ui/feature-gates/issue-43106-gating-of-deprecated.rs",
+"ui/feature-gates/issue-43106-gating-of-derive-2.rs",
+"ui/feature-gates/issue-43106-gating-of-derive.rs",
+"ui/feature-gates/issue-43106-gating-of-macro_escape.rs",
+"ui/feature-gates/issue-43106-gating-of-macro_use.rs",
+"ui/feature-gates/issue-43106-gating-of-proc_macro_derive.rs",
+"ui/feature-gates/issue-43106-gating-of-stable.rs",
+"ui/feature-gates/issue-43106-gating-of-test.rs",
+"ui/feature-gates/issue-43106-gating-of-unstable.rs",
+"ui/feature-gates/issue-49983-see-issue-0.rs",
+"ui/fmt/issue-103826.rs",
+"ui/fmt/issue-104142.rs",
+"ui/fmt/issue-23781.rs",
+"ui/fmt/issue-75307.rs",
+"ui/fmt/issue-86085.rs",
+"ui/fmt/issue-89173.rs",
+"ui/fmt/issue-91556.rs",
+"ui/fn/issue-3044.rs",
+"ui/fn/issue-3099.rs",
+"ui/fn/issue-3904.rs",
+"ui/fn/issue-39259.rs",
+"ui/fn/issue-80179.rs",
+"ui/for-loop-while/issue-1257.rs",
+"ui/for-loop-while/issue-2216.rs",
+"ui/for-loop-while/issue-51345.rs",
+"ui/for-loop-while/issue-69841.rs",
+"ui/for/issue-20605.rs",
+"ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs",
+"ui/foreign/issue-91370-foreign-fn-block-impl.rs",
+"ui/foreign/issue-99276-same-type-lifetimes.rs",
+"ui/function-pointer/issue-102289.rs",
+"ui/functions-closures/closure-expected-type/issue-38714.rs",
+"ui/generic-associated-types/bugs/issue-100013.rs",
+"ui/generic-associated-types/bugs/issue-80626.rs",
+"ui/generic-associated-types/bugs/issue-87735.rs",
+"ui/generic-associated-types/bugs/issue-87755.rs",
+"ui/generic-associated-types/bugs/issue-87803.rs",
+"ui/generic-associated-types/bugs/issue-88382.rs",
+"ui/generic-associated-types/bugs/issue-88460.rs",
+"ui/generic-associated-types/bugs/issue-88526.rs",
+"ui/generic-associated-types/bugs/issue-91762.rs",
+"ui/generic-associated-types/issue-101020.rs",
+"ui/generic-associated-types/issue-102114.rs",
+"ui/generic-associated-types/issue-102333.rs",
+"ui/generic-associated-types/issue-102335-gat.rs",
+"ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs",
+"ui/generic-associated-types/issue-47206-where-clause.rs",
+"ui/generic-associated-types/issue-58694-parameter-out-of-range.rs",
+"ui/generic-associated-types/issue-62326-parameter-out-of-range.rs",
+"ui/generic-associated-types/issue-67424.rs",
+"ui/generic-associated-types/issue-67510-pass.rs",
+"ui/generic-associated-types/issue-67510.rs",
+"ui/generic-associated-types/issue-68641-check-gat-bounds.rs",
+"ui/generic-associated-types/issue-68642-broken-llvm-ir.rs",
+"ui/generic-associated-types/issue-68643-broken-mir.rs",
+"ui/generic-associated-types/issue-68644-codegen-selection.rs",
+"ui/generic-associated-types/issue-68645-codegen-fulfillment.rs",
+"ui/generic-associated-types/issue-68648-1.rs",
+"ui/generic-associated-types/issue-68648-2.rs",
+"ui/generic-associated-types/issue-68649-pass.rs",
+"ui/generic-associated-types/issue-68653.rs",
+"ui/generic-associated-types/issue-68656-unsized-values.rs",
+"ui/generic-associated-types/issue-70303.rs",
+"ui/generic-associated-types/issue-70304.rs",
+"ui/generic-associated-types/issue-71176.rs",
+"ui/generic-associated-types/issue-74684-1.rs",
+"ui/generic-associated-types/issue-74684-2.rs",
+"ui/generic-associated-types/issue-74816.rs",
+"ui/generic-associated-types/issue-74824.rs",
+"ui/generic-associated-types/issue-76407.rs",
+"ui/generic-associated-types/issue-76535.rs",
+"ui/generic-associated-types/issue-76826.rs",
+"ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs",
+"ui/generic-associated-types/issue-78671.rs",
+"ui/generic-associated-types/issue-79422.rs",
+"ui/generic-associated-types/issue-79636-1.rs",
+"ui/generic-associated-types/issue-79636-2.rs",
+"ui/generic-associated-types/issue-80433-reduced.rs",
+"ui/generic-associated-types/issue-80433.rs",
+"ui/generic-associated-types/issue-81487.rs",
+"ui/generic-associated-types/issue-81712-cyclic-traits.rs",
+"ui/generic-associated-types/issue-81862.rs",
+"ui/generic-associated-types/issue-84931.rs",
+"ui/generic-associated-types/issue-85921.rs",
+"ui/generic-associated-types/issue-86218-2.rs",
+"ui/generic-associated-types/issue-86218.rs",
+"ui/generic-associated-types/issue-86483.rs",
+"ui/generic-associated-types/issue-86787.rs",
+"ui/generic-associated-types/issue-87258_a.rs",
+"ui/generic-associated-types/issue-87258_b.rs",
+"ui/generic-associated-types/issue-87429-2.rs",
+"ui/generic-associated-types/issue-87429-associated-type-default.rs",
+"ui/generic-associated-types/issue-87429-specialization.rs",
+"ui/generic-associated-types/issue-87429.rs",
+"ui/generic-associated-types/issue-87748.rs",
+"ui/generic-associated-types/issue-87750.rs",
+"ui/generic-associated-types/issue-88287.rs",
+"ui/generic-associated-types/issue-88360.rs",
+"ui/generic-associated-types/issue-88405.rs",
+"ui/generic-associated-types/issue-88459.rs",
+"ui/generic-associated-types/issue-88595.rs",
+"ui/generic-associated-types/issue-89008.rs",
+"ui/generic-associated-types/issue-89352.rs",
+"ui/generic-associated-types/issue-90014-tait.rs",
+"ui/generic-associated-types/issue-90014-tait2.rs",
+"ui/generic-associated-types/issue-90014.rs",
+"ui/generic-associated-types/issue-90729.rs",
+"ui/generic-associated-types/issue-91139.rs",
+"ui/generic-associated-types/issue-91883.rs",
+"ui/generic-associated-types/issue-92033.rs",
+"ui/generic-associated-types/issue-92096.rs",
+"ui/generic-associated-types/issue-92280.rs",
+"ui/generic-associated-types/issue-92954.rs",
+"ui/generic-associated-types/issue-93141.rs",
+"ui/generic-associated-types/issue-93262.rs",
+"ui/generic-associated-types/issue-93340.rs",
+"ui/generic-associated-types/issue-93341.rs",
+"ui/generic-associated-types/issue-93342.rs",
+"ui/generic-associated-types/issue-93874.rs",
+"ui/generic-associated-types/issue-95305.rs",
+"ui/generics/issue-106694.rs",
+"ui/generics/issue-1112.rs",
+"ui/generics/issue-2936.rs",
+"ui/generics/issue-32498.rs",
+"ui/generics/issue-333.rs",
+"ui/generics/issue-59508-1.rs",
+"ui/generics/issue-59508.rs",
+"ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.rs",
+"ui/generics/issue-61631-default-type-param-cannot-reference-self.rs",
+"ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.rs",
+"ui/generics/issue-79605.rs",
+"ui/generics/issue-80512-param-reordering-with-defaults.rs",
+"ui/generics/issue-83556.rs",
+"ui/generics/issue-94432-garbage-ice.rs",
+"ui/generics/issue-94923.rs",
+"ui/generics/issue-95208-ignore-qself.rs",
+"ui/generics/issue-95208.rs",
+"ui/generics/issue-98432.rs",
+"ui/higher-ranked/trait-bounds/issue-100689.rs",
+"ui/higher-ranked/trait-bounds/issue-102899.rs",
+"ui/higher-ranked/trait-bounds/issue-30786.rs",
+"ui/higher-ranked/trait-bounds/issue-36139-normalize-closure-sig.rs",
+"ui/higher-ranked/trait-bounds/issue-39292.rs",
+"ui/higher-ranked/trait-bounds/issue-42114.rs",
+"ui/higher-ranked/trait-bounds/issue-43623.rs",
+"ui/higher-ranked/trait-bounds/issue-46989.rs",
+"ui/higher-ranked/trait-bounds/issue-57639.rs",
+"ui/higher-ranked/trait-bounds/issue-58451.rs",
+"ui/higher-ranked/trait-bounds/issue-59311.rs",
+"ui/higher-ranked/trait-bounds/issue-60283.rs",
+"ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.rs",
+"ui/higher-ranked/trait-bounds/issue-88446.rs",
+"ui/higher-ranked/trait-bounds/issue-88586-hr-self-outlives-in-trait-def.rs",
+"ui/higher-ranked/trait-bounds/issue-90177.rs",
+"ui/higher-ranked/trait-bounds/issue-95034.rs",
+"ui/higher-ranked/trait-bounds/issue-95230.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-44005.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-56556.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-1.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-2.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-4.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-5.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-6.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-70120.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-74261.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-76956.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-80706.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-80956.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-81809.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89436.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90612.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90638.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90875.rs",
+"ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.rs",
+"ui/hygiene/issue-15221.rs",
+"ui/hygiene/issue-29746.rs",
+"ui/hygiene/issue-32922.rs",
+"ui/hygiene/issue-40847.rs",
+"ui/hygiene/issue-44128.rs",
+"ui/hygiene/issue-47311.rs",
+"ui/hygiene/issue-47312.rs",
+"ui/hygiene/issue-61574-const-parameters.rs",
+"ui/hygiene/issue-77523-def-site-async-await.rs",
+"ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs",
+"ui/impl-trait/in-trait/issue-102140.rs",
+"ui/impl-trait/in-trait/issue-102301.rs",
+"ui/impl-trait/in-trait/issue-102571.rs",
+"ui/impl-trait/issue-100075-2.rs",
+"ui/impl-trait/issue-100075.rs",
+"ui/impl-trait/issue-100187.rs",
+"ui/impl-trait/issue-102605.rs",
+"ui/impl-trait/issue-103181-1.rs",
+"ui/impl-trait/issue-103181-2.rs",
+"ui/impl-trait/issue-103599.rs",
+"ui/impl-trait/issue-108591.rs",
+"ui/impl-trait/issue-108592.rs",
+"ui/impl-trait/issue-35668.rs",
+"ui/impl-trait/issue-36792.rs",
+"ui/impl-trait/issue-46959.rs",
+"ui/impl-trait/issue-49556.rs",
+"ui/impl-trait/issue-49579.rs",
+"ui/impl-trait/issue-49685.rs",
+"ui/impl-trait/issue-51185.rs",
+"ui/impl-trait/issue-54966.rs",
+"ui/impl-trait/issue-55872-1.rs",
+"ui/impl-trait/issue-55872-2.rs",
+"ui/impl-trait/issue-55872-3.rs",
+"ui/impl-trait/issue-55872.rs",
+"ui/impl-trait/issue-56445.rs",
+"ui/impl-trait/issue-68532.rs",
+"ui/impl-trait/issue-72911.rs",
+"ui/impl-trait/issue-86465.rs",
+"ui/impl-trait/issue-87450.rs",
+"ui/impl-trait/issue-99073-2.rs",
+"ui/impl-trait/issue-99073.rs",
+"ui/impl-trait/issue-99642-2.rs",
+"ui/impl-trait/issue-99642.rs",
+"ui/impl-trait/issue-99914.rs",
+"ui/impl-trait/issues/issue-104815.rs",
+"ui/impl-trait/issues/issue-105826.rs",
+"ui/impl-trait/issues/issue-21659-show-relevant-trait-impls-3.rs",
+"ui/impl-trait/issues/issue-42479.rs",
+"ui/impl-trait/issues/issue-49376.rs",
+"ui/impl-trait/issues/issue-52128.rs",
+"ui/impl-trait/issues/issue-53457.rs",
+"ui/impl-trait/issues/issue-54600.rs",
+"ui/impl-trait/issues/issue-54840.rs",
+"ui/impl-trait/issues/issue-54895.rs",
+"ui/impl-trait/issues/issue-55608-captures-empty-region.rs",
+"ui/impl-trait/issues/issue-57464-unexpected-regions.rs",
+"ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs",
+"ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs",
+"ui/impl-trait/issues/issue-57979-nested-impl-trait-in-assoc-proj.rs",
+"ui/impl-trait/issues/issue-58504.rs",
+"ui/impl-trait/issues/issue-58956.rs",
+"ui/impl-trait/issues/issue-62742.rs",
+"ui/impl-trait/issues/issue-65581.rs",
+"ui/impl-trait/issues/issue-67830.rs",
+"ui/impl-trait/issues/issue-70877.rs",
+"ui/impl-trait/issues/issue-70971.rs",
+"ui/impl-trait/issues/issue-74282.rs",
+"ui/impl-trait/issues/issue-77987.rs",
+"ui/impl-trait/issues/issue-78722-2.rs",
+"ui/impl-trait/issues/issue-78722.rs",
+"ui/impl-trait/issues/issue-79099.rs",
+"ui/impl-trait/issues/issue-82139.rs",
+"ui/impl-trait/issues/issue-83919.rs",
+"ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs",
+"ui/impl-trait/issues/issue-84073.rs",
+"ui/impl-trait/issues/issue-84919.rs",
+"ui/impl-trait/issues/issue-86201.rs",
+"ui/impl-trait/issues/issue-86642.rs",
+"ui/impl-trait/issues/issue-86719.rs",
+"ui/impl-trait/issues/issue-86800.rs",
+"ui/impl-trait/issues/issue-87295.rs",
+"ui/impl-trait/issues/issue-87340.rs",
+"ui/impl-trait/issues/issue-88236-2.rs",
+"ui/impl-trait/issues/issue-88236.rs",
+"ui/impl-trait/issues/issue-89312.rs",
+"ui/impl-trait/issues/issue-92305.rs",
+"ui/impl-trait/issues/issue-93788.rs",
+"ui/impl-trait/issues/issue-99348-impl-compatibility.rs",
+"ui/implied-bounds/issue-100690.rs",
+"ui/implied-bounds/issue-101951.rs",
+"ui/implied-bounds/issue-110161.rs",
+"ui/imports/auxiliary/issue-114682-2-extern.rs",
+"ui/imports/auxiliary/issue-114682-3-extern.rs",
+"ui/imports/auxiliary/issue-114682-4-extern.rs",
+"ui/imports/auxiliary/issue-114682-5-extern-1.rs",
+"ui/imports/auxiliary/issue-114682-5-extern-2.rs",
+"ui/imports/auxiliary/issue-114682-6-extern.rs",
+"ui/imports/auxiliary/issue-119369-extern.rs",
+"ui/imports/auxiliary/issue-36881-aux.rs",
+"ui/imports/auxiliary/issue-52891.rs",
+"ui/imports/auxiliary/issue-55811.rs",
+"ui/imports/auxiliary/issue-56125.rs",
+"ui/imports/auxiliary/issue-59764.rs",
+"ui/imports/auxiliary/issue-85992-extern-1.rs",
+"ui/imports/auxiliary/issue-85992-extern-2.rs",
+"ui/imports/issue-109148.rs",
+"ui/imports/issue-109343.rs",
+"ui/imports/issue-113953.rs",
+"ui/imports/issue-114682-1.rs",
+"ui/imports/issue-114682-2.rs",
+"ui/imports/issue-114682-3.rs",
+"ui/imports/issue-114682-4.rs",
+"ui/imports/issue-114682-5.rs",
+"ui/imports/issue-114682-6.rs",
+"ui/imports/issue-119369.rs",
+"ui/imports/issue-13404.rs",
+"ui/imports/issue-1697.rs",
+"ui/imports/issue-18083.rs",
+"ui/imports/issue-19498.rs",
+"ui/imports/issue-24081.rs",
+"ui/imports/issue-24883.rs",
+"ui/imports/issue-25396.rs",
+"ui/imports/issue-26873-multifile/issue-26873-multifile.rs",
+"ui/imports/issue-26873-multifile/issue-26873-onefile.rs",
+"ui/imports/issue-26886.rs",
+"ui/imports/issue-26930.rs",
+"ui/imports/issue-28134.rs",
+"ui/imports/issue-28388-1.rs",
+"ui/imports/issue-28388-2.rs",
+"ui/imports/issue-2937.rs",
+"ui/imports/issue-30560.rs",
+"ui/imports/issue-31212.rs",
+"ui/imports/issue-32119.rs",
+"ui/imports/issue-32222.rs",
+"ui/imports/issue-32354-suggest-import-rename.rs",
+"ui/imports/issue-32833.rs",
+"ui/imports/issue-33464.rs",
+"ui/imports/issue-36881.rs",
+"ui/imports/issue-37887.rs",
+"ui/imports/issue-38293.rs",
+"ui/imports/issue-4366-2.rs",
+"ui/imports/issue-4366.rs",
+"ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs",
+"ui/imports/issue-45829/auxiliary/issue-45829-a.rs",
+"ui/imports/issue-45829/auxiliary/issue-45829-b.rs",
+"ui/imports/issue-45829/issue-45829.rs",
+"ui/imports/issue-47623.rs",
+"ui/imports/issue-4865-1.rs",
+"ui/imports/issue-4865-2.rs",
+"ui/imports/issue-4865-3.rs",
+"ui/imports/issue-52891.rs",
+"ui/imports/issue-53140.rs",
+"ui/imports/issue-53269.rs",
+"ui/imports/issue-53512.rs",
+"ui/imports/issue-53565.rs",
+"ui/imports/issue-55457.rs",
+"ui/imports/issue-55811.rs",
+"ui/imports/issue-55884-1.rs",
+"ui/imports/issue-55884-2.rs",
+"ui/imports/issue-56125.rs",
+"ui/imports/issue-56263.rs",
+"ui/imports/issue-57015.rs",
+"ui/imports/issue-57539.rs",
+"ui/imports/issue-59764.rs",
+"ui/imports/issue-62767.rs",
+"ui/imports/issue-68103.rs",
+"ui/imports/issue-81413.rs",
+"ui/imports/issue-8208.rs",
+"ui/imports/issue-85992.rs",
+"ui/imports/issue-8640.rs",
+"ui/imports/issue-99695-b.rs",
+"ui/imports/issue-99695.rs",
+"ui/inference/issue-103587.rs",
+"ui/inference/issue-104649.rs",
+"ui/inference/issue-107090.rs",
+"ui/inference/issue-113354.rs",
+"ui/inference/issue-12028.rs",
+"ui/inference/issue-28935.rs",
+"ui/inference/issue-36053.rs",
+"ui/inference/issue-70082.rs",
+"ui/inference/issue-70703.rs",
+"ui/inference/issue-71309.rs",
+"ui/inference/issue-71584.rs",
+"ui/inference/issue-71732.rs",
+"ui/inference/issue-72616.rs",
+"ui/inference/issue-72690.rs",
+"ui/inference/issue-80409.rs",
+"ui/inference/issue-80816.rs",
+"ui/inference/issue-81522.rs",
+"ui/inference/issue-83606.rs",
+"ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs",
+"ui/inference/issue-86162-1.rs",
+"ui/inference/issue-86162-2.rs",
+"ui/inference/need_type_info/issue-103053.rs",
+"ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.rs",
+"ui/inference/need_type_info/issue-109905.rs",
+"ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.rs",
+"ui/infinite/issue-41731-infinite-macro-print.rs",
+"ui/infinite/issue-41731-infinite-macro-println.rs",
+"ui/intrinsics/issue-28575.rs",
+"ui/intrinsics/issue-84297-reifying-copy.rs",
+"ui/invalid/issue-114435-layout-type-err.rs",
+"ui/issue-11881.rs",
+"ui/issue-13560.rs",
+"ui/issue-15924.rs",
+"ui/issue-16822.rs",
+"ui/issue-18502.rs",
+"ui/issue-24106.rs",
+"ui/issue-76387-llvm-miscompile.rs",
+"ui/issues-71798.rs",
+"ui/issues/auxiliary/issue-111011.rs",
+"ui/issues/auxiliary/issue-11224.rs",
+"ui/issues/auxiliary/issue-11508.rs",
+"ui/issues/auxiliary/issue-11529.rs",
+"ui/issues/auxiliary/issue-11680.rs",
+"ui/issues/auxiliary/issue-12133-dylib.rs",
+"ui/issues/auxiliary/issue-12133-dylib2.rs",
+"ui/issues/auxiliary/issue-12133-rlib.rs",
+"ui/issues/auxiliary/issue-12612-1.rs",
+"ui/issues/auxiliary/issue-12612-2.rs",
+"ui/issues/auxiliary/issue-12660-aux.rs",
+"ui/issues/auxiliary/issue-13507.rs",
+"ui/issues/auxiliary/issue-13620-1.rs",
+"ui/issues/auxiliary/issue-13620-2.rs",
+"ui/issues/auxiliary/issue-13872-1.rs",
+"ui/issues/auxiliary/issue-13872-2.rs",
+"ui/issues/auxiliary/issue-13872-3.rs",
+"ui/issues/auxiliary/issue-14344-1.rs",
+"ui/issues/auxiliary/issue-14344-2.rs",
+"ui/issues/auxiliary/issue-14421.rs",
+"ui/issues/auxiliary/issue-14422.rs",
+"ui/issues/auxiliary/issue-15562.rs",
+"ui/issues/auxiliary/issue-16643.rs",
+"ui/issues/auxiliary/issue-16725.rs",
+"ui/issues/auxiliary/issue-17662.rs",
+"ui/issues/auxiliary/issue-18501.rs",
+"ui/issues/auxiliary/issue-18514.rs",
+"ui/issues/auxiliary/issue-18711.rs",
+"ui/issues/auxiliary/issue-18913-1.rs",
+"ui/issues/auxiliary/issue-18913-2.rs",
+"ui/issues/auxiliary/issue-19293.rs",
+"ui/issues/auxiliary/issue-19340-1.rs",
+"ui/issues/auxiliary/issue-20389.rs",
+"ui/issues/auxiliary/issue-21202.rs",
+"ui/issues/auxiliary/issue-2170-lib.rs",
+"ui/issues/auxiliary/issue-2316-a.rs",
+"ui/issues/auxiliary/issue-2316-b.rs",
+"ui/issues/auxiliary/issue-2380.rs",
+"ui/issues/auxiliary/issue-2414-a.rs",
+"ui/issues/auxiliary/issue-2414-b.rs",
+"ui/issues/auxiliary/issue-2472-b.rs",
+"ui/issues/auxiliary/issue-25185-1.rs",
+"ui/issues/auxiliary/issue-25185-2.rs",
+"ui/issues/auxiliary/issue-2526.rs",
+"ui/issues/auxiliary/issue-25467.rs",
+"ui/issues/auxiliary/issue-2631-a.rs",
+"ui/issues/auxiliary/issue-2723-a.rs",
+"ui/issues/auxiliary/issue-29265.rs",
+"ui/issues/auxiliary/issue-29485.rs",
+"ui/issues/auxiliary/issue-3012-1.rs",
+"ui/issues/auxiliary/issue-30123-aux.rs",
+"ui/issues/auxiliary/issue-3136-a.rs",
+"ui/issues/auxiliary/issue-31702-1.rs",
+"ui/issues/auxiliary/issue-31702-2.rs",
+"ui/issues/auxiliary/issue-34796-aux.rs",
+"ui/issues/auxiliary/issue-36954.rs",
+"ui/issues/auxiliary/issue-38190.rs",
+"ui/issues/auxiliary/issue-38226-aux.rs",
+"ui/issues/auxiliary/issue-3979-traits.rs",
+"ui/issues/auxiliary/issue-41053.rs",
+"ui/issues/auxiliary/issue-41549.rs",
+"ui/issues/auxiliary/issue-42007-s.rs",
+"ui/issues/auxiliary/issue-4208-cc.rs",
+"ui/issues/auxiliary/issue-4545.rs",
+"ui/issues/auxiliary/issue-48984-aux.rs",
+"ui/issues/auxiliary/issue-49544.rs",
+"ui/issues/auxiliary/issue-51798.rs",
+"ui/issues/auxiliary/issue-52489.rs",
+"ui/issues/auxiliary/issue-5518.rs",
+"ui/issues/auxiliary/issue-5521.rs",
+"ui/issues/auxiliary/issue-56943.rs",
+"ui/issues/auxiliary/issue-57271-lib.rs",
+"ui/issues/auxiliary/issue-5844-aux.rs",
+"ui/issues/auxiliary/issue-7178.rs",
+"ui/issues/auxiliary/issue-73112.rs",
+"ui/issues/auxiliary/issue-7899.rs",
+"ui/issues/auxiliary/issue-8044.rs",
+"ui/issues/auxiliary/issue-8259.rs",
+"ui/issues/auxiliary/issue-8401.rs",
+"ui/issues/auxiliary/issue-9123.rs",
+"ui/issues/auxiliary/issue-9155.rs",
+"ui/issues/auxiliary/issue-9188.rs",
+"ui/issues/auxiliary/issue-9906.rs",
+"ui/issues/auxiliary/issue-9968.rs",
+"ui/issues/issue-10228.rs",
+"ui/issues/issue-10291.rs",
+"ui/issues/issue-102964.rs",
+"ui/issues/issue-10396.rs",
+"ui/issues/issue-10412.rs",
+"ui/issues/issue-10436.rs",
+"ui/issues/issue-10456.rs",
+"ui/issues/issue-10465.rs",
+"ui/issues/issue-10545.rs",
+"ui/issues/issue-10638.rs",
+"ui/issues/issue-10656.rs",
+"ui/issues/issue-106755.rs",
+"ui/issues/issue-10683.rs",
+"ui/issues/issue-10718.rs",
+"ui/issues/issue-10734.rs",
+"ui/issues/issue-10764.rs",
+"ui/issues/issue-10767.rs",
+"ui/issues/issue-10802.rs",
+"ui/issues/issue-10806.rs",
+"ui/issues/issue-10853.rs",
+"ui/issues/issue-10877.rs",
+"ui/issues/issue-10902.rs",
+"ui/issues/issue-11004.rs",
+"ui/issues/issue-11047.rs",
+"ui/issues/issue-11085.rs",
+"ui/issues/issue-11192.rs",
+"ui/issues/issue-11205.rs",
+"ui/issues/issue-11224.rs",
+"ui/issues/issue-11267.rs",
+"ui/issues/issue-11374.rs",
+"ui/issues/issue-11382.rs",
+"ui/issues/issue-11384.rs",
+"ui/issues/issue-11508.rs",
+"ui/issues/issue-11529.rs",
+"ui/issues/issue-11552.rs",
+"ui/issues/issue-11592.rs",
+"ui/issues/issue-11677.rs",
+"ui/issues/issue-11680.rs",
+"ui/issues/issue-11681.rs",
+"ui/issues/issue-11692-1.rs",
+"ui/issues/issue-11692-2.rs",
+"ui/issues/issue-11709.rs",
+"ui/issues/issue-11740.rs",
+"ui/issues/issue-11771.rs",
+"ui/issues/issue-11820.rs",
+"ui/issues/issue-11844.rs",
+"ui/issues/issue-11869.rs",
+"ui/issues/issue-11958.rs",
+"ui/issues/issue-12033.rs",
+"ui/issues/issue-12041.rs",
+"ui/issues/issue-12127.rs",
+"ui/issues/issue-12133-1.rs",
+"ui/issues/issue-12133-2.rs",
+"ui/issues/issue-12133-3.rs",
+"ui/issues/issue-12187-1.rs",
+"ui/issues/issue-12187-2.rs",
+"ui/issues/issue-12285.rs",
+"ui/issues/issue-12567.rs",
+"ui/issues/issue-12612.rs",
+"ui/issues/issue-12660.rs",
+"ui/issues/issue-12677.rs",
+"ui/issues/issue-12699.rs",
+"ui/issues/issue-12729.rs",
+"ui/issues/issue-12744.rs",
+"ui/issues/issue-12860.rs",
+"ui/issues/issue-12863.rs",
+"ui/issues/issue-12909.rs",
+"ui/issues/issue-12920.rs",
+"ui/issues/issue-13027.rs",
+"ui/issues/issue-13058.rs",
+"ui/issues/issue-13105.rs",
+"ui/issues/issue-13167.rs",
+"ui/issues/issue-13202.rs",
+"ui/issues/issue-13204.rs",
+"ui/issues/issue-13214.rs",
+"ui/issues/issue-13259-windows-tcb-trash.rs",
+"ui/issues/issue-13264.rs",
+"ui/issues/issue-13323.rs",
+"ui/issues/issue-13359.rs",
+"ui/issues/issue-13405.rs",
+"ui/issues/issue-13407.rs",
+"ui/issues/issue-13434.rs",
+"ui/issues/issue-13446.rs",
+"ui/issues/issue-13466.rs",
+"ui/issues/issue-13482-2.rs",
+"ui/issues/issue-13482.rs",
+"ui/issues/issue-13497-2.rs",
+"ui/issues/issue-13497.rs",
+"ui/issues/issue-13507-2.rs",
+"ui/issues/issue-1362.rs",
+"ui/issues/issue-13620.rs",
+"ui/issues/issue-13665.rs",
+"ui/issues/issue-13703.rs",
+"ui/issues/issue-13763.rs",
+"ui/issues/issue-13775.rs",
+"ui/issues/issue-13808.rs",
+"ui/issues/issue-13847.rs",
+"ui/issues/issue-13867.rs",
+"ui/issues/issue-13872.rs",
+"ui/issues/issue-14082.rs",
+"ui/issues/issue-14091-2.rs",
+"ui/issues/issue-14091.rs",
+"ui/issues/issue-14092.rs",
+"ui/issues/issue-14229.rs",
+"ui/issues/issue-14254.rs",
+"ui/issues/issue-14285.rs",
+"ui/issues/issue-14308.rs",
+"ui/issues/issue-14330.rs",
+"ui/issues/issue-14344.rs",
+"ui/issues/issue-14366.rs",
+"ui/issues/issue-14382.rs",
+"ui/issues/issue-14393.rs",
+"ui/issues/issue-14399.rs",
+"ui/issues/issue-14421.rs",
+"ui/issues/issue-14422.rs",
+"ui/issues/issue-1448-2.rs",
+"ui/issues/issue-1451.rs",
+"ui/issues/issue-14541.rs",
+"ui/issues/issue-1460.rs",
+"ui/issues/issue-14721.rs",
+"ui/issues/issue-1476.rs",
+"ui/issues/issue-14821.rs",
+"ui/issues/issue-14845.rs",
+"ui/issues/issue-14853.rs",
+"ui/issues/issue-14865.rs",
+"ui/issues/issue-14875.rs",
+"ui/issues/issue-14901.rs",
+"ui/issues/issue-14915.rs",
+"ui/issues/issue-14919.rs",
+"ui/issues/issue-14959.rs",
+"ui/issues/issue-15034.rs",
+"ui/issues/issue-15043.rs",
+"ui/issues/issue-15063.rs",
+"ui/issues/issue-15094.rs",
+"ui/issues/issue-15104.rs",
+"ui/issues/issue-15129-rpass.rs",
+"ui/issues/issue-15155.rs",
+"ui/issues/issue-15167.rs",
+"ui/issues/issue-15189.rs",
+"ui/issues/issue-15207.rs",
+"ui/issues/issue-15260.rs",
+"ui/issues/issue-15381.rs",
+"ui/issues/issue-15444.rs",
+"ui/issues/issue-15523-big.rs",
+"ui/issues/issue-15523.rs",
+"ui/issues/issue-15562.rs",
+"ui/issues/issue-15571.rs",
+"ui/issues/issue-15673.rs",
+"ui/issues/issue-15734.rs",
+"ui/issues/issue-15735.rs",
+"ui/issues/issue-15756.rs",
+"ui/issues/issue-15763.rs",
+"ui/issues/issue-15774.rs",
+"ui/issues/issue-15783.rs",
+"ui/issues/issue-15793.rs",
+"ui/issues/issue-15858.rs",
+"ui/issues/issue-15896.rs",
+"ui/issues/issue-15965.rs",
+"ui/issues/issue-16048.rs",
+"ui/issues/issue-16149.rs",
+"ui/issues/issue-16151.rs",
+"ui/issues/issue-16256.rs",
+"ui/issues/issue-16278.rs",
+"ui/issues/issue-16401.rs",
+"ui/issues/issue-16441.rs",
+"ui/issues/issue-16452.rs",
+"ui/issues/issue-16492.rs",
+"ui/issues/issue-16530.rs",
+"ui/issues/issue-16560.rs",
+"ui/issues/issue-16562.rs",
+"ui/issues/issue-16596.rs",
+"ui/issues/issue-1660.rs",
+"ui/issues/issue-16643.rs",
+"ui/issues/issue-16648.rs",
+"ui/issues/issue-16668.rs",
+"ui/issues/issue-16671.rs",
+"ui/issues/issue-16683.rs",
+"ui/issues/issue-16725.rs",
+"ui/issues/issue-16739.rs",
+"ui/issues/issue-16745.rs",
+"ui/issues/issue-16774.rs",
+"ui/issues/issue-16783.rs",
+"ui/issues/issue-16819.rs",
+"ui/issues/issue-16922-rpass.rs",
+"ui/issues/issue-16939.rs",
+"ui/issues/issue-1696.rs",
+"ui/issues/issue-16966.rs",
+"ui/issues/issue-16994.rs",
+"ui/issues/issue-17001.rs",
+"ui/issues/issue-17033.rs",
+"ui/issues/issue-17068.rs",
+"ui/issues/issue-17121.rs",
+"ui/issues/issue-17216.rs",
+"ui/issues/issue-17252.rs",
+"ui/issues/issue-17302.rs",
+"ui/issues/issue-17322.rs",
+"ui/issues/issue-17336.rs",
+"ui/issues/issue-17337.rs",
+"ui/issues/issue-17351.rs",
+"ui/issues/issue-17361.rs",
+"ui/issues/issue-17373.rs",
+"ui/issues/issue-17385.rs",
+"ui/issues/issue-17405.rs",
+"ui/issues/issue-17441.rs",
+"ui/issues/issue-17450.rs",
+"ui/issues/issue-17503.rs",
+"ui/issues/issue-17546.rs",
+"ui/issues/issue-17551.rs",
+"ui/issues/issue-17651.rs",
+"ui/issues/issue-17662.rs",
+"ui/issues/issue-17732.rs",
+"ui/issues/issue-17734.rs",
+"ui/issues/issue-17740.rs",
+"ui/issues/issue-17746.rs",
+"ui/issues/issue-17758.rs",
+"ui/issues/issue-17771.rs",
+"ui/issues/issue-17800.rs",
+"ui/issues/issue-17816.rs",
+"ui/issues/issue-17877.rs",
+"ui/issues/issue-17897.rs",
+"ui/issues/issue-17904-2.rs",
+"ui/issues/issue-17904.rs",
+"ui/issues/issue-17905-2.rs",
+"ui/issues/issue-17905.rs",
+"ui/issues/issue-17933.rs",
+"ui/issues/issue-17954.rs",
+"ui/issues/issue-17959.rs",
+"ui/issues/issue-17994.rs",
+"ui/issues/issue-17999.rs",
+"ui/issues/issue-18058.rs",
+"ui/issues/issue-18088.rs",
+"ui/issues/issue-18107.rs",
+"ui/issues/issue-18110.rs",
+"ui/issues/issue-18119.rs",
+"ui/issues/issue-18159.rs",
+"ui/issues/issue-18173.rs",
+"ui/issues/issue-18183.rs",
+"ui/issues/issue-18188.rs",
+"ui/issues/issue-18232.rs",
+"ui/issues/issue-18352.rs",
+"ui/issues/issue-18353.rs",
+"ui/issues/issue-18389.rs",
+"ui/issues/issue-18423.rs",
+"ui/issues/issue-18446-2.rs",
+"ui/issues/issue-18446.rs",
+"ui/issues/issue-18464.rs",
+"ui/issues/issue-18501.rs",
+"ui/issues/issue-18514.rs",
+"ui/issues/issue-18532.rs",
+"ui/issues/issue-18539.rs",
+"ui/issues/issue-18566.rs",
+"ui/issues/issue-18611.rs",
+"ui/issues/issue-18685.rs",
+"ui/issues/issue-18711.rs",
+"ui/issues/issue-18738.rs",
+"ui/issues/issue-18767.rs",
+"ui/issues/issue-18783.rs",
+"ui/issues/issue-18809.rs",
+"ui/issues/issue-18845.rs",
+"ui/issues/issue-18859.rs",
+"ui/issues/issue-18906.rs",
+"ui/issues/issue-18913.rs",
+"ui/issues/issue-18919.rs",
+"ui/issues/issue-18952.rs",
+"ui/issues/issue-18959.rs",
+"ui/issues/issue-18988.rs",
+"ui/issues/issue-1900.rs",
+"ui/issues/issue-19001.rs",
+"ui/issues/issue-19037.rs",
+"ui/issues/issue-19086.rs",
+"ui/issues/issue-19097.rs",
+"ui/issues/issue-19098.rs",
+"ui/issues/issue-19100.rs",
+"ui/issues/issue-19127.rs",
+"ui/issues/issue-19129-1.rs",
+"ui/issues/issue-19129-2.rs",
+"ui/issues/issue-19135.rs",
+"ui/issues/issue-1920-absolute-paths/auxiliary/issue-1920.rs",
+"ui/issues/issue-1920-absolute-paths/issue-1920-1.rs",
+"ui/issues/issue-1920-absolute-paths/issue-1920-2.rs",
+"ui/issues/issue-1920-absolute-paths/issue-1920-3.rs",
+"ui/issues/issue-19244-1.rs",
+"ui/issues/issue-19244-2.rs",
+"ui/issues/issue-19293.rs",
+"ui/issues/issue-19340-1.rs",
+"ui/issues/issue-19340-2.rs",
+"ui/issues/issue-19367.rs",
+"ui/issues/issue-19380.rs",
+"ui/issues/issue-19398.rs",
+"ui/issues/issue-19404.rs",
+"ui/issues/issue-19479.rs",
+"ui/issues/issue-19482.rs",
+"ui/issues/issue-19499.rs",
+"ui/issues/issue-19521.rs",
+"ui/issues/issue-19601.rs",
+"ui/issues/issue-1962.rs",
+"ui/issues/issue-19631.rs",
+"ui/issues/issue-19632.rs",
+"ui/issues/issue-19692.rs",
+"ui/issues/issue-19734.rs",
+"ui/issues/issue-1974.rs",
+"ui/issues/issue-19811-escape-unicode.rs",
+"ui/issues/issue-19850.rs",
+"ui/issues/issue-19922.rs",
+"ui/issues/issue-19982.rs",
+"ui/issues/issue-19991.rs",
+"ui/issues/issue-20009.rs",
+"ui/issues/issue-20055-box-trait.rs",
+"ui/issues/issue-20055-box-unsized-array.rs",
+"ui/issues/issue-20162.rs",
+"ui/issues/issue-20174.rs",
+"ui/issues/issue-20186.rs",
+"ui/issues/issue-20225.rs",
+"ui/issues/issue-20261.rs",
+"ui/issues/issue-20313-rpass.rs",
+"ui/issues/issue-20313.rs",
+"ui/issues/issue-20389.rs",
+"ui/issues/issue-20396.rs",
+"ui/issues/issue-20413.rs",
+"ui/issues/issue-20414.rs",
+"ui/issues/issue-20427.rs",
+"ui/issues/issue-20433.rs",
+"ui/issues/issue-20454.rs",
+"ui/issues/issue-20544.rs",
+"ui/issues/issue-20575.rs",
+"ui/issues/issue-20644.rs",
+"ui/issues/issue-20676.rs",
+"ui/issues/issue-20714.rs",
+"ui/issues/issue-2074.rs",
+"ui/issues/issue-20763-1.rs",
+"ui/issues/issue-20763-2.rs",
+"ui/issues/issue-20772.rs",
+"ui/issues/issue-20797.rs",
+"ui/issues/issue-20803.rs",
+"ui/issues/issue-20831-debruijn.rs",
+"ui/issues/issue-20847.rs",
+"ui/issues/issue-20939.rs",
+"ui/issues/issue-20953.rs",
+"ui/issues/issue-20971.rs",
+"ui/issues/issue-21033.rs",
+"ui/issues/issue-21140.rs",
+"ui/issues/issue-21160.rs",
+"ui/issues/issue-21174-2.rs",
+"ui/issues/issue-21174.rs",
+"ui/issues/issue-21177.rs",
+"ui/issues/issue-21202.rs",
+"ui/issues/issue-21245.rs",
+"ui/issues/issue-21291.rs",
+"ui/issues/issue-21306.rs",
+"ui/issues/issue-21332.rs",
+"ui/issues/issue-21361.rs",
+"ui/issues/issue-21384.rs",
+"ui/issues/issue-21400.rs",
+"ui/issues/issue-21402.rs",
+"ui/issues/issue-21449.rs",
+"ui/issues/issue-2150.rs",
+"ui/issues/issue-2151.rs",
+"ui/issues/issue-21546.rs",
+"ui/issues/issue-21554.rs",
+"ui/issues/issue-21596.rs",
+"ui/issues/issue-21600.rs",
+"ui/issues/issue-21622.rs",
+"ui/issues/issue-21634.rs",
+"ui/issues/issue-21655.rs",
+"ui/issues/issue-2170-exe.rs",
+"ui/issues/issue-21701.rs",
+"ui/issues/issue-21763.rs",
+"ui/issues/issue-21837.rs",
+"ui/issues/issue-21891.rs",
+"ui/issues/issue-2190-1.rs",
+"ui/issues/issue-21909.rs",
+"ui/issues/issue-21922.rs",
+"ui/issues/issue-21946.rs",
+"ui/issues/issue-21950.rs",
+"ui/issues/issue-21974.rs",
+"ui/issues/issue-22008.rs",
+"ui/issues/issue-22034.rs",
+"ui/issues/issue-22036.rs",
+"ui/issues/issue-2214.rs",
+"ui/issues/issue-22258.rs",
+"ui/issues/issue-22289.rs",
+"ui/issues/issue-22312.rs",
+"ui/issues/issue-22346.rs",
+"ui/issues/issue-22356.rs",
+"ui/issues/issue-22370.rs",
+"ui/issues/issue-22403.rs",
+"ui/issues/issue-22426.rs",
+"ui/issues/issue-22434.rs",
+"ui/issues/issue-22468.rs",
+"ui/issues/issue-22471.rs",
+"ui/issues/issue-22577.rs",
+"ui/issues/issue-22599.rs",
+"ui/issues/issue-22603.rs",
+"ui/issues/issue-22629.rs",
+"ui/issues/issue-22638.rs",
+"ui/issues/issue-22644.rs",
+"ui/issues/issue-22673.rs",
+"ui/issues/issue-22684.rs",
+"ui/issues/issue-22706.rs",
+"ui/issues/issue-22777.rs",
+"ui/issues/issue-22781.rs",
+"ui/issues/issue-22789.rs",
+"ui/issues/issue-2281-part1.rs",
+"ui/issues/issue-22814.rs",
+"ui/issues/issue-2284.rs",
+"ui/issues/issue-22864-1.rs",
+"ui/issues/issue-22864-2.rs",
+"ui/issues/issue-22872.rs",
+"ui/issues/issue-22874.rs",
+"ui/issues/issue-2288.rs",
+"ui/issues/issue-22886.rs",
+"ui/issues/issue-22894.rs",
+"ui/issues/issue-22933-1.rs",
+"ui/issues/issue-22933-2.rs",
+"ui/issues/issue-22992-2.rs",
+"ui/issues/issue-22992.rs",
+"ui/issues/issue-23024.rs",
+"ui/issues/issue-23036.rs",
+"ui/issues/issue-23041.rs",
+"ui/issues/issue-23046.rs",
+"ui/issues/issue-23073.rs",
+"ui/issues/issue-2311-2.rs",
+"ui/issues/issue-2311.rs",
+"ui/issues/issue-2312.rs",
+"ui/issues/issue-23122-1.rs",
+"ui/issues/issue-23122-2.rs",
+"ui/issues/issue-2316-c.rs",
+"ui/issues/issue-23173.rs",
+"ui/issues/issue-23189.rs",
+"ui/issues/issue-23217.rs",
+"ui/issues/issue-23253.rs",
+"ui/issues/issue-23261.rs",
+"ui/issues/issue-23281.rs",
+"ui/issues/issue-23302-enum-infinite-recursion/issue-23302-1.rs",
+"ui/issues/issue-23302-enum-infinite-recursion/issue-23302-2.rs",
+"ui/issues/issue-23302-enum-infinite-recursion/issue-23302-3.rs",
+"ui/issues/issue-23304-1.rs",
+"ui/issues/issue-23304-2.rs",
+"ui/issues/issue-23311.rs",
+"ui/issues/issue-23336.rs",
+"ui/issues/issue-23354-2.rs",
+"ui/issues/issue-23354.rs",
+"ui/issues/issue-23406.rs",
+"ui/issues/issue-23433.rs",
+"ui/issues/issue-23442.rs",
+"ui/issues/issue-23477.rs",
+"ui/issues/issue-23485.rs",
+"ui/issues/issue-23491.rs",
+"ui/issues/issue-23543.rs",
+"ui/issues/issue-23544.rs",
+"ui/issues/issue-23550.rs",
+"ui/issues/issue-23589.rs",
+"ui/issues/issue-23611-enum-swap-in-drop.rs",
+"ui/issues/issue-23649-1.rs",
+"ui/issues/issue-23649-2.rs",
+"ui/issues/issue-23649-3.rs",
+"ui/issues/issue-23699.rs",
+"ui/issues/issue-2380-b.rs",
+"ui/issues/issue-23808.rs",
+"ui/issues/issue-2383.rs",
+"ui/issues/issue-23891.rs",
+"ui/issues/issue-23898.rs",
+"ui/issues/issue-23958.rs",
+"ui/issues/issue-23966.rs",
+"ui/issues/issue-23992.rs",
+"ui/issues/issue-24013.rs",
+"ui/issues/issue-24036.rs",
+"ui/issues/issue-24086.rs",
+"ui/issues/issue-2414-c.rs",
+"ui/issues/issue-24161.rs",
+"ui/issues/issue-24227.rs",
+"ui/issues/issue-2428.rs",
+"ui/issues/issue-24308.rs",
+"ui/issues/issue-24322.rs",
+"ui/issues/issue-24352.rs",
+"ui/issues/issue-24353.rs",
+"ui/issues/issue-24357.rs",
+"ui/issues/issue-24363.rs",
+"ui/issues/issue-24365.rs",
+"ui/issues/issue-24389.rs",
+"ui/issues/issue-24424.rs",
+"ui/issues/issue-24434.rs",
+"ui/issues/issue-24446.rs",
+"ui/issues/issue-2445-b.rs",
+"ui/issues/issue-2445.rs",
+"ui/issues/issue-24533.rs",
+"ui/issues/issue-24589.rs",
+"ui/issues/issue-2463.rs",
+"ui/issues/issue-24682.rs",
+"ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs",
+"ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs",
+"ui/issues/issue-2470-bounds-check-overflow.rs",
+"ui/issues/issue-2472.rs",
+"ui/issues/issue-24779.rs",
+"ui/issues/issue-24819.rs",
+"ui/issues/issue-2487-a.rs",
+"ui/issues/issue-24945-repeat-dash-opts.rs",
+"ui/issues/issue-24947.rs",
+"ui/issues/issue-24954.rs",
+"ui/issues/issue-2502.rs",
+"ui/issues/issue-25076.rs",
+"ui/issues/issue-25089.rs",
+"ui/issues/issue-25145.rs",
+"ui/issues/issue-25180.rs",
+"ui/issues/issue-25185.rs",
+"ui/issues/issue-2526-a.rs",
+"ui/issues/issue-25279.rs",
+"ui/issues/issue-25343.rs",
+"ui/issues/issue-25368.rs",
+"ui/issues/issue-25386.rs",
+"ui/issues/issue-25394.rs",
+"ui/issues/issue-25467.rs",
+"ui/issues/issue-25497.rs",
+"ui/issues/issue-2550.rs",
+"ui/issues/issue-25515.rs",
+"ui/issues/issue-25549-multiple-drop.rs",
+"ui/issues/issue-25579.rs",
+"ui/issues/issue-25679.rs",
+"ui/issues/issue-25693.rs",
+"ui/issues/issue-25746-bool-transmute.rs",
+"ui/issues/issue-25757.rs",
+"ui/issues/issue-25810.rs",
+"ui/issues/issue-2590.rs",
+"ui/issues/issue-25901.rs",
+"ui/issues/issue-26056.rs",
+"ui/issues/issue-26093.rs",
+"ui/issues/issue-26095.rs",
+"ui/issues/issue-2611-3.rs",
+"ui/issues/issue-26127.rs",
+"ui/issues/issue-26186.rs",
+"ui/issues/issue-26205.rs",
+"ui/issues/issue-26217.rs",
+"ui/issues/issue-26237.rs",
+"ui/issues/issue-26262.rs",
+"ui/issues/issue-2631-b.rs",
+"ui/issues/issue-2642.rs",
+"ui/issues/issue-26468.rs",
+"ui/issues/issue-26472.rs",
+"ui/issues/issue-26484.rs",
+"ui/issues/issue-26614.rs",
+"ui/issues/issue-26619.rs",
+"ui/issues/issue-26641.rs",
+"ui/issues/issue-26646.rs",
+"ui/issues/issue-26655.rs",
+"ui/issues/issue-26709.rs",
+"ui/issues/issue-26802.rs",
+"ui/issues/issue-26805.rs",
+"ui/issues/issue-26812.rs",
+"ui/issues/issue-26948.rs",
+"ui/issues/issue-26997.rs",
+"ui/issues/issue-27008.rs",
+"ui/issues/issue-27033.rs",
+"ui/issues/issue-27042.rs",
+"ui/issues/issue-27054-primitive-binary-ops.rs",
+"ui/issues/issue-27078.rs",
+"ui/issues/issue-2708.rs",
+"ui/issues/issue-27105.rs",
+"ui/issues/issue-2723-b.rs",
+"ui/issues/issue-27240.rs",
+"ui/issues/issue-27268.rs",
+"ui/issues/issue-27281.rs",
+"ui/issues/issue-27340.rs",
+"ui/issues/issue-27401-dropflag-reinit.rs",
+"ui/issues/issue-27433.rs",
+"ui/issues/issue-27592.rs",
+"ui/issues/issue-2761.rs",
+"ui/issues/issue-27639.rs",
+"ui/issues/issue-27697.rs",
+"ui/issues/issue-27815.rs",
+"ui/issues/issue-27842.rs",
+"ui/issues/issue-27859.rs",
+"ui/issues/issue-27889.rs",
+"ui/issues/issue-27942.rs",
+"ui/issues/issue-27949.rs",
+"ui/issues/issue-27997.rs",
+"ui/issues/issue-28105.rs",
+"ui/issues/issue-28109.rs",
+"ui/issues/issue-28181.rs",
+"ui/issues/issue-2823.rs",
+"ui/issues/issue-28279.rs",
+"ui/issues/issue-28344.rs",
+"ui/issues/issue-28433.rs",
+"ui/issues/issue-28472.rs",
+"ui/issues/issue-2848.rs",
+"ui/issues/issue-2849.rs",
+"ui/issues/issue-28498-must-work-ex1.rs",
+"ui/issues/issue-28498-must-work-ex2.rs",
+"ui/issues/issue-28498-ugeh-ex1.rs",
+"ui/issues/issue-28550.rs",
+"ui/issues/issue-28561.rs",
+"ui/issues/issue-28568.rs",
+"ui/issues/issue-28586.rs",
+"ui/issues/issue-28600.rs",
+"ui/issues/issue-28625.rs",
+"ui/issues/issue-28776.rs",
+"ui/issues/issue-28777.rs",
+"ui/issues/issue-28828.rs",
+"ui/issues/issue-28839.rs",
+"ui/issues/issue-28936.rs",
+"ui/issues/issue-2895.rs",
+"ui/issues/issue-28971.rs",
+"ui/issues/issue-28983.rs",
+"ui/issues/issue-28999.rs",
+"ui/issues/issue-29030.rs",
+"ui/issues/issue-29037.rs",
+"ui/issues/issue-2904.rs",
+"ui/issues/issue-29048.rs",
+"ui/issues/issue-29053.rs",
+"ui/issues/issue-29071-2.rs",
+"ui/issues/issue-29071.rs",
+"ui/issues/issue-29092.rs",
+"ui/issues/issue-29147-rpass.rs",
+"ui/issues/issue-29147.rs",
+"ui/issues/issue-29265.rs",
+"ui/issues/issue-29276.rs",
+"ui/issues/issue-2935.rs",
+"ui/issues/issue-29466.rs",
+"ui/issues/issue-29485.rs",
+"ui/issues/issue-2951.rs",
+"ui/issues/issue-29516.rs",
+"ui/issues/issue-29522.rs",
+"ui/issues/issue-29540.rs",
+"ui/issues/issue-29663.rs",
+"ui/issues/issue-29668.rs",
+"ui/issues/issue-29710.rs",
+"ui/issues/issue-29723.rs",
+"ui/issues/issue-29740.rs",
+"ui/issues/issue-29743.rs",
+"ui/issues/issue-29821.rs",
+"ui/issues/issue-29857.rs",
+"ui/issues/issue-29861.rs",
+"ui/issues/issue-2989.rs",
+"ui/issues/issue-29948.rs",
+"ui/issues/issue-2995.rs",
+"ui/issues/issue-30007.rs",
+"ui/issues/issue-30018-panic.rs",
+"ui/issues/issue-30081.rs",
+"ui/issues/issue-3012-2.rs",
+"ui/issues/issue-30123.rs",
+"ui/issues/issue-3021-b.rs",
+"ui/issues/issue-3021-d.rs",
+"ui/issues/issue-30236.rs",
+"ui/issues/issue-30255.rs",
+"ui/issues/issue-3026.rs",
+"ui/issues/issue-3029.rs",
+"ui/issues/issue-3037.rs",
+"ui/issues/issue-30371.rs",
+"ui/issues/issue-3038.rs",
+"ui/issues/issue-30380.rs",
+"ui/issues/issue-30490.rs",
+"ui/issues/issue-3052.rs",
+"ui/issues/issue-30530.rs",
+"ui/issues/issue-30589.rs",
+"ui/issues/issue-30615.rs",
+"ui/issues/issue-30756.rs",
+"ui/issues/issue-30891.rs",
+"ui/issues/issue-3091.rs",
+"ui/issues/issue-31011.rs",
+"ui/issues/issue-3109.rs",
+"ui/issues/issue-3121.rs",
+"ui/issues/issue-31260.rs",
+"ui/issues/issue-31267-additional.rs",
+"ui/issues/issue-31267.rs",
+"ui/issues/issue-31299.rs",
+"ui/issues/issue-3136-b.rs",
+"ui/issues/issue-3149.rs",
+"ui/issues/issue-31511.rs",
+"ui/issues/issue-3154.rs",
+"ui/issues/issue-31702.rs",
+"ui/issues/issue-31769.rs",
+"ui/issues/issue-31776.rs",
+"ui/issues/issue-31910.rs",
+"ui/issues/issue-32004.rs",
+"ui/issues/issue-32008.rs",
+"ui/issues/issue-32086.rs",
+"ui/issues/issue-32122-deref-coercions-composition/issue-32122-1.rs",
+"ui/issues/issue-32122-deref-coercions-composition/issue-32122-2.rs",
+"ui/issues/issue-3214.rs",
+"ui/issues/issue-3220.rs",
+"ui/issues/issue-32292.rs",
+"ui/issues/issue-32324.rs",
+"ui/issues/issue-32326.rs",
+"ui/issues/issue-32377.rs",
+"ui/issues/issue-32389.rs",
+"ui/issues/issue-32518.rs",
+"ui/issues/issue-32655.rs",
+"ui/issues/issue-32782.rs",
+"ui/issues/issue-32797.rs",
+"ui/issues/issue-32805.rs",
+"ui/issues/issue-3290.rs",
+"ui/issues/issue-32950.rs",
+"ui/issues/issue-32995-2.rs",
+"ui/issues/issue-32995.rs",
+"ui/issues/issue-33187.rs",
+"ui/issues/issue-33202.rs",
+"ui/issues/issue-33241.rs",
+"ui/issues/issue-33287.rs",
+"ui/issues/issue-33293.rs",
+"ui/issues/issue-33387.rs",
+"ui/issues/issue-3344.rs",
+"ui/issues/issue-33461.rs",
+"ui/issues/issue-33504.rs",
+"ui/issues/issue-33525.rs",
+"ui/issues/issue-33571.rs",
+"ui/issues/issue-33687.rs",
+"ui/issues/issue-33770.rs",
+"ui/issues/issue-3389.rs",
+"ui/issues/issue-33941.rs",
+"ui/issues/issue-33992.rs",
+"ui/issues/issue-34047.rs",
+"ui/issues/issue-34074.rs",
+"ui/issues/issue-34209.rs",
+"ui/issues/issue-34229.rs",
+"ui/issues/issue-3424.rs",
+"ui/issues/issue-3429.rs",
+"ui/issues/issue-34334.rs",
+"ui/issues/issue-34349.rs",
+"ui/issues/issue-34373.rs",
+"ui/issues/issue-34418.rs",
+"ui/issues/issue-34427.rs",
+"ui/issues/issue-3447.rs",
+"ui/issues/issue-34503.rs",
+"ui/issues/issue-34569.rs",
+"ui/issues/issue-34571.rs",
+"ui/issues/issue-34751.rs",
+"ui/issues/issue-3477.rs",
+"ui/issues/issue-34780.rs",
+"ui/issues/issue-34796.rs",
+"ui/issues/issue-34839.rs",
+"ui/issues/issue-3500.rs",
+"ui/issues/issue-35139.rs",
+"ui/issues/issue-3521-2.rs",
+"ui/issues/issue-35241.rs",
+"ui/issues/issue-35423.rs",
+"ui/issues/issue-3556.rs",
+"ui/issues/issue-35570.rs",
+"ui/issues/issue-3559.rs",
+"ui/issues/issue-35600.rs",
+"ui/issues/issue-3563-3.rs",
+"ui/issues/issue-3574.rs",
+"ui/issues/issue-35815.rs",
+"ui/issues/issue-35976.rs",
+"ui/issues/issue-35988.rs",
+"ui/issues/issue-36023.rs",
+"ui/issues/issue-36036-associated-type-layout.rs",
+"ui/issues/issue-36075.rs",
+"ui/issues/issue-3609.rs",
+"ui/issues/issue-36116.rs",
+"ui/issues/issue-36260.rs",
+"ui/issues/issue-36278-prefix-nesting.rs",
+"ui/issues/issue-36299.rs",
+"ui/issues/issue-36379.rs",
+"ui/issues/issue-36400.rs",
+"ui/issues/issue-36401.rs",
+"ui/issues/issue-36474.rs",
+"ui/issues/issue-3656.rs",
+"ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.rs",
+"ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.rs",
+"ui/issues/issue-36744-bitcast-args-if-needed.rs",
+"ui/issues/issue-36786-resolve-call.rs",
+"ui/issues/issue-3680.rs",
+"ui/issues/issue-36816.rs",
+"ui/issues/issue-36836.rs",
+"ui/issues/issue-36839.rs",
+"ui/issues/issue-36856.rs",
+"ui/issues/issue-36936.rs",
+"ui/issues/issue-36954.rs",
+"ui/issues/issue-3702-2.rs",
+"ui/issues/issue-3702.rs",
+"ui/issues/issue-37051.rs",
+"ui/issues/issue-37109.rs",
+"ui/issues/issue-37131.rs",
+"ui/issues/issue-37311-type-length-limit/issue-37311.rs",
+"ui/issues/issue-3743.rs",
+"ui/issues/issue-37510.rs",
+"ui/issues/issue-3753.rs",
+"ui/issues/issue-37534.rs",
+"ui/issues/issue-37576.rs",
+"ui/issues/issue-37598.rs",
+"ui/issues/issue-3763.rs",
+"ui/issues/issue-37665.rs",
+"ui/issues/issue-37686.rs",
+"ui/issues/issue-37725.rs",
+"ui/issues/issue-37733.rs",
+"ui/issues/issue-3779.rs",
+"ui/issues/issue-37884.rs",
+"ui/issues/issue-38160.rs",
+"ui/issues/issue-38190.rs",
+"ui/issues/issue-38226.rs",
+"ui/issues/issue-38381.rs",
+"ui/issues/issue-38412.rs",
+"ui/issues/issue-38437.rs",
+"ui/issues/issue-38458.rs",
+"ui/issues/issue-3847.rs",
+"ui/issues/issue-38556.rs",
+"ui/issues/issue-38727.rs",
+"ui/issues/issue-3874.rs",
+"ui/issues/issue-38763.rs",
+"ui/issues/issue-38857.rs",
+"ui/issues/issue-38875/auxiliary/issue-38875-b.rs",
+"ui/issues/issue-38875/issue-38875.rs",
+"ui/issues/issue-3888-2.rs",
+"ui/issues/issue-38919.rs",
+"ui/issues/issue-38942.rs",
+"ui/issues/issue-3895.rs",
+"ui/issues/issue-38954.rs",
+"ui/issues/issue-38987.rs",
+"ui/issues/issue-39089.rs",
+"ui/issues/issue-39175.rs",
+"ui/issues/issue-39211.rs",
+"ui/issues/issue-39367.rs",
+"ui/issues/issue-39548.rs",
+"ui/issues/issue-39687.rs",
+"ui/issues/issue-39709.rs",
+"ui/issues/issue-3979-2.rs",
+"ui/issues/issue-3979-generics.rs",
+"ui/issues/issue-3979-xcrate.rs",
+"ui/issues/issue-3979.rs",
+"ui/issues/issue-39808.rs",
+"ui/issues/issue-39827.rs",
+"ui/issues/issue-39848.rs",
+"ui/issues/issue-3991.rs",
+"ui/issues/issue-3993.rs",
+"ui/issues/issue-39970.rs",
+"ui/issues/issue-39984.rs",
+"ui/issues/issue-40000.rs",
+"ui/issues/issue-40136.rs",
+"ui/issues/issue-40235.rs",
+"ui/issues/issue-4025.rs",
+"ui/issues/issue-40288-2.rs",
+"ui/issues/issue-40288.rs",
+"ui/issues/issue-40350.rs",
+"ui/issues/issue-40402-ref-hints/issue-40402-1.rs",
+"ui/issues/issue-40402-ref-hints/issue-40402-2.rs",
+"ui/issues/issue-40408.rs",
+"ui/issues/issue-40510-captured-variable-return/issue-40510-1.rs",
+"ui/issues/issue-40510-captured-variable-return/issue-40510-2.rs",
+"ui/issues/issue-40510-captured-variable-return/issue-40510-3.rs",
+"ui/issues/issue-40510-captured-variable-return/issue-40510-4.rs",
+"ui/issues/issue-40610.rs",
+"ui/issues/issue-40749.rs",
+"ui/issues/issue-40782.rs",
+"ui/issues/issue-40827.rs",
+"ui/issues/issue-40845.rs",
+"ui/issues/issue-40861.rs",
+"ui/issues/issue-40883.rs",
+"ui/issues/issue-40951.rs",
+"ui/issues/issue-41053.rs",
+"ui/issues/issue-41139.rs",
+"ui/issues/issue-41213.rs",
+"ui/issues/issue-41229-ref-str.rs",
+"ui/issues/issue-41272.rs",
+"ui/issues/issue-41298.rs",
+"ui/issues/issue-41479.rs",
+"ui/issues/issue-41498.rs",
+"ui/issues/issue-41549.rs",
+"ui/issues/issue-41604.rs",
+"ui/issues/issue-41628.rs",
+"ui/issues/issue-41652/auxiliary/issue-41652-b.rs",
+"ui/issues/issue-41652/issue-41652.rs",
+"ui/issues/issue-41677.rs",
+"ui/issues/issue-41696.rs",
+"ui/issues/issue-41726.rs",
+"ui/issues/issue-41742.rs",
+"ui/issues/issue-41744.rs",
+"ui/issues/issue-41849-variance-req.rs",
+"ui/issues/issue-41880.rs",
+"ui/issues/issue-41888.rs",
+"ui/issues/issue-41936-variance-coerce-unsized-cycle.rs",
+"ui/issues/issue-41974.rs",
+"ui/issues/issue-41998.rs",
+"ui/issues/issue-42007.rs",
+"ui/issues/issue-4208.rs",
+"ui/issues/issue-42106.rs",
+"ui/issues/issue-42148.rs",
+"ui/issues/issue-42210.rs",
+"ui/issues/issue-4228.rs",
+"ui/issues/issue-42312.rs",
+"ui/issues/issue-42453.rs",
+"ui/issues/issue-42467.rs",
+"ui/issues/issue-4252.rs",
+"ui/issues/issue-42552.rs",
+"ui/issues/issue-4265.rs",
+"ui/issues/issue-42755.rs",
+"ui/issues/issue-42796.rs",
+"ui/issues/issue-42880.rs",
+"ui/issues/issue-42956.rs",
+"ui/issues/issue-43057.rs",
+"ui/issues/issue-43162.rs",
+"ui/issues/issue-43205.rs",
+"ui/issues/issue-43250.rs",
+"ui/issues/issue-43291.rs",
+"ui/issues/issue-4333.rs",
+"ui/issues/issue-4335.rs",
+"ui/issues/issue-43355.rs",
+"ui/issues/issue-43357.rs",
+"ui/issues/issue-43420-no-over-suggest.rs",
+"ui/issues/issue-43424.rs",
+"ui/issues/issue-43431.rs",
+"ui/issues/issue-43483.rs",
+"ui/issues/issue-43692.rs",
+"ui/issues/issue-43806.rs",
+"ui/issues/issue-43853.rs",
+"ui/issues/issue-4387.rs",
+"ui/issues/issue-43910.rs",
+"ui/issues/issue-43923.rs",
+"ui/issues/issue-43925.rs",
+"ui/issues/issue-43926.rs",
+"ui/issues/issue-43988.rs",
+"ui/issues/issue-44023.rs",
+"ui/issues/issue-44056.rs",
+"ui/issues/issue-44078.rs",
+"ui/issues/issue-44216-add-instant.rs",
+"ui/issues/issue-44216-add-system-time.rs",
+"ui/issues/issue-44216-sub-instant.rs",
+"ui/issues/issue-44216-sub-system-time.rs",
+"ui/issues/issue-44239.rs",
+"ui/issues/issue-44247.rs",
+"ui/issues/issue-44405.rs",
+"ui/issues/issue-4464.rs",
+"ui/issues/issue-44730.rs",
+"ui/issues/issue-44851.rs",
+"ui/issues/issue-4517.rs",
+"ui/issues/issue-4541.rs",
+"ui/issues/issue-4542.rs",
+"ui/issues/issue-45425.rs",
+"ui/issues/issue-4545.rs",
+"ui/issues/issue-45510.rs",
+"ui/issues/issue-45562.rs",
+"ui/issues/issue-45697-1.rs",
+"ui/issues/issue-45697.rs",
+"ui/issues/issue-45730.rs",
+"ui/issues/issue-45731.rs",
+"ui/issues/issue-45801.rs",
+"ui/issues/issue-45965.rs",
+"ui/issues/issue-46069.rs",
+"ui/issues/issue-46101.rs",
+"ui/issues/issue-46302.rs",
+"ui/issues/issue-46311.rs",
+"ui/issues/issue-46332.rs",
+"ui/issues/issue-46471-1.rs",
+"ui/issues/issue-46472.rs",
+"ui/issues/issue-46604.rs",
+"ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs",
+"ui/issues/issue-46771.rs",
+"ui/issues/issue-46855.rs",
+"ui/issues/issue-46964.rs",
+"ui/issues/issue-46983.rs",
+"ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs",
+"ui/issues/issue-47094.rs",
+"ui/issues/issue-47184.rs",
+"ui/issues/issue-47309.rs",
+"ui/issues/issue-4734.rs",
+"ui/issues/issue-4735.rs",
+"ui/issues/issue-4736.rs",
+"ui/issues/issue-47364.rs",
+"ui/issues/issue-47377.rs",
+"ui/issues/issue-47380.rs",
+"ui/issues/issue-47486.rs",
+"ui/issues/issue-4759-1.rs",
+"ui/issues/issue-4759.rs",
+"ui/issues/issue-47638.rs",
+"ui/issues/issue-47673.rs",
+"ui/issues/issue-47703-1.rs",
+"ui/issues/issue-47703-tuple.rs",
+"ui/issues/issue-47703.rs",
+"ui/issues/issue-47715.rs",
+"ui/issues/issue-47722.rs",
+"ui/issues/issue-48006.rs",
+"ui/issues/issue-48131.rs",
+"ui/issues/issue-48132.rs",
+"ui/issues/issue-48159.rs",
+"ui/issues/issue-48276.rs",
+"ui/issues/issue-4830.rs",
+"ui/issues/issue-48364.rs",
+"ui/issues/issue-48728.rs",
+"ui/issues/issue-4875.rs",
+"ui/issues/issue-48838.rs",
+"ui/issues/issue-48984.rs",
+"ui/issues/issue-49298.rs",
+"ui/issues/issue-4935.rs",
+"ui/issues/issue-49544.rs",
+"ui/issues/issue-49632.rs",
+"ui/issues/issue-4968.rs",
+"ui/issues/issue-4972.rs",
+"ui/issues/issue-49824.rs",
+"ui/issues/issue-49854.rs",
+"ui/issues/issue-49919.rs",
+"ui/issues/issue-49934-errors.rs",
+"ui/issues/issue-49934.rs",
+"ui/issues/issue-49955.rs",
+"ui/issues/issue-49973.rs",
+"ui/issues/issue-50187.rs",
+"ui/issues/issue-50403.rs",
+"ui/issues/issue-50411.rs",
+"ui/issues/issue-50415.rs",
+"ui/issues/issue-50442.rs",
+"ui/issues/issue-50471.rs",
+"ui/issues/issue-50518.rs",
+"ui/issues/issue-50571.rs",
+"ui/issues/issue-50581.rs",
+"ui/issues/issue-50582.rs",
+"ui/issues/issue-50585.rs",
+"ui/issues/issue-50600.rs",
+"ui/issues/issue-50618.rs",
+"ui/issues/issue-5062.rs",
+"ui/issues/issue-5067.rs",
+"ui/issues/issue-50688.rs",
+"ui/issues/issue-50714-1.rs",
+"ui/issues/issue-50714.rs",
+"ui/issues/issue-50761.rs",
+"ui/issues/issue-50781.rs",
+"ui/issues/issue-50802.rs",
+"ui/issues/issue-50811.rs",
+"ui/issues/issue-5100.rs",
+"ui/issues/issue-51022.rs",
+"ui/issues/issue-51044.rs",
+"ui/issues/issue-51102.rs",
+"ui/issues/issue-51116.rs",
+"ui/issues/issue-51154.rs",
+"ui/issues/issue-51515.rs",
+"ui/issues/issue-5153.rs",
+"ui/issues/issue-51632-try-desugar-incompatible-types.rs",
+"ui/issues/issue-51655.rs",
+"ui/issues/issue-51714.rs",
+"ui/issues/issue-51798.rs",
+"ui/issues/issue-51874.rs",
+"ui/issues/issue-51907.rs",
+"ui/issues/issue-5192.rs",
+"ui/issues/issue-51947.rs",
+"ui/issues/issue-52049.rs",
+"ui/issues/issue-52126-assign-op-invariance.rs",
+"ui/issues/issue-52262.rs",
+"ui/issues/issue-5239-1.rs",
+"ui/issues/issue-5239-2.rs",
+"ui/issues/issue-52489.rs",
+"ui/issues/issue-52533.rs",
+"ui/issues/issue-52717.rs",
+"ui/issues/issue-5280.rs",
+"ui/issues/issue-5315.rs",
+"ui/issues/issue-5321-immediates-with-bare-self.rs",
+"ui/issues/issue-53251.rs",
+"ui/issues/issue-53275.rs",
+"ui/issues/issue-53300.rs",
+"ui/issues/issue-53333.rs",
+"ui/issues/issue-53348.rs",
+"ui/issues/issue-53419.rs",
+"ui/issues/issue-53498.rs",
+"ui/issues/issue-53568.rs",
+"ui/issues/issue-5358-1.rs",
+"ui/issues/issue-53728.rs",
+"ui/issues/issue-53843.rs",
+"ui/issues/issue-54044.rs",
+"ui/issues/issue-54062.rs",
+"ui/issues/issue-54094.rs",
+"ui/issues/issue-5439.rs",
+"ui/issues/issue-54410.rs",
+"ui/issues/issue-54462-mutable-noalias-correctness.rs",
+"ui/issues/issue-54477-reduced-2.rs",
+"ui/issues/issue-54696.rs",
+"ui/issues/issue-5518.rs",
+"ui/issues/issue-5521.rs",
+"ui/issues/issue-55376.rs",
+"ui/issues/issue-55380.rs",
+"ui/issues/issue-5550.rs",
+"ui/issues/issue-5554.rs",
+"ui/issues/issue-55587.rs",
+"ui/issues/issue-5572.rs",
+"ui/issues/issue-55731.rs",
+"ui/issues/issue-56128.rs",
+"ui/issues/issue-56175.rs",
+"ui/issues/issue-56199.rs",
+"ui/issues/issue-56229.rs",
+"ui/issues/issue-56237.rs",
+"ui/issues/issue-5666.rs",
+"ui/issues/issue-56806.rs",
+"ui/issues/issue-56835.rs",
+"ui/issues/issue-56870.rs",
+"ui/issues/issue-5688.rs",
+"ui/issues/issue-56943.rs",
+"ui/issues/issue-5708.rs",
+"ui/issues/issue-57156.rs",
+"ui/issues/issue-57162.rs",
+"ui/issues/issue-5718.rs",
+"ui/issues/issue-57198-pass.rs",
+"ui/issues/issue-57271.rs",
+"ui/issues/issue-57362-1.rs",
+"ui/issues/issue-57362-2.rs",
+"ui/issues/issue-57399-self-return-impl-trait.rs",
+"ui/issues/issue-5741.rs",
+"ui/issues/issue-5754.rs",
+"ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.rs",
+"ui/issues/issue-57741-dereference-boxed-value/issue-57741.rs",
+"ui/issues/issue-57781.rs",
+"ui/issues/issue-57924.rs",
+"ui/issues/issue-58212.rs",
+"ui/issues/issue-58375-monomorphize-default-impls.rs",
+"ui/issues/issue-5844.rs",
+"ui/issues/issue-58463.rs",
+"ui/issues/issue-58712.rs",
+"ui/issues/issue-58734.rs",
+"ui/issues/issue-5883.rs",
+"ui/issues/issue-5884.rs",
+"ui/issues/issue-58857.rs",
+"ui/issues/issue-5900.rs",
+"ui/issues/issue-59020.rs",
+"ui/issues/issue-5917.rs",
+"ui/issues/issue-59326.rs",
+"ui/issues/issue-59488.rs",
+"ui/issues/issue-59494.rs",
+"ui/issues/issue-5950.rs",
+"ui/issues/issue-59756.rs",
+"ui/issues/issue-5988.rs",
+"ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs",
+"ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs",
+"ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs",
+"ui/issues/issue-60218.rs",
+"ui/issues/issue-60622.rs",
+"ui/issues/issue-60989.rs",
+"ui/issues/issue-61106.rs",
+"ui/issues/issue-61108.rs",
+"ui/issues/issue-6117.rs",
+"ui/issues/issue-6130.rs",
+"ui/issues/issue-61475.rs",
+"ui/issues/issue-6153.rs",
+"ui/issues/issue-61623.rs",
+"ui/issues/issue-61894.rs",
+"ui/issues/issue-62480.rs",
+"ui/issues/issue-6318.rs",
+"ui/issues/issue-6344-let.rs",
+"ui/issues/issue-6344-match.rs",
+"ui/issues/issue-63983.rs",
+"ui/issues/issue-64430.rs",
+"ui/issues/issue-64559.rs",
+"ui/issues/issue-64593.rs",
+"ui/issues/issue-64792-bad-unicode-ctor.rs",
+"ui/issues/issue-65131.rs",
+"ui/issues/issue-65230.rs",
+"ui/issues/issue-65462.rs",
+"ui/issues/issue-6557.rs",
+"ui/issues/issue-6596-2.rs",
+"ui/issues/issue-66308.rs",
+"ui/issues/issue-66353.rs",
+"ui/issues/issue-66667-function-cmp-cycle.rs",
+"ui/issues/issue-66702-break-outside-loop-val.rs",
+"ui/issues/issue-66706.rs",
+"ui/issues/issue-66923-show-error-for-correct-call.rs",
+"ui/issues/issue-67039-unsound-pin-partialeq.rs",
+"ui/issues/issue-6738.rs",
+"ui/issues/issue-67535.rs",
+"ui/issues/issue-67552.rs",
+"ui/issues/issue-68010-large-zst-consts.rs",
+"ui/issues/issue-68696-catch-during-unwind.rs",
+"ui/issues/issue-6892.rs",
+"ui/issues/issue-68951.rs",
+"ui/issues/issue-6898.rs",
+"ui/issues/issue-69130.rs",
+"ui/issues/issue-6919.rs",
+"ui/issues/issue-69306.rs",
+"ui/issues/issue-6936.rs",
+"ui/issues/issue-69455.rs",
+"ui/issues/issue-69602-type-err-during-codegen-ice.rs",
+"ui/issues/issue-69683.rs",
+"ui/issues/issue-70093/issue-70093-link-directives.rs",
+"ui/issues/issue-70093/issue-70093.rs",
+"ui/issues/issue-7012.rs",
+"ui/issues/issue-70381.rs",
+"ui/issues/issue-7044.rs",
+"ui/issues/issue-7061.rs",
+"ui/issues/issue-70673.rs",
+"ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs",
+"ui/issues/issue-70746.rs",
+"ui/issues/issue-7092.rs",
+"ui/issues/issue-71406.rs",
+"ui/issues/issue-71676-suggest-deref/issue-71676-1.rs",
+"ui/issues/issue-71676-suggest-deref/issue-71676-2.rs",
+"ui/issues/issue-7178.rs",
+"ui/issues/issue-72002.rs",
+"ui/issues/issue-72076.rs",
+"ui/issues/issue-72278.rs",
+"ui/issues/issue-7246.rs",
+"ui/issues/issue-7268.rs",
+"ui/issues/issue-72839-error-overflow.rs",
+"ui/issues/issue-72933-match-stack-overflow.rs",
+"ui/issues/issue-73112.rs",
+"ui/issues/issue-73229.rs",
+"ui/issues/issue-7344.rs",
+"ui/issues/issue-7364.rs",
+"ui/issues/issue-74082.rs",
+"ui/issues/issue-74564-if-expr-stack-overflow.rs",
+"ui/issues/issue-7519-match-unit-in-arg.rs",
+"ui/issues/issue-75283.rs",
+"ui/issues/issue-7563.rs",
+"ui/issues/issue-75704.rs",
+"ui/issues/issue-7575.rs",
+"ui/issues/issue-76042.rs",
+"ui/issues/issue-7607-1.rs",
+"ui/issues/issue-7607-2.rs",
+"ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs",
+"ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs",
+"ui/issues/issue-76191.rs",
+"ui/issues/issue-7660.rs",
+"ui/issues/issue-7663.rs",
+"ui/issues/issue-7673-cast-generically-implemented-trait.rs",
+"ui/issues/issue-77218/issue-77218-2.rs",
+"ui/issues/issue-77218/issue-77218.rs",
+"ui/issues/issue-7784.rs",
+"ui/issues/issue-77919.rs",
+"ui/issues/issue-78192.rs",
+"ui/issues/issue-78622.rs",
+"ui/issues/issue-7867.rs",
+"ui/issues/issue-78957.rs",
+"ui/issues/issue-7899.rs",
+"ui/issues/issue-7911.rs",
+"ui/issues/issue-7950.rs",
+"ui/issues/issue-7970a.rs",
+"ui/issues/issue-8044.rs",
+"ui/issues/issue-80607.rs",
+"ui/issues/issue-81584.rs",
+"ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs",
+"ui/issues/issue-81918.rs",
+"ui/issues/issue-8248.rs",
+"ui/issues/issue-8249.rs",
+"ui/issues/issue-8259.rs",
+"ui/issues/issue-83048.rs",
+"ui/issues/issue-8391.rs",
+"ui/issues/issue-8398.rs",
+"ui/issues/issue-8401.rs",
+"ui/issues/issue-8498.rs",
+"ui/issues/issue-8506.rs",
+"ui/issues/issue-8521.rs",
+"ui/issues/issue-85461.rs",
+"ui/issues/issue-8578.rs",
+"ui/issues/issue-86756.rs",
+"ui/issues/issue-87199.rs",
+"ui/issues/issue-8727.rs",
+"ui/issues/issue-87490.rs",
+"ui/issues/issue-8761.rs",
+"ui/issues/issue-8767.rs",
+"ui/issues/issue-87707.rs",
+"ui/issues/issue-8783.rs",
+"ui/issues/issue-88150.rs",
+"ui/issues/issue-8860.rs",
+"ui/issues/issue-8898.rs",
+"ui/issues/issue-9047.rs",
+"ui/issues/issue-9110.rs",
+"ui/issues/issue-9123.rs",
+"ui/issues/issue-9129.rs",
+"ui/issues/issue-91489.rs",
+"ui/issues/issue-9155.rs",
+"ui/issues/issue-9188.rs",
+"ui/issues/issue-9243.rs",
+"ui/issues/issue-9249.rs",
+"ui/issues/issue-9259.rs",
+"ui/issues/issue-92741.rs",
+"ui/issues/issue-9382.rs",
+"ui/issues/issue-9446.rs",
+"ui/issues/issue-9575.rs",
+"ui/issues/issue-9719.rs",
+"ui/issues/issue-9725.rs",
+"ui/issues/issue-9737.rs",
+"ui/issues/issue-9814.rs",
+"ui/issues/issue-98299.rs",
+"ui/issues/issue-9837.rs",
+"ui/issues/issue-9906.rs",
+"ui/issues/issue-9918.rs",
+"ui/issues/issue-9942.rs",
+"ui/issues/issue-9951.rs",
+"ui/issues/issue-9968.rs",
+"ui/issues/issue-99838.rs",
+"ui/iterators/issue-28098.rs",
+"ui/iterators/issue-58952-filter-type-length.rs",
+"ui/lang-items/issue-19660.rs",
+"ui/lang-items/issue-83471.rs",
+"ui/lang-items/issue-87573.rs",
+"ui/late-bound-lifetimes/issue-36381.rs",
+"ui/late-bound-lifetimes/issue-47511.rs",
+"ui/late-bound-lifetimes/issue-80618.rs",
+"ui/layout/issue-112048-unsizing-field-order.rs",
+"ui/layout/issue-112048-unsizing-niche.rs",
+"ui/layout/issue-113941.rs",
+"ui/layout/issue-60431-unsized-tail-behind-projection.rs",
+"ui/layout/issue-84108.rs",
+"ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs",
+"ui/layout/issue-96185-overaligned-enum.rs",
+"ui/let-else/issue-100103.rs",
+"ui/let-else/issue-102317.rs",
+"ui/let-else/issue-94176.rs",
+"ui/let-else/issue-99975.rs",
+"ui/lifetimes/auxiliary/issue-91763-aux.rs",
+"ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.rs",
+"ui/lifetimes/issue-104432-unused-lifetimes-in-expansion.rs",
+"ui/lifetimes/issue-105227.rs",
+"ui/lifetimes/issue-105507.rs",
+"ui/lifetimes/issue-105675.rs",
+"ui/lifetimes/issue-107492-default-value-for-lifetime.rs",
+"ui/lifetimes/issue-107988.rs",
+"ui/lifetimes/issue-17728.rs",
+"ui/lifetimes/issue-19707.rs",
+"ui/lifetimes/issue-26638.rs",
+"ui/lifetimes/issue-34979.rs",
+"ui/lifetimes/issue-36744-without-calls.rs",
+"ui/lifetimes/issue-54378.rs",
+"ui/lifetimes/issue-55796.rs",
+"ui/lifetimes/issue-64173-unused-lifetimes.rs",
+"ui/lifetimes/issue-67498.rs",
+"ui/lifetimes/issue-69314.rs",
+"ui/lifetimes/issue-70917-lifetimes-in-fn-def.rs",
+"ui/lifetimes/issue-76168-hr-outlives-2.rs",
+"ui/lifetimes/issue-76168-hr-outlives-3.rs",
+"ui/lifetimes/issue-76168-hr-outlives.rs",
+"ui/lifetimes/issue-77175.rs",
+"ui/lifetimes/issue-79187-2.rs",
+"ui/lifetimes/issue-79187.rs",
+"ui/lifetimes/issue-83737-binders-across-types.rs",
+"ui/lifetimes/issue-83737-erasing-bound-vars.rs",
+"ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs",
+"ui/lifetimes/issue-83907-invalid-fn-like-path.rs",
+"ui/lifetimes/issue-84398.rs",
+"ui/lifetimes/issue-84604.rs",
+"ui/lifetimes/issue-90170-elision-mismatch.rs",
+"ui/lifetimes/issue-90600-expected-return-static-indirect.rs",
+"ui/lifetimes/issue-91763.rs",
+"ui/lifetimes/issue-93911.rs",
+"ui/lifetimes/issue-95023.rs",
+"ui/lifetimes/issue-97193.rs",
+"ui/lifetimes/issue-97194.rs",
+"ui/lifetimes/lifetime-errors/issue_74400.rs",
+"ui/limits/issue-15919-32.rs",
+"ui/limits/issue-15919-64.rs",
+"ui/limits/issue-17913.rs",
+"ui/limits/issue-55878.rs",
+"ui/limits/issue-56762.rs",
+"ui/limits/issue-69485-var-size-diffs-too-large.rs",
+"ui/limits/issue-75158-64.rs",
+"ui/linkage-attr/issue-10755.rs",
+"ui/linkage-attr/issue-109144.rs",
+"ui/lint/dead-code/issue-41883.rs",
+"ui/lint/dead-code/issue-59003.rs",
+"ui/lint/dead-code/issue-68408-false-positive.rs",
+"ui/lint/dead-code/issue-85071-2.rs",
+"ui/lint/dead-code/issue-85071.rs",
+"ui/lint/dead-code/issue-85255.rs",
+"ui/lint/issue-101284.rs",
+"ui/lint/issue-102705.rs",
+"ui/lint/issue-103317.rs",
+"ui/lint/issue-103435-extra-parentheses.rs",
+"ui/lint/issue-104392.rs",
+"ui/lint/issue-104897.rs",
+"ui/lint/issue-106991.rs",
+"ui/lint/issue-108155.rs",
+"ui/lint/issue-109152.rs",
+"ui/lint/issue-109529.rs",
+"ui/lint/issue-110573.rs",
+"ui/lint/issue-111359.rs",
+"ui/lint/issue-112489.rs",
+"ui/lint/issue-117949.rs",
+"ui/lint/issue-121070-let-range.rs",
+"ui/lint/issue-14309.rs",
+"ui/lint/issue-14837.rs",
+"ui/lint/issue-17718-const-naming.rs",
+"ui/lint/issue-1866.rs",
+"ui/lint/issue-19102.rs",
+"ui/lint/issue-20343.rs",
+"ui/lint/issue-30302.rs",
+"ui/lint/issue-31924-non-snake-ffi.rs",
+"ui/lint/issue-34798.rs",
+"ui/lint/issue-35075.rs",
+"ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs",
+"ui/lint/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs",
+"ui/lint/issue-54099-camel-case-underscore-types.rs",
+"ui/lint/issue-57410-1.rs",
+"ui/lint/issue-57410.rs",
+"ui/lint/issue-63364.rs",
+"ui/lint/issue-66362-no-snake-case-warning-for-field-puns.rs",
+"ui/lint/issue-70819-dont-override-forbid-in-same-scope.rs",
+"ui/lint/issue-79546-fuel-ice.rs",
+"ui/lint/issue-79744.rs",
+"ui/lint/issue-80988.rs",
+"ui/lint/issue-81218.rs",
+"ui/lint/issue-83477.rs",
+"ui/lint/issue-87274-paren-parent.rs",
+"ui/lint/issue-89469.rs",
+"ui/lint/issue-90614-accept-allow-text-direction-codepoint-in-comment-lint.rs",
+"ui/lint/issue-97094.rs",
+"ui/lint/issue-99387.rs",
+"ui/lint/let_underscore/issue-119696-err-on-fn.rs",
+"ui/lint/let_underscore/issue-119697-extra-let.rs",
+"ui/lint/must_not_suspend/issue-89562.rs",
+"ui/lint/unused/issue-103320-must-use-ops.rs",
+"ui/lint/unused/issue-104397.rs",
+"ui/lint/unused/issue-105061-array-lint.rs",
+"ui/lint/unused/issue-105061-should-lint.rs",
+"ui/lint/unused/issue-105061.rs",
+"ui/lint/unused/issue-117142-invalid-remove-parens.rs",
+"ui/lint/unused/issue-117284-arg-in-macro.rs",
+"ui/lint/unused/issue-119383-if-let-guard.rs",
+"ui/lint/unused/issue-30730.rs",
+"ui/lint/unused/issue-46576.rs",
+"ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.rs",
+"ui/lint/unused/issue-54180-unused-ref-field.rs",
+"ui/lint/unused/issue-54538-unused-parens-lint.rs",
+"ui/lint/unused/issue-59896.rs",
+"ui/lint/unused/issue-67691-unused-field-in-or-pattern.rs",
+"ui/lint/unused/issue-70041.rs",
+"ui/lint/unused/issue-71290-unused-paren-binop.rs",
+"ui/lint/unused/issue-74883-unused-paren-baren-yield.rs",
+"ui/lint/unused/issue-81314-unused-span-ident.rs",
+"ui/lint/unused/issue-85913.rs",
+"ui/lint/unused/issue-88519-unused-paren.rs",
+"ui/lint/unused/issue-90807-unused-paren-error.rs",
+"ui/lint/unused/issue-90807-unused-paren.rs",
+"ui/lint/unused/issue-92751.rs",
+"ui/lint/unused/issue-96606.rs",
+"ui/lint/use-redundant/issue-92904.rs",
+"ui/loops/issue-50576.rs",
+"ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs",
+"ui/loops/issue-69225-layout-repeated-checked-add.rs",
+"ui/loops/issue-82916.rs",
+"ui/lowering/issue-121108.rs",
+"ui/lowering/issue-96847.rs",
+"ui/lto/issue-100772.rs",
+"ui/lto/issue-105637.rs",
+"ui/lto/issue-11154.rs",
+"ui/macros/auxiliary/issue-100199.rs",
+"ui/macros/auxiliary/issue-19163.rs",
+"ui/macros/auxiliary/issue-40469.rs",
+"ui/macros/auxiliary/issue-75982.rs",
+"ui/macros/issue-100199.rs",
+"ui/macros/issue-102878.rs",
+"ui/macros/issue-103529.rs",
+"ui/macros/issue-104769-concat_bytes-invalid-literal.rs",
+"ui/macros/issue-105011.rs",
+"ui/macros/issue-10536.rs",
+"ui/macros/issue-106837.rs",
+"ui/macros/issue-109237.rs",
+"ui/macros/issue-111749.rs",
+"ui/macros/issue-112342-1.rs",
+"ui/macros/issue-112342-2.rs",
+"ui/macros/issue-118048.rs",
+"ui/macros/issue-118786.rs",
+"ui/macros/issue-16098.rs",
+"ui/macros/issue-19163.rs",
+"ui/macros/issue-21356.rs",
+"ui/macros/issue-22463.rs",
+"ui/macros/issue-25274.rs",
+"ui/macros/issue-25385.rs",
+"ui/macros/issue-26094.rs",
+"ui/macros/issue-26322.rs",
+"ui/macros/issue-2804-2.rs",
+"ui/macros/issue-2804.rs",
+"ui/macros/issue-29084.rs",
+"ui/macros/issue-30143.rs",
+"ui/macros/issue-33185.rs",
+"ui/macros/issue-34171.rs",
+"ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.rs",
+"ui/macros/issue-35450.rs",
+"ui/macros/issue-37175.rs",
+"ui/macros/issue-38715.rs",
+"ui/macros/issue-39388.rs",
+"ui/macros/issue-39404.rs",
+"ui/macros/issue-39467.rs",
+"ui/macros/issue-40469.rs",
+"ui/macros/issue-40770.rs",
+"ui/macros/issue-41776.rs",
+"ui/macros/issue-41803.rs",
+"ui/macros/issue-42954.rs",
+"ui/macros/issue-44127.rs",
+"ui/macros/issue-46438.rs",
+"ui/macros/issue-5060.rs",
+"ui/macros/issue-51848.rs",
+"ui/macros/issue-52169.rs",
+"ui/macros/issue-54441.rs",
+"ui/macros/issue-57597.rs",
+"ui/macros/issue-58490.rs",
+"ui/macros/issue-61033-1.rs",
+"ui/macros/issue-61033-2.rs",
+"ui/macros/issue-61053-different-kleene.rs",
+"ui/macros/issue-61053-duplicate-binder.rs",
+"ui/macros/issue-61053-missing-repetition.rs",
+"ui/macros/issue-61053-unbound.rs",
+"ui/macros/issue-63102.rs",
+"ui/macros/issue-6596-1.rs",
+"ui/macros/issue-68058.rs",
+"ui/macros/issue-68060.rs",
+"ui/macros/issue-69396-const-no-type-in-macro.rs",
+"ui/macros/issue-69838-mods-relative-to-included-path.rs",
+"ui/macros/issue-70446.rs",
+"ui/macros/issue-75982-foreign-macro-weird-mod.rs",
+"ui/macros/issue-77475.rs",
+"ui/macros/issue-78325-inconsistent-resolution.rs",
+"ui/macros/issue-78333.rs",
+"ui/macros/issue-78892-substitution-in-statement-attr.rs",
+"ui/macros/issue-81006.rs",
+"ui/macros/issue-83340.rs",
+"ui/macros/issue-83344.rs",
+"ui/macros/issue-84195-lint-anon-const.rs",
+"ui/macros/issue-84429-matches-edition.rs",
+"ui/macros/issue-84632-eager-expansion-recursion-limit.rs",
+"ui/macros/issue-86082-option-env-invalid-char.rs",
+"ui/macros/issue-86865.rs",
+"ui/macros/issue-8709.rs",
+"ui/macros/issue-87877.rs",
+"ui/macros/issue-88206.rs",
+"ui/macros/issue-88228.rs",
+"ui/macros/issue-8851.rs",
+"ui/macros/issue-92267.rs",
+"ui/macros/issue-95267.rs",
+"ui/macros/issue-95533.rs",
+"ui/macros/issue-98466-allow.rs",
+"ui/macros/issue-98466.rs",
+"ui/macros/issue-98790.rs",
+"ui/macros/issue-99261.rs",
+"ui/macros/issue-99265.rs",
+"ui/macros/issue-99907.rs",
+"ui/macros/rfc-3086-metavar-expr/issue-111904.rs",
+"ui/malformed/issue-107423-unused-delim-only-one-no-pair.rs",
+"ui/malformed/issue-69341-malformed-derive-inert.rs",
+"ui/marker_trait_attr/issue-61651-type-mismatch.rs",
+"ui/match/issue-112438.rs",
+"ui/match/issue-113012.rs",
+"ui/match/issue-11319.rs",
+"ui/match/issue-114691.rs",
+"ui/match/issue-115681.rs",
+"ui/match/issue-11940.rs",
+"ui/match/issue-12552.rs",
+"ui/match/issue-18060.rs",
+"ui/match/issue-26251.rs",
+"ui/match/issue-26996.rs",
+"ui/match/issue-27021.rs",
+"ui/match/issue-33498.rs",
+"ui/match/issue-42679.rs",
+"ui/match/issue-46920-byte-array-patterns.rs",
+"ui/match/issue-5530.rs",
+"ui/match/issue-56685.rs",
+"ui/match/issue-70972-dyn-trait.rs",
+"ui/match/issue-72680.rs",
+"ui/match/issue-72896-non-partial-eq-const.rs",
+"ui/match/issue-74050-end-span.rs",
+"ui/match/issue-82392.rs",
+"ui/match/issue-82866.rs",
+"ui/match/issue-84434.rs",
+"ui/match/issue-91058.rs",
+"ui/match/issue-92100.rs",
+"ui/methods/issue-3707.rs",
+"ui/methods/issues/issue-105732.rs",
+"ui/methods/issues/issue-61525.rs",
+"ui/methods/issues/issue-84495.rs",
+"ui/methods/issues/issue-90315.rs",
+"ui/methods/issues/issue-94581.rs",
+"ui/mir/auxiliary/issue_76375_aux.rs",
+"ui/mir/issue-101844.rs",
+"ui/mir/issue-102389.rs",
+"ui/mir/issue-105809.rs",
+"ui/mir/issue-106062.rs",
+"ui/mir/issue-107678-projection-with-lifetime.rs",
+"ui/mir/issue-107691.rs",
+"ui/mir/issue-109004-drop-large-array.rs",
+"ui/mir/issue-109743.rs",
+"ui/mir/issue-112269.rs",
+"ui/mir/issue-121103.rs",
+"ui/mir/issue-29227.rs",
+"ui/mir/issue-46845.rs",
+"ui/mir/issue-60390.rs",
+"ui/mir/issue-66851.rs",
+"ui/mir/issue-66930.rs",
+"ui/mir/issue-67639-normalization-ice.rs",
+"ui/mir/issue-67710-inline-projection.rs",
+"ui/mir/issue-67947.rs",
+"ui/mir/issue-68841.rs",
+"ui/mir/issue-71793-inline-args-storage.rs",
+"ui/mir/issue-73914.rs",
+"ui/mir/issue-74739.rs",
+"ui/mir/issue-75053.rs",
+"ui/mir/issue-75419-validation-impl-trait.rs",
+"ui/mir/issue-76248.rs",
+"ui/mir/issue-76375.rs",
+"ui/mir/issue-76740-copy-propagation.rs",
+"ui/mir/issue-76803-branches-not-same.rs",
+"ui/mir/issue-77002.rs",
+"ui/mir/issue-77359-simplify-arm-identity.rs",
+"ui/mir/issue-77911.rs",
+"ui/mir/issue-78496.rs",
+"ui/mir/issue-80949.rs",
+"ui/mir/issue-83499-input-output-iteration-ice.rs",
+"ui/mir/issue-89485.rs",
+"ui/mir/issue-91745.rs",
+"ui/mir/issue-92893.rs",
+"ui/mir/issue-99852.rs",
+"ui/mir/issue-99866.rs",
+"ui/mir/issue66339.rs",
+"ui/mir/validate/issue-95978-validator-lifetime-comparison.rs",
+"ui/mismatched_types/issue-106182.rs",
+"ui/mismatched_types/issue-112036.rs",
+"ui/mismatched_types/issue-118145-unwrap-for-shorthand.rs",
+"ui/mismatched_types/issue-118510.rs",
+"ui/mismatched_types/issue-13033.rs",
+"ui/mismatched_types/issue-19109.rs",
+"ui/mismatched_types/issue-26480.rs",
+"ui/mismatched_types/issue-35030.rs",
+"ui/mismatched_types/issue-36053-2.rs",
+"ui/mismatched_types/issue-38371-unfixable.rs",
+"ui/mismatched_types/issue-38371.rs",
+"ui/mismatched_types/issue-47706-trait.rs",
+"ui/mismatched_types/issue-47706.rs",
+"ui/mismatched_types/issue-74918-missing-lifetime.rs",
+"ui/mismatched_types/issue-75361-mismatched-impl.rs",
+"ui/mismatched_types/issue-84976.rs",
+"ui/missing-trait-bounds/auxiliary/issue-69725.rs",
+"ui/missing-trait-bounds/issue-35677.rs",
+"ui/missing-trait-bounds/issue-69725.rs",
+"ui/modules/issue-107649.rs",
+"ui/modules/issue-56411-aux.rs",
+"ui/modules/issue-56411.rs",
+"ui/moves/issue-22536-copy-mustnt-zero.rs",
+"ui/moves/issue-34721.rs",
+"ui/moves/issue-46099-move-in-macro.rs",
+"ui/moves/issue-72649-uninit-in-loop.rs",
+"ui/moves/issue-75904-move-closure-loop.rs",
+"ui/moves/issue-99470-move-out-of-some.rs",
+"ui/never_type/issue-10176.rs",
+"ui/never_type/issue-13352.rs",
+"ui/never_type/issue-2149.rs",
+"ui/never_type/issue-44402.rs",
+"ui/never_type/issue-51506.rs",
+"ui/never_type/issue-52443.rs",
+"ui/never_type/issue-5500-1.rs",
+"ui/never_type/issue-96335.rs",
+"ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs",
+"ui/nll/issue-112604-closure-output-normalize.rs",
+"ui/nll/issue-16223.rs",
+"ui/nll/issue-21114-ebfull.rs",
+"ui/nll/issue-21114-kixunil.rs",
+"ui/nll/issue-21232-partial-init-and-erroneous-use.rs",
+"ui/nll/issue-21232-partial-init-and-use.rs",
+"ui/nll/issue-22323-temp-destruction.rs",
+"ui/nll/issue-24535-allow-mutable-borrow-in-match-guard.rs",
+"ui/nll/issue-27282-move-match-input-into-guard.rs",
+"ui/nll/issue-27282-move-ref-mut-into-guard.rs",
+"ui/nll/issue-27282-mutate-before-diverging-arm-1.rs",
+"ui/nll/issue-27282-mutate-before-diverging-arm-2.rs",
+"ui/nll/issue-27282-mutate-before-diverging-arm-3.rs",
+"ui/nll/issue-27282-mutation-in-guard.rs",
+"ui/nll/issue-27282-reborrow-ref-mut-in-guard.rs",
+"ui/nll/issue-27583.rs",
+"ui/nll/issue-27868.rs",
+"ui/nll/issue-30104.rs",
+"ui/nll/issue-30438-a.rs",
+"ui/nll/issue-30438-b.rs",
+"ui/nll/issue-30438-c.rs",
+"ui/nll/issue-31567.rs",
+"ui/nll/issue-32382-index-assoc-type-with-lifetime.rs",
+"ui/nll/issue-42574-diagnostic-in-nested-closure.rs",
+"ui/nll/issue-43058.rs",
+"ui/nll/issue-45157.rs",
+"ui/nll/issue-45696-long-live-borrows-in-boxes.rs",
+"ui/nll/issue-45696-no-variant-box-recur.rs",
+"ui/nll/issue-45696-scribble-on-boxed-borrow.rs",
+"ui/nll/issue-46023.rs",
+"ui/nll/issue-46036.rs",
+"ui/nll/issue-46589.rs",
+"ui/nll/issue-47022.rs",
+"ui/nll/issue-47153-generic-const.rs",
+"ui/nll/issue-47388.rs",
+"ui/nll/issue-47470.rs",
+"ui/nll/issue-47589.rs",
+"ui/nll/issue-48070.rs",
+"ui/nll/issue-48179.rs",
+"ui/nll/issue-48238.rs",
+"ui/nll/issue-48623-closure.rs",
+"ui/nll/issue-48623-coroutine.rs",
+"ui/nll/issue-48697.rs",
+"ui/nll/issue-48803.rs",
+"ui/nll/issue-50343.rs",
+"ui/nll/issue-50461-used-mut-from-moves.rs",
+"ui/nll/issue-50716-1.rs",
+"ui/nll/issue-50716.rs",
+"ui/nll/issue-51191.rs",
+"ui/nll/issue-51244.rs",
+"ui/nll/issue-51268.rs",
+"ui/nll/issue-51345-2.rs",
+"ui/nll/issue-51351.rs",
+"ui/nll/issue-51512.rs",
+"ui/nll/issue-51770.rs",
+"ui/nll/issue-52057.rs",
+"ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs",
+"ui/nll/issue-52078.rs",
+"ui/nll/issue-52086.rs",
+"ui/nll/issue-52113.rs",
+"ui/nll/issue-52213.rs",
+"ui/nll/issue-52533-1.rs",
+"ui/nll/issue-52534-1.rs",
+"ui/nll/issue-52534-2.rs",
+"ui/nll/issue-52534.rs",
+"ui/nll/issue-52663-span-decl-captured-variable.rs",
+"ui/nll/issue-52663-trait-object.rs",
+"ui/nll/issue-52669.rs",
+"ui/nll/issue-52742.rs",
+"ui/nll/issue-52992.rs",
+"ui/nll/issue-53040.rs",
+"ui/nll/issue-53119.rs",
+"ui/nll/issue-53123-raw-pointer-cast.rs",
+"ui/nll/issue-53570.rs",
+"ui/nll/issue-53773.rs",
+"ui/nll/issue-53807.rs",
+"ui/nll/issue-54189.rs",
+"ui/nll/issue-54302-cases.rs",
+"ui/nll/issue-54302.rs",
+"ui/nll/issue-54382-use-span-of-tail-of-block.rs",
+"ui/nll/issue-54556-niconii.rs",
+"ui/nll/issue-54556-stephaneyfx.rs",
+"ui/nll/issue-54556-temps-in-tail-diagnostic.rs",
+"ui/nll/issue-54556-used-vs-unused-tails.rs",
+"ui/nll/issue-54556-wrap-it-up.rs",
+"ui/nll/issue-54779-anon-static-lifetime.rs",
+"ui/nll/issue-54943-3.rs",
+"ui/nll/issue-54943.rs",
+"ui/nll/issue-55288.rs",
+"ui/nll/issue-55344.rs",
+"ui/nll/issue-55394.rs",
+"ui/nll/issue-55401.rs",
+"ui/nll/issue-55511.rs",
+"ui/nll/issue-55651.rs",
+"ui/nll/issue-55825-const-fn.rs",
+"ui/nll/issue-55850.rs",
+"ui/nll/issue-57100.rs",
+"ui/nll/issue-57265-return-type-wf-check.rs",
+"ui/nll/issue-57280-1-flipped.rs",
+"ui/nll/issue-57280-1.rs",
+"ui/nll/issue-57280.rs",
+"ui/nll/issue-57642-higher-ranked-subtype.rs",
+"ui/nll/issue-57843.rs",
+"ui/nll/issue-57960.rs",
+"ui/nll/issue-57989.rs",
+"ui/nll/issue-58053.rs",
+"ui/nll/issue-58299.rs",
+"ui/nll/issue-61311-normalize.rs",
+"ui/nll/issue-61320-normalize.rs",
+"ui/nll/issue-61424.rs",
+"ui/nll/issue-62007-assign-const-index.rs",
+"ui/nll/issue-62007-assign-differing-fields.rs",
+"ui/nll/issue-63154-normalize.rs",
+"ui/nll/issue-67007-escaping-data.rs",
+"ui/nll/issue-68550.rs",
+"ui/nll/issue-69114-static-mut-ty.rs",
+"ui/nll/issue-69114-static-ty.rs",
+"ui/nll/issue-73159-rpit-static.rs",
+"ui/nll/issue-75777.rs",
+"ui/nll/issue-78561.rs",
+"ui/nll/issue-95272.rs",
+"ui/nll/issue-97997.rs",
+"ui/nll/issue-98170.rs",
+"ui/nll/issue-98589-closures-relate-named-regions.rs",
+"ui/nll/issue-98693.rs",
+"ui/nll/polonius/issue-46589.rs",
+"ui/nll/relate_tys/issue-48071.rs",
+"ui/nll/ty-outlives/issue-53789-1.rs",
+"ui/nll/ty-outlives/issue-53789-2.rs",
+"ui/nll/ty-outlives/issue-55756.rs",
+"ui/nll/user-annotations/issue-54124.rs",
+"ui/nll/user-annotations/issue-54570-bootstrapping.rs",
+"ui/nll/user-annotations/issue-55219.rs",
+"ui/nll/user-annotations/issue-55241.rs",
+"ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.rs",
+"ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs",
+"ui/numbers-arithmetic/issue-105626.rs",
+"ui/numbers-arithmetic/issue-8460-const.rs",
+"ui/numbers-arithmetic/issue-8460.rs",
+"ui/object-safety/issue-102762.rs",
+"ui/object-safety/issue-102933.rs",
+"ui/object-safety/issue-106247.rs",
+"ui/object-safety/issue-19538.rs",
+"ui/on-unimplemented/issue-104140.rs",
+"ui/or-patterns/issue-64879-trailing-before-guard.rs",
+"ui/or-patterns/issue-67514-irrefutable-param.rs",
+"ui/or-patterns/issue-68785-irrefutable-param-with-at.rs",
+"ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs",
+"ui/or-patterns/issue-69875-should-have-been-expanded-earlier.rs",
+"ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs",
+"ui/overloaded/issue-14958.rs",
+"ui/packed/issue-118537-field-offset-ice.rs",
+"ui/packed/issue-118537-field-offset.rs",
+"ui/packed/issue-27060-2.rs",
+"ui/packed/issue-27060.rs",
+"ui/packed/issue-46152.rs",
+"ui/panics/issue-47429-short-backtraces.rs",
+"ui/parser/issue-116781.rs",
+"ui/parser/issues/auxiliary/issue-21146-inc.rs",
+"ui/parser/issues/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.rs",
+"ui/parser/issues/auxiliary/issue-94340-inc.rs",
+"ui/parser/issues/issue-100197-mut-let.rs",
+"ui/parser/issues/issue-101477-enum.rs",
+"ui/parser/issues/issue-101477-let.rs",
+"ui/parser/issues/issue-101540.rs",
+"ui/parser/issues/issue-102182-impl-trait-recover.rs",
+"ui/parser/issues/issue-102806.rs",
+"ui/parser/issues/issue-103143.rs",
+"ui/parser/issues/issue-103381.rs",
+"ui/parser/issues/issue-103425.rs",
+"ui/parser/issues/issue-103451.rs",
+"ui/parser/issues/issue-103748-ICE-wrong-braces.rs",
+"ui/parser/issues/issue-10392-2.rs",
+"ui/parser/issues/issue-10392.rs",
+"ui/parser/issues/issue-104367.rs",
+"ui/parser/issues/issue-104620.rs",
+"ui/parser/issues/issue-104867-inc-dec-2.rs",
+"ui/parser/issues/issue-104867-inc-dec.rs",
+"ui/parser/issues/issue-105209.rs",
+"ui/parser/issues/issue-105366.rs",
+"ui/parser/issues/issue-105634.rs",
+"ui/parser/issues/issue-10636-1.rs",
+"ui/parser/issues/issue-10636-2.rs",
+"ui/parser/issues/issue-107705.rs",
+"ui/parser/issues/issue-108109-fn-missing-params.rs",
+"ui/parser/issues/issue-108109-fn-trait-missing-paren.rs",
+"ui/parser/issues/issue-108242-semicolon-recovery.rs",
+"ui/parser/issues/issue-108495-dec.rs",
+"ui/parser/issues/issue-110014.rs",
+"ui/parser/issues/issue-111148.rs",
+"ui/parser/issues/issue-111416.rs",
+"ui/parser/issues/issue-111692.rs",
+"ui/parser/issues/issue-112188.rs",
+"ui/parser/issues/issue-112458.rs",
+"ui/parser/issues/issue-113110-non-item-at-module-root.rs",
+"ui/parser/issues/issue-113203.rs",
+"ui/parser/issues/issue-113342.rs",
+"ui/parser/issues/issue-114219.rs",
+"ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs",
+"ui/parser/issues/issue-118530-ice.rs",
+"ui/parser/issues/issue-118531-ice.rs",
+"ui/parser/issues/issue-13483.rs",
+"ui/parser/issues/issue-14303-fncall.rs",
+"ui/parser/issues/issue-14303.rs",
+"ui/parser/issues/issue-15914.rs",
+"ui/parser/issues/issue-15980.rs",
+"ui/parser/issues/issue-1655.rs",
+"ui/parser/issues/issue-17718-const-mut.rs",
+"ui/parser/issues/issue-17718-parse-const.rs",
+"ui/parser/issues/issue-17904-2.rs",
+"ui/parser/issues/issue-17904.rs",
+"ui/parser/issues/issue-1802-1.rs",
+"ui/parser/issues/issue-1802-2.rs",
+"ui/parser/issues/issue-19096.rs",
+"ui/parser/issues/issue-19398.rs",
+"ui/parser/issues/issue-20616-1.rs",
+"ui/parser/issues/issue-20616-2.rs",
+"ui/parser/issues/issue-20616-3.rs",
+"ui/parser/issues/issue-20616-4.rs",
+"ui/parser/issues/issue-20616-5.rs",
+"ui/parser/issues/issue-20616-6.rs",
+"ui/parser/issues/issue-20616-7.rs",
+"ui/parser/issues/issue-20616-8.rs",
+"ui/parser/issues/issue-20616-9.rs",
+"ui/parser/issues/issue-20711-2.rs",
+"ui/parser/issues/issue-20711.rs",
+"ui/parser/issues/issue-21146.rs",
+"ui/parser/issues/issue-21153.rs",
+"ui/parser/issues/issue-21475.rs",
+"ui/parser/issues/issue-22647.rs",
+"ui/parser/issues/issue-22712.rs",
+"ui/parser/issues/issue-2354-1.rs",
+"ui/parser/issues/issue-2354.rs",
+"ui/parser/issues/issue-23620-invalid-escapes.rs",
+"ui/parser/issues/issue-24197.rs",
+"ui/parser/issues/issue-24375.rs",
+"ui/parser/issues/issue-24780.rs",
+"ui/parser/issues/issue-27255.rs",
+"ui/parser/issues/issue-30318.rs",
+"ui/parser/issues/issue-3036.rs",
+"ui/parser/issues/issue-31804.rs",
+"ui/parser/issues/issue-32214.rs",
+"ui/parser/issues/issue-32446.rs",
+"ui/parser/issues/issue-32501.rs",
+"ui/parser/issues/issue-32505.rs",
+"ui/parser/issues/issue-33262.rs",
+"ui/parser/issues/issue-33413.rs",
+"ui/parser/issues/issue-33418.rs",
+"ui/parser/issues/issue-33455.rs",
+"ui/parser/issues/issue-34222-1.rs",
+"ui/parser/issues/issue-34255-1.rs",
+"ui/parser/issues/issue-35813-postfix-after-cast.rs",
+"ui/parser/issues/issue-39616.rs",
+"ui/parser/issues/issue-41155.rs",
+"ui/parser/issues/issue-43196.rs",
+"ui/parser/issues/issue-43692.rs",
+"ui/parser/issues/issue-44021.rs",
+"ui/parser/issues/issue-44406.rs",
+"ui/parser/issues/issue-45296.rs",
+"ui/parser/issues/issue-46186.rs",
+"ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs",
+"ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items.rs",
+"ui/parser/issues/issue-48508-aux.rs",
+"ui/parser/issues/issue-48508.rs",
+"ui/parser/issues/issue-48636.rs",
+"ui/parser/issues/issue-49040.rs",
+"ui/parser/issues/issue-49257.rs",
+"ui/parser/issues/issue-51602.rs",
+"ui/parser/issues/issue-52496.rs",
+"ui/parser/issues/issue-54521-1.rs",
+"ui/parser/issues/issue-54521-2.rs",
+"ui/parser/issues/issue-54521-3.rs",
+"ui/parser/issues/issue-5544-a.rs",
+"ui/parser/issues/issue-5544-b.rs",
+"ui/parser/issues/issue-56031.rs",
+"ui/parser/issues/issue-57198.rs",
+"ui/parser/issues/issue-57684.rs",
+"ui/parser/issues/issue-57819.rs",
+"ui/parser/issues/issue-5806.rs",
+"ui/parser/issues/issue-58094-missing-right-square-bracket.rs",
+"ui/parser/issues/issue-58856-1.rs",
+"ui/parser/issues/issue-58856-2.rs",
+"ui/parser/issues/issue-59418.rs",
+"ui/parser/issues/issue-60075.rs",
+"ui/parser/issues/issue-61858.rs",
+"ui/parser/issues/issue-62524.rs",
+"ui/parser/issues/issue-62546.rs",
+"ui/parser/issues/issue-62554.rs",
+"ui/parser/issues/issue-62660.rs",
+"ui/parser/issues/issue-62881.rs",
+"ui/parser/issues/issue-62894.rs",
+"ui/parser/issues/issue-62895.rs",
+"ui/parser/issues/issue-62913.rs",
+"ui/parser/issues/issue-62973.rs",
+"ui/parser/issues/issue-63115-range-pat-interpolated.rs",
+"ui/parser/issues/issue-63116.rs",
+"ui/parser/issues/issue-63135.rs",
+"ui/parser/issues/issue-64732.rs",
+"ui/parser/issues/issue-65041-empty-vis-matcher-in-enum.rs",
+"ui/parser/issues/issue-65041-empty-vis-matcher-in-trait.rs",
+"ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.rs",
+"ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs",
+"ui/parser/issues/issue-65846-rollback-gating-failing-matcher.rs",
+"ui/parser/issues/issue-6610.rs",
+"ui/parser/issues/issue-66357-unexpected-unreachable.rs",
+"ui/parser/issues/issue-66473.rs",
+"ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs",
+"ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs",
+"ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.rs",
+"ui/parser/issues/issue-68091-unicode-ident-after-if.rs",
+"ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs",
+"ui/parser/issues/issue-68629.rs",
+"ui/parser/issues/issue-68730.rs",
+"ui/parser/issues/issue-68788-in-trait-item-propagation.rs",
+"ui/parser/issues/issue-68890-2.rs",
+"ui/parser/issues/issue-68890.rs",
+"ui/parser/issues/issue-68987-unmatch-issue-1.rs",
+"ui/parser/issues/issue-68987-unmatch-issue-2.rs",
+"ui/parser/issues/issue-68987-unmatch-issue-3.rs",
+"ui/parser/issues/issue-68987-unmatch-issue.rs",
+"ui/parser/issues/issue-69259.rs",
+"ui/parser/issues/issue-70050-ntliteral-accepts-negated-lit.rs",
+"ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.rs",
+"ui/parser/issues/issue-70388-without-witness.rs",
+"ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.rs",
+"ui/parser/issues/issue-70552-ascription-in-parens-after-call.rs",
+"ui/parser/issues/issue-70583-block-is-empty-1.rs",
+"ui/parser/issues/issue-70583-block-is-empty-2.rs",
+"ui/parser/issues/issue-7222.rs",
+"ui/parser/issues/issue-72253.rs",
+"ui/parser/issues/issue-72373.rs",
+"ui/parser/issues/issue-73568-lifetime-after-mut.rs",
+"ui/parser/issues/issue-75599.rs",
+"ui/parser/issues/issue-76437-async.rs",
+"ui/parser/issues/issue-76437-const-async-unsafe.rs",
+"ui/parser/issues/issue-76437-const-async.rs",
+"ui/parser/issues/issue-76437-const.rs",
+"ui/parser/issues/issue-76437-pub-crate-unsafe.rs",
+"ui/parser/issues/issue-76437-unsafe.rs",
+"ui/parser/issues/issue-76597.rs",
+"ui/parser/issues/issue-7970b.rs",
+"ui/parser/issues/issue-81804.rs",
+"ui/parser/issues/issue-81806.rs",
+"ui/parser/issues/issue-81827.rs",
+"ui/parser/issues/issue-83639.rs",
+"ui/parser/issues/issue-84104.rs",
+"ui/parser/issues/issue-84117.rs",
+"ui/parser/issues/issue-84148-1.rs",
+"ui/parser/issues/issue-84148-2.rs",
+"ui/parser/issues/issue-8537.rs",
+"ui/parser/issues/issue-86895.rs",
+"ui/parser/issues/issue-87086-colon-path-sep.rs",
+"ui/parser/issues/issue-87197-missing-semicolon.rs",
+"ui/parser/issues/issue-87635.rs",
+"ui/parser/issues/issue-87694-duplicated-pub.rs",
+"ui/parser/issues/issue-87694-misplaced-pub.rs",
+"ui/parser/issues/issue-87812-path.rs",
+"ui/parser/issues/issue-87812.rs",
+"ui/parser/issues/issue-88276-unary-plus.rs",
+"ui/parser/issues/issue-88583-union-as-ident.rs",
+"ui/parser/issues/issue-88770.rs",
+"ui/parser/issues/issue-88818.rs",
+"ui/parser/issues/issue-89388.rs",
+"ui/parser/issues/issue-89396.rs",
+"ui/parser/issues/issue-89574.rs",
+"ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs",
+"ui/parser/issues/issue-90728.rs",
+"ui/parser/issues/issue-90993.rs",
+"ui/parser/issues/issue-91421.rs",
+"ui/parser/issues/issue-91461.rs",
+"ui/parser/issues/issue-93282.rs",
+"ui/parser/issues/issue-93867.rs",
+"ui/parser/issues/issue-94340.rs",
+"ui/parser/issues/issue-98601-delimiter-error-1.rs",
+"ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs",
+"ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs",
+"ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs",
+"ui/parser/macro/issue-33569.rs",
+"ui/parser/macro/issue-37113.rs",
+"ui/parser/macro/issue-37234.rs",
+"ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.rs",
+"ui/parser/shebang/issue-71471-ignore-tidy.rs",
+"ui/pattern/issue-10392.rs",
+"ui/pattern/issue-106552.rs",
+"ui/pattern/issue-106862.rs",
+"ui/pattern/issue-110508.rs",
+"ui/pattern/issue-114896.rs",
+"ui/pattern/issue-115599.rs",
+"ui/pattern/issue-11577.rs",
+"ui/pattern/issue-117626.rs",
+"ui/pattern/issue-12582.rs",
+"ui/pattern/issue-14221.rs",
+"ui/pattern/issue-15080.rs",
+"ui/pattern/issue-17718-patterns.rs",
+"ui/pattern/issue-22546.rs",
+"ui/pattern/issue-27320.rs",
+"ui/pattern/issue-28992-empty.rs",
+"ui/pattern/issue-52240.rs",
+"ui/pattern/issue-6449.rs",
+"ui/pattern/issue-66270-pat-struct-parser-recovery.rs",
+"ui/pattern/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs",
+"ui/pattern/issue-67776-match-same-name-enum-variant-refs.rs",
+"ui/pattern/issue-68393-let-pat-assoc-constant.rs",
+"ui/pattern/issue-72565.rs",
+"ui/pattern/issue-72574-1.rs",
+"ui/pattern/issue-72574-2.rs",
+"ui/pattern/issue-74539.rs",
+"ui/pattern/issue-74702.rs",
+"ui/pattern/issue-74954.rs",
+"ui/pattern/issue-80186-mut-binding-help-suggestion.rs",
+"ui/pattern/issue-8351-1.rs",
+"ui/pattern/issue-8351-2.rs",
+"ui/pattern/issue-88074-pat-range-type-inference-err.rs",
+"ui/pattern/issue-88074-pat-range-type-inference.rs",
+"ui/pattern/issue-92074-macro-ice.rs",
+"ui/pattern/issue-94866.rs",
+"ui/pattern/issue-95878.rs",
+"ui/pattern/move-ref-patterns/issue-53840.rs",
+"ui/pattern/usefulness/integer-ranges/issue-117648-overlapping_range_endpoints-false-positive.rs",
+"ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs",
+"ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs",
+"ui/pattern/usefulness/issue-119493-type-error-ice.rs",
+"ui/pattern/usefulness/issue-119778-type-error-ice.rs",
+"ui/pattern/usefulness/issue-12116.rs",
+"ui/pattern/usefulness/issue-12369.rs",
+"ui/pattern/usefulness/issue-13727.rs",
+"ui/pattern/usefulness/issue-15129.rs",
+"ui/pattern/usefulness/issue-2111.rs",
+"ui/pattern/usefulness/issue-30240-b.rs",
+"ui/pattern/usefulness/issue-30240-rpass.rs",
+"ui/pattern/usefulness/issue-30240.rs",
+"ui/pattern/usefulness/issue-3096-1.rs",
+"ui/pattern/usefulness/issue-3096-2.rs",
+"ui/pattern/usefulness/issue-31221.rs",
+"ui/pattern/usefulness/issue-31561.rs",
+"ui/pattern/usefulness/issue-35609.rs",
+"ui/pattern/usefulness/issue-3601.rs",
+"ui/pattern/usefulness/issue-39362.rs",
+"ui/pattern/usefulness/issue-40221.rs",
+"ui/pattern/usefulness/issue-4321.rs",
+"ui/pattern/usefulness/issue-50900.rs",
+"ui/pattern/usefulness/issue-53820-slice-pattern-large-array.rs",
+"ui/pattern/usefulness/issue-56379.rs",
+"ui/pattern/usefulness/issue-57472.rs",
+"ui/pattern/usefulness/issue-65413-constants-and-slices-exhaustiveness.rs",
+"ui/pattern/usefulness/issue-66501.rs",
+"ui/pattern/usefulness/issue-71930-type-of-match-scrutinee.rs",
+"ui/pattern/usefulness/issue-72377.rs",
+"ui/pattern/usefulness/issue-72476-and-89393-associated-type.rs",
+"ui/pattern/usefulness/issue-78123-non-exhaustive-reference.rs",
+"ui/pattern/usefulness/issue-78549-ref-pat-and-str.rs",
+"ui/pattern/usefulness/issue-80501-or-pat-and-macro.rs",
+"ui/pattern/usefulness/issue-82772-match-box-as-struct.rs",
+"ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs",
+"ui/pattern/usefulness/issue-88747.rs",
+"ui/polymorphization/issue-74614.rs",
+"ui/polymorphization/issue-74636.rs",
+"ui/privacy/auxiliary/issue-117997.rs",
+"ui/privacy/auxiliary/issue-119463-extern.rs",
+"ui/privacy/auxiliary/issue-17718-const-privacy.rs",
+"ui/privacy/auxiliary/issue-57264-1.rs",
+"ui/privacy/auxiliary/issue-57264-2.rs",
+"ui/privacy/auxiliary/issue-75907.rs",
+"ui/privacy/auxiliary/issue-92755.rs",
+"ui/privacy/issue-111220-2-tuple-struct-fields-projection.rs",
+"ui/privacy/issue-111220-tuple-struct-fields.rs",
+"ui/privacy/issue-113860-1.rs",
+"ui/privacy/issue-113860-2.rs",
+"ui/privacy/issue-113860.rs",
+"ui/privacy/issue-11593.rs",
+"ui/privacy/issue-117997.rs",
+"ui/privacy/issue-119463.rs",
+"ui/privacy/issue-13641.rs",
+"ui/privacy/issue-17718-const-privacy.rs",
+"ui/privacy/issue-29161.rs",
+"ui/privacy/issue-30079.rs",
+"ui/privacy/issue-46209-private-enum-variant-reexport.rs",
+"ui/privacy/issue-57264-1.rs",
+"ui/privacy/issue-57264-2.rs",
+"ui/privacy/issue-75062-fieldless-tuple-struct.rs",
+"ui/privacy/issue-75906.rs",
+"ui/privacy/issue-75907.rs",
+"ui/privacy/issue-75907_b.rs",
+"ui/privacy/issue-79593.rs",
+"ui/privacy/issue-92755.rs",
+"ui/proc-macro/auxiliary/issue-104884.rs",
+"ui/proc-macro/auxiliary/issue-107113.rs",
+"ui/proc-macro/auxiliary/issue-118809.rs",
+"ui/proc-macro/auxiliary/issue-38586.rs",
+"ui/proc-macro/auxiliary/issue-39889.rs",
+"ui/proc-macro/auxiliary/issue-42708.rs",
+"ui/proc-macro/auxiliary/issue-50061.rs",
+"ui/proc-macro/auxiliary/issue-50493.rs",
+"ui/proc-macro/auxiliary/issue-59191.rs",
+"ui/proc-macro/auxiliary/issue-66286.rs",
+"ui/proc-macro/auxiliary/issue-75801.rs",
+"ui/proc-macro/auxiliary/issue-79242.rs",
+"ui/proc-macro/auxiliary/issue-79825.rs",
+"ui/proc-macro/auxiliary/issue-83510.rs",
+"ui/proc-macro/auxiliary/issue-91800-macro.rs",
+"ui/proc-macro/issue-104884-trait-impl-sugg-err.rs",
+"ui/proc-macro/issue-107113-wrap.rs",
+"ui/proc-macro/issue-118455-skip-err-builtin.rs",
+"ui/proc-macro/issue-118809.rs",
+"ui/proc-macro/issue-36935.rs",
+"ui/proc-macro/issue-37788.rs",
+"ui/proc-macro/issue-38586.rs",
+"ui/proc-macro/issue-39889.rs",
+"ui/proc-macro/issue-42708.rs",
+"ui/proc-macro/issue-50061.rs",
+"ui/proc-macro/issue-50493.rs",
+"ui/proc-macro/issue-53481.rs",
+"ui/proc-macro/issue-59191-replace-root-with-fn.rs",
+"ui/proc-macro/issue-66286.rs",
+"ui/proc-macro/issue-73933-procedural-masquerade.rs",
+"ui/proc-macro/issue-75734-pp-paren.rs",
+"ui/proc-macro/issue-75801.rs",
+"ui/proc-macro/issue-75930-derive-cfg.rs",
+"ui/proc-macro/issue-76182-leading-vert-pat.rs",
+"ui/proc-macro/issue-76270-panic-in-libproc-macro.rs",
+"ui/proc-macro/issue-78675-captured-inner-attrs.rs",
+"ui/proc-macro/issue-79148.rs",
+"ui/proc-macro/issue-79242-slow-retokenize-check.rs",
+"ui/proc-macro/issue-79825.rs",
+"ui/proc-macro/issue-80760-empty-stmt.rs",
+"ui/proc-macro/issue-81007-item-attrs.rs",
+"ui/proc-macro/issue-81543-item-parse-err.rs",
+"ui/proc-macro/issue-81555.rs",
+"ui/proc-macro/issue-83469-global-alloc-invalid-stmt.rs",
+"ui/proc-macro/issue-83510.rs",
+"ui/proc-macro/issue-86781-bad-inner-doc.rs",
+"ui/proc-macro/issue-89566-suggest-fix-invalid-top-level-macro-attr.rs",
+"ui/proc-macro/issue-91800.rs",
+"ui/process/issue-13304.rs",
+"ui/process/issue-14456.rs",
+"ui/process/issue-14940.rs",
+"ui/process/issue-16272.rs",
+"ui/process/issue-20091.rs",
+"ui/ptr_ops/issue-80309-safe.rs",
+"ui/ptr_ops/issue-80309.rs",
+"ui/pub/issue-33174-restricted-type-in-public-interface.rs",
+"ui/query-system/issue-83479.rs",
+"ui/range/issue-54505-no-literals.rs",
+"ui/range/issue-54505-no-std.rs",
+"ui/range/issue-54505.rs",
+"ui/range/issue-73553-misinterp-range-literal.rs",
+"ui/reachable/auxiliary/issue-11225-1.rs",
+"ui/reachable/auxiliary/issue-11225-2.rs",
+"ui/reachable/auxiliary/issue-11225-3.rs",
+"ui/reachable/issue-11225-1.rs",
+"ui/reachable/issue-11225-2.rs",
+"ui/reachable/issue-11225-3.rs",
+"ui/reachable/issue-948.rs",
+"ui/recursion/issue-26548-recursion-via-normalize.rs",
+"ui/recursion/issue-38591-non-regular-dropck-recursion.rs",
+"ui/recursion/issue-83150.rs",
+"ui/recursion/issue-86784.rs",
+"ui/recursion/issue-95134.rs",
+"ui/recursion_limit/issue-105700.rs",
+"ui/recursion_limit/issue-40003.rs",
+"ui/regions/issue-101280.rs",
+"ui/regions/issue-102374.rs",
+"ui/regions/issue-102392.rs",
+"ui/regions/issue-11612.rs",
+"ui/regions/issue-12470.rs",
+"ui/regions/issue-21520.rs",
+"ui/regions/issue-24085.rs",
+"ui/regions/issue-26448-1.rs",
+"ui/regions/issue-26448-2.rs",
+"ui/regions/issue-26448-3.rs",
+"ui/regions/issue-28848.rs",
+"ui/regions/issue-5243.rs",
+"ui/regions/issue-56537-closure-uses-region-from-container.rs",
+"ui/regions/issue-6157.rs",
+"ui/regions/issue-72051-member-region-hang.rs",
+"ui/regions/issue-78262.rs",
+"ui/repr/issue-83505-repr-simd.rs",
+"ui/resolve/auxiliary/issue-112831-aux.rs",
+"ui/resolve/auxiliary/issue-19452-aux.rs",
+"ui/resolve/auxiliary/issue-21221-3.rs",
+"ui/resolve/auxiliary/issue-21221-4.rs",
+"ui/resolve/auxiliary/issue-30535.rs",
+"ui/resolve/auxiliary/issue-3907.rs",
+"ui/resolve/auxiliary/issue-80079.rs",
+"ui/resolve/issue-100365.rs",
+"ui/resolve/issue-101749-2.rs",
+"ui/resolve/issue-101749.rs",
+"ui/resolve/issue-10200.rs",
+"ui/resolve/issue-102946.rs",
+"ui/resolve/issue-103202.rs",
+"ui/resolve/issue-103474.rs",
+"ui/resolve/issue-104700-inner_scope.rs",
+"ui/resolve/issue-105069.rs",
+"ui/resolve/issue-107563-ambiguous-glob-reexports.rs",
+"ui/resolve/issue-108529.rs",
+"ui/resolve/issue-109153.rs",
+"ui/resolve/issue-109250.rs",
+"ui/resolve/issue-111312.rs",
+"ui/resolve/issue-111727.rs",
+"ui/resolve/issue-112472-multi-generics-suggestion.rs",
+"ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs",
+"ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs",
+"ui/resolve/issue-116164.rs",
+"ui/resolve/issue-117920.rs",
+"ui/resolve/issue-118295.rs",
+"ui/resolve/issue-120559.rs",
+"ui/resolve/issue-12796.rs",
+"ui/resolve/issue-14254.rs",
+"ui/resolve/issue-16058.rs",
+"ui/resolve/issue-17518.rs",
+"ui/resolve/issue-18252.rs",
+"ui/resolve/issue-19452.rs",
+"ui/resolve/issue-21221-1.rs",
+"ui/resolve/issue-21221-2.rs",
+"ui/resolve/issue-21221-3.rs",
+"ui/resolve/issue-21221-4.rs",
+"ui/resolve/issue-22692.rs",
+"ui/resolve/issue-2330.rs",
+"ui/resolve/issue-23305.rs",
+"ui/resolve/issue-2356.rs",
+"ui/resolve/issue-23716.rs",
+"ui/resolve/issue-24968.rs",
+"ui/resolve/issue-26545.rs",
+"ui/resolve/issue-3021-c.rs",
+"ui/resolve/issue-3021.rs",
+"ui/resolve/issue-30535.rs",
+"ui/resolve/issue-3099-a.rs",
+"ui/resolve/issue-3099-b.rs",
+"ui/resolve/issue-31845.rs",
+"ui/resolve/issue-33876.rs",
+"ui/resolve/issue-35675.rs",
+"ui/resolve/issue-3907-2.rs",
+"ui/resolve/issue-3907.rs",
+"ui/resolve/issue-39226.rs",
+"ui/resolve/issue-39559-2.rs",
+"ui/resolve/issue-39559.rs",
+"ui/resolve/issue-42944.rs",
+"ui/resolve/issue-49074.rs",
+"ui/resolve/issue-5035-2.rs",
+"ui/resolve/issue-5035.rs",
+"ui/resolve/issue-50599.rs",
+"ui/resolve/issue-5099.rs",
+"ui/resolve/issue-54379.rs",
+"ui/resolve/issue-55673.rs",
+"ui/resolve/issue-57523.rs",
+"ui/resolve/issue-5927.rs",
+"ui/resolve/issue-60057.rs",
+"ui/resolve/issue-65025-extern-static-parent-generics.rs",
+"ui/resolve/issue-65035-static-with-parent-generics.rs",
+"ui/resolve/issue-6642.rs",
+"ui/resolve/issue-6702.rs",
+"ui/resolve/issue-69401-trait-fn-no-body-ty-local.rs",
+"ui/resolve/issue-70736-async-fn-no-body-def-collector.rs",
+"ui/resolve/issue-73427.rs",
+"ui/resolve/issue-80079.rs",
+"ui/resolve/issue-81508.rs",
+"ui/resolve/issue-82156.rs",
+"ui/resolve/issue-82865.rs",
+"ui/resolve/issue-85348.rs",
+"ui/resolve/issue-85671.rs",
+"ui/resolve/issue-88472.rs",
+"ui/resolve/issue-90113.rs",
+"ui/return/issue-64620.rs",
+"ui/return/issue-82612-return-mutable-reference.rs",
+"ui/return/issue-86188-return-not-in-fn-body.rs",
+"ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.rs",
+"ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.rs",
+"ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs",
+"ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.rs",
+"ui/rfcs/rfc-1937-termination-trait/issue-103052-1.rs",
+"ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs",
+"ui/rfcs/rfc-2005-default-binding-mode/issue-44912-or.rs",
+"ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs",
+"ui/rfcs/rfc-2093-infer-outlives/issue-54467.rs",
+"ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs",
+"ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs",
+"ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs",
+"ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs",
+"ui/rfcs/rfc-2497-if-let-chains/issue-88498.rs",
+"ui/rfcs/rfc-2497-if-let-chains/issue-90722.rs",
+"ui/rfcs/rfc-2497-if-let-chains/issue-92145.rs",
+"ui/rfcs/rfc-2497-if-let-chains/issue-93150.rs",
+"ui/rfcs/rfc-2497-if-let-chains/issue-99938.rs",
+"ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs",
+"ui/rfcs/rfc-2528-type-changing-struct-update/issue-96878.rs",
+"ui/rfcs/rfc-2565-param-attrs/issue-64682-dropping-first-attrs-in-impl-fns.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/issue-100222.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/issue-102156.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/issue-102985.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/issue-103677.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/issue-79450.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/issue-88155.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/issue-92111.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/issue-92230-wf-super-trait-env.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs",
+"ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs",
+"ui/rust-2018/issue-51008-1.rs",
+"ui/rust-2018/issue-51008.rs",
+"ui/rust-2018/issue-52202-use-suggestions.rs",
+"ui/rust-2018/issue-54006.rs",
+"ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs",
+"ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs",
+"ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs",
+"ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs",
+"ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs",
+"ui/rust-2018/uniform-paths/issue-54253.rs",
+"ui/rust-2018/uniform-paths/issue-55779.rs",
+"ui/rust-2018/uniform-paths/issue-56596-2.rs",
+"ui/rust-2018/uniform-paths/issue-56596.rs",
+"ui/rust-2018/uniform-paths/issue-87932.rs",
+"ui/sanitize/issue-111184-coroutine-witness.rs",
+"ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs",
+"ui/sanitize/issue-72154-lifetime-markers.rs",
+"ui/self/issue-61882-2.rs",
+"ui/self/issue-61882.rs",
+"ui/simd/intrinsic/issue-85855.rs",
+"ui/simd/issue-105439.rs",
+"ui/simd/issue-17170.rs",
+"ui/simd/issue-32947.rs",
+"ui/simd/issue-39720.rs",
+"ui/simd/issue-85915-simd-ptrs.rs",
+"ui/simd/issue-89193.rs",
+"ui/single-use-lifetime/issue-104440.rs",
+"ui/single-use-lifetime/issue-107998.rs",
+"ui/single-use-lifetime/issue-117965.rs",
+"ui/span/issue-107353.rs",
+"ui/span/issue-11925.rs",
+"ui/span/issue-15480.rs",
+"ui/span/issue-23338-locals-die-before-temps-of-body.rs",
+"ui/span/issue-23729.rs",
+"ui/span/issue-23827.rs",
+"ui/span/issue-24356.rs",
+"ui/span/issue-24690.rs",
+"ui/span/issue-24805-dropck-child-has-items-via-parent.rs",
+"ui/span/issue-24805-dropck-trait-has-items.rs",
+"ui/span/issue-24895-copy-clone-dropck.rs",
+"ui/span/issue-25199.rs",
+"ui/span/issue-26656.rs",
+"ui/span/issue-27522.rs",
+"ui/span/issue-29106.rs",
+"ui/span/issue-29595.rs",
+"ui/span/issue-33884.rs",
+"ui/span/issue-34264.rs",
+"ui/span/issue-35987.rs",
+"ui/span/issue-36537.rs",
+"ui/span/issue-37767.rs",
+"ui/span/issue-39018.rs",
+"ui/span/issue-39698.rs",
+"ui/span/issue-40157.rs",
+"ui/span/issue-42234-unknown-receiver-type.rs",
+"ui/span/issue-43927-non-ADT-derive.rs",
+"ui/span/issue-71363.rs",
+"ui/span/issue-81800.rs",
+"ui/span/issue28498-reject-ex1.rs",
+"ui/span/issue28498-reject-lifetime-param.rs",
+"ui/span/issue28498-reject-passed-to-fn.rs",
+"ui/span/issue28498-reject-trait-bound.rs",
+"ui/specialization/issue-111232.rs",
+"ui/specialization/issue-33017.rs",
+"ui/specialization/issue-35376.rs",
+"ui/specialization/issue-36804.rs",
+"ui/specialization/issue-38091-2.rs",
+"ui/specialization/issue-38091.rs",
+"ui/specialization/issue-39448.rs",
+"ui/specialization/issue-39618.rs",
+"ui/specialization/issue-40582.rs",
+"ui/specialization/issue-43037.rs",
+"ui/specialization/issue-44861.rs",
+"ui/specialization/issue-45814.rs",
+"ui/specialization/issue-50452-fail.rs",
+"ui/specialization/issue-50452.rs",
+"ui/specialization/issue-51892.rs",
+"ui/specialization/issue-52050.rs",
+"ui/specialization/issue-59435.rs",
+"ui/specialization/issue-63716-parse-async.rs",
+"ui/specialization/issue-68830-spurious-diagnostics.rs",
+"ui/specialization/issue-70442.rs",
+"ui/specialization/min_specialization/issue-79224.rs",
+"ui/stability-attribute/issue-106589.rs",
+"ui/stability-attribute/issue-109177.rs",
+"ui/stability-attribute/issue-28075.rs",
+"ui/stability-attribute/issue-28388-3.rs",
+"ui/stability-attribute/issue-99286-stable-intrinsics.rs",
+"ui/static/auxiliary/issue_24843.rs",
+"ui/static/issue-18118-2.rs",
+"ui/static/issue-18118.rs",
+"ui/static/issue-24843.rs",
+"ui/static/issue-34194.rs",
+"ui/static/issue-5216.rs",
+"ui/statics/issue-14227.rs",
+"ui/statics/issue-15261.rs",
+"ui/statics/issue-17233.rs",
+"ui/statics/issue-17718-static-sync.rs",
+"ui/statics/issue-17718-static-unsafe-interior.rs",
+"ui/statics/issue-44373-2.rs",
+"ui/statics/issue-44373.rs",
+"ui/statics/issue-91050-1.rs",
+"ui/statics/issue-91050-2.rs",
+"ui/std/issue-81357-unsound-file-methods.rs",
+"ui/stdlib-unit-tests/issue-21058.rs",
+"ui/structs-enums/enum-rec/issue-17431-6.rs",
+"ui/structs-enums/enum-rec/issue-17431-7.rs",
+"ui/structs-enums/issue-103869.rs",
+"ui/structs-enums/issue-1701.rs",
+"ui/structs-enums/issue-2718-a.rs",
+"ui/structs-enums/issue-3008-1.rs",
+"ui/structs-enums/issue-3008-2.rs",
+"ui/structs-enums/issue-3008-3.rs",
+"ui/structs-enums/issue-38002.rs",
+"ui/structs-enums/issue-50731.rs",
+"ui/structs-enums/struct-rec/issue-17431-1.rs",
+"ui/structs-enums/struct-rec/issue-17431-2.rs",
+"ui/structs-enums/struct-rec/issue-17431-3.rs",
+"ui/structs-enums/struct-rec/issue-17431-4.rs",
+"ui/structs-enums/struct-rec/issue-17431-5.rs",
+"ui/structs-enums/struct-rec/issue-74224.rs",
+"ui/structs-enums/struct-rec/issue-84611.rs",
+"ui/structs/issue-80853.rs",
+"ui/suggestions/auxiliary/issue-61963-1.rs",
+"ui/suggestions/auxiliary/issue-61963.rs",
+"ui/suggestions/auxiliary/issue-81839.rs",
+"ui/suggestions/issue-101065.rs",
+"ui/suggestions/issue-101421.rs",
+"ui/suggestions/issue-101465.rs",
+"ui/suggestions/issue-101623.rs",
+"ui/suggestions/issue-101984.rs",
+"ui/suggestions/issue-102354.rs",
+"ui/suggestions/issue-102892.rs",
+"ui/suggestions/issue-102972.rs",
+"ui/suggestions/issue-103112.rs",
+"ui/suggestions/issue-103646.rs",
+"ui/suggestions/issue-104086-suggest-let.rs",
+"ui/suggestions/issue-104287.rs",
+"ui/suggestions/issue-104327.rs",
+"ui/suggestions/issue-104328.rs",
+"ui/suggestions/issue-104961.rs",
+"ui/suggestions/issue-105226.rs",
+"ui/suggestions/issue-105494.rs",
+"ui/suggestions/issue-105645.rs",
+"ui/suggestions/issue-105761-suggest-self-for-closure.rs",
+"ui/suggestions/issue-106443-sugg-clone-for-arg.rs",
+"ui/suggestions/issue-106443-sugg-clone-for-bound.rs",
+"ui/suggestions/issue-107860.rs",
+"ui/suggestions/issue-108470.rs",
+"ui/suggestions/issue-109195.rs",
+"ui/suggestions/issue-109291.rs",
+"ui/suggestions/issue-109396.rs",
+"ui/suggestions/issue-109436.rs",
+"ui/suggestions/issue-109854.rs",
+"ui/suggestions/issue-109991.rs",
+"ui/suggestions/issue-112590-suggest-import.rs",
+"ui/suggestions/issue-114701.rs",
+"ui/suggestions/issue-114797-bad-parentheses-dyn-trait.rs",
+"ui/suggestions/issue-116434-2015.rs",
+"ui/suggestions/issue-116434-2021.rs",
+"ui/suggestions/issue-117669.rs",
+"ui/suggestions/issue-21673.rs",
+"ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.rs",
+"ui/suggestions/issue-52820.rs",
+"ui/suggestions/issue-53692.rs",
+"ui/suggestions/issue-57672.rs",
+"ui/suggestions/issue-59819.rs",
+"ui/suggestions/issue-61226.rs",
+"ui/suggestions/issue-61963.rs",
+"ui/suggestions/issue-62843.rs",
+"ui/suggestions/issue-64252-self-type.rs",
+"ui/suggestions/issue-66968-suggest-sorted-words.rs",
+"ui/suggestions/issue-68049-1.rs",
+"ui/suggestions/issue-68049-2.rs",
+"ui/suggestions/issue-71394-no-from-impl.rs",
+"ui/suggestions/issue-72766.rs",
+"ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs",
+"ui/suggestions/issue-81098.rs",
+"ui/suggestions/issue-81839.rs",
+"ui/suggestions/issue-82361.rs",
+"ui/suggestions/issue-82566-1.rs",
+"ui/suggestions/issue-82566-2.rs",
+"ui/suggestions/issue-83892.rs",
+"ui/suggestions/issue-83943.rs",
+"ui/suggestions/issue-84592.rs",
+"ui/suggestions/issue-84700.rs",
+"ui/suggestions/issue-84973-2.rs",
+"ui/suggestions/issue-84973-blacklist.rs",
+"ui/suggestions/issue-84973-negative.rs",
+"ui/suggestions/issue-84973.rs",
+"ui/suggestions/issue-85347.rs",
+"ui/suggestions/issue-85943-no-suggest-unsized-indirection-in-where-clause.rs",
+"ui/suggestions/issue-85945-check-where-clause-before-suggesting-unsized.rs",
+"ui/suggestions/issue-86100-tuple-paren-comma.rs",
+"ui/suggestions/issue-86667.rs",
+"ui/suggestions/issue-88696.rs",
+"ui/suggestions/issue-88730.rs",
+"ui/suggestions/issue-89064.rs",
+"ui/suggestions/issue-89333.rs",
+"ui/suggestions/issue-89640.rs",
+"ui/suggestions/issue-90213-expected-boxfuture-self-ice.rs",
+"ui/suggestions/issue-90974.rs",
+"ui/suggestions/issue-94171.rs",
+"ui/suggestions/issue-96223.rs",
+"ui/suggestions/issue-96555.rs",
+"ui/suggestions/issue-97677.rs",
+"ui/suggestions/issue-97704.rs",
+"ui/suggestions/issue-97760.rs",
+"ui/suggestions/issue-98500.rs",
+"ui/suggestions/issue-98562.rs",
+"ui/suggestions/issue-99080.rs",
+"ui/suggestions/issue-99240-2.rs",
+"ui/suggestions/issue-99240.rs",
+"ui/suggestions/issue-99597.rs",
+"ui/suggestions/lifetimes/issue-105544.rs",
+"ui/symbol-names/issue-53912.rs",
+"ui/symbol-names/issue-60925.rs",
+"ui/symbol-names/issue-75326.rs",
+"ui/symbol-names/issue-76365.rs",
+"ui/test-attrs/custom-test-frameworks/issue-107454.rs",
+"ui/test-attrs/issue-109816.rs",
+"ui/test-attrs/issue-12997-1.rs",
+"ui/test-attrs/issue-12997-2.rs",
+"ui/test-attrs/issue-16597-empty.rs",
+"ui/test-attrs/issue-16597.rs",
+"ui/test-attrs/issue-20823.rs",
+"ui/test-attrs/issue-34932.rs",
+"ui/test-attrs/issue-36768.rs",
+"ui/test-attrs/issue-52557.rs",
+"ui/test-attrs/issue-53675-a-test-called-panic.rs",
+"ui/threads-sendsync/issue-24313.rs",
+"ui/threads-sendsync/issue-29488.rs",
+"ui/threads-sendsync/issue-43733-2.rs",
+"ui/threads-sendsync/issue-43733.rs",
+"ui/threads-sendsync/issue-4446.rs",
+"ui/threads-sendsync/issue-4448.rs",
+"ui/threads-sendsync/issue-8827.rs",
+"ui/threads-sendsync/issue-9396.rs",
+"ui/trait-bounds/issue-119530-sugg-from-fn.rs",
+"ui/trait-bounds/issue-75961.rs",
+"ui/trait-bounds/issue-82038.rs",
+"ui/trait-bounds/issue-93008.rs",
+"ui/trait-bounds/issue-94680.rs",
+"ui/trait-bounds/issue-94999.rs",
+"ui/trait-bounds/issue-95640.rs",
+"ui/traits/alias/issue-107747-do-not-assemble-supertraits.rs",
+"ui/traits/alias/issue-108072-unmet-trait-alias-bound.rs",
+"ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs",
+"ui/traits/alias/issue-60021-assoc-method-resolve.rs",
+"ui/traits/alias/issue-60755.rs",
+"ui/traits/alias/issue-72415-assoc-const-resolve.rs",
+"ui/traits/alias/issue-75983.rs",
+"ui/traits/alias/issue-83613.rs",
+"ui/traits/associated_type_bound/issue-51446.rs",
+"ui/traits/auxiliary/issue_89119_intercrate_caching.rs",
+"ui/traits/issue-103563.rs",
+"ui/traits/issue-104322.rs",
+"ui/traits/issue-105231.rs",
+"ui/traits/issue-106072.rs",
+"ui/traits/issue-117794.rs",
+"ui/traits/issue-18400.rs",
+"ui/traits/issue-18412.rs",
+"ui/traits/issue-20692.rs",
+"ui/traits/issue-22019.rs",
+"ui/traits/issue-22110.rs",
+"ui/traits/issue-22384.rs",
+"ui/traits/issue-22655.rs",
+"ui/traits/issue-23003-overflow.rs",
+"ui/traits/issue-23003.rs",
+"ui/traits/issue-23825.rs",
+"ui/traits/issue-24010.rs",
+"ui/traits/issue-26339.rs",
+"ui/traits/issue-28576.rs",
+"ui/traits/issue-32963.rs",
+"ui/traits/issue-33096.rs",
+"ui/traits/issue-33140-hack-boundaries.rs",
+"ui/traits/issue-33140.rs",
+"ui/traits/issue-35869.rs",
+"ui/traits/issue-3683.rs",
+"ui/traits/issue-38033.rs",
+"ui/traits/issue-38404.rs",
+"ui/traits/issue-38604.rs",
+"ui/traits/issue-3973.rs",
+"ui/traits/issue-40085.rs",
+"ui/traits/issue-4107.rs",
+"ui/traits/issue-43132.rs",
+"ui/traits/issue-43784-supertrait.rs",
+"ui/traits/issue-5008-borrowed-traitobject-method-call.rs",
+"ui/traits/issue-50480.rs",
+"ui/traits/issue-52893.rs",
+"ui/traits/issue-56202.rs",
+"ui/traits/issue-56488.rs",
+"ui/traits/issue-58344.rs",
+"ui/traits/issue-59029-1.rs",
+"ui/traits/issue-59029-2.rs",
+"ui/traits/issue-6128.rs",
+"ui/traits/issue-6334.rs",
+"ui/traits/issue-65284-suggest-generic-trait-bound.rs",
+"ui/traits/issue-65673.rs",
+"ui/traits/issue-66768.rs",
+"ui/traits/issue-68295.rs",
+"ui/traits/issue-7013.rs",
+"ui/traits/issue-70944.rs",
+"ui/traits/issue-71036.rs",
+"ui/traits/issue-71136.rs",
+"ui/traits/issue-72410.rs",
+"ui/traits/issue-72455.rs",
+"ui/traits/issue-75627.rs",
+"ui/traits/issue-77982.rs",
+"ui/traits/issue-78372.rs",
+"ui/traits/issue-78632.rs",
+"ui/traits/issue-79458.rs",
+"ui/traits/issue-8153.rs",
+"ui/traits/issue-82830.rs",
+"ui/traits/issue-83538-tainted-cache-after-cycle.rs",
+"ui/traits/issue-84399-bad-fresh-caching.rs",
+"ui/traits/issue-85360-eval-obligation-ice.rs",
+"ui/traits/issue-85735.rs",
+"ui/traits/issue-87558.rs",
+"ui/traits/issue-89119.rs",
+"ui/traits/issue-90195-2.rs",
+"ui/traits/issue-90195.rs",
+"ui/traits/issue-90662-projection-caching.rs",
+"ui/traits/issue-91594.rs",
+"ui/traits/issue-91949-hangs-on-recursion.rs",
+"ui/traits/issue-92292.rs",
+"ui/traits/issue-9394-inherited-calls.rs",
+"ui/traits/issue-95311.rs",
+"ui/traits/issue-95898.rs",
+"ui/traits/issue-96664.rs",
+"ui/traits/issue-96665.rs",
+"ui/traits/issue-97576.rs",
+"ui/traits/issue-97695-double-trivial-bound.rs",
+"ui/traits/issue-99875.rs",
+"ui/traits/next-solver/coherence/issue-102048.rs",
+"ui/traits/next-solver/issue-118950-root-region.rs",
+"ui/traits/object/issue-33140-traitobject-crate.rs",
+"ui/traits/object/issue-44454-1.rs",
+"ui/traits/object/issue-44454-2.rs",
+"ui/traits/object/issue-44454-3.rs",
+"ui/traits/suggest-dereferences/issue-39029.rs",
+"ui/traits/suggest-dereferences/issue-62530.rs",
+"ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs",
+"ui/traits/trait-upcasting/issue-11515.rs",
+"ui/traits/vtable/issue-91807.rs",
+"ui/traits/vtable/issue-97381.rs",
+"ui/transmutability/arrays/issue-103783-array-length.rs",
+"ui/transmutability/issue-101739-1.rs",
+"ui/transmutability/issue-101739-2.rs",
+"ui/transmutability/issue-110467.rs",
+"ui/transmutability/issue-110892.rs",
+"ui/transmute/issue-115402-overflow-size.rs",
+"ui/trivial-bounds/issue-73021-impossible-inline.rs",
+"ui/try-block/issue-45124.rs",
+"ui/try-trait/issue-32709.rs",
+"ui/type-alias-enum-variants/issue-57866.rs",
+"ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs",
+"ui/type-alias-enum-variants/issue-63151-dead-code-lint-fields-in-patterns.rs",
+"ui/type-alias-impl-trait/issue-101750.rs",
+"ui/type-alias-impl-trait/issue-104817.rs",
+"ui/type-alias-impl-trait/issue-109054.rs",
+"ui/type-alias-impl-trait/issue-52843-closure-constrain.rs",
+"ui/type-alias-impl-trait/issue-52843.rs",
+"ui/type-alias-impl-trait/issue-53092-2.rs",
+"ui/type-alias-impl-trait/issue-53092.rs",
+"ui/type-alias-impl-trait/issue-53096.rs",
+"ui/type-alias-impl-trait/issue-53398-cyclic-types.rs",
+"ui/type-alias-impl-trait/issue-53598.rs",
+"ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs",
+"ui/type-alias-impl-trait/issue-55099-lifetime-inference.rs",
+"ui/type-alias-impl-trait/issue-57188-associate-impl-capture.rs",
+"ui/type-alias-impl-trait/issue-57611-trait-alias.rs",
+"ui/type-alias-impl-trait/issue-57700.rs",
+"ui/type-alias-impl-trait/issue-57807-associated-type.rs",
+"ui/type-alias-impl-trait/issue-57961.rs",
+"ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs",
+"ui/type-alias-impl-trait/issue-58662-simplified.rs",
+"ui/type-alias-impl-trait/issue-58887.rs",
+"ui/type-alias-impl-trait/issue-58951-2.rs",
+"ui/type-alias-impl-trait/issue-58951.rs",
+"ui/type-alias-impl-trait/issue-60371.rs",
+"ui/type-alias-impl-trait/issue-60407.rs",
+"ui/type-alias-impl-trait/issue-60564-working.rs",
+"ui/type-alias-impl-trait/issue-60564.rs",
+"ui/type-alias-impl-trait/issue-60662.rs",
+"ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs",
+"ui/type-alias-impl-trait/issue-63263-closure-return.rs",
+"ui/type-alias-impl-trait/issue-63279.rs",
+"ui/type-alias-impl-trait/issue-63355.rs",
+"ui/type-alias-impl-trait/issue-63677-type-alias-coherence.rs",
+"ui/type-alias-impl-trait/issue-65384.rs",
+"ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs",
+"ui/type-alias-impl-trait/issue-65918.rs",
+"ui/type-alias-impl-trait/issue-66580-closure-coherence.rs",
+"ui/type-alias-impl-trait/issue-67844-nested-opaque.rs",
+"ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs",
+"ui/type-alias-impl-trait/issue-68368-non-defining-use.rs",
+"ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs",
+"ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-ok.rs",
+"ui/type-alias-impl-trait/issue-69323.rs",
+"ui/type-alias-impl-trait/issue-70121.rs",
+"ui/type-alias-impl-trait/issue-72793.rs",
+"ui/type-alias-impl-trait/issue-74244.rs",
+"ui/type-alias-impl-trait/issue-74280.rs",
+"ui/type-alias-impl-trait/issue-74761-2.rs",
+"ui/type-alias-impl-trait/issue-74761.rs",
+"ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs",
+"ui/type-alias-impl-trait/issue-77179.rs",
+"ui/type-alias-impl-trait/issue-78450.rs",
+"ui/type-alias-impl-trait/issue-84660-trait-impl-for-tait.rs",
+"ui/type-alias-impl-trait/issue-84660-unsoundness.rs",
+"ui/type-alias-impl-trait/issue-87455-static-lifetime-ice.rs",
+"ui/type-alias-impl-trait/issue-89686.rs",
+"ui/type-alias-impl-trait/issue-89952.rs",
+"ui/type-alias-impl-trait/issue-90400-1.rs",
+"ui/type-alias-impl-trait/issue-90400-2.rs",
+"ui/type-alias-impl-trait/issue-93411.rs",
+"ui/type-alias-impl-trait/issue-94429.rs",
+"ui/type-alias-impl-trait/issue-96572-unconstrained-mismatch.rs",
+"ui/type-alias-impl-trait/issue-96572-unconstrained.rs",
+"ui/type-alias-impl-trait/issue-98604.rs",
+"ui/type-alias-impl-trait/issue-98608.rs",
+"ui/type-alias/issue-14933.rs",
+"ui/type-alias/issue-37515.rs",
+"ui/type-alias/issue-62263-self-in-atb.rs",
+"ui/type-alias/issue-62305-self-assoc-ty.rs",
+"ui/type-alias/issue-62364-self-ty-arg.rs",
+"ui/type-inference/issue-113283-alllocator-trait-eq.rs",
+"ui/type-inference/issue-30225.rs",
+"ui/type/ascription/issue-34255-1.rs",
+"ui/type/ascription/issue-47666.rs",
+"ui/type/ascription/issue-54516.rs",
+"ui/type/ascription/issue-60933.rs",
+"ui/type/issue-100584.rs",
+"ui/type/issue-101866.rs",
+"ui/type/issue-102598.rs",
+"ui/type/issue-103271.rs",
+"ui/type/issue-58355.rs",
+"ui/type/issue-67690-type-alias-bound-diagnostic-crash.rs",
+"ui/type/issue-91268.rs",
+"ui/type/issue-94187-verbose-type-name.rs",
+"ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs",
+"ui/type/type-check/issue-22897.rs",
+"ui/type/type-check/issue-40294.rs",
+"ui/type/type-check/issue-41314.rs",
+"ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs",
+"ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs",
+"ui/typeck/auxiliary/issue-29181.rs",
+"ui/typeck/auxiliary/issue-36708.rs",
+"ui/typeck/auxiliary/issue-81943-lib.rs",
+"ui/typeck/issue-100164.rs",
+"ui/typeck/issue-100246.rs",
+"ui/typeck/issue-100285.rs",
+"ui/typeck/issue-103899.rs",
+"ui/typeck/issue-10401.rs",
+"ui/typeck/issue-104510-ice.rs",
+"ui/typeck/issue-104513-ice.rs",
+"ui/typeck/issue-104582.rs",
+"ui/typeck/issue-105946.rs",
+"ui/typeck/issue-106929.rs",
+"ui/typeck/issue-107087.rs",
+"ui/typeck/issue-107775.rs",
+"ui/typeck/issue-10969.rs",
+"ui/typeck/issue-110017-format-into-help-deletes-macro.rs",
+"ui/typeck/issue-110052.rs",
+"ui/typeck/issue-112007-leaked-writeln-macro-internals.rs",
+"ui/typeck/issue-112252-ptr-arithmetics-help.rs",
+"ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs",
+"ui/typeck/issue-114423-ice-regression-in-suggestion.rs",
+"ui/typeck/issue-114529-illegal-break-with-value.rs",
+"ui/typeck/issue-116473-ice-wrong-span-variant-args.rs",
+"ui/typeck/issue-116864.rs",
+"ui/typeck/issue-120856.rs",
+"ui/typeck/issue-13853-2.rs",
+"ui/typeck/issue-13853-5.rs",
+"ui/typeck/issue-13853.rs",
+"ui/typeck/issue-16338.rs",
+"ui/typeck/issue-1871.rs",
+"ui/typeck/issue-18937-1.rs",
+"ui/typeck/issue-18937.rs",
+"ui/typeck/issue-2063-resource.rs",
+"ui/typeck/issue-2063.rs",
+"ui/typeck/issue-22375.rs",
+"ui/typeck/issue-29124.rs",
+"ui/typeck/issue-29181.rs",
+"ui/typeck/issue-31173.rs",
+"ui/typeck/issue-33575.rs",
+"ui/typeck/issue-36708.rs",
+"ui/typeck/issue-43189.rs",
+"ui/typeck/issue-46112.rs",
+"ui/typeck/issue-50687-ice-on-borrow.rs",
+"ui/typeck/issue-52082-type-param-shadows-existing-type.rs",
+"ui/typeck/issue-53712.rs",
+"ui/typeck/issue-55810-must-typeck-match-pats-before-guards.rs",
+"ui/typeck/issue-57404.rs",
+"ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.rs",
+"ui/typeck/issue-61711-once-caused-rustc-inf-loop.rs",
+"ui/typeck/issue-65611.rs",
+"ui/typeck/issue-67971.rs",
+"ui/typeck/issue-68590-reborrow-through-derefmut.rs",
+"ui/typeck/issue-69378-ice-on-invalid-type-node-after-recovery.rs",
+"ui/typeck/issue-72225-call-fnmut-through-derefmut.rs",
+"ui/typeck/issue-73592-borrow_mut-through-deref.rs",
+"ui/typeck/issue-74086.rs",
+"ui/typeck/issue-74933.rs",
+"ui/typeck/issue-75883.rs",
+"ui/typeck/issue-75889.rs",
+"ui/typeck/issue-7813.rs",
+"ui/typeck/issue-79040.rs",
+"ui/typeck/issue-80207-unsized-return.rs",
+"ui/typeck/issue-80779.rs",
+"ui/typeck/issue-81293.rs",
+"ui/typeck/issue-81885.rs",
+"ui/typeck/issue-81943.rs",
+"ui/typeck/issue-82772.rs",
+"ui/typeck/issue-83621-placeholder-static-in-extern.rs",
+"ui/typeck/issue-83693.rs",
+"ui/typeck/issue-84160.rs",
+"ui/typeck/issue-84768.rs",
+"ui/typeck/issue-84831.rs",
+"ui/typeck/issue-86721-return-expr-ice.rs",
+"ui/typeck/issue-87771-ice-assign-assign-to-bool.rs",
+"ui/typeck/issue-87872-missing-inaccessible-field-literal.rs",
+"ui/typeck/issue-87872-missing-inaccessible-field-pattern.rs",
+"ui/typeck/issue-88609.rs",
+"ui/typeck/issue-88643.rs",
+"ui/typeck/issue-88803-call-expr-method.rs",
+"ui/typeck/issue-88844.rs",
+"ui/typeck/issue-89044-wrapped-expr-method.rs",
+"ui/typeck/issue-89275.rs",
+"ui/typeck/issue-89806.rs",
+"ui/typeck/issue-89856.rs",
+"ui/typeck/issue-89935.rs",
+"ui/typeck/issue-90027-async-fn-return-suggestion.rs",
+"ui/typeck/issue-90101.rs",
+"ui/typeck/issue-90164.rs",
+"ui/typeck/issue-90319.rs",
+"ui/typeck/issue-90483-inaccessible-field-adjustment.rs",
+"ui/typeck/issue-90804-incorrect-reference-suggestion.rs",
+"ui/typeck/issue-91210-ptr-method.rs",
+"ui/typeck/issue-91267.rs",
+"ui/typeck/issue-91328.rs",
+"ui/typeck/issue-91334.rs",
+"ui/typeck/issue-91450-inner-ty-error.rs",
+"ui/typeck/issue-91633.rs",
+"ui/typeck/issue-92481.rs",
+"ui/typeck/issue-93486.rs",
+"ui/typeck/issue-96530.rs",
+"ui/typeck/issue-96738.rs",
+"ui/typeck/issue-98260.rs",
+"ui/typeck/issue-98982.rs",
+"ui/typeof/issue-100183.rs",
+"ui/typeof/issue-29184.rs",
+"ui/typeof/issue-42060.rs",
+"ui/unboxed-closures/issue-18652.rs",
+"ui/unboxed-closures/issue-18661.rs",
+"ui/unboxed-closures/issue-30906.rs",
+"ui/unboxed-closures/issue-53448.rs",
+"ui/underscore-imports/issue-110164.rs",
+"ui/uniform-paths/auxiliary/issue-53691.rs",
+"ui/uniform-paths/issue-53691.rs",
+"ui/uninhabited/issue-107505.rs",
+"ui/union/issue-41073.rs",
+"ui/union/issue-81199.rs",
+"ui/union/issue-99375.rs",
+"ui/unsafe/auxiliary/issue-106126.rs",
+"ui/unsafe/issue-106126-good-path-bug.rs",
+"ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs",
+"ui/unsafe/issue-3080.rs",
+"ui/unsafe/issue-45087-unreachable-unsafe.rs",
+"ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs",
+"ui/unsafe/issue-47412.rs",
+"ui/unsafe/issue-85435-unsafe-op-in-let-under-unsafe-under-closure.rs",
+"ui/unsafe/issue-87414-query-cycle.rs",
+"ui/unsized-locals/issue-30276-feature-flagged.rs",
+"ui/unsized-locals/issue-30276.rs",
+"ui/unsized-locals/issue-50940-with-feature.rs",
+"ui/unsized-locals/issue-50940.rs",
+"ui/unsized-locals/issue-67981.rs",
+"ui/unsized/issue-115203.rs",
+"ui/unsized/issue-115809.rs",
+"ui/unsized/issue-30355.rs",
+"ui/unsized/issue-40231-1.rs",
+"ui/unsized/issue-40231-2.rs",
+"ui/unsized/issue-71659.rs",
+"ui/unsized/issue-75707.rs",
+"ui/unsized/issue-75899-but-gats.rs",
+"ui/unsized/issue-75899.rs",
+"ui/unsized/issue-91801.rs",
+"ui/unsized/issue-91803.rs",
+"ui/unsized/issue-97732.rs",
+"ui/use/issue-18986.rs",
+"ui/use/issue-60976-extern-use-primitive-type.rs",
+"ui/wf/issue-103573.rs",
+"ui/wf/issue-110157.rs",
+"ui/wf/issue-48638.rs",
+"ui/wf/issue-87495.rs",
+"ui/wf/issue-95665.rs",
+"ui/wf/issue-96810.rs",
+"ui/where-clauses/issue-50825-1.rs",
+"ui/where-clauses/issue-50825.rs",
+]
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index a9340c40f44..870322c44fb 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -101,7 +101,7 @@ fn main() {
         // Checks over tests.
         check!(tests_placement, &root_path);
         check!(debug_artifacts, &tests_path);
-        check!(ui_tests, &tests_path);
+        check!(ui_tests, &tests_path, bless);
         check!(mir_opt_tests, &tests_path, bless);
         check!(rustdoc_gui_tests, &tests_path);
         check!(rustdoc_css_themes, &librustdoc_path);
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 5517b9fdcec..54a298492d9 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -1,11 +1,13 @@
 //! Tidy check to ensure below in UI test directories:
 //! - the number of entries in each directory must be less than `ENTRY_LIMIT`
 //! - there are no stray `.stderr` files
-
 use ignore::Walk;
-use std::collections::HashMap;
+use lazy_static::lazy_static;
+use regex::Regex;
+use std::collections::{BTreeSet, HashMap};
 use std::ffi::OsStr;
 use std::fs;
+use std::io::Write;
 use std::path::{Path, PathBuf};
 
 // FIXME: GitHub's UI truncates file lists that exceed 1000 entries, so these
@@ -16,7 +18,7 @@ const ENTRY_LIMIT: usize = 900;
 // FIXME: The following limits should be reduced eventually.
 
 const ISSUES_ENTRY_LIMIT: usize = 1781;
-const ROOT_ENTRY_LIMIT: usize = 871;
+const ROOT_ENTRY_LIMIT: usize = 872;
 
 const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
     "rs",     // test source files
@@ -95,8 +97,17 @@ fn check_entries(tests_path: &Path, bad: &mut bool) {
     }
 }
 
-pub fn check(path: &Path, bad: &mut bool) {
+pub fn check(path: &Path, bless: bool, bad: &mut bool) {
     check_entries(&path, bad);
+
+    // the list of files in ui tests that are allowed to start with `issue-XXXX`
+    // BTreeSet because we would like a stable ordering so --bless works
+    let allowed_issue_names = BTreeSet::from(
+        include!("issues.txt").map(|path| path.replace("/", std::path::MAIN_SEPARATOR_STR)),
+    );
+
+    let mut remaining_issue_names: BTreeSet<String> = allowed_issue_names.clone();
+
     let (ui, ui_fulldeps) = (path.join("ui"), path.join("ui-fulldeps"));
     let paths = [ui.as_path(), ui_fulldeps.as_path()];
     crate::walk::walk_no_read(&paths, |_, _| false, &mut |entry| {
@@ -109,6 +120,11 @@ pub fn check(path: &Path, bad: &mut bool) {
             {
                 tidy_error!(bad, "file {} has unexpected extension {}", file_path.display(), ext);
             }
+
+            // NB: We do not use file_stem() as some file names have multiple `.`s and we
+            // must strip all of them.
+            let testname =
+                file_path.file_name().unwrap().to_str().unwrap().split_once('.').unwrap().0;
             if ext == "stderr" || ext == "stdout" || ext == "fixed" {
                 // Test output filenames have one of the formats:
                 // ```
@@ -120,11 +136,7 @@ pub fn check(path: &Path, bad: &mut bool) {
                 //
                 // For now, just make sure that there is a corresponding
                 // `$testname.rs` file.
-                //
-                // NB: We do not use file_stem() as some file names have multiple `.`s and we
-                // must strip all of them.
-                let testname =
-                    file_path.file_name().unwrap().to_str().unwrap().split_once('.').unwrap().0;
+
                 if !file_path.with_file_name(testname).with_extension("rs").exists()
                     && !testname.contains("ignore-tidy")
                 {
@@ -137,6 +149,60 @@ pub fn check(path: &Path, bad: &mut bool) {
                     }
                 }
             }
+
+            if ext == "rs" {
+                lazy_static! {
+                    static ref ISSUE_NAME_REGEX: Regex =
+                        Regex::new(r"^issues?[-_]?(\d{3,})").unwrap();
+                }
+
+                if let Some(test_name) = ISSUE_NAME_REGEX.captures(testname) {
+                    // these paths are always relative to the passed `path` and always UTF8
+                    let stripped_path = file_path.strip_prefix(path).unwrap().to_str().unwrap();
+                    if !remaining_issue_names.remove(stripped_path) {
+                        tidy_error!(
+                            bad,
+                            "file `{stripped_path}` must begin with a descriptive name, consider `{{reason}}-issue-{issue_n}.rs`",
+                            issue_n = &test_name[1],
+                        );
+                    }
+                }
+            }
         }
     });
+
+    // if an excluded file is renamed, it must be removed from this list
+    // do this automatically on bless, otherwise issue a tidy error
+    if bless {
+        let issues_txt_header = r#"
+/*
+============================================================
+    ⚠️⚠️⚠️NOTHING SHOULD EVER BE ADDED TO THIS LIST⚠️⚠️⚠️
+============================================================
+*/
+[
+"#;
+        let tidy_src = std::env::current_dir().unwrap().join("src/tools/tidy/src");
+        // instead of overwriting the file, recreate it and use an "atomic rename"
+        // so we don't bork things on panic or a contributor using Ctrl+C
+        let blessed_issues_path = tidy_src.join("issues_blessed.txt");
+        let mut blessed_issues_txt = fs::File::create(&blessed_issues_path).unwrap();
+        blessed_issues_txt.write(issues_txt_header.as_bytes()).unwrap();
+        for filename in allowed_issue_names.difference(&remaining_issue_names) {
+            write!(blessed_issues_txt, "\"{filename}\",\n").unwrap();
+        }
+        write!(blessed_issues_txt, "]\n").unwrap();
+        let old_issues_path = tidy_src.join("issues.txt");
+        fs::rename(blessed_issues_path, old_issues_path).unwrap();
+    } else {
+        for file_name in remaining_issue_names {
+            let mut p = PathBuf::from(path);
+            p.push(file_name);
+            tidy_error!(
+                bad,
+                "file `{}` no longer exists and should be removed from the exclusions in `src/tools/tidy/src/issues.txt`",
+                p.display()
+            );
+        }
+    }
 }
diff --git a/tests/coverage/no_spans.cov-map b/tests/coverage/no_spans.cov-map
index 9915fc52e6d..30171c3f319 100644
--- a/tests/coverage/no_spans.cov-map
+++ b/tests/coverage/no_spans.cov-map
@@ -1,3 +1,11 @@
+Function name: no_spans::affected_function
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1a, 1c, 00, 1d]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 26, 28) to (start + 0, 29)
+
 Function name: no_spans::affected_function::{closure#0}
 Raw bytes (9): 0x[01, 01, 00, 01, 01, 1b, 0c, 00, 0e]
 Number of files: 1
diff --git a/tests/coverage/no_spans.coverage b/tests/coverage/no_spans.coverage
index e55177698a2..b117c32ffd0 100644
--- a/tests/coverage/no_spans.coverage
+++ b/tests/coverage/no_spans.coverage
@@ -23,7 +23,7 @@
    LL|       |}
    LL|       |
    LL|       |macro_that_defines_a_function! {
-   LL|       |    fn affected_function() {
+   LL|      1|    fn affected_function() {
    LL|      1|        || ()
    LL|       |    }
    LL|       |}
diff --git a/tests/coverage/no_spans_if_not.cov-map b/tests/coverage/no_spans_if_not.cov-map
index 5277267ec1b..bc3e14eddd5 100644
--- a/tests/coverage/no_spans_if_not.cov-map
+++ b/tests/coverage/no_spans_if_not.cov-map
@@ -1,3 +1,15 @@
+Function name: no_spans_if_not::affected_function
+Raw bytes (21): 0x[01, 01, 01, 01, 00, 03, 01, 16, 1c, 01, 12, 02, 02, 0d, 00, 0f, 00, 02, 0d, 00, 0f]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 22, 28) to (start + 1, 18)
+- Code(Expression(0, Sub)) at (prev + 2, 13) to (start + 0, 15)
+    = (c0 - Zero)
+- Code(Zero) at (prev + 2, 13) to (start + 0, 15)
+
 Function name: no_spans_if_not::main
 Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 01, 02, 02]
 Number of files: 1
diff --git a/tests/coverage/no_spans_if_not.coverage b/tests/coverage/no_spans_if_not.coverage
index 1b6bbc75a04..d235568db65 100644
--- a/tests/coverage/no_spans_if_not.coverage
+++ b/tests/coverage/no_spans_if_not.coverage
@@ -19,11 +19,11 @@
    LL|       |}
    LL|       |
    LL|       |macro_that_defines_a_function! {
-   LL|       |    fn affected_function() {
-   LL|       |        if !false {
-   LL|       |            ()
+   LL|      1|    fn affected_function() {
+   LL|      1|        if !false {
+   LL|      1|            ()
    LL|       |        } else {
-   LL|       |            ()
+   LL|      0|            ()
    LL|       |        }
    LL|       |    }
    LL|       |}
diff --git a/tests/debuginfo/mutex.rs b/tests/debuginfo/mutex.rs
index 7a58c5c2224..ab9fb8b7e81 100644
--- a/tests/debuginfo/mutex.rs
+++ b/tests/debuginfo/mutex.rs
@@ -10,7 +10,7 @@
 //
 // cdb-command:dx m,d
 // cdb-check:m,d              [Type: std::sync::mutex::Mutex<i32>]
-// cdb-check:    [...] inner            [Type: std::sys::pal::windows::locks::mutex::Mutex]
+// cdb-check:    [...] inner            [Type: std::sys::locks::mutex::windows::Mutex]
 // cdb-check:    [...] poison           [Type: std::sync::poison::Flag]
 // cdb-check:    [...] data             : 0 [Type: core::cell::UnsafeCell<i32>]
 
diff --git a/tests/debuginfo/rwlock-read.rs b/tests/debuginfo/rwlock-read.rs
index 4ed1ebd0b37..7e9838871ba 100644
--- a/tests/debuginfo/rwlock-read.rs
+++ b/tests/debuginfo/rwlock-read.rs
@@ -16,7 +16,7 @@
 // cdb-command:dx r
 // cdb-check:r                [Type: std::sync::rwlock::RwLockReadGuard<i32>]
 // cdb-check:    [...] data             : NonNull([...]: 0) [Type: core::ptr::non_null::NonNull<i32>]
-// cdb-check:    [...] inner_lock       : [...] [Type: std::sys::pal::windows::locks::rwlock::RwLock *]
+// cdb-check:    [...] inner_lock       : [...] [Type: std::sys::locks::rwlock::windows::RwLock *]
 
 #[allow(unused_variables)]
 
diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs
index 78410e49d2a..34792cb9f01 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.rs
+++ b/tests/mir-opt/dataflow-const-prop/enum.rs
@@ -62,7 +62,7 @@ fn statics() {
 
     static RC: &E = &E::V2(4);
 
-    // CHECK: [[t:_.*]] = const {alloc2: &&E};
+    // CHECK: [[t:_.*]] = const {alloc5: &&E};
     // CHECK: [[e2]] = (*[[t]]);
     let e2 = RC;
 
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs
index 5a2099865d6..dcf948d2a88 100644
--- a/tests/ui-fulldeps/internal-lints/diagnostics.rs
+++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs
@@ -55,8 +55,11 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for TranslatableInIntoDiagn
 pub struct UntranslatableInAddToDiagnostic;
 
 impl AddToDiagnostic for UntranslatableInAddToDiagnostic {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F)
-    {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         diag.note("untranslatable diagnostic");
         //~^ ERROR diagnostics should be created using translatable messages
     }
@@ -65,7 +68,11 @@ impl AddToDiagnostic for UntranslatableInAddToDiagnostic {
 pub struct TranslatableInAddToDiagnostic;
 
 impl AddToDiagnostic for TranslatableInAddToDiagnostic {
-    fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
+    fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
+        self,
+        diag: &mut DiagnosticBuilder<'_, G>,
+        f: F,
+    ) {
         diag.note(crate::fluent_generated::no_crate_note);
     }
 }
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.stderr b/tests/ui-fulldeps/internal-lints/diagnostics.stderr
index 108b7c8ea9c..a69a71bf50e 100644
--- a/tests/ui-fulldeps/internal-lints/diagnostics.stderr
+++ b/tests/ui-fulldeps/internal-lints/diagnostics.stderr
@@ -11,13 +11,13 @@ LL | #![deny(rustc::untranslatable_diagnostic)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: diagnostics should be created using translatable messages
-  --> $DIR/diagnostics.rs:60:14
+  --> $DIR/diagnostics.rs:63:14
    |
 LL |         diag.note("untranslatable diagnostic");
    |              ^^^^
 
 error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
-  --> $DIR/diagnostics.rs:74:21
+  --> $DIR/diagnostics.rs:81:21
    |
 LL |     let _diag = dcx.struct_err(crate::fluent_generated::no_crate_example);
    |                     ^^^^^^^^^^
@@ -29,13 +29,13 @@ LL | #![deny(rustc::diagnostic_outside_of_impl)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
-  --> $DIR/diagnostics.rs:77:21
+  --> $DIR/diagnostics.rs:84:21
    |
 LL |     let _diag = dcx.struct_err("untranslatable diagnostic");
    |                     ^^^^^^^^^^
 
 error: diagnostics should be created using translatable messages
-  --> $DIR/diagnostics.rs:77:21
+  --> $DIR/diagnostics.rs:84:21
    |
 LL |     let _diag = dcx.struct_err("untranslatable diagnostic");
    |                     ^^^^^^^^^^
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
index f07b69326b0..0d61e15b0f1 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
@@ -8,9 +8,9 @@ LL |     arg: NotIntoDiagnosticArg,
    |          ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg`
    |
    = help: normalized in stderr
-note: required by a bound in `DiagnosticBuilder::<'a, G>::arg`
-  --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC
-   = note: this error originates in the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info)
+note: required by a bound in `rustc_errors::diagnostic::<impl DiagnosticBuilder<'a, G>>::arg`
+  --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
+   = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied
   --> $DIR/diagnostic-derive-doc-comment-field.rs:46:10
@@ -22,8 +22,9 @@ LL |     arg: NotIntoDiagnosticArg,
    |          ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg`
    |
    = help: normalized in stderr
-note: required by a bound in `Diagnostic::arg`
+note: required by a bound in `rustc_errors::diagnostic::<impl DiagnosticBuilder<'a, G>>::arg`
   --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
+   = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
index 6cc6fdfc0eb..856f32fafa0 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
@@ -1,8 +1,8 @@
 // check-fail
 // Tests error conditions for specifying diagnostics using #[derive(Diagnostic)]
-
 // normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr"
-// normalize-stderr-test "diagnostic_builder\.rs:[0-9]+:[0-9]+" -> "diagnostic_builder.rs:LL:CC"
+// normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC"
+
 // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
 // changing the output of this test. Since Diagnostic is strictly internal to the compiler
 // the test is just ignored on stable and beta:
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
index f2dbc718c76..ddbb3c6df26 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
@@ -628,9 +628,9 @@ LL |     other: Hello,
    |            ^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
    |
    = help: normalized in stderr
-note: required by a bound in `DiagnosticBuilder::<'a, G>::arg`
-  --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC
-   = note: this error originates in the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info)
+note: required by a bound in `rustc_errors::diagnostic::<impl DiagnosticBuilder<'a, G>>::arg`
+  --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
+   = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 86 previous errors
 
diff --git a/tests/ui-fulldeps/stable-mir/compilation-result.rs b/tests/ui-fulldeps/stable-mir/compilation-result.rs
index e6dd9fa132d..cd61d599eb4 100644
--- a/tests/ui-fulldeps/stable-mir/compilation-result.rs
+++ b/tests/ui-fulldeps/stable-mir/compilation-result.rs
@@ -55,7 +55,7 @@ fn test_skipped(mut args: Vec<String>) {
 fn test_failed(mut args: Vec<String>) {
     args.push("--cfg=broken".to_string());
     let result = run!(args, || unreachable!() as ControlFlow<()>);
-    assert_eq!(result, Err(stable_mir::CompilerError::CompilationFailed));
+    assert_eq!(result, Err(stable_mir::CompilerError::Failed));
 }
 
 /// Test that we are able to pass a closure and set the return according to the captured value.
diff --git a/tests/ui/anon-params/anon-params-edition-hygiene.rs b/tests/ui/anon-params/anon-params-edition-hygiene.rs
index 607412f44c4..56e7336a7a5 100644
--- a/tests/ui/anon-params/anon-params-edition-hygiene.rs
+++ b/tests/ui/anon-params/anon-params-edition-hygiene.rs
@@ -1,3 +1,4 @@
+//@ check-pass
 //@ edition:2018
 //@ aux-build:anon-params-edition-hygiene.rs
 
@@ -8,7 +9,6 @@
 extern crate anon_params_edition_hygiene;
 
 generate_trait_2015_ident!(u8);
-// FIXME: Edition hygiene doesn't work correctly with `tt`s in this case.
-generate_trait_2015_tt!(u8); //~ ERROR expected one of `:`, `@`, or `|`, found `)`
+generate_trait_2015_tt!(u8);
 
 fn main() {}
diff --git a/tests/ui/anon-params/anon-params-edition-hygiene.stderr b/tests/ui/anon-params/anon-params-edition-hygiene.stderr
deleted file mode 100644
index 373d7c6aebb..00000000000
--- a/tests/ui/anon-params/anon-params-edition-hygiene.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error: expected one of `:`, `@`, or `|`, found `)`
-  --> $DIR/anon-params-edition-hygiene.rs:12:1
-   |
-LL | generate_trait_2015_tt!(u8);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of `:`, `@`, or `|`
-   |
-   = note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
-   = note: this error originates in the macro `generate_trait_2015_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: if this is a `self` type, give it a parameter name
-   |
-LL | generate_trait_2015_tt!(self: u8);
-   |                         +++++
-help: if this is a parameter name, give it a type
-   |
-LL | generate_trait_2015_tt!(u8: TypeName);
-   |                           ++++++++++
-help: if this is a type, explicitly ignore the parameter name
-   |
-LL | generate_trait_2015_tt!(_: u8);
-   |                         ++
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.rs b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.rs
index 0315938a7ed..be8162c86b9 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.rs
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.rs
@@ -4,12 +4,12 @@ trait Foo {
     const BAR: u32;
 }
 
-const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
+const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; //~ ERROR E0391
 
 struct GlobalImplRef;
 
 impl GlobalImplRef {
-    const BAR: u32 = IMPL_REF_BAR; //~ ERROR E0391
+    const BAR: u32 = IMPL_REF_BAR;
 }
 
 fn main() {}
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
index 88b17be601c..bf37f537a49 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
@@ -1,14 +1,9 @@
-error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`
-  --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:22
-   |
-LL |     const BAR: u32 = IMPL_REF_BAR;
-   |                      ^^^^^^^^^^^^
-   |
-note: ...which requires simplifying constant for the type system `IMPL_REF_BAR`...
+error[E0391]: cycle detected when simplifying constant for the type system `IMPL_REF_BAR`
   --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
    |
 LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^
+   |
 note: ...which requires const-evaluating + checking `IMPL_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:27
    |
@@ -29,7 +24,12 @@ note: ...which requires caching mir of `<impl at $DIR/issue-24949-assoc-const-st
    |
 LL |     const BAR: u32 = IMPL_REF_BAR;
    |     ^^^^^^^^^^^^^^
-   = note: ...which again requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`, completing the cycle
+note: ...which requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`...
+  --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:22
+   |
+LL |     const BAR: u32 = IMPL_REF_BAR;
+   |                      ^^^^^^^^^^^^
+   = note: ...which again requires simplifying constant for the type system `IMPL_REF_BAR`, completing the cycle
    = note: cycle used when running analysis passes on this crate
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
index fd1b4f2f964..d0ada37b99e 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
@@ -1,9 +1,14 @@
-error[E0391]: cycle detected when elaborating drops for `FooDefault::BAR`
+error[E0391]: cycle detected when caching mir of `FooDefault::BAR` for CTFE
+  --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
+   |
+LL |     const BAR: u32 = DEFAULT_REF_BAR;
+   |     ^^^^^^^^^^^^^^
+   |
+note: ...which requires elaborating drops for `FooDefault::BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:22
    |
 LL |     const BAR: u32 = DEFAULT_REF_BAR;
    |                      ^^^^^^^^^^^^^^^
-   |
 note: ...which requires simplifying constant for the type system `DEFAULT_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
    |
@@ -24,13 +29,12 @@ note: ...which requires const-evaluating + checking `FooDefault::BAR`...
    |
 LL |     const BAR: u32 = DEFAULT_REF_BAR;
    |     ^^^^^^^^^^^^^^
-note: ...which requires caching mir of `FooDefault::BAR` for CTFE...
+   = note: ...which again requires caching mir of `FooDefault::BAR` for CTFE, completing the cycle
+note: cycle used when const-evaluating + checking `FooDefault::BAR`
   --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
    |
 LL |     const BAR: u32 = DEFAULT_REF_BAR;
    |     ^^^^^^^^^^^^^^
-   = note: ...which again requires elaborating drops for `FooDefault::BAR`, completing the cycle
-   = note: cycle used when running analysis passes on this crate
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.rs b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.rs
index 68b653ff3c5..62af8534340 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.rs
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.rs
@@ -4,12 +4,12 @@ trait Foo {
     const BAR: u32;
 }
 
-const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
+const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR; //~ ERROR E0391
 
 struct GlobalTraitRef;
 
 impl Foo for GlobalTraitRef {
-    const BAR: u32 = TRAIT_REF_BAR; //~ ERROR E0391
+    const BAR: u32 = TRAIT_REF_BAR;
 }
 
 fn main() {}
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
index 303400f928e..317af7975aa 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
@@ -1,14 +1,9 @@
-error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`
-  --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:22
-   |
-LL |     const BAR: u32 = TRAIT_REF_BAR;
-   |                      ^^^^^^^^^^^^^
-   |
-note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
+error[E0391]: cycle detected when simplifying constant for the type system `TRAIT_REF_BAR`
   --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
    |
 LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
    | ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
 note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`...
   --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:28
    |
@@ -29,7 +24,12 @@ note: ...which requires caching mir of `<impl at $DIR/issue-24949-assoc-const-st
    |
 LL |     const BAR: u32 = TRAIT_REF_BAR;
    |     ^^^^^^^^^^^^^^
-   = note: ...which again requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`, completing the cycle
+note: ...which requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`...
+  --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:22
+   |
+LL |     const BAR: u32 = TRAIT_REF_BAR;
+   |                      ^^^^^^^^^^^^^
+   = note: ...which again requires simplifying constant for the type system `TRAIT_REF_BAR`, completing the cycle
    = note: cycle used when running analysis passes on this crate
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
diff --git a/tests/ui/async-await/for-await-passthrough.rs b/tests/ui/async-await/for-await-passthrough.rs
index 3769ef60b01..e09e843332e 100644
--- a/tests/ui/async-await/for-await-passthrough.rs
+++ b/tests/ui/async-await/for-await-passthrough.rs
@@ -4,8 +4,6 @@
 #![feature(async_iterator, async_iter_from_iter, const_waker, async_for_loop, noop_waker,
            gen_blocks)]
 
-use std::future::Future;
-
 async gen fn async_iter() -> i32 {
     let iter = core::async_iter::from_iter(0..3);
     for await i in iter {
diff --git a/tests/ui/auto-traits/issue-117789.rs b/tests/ui/auto-traits/issue-117789.rs
index 0c30931a1b5..63f796771db 100644
--- a/tests/ui/auto-traits/issue-117789.rs
+++ b/tests/ui/auto-traits/issue-117789.rs
@@ -1,5 +1,3 @@
-#![deny(suspicious_auto_trait_impls)]
-
 auto trait Trait<P> {} //~ ERROR auto traits cannot have generic parameters
 //~^ ERROR auto traits are experimental and possibly buggy
 impl<P> Trait<P> for () {}
diff --git a/tests/ui/auto-traits/issue-117789.stderr b/tests/ui/auto-traits/issue-117789.stderr
index 1f8880b1ef4..99efb213417 100644
--- a/tests/ui/auto-traits/issue-117789.stderr
+++ b/tests/ui/auto-traits/issue-117789.stderr
@@ -1,5 +1,5 @@
 error[E0567]: auto traits cannot have generic parameters
-  --> $DIR/issue-117789.rs:3:17
+  --> $DIR/issue-117789.rs:1:17
    |
 LL | auto trait Trait<P> {}
    |            -----^^^ help: remove the parameters
@@ -7,7 +7,7 @@ LL | auto trait Trait<P> {}
    |            auto trait cannot have generic parameters
 
 error[E0658]: auto traits are experimental and possibly buggy
-  --> $DIR/issue-117789.rs:3:1
+  --> $DIR/issue-117789.rs:1:1
    |
 LL | auto trait Trait<P> {}
    | ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/auto-traits/issue-83857-ub.rs b/tests/ui/auto-traits/issue-83857-ub.rs
index f9b47d2b0c6..20abfdd851a 100644
--- a/tests/ui/auto-traits/issue-83857-ub.rs
+++ b/tests/ui/auto-traits/issue-83857-ub.rs
@@ -1,4 +1,3 @@
-#![allow(suspicious_auto_trait_impls)]
 // Tests that we don't incorrectly allow overlap between a builtin auto trait
 // impl and a user written one. See #83857 for more details
 
diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr
index 6372bdfe762..20bfe7e36ca 100644
--- a/tests/ui/auto-traits/issue-83857-ub.stderr
+++ b/tests/ui/auto-traits/issue-83857-ub.stderr
@@ -1,12 +1,12 @@
 error[E0277]: `Foo<T, U>` cannot be sent between threads safely
-  --> $DIR/issue-83857-ub.rs:22:38
+  --> $DIR/issue-83857-ub.rs:21:38
    |
 LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) {
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo<T, U>` cannot be sent between threads safely
    |
    = help: the trait `Send` is not implemented for `Foo<T, U>`, which is required by `Foo<T, U>: WithAssoc`
 note: required for `Foo<T, U>` to implement `WithAssoc`
-  --> $DIR/issue-83857-ub.rs:15:15
+  --> $DIR/issue-83857-ub.rs:14:15
    |
 LL | impl<T: Send> WithAssoc for T {
    |         ----  ^^^^^^^^^     ^
@@ -18,7 +18,7 @@ LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i
    |                                                                                +++++++++++++++++++++
 
 error[E0277]: `Foo<T, U>` cannot be sent between threads safely
-  --> $DIR/issue-83857-ub.rs:22:80
+  --> $DIR/issue-83857-ub.rs:21:80
    |
 LL |   fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) {
    |  ________________________________________________________________________________^
@@ -31,7 +31,7 @@ LL | | }
    |
    = help: the trait `Send` is not implemented for `Foo<T, U>`, which is required by `Foo<T, U>: WithAssoc`
 note: required for `Foo<T, U>` to implement `WithAssoc`
-  --> $DIR/issue-83857-ub.rs:15:15
+  --> $DIR/issue-83857-ub.rs:14:15
    |
 LL | impl<T: Send> WithAssoc for T {
    |         ----  ^^^^^^^^^     ^
@@ -43,7 +43,7 @@ LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i
    |                                                                                +++++++++++++++++++++
 
 error[E0277]: `Foo<T, U>` cannot be sent between threads safely
-  --> $DIR/issue-83857-ub.rs:25:11
+  --> $DIR/issue-83857-ub.rs:24:11
    |
 LL |     f(foo(v));
    |       --- ^ `Foo<T, U>` cannot be sent between threads safely
@@ -52,7 +52,7 @@ LL |     f(foo(v));
    |
    = help: the trait `Send` is not implemented for `Foo<T, U>`
 note: required by a bound in `foo`
-  --> $DIR/issue-83857-ub.rs:29:11
+  --> $DIR/issue-83857-ub.rs:28:11
    |
 LL | fn foo<T: Send>(x: T) -> <T as WithAssoc>::Output {
    |           ^^^^ required by this bound in `foo`
diff --git a/tests/ui/auto-traits/suspicious-impls-lint.rs b/tests/ui/auto-traits/suspicious-impls-lint.rs
deleted file mode 100644
index 7712e84f4a2..00000000000
--- a/tests/ui/auto-traits/suspicious-impls-lint.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-#![deny(suspicious_auto_trait_impls)]
-
-use std::marker::PhantomData;
-
-struct MayImplementSendOk<T>(T);
-unsafe impl<T: Send> Send for MayImplementSendOk<T> {} // ok
-
-struct MayImplementSendErr<T>(T);
-unsafe impl<T: Send> Send for MayImplementSendErr<&T> {}
-//~^ ERROR
-//~| WARNING this will change its meaning
-
-struct ContainsNonSendDirect<T>(*const T);
-unsafe impl<T: Send> Send for ContainsNonSendDirect<&T> {} // ok
-
-struct ContainsPtr<T>(*const T);
-struct ContainsIndirectNonSend<T>(ContainsPtr<T>);
-unsafe impl<T: Send> Send for ContainsIndirectNonSend<&T> {} // ok
-
-struct ContainsVec<T>(Vec<T>);
-unsafe impl Send for ContainsVec<i32> {}
-//~^ ERROR
-//~| WARNING this will change its meaning
-
-struct TwoParams<T, U>(T, U);
-unsafe impl<T: Send, U: Send> Send for TwoParams<T, U> {} // ok
-
-struct TwoParamsFlipped<T, U>(T, U);
-unsafe impl<T: Send, U: Send> Send for TwoParamsFlipped<U, T> {} // ok
-
-struct TwoParamsSame<T, U>(T, U);
-unsafe impl<T: Send> Send for TwoParamsSame<T, T> {}
-//~^ ERROR
-//~| WARNING this will change its meaning
-
-pub struct WithPhantomDataNonSend<T, U>(PhantomData<*const T>, U);
-unsafe impl<T> Send for WithPhantomDataNonSend<T, i8> {} // ok
-
-pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U);
-unsafe impl<T> Send for WithPhantomDataSend<*const T, i8> {}
-//~^ ERROR
-//~| WARNING this will change its meaning
-
-pub struct WithLifetime<'a, T>(&'a (), T);
-unsafe impl<T> Send for WithLifetime<'static, T> {} // ok
-unsafe impl<T> Sync for WithLifetime<'static, Vec<T>> {}
-//~^ ERROR
-//~| WARNING this will change its meaning
-
-fn main() {}
diff --git a/tests/ui/auto-traits/suspicious-impls-lint.stderr b/tests/ui/auto-traits/suspicious-impls-lint.stderr
deleted file mode 100644
index 9cd4e79f851..00000000000
--- a/tests/ui/auto-traits/suspicious-impls-lint.stderr
+++ /dev/null
@@ -1,82 +0,0 @@
-error: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/suspicious-impls-lint.rs:9:1
-   |
-LL | unsafe impl<T: Send> Send for MayImplementSendErr<&T> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `&T` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/suspicious-impls-lint.rs:8:1
-   |
-LL | struct MayImplementSendErr<T>(T);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/suspicious-impls-lint.rs:1:9
-   |
-LL | #![deny(suspicious_auto_trait_impls)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/suspicious-impls-lint.rs:21:1
-   |
-LL | unsafe impl Send for ContainsVec<i32> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `i32` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/suspicious-impls-lint.rs:20:1
-   |
-LL | struct ContainsVec<T>(Vec<T>);
-   | ^^^^^^^^^^^^^^^^^^^^^
-
-error: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/suspicious-impls-lint.rs:32:1
-   |
-LL | unsafe impl<T: Send> Send for TwoParamsSame<T, T> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `T` is mentioned multiple times
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/suspicious-impls-lint.rs:31:1
-   |
-LL | struct TwoParamsSame<T, U>(T, U);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/suspicious-impls-lint.rs:40:1
-   |
-LL | unsafe impl<T> Send for WithPhantomDataSend<*const T, i8> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `*const T` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/suspicious-impls-lint.rs:39:1
-   |
-LL | pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: cross-crate traits with a default impl, like `Sync`, should not be specialized
-  --> $DIR/suspicious-impls-lint.rs:46:1
-   |
-LL | unsafe impl<T> Sync for WithLifetime<'static, Vec<T>> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `Vec<T>` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/suspicious-impls-lint.rs:44:1
-   |
-LL | pub struct WithLifetime<'a, T>(&'a (), T);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 5 previous errors
-
diff --git a/tests/ui/auto-traits/suspicious-negative-impls-lint.rs b/tests/ui/auto-traits/suspicious-negative-impls-lint.rs
deleted file mode 100644
index 34842e5944b..00000000000
--- a/tests/ui/auto-traits/suspicious-negative-impls-lint.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#![feature(negative_impls)]
-#![deny(suspicious_auto_trait_impls)]
-
-use std::marker::PhantomData;
-
-struct ContainsVec<T>(Vec<T>);
-impl !Send for ContainsVec<u32> {}
-//~^ ERROR
-//~| WARNING this will change its meaning
-
-pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U);
-impl<T> !Send for WithPhantomDataSend<*const T, u8> {}
-//~^ ERROR
-//~| WARNING this will change its meaning
-
-pub struct WithLifetime<'a, T>(&'a (), T);
-impl<T> !Sync for WithLifetime<'static, Option<T>> {}
-//~^ ERROR
-//~| WARNING this will change its meaning
-
-fn main() {}
diff --git a/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr b/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr
deleted file mode 100644
index ee03ea12557..00000000000
--- a/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr
+++ /dev/null
@@ -1,52 +0,0 @@
-error: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/suspicious-negative-impls-lint.rs:7:1
-   |
-LL | impl !Send for ContainsVec<u32> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `u32` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/suspicious-negative-impls-lint.rs:6:1
-   |
-LL | struct ContainsVec<T>(Vec<T>);
-   | ^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
-  --> $DIR/suspicious-negative-impls-lint.rs:2:9
-   |
-LL | #![deny(suspicious_auto_trait_impls)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/suspicious-negative-impls-lint.rs:12:1
-   |
-LL | impl<T> !Send for WithPhantomDataSend<*const T, u8> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `*const T` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/suspicious-negative-impls-lint.rs:11:1
-   |
-LL | pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: cross-crate traits with a default impl, like `Sync`, should not be specialized
-  --> $DIR/suspicious-negative-impls-lint.rs:17:1
-   |
-LL | impl<T> !Sync for WithLifetime<'static, Option<T>> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `Option<T>` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/suspicious-negative-impls-lint.rs:16:1
-   |
-LL | pub struct WithLifetime<'a, T>(&'a (), T);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 3 previous errors
-
diff --git a/tests/ui/check-static-values-constraints.stderr b/tests/ui/check-static-values-constraints.stderr
index 064eb4b8a5c..e7532de5647 100644
--- a/tests/ui/check-static-values-constraints.stderr
+++ b/tests/ui/check-static-values-constraints.stderr
@@ -129,17 +129,6 @@ LL | static STATIC19: Vec<isize> = vec![3];
    = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0507]: cannot move out of static item `x`
-  --> $DIR/check-static-values-constraints.rs:119:9
-   |
-LL |         x
-   |         ^ move occurs because `x` has type `Vec<isize>`, which does not implement the `Copy` trait
-   |
-help: consider borrowing here
-   |
-LL |         &x
-   |         +
-
 error[E0010]: allocations are not allowed in statics
   --> $DIR/check-static-values-constraints.rs:117:32
    |
@@ -158,6 +147,17 @@ LL |         static x: Vec<isize> = vec![3];
    = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
+error[E0507]: cannot move out of static item `x`
+  --> $DIR/check-static-values-constraints.rs:119:9
+   |
+LL |         x
+   |         ^ move occurs because `x` has type `Vec<isize>`, which does not implement the `Copy` trait
+   |
+help: consider borrowing here
+   |
+LL |         &x
+   |         +
+
 error: aborting due to 17 previous errors
 
 Some errors have detailed explanations: E0010, E0015, E0493, E0507.
diff --git a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs
index 76a57936e69..24b87892753 100644
--- a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs
+++ b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.rs
@@ -13,7 +13,5 @@ impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR found both positive and nega
 unsafe impl<T: 'static> Send for TestType<T> {} //~ ERROR conflicting implementations
 
 impl !Send for TestType<i32> {}
-//~^ WARNING
-//~| WARNING this will change its meaning
 
 fn main() {}
diff --git a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr
index 020199da991..2463f38a922 100644
--- a/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr
+++ b/tests/ui/coherence/coherence-conflicting-negative-trait-impl.stderr
@@ -16,23 +16,7 @@ LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
 LL | unsafe impl<T: 'static> Send for TestType<T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
 
-warning: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/coherence-conflicting-negative-trait-impl.rs:15:1
-   |
-LL | impl !Send for TestType<i32> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `i32` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/coherence-conflicting-negative-trait-impl.rs:7:1
-   |
-LL | struct TestType<T>(::std::marker::PhantomData<T>);
-   | ^^^^^^^^^^^^^^^^^^
-   = note: `#[warn(suspicious_auto_trait_impls)]` on by default
-
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to 2 previous errors
 
 Some errors have detailed explanations: E0119, E0751.
 For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-fn-implied-bounds.rs b/tests/ui/coherence/coherence-fn-implied-bounds.rs
index 4539af9a32e..0ae54284102 100644
--- a/tests/ui/coherence/coherence-fn-implied-bounds.rs
+++ b/tests/ui/coherence/coherence-fn-implied-bounds.rs
@@ -20,7 +20,7 @@ impl Trait for for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32 {}
 
 impl Trait for for<'c> fn(&'c &'c u32, &'c &'c u32) -> &'c u32 {
     //~^ ERROR conflicting implementations
-    //~| WARNING this was previously accepted by the compiler
+    //~| WARN the behavior may change in a future release
 }
 
 fn main() {}
diff --git a/tests/ui/coherence/coherence-fn-implied-bounds.stderr b/tests/ui/coherence/coherence-fn-implied-bounds.stderr
index b0dea746709..ece3288989d 100644
--- a/tests/ui/coherence/coherence-fn-implied-bounds.stderr
+++ b/tests/ui/coherence/coherence-fn-implied-bounds.stderr
@@ -7,7 +7,7 @@ LL |
 LL | impl Trait for for<'c> fn(&'c &'c u32, &'c &'c u32) -> &'c u32 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a &'b u32, &'b &'a u32) -> &'b u32`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = warning: the behavior may change in a future release
    = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
 note: the lint level is defined here
diff --git a/tests/ui/coherence/coherence-free-vs-bound-region.rs b/tests/ui/coherence/coherence-free-vs-bound-region.rs
index 2f5c49d293d..89d0005fb79 100644
--- a/tests/ui/coherence/coherence-free-vs-bound-region.rs
+++ b/tests/ui/coherence/coherence-free-vs-bound-region.rs
@@ -15,7 +15,7 @@ impl<'a> TheTrait for fn(&'a u8) {}
 
 impl TheTrait for fn(&u8) {
     //~^ ERROR conflicting implementations of trait
-    //~| WARNING this was previously accepted by the compiler
+    //~| WARN the behavior may change in a future release
 }
 
 fn main() {}
diff --git a/tests/ui/coherence/coherence-free-vs-bound-region.stderr b/tests/ui/coherence/coherence-free-vs-bound-region.stderr
index c97b32e429d..e45cf5ad3a4 100644
--- a/tests/ui/coherence/coherence-free-vs-bound-region.stderr
+++ b/tests/ui/coherence/coherence-free-vs-bound-region.stderr
@@ -7,7 +7,7 @@ LL |
 LL | impl TheTrait for fn(&u8) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&u8)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = warning: the behavior may change in a future release
    = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
 note: the lint level is defined here
diff --git a/tests/ui/coherence/coherence-orphan.rs b/tests/ui/coherence/coherence-orphan.rs
index c06705133c8..9c96958f21a 100644
--- a/tests/ui/coherence/coherence-orphan.rs
+++ b/tests/ui/coherence/coherence-orphan.rs
@@ -7,18 +7,16 @@ use lib::TheTrait;
 
 struct TheType;
 
-impl TheTrait<usize> for isize { }
+impl TheTrait<usize> for isize {}
 //~^ ERROR E0117
 //~| ERROR not all trait items implemented
 
-impl TheTrait<TheType> for isize { }
+impl TheTrait<TheType> for isize {}
 //~^ ERROR not all trait items implemented
 
-impl TheTrait<isize> for TheType { }
+impl TheTrait<isize> for TheType {}
 //~^ ERROR not all trait items implemented
 
-impl !Send for Vec<isize> { } //~ ERROR E0117
-//~^ WARNING
-//~| WARNING this will change its meaning
+impl !Send for Vec<isize> {} //~ ERROR E0117
 
-fn main() { }
+fn main() {}
diff --git a/tests/ui/coherence/coherence-orphan.stderr b/tests/ui/coherence/coherence-orphan.stderr
index 78fad837647..b1bb75bfe51 100644
--- a/tests/ui/coherence/coherence-orphan.stderr
+++ b/tests/ui/coherence/coherence-orphan.stderr
@@ -1,7 +1,7 @@
 error[E0117]: only traits defined in the current crate can be implemented for primitive types
   --> $DIR/coherence-orphan.rs:10:1
    |
-LL | impl TheTrait<usize> for isize { }
+LL | impl TheTrait<usize> for isize {}
    | ^^^^^---------------^^^^^-----
    | |    |                   |
    | |    |                   `isize` is not defined in the current crate
@@ -13,7 +13,7 @@ LL | impl TheTrait<usize> for isize { }
 error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate
   --> $DIR/coherence-orphan.rs:20:1
    |
-LL | impl !Send for Vec<isize> { }
+LL | impl !Send for Vec<isize> {}
    | ^^^^^^^^^^^^^^^----------
    | |              |
    | |              `Vec` is not defined in the current crate
@@ -21,23 +21,10 @@ LL | impl !Send for Vec<isize> { }
    |
    = note: define and implement a trait or new type instead
 
-warning: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/coherence-orphan.rs:20:1
-   |
-LL | impl !Send for Vec<isize> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `isize` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-   = note: `#[warn(suspicious_auto_trait_impls)]` on by default
-
 error[E0046]: not all trait items implemented, missing: `the_fn`
   --> $DIR/coherence-orphan.rs:10:1
    |
-LL | impl TheTrait<usize> for isize { }
+LL | impl TheTrait<usize> for isize {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `the_fn` in implementation
    |
    = help: implement the missing item: `fn the_fn(&self) { todo!() }`
@@ -45,7 +32,7 @@ LL | impl TheTrait<usize> for isize { }
 error[E0046]: not all trait items implemented, missing: `the_fn`
   --> $DIR/coherence-orphan.rs:14:1
    |
-LL | impl TheTrait<TheType> for isize { }
+LL | impl TheTrait<TheType> for isize {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `the_fn` in implementation
    |
    = help: implement the missing item: `fn the_fn(&self) { todo!() }`
@@ -53,12 +40,12 @@ LL | impl TheTrait<TheType> for isize { }
 error[E0046]: not all trait items implemented, missing: `the_fn`
   --> $DIR/coherence-orphan.rs:17:1
    |
-LL | impl TheTrait<isize> for TheType { }
+LL | impl TheTrait<isize> for TheType {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `the_fn` in implementation
    |
    = help: implement the missing item: `fn the_fn(&self) { todo!() }`
 
-error: aborting due to 5 previous errors; 1 warning emitted
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0046, E0117.
 For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/coherence/coherence-overlap-negative-impls.rs b/tests/ui/coherence/coherence-overlap-negative-impls.rs
index 9a85d8c5a63..ffcd56817e5 100644
--- a/tests/ui/coherence/coherence-overlap-negative-impls.rs
+++ b/tests/ui/coherence/coherence-overlap-negative-impls.rs
@@ -15,16 +15,20 @@ struct Test;
 
 trait Fold<F> {}
 
-impl<T, F> Fold<F> for Cons<T> // 0
+impl<T, F> Fold<F> for Cons<T>
+// 0
 where
     T: Fold<Nil>,
-{}
+{
+}
 
-impl<T, F> Fold<F> for Cons<T> // 1
+impl<T, F> Fold<F> for Cons<T>
+// 1
 where
     T: Fold<F>,
     private::Is<T>: private::NotNil,
-{}
+{
+}
 
 impl<F> Fold<F> for Test {} // 2
 
@@ -34,7 +38,6 @@ mod private {
     pub struct Is<T>(T);
     pub auto trait NotNil {}
 
-    #[allow(suspicious_auto_trait_impls)]
     impl !NotNil for Is<Nil> {}
 }
 
diff --git a/tests/ui/coherence/coherence-subtyping.rs b/tests/ui/coherence/coherence-subtyping.rs
index da0cc2d0265..4365ad5c884 100644
--- a/tests/ui/coherence/coherence-subtyping.rs
+++ b/tests/ui/coherence/coherence-subtyping.rs
@@ -13,8 +13,8 @@ trait TheTrait {
 impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {}
 
 impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
-    //~^ WARNING conflicting implementation
-    //~^^ WARNING this was previously accepted by the compiler but is being phased out
+    //~^ WARN conflicting implementation
+    //~| WARN the behavior may change in a future release
 }
 
 fn main() {}
diff --git a/tests/ui/coherence/coherence-subtyping.stderr b/tests/ui/coherence/coherence-subtyping.stderr
index 9d90019a50f..42f256ace78 100644
--- a/tests/ui/coherence/coherence-subtyping.stderr
+++ b/tests/ui/coherence/coherence-subtyping.stderr
@@ -7,7 +7,7 @@ LL |
 LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = warning: the behavior may change in a future release
    = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
    = note: `#[warn(coherence_leak_check)]` on by default
diff --git a/tests/ui/coherence/coherence-wasm-bindgen.rs b/tests/ui/coherence/coherence-wasm-bindgen.rs
index ee09a72449b..57daaa134d4 100644
--- a/tests/ui/coherence/coherence-wasm-bindgen.rs
+++ b/tests/ui/coherence/coherence-wasm-bindgen.rs
@@ -31,7 +31,7 @@ where
     R: ReturnWasmAbi,
 {
     //~^^^^^ ERROR conflicting implementation
-    //~| WARNING this was previously accepted
+    //~| WARN the behavior may change in a future release
 }
 
 fn main() {}
diff --git a/tests/ui/coherence/coherence-wasm-bindgen.stderr b/tests/ui/coherence/coherence-wasm-bindgen.stderr
index b3c3dac612d..939f1fce9a4 100644
--- a/tests/ui/coherence/coherence-wasm-bindgen.stderr
+++ b/tests/ui/coherence/coherence-wasm-bindgen.stderr
@@ -13,7 +13,7 @@ LL | |     A: RefFromWasmAbi,
 LL | |     R: ReturnWasmAbi,
    | |_____________________^ conflicting implementation for `&dyn Fn(&_) -> _`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = warning: the behavior may change in a future release
    = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
    = note: downstream crates may implement trait `FromWasmAbi` for type `&_`
    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
diff --git a/tests/ui/coherence/const-errs-dont-conflict-103369.rs b/tests/ui/coherence/const-errs-dont-conflict-103369.rs
new file mode 100644
index 00000000000..c7d46a8000d
--- /dev/null
+++ b/tests/ui/coherence/const-errs-dont-conflict-103369.rs
@@ -0,0 +1,14 @@
+// #103369: don't complain about conflicting implementations with [const error]
+
+pub trait ConstGenericTrait<const N: u32> {}
+
+impl ConstGenericTrait<{my_fn(1)}> for () {}
+
+impl ConstGenericTrait<{my_fn(2)}> for () {}
+
+const fn my_fn(v: u32) -> u32 {
+    panic!("Some error occurred"); //~ ERROR E0080
+    //~| ERROR E0080
+}
+
+fn main() {}
diff --git a/tests/ui/coherence/const-errs-dont-conflict-103369.stderr b/tests/ui/coherence/const-errs-dont-conflict-103369.stderr
new file mode 100644
index 00000000000..22066d6b6bd
--- /dev/null
+++ b/tests/ui/coherence/const-errs-dont-conflict-103369.stderr
@@ -0,0 +1,39 @@
+error[E0080]: evaluation of constant value failed
+  --> $DIR/const-errs-dont-conflict-103369.rs:10:5
+   |
+LL |     panic!("Some error occurred");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Some error occurred', $DIR/const-errs-dont-conflict-103369.rs:10:5
+   |
+note: inside `my_fn`
+  --> $DIR/const-errs-dont-conflict-103369.rs:10:5
+   |
+LL |     panic!("Some error occurred");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `<() as ConstGenericTrait<{my_fn(1)}>>::{constant#0}`
+  --> $DIR/const-errs-dont-conflict-103369.rs:5:25
+   |
+LL | impl ConstGenericTrait<{my_fn(1)}> for () {}
+   |                         ^^^^^^^^
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0080]: evaluation of constant value failed
+  --> $DIR/const-errs-dont-conflict-103369.rs:10:5
+   |
+LL |     panic!("Some error occurred");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Some error occurred', $DIR/const-errs-dont-conflict-103369.rs:10:5
+   |
+note: inside `my_fn`
+  --> $DIR/const-errs-dont-conflict-103369.rs:10:5
+   |
+LL |     panic!("Some error occurred");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `<() as ConstGenericTrait<{my_fn(2)}>>::{constant#0}`
+  --> $DIR/const-errs-dont-conflict-103369.rs:7:25
+   |
+LL | impl ConstGenericTrait<{my_fn(2)}> for () {}
+   |                         ^^^^^^^^
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr b/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr
index 5368db29338..832c56a4554 100644
--- a/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr
+++ b/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.explicit.stderr
@@ -6,7 +6,7 @@ LL | impl<T: ?Sized + Marker> FnMarker for fn(T) {}
 LL | impl<T: ?Sized> FnMarker for fn(&T) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(&_)`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = warning: the behavior may change in a future release
    = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
 note: the lint level is defined here
diff --git a/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs b/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs
index 7967002e021..e487dcc3c0e 100644
--- a/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs
+++ b/tests/ui/coherence/negative-coherence-placeholder-region-constraints-on-unification.rs
@@ -20,6 +20,6 @@ trait FnMarker {}
 impl<T: ?Sized + Marker> FnMarker for fn(T) {}
 impl<T: ?Sized> FnMarker for fn(&T) {}
 //[explicit]~^ ERROR conflicting implementations of trait `FnMarker` for type `fn(&_)`
-//[explicit]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+//[explicit]~| WARN the behavior may change in a future release
 
 fn main() {}
diff --git a/tests/ui/coherence/occurs-check/associated-type.next.stderr b/tests/ui/coherence/occurs-check/associated-type.next.stderr
index 65be4a9c884..e405f389f5e 100644
--- a/tests/ui/coherence/occurs-check/associated-type.next.stderr
+++ b/tests/ui/coherence/occurs-check/associated-type.next.stderr
@@ -1,11 +1,11 @@
 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
-WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
+WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
-WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
+WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
-WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
+WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
-WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
+WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
 error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())`
   --> $DIR/associated-type.rs:31:1
    |
diff --git a/tests/ui/coherence/occurs-check/associated-type.old.stderr b/tests/ui/coherence/occurs-check/associated-type.old.stderr
index 8e852ec796e..4a67a777f10 100644
--- a/tests/ui/coherence/occurs-check/associated-type.old.stderr
+++ b/tests/ui/coherence/occurs-check/associated-type.old.stderr
@@ -1,11 +1,11 @@
 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
-WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!3_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
+WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
-WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!3_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
+WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
-WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!3_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
+WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
-WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!3_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
+WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const ?1t, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) })
 error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), _)>` for type `for<'a> fn(&'a (), _)`
   --> $DIR/associated-type.rs:31:1
    |
diff --git a/tests/ui/const-generics/invariant.rs b/tests/ui/const-generics/invariant.rs
index 39d658be67d..ee4ad4e7c4e 100644
--- a/tests/ui/const-generics/invariant.rs
+++ b/tests/ui/const-generics/invariant.rs
@@ -12,18 +12,16 @@ impl SadBee for for<'a> fn(&'a ()) {
     const ASSOC: usize = 0;
 }
 impl SadBee for fn(&'static ()) {
-    //~^ WARNING conflicting implementations of trait
-    //~| WARNING this was previously accepted
+    //~^ WARN conflicting implementations of trait
+    //~| WARN the behavior may change in a future release
     const ASSOC: usize = 100;
 }
 
 struct Foo<T: SadBee>([u8; <T as SadBee>::ASSOC], PhantomData<T>)
 where
-    [(); <T as SadBee>::ASSOC]: ;
+    [(); <T as SadBee>::ASSOC]:;
 
-fn covariant(
-    v: &'static Foo<for<'a> fn(&'a ())>
-) -> &'static Foo<fn(&'static ())> {
+fn covariant(v: &'static Foo<for<'a> fn(&'a ())>) -> &'static Foo<fn(&'static ())> {
     v
     //~^ ERROR mismatched types
 }
diff --git a/tests/ui/const-generics/invariant.stderr b/tests/ui/const-generics/invariant.stderr
index f631e131146..b4e46e55268 100644
--- a/tests/ui/const-generics/invariant.stderr
+++ b/tests/ui/const-generics/invariant.stderr
@@ -7,13 +7,13 @@ LL | impl SadBee for for<'a> fn(&'a ()) {
 LL | impl SadBee for fn(&'static ()) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())`
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = warning: the behavior may change in a future release
    = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
    = note: `#[warn(coherence_leak_check)]` on by default
 
 error[E0308]: mismatched types
-  --> $DIR/invariant.rs:27:5
+  --> $DIR/invariant.rs:25:5
    |
 LL |     v
    |     ^ one type is more general than the other
diff --git a/tests/ui/const-generics/issues/issue-100313.rs b/tests/ui/const-generics/issues/issue-100313.rs
index 9af9b5ca458..4e9d3626aa8 100644
--- a/tests/ui/const-generics/issues/issue-100313.rs
+++ b/tests/ui/const-generics/issues/issue-100313.rs
@@ -9,7 +9,6 @@ impl <const B: &'static bool> T<B> {
         unsafe {
             *(B as *const bool as *mut bool) = false;
             //~^ ERROR evaluation of constant value failed [E0080]
-            //~| ERROR assigning to `&T` is undefined behavior
         }
     }
 }
diff --git a/tests/ui/const-generics/issues/issue-100313.stderr b/tests/ui/const-generics/issues/issue-100313.stderr
index 5832dbe1777..a422764fe2c 100644
--- a/tests/ui/const-generics/issues/issue-100313.stderr
+++ b/tests/ui/const-generics/issues/issue-100313.stderr
@@ -1,12 +1,3 @@
-error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
-  --> $DIR/issue-100313.rs:10:13
-   |
-LL |             *(B as *const bool as *mut bool) = false;
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
-   = note: `#[deny(invalid_reference_casting)]` on by default
-
 error[E0080]: evaluation of constant value failed
   --> $DIR/issue-100313.rs:10:13
    |
@@ -19,11 +10,11 @@ note: inside `T::<&true>::set_false`
 LL |             *(B as *const bool as *mut bool) = false;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 note: inside `_`
-  --> $DIR/issue-100313.rs:19:5
+  --> $DIR/issue-100313.rs:18:5
    |
 LL |     x.set_false();
    |     ^^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-array-oob.rs b/tests/ui/consts/const-array-oob.rs
index c747ab50c16..cf3db077e36 100644
--- a/tests/ui/consts/const-array-oob.rs
+++ b/tests/ui/consts/const-array-oob.rs
@@ -1,5 +1,6 @@
 const FOO: [usize; 3] = [1, 2, 3];
-const BAR: usize = FOO[5]; // no error, because the error below occurs before regular const eval
+const BAR: usize = FOO[5];
+//~^ ERROR: evaluation of constant value failed
 
 const BLUB: [u32; FOO[4]] = [5, 6];
 //~^ ERROR evaluation of constant value failed [E0080]
diff --git a/tests/ui/consts/const-array-oob.stderr b/tests/ui/consts/const-array-oob.stderr
index d481d772894..be31f183b9a 100644
--- a/tests/ui/consts/const-array-oob.stderr
+++ b/tests/ui/consts/const-array-oob.stderr
@@ -1,9 +1,15 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-array-oob.rs:4:19
+  --> $DIR/const-array-oob.rs:5:19
    |
 LL | const BLUB: [u32; FOO[4]] = [5, 6];
    |                   ^^^^^^ index out of bounds: the length is 3 but the index is 4
 
-error: aborting due to 1 previous error
+error[E0080]: evaluation of constant value failed
+  --> $DIR/const-array-oob.rs:2:20
+   |
+LL | const BAR: usize = FOO[5];
+   |                    ^^^^^^ index out of bounds: the length is 3 but the index is 5
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/const-eval-query-stack.stderr b/tests/ui/consts/const-eval/const-eval-query-stack.stderr
index 2fcb3d41dd9..96fd9ed5f04 100644
--- a/tests/ui/consts/const-eval/const-eval-query-stack.stderr
+++ b/tests/ui/consts/const-eval/const-eval-query-stack.stderr
@@ -7,6 +7,5 @@ LL | const X: i32 = 1 / 0;
 query stack during panic:
 #0 [eval_to_allocation_raw] const-evaluating + checking `X`
 #1 [eval_to_const_value_raw] simplifying constant for the type system `X`
-#2 [lint_mod] linting top-level module
-#3 [analysis] running analysis passes on this crate
+#2 [analysis] running analysis passes on this crate
 end of query stack
diff --git a/tests/ui/consts/const-eval/const_fn_ptr.stderr b/tests/ui/consts/const-eval/const_fn_ptr.stderr
index ca1585f8837..682a5a23afc 100644
--- a/tests/ui/consts/const-eval/const_fn_ptr.stderr
+++ b/tests/ui/consts/const-eval/const_fn_ptr.stderr
@@ -1,11 +1,6 @@
 warning: skipping const checks
    |
 help: skipping check that does not even have a feature gate
-  --> $DIR/const_fn_ptr.rs:11:5
-   |
-LL |     X(x)
-   |     ^^^^
-help: skipping check that does not even have a feature gate
   --> $DIR/const_fn_ptr.rs:15:5
    |
 LL |     X_CONST(x)
@@ -15,6 +10,11 @@ help: skipping check that does not even have a feature gate
    |
 LL |     x(y)
    |     ^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_fn_ptr.rs:11:5
+   |
+LL |     X(x)
+   |     ^^^^
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/consts/const-eval/generic-slice.stderr b/tests/ui/consts/const-eval/generic-slice.stderr
index ff1dc29ccfd..8559f6d1a44 100644
--- a/tests/ui/consts/const-eval/generic-slice.stderr
+++ b/tests/ui/consts/const-eval/generic-slice.stderr
@@ -1,4 +1,18 @@
 error[E0597]: `x` does not live long enough
+  --> $DIR/generic-slice.rs:27:5
+   |
+LL |     let x: &[_] = &[];
+   |         - binding `x` declared here
+LL |     &x
+   |     ^^
+   |     |
+   |     borrowed value does not live long enough
+   |     using this value as a static requires that `x` is borrowed for `'static`
+LL |
+LL | };
+   | - `x` dropped here while still borrowed
+
+error[E0597]: `x` does not live long enough
   --> $DIR/generic-slice.rs:15:9
    |
 LL | impl<'a, T: 'static> Generic<'a, T> {
@@ -15,20 +29,6 @@ LL |
 LL |     };
    |     - `x` dropped here while still borrowed
 
-error[E0597]: `x` does not live long enough
-  --> $DIR/generic-slice.rs:27:5
-   |
-LL |     let x: &[_] = &[];
-   |         - binding `x` declared here
-LL |     &x
-   |     ^^
-   |     |
-   |     borrowed value does not live long enough
-   |     using this value as a static requires that `x` is borrowed for `'static`
-LL |
-LL | };
-   | - `x` dropped here while still borrowed
-
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs
index 5fc0674c576..261dea6182d 100644
--- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs
+++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs
@@ -1,7 +1,6 @@
 const fn foo() -> ! {
     unsafe { std::mem::transmute(()) }
     //~^ ERROR evaluation of constant value failed
-    //~| WARN the type `!` does not permit zero-initialization [invalid_value]
 }
 
 // Type defined in a submodule, so that it is not "visibly"
@@ -18,7 +17,6 @@ const FOO: [empty::Empty; 3] = [foo(); 3];
 
 const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
 //~^ ERROR evaluation of constant value failed
-//~| WARN the type `empty::Empty` does not permit zero-initialization
 
 fn main() {
     FOO;
diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr
index 4c50ab5319e..d9f1780f7b9 100644
--- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr
+++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.stderr
@@ -1,12 +1,3 @@
-warning: the type `!` does not permit zero-initialization
-  --> $DIR/validate_uninhabited_zsts.rs:2:14
-   |
-LL |     unsafe { std::mem::transmute(()) }
-   |              ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
-   |
-   = note: the `!` type has no valid value
-   = note: `#[warn(invalid_value)]` on by default
-
 error[E0080]: evaluation of constant value failed
   --> $DIR/validate_uninhabited_zsts.rs:2:14
    |
@@ -19,34 +10,17 @@ note: inside `foo`
 LL |     unsafe { std::mem::transmute(()) }
    |              ^^^^^^^^^^^^^^^^^^^^^^^
 note: inside `FOO`
-  --> $DIR/validate_uninhabited_zsts.rs:17:33
+  --> $DIR/validate_uninhabited_zsts.rs:16:33
    |
 LL | const FOO: [empty::Empty; 3] = [foo(); 3];
    |                                 ^^^^^
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/validate_uninhabited_zsts.rs:19:42
+  --> $DIR/validate_uninhabited_zsts.rs:18:42
    |
 LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
    |                                          ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered a value of uninhabited type `Void`
 
-warning: the type `empty::Empty` does not permit zero-initialization
-  --> $DIR/validate_uninhabited_zsts.rs:19:42
-   |
-LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
-   |                                          ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
-   |
-note: in this struct field
-  --> $DIR/validate_uninhabited_zsts.rs:14:22
-   |
-LL |     pub struct Empty(Void);
-   |                      ^^^^
-note: enums with no inhabited variants have no valid value
-  --> $DIR/validate_uninhabited_zsts.rs:11:5
-   |
-LL |     enum Void {}
-   |     ^^^^^^^^^
-
-error: aborting due to 2 previous errors; 2 warnings emitted
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-mut-refs/issue-76510.rs b/tests/ui/consts/const-mut-refs/issue-76510.rs
index b6a73abb09c..685e3a129c2 100644
--- a/tests/ui/consts/const-mut-refs/issue-76510.rs
+++ b/tests/ui/consts/const-mut-refs/issue-76510.rs
@@ -3,7 +3,6 @@ use std::mem::{transmute, ManuallyDrop};
 const S: &'static mut str = &mut " hello ";
 //~^ ERROR: mutable references are not allowed in the final value of constants
 //~| ERROR: mutation through a reference is not allowed in constants
-//~| ERROR: cannot borrow data in a `&` reference as mutable
 
 const fn trigger() -> [(); unsafe {
         let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
diff --git a/tests/ui/consts/const-mut-refs/issue-76510.stderr b/tests/ui/consts/const-mut-refs/issue-76510.stderr
index 8a1b19baff7..ab4487026cf 100644
--- a/tests/ui/consts/const-mut-refs/issue-76510.stderr
+++ b/tests/ui/consts/const-mut-refs/issue-76510.stderr
@@ -14,13 +14,7 @@ LL | const S: &'static mut str = &mut " hello ";
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0596]: cannot borrow data in a `&` reference as mutable
-  --> $DIR/issue-76510.rs:3:29
-   |
-LL | const S: &'static mut str = &mut " hello ";
-   |                             ^^^^^^^^^^^^^^ cannot borrow as mutable
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0596, E0658, E0764.
-For more information about an error, try `rustc --explain E0596`.
+Some errors have detailed explanations: E0658, E0764.
+For more information about an error, try `rustc --explain E0658`.
diff --git a/tests/ui/consts/const_cmp_type_id.stderr b/tests/ui/consts/const_cmp_type_id.stderr
index 84be0b67307..98f5b3a5e90 100644
--- a/tests/ui/consts/const_cmp_type_id.stderr
+++ b/tests/ui/consts/const_cmp_type_id.stderr
@@ -4,6 +4,12 @@ error[E0131]: `main` function is not allowed to have generic parameters
 LL | const fn main() {
    |              ^ `main` cannot have generic parameters
 
+error[E0080]: evaluation of constant value failed
+  --> $DIR/const_cmp_type_id.rs:10:22
+   |
+LL |     const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<TypeId as PartialOrd>::lt`
+
 error[E0308]: mismatched types
   --> $DIR/const_cmp_type_id.rs:8:13
    |
@@ -22,7 +28,7 @@ LL |     assert!(TypeId::of::<()>() != TypeId::of::<u8>());
    = note: expected constant `host`
               found constant `true`
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0131, E0308.
-For more information about an error, try `rustc --explain E0131`.
+Some errors have detailed explanations: E0080, E0131, E0308.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const_let_assign3.stderr b/tests/ui/consts/const_let_assign3.stderr
index 40c11acee5c..ae890131715 100644
--- a/tests/ui/consts/const_let_assign3.stderr
+++ b/tests/ui/consts/const_let_assign3.stderr
@@ -1,18 +1,18 @@
-error[E0658]: mutable references are not allowed in constant functions
-  --> $DIR/const_let_assign3.rs:6:18
+error[E0658]: mutable references are not allowed in constants
+  --> $DIR/const_let_assign3.rs:14:5
    |
-LL |     const fn foo(&mut self, x: u32) {
-   |                  ^^^^^^^^^
+LL |     s.foo(3);
+   |     ^
    |
    = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: mutable references are not allowed in constants
-  --> $DIR/const_let_assign3.rs:14:5
+error[E0658]: mutable references are not allowed in constant functions
+  --> $DIR/const_let_assign3.rs:6:18
    |
-LL |     s.foo(3);
-   |     ^
+LL |     const fn foo(&mut self, x: u32) {
+   |                  ^^^^^^^^^
    |
    = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
diff --git a/tests/ui/consts/const_refs_to_static_fail_invalid.stderr b/tests/ui/consts/const_refs_to_static_fail_invalid.stderr
index 4ff15f0c28b..d5bb4847746 100644
--- a/tests/ui/consts/const_refs_to_static_fail_invalid.stderr
+++ b/tests/ui/consts/const_refs_to_static_fail_invalid.stderr
@@ -9,12 +9,6 @@ LL |     const C: &bool = unsafe { std::mem::transmute(&S) };
                HEX_DUMP
            }
 
-error: could not evaluate constant pattern
-  --> $DIR/const_refs_to_static_fail_invalid.rs:15:9
-   |
-LL |         C => {}
-   |         ^
-
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/const_refs_to_static_fail_invalid.rs:25:5
    |
@@ -26,12 +20,6 @@ LL |     const C: &i8 = unsafe { &S };
                HEX_DUMP
            }
 
-error: could not evaluate constant pattern
-  --> $DIR/const_refs_to_static_fail_invalid.rs:31:9
-   |
-LL |         C => {}
-   |         ^
-
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/const_refs_to_static_fail_invalid.rs:39:5
    |
@@ -44,6 +32,18 @@ LL |     const C: &i32 = unsafe { &S_MUT };
            }
 
 error: could not evaluate constant pattern
+  --> $DIR/const_refs_to_static_fail_invalid.rs:15:9
+   |
+LL |         C => {}
+   |         ^
+
+error: could not evaluate constant pattern
+  --> $DIR/const_refs_to_static_fail_invalid.rs:31:9
+   |
+LL |         C => {}
+   |         ^
+
+error: could not evaluate constant pattern
   --> $DIR/const_refs_to_static_fail_invalid.rs:46:9
    |
 LL |         C => {}
diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr
index afe89461f03..527579d99ea 100644
--- a/tests/ui/consts/fn_trait_refs.stderr
+++ b/tests/ui/consts/fn_trait_refs.stderr
@@ -74,6 +74,24 @@ LL |     T: ~const FnMut<()> + ~const Destruct,
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
+error[E0015]: cannot call non-const operator in constants
+  --> $DIR/fn_trait_refs.rs:72:17
+   |
+LL |         assert!(test_one == (1, 1, 1));
+   |                 ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = help: add `#![feature(effects)]` to the crate attributes to enable
+
+error[E0015]: cannot call non-const operator in constants
+  --> $DIR/fn_trait_refs.rs:75:17
+   |
+LL |         assert!(test_two == (2, 2));
+   |                 ^^^^^^^^^^^^^^^^^^
+   |
+   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = help: add `#![feature(effects)]` to the crate attributes to enable
+
 error[E0015]: cannot call non-const closure in constant functions
   --> $DIR/fn_trait_refs.rs:17:5
    |
@@ -149,24 +167,6 @@ LL | const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
 LL | }
    | - value is dropped here
 
-error[E0015]: cannot call non-const operator in constants
-  --> $DIR/fn_trait_refs.rs:72:17
-   |
-LL |         assert!(test_one == (1, 1, 1));
-   |                 ^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
-   = help: add `#![feature(effects)]` to the crate attributes to enable
-
-error[E0015]: cannot call non-const operator in constants
-  --> $DIR/fn_trait_refs.rs:75:17
-   |
-LL |         assert!(test_two == (2, 2));
-   |                 ^^^^^^^^^^^^^^^^^^
-   |
-   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
-   = help: add `#![feature(effects)]` to the crate attributes to enable
-
 error: aborting due to 20 previous errors
 
 Some errors have detailed explanations: E0015, E0493, E0635.
diff --git a/tests/ui/consts/issue-16538.stderr b/tests/ui/consts/issue-16538.stderr
index 834ffa8d3a0..3981b4ada49 100644
--- a/tests/ui/consts/issue-16538.stderr
+++ b/tests/ui/consts/issue-16538.stderr
@@ -1,3 +1,12 @@
+error[E0015]: cannot call non-const fn `Y::foo` in statics
+  --> $DIR/issue-16538.rs:11:23
+   |
+LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: calls in statics are limited to constant functions, tuple structs and tuple variants
+   = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
+
 error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
   --> $DIR/issue-16538.rs:11:22
    |
@@ -14,15 +23,6 @@ LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
    |
    = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
 
-error[E0015]: cannot call non-const fn `Y::foo` in statics
-  --> $DIR/issue-16538.rs:11:23
-   |
-LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
-   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: calls in statics are limited to constant functions, tuple structs and tuple variants
-   = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
-
 error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0015, E0133.
diff --git a/tests/ui/consts/issue-66693.rs b/tests/ui/consts/issue-66693.rs
index df45d01ec02..416bd8ec72a 100644
--- a/tests/ui/consts/issue-66693.rs
+++ b/tests/ui/consts/issue-66693.rs
@@ -12,9 +12,11 @@ const fn _foo() {
     //~^ ERROR: argument to `panic!()` in a const context must have type `&str`
 }
 
-// ensure that conforming panics don't cause an error
+// ensure that conforming panics don't cause an error beyond the failure to const eval
 const _: () = panic!();
+//~^ ERROR: evaluation of constant value failed
 static _BAR: () = panic!("panic in static");
+//~^ ERROR could not evaluate static initializer
 
 const fn _bar() {
     panic!("panic in const fn");
diff --git a/tests/ui/consts/issue-66693.stderr b/tests/ui/consts/issue-66693.stderr
index f4898fd9732..a435ace4773 100644
--- a/tests/ui/consts/issue-66693.stderr
+++ b/tests/ui/consts/issue-66693.stderr
@@ -14,6 +14,22 @@ LL | static _FOO: () = panic!(true);
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
+error[E0080]: evaluation of constant value failed
+  --> $DIR/issue-66693.rs:16:15
+   |
+LL | const _: () = panic!();
+   |               ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-66693.rs:16:15
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0080]: could not evaluate static initializer
+  --> $DIR/issue-66693.rs:18:19
+   |
+LL | static _BAR: () = panic!("panic in static");
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'panic in static', $DIR/issue-66693.rs:18:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
 error: argument to `panic!()` in a const context must have type `&str`
   --> $DIR/issue-66693.rs:11:5
    |
@@ -22,5 +38,6 @@ LL |     panic!(&1);
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 3 previous errors
+error: aborting due to 5 previous errors
 
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr
index 7b22fa4399f..7a7b7bc57da 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr
@@ -9,12 +9,6 @@ LL | const SLICE_MUT: &[u8; 1] = {
                HEX_DUMP
            }
 
-error: could not evaluate constant pattern
-  --> $DIR/const_refers_to_static_cross_crate.rs:40:9
-   |
-LL |         SLICE_MUT => true,
-   |         ^^^^^^^^^
-
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/const_refers_to_static_cross_crate.rs:17:1
    |
@@ -26,12 +20,6 @@ LL | const U8_MUT: &u8 = {
                HEX_DUMP
            }
 
-error: could not evaluate constant pattern
-  --> $DIR/const_refers_to_static_cross_crate.rs:48:9
-   |
-LL |         U8_MUT => true,
-   |         ^^^^^^
-
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/const_refers_to_static_cross_crate.rs:23:1
    |
@@ -43,12 +31,6 @@ LL | const U8_MUT2: &u8 = {
                HEX_DUMP
            }
 
-error: could not evaluate constant pattern
-  --> $DIR/const_refers_to_static_cross_crate.rs:58:9
-   |
-LL |         U8_MUT2 => true,
-   |         ^^^^^^^
-
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_refers_to_static_cross_crate.rs:29:15
    |
@@ -56,6 +38,24 @@ LL |         match static_cross_crate::OPT_ZERO {
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses mutable global memory
 
 error: could not evaluate constant pattern
+  --> $DIR/const_refers_to_static_cross_crate.rs:40:9
+   |
+LL |         SLICE_MUT => true,
+   |         ^^^^^^^^^
+
+error: could not evaluate constant pattern
+  --> $DIR/const_refers_to_static_cross_crate.rs:48:9
+   |
+LL |         U8_MUT => true,
+   |         ^^^^^^
+
+error: could not evaluate constant pattern
+  --> $DIR/const_refers_to_static_cross_crate.rs:58:9
+   |
+LL |         U8_MUT2 => true,
+   |         ^^^^^^^
+
+error: could not evaluate constant pattern
   --> $DIR/const_refers_to_static_cross_crate.rs:65:9
    |
 LL |         U8_MUT3 => true,
diff --git a/tests/ui/consts/miri_unleashed/mutable_references.rs b/tests/ui/consts/miri_unleashed/mutable_references.rs
index a361c504b5e..ce7df4b1620 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references.rs
+++ b/tests/ui/consts/miri_unleashed/mutable_references.rs
@@ -4,29 +4,26 @@ use std::cell::UnsafeCell;
 
 // a test demonstrating what things we could allow with a smarter const qualification
 
-// this is fine because is not possible to mutate through an immutable reference.
 static FOO: &&mut u32 = &&mut 42;
+//~^ ERROR encountered mutable pointer in final value of static
 
-// this is fine because accessing an immutable static `BAR` is equivalent to accessing `*&BAR`
-// which puts the mutable reference behind an immutable one.
 static BAR: &mut () = &mut ();
+//~^ ERROR encountered mutable pointer in final value of static
 
 struct Foo<T>(T);
 
-// this is fine for the same reason as `BAR`.
 static BOO: &mut Foo<()> = &mut Foo(());
+//~^ ERROR encountered mutable pointer in final value of static
 
-// interior mutability is fine
 struct Meh {
     x: &'static UnsafeCell<i32>,
 }
 unsafe impl Sync for Meh {}
-static MEH: Meh = Meh {
-    x: &UnsafeCell::new(42),
-};
+static MEH: Meh = Meh { x: &UnsafeCell::new(42) };
+//~^ ERROR encountered mutable pointer in final value of static
 
-// this is fine for the same reason as `BAR`.
 static OH_YES: &mut i32 = &mut 42;
+//~^ ERROR encountered mutable pointer in final value of static
 
 fn main() {
     unsafe {
diff --git a/tests/ui/consts/miri_unleashed/mutable_references.stderr b/tests/ui/consts/miri_unleashed/mutable_references.stderr
index 39298842a33..532d7408e68 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references.stderr
+++ b/tests/ui/consts/miri_unleashed/mutable_references.stderr
@@ -1,5 +1,35 @@
+error: encountered mutable pointer in final value of static
+  --> $DIR/mutable_references.rs:7:1
+   |
+LL | static FOO: &&mut u32 = &&mut 42;
+   | ^^^^^^^^^^^^^^^^^^^^^
+
+error: encountered mutable pointer in final value of static
+  --> $DIR/mutable_references.rs:10:1
+   |
+LL | static BAR: &mut () = &mut ();
+   | ^^^^^^^^^^^^^^^^^^^
+
+error: encountered mutable pointer in final value of static
+  --> $DIR/mutable_references.rs:15:1
+   |
+LL | static BOO: &mut Foo<()> = &mut Foo(());
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: encountered mutable pointer in final value of static
+  --> $DIR/mutable_references.rs:22:1
+   |
+LL | static MEH: Meh = Meh { x: &UnsafeCell::new(42) };
+   | ^^^^^^^^^^^^^^^
+
+error: encountered mutable pointer in final value of static
+  --> $DIR/mutable_references.rs:25:1
+   |
+LL | static OH_YES: &mut i32 = &mut 42;
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+
 error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
-  --> $DIR/mutable_references.rs:35:5
+  --> $DIR/mutable_references.rs:32:5
    |
 LL |     *OH_YES = 99;
    |     ^^^^^^^^^^^^ cannot assign
@@ -7,31 +37,31 @@ LL |     *OH_YES = 99;
 warning: skipping const checks
    |
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references.rs:8:26
+  --> $DIR/mutable_references.rs:7:26
    |
 LL | static FOO: &&mut u32 = &&mut 42;
    |                          ^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references.rs:12:23
+  --> $DIR/mutable_references.rs:10:23
    |
 LL | static BAR: &mut () = &mut ();
    |                       ^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references.rs:17:28
+  --> $DIR/mutable_references.rs:15:28
    |
 LL | static BOO: &mut Foo<()> = &mut Foo(());
    |                            ^^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references.rs:25:8
+  --> $DIR/mutable_references.rs:22:28
    |
-LL |     x: &UnsafeCell::new(42),
-   |        ^^^^^^^^^^^^^^^^^^^^
+LL | static MEH: Meh = Meh { x: &UnsafeCell::new(42) };
+   |                            ^^^^^^^^^^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references.rs:29:27
+  --> $DIR/mutable_references.rs:25:27
    |
 LL | static OH_YES: &mut i32 = &mut 42;
    |                           ^^^^^^^
 
-error: aborting due to 1 previous error; 1 warning emitted
+error: aborting due to 6 previous errors; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0594`.
diff --git a/tests/ui/consts/promote-not.stderr b/tests/ui/consts/promote-not.stderr
index b93358e8dcc..524d6981721 100644
--- a/tests/ui/consts/promote-not.stderr
+++ b/tests/ui/consts/promote-not.stderr
@@ -19,26 +19,6 @@ LL | };
    | - temporary value is freed at the end of this statement
 
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/promote-not.rs:20:32
-   |
-LL |         let _x: &'static () = &foo();
-   |                 -----------    ^^^^^ creates a temporary value which is freed while still in use
-   |                 |
-   |                 type annotation requires that borrow lasts for `'static`
-LL |     }
-   |     - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
-  --> $DIR/promote-not.rs:28:29
-   |
-LL |     let _x: &'static i32 = &unsafe { U { x: 0 }.x };
-   |             ------------    ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
-   |             |
-   |             type annotation requires that borrow lasts for `'static`
-LL | }
-   | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
   --> $DIR/promote-not.rs:33:29
    |
 LL |     let _x: &'static i32 = &unsafe { U { x: 0 }.x };
@@ -59,6 +39,26 @@ LL | };
    | - temporary value is freed at the end of this statement
 
 error[E0716]: temporary value dropped while borrowed
+  --> $DIR/promote-not.rs:20:32
+   |
+LL |         let _x: &'static () = &foo();
+   |                 -----------    ^^^^^ creates a temporary value which is freed while still in use
+   |                 |
+   |                 type annotation requires that borrow lasts for `'static`
+LL |     }
+   |     - temporary value is freed at the end of this statement
+
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/promote-not.rs:28:29
+   |
+LL |     let _x: &'static i32 = &unsafe { U { x: 0 }.x };
+   |             ------------    ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
+   |             |
+   |             type annotation requires that borrow lasts for `'static`
+LL | }
+   | - temporary value is freed at the end of this statement
+
+error[E0716]: temporary value dropped while borrowed
   --> $DIR/promote-not.rs:46:29
    |
 LL |     let _val: &'static _ = &(Cell::new(1), 2).0;
diff --git a/tests/ui/consts/promoted_const_call2.stderr b/tests/ui/consts/promoted_const_call2.stderr
index 13d864ed3db..177f7aed17d 100644
--- a/tests/ui/consts/promoted_const_call2.stderr
+++ b/tests/ui/consts/promoted_const_call2.stderr
@@ -18,6 +18,12 @@ LL |     let _: &'static _ = &id(&String::new());
    |            |                 creates a temporary value which is freed while still in use
    |            type annotation requires that borrow lasts for `'static`
 
+error[E0493]: destructor of `String` cannot be evaluated at compile-time
+  --> $DIR/promoted_const_call2.rs:4:30
+   |
+LL |     let _: &'static _ = &id(&String::new());
+   |                              ^^^^^^^^^^^^^ the destructor for this type cannot be evaluated in constants
+
 error[E0716]: temporary value dropped while borrowed
   --> $DIR/promoted_const_call2.rs:11:26
    |
@@ -38,12 +44,6 @@ LL |     let _: &'static _ = &id(&String::new());
    |            |                 creates a temporary value which is freed while still in use
    |            type annotation requires that borrow lasts for `'static`
 
-error[E0493]: destructor of `String` cannot be evaluated at compile-time
-  --> $DIR/promoted_const_call2.rs:4:30
-   |
-LL |     let _: &'static _ = &id(&String::new());
-   |                              ^^^^^^^^^^^^^ the destructor for this type cannot be evaluated in constants
-
 error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0493, E0716.
diff --git a/tests/ui/consts/qualif-indirect-mutation-fail.stderr b/tests/ui/consts/qualif-indirect-mutation-fail.stderr
index 6379c00e4b4..458dc2071c4 100644
--- a/tests/ui/consts/qualif-indirect-mutation-fail.stderr
+++ b/tests/ui/consts/qualif-indirect-mutation-fail.stderr
@@ -1,21 +1,55 @@
-error[E0493]: destructor of `(u32, Option<String>)` cannot be evaluated at compile-time
-  --> $DIR/qualif-indirect-mutation-fail.rs:9:9
-   |
-LL |     let mut a: (u32, Option<String>) = (0, None);
-   |         ^^^^^ the destructor for this type cannot be evaluated in constant functions
-
 error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
   --> $DIR/qualif-indirect-mutation-fail.rs:15:9
    |
 LL |     let mut x = None;
    |         ^^^^^ the destructor for this type cannot be evaluated in constants
 
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+   |
+   = note: calling non-const function `<Vec<u8> as Drop>::drop`
+   |
+note: inside `std::ptr::drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `A1`
+  --> $DIR/qualif-indirect-mutation-fail.rs:21:1
+   |
+LL | };
+   | ^
+
 error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
   --> $DIR/qualif-indirect-mutation-fail.rs:31:9
    |
 LL |     let _z = x;
    |         ^^ the destructor for this type cannot be evaluated in constants
 
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+   |
+   = note: calling non-const function `<Vec<u8> as Drop>::drop`
+   |
+note: inside `std::ptr::drop_in_place::<Vec<u8>> - shim(Some(Vec<u8>))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `A2`
+  --> $DIR/qualif-indirect-mutation-fail.rs:32:1
+   |
+LL | };
+   | ^
+
+error[E0493]: destructor of `(u32, Option<String>)` cannot be evaluated at compile-time
+  --> $DIR/qualif-indirect-mutation-fail.rs:9:9
+   |
+LL |     let mut a: (u32, Option<String>) = (0, None);
+   |         ^^^^^ the destructor for this type cannot be evaluated in constant functions
+
 error[E0493]: destructor of `Option<T>` cannot be evaluated at compile-time
   --> $DIR/qualif-indirect-mutation-fail.rs:36:9
    |
@@ -52,6 +86,7 @@ error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
 LL |     let x: Option<String> = None;
    |         ^ the destructor for this type cannot be evaluated in constant functions
 
-error: aborting due to 9 previous errors
+error: aborting due to 11 previous errors
 
-For more information about this error, try `rustc --explain E0493`.
+Some errors have detailed explanations: E0080, E0493.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/recursive-zst-static.default.stderr b/tests/ui/consts/recursive-zst-static.default.stderr
index 7679c50c74b..dedca16db8d 100644
--- a/tests/ui/consts/recursive-zst-static.default.stderr
+++ b/tests/ui/consts/recursive-zst-static.default.stderr
@@ -16,17 +16,7 @@ note: ...which requires evaluating initializer of static `B`...
 LL | static B: () = A;
    |                ^
    = note: ...which again requires evaluating initializer of static `A`, completing the cycle
-note: cycle used when linting top-level module
-  --> $DIR/recursive-zst-static.rs:10:1
-   |
-LL | / static FOO: () = FOO;
-LL | |
-LL | |
-LL | | static A: () = B;
-...  |
-LL | |     FOO
-LL | | }
-   | |_^
+   = note: cycle used when running analysis passes on this crate
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/recursive-zst-static.unleash.stderr b/tests/ui/consts/recursive-zst-static.unleash.stderr
index 7679c50c74b..dedca16db8d 100644
--- a/tests/ui/consts/recursive-zst-static.unleash.stderr
+++ b/tests/ui/consts/recursive-zst-static.unleash.stderr
@@ -16,17 +16,7 @@ note: ...which requires evaluating initializer of static `B`...
 LL | static B: () = A;
    |                ^
    = note: ...which again requires evaluating initializer of static `A`, completing the cycle
-note: cycle used when linting top-level module
-  --> $DIR/recursive-zst-static.rs:10:1
-   |
-LL | / static FOO: () = FOO;
-LL | |
-LL | |
-LL | | static A: () = B;
-...  |
-LL | |     FOO
-LL | | }
-   | |_^
+   = note: cycle used when running analysis passes on this crate
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/coroutine/async_gen_fn_iter.rs b/tests/ui/coroutine/async_gen_fn_iter.rs
index c4a7629f314..42288712c70 100644
--- a/tests/ui/coroutine/async_gen_fn_iter.rs
+++ b/tests/ui/coroutine/async_gen_fn_iter.rs
@@ -46,7 +46,6 @@ async fn async_main() {
 use std::pin::{Pin, pin};
 use std::task::*;
 use std::async_iter::AsyncIterator;
-use std::future::Future;
 
 trait AsyncIterExt {
     fn next(&mut self) -> Next<'_, Self>;
diff --git a/tests/ui/drop/repeat-drop-2.stderr b/tests/ui/drop/repeat-drop-2.stderr
index f030228f71a..009a2057212 100644
--- a/tests/ui/drop/repeat-drop-2.stderr
+++ b/tests/ui/drop/repeat-drop-2.stderr
@@ -1,3 +1,12 @@
+error[E0493]: destructor of `String` cannot be evaluated at compile-time
+  --> $DIR/repeat-drop-2.rs:7:25
+   |
+LL | const _: [String; 0] = [String::new(); 0];
+   |                        -^^^^^^^^^^^^^----
+   |                        ||
+   |                        |the destructor for this type cannot be evaluated in constants
+   |                        value is dropped here
+
 error[E0382]: use of moved value: `foo`
   --> $DIR/repeat-drop-2.rs:4:17
    |
@@ -13,15 +22,6 @@ help: consider cloning the value if the performance cost is acceptable
 LL |     let _bar = foo.clone();
    |                   ++++++++
 
-error[E0493]: destructor of `String` cannot be evaluated at compile-time
-  --> $DIR/repeat-drop-2.rs:7:25
-   |
-LL | const _: [String; 0] = [String::new(); 0];
-   |                        -^^^^^^^^^^^^^----
-   |                        ||
-   |                        |the destructor for this type cannot be evaluated in constants
-   |                        value is dropped here
-
 error[E0381]: used binding `x` isn't initialized
   --> $DIR/repeat-drop-2.rs:12:14
    |
diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs
index e3eed775a5f..4975246fa94 100644
--- a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs
+++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs
@@ -16,7 +16,7 @@ macro_rules! local_passes_ident {
     ($i: ident) => ($i) //~ ERROR macro expansion ends with an incomplete expression
 }
 macro_rules! local_passes_tt {
-    ($i: tt) => ($i) //~ ERROR macro expansion ends with an incomplete expression
+    ($i: tt) => ($i)
 }
 
 pub fn check_async() {
@@ -34,7 +34,7 @@ pub fn check_async() {
     if passes_tt!(r#async) == 1 {} // OK
     if local_passes_ident!(async) == 1 {} // Error reported above in the macro
     if local_passes_ident!(r#async) == 1 {} // OK
-    if local_passes_tt!(async) == 1 {} // Error reported above in the macro
+    if local_passes_tt!(async) == 1 {} //~ ERROR macro expansion ends with an incomplete expression
     if local_passes_tt!(r#async) == 1 {} // OK
     module::async(); //~ ERROR expected identifier, found keyword `async`
     module::r#async(); // OK
diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr
index 6f08cff433b..4bbe1597233 100644
--- a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr
+++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr
@@ -68,10 +68,10 @@ LL |     ($i: ident) => ($i)
    |                       ^ expected one of `move`, `|`, or `||`
 
 error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||`
-  --> $DIR/edition-keywords-2018-2018-parsing.rs:19:20
+  --> $DIR/edition-keywords-2018-2018-parsing.rs:37:30
    |
-LL |     ($i: tt) => ($i)
-   |                    ^ expected one of `move`, `|`, or `||`
+LL |     if local_passes_tt!(async) == 1 {}
+   |                              ^ expected one of `move`, `|`, or `||`
 
 error[E0308]: mismatched types
   --> $DIR/edition-keywords-2018-2018-parsing.rs:42:33
diff --git a/tests/ui/error-codes/E0017.rs b/tests/ui/error-codes/E0017.rs
index 144340b3512..c29015c8f33 100644
--- a/tests/ui/error-codes/E0017.rs
+++ b/tests/ui/error-codes/E0017.rs
@@ -1,5 +1,8 @@
 #![feature(const_mut_refs)]
 
+//@ normalize-stderr-test "\(size: ., align: .\)" -> ""
+//@ normalize-stderr-test " +│ ╾─+╼" -> ""
+
 static X: i32 = 1;
 const C: i32 = 2;
 static mut M: i32 = 3;
@@ -14,5 +17,6 @@ static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are no
 
 static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
 //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
+//~| ERROR undefined behavior
 
 fn main() {}
diff --git a/tests/ui/error-codes/E0017.stderr b/tests/ui/error-codes/E0017.stderr
index 982ce52764e..b5e9bacb122 100644
--- a/tests/ui/error-codes/E0017.stderr
+++ b/tests/ui/error-codes/E0017.stderr
@@ -1,5 +1,5 @@
 warning: creating a mutable reference to mutable static is discouraged
-  --> $DIR/E0017.rs:15:52
+  --> $DIR/E0017.rs:18:52
    |
 LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
    |                                                    ^^^^^^ mutable reference to mutable static
@@ -14,7 +14,7 @@ LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { addr_of_mut!(M) };
    |                                                    ~~~~~~~~~~~~~~~
 
 warning: taking a mutable reference to a `const` item
-  --> $DIR/E0017.rs:7:30
+  --> $DIR/E0017.rs:10:30
    |
 LL | const CR: &'static mut i32 = &mut C;
    |                              ^^^^^^
@@ -22,26 +22,26 @@ LL | const CR: &'static mut i32 = &mut C;
    = note: each usage of a `const` item creates a new temporary
    = note: the mutable reference will refer to this temporary, not the original `const` item
 note: `const` item defined here
-  --> $DIR/E0017.rs:4:1
+  --> $DIR/E0017.rs:7:1
    |
 LL | const C: i32 = 2;
    | ^^^^^^^^^^^^
    = note: `#[warn(const_item_mutation)]` on by default
 
 error[E0764]: mutable references are not allowed in the final value of constants
-  --> $DIR/E0017.rs:7:30
+  --> $DIR/E0017.rs:10:30
    |
 LL | const CR: &'static mut i32 = &mut C;
    |                              ^^^^^^
 
 error[E0596]: cannot borrow immutable static item `X` as mutable
-  --> $DIR/E0017.rs:10:39
+  --> $DIR/E0017.rs:13:39
    |
 LL | static STATIC_REF: &'static mut i32 = &mut X;
    |                                       ^^^^^^ cannot borrow as mutable
 
 warning: taking a mutable reference to a `const` item
-  --> $DIR/E0017.rs:12:38
+  --> $DIR/E0017.rs:15:38
    |
 LL | static CONST_REF: &'static mut i32 = &mut C;
    |                                      ^^^^^^
@@ -49,18 +49,29 @@ LL | static CONST_REF: &'static mut i32 = &mut C;
    = note: each usage of a `const` item creates a new temporary
    = note: the mutable reference will refer to this temporary, not the original `const` item
 note: `const` item defined here
-  --> $DIR/E0017.rs:4:1
+  --> $DIR/E0017.rs:7:1
    |
 LL | const C: i32 = 2;
    | ^^^^^^^^^^^^
 
 error[E0764]: mutable references are not allowed in the final value of statics
-  --> $DIR/E0017.rs:12:38
+  --> $DIR/E0017.rs:15:38
    |
 LL | static CONST_REF: &'static mut i32 = &mut C;
    |                                      ^^^^^^
 
-error: aborting due to 3 previous errors; 3 warnings emitted
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/E0017.rs:18:1
+   |
+LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` or `static`
+   |
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+   = note: the raw bytes of the constant  {
+               ╾ALLOC0╼
+           }
+
+error: aborting due to 4 previous errors; 3 warnings emitted
 
-Some errors have detailed explanations: E0596, E0764.
-For more information about an error, try `rustc --explain E0596`.
+Some errors have detailed explanations: E0080, E0596, E0764.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/error-codes/E0093.stderr b/tests/ui/error-codes/E0093.stderr
index 387e0c55d4d..51c367b343a 100644
--- a/tests/ui/error-codes/E0093.stderr
+++ b/tests/ui/error-codes/E0093.stderr
@@ -3,6 +3,8 @@ error[E0093]: unrecognized intrinsic function: `foo`
    |
 LL |     fn foo();
    |     ^^^^^^^^^ unrecognized intrinsic
+   |
+   = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0388.rs b/tests/ui/error-codes/E0388.rs
index bd371328e6b..bbc5f2710bf 100644
--- a/tests/ui/error-codes/E0388.rs
+++ b/tests/ui/error-codes/E0388.rs
@@ -2,10 +2,12 @@ static X: i32 = 1;
 const C: i32 = 2;
 
 const CR: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
-                                     //~| WARN taking a mutable
+
+//~| WARN taking a mutable
 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0658
 
 static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
-                                             //~| WARN taking a mutable
+
+//~| WARN taking a mutable
 
 fn main() {}
diff --git a/tests/ui/error-codes/E0388.stderr b/tests/ui/error-codes/E0388.stderr
index 3e89e3f804b..cb7047072bd 100644
--- a/tests/ui/error-codes/E0388.stderr
+++ b/tests/ui/error-codes/E0388.stderr
@@ -20,7 +20,7 @@ LL | const CR: &'static mut i32 = &mut C;
    |                              ^^^^^^
 
 error[E0658]: mutable references are not allowed in statics
-  --> $DIR/E0388.rs:6:39
+  --> $DIR/E0388.rs:7:39
    |
 LL | static STATIC_REF: &'static mut i32 = &mut X;
    |                                       ^^^^^^
@@ -30,7 +30,7 @@ LL | static STATIC_REF: &'static mut i32 = &mut X;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 warning: taking a mutable reference to a `const` item
-  --> $DIR/E0388.rs:8:38
+  --> $DIR/E0388.rs:9:38
    |
 LL | static CONST_REF: &'static mut i32 = &mut C;
    |                                      ^^^^^^
@@ -44,7 +44,7 @@ LL | const C: i32 = 2;
    | ^^^^^^^^^^^^
 
 error[E0764]: mutable references are not allowed in the final value of statics
-  --> $DIR/E0388.rs:8:38
+  --> $DIR/E0388.rs:9:38
    |
 LL | static CONST_REF: &'static mut i32 = &mut C;
    |                                      ^^^^^^
diff --git a/tests/ui/error-codes/E0396.stderr b/tests/ui/error-codes/E0396.stderr
index ac1e7d65ce8..8bc14139d63 100644
--- a/tests/ui/error-codes/E0396.stderr
+++ b/tests/ui/error-codes/E0396.stderr
@@ -8,42 +8,42 @@ LL | const VALUE: u8 = unsafe { *REG_ADDR };
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
-  --> $DIR/E0396.rs:10:11
+error[E0658]: dereferencing raw mutable pointers in constants is unstable
+  --> $DIR/E0396.rs:14:36
    |
-LL |     match *INFALLIBLE {}
-   |           ^^^^^^^^^^^
+LL |     const BAD: () = unsafe { match *INFALLIBLE {} };
+   |                                    ^^^^^^^^^^^
    |
    = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
-  --> $DIR/E0396.rs:10:11
+error[E0658]: dereferencing raw mutable pointers in constants is unstable
+  --> $DIR/E0396.rs:14:36
    |
-LL |     match *INFALLIBLE {}
-   |           ^^^^^^^^^^^
+LL |     const BAD: () = unsafe { match *INFALLIBLE {} };
+   |                                    ^^^^^^^^^^^
    |
    = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error[E0658]: dereferencing raw mutable pointers in constants is unstable
-  --> $DIR/E0396.rs:14:36
+error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
+  --> $DIR/E0396.rs:10:11
    |
-LL |     const BAD: () = unsafe { match *INFALLIBLE {} };
-   |                                    ^^^^^^^^^^^
+LL |     match *INFALLIBLE {}
+   |           ^^^^^^^^^^^
    |
    = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: dereferencing raw mutable pointers in constants is unstable
-  --> $DIR/E0396.rs:14:36
+error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
+  --> $DIR/E0396.rs:10:11
    |
-LL |     const BAD: () = unsafe { match *INFALLIBLE {} };
-   |                                    ^^^^^^^^^^^
+LL |     match *INFALLIBLE {}
+   |           ^^^^^^^^^^^
    |
    = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
diff --git a/tests/ui/extern/issue-28324.rs b/tests/ui/extern/issue-28324.rs
index f74726e8166..a5e240fa283 100644
--- a/tests/ui/extern/issue-28324.rs
+++ b/tests/ui/extern/issue-28324.rs
@@ -4,5 +4,6 @@ extern "C" {
 
 pub static BAZ: u32 = *&error_message_count;
 //~^ ERROR use of extern static is unsafe and requires
+//~| ERROR could not evaluate static initializer
 
 fn main() {}
diff --git a/tests/ui/extern/issue-28324.stderr b/tests/ui/extern/issue-28324.stderr
index 94ff2131993..1fccb34fdf3 100644
--- a/tests/ui/extern/issue-28324.stderr
+++ b/tests/ui/extern/issue-28324.stderr
@@ -1,3 +1,9 @@
+error[E0080]: could not evaluate static initializer
+  --> $DIR/issue-28324.rs:5:23
+   |
+LL | pub static BAZ: u32 = *&error_message_count;
+   |                       ^^^^^^^^^^^^^^^^^^^^^ cannot access extern static (DefId(0:4 ~ issue_28324[8ec4]::{extern#0}::error_message_count))
+
 error[E0133]: use of extern static is unsafe and requires unsafe function or block
   --> $DIR/issue-28324.rs:5:25
    |
@@ -6,6 +12,7 @@ LL | pub static BAZ: u32 = *&error_message_count;
    |
    = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0133`.
+Some errors have detailed explanations: E0080, E0133.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/feature-gates/feature-gate-abi.stderr b/tests/ui/feature-gates/feature-gate-abi.stderr
index aa60434d9fe..3fd1e1189ab 100644
--- a/tests/ui/feature-gates/feature-gate-abi.stderr
+++ b/tests/ui/feature-gates/feature-gate-abi.stderr
@@ -187,12 +187,16 @@ error[E0093]: unrecognized intrinsic function: `f1`
    |
 LL | extern "rust-intrinsic" fn f1() {}
    |                            ^^ unrecognized intrinsic
+   |
+   = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
 
 error[E0093]: unrecognized intrinsic function: `f2`
   --> $DIR/feature-gate-abi.rs:18:32
    |
 LL | extern "platform-intrinsic" fn f2() {}
    |                                ^^ unrecognized intrinsic
+   |
+   = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
 
 error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
   --> $DIR/feature-gate-abi.rs:25:32
diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.stderr b/tests/ui/feature-gates/feature-gate-intrinsics.stderr
index 78c21843adb..583a4a1a84e 100644
--- a/tests/ui/feature-gates/feature-gate-intrinsics.stderr
+++ b/tests/ui/feature-gates/feature-gate-intrinsics.stderr
@@ -21,12 +21,16 @@ error[E0093]: unrecognized intrinsic function: `bar`
    |
 LL |     fn bar();
    |     ^^^^^^^^^ unrecognized intrinsic
+   |
+   = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
 
 error[E0093]: unrecognized intrinsic function: `baz`
   --> $DIR/feature-gate-intrinsics.rs:5:28
    |
 LL | extern "rust-intrinsic" fn baz() {}
    |                            ^^^ unrecognized intrinsic
+   |
+   = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
 
 error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
   --> $DIR/feature-gate-intrinsics.rs:5:34
diff --git a/tests/ui/fmt/format-args-capture-first-literal-is-macro.rs b/tests/ui/fmt/format-args-capture-first-literal-is-macro.rs
index 5afd21a17e5..3a0b7ba4666 100644
--- a/tests/ui/fmt/format-args-capture-first-literal-is-macro.rs
+++ b/tests/ui/fmt/format-args-capture-first-literal-is-macro.rs
@@ -6,7 +6,6 @@ extern crate format_string_proc_macro;
 macro_rules! identity_mbe {
     ($tt:tt) => {
         $tt
-        //~^ ERROR there is no argument named `a`
     };
 }
 
@@ -16,6 +15,7 @@ fn main() {
     format!(identity_pm!("{a}"));
     //~^ ERROR there is no argument named `a`
     format!(identity_mbe!("{a}"));
+    //~^ ERROR there is no argument named `a`
     format!(concat!("{a}"));
     //~^ ERROR there is no argument named `a`
 }
diff --git a/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr b/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr
index 4cf3afad7b8..e399361579f 100644
--- a/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr
+++ b/tests/ui/fmt/format-args-capture-first-literal-is-macro.stderr
@@ -1,5 +1,5 @@
 error: there is no argument named `a`
-  --> $DIR/format-args-capture-first-literal-is-macro.rs:16:26
+  --> $DIR/format-args-capture-first-literal-is-macro.rs:15:26
    |
 LL |     format!(identity_pm!("{a}"));
    |                          ^^^^^
@@ -8,10 +8,10 @@ LL |     format!(identity_pm!("{a}"));
    = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
 
 error: there is no argument named `a`
-  --> $DIR/format-args-capture-first-literal-is-macro.rs:8:9
+  --> $DIR/format-args-capture-first-literal-is-macro.rs:17:27
    |
-LL |         $tt
-   |         ^^^
+LL |     format!(identity_mbe!("{a}"));
+   |                           ^^^^^
    |
    = note: did you intend to capture a variable `a` from the surrounding scope?
    = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
diff --git a/tests/ui/generic-associated-types/issue-79636-1.rs b/tests/ui/generic-associated-types/issue-79636-1.rs
index a05311d59c1..3357afb9d4d 100644
--- a/tests/ui/generic-associated-types/issue-79636-1.rs
+++ b/tests/ui/generic-associated-types/issue-79636-1.rs
@@ -15,7 +15,6 @@ where
     //~^ ERROR: missing generics for associated type `Monad::Wrapped`
 {
     outer.bind(|inner| inner)
-    //~^ ERROR type annotations needed
 }
 
 fn main() {
diff --git a/tests/ui/generic-associated-types/issue-79636-1.stderr b/tests/ui/generic-associated-types/issue-79636-1.stderr
index 743d8b7d462..c31064dec62 100644
--- a/tests/ui/generic-associated-types/issue-79636-1.stderr
+++ b/tests/ui/generic-associated-types/issue-79636-1.stderr
@@ -30,19 +30,8 @@ help: function arguments must have a statically known size, borrowed types alway
 LL |     fn bind<B, F>(&self, f: F) -> Self::Wrapped<B> {
    |                   +
 
-error[E0282]: type annotations needed
-  --> $DIR/issue-79636-1.rs:17:17
-   |
-LL |     outer.bind(|inner| inner)
-   |                 ^^^^^
-   |
-help: consider giving this closure parameter an explicit type
-   |
-LL |     outer.bind(|inner: /* Type */| inner)
-   |                      ++++++++++++
-
 error[E0277]: the trait bound `Option<Option<bool>>: Monad` is not satisfied
-  --> $DIR/issue-79636-1.rs:22:21
+  --> $DIR/issue-79636-1.rs:21:21
    |
 LL |     assert_eq!(join(Some(Some(true))), Some(true));
    |                ---- ^^^^^^^^^^^^^^^^ the trait `Monad` is not implemented for `Option<Option<bool>>`
@@ -63,7 +52,7 @@ LL | where
 LL |     MOuter: Monad<Unwrapped = MInner>,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `join`
 
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0107, E0277, E0282.
+Some errors have detailed explanations: E0107, E0277.
 For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs
index dd00b327d2d..93f01c9577c 100644
--- a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs
@@ -3,7 +3,7 @@
 
 // Ensure that we check if trivial bounds on const items hold or not.
 
-const UNUSABLE: () = ()
+const UNUSABLE: () = () //~ ERROR evaluation of constant value failed
 where
     String: Copy;
 
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr
index 942e5dbd88e..407682fee56 100644
--- a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr
@@ -1,3 +1,11 @@
+error[E0080]: evaluation of constant value failed
+  --> $DIR/trivially-unsatisfied-bounds-0.rs:6:1
+   |
+LL | / const UNUSABLE: () = ()
+LL | | where
+LL | |     String: Copy;
+   | |_________________^ entering unreachable code
+
 error[E0277]: the trait bound `String: Copy` is not satisfied
   --> $DIR/trivially-unsatisfied-bounds-0.rs:11:13
    |
@@ -13,6 +21,7 @@ LL | where
 LL |     String: Copy;
    |             ^^^^ required by this bound in `UNUSABLE`
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0080, E0277.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/impl-trait/rpit/early_bound.rs b/tests/ui/impl-trait/rpit/early_bound.rs
index 03bd64d4d76..6dda687929c 100644
--- a/tests/ui/impl-trait/rpit/early_bound.rs
+++ b/tests/ui/impl-trait/rpit/early_bound.rs
@@ -5,7 +5,6 @@ fn test<'a: 'a>(n: bool) -> impl Sized + 'a {
     let true = n else { loop {} };
     let _ = || {
         let _ = identity::<&'a ()>(test(false));
-        //~^ ERROR hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds
     };
     loop {}
 }
diff --git a/tests/ui/impl-trait/rpit/early_bound.stderr b/tests/ui/impl-trait/rpit/early_bound.stderr
index 815368f250e..780dea4e284 100644
--- a/tests/ui/impl-trait/rpit/early_bound.stderr
+++ b/tests/ui/impl-trait/rpit/early_bound.stderr
@@ -1,14 +1,3 @@
-error[E0700]: hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds
-  --> $DIR/early_bound.rs:7:17
-   |
-LL | fn test<'a: 'a>(n: bool) -> impl Sized + 'a {
-   |         --                  --------------- opaque type defined here
-   |         |
-   |         hidden type `&'a ()` captures the lifetime `'a` as defined here
-...
-LL |         let _ = identity::<&'a ()>(test(false));
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error: concrete type differs from previous defining opaque type use
   --> $DIR/early_bound.rs:3:29
    |
@@ -21,6 +10,5 @@ note: previous use here
 LL |         let _ = identity::<&'a ()>(test(false));
    |                                    ^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/where-allowed.rs b/tests/ui/impl-trait/where-allowed.rs
index 505e2d6c171..72ce617693e 100644
--- a/tests/ui/impl-trait/where-allowed.rs
+++ b/tests/ui/impl-trait/where-allowed.rs
@@ -59,7 +59,6 @@ fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
 fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
 //~^ ERROR `impl Trait` is not allowed in the parameters of `Fn` trait bounds
 //~| ERROR nested `impl Trait` is not allowed
-//~| ERROR: type annotations needed
 
 // Allowed
 fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr
index c22312cce19..f203f4cabc8 100644
--- a/tests/ui/impl-trait/where-allowed.stderr
+++ b/tests/ui/impl-trait/where-allowed.stderr
@@ -17,7 +17,7 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic
    |                                                 outer `impl Trait`
 
 error[E0658]: `impl Trait` in associated types is unstable
-  --> $DIR/where-allowed.rs:123:16
+  --> $DIR/where-allowed.rs:122:16
    |
 LL |     type Out = impl Debug;
    |                ^^^^^^^^^^
@@ -27,7 +27,7 @@ LL |     type Out = impl Debug;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: `impl Trait` in type aliases is unstable
-  --> $DIR/where-allowed.rs:160:23
+  --> $DIR/where-allowed.rs:159:23
    |
 LL | type InTypeAlias<R> = impl Debug;
    |                       ^^^^^^^^^^
@@ -37,7 +37,7 @@ LL | type InTypeAlias<R> = impl Debug;
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: `impl Trait` in type aliases is unstable
-  --> $DIR/where-allowed.rs:163:39
+  --> $DIR/where-allowed.rs:162:39
    |
 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
    |                                       ^^^^^^^^^^
@@ -127,7 +127,7 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
-  --> $DIR/where-allowed.rs:69:38
+  --> $DIR/where-allowed.rs:68:38
    |
 LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
    |                                      ^^^^^^^^^^
@@ -135,7 +135,7 @@ LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
-  --> $DIR/where-allowed.rs:73:40
+  --> $DIR/where-allowed.rs:72:40
    |
 LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
    |                                        ^^^^^^^^^^
@@ -143,7 +143,7 @@ LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in field types
-  --> $DIR/where-allowed.rs:87:32
+  --> $DIR/where-allowed.rs:86:32
    |
 LL | struct InBraceStructField { x: impl Debug }
    |                                ^^^^^^^^^^
@@ -151,7 +151,7 @@ LL | struct InBraceStructField { x: impl Debug }
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in field types
-  --> $DIR/where-allowed.rs:91:41
+  --> $DIR/where-allowed.rs:90:41
    |
 LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
    |                                         ^^^^^^^^^^
@@ -159,7 +159,7 @@ LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in field types
-  --> $DIR/where-allowed.rs:95:27
+  --> $DIR/where-allowed.rs:94:27
    |
 LL | struct InTupleStructField(impl Debug);
    |                           ^^^^^^^^^^
@@ -167,7 +167,7 @@ LL | struct InTupleStructField(impl Debug);
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in field types
-  --> $DIR/where-allowed.rs:100:25
+  --> $DIR/where-allowed.rs:99:25
    |
 LL |     InBraceVariant { x: impl Debug },
    |                         ^^^^^^^^^^
@@ -175,7 +175,7 @@ LL |     InBraceVariant { x: impl Debug },
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in field types
-  --> $DIR/where-allowed.rs:102:20
+  --> $DIR/where-allowed.rs:101:20
    |
 LL |     InTupleVariant(impl Debug),
    |                    ^^^^^^^^^^
@@ -183,7 +183,7 @@ LL |     InTupleVariant(impl Debug),
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in `extern fn` parameters
-  --> $DIR/where-allowed.rs:144:33
+  --> $DIR/where-allowed.rs:143:33
    |
 LL |     fn in_foreign_parameters(_: impl Debug);
    |                                 ^^^^^^^^^^
@@ -191,7 +191,7 @@ LL |     fn in_foreign_parameters(_: impl Debug);
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in `extern fn` return types
-  --> $DIR/where-allowed.rs:147:31
+  --> $DIR/where-allowed.rs:146:31
    |
 LL |     fn in_foreign_return() -> impl Debug;
    |                               ^^^^^^^^^^
@@ -199,7 +199,7 @@ LL |     fn in_foreign_return() -> impl Debug;
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
-  --> $DIR/where-allowed.rs:163:39
+  --> $DIR/where-allowed.rs:162:39
    |
 LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
    |                                       ^^^^^^^^^^
@@ -207,7 +207,7 @@ LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in traits
-  --> $DIR/where-allowed.rs:168:16
+  --> $DIR/where-allowed.rs:167:16
    |
 LL | impl PartialEq<impl Debug> for () {
    |                ^^^^^^^^^^
@@ -215,7 +215,7 @@ LL | impl PartialEq<impl Debug> for () {
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in impl headers
-  --> $DIR/where-allowed.rs:173:24
+  --> $DIR/where-allowed.rs:172:24
    |
 LL | impl PartialEq<()> for impl Debug {
    |                        ^^^^^^^^^^
@@ -223,7 +223,7 @@ LL | impl PartialEq<()> for impl Debug {
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in impl headers
-  --> $DIR/where-allowed.rs:178:6
+  --> $DIR/where-allowed.rs:177:6
    |
 LL | impl impl Debug {
    |      ^^^^^^^^^^
@@ -231,7 +231,7 @@ LL | impl impl Debug {
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in impl headers
-  --> $DIR/where-allowed.rs:184:24
+  --> $DIR/where-allowed.rs:183:24
    |
 LL | impl InInherentImplAdt<impl Debug> {
    |                        ^^^^^^^^^^
@@ -239,7 +239,7 @@ LL | impl InInherentImplAdt<impl Debug> {
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in bounds
-  --> $DIR/where-allowed.rs:190:11
+  --> $DIR/where-allowed.rs:189:11
    |
 LL |     where impl Debug: Debug
    |           ^^^^^^^^^^
@@ -247,7 +247,7 @@ LL |     where impl Debug: Debug
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in bounds
-  --> $DIR/where-allowed.rs:197:15
+  --> $DIR/where-allowed.rs:196:15
    |
 LL |     where Vec<impl Debug>: Debug
    |               ^^^^^^^^^^
@@ -255,7 +255,7 @@ LL |     where Vec<impl Debug>: Debug
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in bounds
-  --> $DIR/where-allowed.rs:204:24
+  --> $DIR/where-allowed.rs:203:24
    |
 LL |     where T: PartialEq<impl Debug>
    |                        ^^^^^^^^^^
@@ -263,7 +263,7 @@ LL |     where T: PartialEq<impl Debug>
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the parameters of `Fn` trait bounds
-  --> $DIR/where-allowed.rs:211:17
+  --> $DIR/where-allowed.rs:210:17
    |
 LL |     where T: Fn(impl Debug)
    |                 ^^^^^^^^^^
@@ -271,7 +271,7 @@ LL |     where T: Fn(impl Debug)
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the return type of `Fn` trait bounds
-  --> $DIR/where-allowed.rs:218:22
+  --> $DIR/where-allowed.rs:217:22
    |
 LL |     where T: Fn() -> impl Debug
    |                      ^^^^^^^^^^
@@ -279,7 +279,7 @@ LL |     where T: Fn() -> impl Debug
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:224:40
+  --> $DIR/where-allowed.rs:223:40
    |
 LL | struct InStructGenericParamDefault<T = impl Debug>(T);
    |                                        ^^^^^^^^^^
@@ -287,7 +287,7 @@ LL | struct InStructGenericParamDefault<T = impl Debug>(T);
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:228:36
+  --> $DIR/where-allowed.rs:227:36
    |
 LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
    |                                    ^^^^^^^^^^
@@ -295,7 +295,7 @@ LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:232:38
+  --> $DIR/where-allowed.rs:231:38
    |
 LL | trait InTraitGenericParamDefault<T = impl Debug> {}
    |                                      ^^^^^^^^^^
@@ -303,7 +303,7 @@ LL | trait InTraitGenericParamDefault<T = impl Debug> {}
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:236:41
+  --> $DIR/where-allowed.rs:235:41
    |
 LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
    |                                         ^^^^^^^^^^
@@ -311,7 +311,7 @@ LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:240:11
+  --> $DIR/where-allowed.rs:239:11
    |
 LL | impl <T = impl Debug> T {}
    |           ^^^^^^^^^^
@@ -319,7 +319,7 @@ LL | impl <T = impl Debug> T {}
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:247:40
+  --> $DIR/where-allowed.rs:246:40
    |
 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    |                                        ^^^^^^^^^^
@@ -327,7 +327,7 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the type of variable bindings
-  --> $DIR/where-allowed.rs:253:29
+  --> $DIR/where-allowed.rs:252:29
    |
 LL |     let _in_local_variable: impl Fn() = || {};
    |                             ^^^^^^^^^
@@ -335,7 +335,7 @@ LL |     let _in_local_variable: impl Fn() = || {};
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in closure return types
-  --> $DIR/where-allowed.rs:255:46
+  --> $DIR/where-allowed.rs:254:46
    |
 LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
    |                                              ^^^^^^^^^
@@ -343,7 +343,7 @@ LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:240:7
+  --> $DIR/where-allowed.rs:239:7
    |
 LL | impl <T = impl Debug> T {}
    |       ^^^^^^^^^^^^^^
@@ -353,7 +353,7 @@ LL | impl <T = impl Debug> T {}
    = note: `#[deny(invalid_type_param_default)]` on by default
 
 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:247:36
+  --> $DIR/where-allowed.rs:246:36
    |
 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    |                                    ^^^^^^^^^^^^^^
@@ -362,7 +362,7 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
 
 error[E0118]: no nominal type found for inherent implementation
-  --> $DIR/where-allowed.rs:240:1
+  --> $DIR/where-allowed.rs:239:1
    |
 LL | impl <T = impl Debug> T {}
    | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
@@ -377,14 +377,8 @@ LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!
    |
    = note: cannot satisfy `_: Debug`
 
-error[E0282]: type annotations needed
-  --> $DIR/where-allowed.rs:59:49
-   |
-LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
-   |                                                 ^^^^^^^^^^^^^^^^^^^ cannot infer type
-
 error[E0283]: type annotations needed
-  --> $DIR/where-allowed.rs:65:46
+  --> $DIR/where-allowed.rs:64:46
    |
 LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
    |                                              ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
@@ -396,7 +390,7 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani
              where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
 
 error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope
-  --> $DIR/where-allowed.rs:82:5
+  --> $DIR/where-allowed.rs:81:5
    |
 LL |     vec![vec![0; 10], vec![12; 7], vec![8; 3]]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]`
@@ -404,7 +398,7 @@ LL |     vec![vec![0; 10], vec![12; 7], vec![8; 3]]
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0053]: method `in_trait_impl_return` has an incompatible type for trait
-  --> $DIR/where-allowed.rs:130:34
+  --> $DIR/where-allowed.rs:129:34
    |
 LL |     type Out = impl Debug;
    |                ---------- the expected opaque type
@@ -416,7 +410,7 @@ LL |     fn in_trait_impl_return() -> impl Debug { () }
    |                                  help: change the output type to match the trait: `<() as DummyTrait>::Out`
    |
 note: type in trait
-  --> $DIR/where-allowed.rs:120:34
+  --> $DIR/where-allowed.rs:119:34
    |
 LL |     fn in_trait_impl_return() -> Self::Out;
    |                                  ^^^^^^^^^
@@ -425,14 +419,14 @@ LL |     fn in_trait_impl_return() -> Self::Out;
    = note: distinct uses of `impl Trait` result in different opaque types
 
 error: unconstrained opaque type
-  --> $DIR/where-allowed.rs:123:16
+  --> $DIR/where-allowed.rs:122:16
    |
 LL |     type Out = impl Debug;
    |                ^^^^^^^^^^
    |
    = note: `Out` must be used in combination with a concrete type within the same impl
 
-error: aborting due to 51 previous errors
+error: aborting due to 50 previous errors
 
-Some errors have detailed explanations: E0053, E0118, E0282, E0283, E0562, E0599, E0658, E0666.
+Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0599, E0658, E0666.
 For more information about an error, try `rustc --explain E0053`.
diff --git a/tests/ui/inference/issue-80409.no-compat.stderr b/tests/ui/inference/issue-80409.no-compat.stderr
index 7bb4786db3a..f9772b2d5a6 100644
--- a/tests/ui/inference/issue-80409.no-compat.stderr
+++ b/tests/ui/inference/issue-80409.no-compat.stderr
@@ -1,6 +1,16 @@
 error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ImpliedOutlivesBounds { ty: &'?2 mut StateContext<'?3, usize> } }
+  --> $DIR/issue-80409.rs:49:30
    |
-   = query stack during panic:
+LL |     builder.state().on_entry(|_| {});
+   |                              ^^^
+   |
+note: 
+  --> $DIR/issue-80409.rs:49:30
+   |
+LL |     builder.state().on_entry(|_| {});
+   |                              ^^^
+
+query stack during panic:
 end of query stack
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/inference/issue-80409.rs b/tests/ui/inference/issue-80409.rs
index e54da78614f..dfb84563e6d 100644
--- a/tests/ui/inference/issue-80409.rs
+++ b/tests/ui/inference/issue-80409.rs
@@ -8,6 +8,7 @@
 //@[no-compat] check-fail
 //@[no-compat] known-bug: #80409
 //@[no-compat] failure-status: 101
+//@[no-compat] normalize-stderr-test "delayed at.*" -> ""
 //@[no-compat] normalize-stderr-test "note: .*\n\n" -> ""
 //@[no-compat] normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
 //@[no-compat] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
diff --git a/tests/ui/intrinsics-always-extern.stderr b/tests/ui/intrinsics-always-extern.stderr
index 32468f99197..1f7bb5a3b0d 100644
--- a/tests/ui/intrinsics-always-extern.stderr
+++ b/tests/ui/intrinsics-always-extern.stderr
@@ -9,6 +9,8 @@ error[E0093]: unrecognized intrinsic function: `hello`
    |
 LL | extern "rust-intrinsic" fn hello() {
    |                            ^^^^^ unrecognized intrinsic
+   |
+   = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
 
 error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
   --> $DIR/intrinsics-always-extern.rs:8:43
diff --git a/tests/ui/issues/issue-106755.rs b/tests/ui/issues/issue-106755.rs
index 40cb83fcabc..689b1d885ae 100644
--- a/tests/ui/issues/issue-106755.rs
+++ b/tests/ui/issues/issue-106755.rs
@@ -15,7 +15,5 @@ impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR found both positive and nega
 unsafe impl<T: 'static> Send for TestType<T> {} //~ ERROR conflicting implementations
 
 impl !Send for TestType<i32> {}
-//~^ WARNING
-//~| WARNING this will change its meaning
 
 fn main() {}
diff --git a/tests/ui/issues/issue-106755.stderr b/tests/ui/issues/issue-106755.stderr
index 6b3a8427e77..54397034062 100644
--- a/tests/ui/issues/issue-106755.stderr
+++ b/tests/ui/issues/issue-106755.stderr
@@ -16,23 +16,7 @@ LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
 LL | unsafe impl<T: 'static> Send for TestType<T> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
 
-warning: cross-crate traits with a default impl, like `Send`, should not be specialized
-  --> $DIR/issue-106755.rs:17:1
-   |
-LL | impl !Send for TestType<i32> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = warning: this will change its meaning in a future release!
-   = note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
-   = note: `i32` is not a generic parameter
-note: try using the same sequence of generic parameters as the struct definition
-  --> $DIR/issue-106755.rs:9:1
-   |
-LL | struct TestType<T>(::std::marker::PhantomData<T>);
-   | ^^^^^^^^^^^^^^^^^^
-   = note: `#[warn(suspicious_auto_trait_impls)]` on by default
-
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to 2 previous errors
 
 Some errors have detailed explanations: E0119, E0751.
 For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/issues/issue-17252.rs b/tests/ui/issues/issue-17252.rs
index 7141e4874c0..5941e10f8b0 100644
--- a/tests/ui/issues/issue-17252.rs
+++ b/tests/ui/issues/issue-17252.rs
@@ -4,6 +4,7 @@ fn main() {
     let _x: [u8; FOO]; // caused stack overflow prior to fix
     let _y: usize = 1 + {
         const BAR: usize = BAR;
+        //~^ ERROR: cycle
         let _z: [u8; BAR]; // caused stack overflow prior to fix
         1
     };
diff --git a/tests/ui/issues/issue-17252.stderr b/tests/ui/issues/issue-17252.stderr
index d8984860457..56bc32b19ab 100644
--- a/tests/ui/issues/issue-17252.stderr
+++ b/tests/ui/issues/issue-17252.stderr
@@ -10,13 +10,24 @@ note: ...which requires const-evaluating + checking `FOO`...
 LL | const FOO: usize = FOO;
    |                    ^^^
    = note: ...which again requires simplifying constant for the type system `FOO`, completing the cycle
-note: cycle used when const-evaluating + checking `main::{constant#0}`
-  --> $DIR/issue-17252.rs:4:18
+   = note: cycle used when running analysis passes on this crate
+   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error[E0391]: cycle detected when simplifying constant for the type system `main::BAR`
+  --> $DIR/issue-17252.rs:6:9
+   |
+LL |         const BAR: usize = BAR;
+   |         ^^^^^^^^^^^^^^^^
+   |
+note: ...which requires const-evaluating + checking `main::BAR`...
+  --> $DIR/issue-17252.rs:6:28
    |
-LL |     let _x: [u8; FOO]; // caused stack overflow prior to fix
-   |                  ^^^
+LL |         const BAR: usize = BAR;
+   |                            ^^^
+   = note: ...which again requires simplifying constant for the type system `main::BAR`, completing the cycle
+   = note: cycle used when running analysis passes on this crate
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-3.stderr b/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-3.stderr
index e23957c6de7..8a152f58966 100644
--- a/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-3.stderr
+++ b/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-3.stderr
@@ -20,15 +20,7 @@ note: ...which requires const-evaluating + checking `B`...
 LL | const B: i32 = A;
    |                ^
    = note: ...which again requires simplifying constant for the type system `A`, completing the cycle
-note: cycle used when linting top-level module
-  --> $DIR/issue-23302-3.rs:1:1
-   |
-LL | / const A: i32 = B;
-LL | |
-LL | | const B: i32 = A;
-LL | |
-LL | | fn main() { }
-   | |_____________^
+   = note: cycle used when running analysis passes on this crate
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/issues/issue-76191.rs b/tests/ui/issues/issue-76191.rs
index d9790d2b56e..277624c005a 100644
--- a/tests/ui/issues/issue-76191.rs
+++ b/tests/ui/issues/issue-76191.rs
@@ -6,6 +6,7 @@ use std::ops::RangeInclusive;
 const RANGE: RangeInclusive<i32> = 0..=255;
 
 const RANGE2: RangeInclusive<i32> = panic!();
+//~^ ERROR evaluation of constant value failed
 
 fn main() {
     let n: i32 = 1;
diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/issues/issue-76191.stderr
index 32d9105b259..3702bfb7769 100644
--- a/tests/ui/issues/issue-76191.stderr
+++ b/tests/ui/issues/issue-76191.stderr
@@ -1,5 +1,13 @@
+error[E0080]: evaluation of constant value failed
+  --> $DIR/issue-76191.rs:8:37
+   |
+LL | const RANGE2: RangeInclusive<i32> = panic!();
+   |                                     ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-76191.rs:8:37
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
 error[E0308]: mismatched types
-  --> $DIR/issue-76191.rs:13:9
+  --> $DIR/issue-76191.rs:14:9
    |
 LL | const RANGE: RangeInclusive<i32> = 0..=255;
    | -------------------------------- constant defined here
@@ -20,7 +28,7 @@ LL |         0..=255 => {}
    |         ~~~~~~~
 
 error[E0308]: mismatched types
-  --> $DIR/issue-76191.rs:15:9
+  --> $DIR/issue-76191.rs:16:9
    |
 LL | const RANGE2: RangeInclusive<i32> = panic!();
    | --------------------------------- constant defined here
@@ -38,6 +46,7 @@ LL |         RANGE2 => {}
             found struct `RangeInclusive<i32>`
    = note: constants only support matching by type, if you meant to match against a range of values, consider using a range pattern like `min ..= max` in the match block
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0308`.
+Some errors have detailed explanations: E0080, E0308.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/lint/wide_pointer_comparisons.rs b/tests/ui/lint/wide_pointer_comparisons.rs
index 37807776d2f..31369001075 100644
--- a/tests/ui/lint/wide_pointer_comparisons.rs
+++ b/tests/ui/lint/wide_pointer_comparisons.rs
@@ -110,10 +110,12 @@ fn main() {
     {
         macro_rules! cmp {
             ($a:tt, $b:tt) => { $a == $b }
-            //~^ WARN ambiguous wide pointer comparison
         }
 
+        // FIXME: This lint uses some custom span combination logic.
+        // Rewrite it to adapt to the new metavariable span rules.
         cmp!(a, b);
+        //~^ WARN ambiguous wide pointer comparison
     }
 
     {
diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr
index 349ff467d0f..6ef117c63c5 100644
--- a/tests/ui/lint/wide_pointer_comparisons.stderr
+++ b/tests/ui/lint/wide_pointer_comparisons.stderr
@@ -421,18 +421,18 @@ LL |         std::ptr::eq(*a, *b)
    |         ~~~~~~~~~~~~~  ~   +
 
 warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
-  --> $DIR/wide_pointer_comparisons.rs:112:33
+  --> $DIR/wide_pointer_comparisons.rs:117:14
    |
-LL |             ($a:tt, $b:tt) => { $a == $b }
-   |                                 ^^^^^^^^
+LL |         cmp!(a, b);
+   |              ^^^^
    |
 help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
    |
-LL |             ($a:tt, $b:tt) => { std::ptr::addr_eq($a, $b) }
-   |                                 ++++++++++++++++++  ~   +
+LL |         cmp!(std::ptr::addr_eq(a, b));
+   |              ++++++++++++++++++ ~  +
 
 warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
-  --> $DIR/wide_pointer_comparisons.rs:121:39
+  --> $DIR/wide_pointer_comparisons.rs:123:39
    |
 LL |             ($a:ident, $b:ident) => { $a == $b }
    |                                       ^^^^^^^^
@@ -447,7 +447,7 @@ LL |             ($a:ident, $b:ident) => { std::ptr::addr_eq($a, $b) }
    |                                       ++++++++++++++++++  ~   +
 
 warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
-  --> $DIR/wide_pointer_comparisons.rs:131:37
+  --> $DIR/wide_pointer_comparisons.rs:133:37
    |
 LL |             ($a:expr, $b:expr) => { $a == $b }
    |                                     ^^
diff --git a/tests/ui/liveness/liveness-consts.stderr b/tests/ui/liveness/liveness-consts.stderr
index 016debdd396..34ce3947337 100644
--- a/tests/ui/liveness/liveness-consts.stderr
+++ b/tests/ui/liveness/liveness-consts.stderr
@@ -23,12 +23,6 @@ warning: unused variable: `z`
 LL | pub fn f(x: [u8; { let s = 17; 100 }]) -> [u8;  { let z = 18; 100 }] {
    |                                                       ^ help: if this is intentional, prefix it with an underscore: `_z`
 
-warning: unused variable: `z`
-  --> $DIR/liveness-consts.rs:60:13
-   |
-LL |         let z = 42;
-   |             ^ help: if this is intentional, prefix it with an underscore: `_z`
-
 warning: variable `a` is assigned to, but never used
   --> $DIR/liveness-consts.rs:7:13
    |
@@ -46,6 +40,12 @@ LL |     b += 1;
    = help: maybe it is overwritten before being read?
    = note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]`
 
+warning: unused variable: `z`
+  --> $DIR/liveness-consts.rs:60:13
+   |
+LL |         let z = 42;
+   |             ^ help: if this is intentional, prefix it with an underscore: `_z`
+
 warning: value assigned to `t` is never read
   --> $DIR/liveness-consts.rs:42:9
    |
diff --git a/tests/ui/macros/invalid-fragment-specifier.rs b/tests/ui/macros/invalid-fragment-specifier.rs
new file mode 100644
index 00000000000..1daf0a95434
--- /dev/null
+++ b/tests/ui/macros/invalid-fragment-specifier.rs
@@ -0,0 +1,10 @@
+macro_rules! test {
+    ($wrong:id) => {};
+} //~^ ERROR: invalid fragment specifier `id`
+
+// guard against breaking raw identifier diagnostic
+macro_rules! test_raw_identifer {
+    ($wrong:r#if) => {};
+} //~^ ERROR: invalid fragment specifier `r#if`
+
+fn main() {}
diff --git a/tests/ui/macros/invalid-fragment-specifier.stderr b/tests/ui/macros/invalid-fragment-specifier.stderr
new file mode 100644
index 00000000000..7516dbc3a08
--- /dev/null
+++ b/tests/ui/macros/invalid-fragment-specifier.stderr
@@ -0,0 +1,18 @@
+error: invalid fragment specifier `id`
+  --> $DIR/invalid-fragment-specifier.rs:2:6
+   |
+LL |     ($wrong:id) => {};
+   |      ^^^^^^^^^
+   |
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
+
+error: invalid fragment specifier `r#if`
+  --> $DIR/invalid-fragment-specifier.rs:7:6
+   |
+LL |     ($wrong:r#if) => {};
+   |      ^^^^^^^^^^^
+   |
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/macros/issue-118786.rs b/tests/ui/macros/issue-118786.rs
index cc6c751813b..97454c9de07 100644
--- a/tests/ui/macros/issue-118786.rs
+++ b/tests/ui/macros/issue-118786.rs
@@ -5,8 +5,7 @@
 macro_rules! make_macro {
     ($macro_name:tt) => {
         macro_rules! $macro_name {
-        //~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon
-        //~| ERROR macro expansion ignores token `{` and any following
+        //~^ ERROR macro expansion ignores token `{` and any following
         //~| ERROR cannot find macro `macro_rules` in this scope
             () => {}
         }
@@ -14,3 +13,4 @@ macro_rules! make_macro {
 }
 
 make_macro!((meow));
+//~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon
diff --git a/tests/ui/macros/issue-118786.stderr b/tests/ui/macros/issue-118786.stderr
index 1a8ac9340da..03e65c94ba7 100644
--- a/tests/ui/macros/issue-118786.stderr
+++ b/tests/ui/macros/issue-118786.stderr
@@ -1,13 +1,13 @@
 error: macros that expand to items must be delimited with braces or followed by a semicolon
-  --> $DIR/issue-118786.rs:7:22
+  --> $DIR/issue-118786.rs:15:13
    |
-LL |         macro_rules! $macro_name {
-   |                      ^^^^^^^^^^^
+LL | make_macro!((meow));
+   |             ^^^^^^
    |
 help: change the delimiters to curly braces
    |
-LL |         macro_rules! {$macro_name} {
-   |                      +           +
+LL | make_macro!({meow});
+   |             ~    ~
 help: add a semicolon
    |
 LL |         macro_rules! $macro_name; {
diff --git a/tests/ui/macros/macro-invalid-fragment-spec.rs b/tests/ui/macros/macro-invalid-fragment-spec.rs
deleted file mode 100644
index dc4d75096af..00000000000
--- a/tests/ui/macros/macro-invalid-fragment-spec.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-macro_rules! foo(
-    ($x:foo) => ()
-    //~^ ERROR invalid fragment specifier
-);
-
-fn main() {
-    foo!(foo);
-}
diff --git a/tests/ui/macros/macro-invalid-fragment-spec.stderr b/tests/ui/macros/macro-invalid-fragment-spec.stderr
deleted file mode 100644
index 919111ede51..00000000000
--- a/tests/ui/macros/macro-invalid-fragment-spec.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error: invalid fragment specifier `foo`
-  --> $DIR/macro-invalid-fragment-spec.rs:2:6
-   |
-LL |     ($x:foo) => ()
-   |      ^^^^^^
-   |
-   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr
index 060595e1d40..12427040272 100644
--- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr
+++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr
@@ -47,8 +47,8 @@ LL |     local_bar_tt.pow(2);
    |
 help: you must specify a type for this binding, like `i32`
    |
-LL |     ($tt:tt) => { let $tt: i32 = 42; }
-   |                          +++++
+LL |     local_mac_tt!(local_bar_tt: i32);
+   |                               +++++
 
 error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}`
   --> $DIR/method-on-ambiguous-numeric-type.rs:37:9
diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr
index d005f116e12..78cde9b6dca 100644
--- a/tests/ui/parser/issues/issue-44406.stderr
+++ b/tests/ui/parser/issues/issue-44406.stderr
@@ -15,7 +15,7 @@ LL |         bar { baz: $rest }
 help: if `bar` is a function, use the arguments directly
    |
 LL -         bar(baz: $rest)
-LL +         bar(: $rest)
+LL +         bar($rest)
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
index 8e125864b8b..a68fae1a36e 100644
--- a/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
+++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
@@ -5,6 +5,11 @@ LL |         $($c)ö* {}
    |             ^   - if this block is the condition of the `if` expression, then it must be followed by another block
    |             |
    |             expected condition here
+...
+LL |     x!(if);
+   |     ------ in this macro invocation
+   |
+   = note: this error originates in the macro `x` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
index 1a90b4724d4..d489df85c44 100644
--- a/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
+++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
@@ -1,9 +1,9 @@
 macro_rules! x {
     ($($c:tt)*) => {
-        $($c)ö* //~ ERROR macro expansion ends with an incomplete expression: expected expression
+        $($c)ö*
     };
 }
 
 fn main() {
-    x!(!);
+    x!(!); //~ ERROR macro expansion ends with an incomplete expression: expected expression
 }
diff --git a/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
index 15aa62e0810..3a4b0cbf2a5 100644
--- a/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
+++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
@@ -1,8 +1,8 @@
 error: macro expansion ends with an incomplete expression: expected expression
-  --> $DIR/issue-68092-unicode-ident-after-incomplete-expr.rs:3:13
+  --> $DIR/issue-68092-unicode-ident-after-incomplete-expr.rs:8:9
    |
-LL |         $($c)ö*
-   |             ^ expected expression
+LL |     x!(!);
+   |         ^ expected expression
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/proc-macro/capture-macro-rules-invoke.stdout b/tests/ui/proc-macro/capture-macro-rules-invoke.stdout
index bbab08bca49..71e34119ba7 100644
--- a/tests/ui/proc-macro/capture-macro-rules-invoke.stdout
+++ b/tests/ui/proc-macro/capture-macro-rules-invoke.stdout
@@ -271,7 +271,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
                 span: $DIR/capture-macro-rules-invoke.rs:47:19: 47:20 (#0),
             },
         ],
-        span: $DIR/capture-macro-rules-invoke.rs:15:60: 15:63 (#0),
+        span: $DIR/capture-macro-rules-invoke.rs:47:13: 47:22 (#0),
     },
     Punct {
         ch: ',',
diff --git a/tests/ui/proc-macro/custom-attr-panic.rs b/tests/ui/proc-macro/custom-attr-panic.rs
new file mode 100644
index 00000000000..23bcb66319d
--- /dev/null
+++ b/tests/ui/proc-macro/custom-attr-panic.rs
@@ -0,0 +1,8 @@
+//@ aux-build: test-macros.rs
+
+extern crate test_macros;
+
+#[test_macros::panic_attr] //~ ERROR custom attribute panicked
+fn foo() {}
+
+fn main() {}
diff --git a/tests/ui/proc-macro/custom-attr-panic.stderr b/tests/ui/proc-macro/custom-attr-panic.stderr
new file mode 100644
index 00000000000..e436162bcc1
--- /dev/null
+++ b/tests/ui/proc-macro/custom-attr-panic.stderr
@@ -0,0 +1,10 @@
+error: custom attribute panicked
+  --> $DIR/custom-attr-panic.rs:5:1
+   |
+LL | #[test_macros::panic_attr]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: message: panic-attr
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr
index e72d259e8a5..f802841d2e4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr
@@ -1,12 +1,3 @@
-error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
-  --> $DIR/call-const-trait-method-pass.rs:36:7
-   |
-LL |     a.plus(b)
-   |       ^^^^^^^
-   |
-   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-   = help: add `#![feature(effects)]` to the crate attributes to enable
-
 error[E0015]: cannot call non-const operator in constants
   --> $DIR/call-const-trait-method-pass.rs:39:22
    |
@@ -21,6 +12,15 @@ LL | impl const std::ops::Add for Int {
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
    = help: add `#![feature(effects)]` to the crate attributes to enable
 
+error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
+  --> $DIR/call-const-trait-method-pass.rs:36:7
+   |
+LL |     a.plus(b)
+   |       ^^^^^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+   = help: add `#![feature(effects)]` to the crate attributes to enable
+
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
index b66b27ad2bd..a225125ef53 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
@@ -23,23 +23,23 @@ LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
    |                           ^^^^^^^^^^
 
 error[E0015]: cannot call non-const closure in constant functions
-  --> $DIR/const-closures.rs:12:5
+  --> $DIR/const-closures.rs:24:5
    |
-LL |     f() * 7
+LL |     f() + f()
    |     ^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = help: add `#![feature(effects)]` to the crate attributes to enable
 help: consider further restricting this bound
    |
-LL |         F: ~const FnOnce() -> u8 + ~const std::ops::Fn<()>,
-   |                                  +++++++++++++++++++++++++
+LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
+   |                                      +++++++++++++++++++++++++
 
 error[E0015]: cannot call non-const closure in constant functions
-  --> $DIR/const-closures.rs:24:5
+  --> $DIR/const-closures.rs:24:11
    |
 LL |     f() + f()
-   |     ^^^
+   |           ^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = help: add `#![feature(effects)]` to the crate attributes to enable
@@ -49,17 +49,17 @@ LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u
    |                                      +++++++++++++++++++++++++
 
 error[E0015]: cannot call non-const closure in constant functions
-  --> $DIR/const-closures.rs:24:11
+  --> $DIR/const-closures.rs:12:5
    |
-LL |     f() + f()
-   |           ^^^
+LL |     f() * 7
+   |     ^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
    = help: add `#![feature(effects)]` to the crate attributes to enable
 help: consider further restricting this bound
    |
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
-   |                                      +++++++++++++++++++++++++
+LL |         F: ~const FnOnce() -> u8 + ~const std::ops::Fn<()>,
+   |                                  +++++++++++++++++++++++++
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr
index 8997e7ade6c..9afa2072dde 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr
@@ -4,6 +4,57 @@ error[E0493]: destructor of `T` cannot be evaluated at compile-time
 LL | const fn check<T: ~const Destruct>(_: T) {}
    |                                    ^ the destructor for this type cannot be evaluated in constant functions
 
-error: aborting due to 1 previous error
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+   |
+   = note: calling non-const function `<NonTrivialDrop as Drop>::drop`
+   |
+note: inside `std::ptr::drop_in_place::<NonTrivialDrop> - shim(Some(NonTrivialDrop))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `check::<NonTrivialDrop>`
+  --> $DIR/const-drop-fail.rs:24:43
+   |
+LL | const fn check<T: ~const Destruct>(_: T) {}
+   |                                           ^
+note: inside `_`
+  --> $DIR/const-drop-fail.rs:28:23
+   |
+LL |           const _: () = check($exp);
+   |                         ^^^^^^^^^^^
+...
+LL | / check_all! {
+LL | |     NonTrivialDrop,
+LL | |     ConstImplWithDropGlue(NonTrivialDrop),
+LL | | }
+   | |_- in this macro invocation
+   = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+   |
+   = note: calling non-const function `<ConstImplWithDropGlue as Drop>::drop`
+   |
+note: inside `std::ptr::drop_in_place::<ConstImplWithDropGlue> - shim(Some(ConstImplWithDropGlue))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `check::<ConstImplWithDropGlue>`
+  --> $DIR/const-drop-fail.rs:24:43
+   |
+LL | const fn check<T: ~const Destruct>(_: T) {}
+   |                                           ^
+note: inside `_`
+  --> $DIR/const-drop-fail.rs:28:23
+   |
+LL |           const _: () = check($exp);
+   |                         ^^^^^^^^^^^
+...
+LL | / check_all! {
+LL | |     NonTrivialDrop,
+LL | |     ConstImplWithDropGlue(NonTrivialDrop),
+LL | | }
+   | |_- in this macro invocation
+   = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0493`.
+Some errors have detailed explanations: E0080, E0493.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr
index f166bdf6cec..5ff3be713a7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr
@@ -1,15 +1,92 @@
+error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
+  --> $DIR/const-drop.rs:24:13
+   |
+LL |     let _ = S(&mut c);
+   |             ^^^^^^^^^ the destructor for this type cannot be evaluated in constant functions
+
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+   |
+   = note: calling non-const function `<S<'_> as Drop>::drop`
+   |
+note: inside `std::ptr::drop_in_place::<S<'_>> - shim(Some(S<'_>))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `b`
+  --> $DIR/const-drop.rs:24:22
+   |
+LL |     let _ = S(&mut c);
+   |                      ^
+note: inside `C`
+  --> $DIR/const-drop.rs:30:15
+   |
+LL | const C: u8 = b();
+   |               ^^^
+
 error[E0493]: destructor of `T` cannot be evaluated at compile-time
   --> $DIR/const-drop.rs:19:32
    |
 LL | const fn a<T: ~const Destruct>(_: T) {}
    |                                ^ the destructor for this type cannot be evaluated in constant functions
 
-error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
-  --> $DIR/const-drop.rs:24:13
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
    |
-LL |     let _ = S(&mut c);
-   |             ^^^^^^^^^ the destructor for this type cannot be evaluated in constant functions
+   = note: calling non-const function `<t::ConstDrop as Drop>::drop`
+   |
+note: inside `std::ptr::drop_in_place::<t::ConstDrop> - shim(Some(t::ConstDrop))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `a::<t::ConstDrop>`
+  --> $DIR/const-drop.rs:19:39
+   |
+LL | const fn a<T: ~const Destruct>(_: T) {}
+   |                                       ^
+note: inside `_`
+  --> $DIR/const-drop.rs:35:27
+   |
+LL |               const _: () = a($exp);
+   |                             ^^^^^^^
+...
+LL | / implements_const_drop! {
+LL | |     1u8,
+LL | |     2,
+LL | |     3.0,
+...  |
+LL | |     Result::<i32, !>::Ok(1),
+LL | | }
+   | |_- in this macro invocation
+   = note: this error originates in the macro `implements_const_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+   |
+   = note: calling non-const function `<t::ConstDrop as Drop>::drop`
+   |
+note: inside `std::ptr::drop_in_place::<t::ConstDrop> - shim(Some(t::ConstDrop))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `std::ptr::drop_in_place::<t::HasConstDrop> - shim(Some(t::HasConstDrop))`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `a::<t::HasConstDrop>`
+  --> $DIR/const-drop.rs:19:39
+   |
+LL | const fn a<T: ~const Destruct>(_: T) {}
+   |                                       ^
+note: inside `_`
+  --> $DIR/const-drop.rs:35:27
+   |
+LL |               const _: () = a($exp);
+   |                             ^^^^^^^
+...
+LL | / implements_const_drop! {
+LL | |     1u8,
+LL | |     2,
+LL | |     3.0,
+...  |
+LL | |     Result::<i32, !>::Ok(1),
+LL | | }
+   | |_- in this macro invocation
+   = note: this error originates in the macro `implements_const_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 2 previous errors
+error: aborting due to 5 previous errors
 
-For more information about this error, try `rustc --explain E0493`.
+Some errors have detailed explanations: E0080, E0493.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr
index 23e36887025..40e39cbefbc 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr
@@ -1,11 +1,3 @@
-error[E0493]: destructor of `T` cannot be evaluated at compile-time
-  --> $DIR/const-drop.rs:19:32
-   |
-LL | const fn a<T: ~const Destruct>(_: T) {}
-   |                                ^      - value is dropped here
-   |                                |
-   |                                the destructor for this type cannot be evaluated in constant functions
-
 error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
   --> $DIR/const-drop.rs:24:13
    |
@@ -14,6 +6,14 @@ LL |     let _ = S(&mut c);
    |             |
    |             the destructor for this type cannot be evaluated in constant functions
 
+error[E0493]: destructor of `T` cannot be evaluated at compile-time
+  --> $DIR/const-drop.rs:19:32
+   |
+LL | const fn a<T: ~const Destruct>(_: T) {}
+   |                                ^      - value is dropped here
+   |                                |
+   |                                the destructor for this type cannot be evaluated in constant functions
+
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed
index 38d8a36bcdf..435857224ac 100644
--- a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed
+++ b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.fixed
@@ -111,10 +111,13 @@ mod everything_outside_with_tt_inner {
 mod everything_outside_with_tt_outer {
     macro_rules! m {
         ($b:lifetime $colon:tt $a:tt) => {
-            struct Foo<$a, $b >(&$a &$b ());
+            // FIXME: replacement span is corrupted due to a collision in metavar span table.
+            // struct Foo<$a, $b $colon $a>(&$a &$b ());
+            // ^ ERROR: outlives requirements can be inferred
+            struct Bar<$a, $b>(&$a &$b ()) ;
+            //~^ ERROR: outlives requirements can be inferred
+            struct Baz<$a, $b>(&$a &$b ()) where (): Sized, ;
             //~^ ERROR: outlives requirements can be inferred
-            struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a;
-            struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a;
         }
     }
     m!('b: 'a);
@@ -123,9 +126,10 @@ mod everything_outside_with_tt_outer {
 mod everything_outside_with_tt_both {
     macro_rules! m {
         ($b:tt $colon:tt $a:tt) => {
-            struct Foo<$a, $b >(&$a &$b ());
-            //~^ ERROR: outlives requirements can be inferred
-            struct Bar<$a, $b>(&$a &$b ()) where ;
+            // FIXME: replacement span is corrupted due to a collision in metavar span table.
+            // struct Foo<$a, $b $colon $a>(&$a &$b ());
+            // ^ ERROR: outlives requirements can be inferred
+            struct Bar<$a, $b>(&$a &$b ()) ;
             //~^ ERROR: outlives requirements can be inferred
             struct Baz<$a, $b>(&$a &$b ()) where (): Sized, ;
             //~^ ERROR: outlives requirements can be inferred
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs
index 60eedf7b069..6c879231a16 100644
--- a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs
+++ b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.rs
@@ -111,10 +111,13 @@ mod everything_outside_with_tt_inner {
 mod everything_outside_with_tt_outer {
     macro_rules! m {
         ($b:lifetime $colon:tt $a:tt) => {
-            struct Foo<$a, $b $colon $a>(&$a &$b ());
-            //~^ ERROR: outlives requirements can be inferred
+            // FIXME: replacement span is corrupted due to a collision in metavar span table.
+            // struct Foo<$a, $b $colon $a>(&$a &$b ());
+            // ^ ERROR: outlives requirements can be inferred
             struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a;
+            //~^ ERROR: outlives requirements can be inferred
             struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a;
+            //~^ ERROR: outlives requirements can be inferred
         }
     }
     m!('b: 'a);
@@ -123,8 +126,9 @@ mod everything_outside_with_tt_outer {
 mod everything_outside_with_tt_both {
     macro_rules! m {
         ($b:tt $colon:tt $a:tt) => {
-            struct Foo<$a, $b $colon $a>(&$a &$b ());
-            //~^ ERROR: outlives requirements can be inferred
+            // FIXME: replacement span is corrupted due to a collision in metavar span table.
+            // struct Foo<$a, $b $colon $a>(&$a &$b ());
+            // ^ ERROR: outlives requirements can be inferred
             struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a;
             //~^ ERROR: outlives requirements can be inferred
             struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a;
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr
index 734ae687978..d684911be39 100644
--- a/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr
+++ b/tests/ui/rust-2018/edition-lint-infer-outlives-macro.stderr
@@ -83,25 +83,40 @@ LL |     m!('b: 'a);
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: outlives requirements can be inferred
-  --> $DIR/edition-lint-infer-outlives-macro.rs:114:31
+  --> $DIR/edition-lint-infer-outlives-macro.rs:117:44
    |
-LL |             struct Foo<$a, $b $colon $a>(&$a &$b ());
-   |                               ^^^^^^^^^ help: remove this bound
+LL |             struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a;
+   |                                            ^^^^^^^^^^^^^^^^^^ help: remove this bound
+...
+LL |     m!('b: 'a);
+   |     ---------- in this macro invocation
+   |
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: outlives requirements can be inferred
-  --> $DIR/edition-lint-infer-outlives-macro.rs:126:31
+  --> $DIR/edition-lint-infer-outlives-macro.rs:119:61
+   |
+LL |             struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a;
+   |                                                             ^^^^^^^^^^^^ help: remove this bound
+...
+LL |     m!('b: 'a);
+   |     ---------- in this macro invocation
    |
-LL |             struct Foo<$a, $b $colon $a>(&$a &$b ());
-   |                               ^^^^^^^^^ help: remove this bound
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: outlives requirements can be inferred
-  --> $DIR/edition-lint-infer-outlives-macro.rs:128:50
+  --> $DIR/edition-lint-infer-outlives-macro.rs:132:44
    |
 LL |             struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a;
-   |                                                  ^^^^^^^^^^^^ help: remove this bound
+   |                                            ^^^^^^^^^^^^^^^^^^ help: remove this bound
+...
+LL |     m!('b: 'a);
+   |     ---------- in this macro invocation
+   |
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: outlives requirements can be inferred
-  --> $DIR/edition-lint-infer-outlives-macro.rs:130:61
+  --> $DIR/edition-lint-infer-outlives-macro.rs:134:61
    |
 LL |             struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a;
    |                                                             ^^^^^^^^^^^^ help: remove this bound
diff --git a/tests/ui/rust-2024/prelude2024.rs b/tests/ui/rust-2024/prelude2024.rs
new file mode 100644
index 00000000000..e58ebe74188
--- /dev/null
+++ b/tests/ui/rust-2024/prelude2024.rs
@@ -0,0 +1,9 @@
+//@ check-pass
+//@ compile-flags: -Zunstable-options
+//@ edition:2024
+
+fn main() {
+    fut(async {}.into_future(), async {});
+}
+
+fn fut(_: impl Future, _: impl IntoFuture) {}
diff --git a/tests/ui/span/macro-span-replacement.rs b/tests/ui/span/macro-span-replacement.rs
index e6fcfa4c709..16f4018cf3e 100644
--- a/tests/ui/span/macro-span-replacement.rs
+++ b/tests/ui/span/macro-span-replacement.rs
@@ -4,10 +4,10 @@
 
 macro_rules! m {
     ($a:tt $b:tt) => {
-        $b $a; //~ WARN struct `S` is never constructed
+        $b $a;
     }
 }
 
 fn main() {
-    m!(S struct);
+    m!(S struct); //~ WARN struct `S` is never constructed
 }
diff --git a/tests/ui/span/macro-span-replacement.stderr b/tests/ui/span/macro-span-replacement.stderr
index 5dd56342889..6248db112f8 100644
--- a/tests/ui/span/macro-span-replacement.stderr
+++ b/tests/ui/span/macro-span-replacement.stderr
@@ -1,11 +1,8 @@
 warning: struct `S` is never constructed
-  --> $DIR/macro-span-replacement.rs:7:12
+  --> $DIR/macro-span-replacement.rs:12:8
    |
-LL |         $b $a;
-   |            ^^
-...
 LL |     m!(S struct);
-   |     ------------ in this macro invocation
+   |        ^
    |
 note: the lint level is defined here
   --> $DIR/macro-span-replacement.rs:3:9
diff --git a/tests/ui/static/static-drop-scope.stderr b/tests/ui/static/static-drop-scope.stderr
index 2c55161628f..24658bc601e 100644
--- a/tests/ui/static/static-drop-scope.stderr
+++ b/tests/ui/static/static-drop-scope.stderr
@@ -30,6 +30,22 @@ LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1;
    |                           |
    |                           the destructor for this type cannot be evaluated in constants
 
+error[E0493]: destructor of `(Option<WithDtor>, i32)` cannot be evaluated at compile-time
+  --> $DIR/static-drop-scope.rs:27:34
+   |
+LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
+   |                                  ^^^^^^^^^^^^^^^^^^^ - value is dropped here
+   |                                  |
+   |                                  the destructor for this type cannot be evaluated in constants
+
+error[E0493]: destructor of `(Option<WithDtor>, i32)` cannot be evaluated at compile-time
+  --> $DIR/static-drop-scope.rs:32:43
+   |
+LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
+   |                                           ^^^^^^^^^^^ - value is dropped here
+   |                                           |
+   |                                           the destructor for this type cannot be evaluated in constants
+
 error[E0493]: destructor of `T` cannot be evaluated at compile-time
   --> $DIR/static-drop-scope.rs:19:24
    |
@@ -47,22 +63,6 @@ LL |
 LL | }
    | - value is dropped here
 
-error[E0493]: destructor of `(Option<WithDtor>, i32)` cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:27:34
-   |
-LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
-   |                                  ^^^^^^^^^^^^^^^^^^^ - value is dropped here
-   |                                  |
-   |                                  the destructor for this type cannot be evaluated in constants
-
-error[E0493]: destructor of `(Option<WithDtor>, i32)` cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:32:43
-   |
-LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
-   |                                           ^^^^^^^^^^^ - value is dropped here
-   |                                           |
-   |                                           the destructor for this type cannot be evaluated in constants
-
 error: aborting due to 8 previous errors
 
 For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/statics/issue-14227.rs b/tests/ui/statics/issue-14227.rs
index a1fde14600a..8a70f51d3b4 100644
--- a/tests/ui/statics/issue-14227.rs
+++ b/tests/ui/statics/issue-14227.rs
@@ -3,5 +3,6 @@ extern "C" {
 }
 static CRASH: u32 = symbol;
 //~^ ERROR use of extern static is unsafe and requires
+//~| ERROR could not evaluate static initializer
 
 fn main() {}
diff --git a/tests/ui/statics/issue-14227.stderr b/tests/ui/statics/issue-14227.stderr
index 085d6df9c41..0aeb973bff3 100644
--- a/tests/ui/statics/issue-14227.stderr
+++ b/tests/ui/statics/issue-14227.stderr
@@ -1,3 +1,9 @@
+error[E0080]: could not evaluate static initializer
+  --> $DIR/issue-14227.rs:4:21
+   |
+LL | static CRASH: u32 = symbol;
+   |                     ^^^^^^ cannot access extern static (DefId(0:4 ~ issue_14227[1133]::{extern#0}::symbol))
+
 error[E0133]: use of extern static is unsafe and requires unsafe function or block
   --> $DIR/issue-14227.rs:4:21
    |
@@ -6,6 +12,7 @@ LL | static CRASH: u32 = symbol;
    |
    = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0133`.
+Some errors have detailed explanations: E0080, E0133.
+For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/statics/uninhabited-static.rs b/tests/ui/statics/uninhabited-static.rs
index f5c6f444317..a0f83f45079 100644
--- a/tests/ui/statics/uninhabited-static.rs
+++ b/tests/ui/statics/uninhabited-static.rs
@@ -12,10 +12,8 @@ extern {
 static VOID2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type
 //~| WARN: previously accepted
 //~| ERROR could not evaluate static initializer
-//~| WARN: type `Void` does not permit zero-initialization
 static NEVER2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type
 //~| WARN: previously accepted
 //~| ERROR could not evaluate static initializer
-//~| WARN: type `Void` does not permit zero-initialization
 
 fn main() {}
diff --git a/tests/ui/statics/uninhabited-static.stderr b/tests/ui/statics/uninhabited-static.stderr
index 9260930473f..f891c0ce25b 100644
--- a/tests/ui/statics/uninhabited-static.stderr
+++ b/tests/ui/statics/uninhabited-static.stderr
@@ -34,7 +34,7 @@ LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
    = note: uninhabited statics cannot be initialized, and any access would be an immediate error
 
 error: static of uninhabited type
-  --> $DIR/uninhabited-static.rs:16:1
+  --> $DIR/uninhabited-static.rs:15:1
    |
 LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
    | ^^^^^^^^^^^^^^^^^^^
@@ -49,37 +49,12 @@ error[E0080]: could not evaluate static initializer
 LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
    |                               ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type `Void`
 
-warning: the type `Void` does not permit zero-initialization
-  --> $DIR/uninhabited-static.rs:12:31
-   |
-LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
-   |                               ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
-   |
-note: enums with no inhabited variants have no valid value
-  --> $DIR/uninhabited-static.rs:4:1
-   |
-LL | enum Void {}
-   | ^^^^^^^^^
-   = note: `#[warn(invalid_value)]` on by default
-
 error[E0080]: could not evaluate static initializer
-  --> $DIR/uninhabited-static.rs:16:32
+  --> $DIR/uninhabited-static.rs:15:32
    |
 LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
    |                                ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type `Void`
 
-warning: the type `Void` does not permit zero-initialization
-  --> $DIR/uninhabited-static.rs:16:32
-   |
-LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
-   |                                ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
-   |
-note: enums with no inhabited variants have no valid value
-  --> $DIR/uninhabited-static.rs:4:1
-   |
-LL | enum Void {}
-   | ^^^^^^^^^
-
-error: aborting due to 6 previous errors; 2 warnings emitted
+error: aborting due to 6 previous errors
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.next.stderr b/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.next.stderr
index aaadf604a80..cde925db184 100644
--- a/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.next.stderr
+++ b/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.next.stderr
@@ -1,8 +1,8 @@
-error[E0284]: type annotations needed: cannot satisfy `<<T as Id<_>>::Id as Unnormalizable>::Assoc == _`
+error[E0284]: type annotations needed: cannot satisfy `_ == <<T as Id<_>>::Id as Unnormalizable>::Assoc`
   --> $DIR/occurs-check-nested-alias.rs:36:9
    |
 LL |     x = y;
-   |         ^ cannot satisfy `<<T as Id<_>>::Id as Unnormalizable>::Assoc == _`
+   |         ^ cannot satisfy `_ == <<T as Id<_>>::Id as Unnormalizable>::Assoc`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/treat-err-as-bug/err.stderr b/tests/ui/treat-err-as-bug/err.stderr
index ca04ee9e0cf..eb7b50b4210 100644
--- a/tests/ui/treat-err-as-bug/err.stderr
+++ b/tests/ui/treat-err-as-bug/err.stderr
@@ -8,5 +8,5 @@ error: the compiler unexpectedly panicked. this is a bug.
 
 query stack during panic:
 #0 [eval_static_initializer] evaluating initializer of static `C`
-#1 [lint_mod] linting top-level module
+#1 [analysis] running analysis passes on this crate
 end of query stack
diff --git a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
index a3f65146f75..71416eb531a 100644
--- a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
+++ b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
@@ -18,7 +18,6 @@ impl Foo for () {
 
     type Baz<T> = impl Sized;
     //~^ ERROR type `Baz` has 1 type parameter but its trait declaration has 0 type parameters
-    //~| ERROR unconstrained opaque type
 
     fn test<'a>() -> Self::Bar<'a> {
         &()
diff --git a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr
index 13f5d8b8ea6..e5a21ff8b4e 100644
--- a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr
+++ b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr
@@ -7,14 +7,6 @@ LL |     type Baz<'a>;
 LL |     type Baz<T> = impl Sized;
    |              ^ found 1 type parameter
 
-error: unconstrained opaque type
-  --> $DIR/impl-trait-in-type-alias-with-bad-substs.rs:19:19
-   |
-LL |     type Baz<T> = impl Sized;
-   |                   ^^^^^^^^^^
-   |
-   = note: `Baz` must be used in combination with a concrete type within the same impl
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0049`.
diff --git a/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr b/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr
index 1ef02321e15..1a3848bbcf5 100644
--- a/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr
+++ b/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr
@@ -1,8 +1,8 @@
 error: function can not have more than 65535 arguments
-  --> $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:22
+  --> $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:17
    |
 LL |         fn _f($($t: ()),*) {}
-   |                      ^
+   |                 ^^^^^^
 ...
 LL | many_args!{[_]########## ######}
    | -------------------------------- in this macro invocation
diff --git a/tests/ui/typeck/cyclic_type_ice.rs b/tests/ui/typeck/cyclic_type_ice.rs
new file mode 100644
index 00000000000..7899b354f38
--- /dev/null
+++ b/tests/ui/typeck/cyclic_type_ice.rs
@@ -0,0 +1,7 @@
+fn thing() {
+    let f = |_, _| ();
+    f(f); //~ ERROR: closure/coroutine type that references itself
+    //~^ ERROR: this function takes 2 arguments but 1 argument was supplied
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/cyclic_type_ice.stderr b/tests/ui/typeck/cyclic_type_ice.stderr
new file mode 100644
index 00000000000..bfff6830fc5
--- /dev/null
+++ b/tests/ui/typeck/cyclic_type_ice.stderr
@@ -0,0 +1,31 @@
+error[E0644]: closure/coroutine type that references itself
+  --> $DIR/cyclic_type_ice.rs:3:7
+   |
+LL |     f(f);
+   |       ^ cyclic type of infinite size
+   |
+   = note: closures cannot capture themselves or take themselves as argument;
+           this error may be the result of a recent compiler bug-fix,
+           see issue #46062 <https://github.com/rust-lang/rust/issues/46062>
+           for more information
+
+error[E0057]: this function takes 2 arguments but 1 argument was supplied
+  --> $DIR/cyclic_type_ice.rs:3:5
+   |
+LL |     f(f);
+   |     ^--- an argument is missing
+   |
+note: closure defined here
+  --> $DIR/cyclic_type_ice.rs:2:13
+   |
+LL |     let f = |_, _| ();
+   |             ^^^^^^
+help: provide the argument
+   |
+LL |     f(/*  */, /*  */);
+   |      ~~~~~~~~~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0057, E0644.
+For more information about an error, try `rustc --explain E0057`.
diff --git a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs
index c319c63eda2..cc66b5fd6f2 100644
--- a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs
+++ b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs
@@ -58,12 +58,12 @@ macro_rules! nested2_ident {
 // instead of the enum variant
 macro_rules! nested1_tt_args_in_first_macro {
     () => (nested2_tt_args_in_first_macro!(i32, u32));
+    //~^ ERROR type arguments are not allowed on this type
 }
 
 macro_rules! nested2_tt_args_in_first_macro {
     ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
-    //~^ ERROR type arguments are not allowed on this type
-    //~| ERROR mismatched types
+    //~^ ERROR mismatched types
             = 5 { true } else { false });
 }
 
diff --git a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr
index b17936ee3d3..cb7666657ef 100644
--- a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr
+++ b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr
@@ -1,10 +1,10 @@
 error[E0109]: type arguments are not allowed on this type
   --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:15:51
    |
+LL |     () => (recursive_tt!(VariantB));
+   |                          -------- not allowed on this type
 LL |     ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
-   |                                        --------   ^^^  ^^^ type argument not allowed
-   |                                        |
-   |                                        not allowed on this type
+   |                                                   ^^^  ^^^ type argument not allowed
 ...
 LL |     recursive_tt!();
    |     --------------- in this macro invocation
@@ -69,10 +69,11 @@ LL |     recursive_ident!();
 error[E0109]: type arguments are not allowed on this type
   --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:38:51
    |
+LL |     () => (nested2_tt!(VariantB));
+   |                        -------- not allowed on this type
+...
 LL |     ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
-   |                                        --------   ^^^  ^^^ type argument not allowed
-   |                                        |
-   |                                        not allowed on this type
+   |                                                   ^^^  ^^^ type argument not allowed
 ...
 LL |     nested1_tt!();
    |     ------------- in this macro invocation
@@ -136,12 +137,13 @@ LL |     nested1_ident!();
    = note: this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0109]: type arguments are not allowed on this type
-  --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:64:58
+  --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:60:44
    |
+LL |     () => (nested2_tt_args_in_first_macro!(i32, u32));
+   |                                            ^^^  ^^^ type argument not allowed
+...
 LL |     ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
-   |                                               --------   ^^^^^  ^^^^^ type argument not allowed
-   |                                               |
-   |                                               not allowed on this type
+   |                                               -------- not allowed on this type
 ...
 LL |     nested1_tt_args_in_first_macro!();
    |     --------------------------------- in this macro invocation
@@ -155,11 +157,11 @@ LL +     ($arg1:tt, $arg2:tt) => (if let EnumUnit::<$arg1, $arg2>::VariantB {}
    |
 
 error[E0308]: mismatched types
-  --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:64:37
+  --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:65:37
    |
 LL |     ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>`
-...
+LL |
 LL |             = 5 { true } else { false });
    |               - this expression has type `{integer}`
 ...
diff --git a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs
index 3e15e28b8fd..ce0b60b6411 100644
--- a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs
+++ b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs
@@ -1,5 +1,4 @@
 //@ aux-build:tdticc_coherence_lib.rs
-#![allow(suspicious_auto_trait_impls)]
 
 // Test that we do not consider associated types to be sendable without
 // some applicable trait bound (and we don't ICE).
@@ -11,15 +10,15 @@ extern crate tdticc_coherence_lib as lib;
 use lib::DefaultedTrait;
 
 struct A;
-impl DefaultedTrait for (A,) { } //~ ERROR E0117
+impl DefaultedTrait for (A,) {} //~ ERROR E0117
 
 struct B;
-impl !DefaultedTrait for (B,) { } //~ ERROR E0117
+impl !DefaultedTrait for (B,) {} //~ ERROR E0117
 
 struct C;
 struct D<T>(T);
-impl DefaultedTrait for Box<C> { } //~ ERROR E0321
-impl DefaultedTrait for lib::Something<C> { } //~ ERROR E0117
-impl DefaultedTrait for D<C> { } // OK
+impl DefaultedTrait for Box<C> {} //~ ERROR E0321
+impl DefaultedTrait for lib::Something<C> {} //~ ERROR E0117
+impl DefaultedTrait for D<C> {} // OK
 
-fn main() { }
+fn main() {}
diff --git a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
index fc3778b7967..32e6e88fc48 100644
--- a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
+++ b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
@@ -1,7 +1,7 @@
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
-  --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:14:1
+  --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:13:1
    |
-LL | impl DefaultedTrait for (A,) { }
+LL | impl DefaultedTrait for (A,) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^----
    | |                       |
    | |                       this is not defined in the current crate because tuples are always foreign
@@ -10,9 +10,9 @@ LL | impl DefaultedTrait for (A,) { }
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
-  --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:17:1
+  --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:16:1
    |
-LL | impl !DefaultedTrait for (B,) { }
+LL | impl !DefaultedTrait for (B,) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^----
    | |                        |
    | |                        this is not defined in the current crate because tuples are always foreign
@@ -21,15 +21,15 @@ LL | impl !DefaultedTrait for (B,) { }
    = note: define and implement a trait or new type instead
 
 error[E0321]: cross-crate traits with a default impl, like `DefaultedTrait`, can only be implemented for a struct/enum type defined in the current crate
-  --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:1
+  --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:20:1
    |
-LL | impl DefaultedTrait for Box<C> { }
+LL | impl DefaultedTrait for Box<C> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait for type in another crate
 
 error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate
-  --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:22:1
+  --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:1
    |
-LL | impl DefaultedTrait for lib::Something<C> { }
+LL | impl DefaultedTrait for lib::Something<C> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^-----------------
    | |                       |
    | |                       `Something` is not defined in the current crate
diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr
index 18f6edad5c0..c102926fcf5 100644
--- a/tests/ui/typeck/typeck_type_placeholder_item.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr
@@ -666,12 +666,6 @@ LL |     type F: std::ops::Fn(_);
 LL | impl Qux for Struct {
    | ^^^^^^^^^^^^^^^^^^^ missing `F` in implementation
 
-error[E0515]: cannot return reference to function parameter `x`
-  --> $DIR/typeck_type_placeholder_item.rs:50:5
-   |
-LL |     &x
-   |     ^^ returns a reference to data owned by the current function
-
 error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::filter::<{closure@$DIR/typeck_type_placeholder_item.rs:230:29: 230:32}>` in constants
   --> $DIR/typeck_type_placeholder_item.rs:230:22
    |
@@ -690,6 +684,12 @@ LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
 
+error[E0515]: cannot return reference to function parameter `x`
+  --> $DIR/typeck_type_placeholder_item.rs:50:5
+   |
+LL |     &x
+   |     ^^ returns a reference to data owned by the current function
+
 error: aborting due to 75 previous errors
 
 Some errors have detailed explanations: E0015, E0046, E0121, E0282, E0403, E0515.
diff --git a/tests/ui/wf/issue-110157.rs b/tests/ui/wf/issue-110157.rs
index 07e2c5d58c3..1a3d13e93b0 100644
--- a/tests/ui/wf/issue-110157.rs
+++ b/tests/ui/wf/issue-110157.rs
@@ -1,8 +1,7 @@
 struct NeedsDropTypes<'tcx, F>(std::marker::PhantomData<&'tcx F>);
 
 impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
-//~^ ERROR type annotations needed
-//~| ERROR not all trait items implemented
+//~^ ERROR not all trait items implemented
 where
     F: Fn(&Missing) -> Result<I, ()>,
     //~^ ERROR cannot find type `Missing` in this scope
diff --git a/tests/ui/wf/issue-110157.stderr b/tests/ui/wf/issue-110157.stderr
index 16bd34a6d8e..e750ea47d51 100644
--- a/tests/ui/wf/issue-110157.stderr
+++ b/tests/ui/wf/issue-110157.stderr
@@ -1,37 +1,20 @@
 error[E0412]: cannot find type `Missing` in this scope
-  --> $DIR/issue-110157.rs:7:12
+  --> $DIR/issue-110157.rs:6:12
    |
 LL |     F: Fn(&Missing) -> Result<I, ()>,
    |            ^^^^^^^ not found in this scope
 
 error[E0412]: cannot find type `Missing` in this scope
-  --> $DIR/issue-110157.rs:9:24
+  --> $DIR/issue-110157.rs:8:24
    |
 LL |     I: Iterator<Item = Missing>,
    |                        ^^^^^^^ not found in this scope
 
-error[E0283]: type annotations needed
-  --> $DIR/issue-110157.rs:3:31
-   |
-LL | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
-   |                               ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `I`
-   |
-   = note: cannot satisfy `_: Iterator`
-note: required for `NeedsDropTypes<'tcx, F>` to implement `Iterator`
-  --> $DIR/issue-110157.rs:3:18
-   |
-LL | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
-   |                  ^^^^^^^^     ^^^^^^^^^^^^^^^^^^^^^^^
-...
-LL |     I: Iterator<Item = Missing>,
-   |        ------------------------ unsatisfied trait bound introduced here
-
 error[E0046]: not all trait items implemented, missing: `Item`, `next`
   --> $DIR/issue-110157.rs:3:1
    |
 LL | / impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
 LL | |
-LL | |
 LL | | where
 LL | |     F: Fn(&Missing) -> Result<I, ()>,
 LL | |
@@ -41,7 +24,7 @@ LL | |     I: Iterator<Item = Missing>,
    = help: implement the missing item: `type Item = /* Type */;`
    = help: implement the missing item: `fn next(&mut self) -> Option<<Self as Iterator>::Item> { todo!() }`
 
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0046, E0283, E0412.
+Some errors have detailed explanations: E0046, E0412.
 For more information about an error, try `rustc --explain E0046`.