about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock12
-rw-r--r--Cargo.toml3
-rw-r--r--compiler/rustc_attr/src/builtin.rs10
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/move_errors.rs17
-rw-r--r--compiler/rustc_const_eval/messages.ftl2
-rw-r--r--compiler/rustc_const_eval/src/check_consts/check.rs21
-rw-r--r--compiler/rustc_const_eval/src/check_consts/ops.rs4
-rw-r--r--compiler/rustc_const_eval/src/const_eval/fn_queries.rs12
-rw-r--r--compiler/rustc_feature/src/builtin_attrs.rs4
-rw-r--r--compiler/rustc_hir_analysis/messages.ftl4
-rw-r--r--compiler/rustc_hir_analysis/src/collect/type_of.rs10
-rw-r--r--compiler/rustc_hir_typeck/src/pat.rs19
-rw-r--r--compiler/rustc_middle/src/middle/stability.rs4
-rw-r--r--compiler/rustc_middle/src/ty/intrinsic.rs2
-rw-r--r--compiler/rustc_middle/src/ty/util.rs1
-rw-r--r--compiler/rustc_parse/src/parser/attr_wrapper.rs28
-rw-r--r--compiler/rustc_passes/src/stability.rs15
-rw-r--r--compiler/rustc_session/src/config.rs4
-rw-r--r--compiler/rustc_session/src/options.rs11
-rw-r--r--compiler/rustc_span/src/symbol.rs1
-rw-r--r--compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs4
-rw-r--r--compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs35
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/confirmation.rs12
-rw-r--r--library/core/src/intrinsics.rs2172
-rw-r--r--library/core/src/lib.rs2
-rw-r--r--library/core/tests/lib.rs2
-rw-r--r--library/rustc-std-workspace-core/README.md3
m---------src/doc/edition-guide0
m---------src/doc/reference0
m---------src/doc/rust-by-example0
m---------src/doc/rustc-dev-guide0
-rw-r--r--src/librustdoc/clean/mod.rs4
-rw-r--r--src/librustdoc/core.rs7
-rw-r--r--src/librustdoc/passes/calculate_doc_coverage.rs1
-rw-r--r--src/librustdoc/passes/strip_hidden.rs2
-rw-r--r--src/librustdoc/passes/strip_priv_imports.rs2
-rw-r--r--src/librustdoc/passes/strip_private.rs2
-rw-r--r--src/librustdoc/visit_ast.rs2
-rw-r--r--src/rustc-std-workspace/README.md4
-rw-r--r--src/rustc-std-workspace/rustc-std-workspace-alloc/Cargo.toml11
-rw-r--r--src/rustc-std-workspace/rustc-std-workspace-alloc/src/lib.rs3
-rw-r--r--src/rustc-std-workspace/rustc-std-workspace-core/Cargo.toml11
-rw-r--r--src/rustc-std-workspace/rustc-std-workspace-core/src/lib.rs3
-rw-r--r--src/rustc-std-workspace/rustc-std-workspace-std/Cargo.toml11
-rw-r--r--src/rustc-std-workspace/rustc-std-workspace-std/src/lib.rs1
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/allow_attributes.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/allow_attributes_without_reason.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/blanket_clippy_restriction_lints.rs6
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs4
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/duplicated_attributes.rs8
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/mixed_attributes_style.rs6
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/mod.rs128
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/should_panic_without_expect.rs6
-rw-r--r--src/tools/clippy/clippy_lints/src/attrs/useless_attribute.rs8
-rw-r--r--src/tools/clippy/clippy_lints/src/lib.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/check_proc_macro.rs5
-rw-r--r--src/tools/clippy/tests/ui/allow_attributes.stderr10
-rw-r--r--src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr11
-rw-r--r--src/tools/clippy/tests/ui/attrs.stderr18
-rw-r--r--src/tools/clippy/tests/ui/blanket_clippy_restriction_lints.stderr14
-rw-r--r--src/tools/rust-analyzer/.github/workflows/autopublish.yaml1
-rw-r--r--src/tools/rust-analyzer/Cargo.lock24
-rw-r--r--src/tools/rust-analyzer/Cargo.toml10
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/body/lower.rs16
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/data.rs1
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/dyn_map.rs74
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/dyn_map/keys.rs72
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/expander.rs4
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/generics.rs19
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/hir/type_ref.rs17
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs10
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs78
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/lib.rs14
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/lower.rs100
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/path.rs4
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/path/lower.rs54
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs18
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs29
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/display.rs4
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/infer.rs2
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/infer/path.rs2
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/layout.rs16
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/lower.rs407
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs28
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/tests.rs2
-rw-r--r--src/tools/rust-analyzer/crates/hir/src/lib.rs87
-rw-r--r--src/tools/rust-analyzer/crates/hir/src/semantics.rs13
-rw-r--r--src/tools/rust-analyzer/crates/hir/src/semantics/child_by_source.rs (renamed from src/tools/rust-analyzer/crates/hir-def/src/child_by_source.rs)4
-rw-r--r--src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs6
-rw-r--r--src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs9
-rw-r--r--src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_fn_type_alias.rs430
-rw-r--r--src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_const_as_literal.rs5
-rw-r--r--src/tools/rust-analyzer/crates/ide-assists/src/lib.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs30
-rw-r--r--src/tools/rust-analyzer/crates/ide-completion/src/render.rs24
-rw-r--r--src/tools/rust-analyzer/crates/ide-completion/src/tests/flyimport.rs51
-rw-r--r--src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/hover.rs33
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/hover/render.rs155
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/hover/tests.rs483
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/interpret.rs64
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/interpret_function.rs47
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/lib.rs4
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/static_index.rs1
-rw-r--r--src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs2
-rw-r--r--src/tools/rust-analyzer/crates/parser/src/grammar.rs7
-rw-r--r--src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs2
-rw-r--r--src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs2
-rw-r--r--src/tools/rust-analyzer/crates/parser/src/grammar/items.rs13
-rw-r--r--src/tools/rust-analyzer/crates/parser/src/grammar/items/traits.rs2
-rw-r--r--src/tools/rust-analyzer/crates/parser/src/grammar/patterns.rs24
-rw-r--r--src/tools/rust-analyzer/crates/parser/test_data/generated/runner.rs8
-rw-r--r--src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_pat_leading_or.rast54
-rw-r--r--src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_pat_leading_or.rs1
-rw-r--r--src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/safe_outside_of_extern.rast30
-rw-r--r--src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/safe_outside_of_extern.rs1
-rw-r--r--src/tools/rust-analyzer/crates/proc-macro-api/src/process.rs4
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs23
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/cli/run_tests.rs9
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs5
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs6
-rw-r--r--src/tools/rust-analyzer/crates/syntax/src/ast/make.rs42
-rw-r--r--src/tools/rust-analyzer/crates/test-fixture/Cargo.toml1
-rw-r--r--src/tools/rust-analyzer/docs/dev/setup.md57
-rw-r--r--src/tools/rust-analyzer/editors/code/package.json2
-rw-r--r--src/tools/rust-analyzer/rust-version2
-rw-r--r--src/tools/rust-analyzer/xtask/src/tidy.rs1
-rw-r--r--tests/rustdoc-ui/show-coverage-json.rs13
-rw-r--r--tests/rustdoc-ui/show-coverage-json.stdout1
-rw-r--r--tests/rustdoc-ui/show-coverage.rs13
-rw-r--r--tests/rustdoc-ui/show-coverage.stdout7
-rw-r--r--tests/rustdoc/const-intrinsic.rs28
-rw-r--r--tests/ui-fulldeps/hash-stable-is-unstable.rs11
-rw-r--r--tests/ui-fulldeps/hash-stable-is-unstable.stderr20
-rw-r--r--tests/ui-fulldeps/pathless-extern-unstable.rs3
-rw-r--r--tests/ui-fulldeps/pathless-extern-unstable.stderr4
-rw-r--r--tests/ui/associated-inherent-types/assoc-inherent-unstable.rs2
-rw-r--r--tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr2
-rw-r--r--tests/ui/async-await/async-fn/edition-2015.rs4
-rw-r--r--tests/ui/async-await/async-fn/edition-2015.stderr4
-rw-r--r--tests/ui/box/alloc-unstable-fail.rs2
-rw-r--r--tests/ui/box/alloc-unstable-fail.stderr2
-rw-r--r--tests/ui/closures/coerce-unsafe-to-closure.stderr4
-rw-r--r--tests/ui/conditional-compilation/cfg_accessible-unstable.rs2
-rw-r--r--tests/ui/conditional-compilation/cfg_accessible-unstable.stderr2
-rw-r--r--tests/ui/consts/auxiliary/unstable_intrinsic.rs33
-rw-r--r--tests/ui/consts/const-compare-bytes-ub.rs1
-rw-r--r--tests/ui/consts/const-compare-bytes-ub.stderr16
-rw-r--r--tests/ui/consts/const-compare-bytes.rs1
-rw-r--r--tests/ui/consts/const-eval/simd/insert_extract.rs20
-rw-r--r--tests/ui/consts/const-unstable-intrinsic.rs70
-rw-r--r--tests/ui/consts/const-unstable-intrinsic.stderr111
-rw-r--r--tests/ui/consts/copy-intrinsic.rs20
-rw-r--r--tests/ui/consts/copy-intrinsic.stderr8
-rw-r--r--tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs11
-rw-r--r--tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr23
-rw-r--r--tests/ui/derives/rustc-decodable-issue-123156.stderr2
-rw-r--r--tests/ui/destructuring-assignment/struct_destructure_fail.stderr4
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr4
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr4
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr4
-rw-r--r--tests/ui/error-codes/E0027.stderr16
-rw-r--r--tests/ui/explore-issue-38412.rs2
-rw-r--r--tests/ui/explore-issue-38412.stderr14
-rw-r--r--tests/ui/feature-gates/bench.rs4
-rw-r--r--tests/ui/feature-gates/bench.stderr8
-rw-r--r--tests/ui/feature-gates/feature-gate-alloc-error-handler.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-autodiff-use.rs8
-rw-r--r--tests/ui/feature-gates/feature-gate-concat_bytes.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-concat_bytes.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-concat_idents.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-concat_idents2.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-concat_idents3.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-custom_mir.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-format_args_nl.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-log_syntax.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-log_syntax2.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-naked_functions.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-naked_functions.stderr6
-rw-r--r--tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr8
-rw-r--r--tests/ui/feature-gates/feature-gate-trace_macros.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-type_ascription.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-type_ascription.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr6
-rw-r--r--tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr6
-rw-r--r--tests/ui/feature-gates/issue-49983-see-issue-0.stderr2
-rw-r--r--tests/ui/feature-gates/rustc-private.rs2
-rw-r--r--tests/ui/feature-gates/rustc-private.stderr2
-rw-r--r--tests/ui/feature-gates/trace_macros-gate.stderr8
-rw-r--r--tests/ui/imports/issue-37887.stderr2
-rw-r--r--tests/ui/imports/resolve-other-libc.rs2
-rw-r--r--tests/ui/inference/inference_unstable_forced.stderr2
-rw-r--r--tests/ui/internal/internal-unstable-noallow.rs8
-rw-r--r--tests/ui/internal/internal-unstable-noallow.stderr8
-rw-r--r--tests/ui/internal/internal-unstable-thread-local.stderr2
-rw-r--r--tests/ui/internal/internal-unstable.stderr10
-rw-r--r--tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs1
-rw-r--r--tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr6
-rw-r--r--tests/ui/intrinsics/intrinsic-raw_eq-const.rs1
-rw-r--r--tests/ui/intrinsics/reify-intrinsic.stderr4
-rw-r--r--tests/ui/intrinsics/unchecked_math_unstable.stderr6
-rw-r--r--tests/ui/issues/issue-52489.rs2
-rw-r--r--tests/ui/issues/issue-52489.stderr2
-rw-r--r--tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr4
-rw-r--r--tests/ui/layout/thaw-transmute-invalid-enum.rs6
-rw-r--r--tests/ui/layout/thaw-transmute-invalid-enum.stderr6
-rw-r--r--tests/ui/lint/expansion-time.rs2
-rw-r--r--tests/ui/lint/expansion-time.stderr4
-rw-r--r--tests/ui/lint/lint-output-format.stderr8
-rw-r--r--tests/ui/lint/lint-stability-2.rs16
-rw-r--r--tests/ui/lint/lint-stability-2.stderr64
-rw-r--r--tests/ui/lint/lint-stability-fields.stderr86
-rw-r--r--tests/ui/lint/lint-stability.rs10
-rw-r--r--tests/ui/lint/lint-stability.stderr86
-rw-r--r--tests/ui/macros/macro-stability.rs8
-rw-r--r--tests/ui/macros/macro-stability.stderr6
-rw-r--r--tests/ui/offset-of/offset-of-unstable.stderr16
-rw-r--r--tests/ui/on-unimplemented/suggest_tuple_wrap.rs19
-rw-r--r--tests/ui/on-unimplemented/suggest_tuple_wrap.stderr25
-rw-r--r--tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs26
-rw-r--r--tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr26
-rw-r--r--tests/ui/overloaded/overloaded-calls-nontuple.stderr4
-rw-r--r--tests/ui/pattern/usefulness/doc-hidden-fields.stderr12
-rw-r--r--tests/ui/pattern/usefulness/stable-gated-fields.stderr4
-rw-r--r--tests/ui/pattern/usefulness/unstable-gated-fields.stderr8
-rw-r--r--tests/ui/pin-macro/cant_access_internals.rs2
-rw-r--r--tests/ui/pin-macro/cant_access_internals.stderr2
-rw-r--r--tests/ui/proc-macro/expand-to-unstable.stderr2
-rw-r--r--tests/ui/repr/16-bit-repr-c-enum.rs11
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr2
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs2
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs6
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs5
-rw-r--r--tests/ui/stability-attribute/accidental-stable-in-unstable.rs2
-rw-r--r--tests/ui/stability-attribute/accidental-stable-in-unstable.stderr2
-rw-r--r--tests/ui/stability-attribute/allow-unstable-reexport.rs6
-rw-r--r--tests/ui/stability-attribute/allow-unstable-reexport.stderr6
-rw-r--r--tests/ui/stability-attribute/allowed-through-unstable.rs2
-rw-r--r--tests/ui/stability-attribute/allowed-through-unstable.stderr2
-rw-r--r--tests/ui/stability-attribute/default-body-stability-err.stderr8
-rw-r--r--tests/ui/stability-attribute/generics-default-stability-trait.rs6
-rw-r--r--tests/ui/stability-attribute/generics-default-stability-trait.stderr6
-rw-r--r--tests/ui/stability-attribute/generics-default-stability-where.rs2
-rw-r--r--tests/ui/stability-attribute/generics-default-stability-where.stderr2
-rw-r--r--tests/ui/stability-attribute/generics-default-stability.rs56
-rw-r--r--tests/ui/stability-attribute/generics-default-stability.stderr56
-rw-r--r--tests/ui/stability-attribute/issue-28075.rs2
-rw-r--r--tests/ui/stability-attribute/issue-28075.stderr2
-rw-r--r--tests/ui/stability-attribute/issue-28388-3.rs2
-rw-r--r--tests/ui/stability-attribute/issue-28388-3.stderr2
-rw-r--r--tests/ui/stability-attribute/missing-const-stability.rs6
-rw-r--r--tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs4
-rw-r--r--tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr4
-rw-r--r--tests/ui/stability-attribute/stability-attribute-issue.rs4
-rw-r--r--tests/ui/stability-attribute/stability-attribute-issue.stderr4
-rw-r--r--tests/ui/stability-attribute/stable-in-unstable.rs12
-rw-r--r--tests/ui/stability-attribute/stable-in-unstable.stderr12
-rw-r--r--tests/ui/stability-attribute/suggest-vec-allocator-api.rs8
-rw-r--r--tests/ui/stability-attribute/suggest-vec-allocator-api.stderr8
-rw-r--r--tests/ui/structs/struct-field-cfg.stderr4
-rw-r--r--tests/ui/structs/struct-pat-derived-error.stderr4
-rw-r--r--tests/ui/structs/struct-tuple-field-names.stderr4
-rw-r--r--tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr16
-rw-r--r--tests/ui/target-feature/feature-hierarchy.rs10
-rw-r--r--tests/ui/target-feature/no-llvm-leaks.rs10
-rw-r--r--tests/ui/traits/bound/unknown-assoc-with-const-arg.rs20
-rw-r--r--tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr38
-rw-r--r--tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr2
-rw-r--r--tests/ui/traits/issue-78372.rs4
-rw-r--r--tests/ui/traits/issue-78372.stderr4
-rw-r--r--tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs4
-rw-r--r--tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr4
-rw-r--r--tests/ui/type/pattern_types/feature-gate-pattern_types.rs10
-rw-r--r--tests/ui/type/pattern_types/feature-gate-pattern_types.stderr10
-rw-r--r--tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr4
285 files changed, 4308 insertions, 2690 deletions
diff --git a/Cargo.lock b/Cargo.lock
index cc36dd82f97..f78db30b286 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3197,6 +3197,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e5c9f15eec8235d7cb775ee6f81891db79b98fd54ba1ad8fae565b88ef1ae4e2"
 
 [[package]]
+name = "rustc-std-workspace-alloc"
+version = "1.0.1"
+
+[[package]]
+name = "rustc-std-workspace-core"
+version = "1.0.1"
+
+[[package]]
+name = "rustc-std-workspace-std"
+version = "1.0.1"
+
+[[package]]
 name = "rustc_abi"
 version = "0.0.0"
 dependencies = [
diff --git a/Cargo.toml b/Cargo.toml
index d4b84250fc4..e1d667bf015 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,9 @@ resolver = "2"
 members = [
   "compiler/rustc",
   "src/etc/test-float-parse",
+  "src/rustc-std-workspace/rustc-std-workspace-core",
+  "src/rustc-std-workspace/rustc-std-workspace-alloc",
+  "src/rustc-std-workspace/rustc-std-workspace-std",
   "src/rustdoc-json-types",
   "src/tools/build_helper",
   "src/tools/cargotest",
diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs
index 6af75bc94bb..2753ac529d1 100644
--- a/compiler/rustc_attr/src/builtin.rs
+++ b/compiler/rustc_attr/src/builtin.rs
@@ -273,8 +273,7 @@ pub fn find_stability(
 /// Collects stability info from `rustc_const_stable`/`rustc_const_unstable`/`rustc_promotable`
 /// attributes in `attrs`. Returns `None` if no stability attributes are found.
 ///
-/// `is_const_fn` indicates whether this is a function marked as `const`. It will always
-/// be false for intrinsics in an `extern` block!
+/// `is_const_fn` indicates whether this is a function marked as `const`.
 pub fn find_const_stability(
     sess: &Session,
     attrs: &[Attribute],
@@ -330,7 +329,7 @@ pub fn find_const_stability(
         }
     }
 
-    // Merge promotable and not_exposed_on_stable into stability info
+    // Merge promotable and const_stable_indirect into stability info
     if promotable {
         match &mut const_stab {
             Some((stab, _)) => stab.promotable = promotable,
@@ -352,10 +351,7 @@ pub fn find_const_stability(
                     })
                 }
             }
-            _ => {
-                // We ignore the `#[rustc_const_stable_indirect]` here, it should be picked up by
-                // the `default_const_unstable` logic.
-            }
+            _ => {}
         }
     }
     // Make sure if `const_stable_indirect` is present, that is recorded. Also make sure all `const
diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
index 3871816777c..15cc9c20ab7 100644
--- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
@@ -10,6 +10,7 @@ use rustc_middle::ty::{self, Ty};
 use rustc_mir_dataflow::move_paths::{LookupResult, MovePathIndex};
 use rustc_span::{BytePos, ExpnKind, MacroKind, Span};
 use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
+use rustc_trait_selection::infer::InferCtxtExt;
 use tracing::debug;
 
 use crate::MirBorrowckCtxt;
@@ -267,6 +268,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
                 kind,
                 self.is_upvar_field_projection(original_path.as_ref())
             );
+            if self.has_ambiguous_copy(original_path.ty(self.body, self.infcx.tcx).ty) {
+                // If the type may implement Copy, skip the error.
+                // It's an error with the Copy implementation (e.g. duplicate Copy) rather than borrow check
+                self.dcx().span_delayed_bug(
+                    span,
+                    "Type may implement copy, but there is no other error.",
+                );
+                return;
+            }
             (
                 match kind {
                     &IllegalMoveOriginKind::BorrowedContent { target_place } => self
@@ -291,6 +301,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
         self.buffer_error(err);
     }
 
+    fn has_ambiguous_copy(&mut self, ty: Ty<'tcx>) -> bool {
+        let Some(copy_trait_def) = self.infcx.tcx.lang_items().copy_trait() else { return false };
+        // This is only going to be ambiguous if there are incoherent impls, because otherwise
+        // ambiguity should never happen in MIR.
+        self.infcx.type_implements_trait(copy_trait_def, [ty], self.param_env).may_apply()
+    }
+
     fn report_cannot_move_from_static(&mut self, place: Place<'tcx>, span: Span) -> Diag<'infcx> {
         let description = if place.projection.len() == 1 {
             format!("static item {}", self.describe_any_place(place.as_ref()))
diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl
index 2bc5adb2dce..826e34930ea 100644
--- a/compiler/rustc_const_eval/messages.ftl
+++ b/compiler/rustc_const_eval/messages.ftl
@@ -399,7 +399,7 @@ const_eval_uninhabited_enum_variant_written =
 const_eval_unmarked_const_fn_exposed = `{$def_path}` cannot be (indirectly) exposed to stable
     .help = either mark the callee as `#[rustc_const_stable_indirect]`, or the caller as `#[rustc_const_unstable]`
 const_eval_unmarked_intrinsic_exposed = intrinsic `{$def_path}` cannot be (indirectly) exposed to stable
-    .help = mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_indirect]` (but this requires team approval)
+    .help = mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval)
 
 const_eval_unreachable = entering unreachable code
 const_eval_unreachable_unwind =
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs
index 8cb7e02036f..aea3d5bd3e7 100644
--- a/compiler/rustc_const_eval/src/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/check_consts/check.rs
@@ -736,16 +736,25 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
 
                 // Intrinsics are language primitives, not regular calls, so treat them separately.
                 if let Some(intrinsic) = tcx.intrinsic(callee) {
+                    // We use `intrinsic.const_stable` to determine if this can be safely exposed to
+                    // stable code, rather than `const_stable_indirect`. This is to make
+                    // `#[rustc_const_stable_indirect]` an attribute that is always safe to add.
+                    // We also ask is_safe_to_expose_on_stable_const_fn; this determines whether the intrinsic
+                    // fallback body is safe to expose on stable.
+                    let is_const_stable = intrinsic.const_stable
+                        || (!intrinsic.must_be_overridden
+                            && tcx.is_const_fn(callee)
+                            && is_safe_to_expose_on_stable_const_fn(tcx, callee));
                     match tcx.lookup_const_stability(callee) {
                         None => {
                             // Non-const intrinsic.
                             self.check_op(ops::IntrinsicNonConst { name: intrinsic.name });
                         }
-                        Some(ConstStability { feature: None, const_stable_indirect, .. }) => {
+                        Some(ConstStability { feature: None, .. }) => {
                             // Intrinsic does not need a separate feature gate (we rely on the
                             // regular stability checker). However, we have to worry about recursive
                             // const stability.
-                            if !const_stable_indirect && self.enforce_recursive_const_stability() {
+                            if !is_const_stable && self.enforce_recursive_const_stability() {
                                 self.dcx().emit_err(errors::UnmarkedIntrinsicExposed {
                                     span: self.span,
                                     def_path: self.tcx.def_path_str(callee),
@@ -755,17 +764,19 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
                         Some(ConstStability {
                             feature: Some(feature),
                             level: StabilityLevel::Unstable { .. },
-                            const_stable_indirect,
                             ..
                         }) => {
                             self.check_op(ops::IntrinsicUnstable {
                                 name: intrinsic.name,
                                 feature,
-                                const_stable_indirect,
+                                const_stable: is_const_stable,
                             });
                         }
                         Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => {
-                            // All good.
+                            // All good. Note that a `#[rustc_const_stable]` intrinsic (meaning it
+                            // can be *directly* invoked from stable const code) does not always
+                            // have the `#[rustc_const_stable_intrinsic]` attribute (which controls
+                            // exposing an intrinsic indirectly); we accept this call anyway.
                         }
                     }
                     // This completes the checks for intrinsics.
diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs
index d264cab1511..2931159842f 100644
--- a/compiler/rustc_const_eval/src/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/check_consts/ops.rs
@@ -354,14 +354,14 @@ impl<'tcx> NonConstOp<'tcx> for IntrinsicNonConst {
 pub(crate) struct IntrinsicUnstable {
     pub name: Symbol,
     pub feature: Symbol,
-    pub const_stable_indirect: bool,
+    pub const_stable: bool,
 }
 
 impl<'tcx> NonConstOp<'tcx> for IntrinsicUnstable {
     fn status_in_item(&self, _ccx: &ConstCx<'_, 'tcx>) -> Status {
         Status::Unstable {
             gate: self.feature,
-            safe_to_expose_on_stable: self.const_stable_indirect,
+            safe_to_expose_on_stable: self.const_stable,
             // We do *not* want to suggest to mark the intrinsic as `const_stable_indirect`,
             // that's not a trivial change!
             is_function_call: false,
diff --git a/compiler/rustc_const_eval/src/const_eval/fn_queries.rs b/compiler/rustc_const_eval/src/const_eval/fn_queries.rs
index 037fdcbcf9b..beff0cd99fc 100644
--- a/compiler/rustc_const_eval/src/const_eval/fn_queries.rs
+++ b/compiler/rustc_const_eval/src/const_eval/fn_queries.rs
@@ -25,15 +25,9 @@ fn constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::Constness {
             hir::Constness::Const
         }
         hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(impl_), .. }) => impl_.constness,
-        hir::Node::ForeignItem(hir::ForeignItem { kind: hir::ForeignItemKind::Fn(..), .. }) => {
-            // Intrinsics use `rustc_const_{un,}stable` attributes to indicate constness. All other
-            // foreign items cannot be evaluated at compile-time.
-            let is_const = if tcx.intrinsic(def_id).is_some() {
-                tcx.lookup_const_stability(def_id).is_some()
-            } else {
-                false
-            };
-            if is_const { hir::Constness::Const } else { hir::Constness::NotConst }
+        hir::Node::ForeignItem(_) => {
+            // Foreign items cannot be evaluated at compile-time.
+            hir::Constness::NotConst
         }
         hir::Node::Expr(e) if let hir::ExprKind::Closure(c) = e.kind => c.constness,
         _ => {
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index 0069b07ad62..cc0bdec7019 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -837,6 +837,10 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
         rustc_const_stable_indirect, Normal,
         template!(Word), WarnFollowing, EncodeCrossCrate::No, IMPL_DETAIL,
     ),
+    rustc_attr!(
+        rustc_const_stable_intrinsic, Normal,
+        template!(Word), WarnFollowing, EncodeCrossCrate::No, IMPL_DETAIL,
+    ),
     gated!(
         rustc_allow_const_fn_unstable, Normal,
         template!(Word, List: "feat1, feat2, ..."), DuplicatesOk, EncodeCrossCrate::No,
diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index 38b11aa4017..6e8ba51612e 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -311,8 +311,8 @@ hir_analysis_missing_trait_item_suggestion = implement the missing item: `{$snip
 
 hir_analysis_missing_trait_item_unstable = not all trait items implemented, missing: `{$missing_item_name}`
     .note = default implementation of `{$missing_item_name}` is unstable
-    .some_note = use of unstable library feature '{$feature}': {$reason}
-    .none_note = use of unstable library feature '{$feature}'
+    .some_note = use of unstable library feature `{$feature}`: {$reason}
+    .none_note = use of unstable library feature `{$feature}`
 
 hir_analysis_missing_type_params =
     the type {$parameterCount ->
diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs
index 84161ec7648..816761fd00f 100644
--- a/compiler/rustc_hir_analysis/src/collect/type_of.rs
+++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs
@@ -175,19 +175,13 @@ fn const_arg_anon_type_of<'tcx>(tcx: TyCtxt<'tcx>, arg_hir_id: HirId, span: Span
         // arm would handle this.
         //
         // I believe this match arm is only needed for GAT but I am not 100% sure - BoxyUwU
-        Node::Ty(hir_ty @ hir::Ty { kind: TyKind::Path(QPath::TypeRelative(_, segment)), .. }) => {
+        Node::Ty(hir_ty @ hir::Ty { kind: TyKind::Path(QPath::TypeRelative(ty, segment)), .. }) => {
             // Find the Item containing the associated type so we can create an ItemCtxt.
             // Using the ItemCtxt lower the HIR for the unresolved assoc type into a
             // ty which is a fully resolved projection.
             // For the code example above, this would mean lowering `Self::Assoc<3>`
             // to a ty::Alias(ty::Projection, `<Self as Foo>::Assoc<3>`).
-            let item_def_id = tcx
-                .hir()
-                .parent_owner_iter(arg_hir_id)
-                .find(|(_, node)| matches!(node, OwnerNode::Item(_)))
-                .unwrap()
-                .0
-                .def_id;
+            let item_def_id = tcx.hir().get_parent_item(ty.hir_id).def_id;
             let ty = ItemCtxt::new(tcx, item_def_id).lower_ty(hir_ty);
 
             // Iterate through the generics of the projection to find the one that corresponds to
diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs
index 03590b6a455..2a8ed26aa2b 100644
--- a/compiler/rustc_hir_typeck/src/pat.rs
+++ b/compiler/rustc_hir_typeck/src/pat.rs
@@ -2071,6 +2071,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 s = pluralize!(len),
                 them = if len == 1 { "it" } else { "them" },
             ),
+            format!(
+                "{}{}{}{}",
+                prefix,
+                unmentioned_fields
+                    .iter()
+                    .map(|(_, name)| {
+                        let field_name = name.to_string();
+                        format!("{field_name}: _")
+                    })
+                    .collect::<Vec<_>>()
+                    .join(", "),
+                if have_inaccessible_fields { ", .." } else { "" },
+                postfix,
+            ),
+            Applicability::MachineApplicable,
+        );
+        err.span_suggestion(
+            sp,
+            "or always ignore missing fields here",
             format!("{prefix}..{postfix}"),
             Applicability::MachineApplicable,
         );
diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs
index c0688aff183..e6b36299d7f 100644
--- a/compiler/rustc_middle/src/middle/stability.rs
+++ b/compiler/rustc_middle/src/middle/stability.rs
@@ -112,8 +112,8 @@ pub fn report_unstable(
     soft_handler: impl FnOnce(&'static Lint, Span, String),
 ) {
     let msg = match reason {
-        Some(r) => format!("use of unstable library feature '{feature}': {r}"),
-        None => format!("use of unstable library feature '{feature}'"),
+        Some(r) => format!("use of unstable library feature `{feature}`: {r}"),
+        None => format!("use of unstable library feature `{feature}`"),
     };
 
     if is_soft {
diff --git a/compiler/rustc_middle/src/ty/intrinsic.rs b/compiler/rustc_middle/src/ty/intrinsic.rs
index ed0fb37d3b8..6a3ddacb424 100644
--- a/compiler/rustc_middle/src/ty/intrinsic.rs
+++ b/compiler/rustc_middle/src/ty/intrinsic.rs
@@ -9,6 +9,8 @@ pub struct IntrinsicDef {
     pub name: Symbol,
     /// Whether the intrinsic has no meaningful body and all backends need to shim all calls to it.
     pub must_be_overridden: bool,
+    /// Whether the intrinsic can be invoked from stable const fn
+    pub const_stable: bool,
 }
 
 impl TyCtxt<'_> {
diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs
index 83276808a28..6ffd149ef14 100644
--- a/compiler/rustc_middle/src/ty/util.rs
+++ b/compiler/rustc_middle/src/ty/util.rs
@@ -1789,6 +1789,7 @@ pub fn intrinsic_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::Intrinsi
         Some(ty::IntrinsicDef {
             name: tcx.item_name(def_id.into()),
             must_be_overridden: tcx.has_attr(def_id, sym::rustc_intrinsic_must_be_overridden),
+            const_stable: tcx.has_attr(def_id, sym::rustc_const_stable_intrinsic),
         })
     } else {
         None
diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs
index 8bd615e6d79..c85d0bd05cb 100644
--- a/compiler/rustc_parse/src/parser/attr_wrapper.rs
+++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs
@@ -136,8 +136,9 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl {
                 node_replacements.array_windows()
             {
                 assert!(
-                    node_range.0.end <= next_node_range.0.start,
-                    "Node ranges should be disjoint: ({:?}, {:?}) ({:?}, {:?})",
+                    node_range.0.end <= next_node_range.0.start
+                        || node_range.0.end >= next_node_range.0.end,
+                    "Node ranges should be disjoint or nested: ({:?}, {:?}) ({:?}, {:?})",
                     node_range,
                     tokens,
                     next_node_range,
@@ -145,8 +146,20 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl {
                 );
             }
 
-            // Process the replace ranges.
-            for (node_range, target) in node_replacements.into_iter() {
+            // Process the replace ranges, starting from the highest start
+            // position and working our way back. If have tokens like:
+            //
+            // `#[cfg(FALSE)] struct Foo { #[cfg(FALSE)] field: bool }`
+            //
+            // Then we will generate replace ranges for both
+            // the `#[cfg(FALSE)] field: bool` and the entire
+            // `#[cfg(FALSE)] struct Foo { #[cfg(FALSE)] field: bool }`
+            //
+            // By starting processing from the replace range with the greatest
+            // start position, we ensure that any (outer) replace range which
+            // encloses another (inner) replace range will fully overwrite the
+            // inner range's replacement.
+            for (node_range, target) in node_replacements.into_iter().rev() {
                 assert!(
                     !node_range.0.is_empty(),
                     "Cannot replace an empty node range: {:?}",
@@ -383,9 +396,10 @@ impl<'a> Parser<'a> {
             // from `ParserRange` form to `NodeRange` form. We will perform the actual
             // replacement only when we convert the `LazyAttrTokenStream` to an
             // `AttrTokenStream`.
-            self.capture_state
-                .parser_replacements
-                .drain(parser_replacements_start..parser_replacements_end)
+            self.capture_state.parser_replacements
+                [parser_replacements_start..parser_replacements_end]
+                .iter()
+                .cloned()
                 .chain(inner_attr_parser_replacements)
                 .map(|(parser_range, data)| {
                     (NodeRange::new(parser_range, collect_pos.start_pos), data)
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index 737e163efce..cd47c8ece60 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -106,7 +106,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
         def_id: LocalDefId,
         item_sp: Span,
         fn_sig: Option<&'tcx hir::FnSig<'tcx>>,
-        is_foreign_item: bool,
         kind: AnnotationKind,
         inherit_deprecation: InheritDeprecation,
         inherit_const_stability: InheritConstStability,
@@ -175,11 +174,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
         // implied), check if the function/method is const or the parent impl block is const.
         if let Some(fn_sig) = fn_sig
             && !fn_sig.header.is_const()
-            // We have to exclude foreign items as they might be intrinsics. Sadly we can't check
-            // their ABI; `fn_sig.abi` is *not* correct for foreign functions.
-            && !is_foreign_item
             && const_stab.is_some()
-            && (!self.in_trait_impl || !self.tcx.is_const_fn(def_id.to_def_id()))
         {
             self.tcx.dcx().emit_err(errors::MissingConstErr { fn_sig_span: fn_sig.span });
         }
@@ -398,7 +393,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
                         ctor_def_id,
                         i.span,
                         None,
-                        /* is_foreign_item */ false,
                         AnnotationKind::Required,
                         InheritDeprecation::Yes,
                         InheritConstStability::No,
@@ -417,7 +411,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
             i.owner_id.def_id,
             i.span,
             fn_sig,
-            /* is_foreign_item */ false,
             kind,
             InheritDeprecation::Yes,
             const_stab_inherit,
@@ -437,7 +430,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
             ti.owner_id.def_id,
             ti.span,
             fn_sig,
-            /* is_foreign_item */ false,
             AnnotationKind::Required,
             InheritDeprecation::Yes,
             InheritConstStability::No,
@@ -461,7 +453,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
             ii.owner_id.def_id,
             ii.span,
             fn_sig,
-            /* is_foreign_item */ false,
             kind,
             InheritDeprecation::Yes,
             InheritConstStability::No,
@@ -477,7 +468,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
             var.def_id,
             var.span,
             None,
-            /* is_foreign_item */ false,
             AnnotationKind::Required,
             InheritDeprecation::Yes,
             InheritConstStability::No,
@@ -488,7 +478,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
                         ctor_def_id,
                         var.span,
                         None,
-                        /* is_foreign_item */ false,
                         AnnotationKind::Required,
                         InheritDeprecation::Yes,
                         InheritConstStability::No,
@@ -507,7 +496,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
             s.def_id,
             s.span,
             None,
-            /* is_foreign_item */ false,
             AnnotationKind::Required,
             InheritDeprecation::Yes,
             InheritConstStability::No,
@@ -527,7 +515,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
             i.owner_id.def_id,
             i.span,
             fn_sig,
-            /* is_foreign_item */ true,
             AnnotationKind::Required,
             InheritDeprecation::Yes,
             InheritConstStability::No,
@@ -550,7 +537,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
             p.def_id,
             p.span,
             None,
-            /* is_foreign_item */ false,
             kind,
             InheritDeprecation::No,
             InheritConstStability::No,
@@ -712,7 +698,6 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
             CRATE_DEF_ID,
             tcx.hir().span(CRATE_HIR_ID),
             None,
-            /* is_foreign_item */ false,
             AnnotationKind::Required,
             InheritDeprecation::Yes,
             InheritConstStability::No,
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index bb730592068..9f8b76d4c57 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -2466,6 +2466,10 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
         early_dcx.early_fatal("value for threads must be a positive non-zero integer");
     }
 
+    if unstable_opts.threads == parse::MAX_THREADS_CAP {
+        early_dcx.early_warn(format!("number of threads was capped at {}", parse::MAX_THREADS_CAP));
+    }
+
     let fuel = unstable_opts.fuel.is_some() || unstable_opts.print_fuel.is_some();
     if fuel && unstable_opts.threads > 1 {
         early_dcx.early_fatal("optimization fuel is incompatible with multiple threads");
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index ca67e0a68a9..c12306d0269 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -457,10 +457,11 @@ mod desc {
         "either a boolean (`yes`, `no`, `on`, `off`, etc), or `nll` (default: `nll`)";
 }
 
-mod parse {
+pub mod parse {
     use std::str::FromStr;
 
     pub(crate) use super::*;
+    pub(crate) const MAX_THREADS_CAP: usize = 256;
 
     /// This is for boolean options that don't take a value and start with
     /// `no-`. This style of option is deprecated.
@@ -657,7 +658,7 @@ mod parse {
     }
 
     pub(crate) fn parse_threads(slot: &mut usize, v: Option<&str>) -> bool {
-        match v.and_then(|s| s.parse().ok()) {
+        let ret = match v.and_then(|s| s.parse().ok()) {
             Some(0) => {
                 *slot = std::thread::available_parallelism().map_or(1, NonZero::<usize>::get);
                 true
@@ -667,7 +668,11 @@ mod parse {
                 true
             }
             None => false,
-        }
+        };
+        // We want to cap the number of threads here to avoid large numbers like 999999 and compiler panics.
+        // This solution was suggested here https://github.com/rust-lang/rust/issues/117638#issuecomment-1800925067
+        *slot = slot.clone().min(MAX_THREADS_CAP);
+        ret
     }
 
     /// Use this for any numeric option that has a static default.
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index fac2180d63b..21a74bd4020 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -1663,6 +1663,7 @@ symbols! {
         rustc_const_panic_str,
         rustc_const_stable,
         rustc_const_stable_indirect,
+        rustc_const_stable_intrinsic,
         rustc_const_unstable,
         rustc_conversion_suggestion,
         rustc_deallocator,
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
index f5cd99222e3..a1c97a38567 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
@@ -471,6 +471,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
                         }
 
                         self.try_to_add_help_message(
+                            &root_obligation,
                             &obligation,
                             leaf_trait_predicate,
                             &mut err,
@@ -2488,6 +2489,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
 
     fn try_to_add_help_message(
         &self,
+        root_obligation: &PredicateObligation<'tcx>,
         obligation: &PredicateObligation<'tcx>,
         trait_predicate: ty::PolyTraitPredicate<'tcx>,
         err: &mut Diag<'_>,
@@ -2575,6 +2577,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
                 impl_candidates.as_slice(),
                 span,
             );
+
+            self.suggest_tuple_wrapping(err, root_obligation, obligation);
         }
     }
 
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
index e155effa1e3..86fd4c230f6 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
@@ -4452,6 +4452,41 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
         }
     }
 
+    /// If the type failed selection but the trait is implemented for `(T,)`, suggest that the user
+    /// creates a unary tuple
+    ///
+    /// This is a common gotcha when using libraries that emulate variadic functions with traits for tuples.
+    pub(super) fn suggest_tuple_wrapping(
+        &self,
+        err: &mut Diag<'_>,
+        root_obligation: &PredicateObligation<'tcx>,
+        obligation: &PredicateObligation<'tcx>,
+    ) {
+        let ObligationCauseCode::FunctionArg { arg_hir_id, .. } = obligation.cause.code() else {
+            return;
+        };
+
+        let Some(root_pred) = root_obligation.predicate.as_trait_clause() else { return };
+
+        let trait_ref = root_pred.map_bound(|root_pred| {
+            root_pred
+                .trait_ref
+                .with_self_ty(self.tcx, Ty::new_tup(self.tcx, &[root_pred.trait_ref.self_ty()]))
+        });
+
+        let obligation =
+            Obligation::new(self.tcx, obligation.cause.clone(), obligation.param_env, trait_ref);
+
+        if self.predicate_must_hold_modulo_regions(&obligation) {
+            let arg_span = self.tcx.hir().span(*arg_hir_id);
+            err.multipart_suggestion_verbose(
+                format!("use a unary tuple instead"),
+                vec![(arg_span.shrink_to_lo(), "(".into()), (arg_span.shrink_to_hi(), ",)".into())],
+                Applicability::MaybeIncorrect,
+            );
+        }
+    }
+
     pub(super) fn explain_hrtb_projection(
         &self,
         diag: &mut Diag<'_>,
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
index e7d3004aa20..4e1366326fd 100644
--- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
@@ -951,18 +951,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 });
 
                 // We must additionally check that the return type impls `Future`.
-
-                // FIXME(async_closures): Investigate this before stabilization.
-                // We instantiate this binder eagerly because the `confirm_future_candidate`
-                // method doesn't support higher-ranked futures, which the `AsyncFn`
-                // traits expressly allow the user to write. To fix this correctly,
-                // we'd need to instantiate trait bounds before we get to selection,
-                // like the new trait solver does.
                 let future_trait_def_id = tcx.require_lang_item(LangItem::Future, None);
-                let placeholder_output_ty = self.infcx.enter_forall_and_leak_universe(sig.output());
                 nested.push(obligation.with(
                     tcx,
-                    ty::TraitRef::new(tcx, future_trait_def_id, [placeholder_output_ty]),
+                    sig.output().map_bound(|output_ty| {
+                        ty::TraitRef::new(tcx, future_trait_def_id, [output_ty])
+                    }),
                 ));
 
                 (trait_ref, Ty::from_closure_kind(tcx, ty::ClosureKind::Fn))
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index fc09da7bcbc..c0d4a1eb34d 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -8,16 +8,16 @@
 //! Note: any changes to the constness of intrinsics should be discussed with the language team.
 //! This includes changes in the stability of the constness.
 //!
-//! In order to make an intrinsic usable at compile-time, one needs to copy the implementation
-//! from <https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics> to
-//! <https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs> and add a
-//! `#[rustc_const_unstable(feature = "const_such_and_such", issue = "01234")]` to the intrinsic declaration.
+//! In order to make an intrinsic usable at compile-time, it needs to be declared in the "new"
+//! style, i.e. as a `#[rustc_intrinsic]` function, not inside an `extern` block. Then copy the
+//! implementation from <https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics> to
+//! <https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs>
+//! and make the intrinsic declaration a `const fn`.
 //!
 //! If an intrinsic is supposed to be used from a `const fn` with a `rustc_const_stable` attribute,
-//! `#[rustc_const_stable_indirect]` needs to be added to the intrinsic (`#[rustc_const_unstable]`
-//! can be removed then). Such a change should not be done without T-lang consultation, because it
-//! may bake a feature into the language that cannot be replicated in user code without compiler
-//! support.
+//! `#[rustc_const_stable_intrinsic]` needs to be added to the intrinsic. Such a change requires
+//! T-lang approval, because it may bake a feature into the language that cannot be replicated in
+//! user code without compiler support.
 //!
 //! # Volatiles
 //!
@@ -936,21 +936,31 @@ extern "rust-intrinsic" {
     #[rustc_nounwind]
     pub fn abort() -> !;
 
-    /// Informs the optimizer that this point in the code is not reachable,
-    /// enabling further optimizations.
-    ///
-    /// N.B., this is very different from the `unreachable!()` macro: Unlike the
-    /// macro, which panics when it is executed, it is *undefined behavior* to
-    /// reach code marked with this function.
+    /// Executes a breakpoint trap, for inspection by a debugger.
     ///
-    /// The stabilized version of this intrinsic is [`core::hint::unreachable_unchecked`].
-    #[cfg_attr(
-        bootstrap,
-        rustc_const_stable(feature = "const_unreachable_unchecked", since = "1.57.0")
-    )]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
+    /// This intrinsic does not have a stable counterpart.
     #[rustc_nounwind]
-    pub fn unreachable() -> !;
+    pub fn breakpoint();
+}
+
+/// Informs the optimizer that this point in the code is not reachable,
+/// enabling further optimizations.
+///
+/// N.B., this is very different from the `unreachable!()` macro: Unlike the
+/// macro, which panics when it is executed, it is *undefined behavior* to
+/// reach code marked with this function.
+///
+/// The stabilized version of this intrinsic is [`core::hint::unreachable_unchecked`].
+#[cfg_attr(
+    bootstrap,
+    rustc_const_stable(feature = "const_unreachable_unchecked", since = "1.57.0")
+)]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn unreachable() -> ! {
+    unreachable!()
 }
 
 /// Informs the optimizer that a condition is always true.
@@ -964,7 +974,7 @@ extern "rust-intrinsic" {
 ///
 /// The stabilized version of this intrinsic is [`core::hint::assert_unchecked`].
 #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_assume", since = "1.77.0"))]
-#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
 #[rustc_intrinsic]
@@ -990,7 +1000,7 @@ pub const unsafe fn assume(b: bool) {
     bootstrap,
     rustc_const_stable(feature = "const_likely", since = "CURRENT_RUSTC_VERSION")
 )]
-#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
 #[unstable(feature = "core_intrinsics", issue = "none")]
 #[rustc_intrinsic]
 #[rustc_nounwind]
@@ -1014,7 +1024,7 @@ pub const fn likely(b: bool) -> bool {
     bootstrap,
     rustc_const_stable(feature = "const_likely", since = "CURRENT_RUSTC_VERSION")
 )]
-#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
 #[unstable(feature = "core_intrinsics", issue = "none")]
 #[rustc_intrinsic]
 #[rustc_nounwind]
@@ -1044,437 +1054,465 @@ pub fn select_unpredictable<T>(b: bool, true_val: T, false_val: T) -> T {
     if b { true_val } else { false_val }
 }
 
-extern "rust-intrinsic" {
-    /// Executes a breakpoint trap, for inspection by a debugger.
-    ///
-    /// This intrinsic does not have a stable counterpart.
-    #[rustc_nounwind]
-    pub fn breakpoint();
+/// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
+/// This will statically either panic, or do nothing.
+///
+/// This intrinsic does not have a stable counterpart.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_assert_type", since = "1.59.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn assert_inhabited<T>() {
+    unreachable!()
+}
 
-    /// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
-    /// This will statically either panic, or do nothing.
-    ///
-    /// This intrinsic does not have a stable counterpart.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_assert_type", since = "1.59.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn assert_inhabited<T>();
+/// A guard for unsafe functions that cannot ever be executed if `T` does not permit
+/// zero-initialization: This will statically either panic, or do nothing.
+///
+/// This intrinsic does not have a stable counterpart.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_assert_type2", since = "1.75.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn assert_zero_valid<T>() {
+    unreachable!()
+}
 
-    /// A guard for unsafe functions that cannot ever be executed if `T` does not permit
-    /// zero-initialization: This will statically either panic, or do nothing.
-    ///
-    /// This intrinsic does not have a stable counterpart.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_assert_type2", since = "1.75.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn assert_zero_valid<T>();
+/// A guard for `std::mem::uninitialized`. This will statically either panic, or do nothing.
+///
+/// This intrinsic does not have a stable counterpart.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_assert_type2", since = "1.75.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn assert_mem_uninitialized_valid<T>() {
+    unreachable!()
+}
 
-    /// A guard for `std::mem::uninitialized`. This will statically either panic, or do nothing.
-    ///
-    /// This intrinsic does not have a stable counterpart.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_assert_type2", since = "1.75.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn assert_mem_uninitialized_valid<T>();
+/// Gets a reference to a static `Location` indicating where it was called.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// Consider using [`core::panic::Location::caller`] instead.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_caller_location", since = "1.79.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn caller_location() -> &'static crate::panic::Location<'static> {
+    unreachable!()
+}
 
-    /// Gets a reference to a static `Location` indicating where it was called.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// Consider using [`core::panic::Location::caller`] instead.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_caller_location", since = "1.79.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn caller_location() -> &'static crate::panic::Location<'static>;
+/// Moves a value out of scope without running drop glue.
+///
+/// This exists solely for [`crate::mem::forget_unsized`]; normal `forget` uses
+/// `ManuallyDrop` instead.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_intrinsic_forget", since = "1.83.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn forget<T: ?Sized>(_: T) {
+    unreachable!()
+}
 
-    /// Moves a value out of scope without running drop glue.
-    ///
-    /// This exists solely for [`crate::mem::forget_unsized`]; normal `forget` uses
-    /// `ManuallyDrop` instead.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_intrinsic_forget", since = "1.83.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn forget<T: ?Sized>(_: T);
-
-    /// Reinterprets the bits of a value of one type as another type.
-    ///
-    /// Both types must have the same size. Compilation will fail if this is not guaranteed.
-    ///
-    /// `transmute` is semantically equivalent to a bitwise move of one type
-    /// into another. It copies the bits from the source value into the
-    /// destination value, then forgets the original. Note that source and destination
-    /// are passed by-value, which means if `Src` or `Dst` contain padding, that padding
-    /// is *not* guaranteed to be preserved by `transmute`.
-    ///
-    /// Both the argument and the result must be [valid](../../nomicon/what-unsafe-does.html) at
-    /// their given type. Violating this condition leads to [undefined behavior][ub]. The compiler
-    /// will generate code *assuming that you, the programmer, ensure that there will never be
-    /// undefined behavior*. It is therefore your responsibility to guarantee that every value
-    /// passed to `transmute` is valid at both types `Src` and `Dst`. Failing to uphold this condition
-    /// may lead to unexpected and unstable compilation results. This makes `transmute` **incredibly
-    /// unsafe**. `transmute` should be the absolute last resort.
-    ///
-    /// Because `transmute` is a by-value operation, alignment of the *transmuted values
-    /// themselves* is not a concern. As with any other function, the compiler already ensures
-    /// both `Src` and `Dst` are properly aligned. However, when transmuting values that *point
-    /// elsewhere* (such as pointers, references, boxes…), the caller has to ensure proper
-    /// alignment of the pointed-to values.
-    ///
-    /// The [nomicon](../../nomicon/transmutes.html) has additional documentation.
-    ///
-    /// [ub]: ../../reference/behavior-considered-undefined.html
-    ///
-    /// # Transmutation between pointers and integers
-    ///
-    /// Special care has to be taken when transmuting between pointers and integers, e.g.
-    /// transmuting between `*const ()` and `usize`.
-    ///
-    /// Transmuting *pointers to integers* in a `const` context is [undefined behavior][ub], unless
-    /// the pointer was originally created *from* an integer. (That includes this function
-    /// specifically, integer-to-pointer casts, and helpers like [`dangling`][crate::ptr::dangling],
-    /// but also semantically-equivalent conversions such as punning through `repr(C)` union
-    /// fields.) Any attempt to use the resulting value for integer operations will abort
-    /// const-evaluation. (And even outside `const`, such transmutation is touching on many
-    /// unspecified aspects of the Rust memory model and should be avoided. See below for
-    /// alternatives.)
-    ///
-    /// Transmuting *integers to pointers* is a largely unspecified operation. It is likely *not*
-    /// equivalent to an `as` cast. Doing non-zero-sized memory accesses with a pointer constructed
-    /// this way is currently considered undefined behavior.
-    ///
-    /// All this also applies when the integer is nested inside an array, tuple, struct, or enum.
-    /// However, `MaybeUninit<usize>` is not considered an integer type for the purpose of this
-    /// section. Transmuting `*const ()` to `MaybeUninit<usize>` is fine---but then calling
-    /// `assume_init()` on that result is considered as completing the pointer-to-integer transmute
-    /// and thus runs into the issues discussed above.
-    ///
-    /// In particular, doing a pointer-to-integer-to-pointer roundtrip via `transmute` is *not* a
-    /// lossless process. If you want to round-trip a pointer through an integer in a way that you
-    /// can get back the original pointer, you need to use `as` casts, or replace the integer type
-    /// by `MaybeUninit<$int>` (and never call `assume_init()`). If you are looking for a way to
-    /// store data of arbitrary type, also use `MaybeUninit<T>` (that will also handle uninitialized
-    /// memory due to padding). If you specifically need to store something that is "either an
-    /// integer or a pointer", use `*mut ()`: integers can be converted to pointers and back without
-    /// any loss (via `as` casts or via `transmute`).
-    ///
-    /// # Examples
-    ///
-    /// There are a few things that `transmute` is really useful for.
-    ///
-    /// Turning a pointer into a function pointer. This is *not* portable to
-    /// machines where function pointers and data pointers have different sizes.
-    ///
-    /// ```
-    /// fn foo() -> i32 {
-    ///     0
-    /// }
-    /// // Crucially, we `as`-cast to a raw pointer before `transmute`ing to a function pointer.
-    /// // This avoids an integer-to-pointer `transmute`, which can be problematic.
-    /// // Transmuting between raw pointers and function pointers (i.e., two pointer types) is fine.
-    /// let pointer = foo as *const ();
-    /// let function = unsafe {
-    ///     std::mem::transmute::<*const (), fn() -> i32>(pointer)
-    /// };
-    /// assert_eq!(function(), 0);
-    /// ```
-    ///
-    /// Extending a lifetime, or shortening an invariant lifetime. This is
-    /// advanced, very unsafe Rust!
-    ///
-    /// ```
-    /// struct R<'a>(&'a i32);
-    /// unsafe fn extend_lifetime<'b>(r: R<'b>) -> R<'static> {
-    ///     std::mem::transmute::<R<'b>, R<'static>>(r)
-    /// }
-    ///
-    /// unsafe fn shorten_invariant_lifetime<'b, 'c>(r: &'b mut R<'static>)
-    ///                                              -> &'b mut R<'c> {
-    ///     std::mem::transmute::<&'b mut R<'static>, &'b mut R<'c>>(r)
-    /// }
-    /// ```
-    ///
-    /// # Alternatives
-    ///
-    /// Don't despair: many uses of `transmute` can be achieved through other means.
-    /// Below are common applications of `transmute` which can be replaced with safer
-    /// constructs.
-    ///
-    /// Turning raw bytes (`[u8; SZ]`) into `u32`, `f64`, etc.:
-    ///
-    /// ```
-    /// let raw_bytes = [0x78, 0x56, 0x34, 0x12];
-    ///
-    /// let num = unsafe {
-    ///     std::mem::transmute::<[u8; 4], u32>(raw_bytes)
-    /// };
-    ///
-    /// // use `u32::from_ne_bytes` instead
-    /// let num = u32::from_ne_bytes(raw_bytes);
-    /// // or use `u32::from_le_bytes` or `u32::from_be_bytes` to specify the endianness
-    /// let num = u32::from_le_bytes(raw_bytes);
-    /// assert_eq!(num, 0x12345678);
-    /// let num = u32::from_be_bytes(raw_bytes);
-    /// assert_eq!(num, 0x78563412);
-    /// ```
-    ///
-    /// Turning a pointer into a `usize`:
-    ///
-    /// ```no_run
-    /// let ptr = &0;
-    /// let ptr_num_transmute = unsafe {
-    ///     std::mem::transmute::<&i32, usize>(ptr)
-    /// };
-    ///
-    /// // Use an `as` cast instead
-    /// let ptr_num_cast = ptr as *const i32 as usize;
-    /// ```
-    ///
-    /// Note that using `transmute` to turn a pointer to a `usize` is (as noted above) [undefined
-    /// behavior][ub] in `const` contexts. Also outside of consts, this operation might not behave
-    /// as expected -- this is touching on many unspecified aspects of the Rust memory model.
-    /// Depending on what the code is doing, the following alternatives are preferable to
-    /// pointer-to-integer transmutation:
-    /// - If the code just wants to store data of arbitrary type in some buffer and needs to pick a
-    ///   type for that buffer, it can use [`MaybeUninit`][crate::mem::MaybeUninit].
-    /// - If the code actually wants to work on the address the pointer points to, it can use `as`
-    ///   casts or [`ptr.addr()`][pointer::addr].
-    ///
-    /// Turning a `*mut T` into a `&mut T`:
-    ///
-    /// ```
-    /// let ptr: *mut i32 = &mut 0;
-    /// let ref_transmuted = unsafe {
-    ///     std::mem::transmute::<*mut i32, &mut i32>(ptr)
-    /// };
-    ///
-    /// // Use a reborrow instead
-    /// let ref_casted = unsafe { &mut *ptr };
-    /// ```
-    ///
-    /// Turning a `&mut T` into a `&mut U`:
-    ///
-    /// ```
-    /// let ptr = &mut 0;
-    /// let val_transmuted = unsafe {
-    ///     std::mem::transmute::<&mut i32, &mut u32>(ptr)
-    /// };
-    ///
-    /// // Now, put together `as` and reborrowing - note the chaining of `as`
-    /// // `as` is not transitive
-    /// let val_casts = unsafe { &mut *(ptr as *mut i32 as *mut u32) };
-    /// ```
-    ///
-    /// Turning a `&str` into a `&[u8]`:
-    ///
-    /// ```
-    /// // this is not a good way to do this.
-    /// let slice = unsafe { std::mem::transmute::<&str, &[u8]>("Rust") };
-    /// assert_eq!(slice, &[82, 117, 115, 116]);
-    ///
-    /// // You could use `str::as_bytes`
-    /// let slice = "Rust".as_bytes();
-    /// assert_eq!(slice, &[82, 117, 115, 116]);
-    ///
-    /// // Or, just use a byte string, if you have control over the string
-    /// // literal
-    /// assert_eq!(b"Rust", &[82, 117, 115, 116]);
-    /// ```
-    ///
-    /// Turning a `Vec<&T>` into a `Vec<Option<&T>>`.
-    ///
-    /// To transmute the inner type of the contents of a container, you must make sure to not
-    /// violate any of the container's invariants. For `Vec`, this means that both the size
-    /// *and alignment* of the inner types have to match. Other containers might rely on the
-    /// size of the type, alignment, or even the `TypeId`, in which case transmuting wouldn't
-    /// be possible at all without violating the container invariants.
-    ///
-    /// ```
-    /// let store = [0, 1, 2, 3];
-    /// let v_orig = store.iter().collect::<Vec<&i32>>();
-    ///
-    /// // clone the vector as we will reuse them later
-    /// let v_clone = v_orig.clone();
-    ///
-    /// // Using transmute: this relies on the unspecified data layout of `Vec`, which is a
-    /// // bad idea and could cause Undefined Behavior.
-    /// // However, it is no-copy.
-    /// let v_transmuted = unsafe {
-    ///     std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(v_clone)
-    /// };
-    ///
-    /// let v_clone = v_orig.clone();
-    ///
-    /// // This is the suggested, safe way.
-    /// // It may copy the entire vector into a new one though, but also may not.
-    /// let v_collected = v_clone.into_iter()
-    ///                          .map(Some)
-    ///                          .collect::<Vec<Option<&i32>>>();
-    ///
-    /// let v_clone = v_orig.clone();
-    ///
-    /// // This is the proper no-copy, unsafe way of "transmuting" a `Vec`, without relying on the
-    /// // data layout. Instead of literally calling `transmute`, we perform a pointer cast, but
-    /// // in terms of converting the original inner type (`&i32`) to the new one (`Option<&i32>`),
-    /// // this has all the same caveats. Besides the information provided above, also consult the
-    /// // [`from_raw_parts`] documentation.
-    /// let v_from_raw = unsafe {
-    // FIXME Update this when vec_into_raw_parts is stabilized
-    ///     // Ensure the original vector is not dropped.
-    ///     let mut v_clone = std::mem::ManuallyDrop::new(v_clone);
-    ///     Vec::from_raw_parts(v_clone.as_mut_ptr() as *mut Option<&i32>,
-    ///                         v_clone.len(),
-    ///                         v_clone.capacity())
-    /// };
-    /// ```
-    ///
-    /// [`from_raw_parts`]: ../../std/vec/struct.Vec.html#method.from_raw_parts
-    ///
-    /// Implementing `split_at_mut`:
-    ///
-    /// ```
-    /// use std::{slice, mem};
-    ///
-    /// // There are multiple ways to do this, and there are multiple problems
-    /// // with the following (transmute) way.
-    /// fn split_at_mut_transmute<T>(slice: &mut [T], mid: usize)
-    ///                              -> (&mut [T], &mut [T]) {
-    ///     let len = slice.len();
-    ///     assert!(mid <= len);
-    ///     unsafe {
-    ///         let slice2 = mem::transmute::<&mut [T], &mut [T]>(slice);
-    ///         // first: transmute is not type safe; all it checks is that T and
-    ///         // U are of the same size. Second, right here, you have two
-    ///         // mutable references pointing to the same memory.
-    ///         (&mut slice[0..mid], &mut slice2[mid..len])
-    ///     }
-    /// }
-    ///
-    /// // This gets rid of the type safety problems; `&mut *` will *only* give
-    /// // you a `&mut T` from a `&mut T` or `*mut T`.
-    /// fn split_at_mut_casts<T>(slice: &mut [T], mid: usize)
-    ///                          -> (&mut [T], &mut [T]) {
-    ///     let len = slice.len();
-    ///     assert!(mid <= len);
-    ///     unsafe {
-    ///         let slice2 = &mut *(slice as *mut [T]);
-    ///         // however, you still have two mutable references pointing to
-    ///         // the same memory.
-    ///         (&mut slice[0..mid], &mut slice2[mid..len])
-    ///     }
-    /// }
-    ///
-    /// // This is how the standard library does it. This is the best method, if
-    /// // you need to do something like this
-    /// fn split_at_stdlib<T>(slice: &mut [T], mid: usize)
-    ///                       -> (&mut [T], &mut [T]) {
-    ///     let len = slice.len();
-    ///     assert!(mid <= len);
-    ///     unsafe {
-    ///         let ptr = slice.as_mut_ptr();
-    ///         // This now has three mutable references pointing at the same
-    ///         // memory. `slice`, the rvalue ret.0, and the rvalue ret.1.
-    ///         // `slice` is never used after `let ptr = ...`, and so one can
-    ///         // treat it as "dead", and therefore, you only have two real
-    ///         // mutable slices.
-    ///         (slice::from_raw_parts_mut(ptr, mid),
-    ///          slice::from_raw_parts_mut(ptr.add(mid), len - mid))
-    ///     }
-    /// }
-    /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
-    #[rustc_allowed_through_unstable_modules]
-    #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
-    #[rustc_diagnostic_item = "transmute"]
-    #[rustc_nounwind]
-    pub fn transmute<Src, Dst>(src: Src) -> Dst;
-
-    /// Like [`transmute`], but even less checked at compile-time: rather than
-    /// giving an error for `size_of::<Src>() != size_of::<Dst>()`, it's
-    /// **Undefined Behavior** at runtime.
-    ///
-    /// Prefer normal `transmute` where possible, for the extra checking, since
-    /// both do exactly the same thing at runtime, if they both compile.
-    ///
-    /// This is not expected to ever be exposed directly to users, rather it
-    /// may eventually be exposed through some more-constrained API.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_transmute", since = "1.56.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn transmute_unchecked<Src, Dst>(src: Src) -> Dst;
-
-    /// Returns `true` if the actual type given as `T` requires drop
-    /// glue; returns `false` if the actual type provided for `T`
-    /// implements `Copy`.
-    ///
-    /// If the actual type neither requires drop glue nor implements
-    /// `Copy`, then the return value of this function is unspecified.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized version of this intrinsic is [`mem::needs_drop`](crate::mem::needs_drop).
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_needs_drop", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn needs_drop<T: ?Sized>() -> bool;
+/// Reinterprets the bits of a value of one type as another type.
+///
+/// Both types must have the same size. Compilation will fail if this is not guaranteed.
+///
+/// `transmute` is semantically equivalent to a bitwise move of one type
+/// into another. It copies the bits from the source value into the
+/// destination value, then forgets the original. Note that source and destination
+/// are passed by-value, which means if `Src` or `Dst` contain padding, that padding
+/// is *not* guaranteed to be preserved by `transmute`.
+///
+/// Both the argument and the result must be [valid](../../nomicon/what-unsafe-does.html) at
+/// their given type. Violating this condition leads to [undefined behavior][ub]. The compiler
+/// will generate code *assuming that you, the programmer, ensure that there will never be
+/// undefined behavior*. It is therefore your responsibility to guarantee that every value
+/// passed to `transmute` is valid at both types `Src` and `Dst`. Failing to uphold this condition
+/// may lead to unexpected and unstable compilation results. This makes `transmute` **incredibly
+/// unsafe**. `transmute` should be the absolute last resort.
+///
+/// Because `transmute` is a by-value operation, alignment of the *transmuted values
+/// themselves* is not a concern. As with any other function, the compiler already ensures
+/// both `Src` and `Dst` are properly aligned. However, when transmuting values that *point
+/// elsewhere* (such as pointers, references, boxes…), the caller has to ensure proper
+/// alignment of the pointed-to values.
+///
+/// The [nomicon](../../nomicon/transmutes.html) has additional documentation.
+///
+/// [ub]: ../../reference/behavior-considered-undefined.html
+///
+/// # Transmutation between pointers and integers
+///
+/// Special care has to be taken when transmuting between pointers and integers, e.g.
+/// transmuting between `*const ()` and `usize`.
+///
+/// Transmuting *pointers to integers* in a `const` context is [undefined behavior][ub], unless
+/// the pointer was originally created *from* an integer. (That includes this function
+/// specifically, integer-to-pointer casts, and helpers like [`dangling`][crate::ptr::dangling],
+/// but also semantically-equivalent conversions such as punning through `repr(C)` union
+/// fields.) Any attempt to use the resulting value for integer operations will abort
+/// const-evaluation. (And even outside `const`, such transmutation is touching on many
+/// unspecified aspects of the Rust memory model and should be avoided. See below for
+/// alternatives.)
+///
+/// Transmuting *integers to pointers* is a largely unspecified operation. It is likely *not*
+/// equivalent to an `as` cast. Doing non-zero-sized memory accesses with a pointer constructed
+/// this way is currently considered undefined behavior.
+///
+/// All this also applies when the integer is nested inside an array, tuple, struct, or enum.
+/// However, `MaybeUninit<usize>` is not considered an integer type for the purpose of this
+/// section. Transmuting `*const ()` to `MaybeUninit<usize>` is fine---but then calling
+/// `assume_init()` on that result is considered as completing the pointer-to-integer transmute
+/// and thus runs into the issues discussed above.
+///
+/// In particular, doing a pointer-to-integer-to-pointer roundtrip via `transmute` is *not* a
+/// lossless process. If you want to round-trip a pointer through an integer in a way that you
+/// can get back the original pointer, you need to use `as` casts, or replace the integer type
+/// by `MaybeUninit<$int>` (and never call `assume_init()`). If you are looking for a way to
+/// store data of arbitrary type, also use `MaybeUninit<T>` (that will also handle uninitialized
+/// memory due to padding). If you specifically need to store something that is "either an
+/// integer or a pointer", use `*mut ()`: integers can be converted to pointers and back without
+/// any loss (via `as` casts or via `transmute`).
+///
+/// # Examples
+///
+/// There are a few things that `transmute` is really useful for.
+///
+/// Turning a pointer into a function pointer. This is *not* portable to
+/// machines where function pointers and data pointers have different sizes.
+///
+/// ```
+/// fn foo() -> i32 {
+///     0
+/// }
+/// // Crucially, we `as`-cast to a raw pointer before `transmute`ing to a function pointer.
+/// // This avoids an integer-to-pointer `transmute`, which can be problematic.
+/// // Transmuting between raw pointers and function pointers (i.e., two pointer types) is fine.
+/// let pointer = foo as *const ();
+/// let function = unsafe {
+///     std::mem::transmute::<*const (), fn() -> i32>(pointer)
+/// };
+/// assert_eq!(function(), 0);
+/// ```
+///
+/// Extending a lifetime, or shortening an invariant lifetime. This is
+/// advanced, very unsafe Rust!
+///
+/// ```
+/// struct R<'a>(&'a i32);
+/// unsafe fn extend_lifetime<'b>(r: R<'b>) -> R<'static> {
+///     std::mem::transmute::<R<'b>, R<'static>>(r)
+/// }
+///
+/// unsafe fn shorten_invariant_lifetime<'b, 'c>(r: &'b mut R<'static>)
+///                                              -> &'b mut R<'c> {
+///     std::mem::transmute::<&'b mut R<'static>, &'b mut R<'c>>(r)
+/// }
+/// ```
+///
+/// # Alternatives
+///
+/// Don't despair: many uses of `transmute` can be achieved through other means.
+/// Below are common applications of `transmute` which can be replaced with safer
+/// constructs.
+///
+/// Turning raw bytes (`[u8; SZ]`) into `u32`, `f64`, etc.:
+///
+/// ```
+/// let raw_bytes = [0x78, 0x56, 0x34, 0x12];
+///
+/// let num = unsafe {
+///     std::mem::transmute::<[u8; 4], u32>(raw_bytes)
+/// };
+///
+/// // use `u32::from_ne_bytes` instead
+/// let num = u32::from_ne_bytes(raw_bytes);
+/// // or use `u32::from_le_bytes` or `u32::from_be_bytes` to specify the endianness
+/// let num = u32::from_le_bytes(raw_bytes);
+/// assert_eq!(num, 0x12345678);
+/// let num = u32::from_be_bytes(raw_bytes);
+/// assert_eq!(num, 0x78563412);
+/// ```
+///
+/// Turning a pointer into a `usize`:
+///
+/// ```no_run
+/// let ptr = &0;
+/// let ptr_num_transmute = unsafe {
+///     std::mem::transmute::<&i32, usize>(ptr)
+/// };
+///
+/// // Use an `as` cast instead
+/// let ptr_num_cast = ptr as *const i32 as usize;
+/// ```
+///
+/// Note that using `transmute` to turn a pointer to a `usize` is (as noted above) [undefined
+/// behavior][ub] in `const` contexts. Also outside of consts, this operation might not behave
+/// as expected -- this is touching on many unspecified aspects of the Rust memory model.
+/// Depending on what the code is doing, the following alternatives are preferable to
+/// pointer-to-integer transmutation:
+/// - If the code just wants to store data of arbitrary type in some buffer and needs to pick a
+///   type for that buffer, it can use [`MaybeUninit`][crate::mem::MaybeUninit].
+/// - If the code actually wants to work on the address the pointer points to, it can use `as`
+///   casts or [`ptr.addr()`][pointer::addr].
+///
+/// Turning a `*mut T` into a `&mut T`:
+///
+/// ```
+/// let ptr: *mut i32 = &mut 0;
+/// let ref_transmuted = unsafe {
+///     std::mem::transmute::<*mut i32, &mut i32>(ptr)
+/// };
+///
+/// // Use a reborrow instead
+/// let ref_casted = unsafe { &mut *ptr };
+/// ```
+///
+/// Turning a `&mut T` into a `&mut U`:
+///
+/// ```
+/// let ptr = &mut 0;
+/// let val_transmuted = unsafe {
+///     std::mem::transmute::<&mut i32, &mut u32>(ptr)
+/// };
+///
+/// // Now, put together `as` and reborrowing - note the chaining of `as`
+/// // `as` is not transitive
+/// let val_casts = unsafe { &mut *(ptr as *mut i32 as *mut u32) };
+/// ```
+///
+/// Turning a `&str` into a `&[u8]`:
+///
+/// ```
+/// // this is not a good way to do this.
+/// let slice = unsafe { std::mem::transmute::<&str, &[u8]>("Rust") };
+/// assert_eq!(slice, &[82, 117, 115, 116]);
+///
+/// // You could use `str::as_bytes`
+/// let slice = "Rust".as_bytes();
+/// assert_eq!(slice, &[82, 117, 115, 116]);
+///
+/// // Or, just use a byte string, if you have control over the string
+/// // literal
+/// assert_eq!(b"Rust", &[82, 117, 115, 116]);
+/// ```
+///
+/// Turning a `Vec<&T>` into a `Vec<Option<&T>>`.
+///
+/// To transmute the inner type of the contents of a container, you must make sure to not
+/// violate any of the container's invariants. For `Vec`, this means that both the size
+/// *and alignment* of the inner types have to match. Other containers might rely on the
+/// size of the type, alignment, or even the `TypeId`, in which case transmuting wouldn't
+/// be possible at all without violating the container invariants.
+///
+/// ```
+/// let store = [0, 1, 2, 3];
+/// let v_orig = store.iter().collect::<Vec<&i32>>();
+///
+/// // clone the vector as we will reuse them later
+/// let v_clone = v_orig.clone();
+///
+/// // Using transmute: this relies on the unspecified data layout of `Vec`, which is a
+/// // bad idea and could cause Undefined Behavior.
+/// // However, it is no-copy.
+/// let v_transmuted = unsafe {
+///     std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(v_clone)
+/// };
+///
+/// let v_clone = v_orig.clone();
+///
+/// // This is the suggested, safe way.
+/// // It may copy the entire vector into a new one though, but also may not.
+/// let v_collected = v_clone.into_iter()
+///                          .map(Some)
+///                          .collect::<Vec<Option<&i32>>>();
+///
+/// let v_clone = v_orig.clone();
+///
+/// // This is the proper no-copy, unsafe way of "transmuting" a `Vec`, without relying on the
+/// // data layout. Instead of literally calling `transmute`, we perform a pointer cast, but
+/// // in terms of converting the original inner type (`&i32`) to the new one (`Option<&i32>`),
+/// // this has all the same caveats. Besides the information provided above, also consult the
+/// // [`from_raw_parts`] documentation.
+/// let v_from_raw = unsafe {
+// FIXME Update this when vec_into_raw_parts is stabilized
+///     // Ensure the original vector is not dropped.
+///     let mut v_clone = std::mem::ManuallyDrop::new(v_clone);
+///     Vec::from_raw_parts(v_clone.as_mut_ptr() as *mut Option<&i32>,
+///                         v_clone.len(),
+///                         v_clone.capacity())
+/// };
+/// ```
+///
+/// [`from_raw_parts`]: ../../std/vec/struct.Vec.html#method.from_raw_parts
+///
+/// Implementing `split_at_mut`:
+///
+/// ```
+/// use std::{slice, mem};
+///
+/// // There are multiple ways to do this, and there are multiple problems
+/// // with the following (transmute) way.
+/// fn split_at_mut_transmute<T>(slice: &mut [T], mid: usize)
+///                              -> (&mut [T], &mut [T]) {
+///     let len = slice.len();
+///     assert!(mid <= len);
+///     unsafe {
+///         let slice2 = mem::transmute::<&mut [T], &mut [T]>(slice);
+///         // first: transmute is not type safe; all it checks is that T and
+///         // U are of the same size. Second, right here, you have two
+///         // mutable references pointing to the same memory.
+///         (&mut slice[0..mid], &mut slice2[mid..len])
+///     }
+/// }
+///
+/// // This gets rid of the type safety problems; `&mut *` will *only* give
+/// // you a `&mut T` from a `&mut T` or `*mut T`.
+/// fn split_at_mut_casts<T>(slice: &mut [T], mid: usize)
+///                          -> (&mut [T], &mut [T]) {
+///     let len = slice.len();
+///     assert!(mid <= len);
+///     unsafe {
+///         let slice2 = &mut *(slice as *mut [T]);
+///         // however, you still have two mutable references pointing to
+///         // the same memory.
+///         (&mut slice[0..mid], &mut slice2[mid..len])
+///     }
+/// }
+///
+/// // This is how the standard library does it. This is the best method, if
+/// // you need to do something like this
+/// fn split_at_stdlib<T>(slice: &mut [T], mid: usize)
+///                       -> (&mut [T], &mut [T]) {
+///     let len = slice.len();
+///     assert!(mid <= len);
+///     unsafe {
+///         let ptr = slice.as_mut_ptr();
+///         // This now has three mutable references pointing at the same
+///         // memory. `slice`, the rvalue ret.0, and the rvalue ret.1.
+///         // `slice` is never used after `let ptr = ...`, and so one can
+///         // treat it as "dead", and therefore, you only have two real
+///         // mutable slices.
+///         (slice::from_raw_parts_mut(ptr, mid),
+///          slice::from_raw_parts_mut(ptr.add(mid), len - mid))
+///     }
+/// }
+/// ```
+#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_allowed_through_unstable_modules]
+#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
+#[rustc_diagnostic_item = "transmute"]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn transmute<Src, Dst>(_src: Src) -> Dst {
+    unreachable!()
+}
 
-    /// Calculates the offset from a pointer.
-    ///
-    /// This is implemented as an intrinsic to avoid converting to and from an
-    /// integer, since the conversion would throw away aliasing information.
-    ///
-    /// This can only be used with `Ptr` as a raw pointer type (`*mut` or `*const`)
-    /// to a `Sized` pointee and with `Delta` as `usize` or `isize`.  Any other
-    /// instantiations may arbitrarily misbehave, and that's *not* a compiler bug.
-    ///
-    /// # Safety
-    ///
-    /// If the computed offset is non-zero, then both the starting and resulting pointer must be
-    /// either in bounds or at the end of an allocated object. If either pointer is out
-    /// of bounds or arithmetic overflow occurs then this operation is undefined behavior.
-    ///
-    /// The stabilized version of this intrinsic is [`pointer::offset`].
-    #[must_use = "returns a new pointer rather than modifying its argument"]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn offset<Ptr, Delta>(dst: Ptr, offset: Delta) -> Ptr;
+/// Like [`transmute`], but even less checked at compile-time: rather than
+/// giving an error for `size_of::<Src>() != size_of::<Dst>()`, it's
+/// **Undefined Behavior** at runtime.
+///
+/// Prefer normal `transmute` where possible, for the extra checking, since
+/// both do exactly the same thing at runtime, if they both compile.
+///
+/// This is not expected to ever be exposed directly to users, rather it
+/// may eventually be exposed through some more-constrained API.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_transmute", since = "1.56.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn transmute_unchecked<Src, Dst>(_src: Src) -> Dst {
+    unreachable!()
+}
 
-    /// Calculates the offset from a pointer, potentially wrapping.
-    ///
-    /// This is implemented as an intrinsic to avoid converting to and from an
-    /// integer, since the conversion inhibits certain optimizations.
-    ///
-    /// # Safety
-    ///
-    /// Unlike the `offset` intrinsic, this intrinsic does not restrict the
-    /// resulting pointer to point into or at the end of an allocated
-    /// object, and it wraps with two's complement arithmetic. The resulting
-    /// value is not necessarily valid to be used to actually access memory.
-    ///
-    /// The stabilized version of this intrinsic is [`pointer::wrapping_offset`].
-    #[must_use = "returns a new pointer rather than modifying its argument"]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
+/// Returns `true` if the actual type given as `T` requires drop
+/// glue; returns `false` if the actual type provided for `T`
+/// implements `Copy`.
+///
+/// If the actual type neither requires drop glue nor implements
+/// `Copy`, then the return value of this function is unspecified.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized version of this intrinsic is [`mem::needs_drop`](crate::mem::needs_drop).
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_needs_drop", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn needs_drop<T: ?Sized>() -> bool {
+    unreachable!()
+}
+
+/// Calculates the offset from a pointer.
+///
+/// This is implemented as an intrinsic to avoid converting to and from an
+/// integer, since the conversion would throw away aliasing information.
+///
+/// This can only be used with `Ptr` as a raw pointer type (`*mut` or `*const`)
+/// to a `Sized` pointee and with `Delta` as `usize` or `isize`.  Any other
+/// instantiations may arbitrarily misbehave, and that's *not* a compiler bug.
+///
+/// # Safety
+///
+/// If the computed offset is non-zero, then both the starting and resulting pointer must be
+/// either in bounds or at the end of an allocated object. If either pointer is out
+/// of bounds or arithmetic overflow occurs then this operation is undefined behavior.
+///
+/// The stabilized version of this intrinsic is [`pointer::offset`].
+#[must_use = "returns a new pointer rather than modifying its argument"]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn offset<Ptr, Delta>(_dst: Ptr, _offset: Delta) -> Ptr {
+    unreachable!()
+}
 
+/// Calculates the offset from a pointer, potentially wrapping.
+///
+/// This is implemented as an intrinsic to avoid converting to and from an
+/// integer, since the conversion inhibits certain optimizations.
+///
+/// # Safety
+///
+/// Unlike the `offset` intrinsic, this intrinsic does not restrict the
+/// resulting pointer to point into or at the end of an allocated
+/// object, and it wraps with two's complement arithmetic. The resulting
+/// value is not necessarily valid to be used to actually access memory.
+///
+/// The stabilized version of this intrinsic is [`pointer::wrapping_offset`].
+#[must_use = "returns a new pointer rather than modifying its argument"]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn arith_offset<T>(_dst: *const T, _offset: isize) -> *const T {
+    unreachable!()
+}
+
+extern "rust-intrinsic" {
     /// Masks out bits of the pointer according to a mask.
     ///
     /// Note that, unlike most intrinsics, this is safe to call;
@@ -2143,474 +2181,569 @@ extern "rust-intrinsic" {
     /// Stabilized as [`f32::to_int_unchecked`] and [`f64::to_int_unchecked`].
     #[rustc_nounwind]
     pub fn float_to_int_unchecked<Float: Copy, Int: Copy>(value: Float) -> Int;
+}
 
-    /// Returns the number of bits set in an integer type `T`
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `count_ones` method. For example,
-    /// [`u32::count_ones`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ctpop", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn ctpop<T: Copy>(x: T) -> u32;
+/// Returns the number of bits set in an integer type `T`
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `count_ones` method. For example,
+/// [`u32::count_ones`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ctpop", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn ctpop<T: Copy>(_x: T) -> u32 {
+    unimplemented!()
+}
 
-    /// Returns the number of leading unset bits (zeroes) in an integer type `T`.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `leading_zeros` method. For example,
-    /// [`u32::leading_zeros`]
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// #![feature(core_intrinsics)]
-    /// # #![allow(internal_features)]
-    ///
-    /// use std::intrinsics::ctlz;
-    ///
-    /// let x = 0b0001_1100_u8;
-    /// let num_leading = ctlz(x);
-    /// assert_eq!(num_leading, 3);
-    /// ```
-    ///
-    /// An `x` with value `0` will return the bit width of `T`.
-    ///
-    /// ```
-    /// #![feature(core_intrinsics)]
-    /// # #![allow(internal_features)]
-    ///
-    /// use std::intrinsics::ctlz;
-    ///
-    /// let x = 0u16;
-    /// let num_leading = ctlz(x);
-    /// assert_eq!(num_leading, 16);
-    /// ```
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ctlz", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn ctlz<T: Copy>(x: T) -> u32;
+/// Returns the number of leading unset bits (zeroes) in an integer type `T`.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `leading_zeros` method. For example,
+/// [`u32::leading_zeros`]
+///
+/// # Examples
+///
+/// ```
+/// #![feature(core_intrinsics)]
+/// # #![allow(internal_features)]
+///
+/// use std::intrinsics::ctlz;
+///
+/// let x = 0b0001_1100_u8;
+/// let num_leading = ctlz(x);
+/// assert_eq!(num_leading, 3);
+/// ```
+///
+/// An `x` with value `0` will return the bit width of `T`.
+///
+/// ```
+/// #![feature(core_intrinsics)]
+/// # #![allow(internal_features)]
+///
+/// use std::intrinsics::ctlz;
+///
+/// let x = 0u16;
+/// let num_leading = ctlz(x);
+/// assert_eq!(num_leading, 16);
+/// ```
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ctlz", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn ctlz<T: Copy>(_x: T) -> u32 {
+    unimplemented!()
+}
 
-    /// Like `ctlz`, but extra-unsafe as it returns `undef` when
-    /// given an `x` with value `0`.
-    ///
-    /// This intrinsic does not have a stable counterpart.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// #![feature(core_intrinsics)]
-    /// # #![allow(internal_features)]
-    ///
-    /// use std::intrinsics::ctlz_nonzero;
-    ///
-    /// let x = 0b0001_1100_u8;
-    /// let num_leading = unsafe { ctlz_nonzero(x) };
-    /// assert_eq!(num_leading, 3);
-    /// ```
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "constctlz", since = "1.50.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn ctlz_nonzero<T: Copy>(x: T) -> u32;
+/// Like `ctlz`, but extra-unsafe as it returns `undef` when
+/// given an `x` with value `0`.
+///
+/// This intrinsic does not have a stable counterpart.
+///
+/// # Examples
+///
+/// ```
+/// #![feature(core_intrinsics)]
+/// # #![allow(internal_features)]
+///
+/// use std::intrinsics::ctlz_nonzero;
+///
+/// let x = 0b0001_1100_u8;
+/// let num_leading = unsafe { ctlz_nonzero(x) };
+/// assert_eq!(num_leading, 3);
+/// ```
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "constctlz", since = "1.50.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn ctlz_nonzero<T: Copy>(_x: T) -> u32 {
+    unimplemented!()
+}
 
-    /// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `trailing_zeros` method. For example,
-    /// [`u32::trailing_zeros`]
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// #![feature(core_intrinsics)]
-    /// # #![allow(internal_features)]
-    ///
-    /// use std::intrinsics::cttz;
-    ///
-    /// let x = 0b0011_1000_u8;
-    /// let num_trailing = cttz(x);
-    /// assert_eq!(num_trailing, 3);
-    /// ```
-    ///
-    /// An `x` with value `0` will return the bit width of `T`:
-    ///
-    /// ```
-    /// #![feature(core_intrinsics)]
-    /// # #![allow(internal_features)]
-    ///
-    /// use std::intrinsics::cttz;
-    ///
-    /// let x = 0u16;
-    /// let num_trailing = cttz(x);
-    /// assert_eq!(num_trailing, 16);
-    /// ```
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_cttz", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn cttz<T: Copy>(x: T) -> u32;
+/// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `trailing_zeros` method. For example,
+/// [`u32::trailing_zeros`]
+///
+/// # Examples
+///
+/// ```
+/// #![feature(core_intrinsics)]
+/// # #![allow(internal_features)]
+///
+/// use std::intrinsics::cttz;
+///
+/// let x = 0b0011_1000_u8;
+/// let num_trailing = cttz(x);
+/// assert_eq!(num_trailing, 3);
+/// ```
+///
+/// An `x` with value `0` will return the bit width of `T`:
+///
+/// ```
+/// #![feature(core_intrinsics)]
+/// # #![allow(internal_features)]
+///
+/// use std::intrinsics::cttz;
+///
+/// let x = 0u16;
+/// let num_trailing = cttz(x);
+/// assert_eq!(num_trailing, 16);
+/// ```
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_cttz", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn cttz<T: Copy>(_x: T) -> u32 {
+    unimplemented!()
+}
 
-    /// Like `cttz`, but extra-unsafe as it returns `undef` when
-    /// given an `x` with value `0`.
-    ///
-    /// This intrinsic does not have a stable counterpart.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// #![feature(core_intrinsics)]
-    /// # #![allow(internal_features)]
-    ///
-    /// use std::intrinsics::cttz_nonzero;
-    ///
-    /// let x = 0b0011_1000_u8;
-    /// let num_trailing = unsafe { cttz_nonzero(x) };
-    /// assert_eq!(num_trailing, 3);
-    /// ```
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_cttz_nonzero", since = "1.53.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn cttz_nonzero<T: Copy>(x: T) -> u32;
+/// Like `cttz`, but extra-unsafe as it returns `undef` when
+/// given an `x` with value `0`.
+///
+/// This intrinsic does not have a stable counterpart.
+///
+/// # Examples
+///
+/// ```
+/// #![feature(core_intrinsics)]
+/// # #![allow(internal_features)]
+///
+/// use std::intrinsics::cttz_nonzero;
+///
+/// let x = 0b0011_1000_u8;
+/// let num_trailing = unsafe { cttz_nonzero(x) };
+/// assert_eq!(num_trailing, 3);
+/// ```
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_cttz_nonzero", since = "1.53.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn cttz_nonzero<T: Copy>(_x: T) -> u32 {
+    unimplemented!()
+}
 
-    /// Reverses the bytes in an integer type `T`.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `swap_bytes` method. For example,
-    /// [`u32::swap_bytes`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_bswap", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn bswap<T: Copy>(x: T) -> T;
+/// Reverses the bytes in an integer type `T`.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `swap_bytes` method. For example,
+/// [`u32::swap_bytes`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_bswap", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn bswap<T: Copy>(_x: T) -> T {
+    unimplemented!()
+}
 
-    /// Reverses the bits in an integer type `T`.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `reverse_bits` method. For example,
-    /// [`u32::reverse_bits`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_bitreverse", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn bitreverse<T: Copy>(x: T) -> T;
+/// Reverses the bits in an integer type `T`.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `reverse_bits` method. For example,
+/// [`u32::reverse_bits`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_bitreverse", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn bitreverse<T: Copy>(_x: T) -> T {
+    unimplemented!()
+}
 
-    /// Does a three-way comparison between the two integer arguments.
-    ///
-    /// This is included as an intrinsic as it's useful to let it be one thing
-    /// in MIR, rather than the multiple checks and switches that make its IR
-    /// large and difficult to optimize.
-    ///
-    /// The stabilized version of this intrinsic is [`Ord::cmp`].
-    #[rustc_const_unstable(feature = "const_three_way_compare", issue = "none")]
-    #[rustc_safe_intrinsic]
-    pub fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> crate::cmp::Ordering;
+/// Does a three-way comparison between the two integer arguments.
+///
+/// This is included as an intrinsic as it's useful to let it be one thing
+/// in MIR, rather than the multiple checks and switches that make its IR
+/// large and difficult to optimize.
+///
+/// The stabilized version of this intrinsic is [`Ord::cmp`].
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_three_way_compare", issue = "none"))]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn three_way_compare<T: Copy>(_lhs: T, _rhss: T) -> crate::cmp::Ordering {
+    unimplemented!()
+}
 
-    /// Performs checked integer addition.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `overflowing_add` method. For example,
-    /// [`u32::overflowing_add`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_overflow", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn add_with_overflow<T: Copy>(x: T, y: T) -> (T, bool);
+/// Performs checked integer addition.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `overflowing_add` method. For example,
+/// [`u32::overflowing_add`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_overflow", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn add_with_overflow<T: Copy>(_x: T, _y: T) -> (T, bool) {
+    unimplemented!()
+}
 
-    /// Performs checked integer subtraction
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `overflowing_sub` method. For example,
-    /// [`u32::overflowing_sub`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_overflow", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn sub_with_overflow<T: Copy>(x: T, y: T) -> (T, bool);
+/// Performs checked integer subtraction
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `overflowing_sub` method. For example,
+/// [`u32::overflowing_sub`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_overflow", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn sub_with_overflow<T: Copy>(_x: T, _y: T) -> (T, bool) {
+    unimplemented!()
+}
 
-    /// Performs checked integer multiplication
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `overflowing_mul` method. For example,
-    /// [`u32::overflowing_mul`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_overflow", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn mul_with_overflow<T: Copy>(x: T, y: T) -> (T, bool);
+/// Performs checked integer multiplication
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `overflowing_mul` method. For example,
+/// [`u32::overflowing_mul`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_overflow", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn mul_with_overflow<T: Copy>(_x: T, _y: T) -> (T, bool) {
+    unimplemented!()
+}
 
-    /// Performs an exact division, resulting in undefined behavior where
-    /// `x % y != 0` or `y == 0` or `x == T::MIN && y == -1`
-    ///
-    /// This intrinsic does not have a stable counterpart.
-    #[rustc_const_unstable(feature = "const_exact_div", issue = "none")]
-    #[rustc_nounwind]
-    pub fn exact_div<T: Copy>(x: T, y: T) -> T;
+/// Performs an exact division, resulting in undefined behavior where
+/// `x % y != 0` or `y == 0` or `x == T::MIN && y == -1`
+///
+/// This intrinsic does not have a stable counterpart.
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_exact_div", issue = "none"))]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn exact_div<T: Copy>(_x: T, _y: T) -> T {
+    unimplemented!()
+}
 
-    /// Performs an unchecked division, resulting in undefined behavior
-    /// where `y == 0` or `x == T::MIN && y == -1`
-    ///
-    /// Safe wrappers for this intrinsic are available on the integer
-    /// primitives via the `checked_div` method. For example,
-    /// [`u32::checked_div`]
-    #[cfg_attr(
-        bootstrap,
-        rustc_const_stable(feature = "const_int_unchecked_div", since = "1.52.0")
-    )]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn unchecked_div<T: Copy>(x: T, y: T) -> T;
-    /// Returns the remainder of an unchecked division, resulting in
-    /// undefined behavior when `y == 0` or `x == T::MIN && y == -1`
-    ///
-    /// Safe wrappers for this intrinsic are available on the integer
-    /// primitives via the `checked_rem` method. For example,
-    /// [`u32::checked_rem`]
-    #[cfg_attr(
-        bootstrap,
-        rustc_const_stable(feature = "const_int_unchecked_rem", since = "1.52.0")
-    )]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn unchecked_rem<T: Copy>(x: T, y: T) -> T;
+/// Performs an unchecked division, resulting in undefined behavior
+/// where `y == 0` or `x == T::MIN && y == -1`
+///
+/// Safe wrappers for this intrinsic are available on the integer
+/// primitives via the `checked_div` method. For example,
+/// [`u32::checked_div`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_unchecked_div", since = "1.52.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn unchecked_div<T: Copy>(_x: T, _y: T) -> T {
+    unimplemented!()
+}
+/// Returns the remainder of an unchecked division, resulting in
+/// undefined behavior when `y == 0` or `x == T::MIN && y == -1`
+///
+/// Safe wrappers for this intrinsic are available on the integer
+/// primitives via the `checked_rem` method. For example,
+/// [`u32::checked_rem`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_unchecked_rem", since = "1.52.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn unchecked_rem<T: Copy>(_x: T, _y: T) -> T {
+    unimplemented!()
+}
 
-    /// Performs an unchecked left shift, resulting in undefined behavior when
-    /// `y < 0` or `y >= N`, where N is the width of T in bits.
-    ///
-    /// Safe wrappers for this intrinsic are available on the integer
-    /// primitives via the `checked_shl` method. For example,
-    /// [`u32::checked_shl`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn unchecked_shl<T: Copy, U: Copy>(x: T, y: U) -> T;
-    /// Performs an unchecked right shift, resulting in undefined behavior when
-    /// `y < 0` or `y >= N`, where N is the width of T in bits.
-    ///
-    /// Safe wrappers for this intrinsic are available on the integer
-    /// primitives via the `checked_shr` method. For example,
-    /// [`u32::checked_shr`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn unchecked_shr<T: Copy, U: Copy>(x: T, y: U) -> T;
+/// Performs an unchecked left shift, resulting in undefined behavior when
+/// `y < 0` or `y >= N`, where N is the width of T in bits.
+///
+/// Safe wrappers for this intrinsic are available on the integer
+/// primitives via the `checked_shl` method. For example,
+/// [`u32::checked_shl`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn unchecked_shl<T: Copy, U: Copy>(_x: T, _y: U) -> T {
+    unimplemented!()
+}
+/// Performs an unchecked right shift, resulting in undefined behavior when
+/// `y < 0` or `y >= N`, where N is the width of T in bits.
+///
+/// Safe wrappers for this intrinsic are available on the integer
+/// primitives via the `checked_shr` method. For example,
+/// [`u32::checked_shr`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn unchecked_shr<T: Copy, U: Copy>(_x: T, _y: U) -> T {
+    unimplemented!()
+}
 
-    /// Returns the result of an unchecked addition, resulting in
-    /// undefined behavior when `x + y > T::MAX` or `x + y < T::MIN`.
-    ///
-    /// The stable counterpart of this intrinsic is `unchecked_add` on the various
-    /// integer types, such as [`u16::unchecked_add`] and [`i64::unchecked_add`].
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "unchecked_math", since = "1.79.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn unchecked_add<T: Copy>(x: T, y: T) -> T;
+/// Returns the result of an unchecked addition, resulting in
+/// undefined behavior when `x + y > T::MAX` or `x + y < T::MIN`.
+///
+/// The stable counterpart of this intrinsic is `unchecked_add` on the various
+/// integer types, such as [`u16::unchecked_add`] and [`i64::unchecked_add`].
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "unchecked_math", since = "1.79.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn unchecked_add<T: Copy>(_x: T, _y: T) -> T {
+    unimplemented!()
+}
 
-    /// Returns the result of an unchecked subtraction, resulting in
-    /// undefined behavior when `x - y > T::MAX` or `x - y < T::MIN`.
-    ///
-    /// The stable counterpart of this intrinsic is `unchecked_sub` on the various
-    /// integer types, such as [`u16::unchecked_sub`] and [`i64::unchecked_sub`].
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "unchecked_math", since = "1.79.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn unchecked_sub<T: Copy>(x: T, y: T) -> T;
+/// Returns the result of an unchecked subtraction, resulting in
+/// undefined behavior when `x - y > T::MAX` or `x - y < T::MIN`.
+///
+/// The stable counterpart of this intrinsic is `unchecked_sub` on the various
+/// integer types, such as [`u16::unchecked_sub`] and [`i64::unchecked_sub`].
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "unchecked_math", since = "1.79.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn unchecked_sub<T: Copy>(_x: T, _y: T) -> T {
+    unimplemented!()
+}
 
-    /// Returns the result of an unchecked multiplication, resulting in
-    /// undefined behavior when `x * y > T::MAX` or `x * y < T::MIN`.
-    ///
-    /// The stable counterpart of this intrinsic is `unchecked_mul` on the various
-    /// integer types, such as [`u16::unchecked_mul`] and [`i64::unchecked_mul`].
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "unchecked_math", since = "1.79.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn unchecked_mul<T: Copy>(x: T, y: T) -> T;
+/// Returns the result of an unchecked multiplication, resulting in
+/// undefined behavior when `x * y > T::MAX` or `x * y < T::MIN`.
+///
+/// The stable counterpart of this intrinsic is `unchecked_mul` on the various
+/// integer types, such as [`u16::unchecked_mul`] and [`i64::unchecked_mul`].
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "unchecked_math", since = "1.79.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn unchecked_mul<T: Copy>(_x: T, _y: T) -> T {
+    unimplemented!()
+}
 
-    /// Performs rotate left.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `rotate_left` method. For example,
-    /// [`u32::rotate_left`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_rotate", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn rotate_left<T: Copy>(x: T, shift: u32) -> T;
+/// Performs rotate left.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `rotate_left` method. For example,
+/// [`u32::rotate_left`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_rotate", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn rotate_left<T: Copy>(_x: T, _shift: u32) -> T {
+    unimplemented!()
+}
 
-    /// Performs rotate right.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `rotate_right` method. For example,
-    /// [`u32::rotate_right`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_rotate", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn rotate_right<T: Copy>(x: T, shift: u32) -> T;
+/// Performs rotate right.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `rotate_right` method. For example,
+/// [`u32::rotate_right`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_rotate", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn rotate_right<T: Copy>(_x: T, _shift: u32) -> T {
+    unimplemented!()
+}
 
-    /// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `wrapping_add` method. For example,
-    /// [`u32::wrapping_add`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn wrapping_add<T: Copy>(a: T, b: T) -> T;
-    /// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `wrapping_sub` method. For example,
-    /// [`u32::wrapping_sub`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn wrapping_sub<T: Copy>(a: T, b: T) -> T;
-    /// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `wrapping_mul` method. For example,
-    /// [`u32::wrapping_mul`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn wrapping_mul<T: Copy>(a: T, b: T) -> T;
+/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `wrapping_add` method. For example,
+/// [`u32::wrapping_add`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn wrapping_add<T: Copy>(_a: T, _b: T) -> T {
+    unimplemented!()
+}
+/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `wrapping_sub` method. For example,
+/// [`u32::wrapping_sub`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn wrapping_sub<T: Copy>(_a: T, _b: T) -> T {
+    unimplemented!()
+}
+/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `wrapping_mul` method. For example,
+/// [`u32::wrapping_mul`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn wrapping_mul<T: Copy>(_a: T, _b: T) -> T {
+    unimplemented!()
+}
 
-    /// Computes `a + b`, saturating at numeric bounds.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `saturating_add` method. For example,
-    /// [`u32::saturating_add`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_saturating", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn saturating_add<T: Copy>(a: T, b: T) -> T;
-    /// Computes `a - b`, saturating at numeric bounds.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized versions of this intrinsic are available on the integer
-    /// primitives via the `saturating_sub` method. For example,
-    /// [`u32::saturating_sub`]
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_saturating", since = "1.40.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn saturating_sub<T: Copy>(a: T, b: T) -> T;
+/// Computes `a + b`, saturating at numeric bounds.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `saturating_add` method. For example,
+/// [`u32::saturating_add`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_saturating", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn saturating_add<T: Copy>(_a: T, _b: T) -> T {
+    unimplemented!()
+}
+/// Computes `a - b`, saturating at numeric bounds.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized versions of this intrinsic are available on the integer
+/// primitives via the `saturating_sub` method. For example,
+/// [`u32::saturating_sub`]
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_int_saturating", since = "1.40.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn saturating_sub<T: Copy>(_a: T, _b: T) -> T {
+    unimplemented!()
+}
 
-    /// This is an implementation detail of [`crate::ptr::read`] and should
-    /// not be used anywhere else.  See its comments for why this exists.
-    ///
-    /// This intrinsic can *only* be called where the pointer is a local without
-    /// projections (`read_via_copy(ptr)`, not `read_via_copy(*ptr)`) so that it
-    /// trivially obeys runtime-MIR rules about derefs in operands.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_read", since = "1.71.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn read_via_copy<T>(ptr: *const T) -> T;
+/// This is an implementation detail of [`crate::ptr::read`] and should
+/// not be used anywhere else.  See its comments for why this exists.
+///
+/// This intrinsic can *only* be called where the pointer is a local without
+/// projections (`read_via_copy(ptr)`, not `read_via_copy(*ptr)`) so that it
+/// trivially obeys runtime-MIR rules about derefs in operands.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_read", since = "1.71.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn read_via_copy<T>(_ptr: *const T) -> T {
+    unimplemented!()
+}
 
-    /// This is an implementation detail of [`crate::ptr::write`] and should
-    /// not be used anywhere else.  See its comments for why this exists.
-    ///
-    /// This intrinsic can *only* be called where the pointer is a local without
-    /// projections (`write_via_move(ptr, x)`, not `write_via_move(*ptr, x)`) so
-    /// that it trivially obeys runtime-MIR rules about derefs in operands.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_write", since = "1.83.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn write_via_move<T>(ptr: *mut T, value: T);
+/// This is an implementation detail of [`crate::ptr::write`] and should
+/// not be used anywhere else.  See its comments for why this exists.
+///
+/// This intrinsic can *only* be called where the pointer is a local without
+/// projections (`write_via_move(ptr, x)`, not `write_via_move(*ptr, x)`) so
+/// that it trivially obeys runtime-MIR rules about derefs in operands.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_write", since = "1.83.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn write_via_move<T>(_ptr: *mut T, _value: T) {
+    unimplemented!()
+}
 
-    /// Returns the value of the discriminant for the variant in 'v';
-    /// if `T` has no discriminant, returns `0`.
-    ///
-    /// Note that, unlike most intrinsics, this is safe to call;
-    /// it does not require an `unsafe` block.
-    /// Therefore, implementations must not require the user to uphold
-    /// any safety invariants.
-    ///
-    /// The stabilized version of this intrinsic is [`core::mem::discriminant`].
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_discriminant", since = "1.75.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn discriminant_value<T>(v: &T) -> <T as DiscriminantKind>::Discriminant;
+/// Returns the value of the discriminant for the variant in 'v';
+/// if `T` has no discriminant, returns `0`.
+///
+/// Note that, unlike most intrinsics, this is safe to call;
+/// it does not require an `unsafe` block.
+/// Therefore, implementations must not require the user to uphold
+/// any safety invariants.
+///
+/// The stabilized version of this intrinsic is [`core::mem::discriminant`].
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_discriminant", since = "1.75.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn discriminant_value<T>(_v: &T) -> <T as DiscriminantKind>::Discriminant {
+    unimplemented!()
+}
 
+extern "rust-intrinsic" {
     /// Rust's "try catch" construct for unwinding. Invokes the function pointer `try_fn` with the
     /// data pointer `data`, and calls `catch_fn` if unwinding occurs while `try_fn` runs.
     ///
@@ -2638,25 +2771,32 @@ extern "rust-intrinsic" {
     /// in ways that are not allowed for regular writes).
     #[rustc_nounwind]
     pub fn nontemporal_store<T>(ptr: *mut T, val: T);
+}
 
-    /// See documentation of `<*const T>::offset_from` for details.
-    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_offset_from", since = "1.65.0"))]
-    #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-    #[rustc_nounwind]
-    pub fn ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize;
+/// See documentation of `<*const T>::offset_from` for details.
+#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_offset_from", since = "1.65.0"))]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn ptr_offset_from<T>(_ptr: *const T, _base: *const T) -> isize {
+    unimplemented!()
+}
 
-    /// See documentation of `<*const T>::sub_ptr` for details.
-    #[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
-    #[rustc_nounwind]
-    pub fn ptr_offset_from_unsigned<T>(ptr: *const T, base: *const T) -> usize;
+/// See documentation of `<*const T>::sub_ptr` for details.
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892"))]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn ptr_offset_from_unsigned<T>(_ptr: *const T, _base: *const T) -> usize {
+    unimplemented!()
 }
 
 /// See documentation of `<*const T>::guaranteed_eq` for details.
 /// Returns `2` if the result is unknown.
 /// Returns `1` if the pointers are guaranteed equal
 /// Returns `0` if the pointers are guaranteed inequal
-#[rustc_const_unstable(feature = "const_raw_ptr_comparison", issue = "53020")]
-#[unstable(feature = "core_intrinsics", issue = "none")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_raw_ptr_comparison", issue = "53020"))]
 #[rustc_intrinsic]
 #[rustc_nounwind]
 #[rustc_do_not_const_check]
@@ -2666,59 +2806,71 @@ pub const fn ptr_guaranteed_cmp<T>(ptr: *const T, other: *const T) -> u8 {
     (ptr == other) as u8
 }
 
-extern "rust-intrinsic" {
-    /// Determines whether the raw bytes of the two values are equal.
-    ///
-    /// This is particularly handy for arrays, since it allows things like just
-    /// comparing `i96`s instead of forcing `alloca`s for `[6 x i16]`.
-    ///
-    /// Above some backend-decided threshold this will emit calls to `memcmp`,
-    /// like slice equality does, instead of causing massive code size.
-    ///
-    /// Since this works by comparing the underlying bytes, the actual `T` is
-    /// not particularly important.  It will be used for its size and alignment,
-    /// but any validity restrictions will be ignored, not enforced.
-    ///
-    /// # Safety
-    ///
-    /// It's UB to call this if any of the *bytes* in `*a` or `*b` are uninitialized.
-    /// Note that this is a stricter criterion than just the *values* being
-    /// fully-initialized: if `T` has padding, it's UB to call this intrinsic.
-    ///
-    /// At compile-time, it is furthermore UB to call this if any of the bytes
-    /// in `*a` or `*b` have provenance.
-    ///
-    /// (The implementation is allowed to branch on the results of comparisons,
-    /// which is UB if any of their inputs are `undef`.)
-    #[rustc_const_unstable(feature = "const_intrinsic_raw_eq", issue = "none")]
-    #[rustc_nounwind]
-    pub fn raw_eq<T>(a: &T, b: &T) -> bool;
+/// Determines whether the raw bytes of the two values are equal.
+///
+/// This is particularly handy for arrays, since it allows things like just
+/// comparing `i96`s instead of forcing `alloca`s for `[6 x i16]`.
+///
+/// Above some backend-decided threshold this will emit calls to `memcmp`,
+/// like slice equality does, instead of causing massive code size.
+///
+/// Since this works by comparing the underlying bytes, the actual `T` is
+/// not particularly important.  It will be used for its size and alignment,
+/// but any validity restrictions will be ignored, not enforced.
+///
+/// # Safety
+///
+/// It's UB to call this if any of the *bytes* in `*a` or `*b` are uninitialized.
+/// Note that this is a stricter criterion than just the *values* being
+/// fully-initialized: if `T` has padding, it's UB to call this intrinsic.
+///
+/// At compile-time, it is furthermore UB to call this if any of the bytes
+/// in `*a` or `*b` have provenance.
+///
+/// (The implementation is allowed to branch on the results of comparisons,
+/// which is UB if any of their inputs are `undef`.)
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_intrinsic_raw_eq", issue = "none"))]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn raw_eq<T>(_a: &T, _b: &T) -> bool {
+    unimplemented!()
+}
 
-    /// Lexicographically compare `[left, left + bytes)` and `[right, right + bytes)`
-    /// as unsigned bytes, returning negative if `left` is less, zero if all the
-    /// bytes match, or positive if `left` is greater.
-    ///
-    /// This underlies things like `<[u8]>::cmp`, and will usually lower to `memcmp`.
-    ///
-    /// # Safety
-    ///
-    /// `left` and `right` must each be [valid] for reads of `bytes` bytes.
-    ///
-    /// Note that this applies to the whole range, not just until the first byte
-    /// that differs.  That allows optimizations that can read in large chunks.
-    ///
-    /// [valid]: crate::ptr#safety
-    #[rustc_const_unstable(feature = "const_intrinsic_compare_bytes", issue = "none")]
-    #[rustc_nounwind]
-    pub fn compare_bytes(left: *const u8, right: *const u8, bytes: usize) -> i32;
+/// Lexicographically compare `[left, left + bytes)` and `[right, right + bytes)`
+/// as unsigned bytes, returning negative if `left` is less, zero if all the
+/// bytes match, or positive if `left` is greater.
+///
+/// This underlies things like `<[u8]>::cmp`, and will usually lower to `memcmp`.
+///
+/// # Safety
+///
+/// `left` and `right` must each be [valid] for reads of `bytes` bytes.
+///
+/// Note that this applies to the whole range, not just until the first byte
+/// that differs.  That allows optimizations that can read in large chunks.
+///
+/// [valid]: crate::ptr#safety
+#[cfg_attr(
+    bootstrap,
+    rustc_const_unstable(feature = "const_intrinsic_compare_bytes", issue = "none")
+)]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn compare_bytes(_left: *const u8, _right: *const u8, _bytes: usize) -> i32 {
+    unimplemented!()
+}
 
-    /// See documentation of [`std::hint::black_box`] for details.
-    ///
-    /// [`std::hint::black_box`]: crate::hint::black_box
-    #[rustc_const_unstable(feature = "const_black_box", issue = "none")]
-    #[rustc_safe_intrinsic]
-    #[rustc_nounwind]
-    pub fn black_box<T>(dummy: T) -> T;
+/// See documentation of [`std::hint::black_box`] for details.
+///
+/// [`std::hint::black_box`]: crate::hint::black_box
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_black_box", issue = "none"))]
+#[rustc_nounwind]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const fn black_box<T>(_dummy: T) -> T {
+    unimplemented!()
 }
 
 /// Selects which function to call depending on the context.
@@ -2886,7 +3038,7 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
 #[rustc_nounwind]
 #[inline]
 #[rustc_intrinsic]
-// This has fallback `const fn` MIR, so shouldn't need stability, see #122652
+// Const-unstable because `swap_nonoverlapping` is const-unstable.
 #[rustc_const_unstable(feature = "const_typed_swap", issue = "none")]
 pub const unsafe fn typed_swap<T>(x: *mut T, y: *mut T) {
     // SAFETY: The caller provided single non-overlapping items behind
@@ -2908,8 +3060,7 @@ pub const unsafe fn typed_swap<T>(x: *mut T, y: *mut T) {
 /// user has UB checks disabled, the checks will still get optimized out. This intrinsic is
 /// primarily used by [`ub_checks::assert_unsafe_precondition`].
 #[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_ub_checks", issue = "none"))]
-#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)] // just for UB checks
-#[unstable(feature = "core_intrinsics", issue = "none")]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)] // just for UB checks
 #[inline(always)]
 #[rustc_intrinsic]
 pub const fn ub_checks() -> bool {
@@ -2925,7 +3076,6 @@ pub const fn ub_checks() -> bool {
 ///    - At compile time, a compile error occurs if this constraint is violated.
 ///    - At runtime, it is not checked.
 #[rustc_const_unstable(feature = "const_heap", issue = "79597")]
-#[unstable(feature = "core_intrinsics", issue = "none")]
 #[rustc_nounwind]
 #[rustc_intrinsic]
 #[miri::intrinsic_fallback_is_spec]
@@ -2994,7 +3144,7 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
 #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_size_of", since = "1.40.0"))]
-#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn size_of<T>() -> usize {
@@ -3012,7 +3162,7 @@ pub const fn size_of<T>() -> usize {
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
 #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_min_align_of", since = "1.40.0"))]
-#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn min_align_of<T>() -> usize {
@@ -3025,7 +3175,7 @@ pub const fn min_align_of<T>() -> usize {
 /// It's "tracking issue" is [#91971](https://github.com/rust-lang/rust/issues/91971).
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
-#[rustc_const_unstable(feature = "const_pref_align_of", issue = "91971")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_pref_align_of", issue = "91971"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn pref_align_of<T>() -> usize {
@@ -3043,7 +3193,7 @@ pub const unsafe fn pref_align_of<T>() -> usize {
 /// The to-be-stabilized version of this intrinsic is [`crate::mem::variant_count`].
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
-#[rustc_const_unstable(feature = "variant_count", issue = "73662")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "variant_count", issue = "73662"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn variant_count<T>() -> usize {
@@ -3059,7 +3209,7 @@ pub const fn variant_count<T>() -> usize {
 /// See [`crate::mem::size_of_val_raw`] for safety conditions.
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
-#[rustc_const_unstable(feature = "const_size_of_val", issue = "46571")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_size_of_val", issue = "46571"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn size_of_val<T: ?Sized>(_ptr: *const T) -> usize {
@@ -3075,7 +3225,7 @@ pub const unsafe fn size_of_val<T: ?Sized>(_ptr: *const T) -> usize {
 /// See [`crate::mem::align_of_val_raw`] for safety conditions.
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
-#[rustc_const_unstable(feature = "const_align_of_val", issue = "46571")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_align_of_val", issue = "46571"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn min_align_of_val<T: ?Sized>(_ptr: *const T) -> usize {
@@ -3092,7 +3242,7 @@ pub const unsafe fn min_align_of_val<T: ?Sized>(_ptr: *const T) -> usize {
 /// The stabilized version of this intrinsic is [`core::any::type_name`].
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
-#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_type_name", issue = "63084"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn type_name<T: ?Sized>() -> &'static str {
@@ -3111,7 +3261,7 @@ pub const fn type_name<T: ?Sized>() -> &'static str {
 /// The stabilized version of this intrinsic is [`core::any::TypeId::of`].
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
-#[rustc_const_unstable(feature = "const_type_id", issue = "77125")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_type_id", issue = "77125"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn type_id<T: ?Sized + 'static>() -> u128 {
@@ -3126,7 +3276,7 @@ pub const fn type_id<T: ?Sized + 'static>() -> u128 {
 #[rustc_nounwind]
 #[unstable(feature = "core_intrinsics", issue = "none")]
 #[cfg_attr(bootstrap, rustc_const_stable(feature = "ptr_metadata_const", since = "1.83.0"))]
-#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn aggregate_raw_ptr<P: AggregateRawPtr<D, Metadata = M>, D, M>(_data: D, _meta: M) -> P {
@@ -3155,7 +3305,7 @@ impl<P: ?Sized, T: ptr::Thin> AggregateRawPtr<*mut T> for *mut P {
     bootstrap,
     cfg_attr(bootstrap, rustc_const_stable(feature = "ptr_metadata_const", since = "1.83.0"))
 )]
-#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
+#[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(_ptr: *const P) -> M {
@@ -3261,18 +3411,13 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(_ptr: *cons
 #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
 #[rustc_diagnostic_item = "ptr_copy_nonoverlapping"]
 pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
-    extern "rust-intrinsic" {
-        #[cfg_attr(
-            bootstrap,
-            rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")
-        )]
-        #[cfg_attr(
-            not(bootstrap),
-            rustc_const_unstable(feature = "core_intrinsics", issue = "none")
-        )]
-        #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-        #[rustc_nounwind]
-        pub fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
+    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0"))]
+    #[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+    #[rustc_nounwind]
+    #[rustc_intrinsic]
+    #[rustc_intrinsic_must_be_overridden]
+    const unsafe fn copy_nonoverlapping<T>(_src: *const T, _dst: *mut T, _count: usize) {
+        unreachable!()
     }
 
     ub_checks::assert_unsafe_precondition!(
@@ -3373,18 +3518,13 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
 #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
 #[rustc_diagnostic_item = "ptr_copy"]
 pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
-    extern "rust-intrinsic" {
-        #[cfg_attr(
-            bootstrap,
-            rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")
-        )]
-        #[cfg_attr(
-            not(bootstrap),
-            rustc_const_unstable(feature = "core_intrinsics", issue = "none")
-        )]
-        #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-        #[rustc_nounwind]
-        fn copy<T>(src: *const T, dst: *mut T, count: usize);
+    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0"))]
+    #[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+    #[rustc_nounwind]
+    #[rustc_intrinsic]
+    #[rustc_intrinsic_must_be_overridden]
+    const unsafe fn copy<T>(_src: *const T, _dst: *mut T, _count: usize) {
+        unreachable!()
     }
 
     // SAFETY: the safety contract for `copy` must be upheld by the caller.
@@ -3462,11 +3602,13 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
 #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
 #[rustc_diagnostic_item = "ptr_write_bytes"]
 pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
-    extern "rust-intrinsic" {
-        #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_write", since = "1.83.0"))]
-        #[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
-        #[rustc_nounwind]
-        fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
+    #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_ptr_write", since = "1.83.0"))]
+    #[cfg_attr(not(bootstrap), rustc_const_stable_intrinsic)]
+    #[rustc_nounwind]
+    #[rustc_intrinsic]
+    #[rustc_intrinsic_must_be_overridden]
+    const unsafe fn write_bytes<T>(_dst: *mut T, _val: u8, _count: usize) {
+        unreachable!()
     }
 
     // SAFETY: the safety contract for `write_bytes` must be upheld by the caller.
@@ -3494,8 +3636,7 @@ pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
 /// The stabilized version of this intrinsic is
 /// [`f16::min`]
 #[rustc_nounwind]
-// #[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
-#[rustc_const_unstable(feature = "f16", issue = "116909")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "f16", issue = "116909"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn minnumf16(_x: f16, _y: f16) -> f16 {
@@ -3512,7 +3653,7 @@ pub const fn minnumf16(_x: f16, _y: f16) -> f16 {
 /// The stabilized version of this intrinsic is
 /// [`f32::min`]
 #[rustc_nounwind]
-#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_float_methods", issue = "130843"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn minnumf32(_x: f32, _y: f32) -> f32 {
@@ -3529,7 +3670,7 @@ pub const fn minnumf32(_x: f32, _y: f32) -> f32 {
 /// The stabilized version of this intrinsic is
 /// [`f64::min`]
 #[rustc_nounwind]
-#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_float_methods", issue = "130843"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn minnumf64(_x: f64, _y: f64) -> f64 {
@@ -3546,8 +3687,7 @@ pub const fn minnumf64(_x: f64, _y: f64) -> f64 {
 /// The stabilized version of this intrinsic is
 /// [`f128::min`]
 #[rustc_nounwind]
-// #[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
-#[rustc_const_unstable(feature = "f128", issue = "116909")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "f128", issue = "116909"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn minnumf128(_x: f128, _y: f128) -> f128 {
@@ -3564,8 +3704,7 @@ pub const fn minnumf128(_x: f128, _y: f128) -> f128 {
 /// The stabilized version of this intrinsic is
 /// [`f16::max`]
 #[rustc_nounwind]
-// #[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
-#[rustc_const_unstable(feature = "f16", issue = "116909")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "f16", issue = "116909"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn maxnumf16(_x: f16, _y: f16) -> f16 {
@@ -3582,7 +3721,7 @@ pub const fn maxnumf16(_x: f16, _y: f16) -> f16 {
 /// The stabilized version of this intrinsic is
 /// [`f32::max`]
 #[rustc_nounwind]
-#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_float_methods", issue = "130843"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn maxnumf32(_x: f32, _y: f32) -> f32 {
@@ -3599,7 +3738,7 @@ pub const fn maxnumf32(_x: f32, _y: f32) -> f32 {
 /// The stabilized version of this intrinsic is
 /// [`f64::max`]
 #[rustc_nounwind]
-#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_float_methods", issue = "130843"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn maxnumf64(_x: f64, _y: f64) -> f64 {
@@ -3616,8 +3755,7 @@ pub const fn maxnumf64(_x: f64, _y: f64) -> f64 {
 /// The stabilized version of this intrinsic is
 /// [`f128::max`]
 #[rustc_nounwind]
-// #[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
-#[rustc_const_unstable(feature = "f128", issue = "116909")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "f128", issue = "116909"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const fn maxnumf128(_x: f128, _y: f128) -> f128 {
@@ -3629,8 +3767,7 @@ pub const fn maxnumf128(_x: f128, _y: f128) -> f128 {
 /// The stabilized version of this intrinsic is
 /// [`f16::abs`](../../std/primitive.f16.html#method.abs)
 #[rustc_nounwind]
-// #[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
-#[rustc_const_unstable(feature = "f16", issue = "116909")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "f16", issue = "116909"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn fabsf16(_x: f16) -> f16 {
@@ -3642,7 +3779,7 @@ pub const unsafe fn fabsf16(_x: f16) -> f16 {
 /// The stabilized version of this intrinsic is
 /// [`f32::abs`](../../std/primitive.f32.html#method.abs)
 #[rustc_nounwind]
-#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_float_methods", issue = "130843"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn fabsf32(_x: f32) -> f32 {
@@ -3654,7 +3791,7 @@ pub const unsafe fn fabsf32(_x: f32) -> f32 {
 /// The stabilized version of this intrinsic is
 /// [`f64::abs`](../../std/primitive.f64.html#method.abs)
 #[rustc_nounwind]
-#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_float_methods", issue = "130843"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn fabsf64(_x: f64) -> f64 {
@@ -3666,8 +3803,7 @@ pub const unsafe fn fabsf64(_x: f64) -> f64 {
 /// The stabilized version of this intrinsic is
 /// [`f128::abs`](../../std/primitive.f128.html#method.abs)
 #[rustc_nounwind]
-// #[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
-#[rustc_const_unstable(feature = "f128", issue = "116909")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "f128", issue = "116909"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn fabsf128(_x: f128) -> f128 {
@@ -3679,8 +3815,7 @@ pub const unsafe fn fabsf128(_x: f128) -> f128 {
 /// The stabilized version of this intrinsic is
 /// [`f16::copysign`](../../std/primitive.f16.html#method.copysign)
 #[rustc_nounwind]
-// #[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
-#[rustc_const_unstable(feature = "f16", issue = "116909")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "f16", issue = "116909"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn copysignf16(_x: f16, _y: f16) -> f16 {
@@ -3692,7 +3827,7 @@ pub const unsafe fn copysignf16(_x: f16, _y: f16) -> f16 {
 /// The stabilized version of this intrinsic is
 /// [`f32::copysign`](../../std/primitive.f32.html#method.copysign)
 #[rustc_nounwind]
-#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_float_methods", issue = "130843"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn copysignf32(_x: f32, _y: f32) -> f32 {
@@ -3703,7 +3838,7 @@ pub const unsafe fn copysignf32(_x: f32, _y: f32) -> f32 {
 /// The stabilized version of this intrinsic is
 /// [`f64::copysign`](../../std/primitive.f64.html#method.copysign)
 #[rustc_nounwind]
-#[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_float_methods", issue = "130843"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn copysignf64(_x: f64, _y: f64) -> f64 {
@@ -3715,8 +3850,7 @@ pub const unsafe fn copysignf64(_x: f64, _y: f64) -> f64 {
 /// The stabilized version of this intrinsic is
 /// [`f128::copysign`](../../std/primitive.f128.html#method.copysign)
 #[rustc_nounwind]
-// #[rustc_const_unstable(feature = "const_float_methods", issue = "130843")]
-#[rustc_const_unstable(feature = "f128", issue = "116909")]
+#[cfg_attr(bootstrap, rustc_const_unstable(feature = "f128", issue = "116909"))]
 #[rustc_intrinsic]
 #[rustc_intrinsic_must_be_overridden]
 pub const unsafe fn copysignf128(_x: f128, _y: f128) -> f128 {
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 12f6997dbea..444f733adff 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -107,6 +107,7 @@
 //
 // Library features:
 // tidy-alphabetical-start
+#![cfg_attr(bootstrap, feature(const_exact_div))]
 #![cfg_attr(bootstrap, feature(const_fmt_arguments_new))]
 #![feature(array_ptr_get)]
 #![feature(asm_experimental_arch)]
@@ -116,7 +117,6 @@
 #![feature(const_black_box)]
 #![feature(const_char_encode_utf16)]
 #![feature(const_eval_select)]
-#![feature(const_exact_div)]
 #![feature(const_float_methods)]
 #![feature(const_heap)]
 #![feature(const_nonnull_new)]
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index 0c5bf585647..b9706ea2a9e 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -1,4 +1,5 @@
 // tidy-alphabetical-start
+#![cfg_attr(bootstrap, feature(const_three_way_compare))]
 #![cfg_attr(bootstrap, feature(strict_provenance))]
 #![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
 #![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
@@ -22,7 +23,6 @@
 #![feature(const_nonnull_new)]
 #![feature(const_option_ext)]
 #![feature(const_pin_2)]
-#![feature(const_three_way_compare)]
 #![feature(const_trait_impl)]
 #![feature(core_intrinsics)]
 #![feature(core_io_borrowed_buf)]
diff --git a/library/rustc-std-workspace-core/README.md b/library/rustc-std-workspace-core/README.md
index 40e0b62afab..55a36e74106 100644
--- a/library/rustc-std-workspace-core/README.md
+++ b/library/rustc-std-workspace-core/README.md
@@ -27,3 +27,6 @@ it'll look like
 
 when Cargo invokes the compiler, satisfying the implicit `extern crate core`
 directive injected by the compiler.
+
+The sources for the crates.io version can be found in
+[`src/rustc-std-workspace`](../../src/rustc-std-workspace).
diff --git a/src/doc/edition-guide b/src/doc/edition-guide
-Subproject 1f07c242f8162a711a5ac5a4ea8fa7ec884ee7a
+Subproject 2d482e203eb6d6e353814cf1415c5f94e590b9e
diff --git a/src/doc/reference b/src/doc/reference
-Subproject 23ce619966541bf2c80d45fdfeecf3393e360a1
+Subproject da0f6dad767670da0e8cd5af8a7090db3272f62
diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example
-Subproject 8bede1b919a81ab7d0c961f6bbf68d3efa297bd
+Subproject 9db78608b17d5f4a6c033b8a3038466b87d6320
diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide
-Subproject 59d94ea75a0b157e148af14c73c2dd60efb7b60
+Subproject 6a5accdaf10255882b1e6c59dfe5f1c79ac9548
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index c367eed53e0..992be651dbe 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2907,7 +2907,7 @@ fn clean_extern_crate<'tcx>(
                     None => false,
                 }
         })
-        && !cx.output_format.is_json();
+        && !cx.is_json_output();
 
     let krate_owner_def_id = krate.owner_id.def_id;
     if please_inline {
@@ -3000,7 +3000,7 @@ fn clean_use_statement_inner<'tcx>(
     // forcefully don't inline if this is not public or if the
     // #[doc(no_inline)] attribute is present.
     // Don't inline doc(hidden) imports so they can be stripped at a later stage.
-    let mut denied = cx.output_format.is_json()
+    let mut denied = cx.is_json_output()
         || !(visibility.is_public()
             || (cx.render_options.document_private && is_visible_from_parent_mod))
         || pub_underscore
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 0f7d4d3e8f3..7ba3cfb66bd 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -121,6 +121,13 @@ impl<'tcx> DocContext<'tcx> {
             _ => None,
         }
     }
+
+    /// Returns `true` if the JSON output format is enabled for generating the crate content.
+    ///
+    /// If another option like `--show-coverage` is enabled, it will return `false`.
+    pub(crate) fn is_json_output(&self) -> bool {
+        self.output_format.is_json() && !self.show_coverage
+    }
 }
 
 /// Creates a new `DiagCtxt` that can be used to emit warnings and errors.
diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs
index d27e737764d..9f9a093da8a 100644
--- a/src/librustdoc/passes/calculate_doc_coverage.rs
+++ b/src/librustdoc/passes/calculate_doc_coverage.rs
@@ -132,6 +132,7 @@ impl<'a, 'b> CoverageCalculator<'a, 'b> {
 
     fn print_results(&self) {
         let output_format = self.ctx.output_format;
+        // In this case we want to ensure that the `OutputFormat` is JSON and NOT the `DocContext`.
         if output_format.is_json() {
             println!("{}", self.to_json());
             return;
diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs
index aba04283e59..4ef5f7f20a9 100644
--- a/src/librustdoc/passes/strip_hidden.rs
+++ b/src/librustdoc/passes/strip_hidden.rs
@@ -23,7 +23,7 @@ pub(crate) const STRIP_HIDDEN: Pass = Pass {
 /// Strip items marked `#[doc(hidden)]`
 pub(crate) fn strip_hidden(krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate {
     let mut retained = ItemIdSet::default();
-    let is_json_output = cx.output_format.is_json() && !cx.show_coverage;
+    let is_json_output = cx.is_json_output();
 
     // strip all #[doc(hidden)] items
     let krate = {
diff --git a/src/librustdoc/passes/strip_priv_imports.rs b/src/librustdoc/passes/strip_priv_imports.rs
index 2e9f06bd0a3..b9b2431f06f 100644
--- a/src/librustdoc/passes/strip_priv_imports.rs
+++ b/src/librustdoc/passes/strip_priv_imports.rs
@@ -13,7 +13,7 @@ pub(crate) const STRIP_PRIV_IMPORTS: Pass = Pass {
 };
 
 pub(crate) fn strip_priv_imports(krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate {
-    let is_json_output = cx.output_format.is_json() && !cx.show_coverage;
+    let is_json_output = cx.is_json_output();
     ImportStripper {
         tcx: cx.tcx,
         is_json_output,
diff --git a/src/librustdoc/passes/strip_private.rs b/src/librustdoc/passes/strip_private.rs
index 78f0ad27740..1bd8a7838ec 100644
--- a/src/librustdoc/passes/strip_private.rs
+++ b/src/librustdoc/passes/strip_private.rs
@@ -18,7 +18,7 @@ pub(crate) const STRIP_PRIVATE: Pass = Pass {
 pub(crate) fn strip_private(mut krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate {
     // This stripper collects all *retained* nodes.
     let mut retained = ItemIdSet::default();
-    let is_json_output = cx.output_format.is_json() && !cx.show_coverage;
+    let is_json_output = cx.is_json_output();
 
     // strip all private items
     {
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index f789aca7378..31c33fbf497 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -235,7 +235,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
             return false;
         }
 
-        if self.cx.output_format.is_json() {
+        if self.cx.is_json_output() {
             return false;
         }
 
diff --git a/src/rustc-std-workspace/README.md b/src/rustc-std-workspace/README.md
new file mode 100644
index 00000000000..a8e925f243d
--- /dev/null
+++ b/src/rustc-std-workspace/README.md
@@ -0,0 +1,4 @@
+See [`library/rustc-std-workspace-core/README.md`](../../library/rustc-std-workspace-core/README.md) for context.
+
+These are the crates.io versions of these crates, as opposed to the versions
+in `library` which are the ones used inside the rustc workspace.
diff --git a/src/rustc-std-workspace/rustc-std-workspace-alloc/Cargo.toml b/src/rustc-std-workspace/rustc-std-workspace-alloc/Cargo.toml
new file mode 100644
index 00000000000..1a8ebdcfeae
--- /dev/null
+++ b/src/rustc-std-workspace/rustc-std-workspace-alloc/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "rustc-std-workspace-alloc"
+version = "1.0.1"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
+edition = "2021"
+license = 'MIT/Apache-2.0'
+description = """
+crate for integration of crates.io crates into rust-lang/rust standard library workspace
+"""
+
+repository = "https://github.com/rust-lang/rust/tree/master/src/rustc-std-workspace"
diff --git a/src/rustc-std-workspace/rustc-std-workspace-alloc/src/lib.rs b/src/rustc-std-workspace/rustc-std-workspace-alloc/src/lib.rs
new file mode 100644
index 00000000000..938b8bb29b6
--- /dev/null
+++ b/src/rustc-std-workspace/rustc-std-workspace-alloc/src/lib.rs
@@ -0,0 +1,3 @@
+#![no_std]
+extern crate alloc as the_alloc;
+pub use the_alloc::*;
diff --git a/src/rustc-std-workspace/rustc-std-workspace-core/Cargo.toml b/src/rustc-std-workspace/rustc-std-workspace-core/Cargo.toml
new file mode 100644
index 00000000000..116cf3fb6bc
--- /dev/null
+++ b/src/rustc-std-workspace/rustc-std-workspace-core/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "rustc-std-workspace-core"
+version = "1.0.1"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
+edition = "2021"
+license = "MIT/Apache-2.0"
+description = """
+crate for integration of crates.io crates into rust-lang/rust standard library workspace
+"""
+
+repository = "https://github.com/rust-lang/rust/tree/master/src/rustc-std-workspace"
diff --git a/src/rustc-std-workspace/rustc-std-workspace-core/src/lib.rs b/src/rustc-std-workspace/rustc-std-workspace-core/src/lib.rs
new file mode 100644
index 00000000000..38b1615a024
--- /dev/null
+++ b/src/rustc-std-workspace/rustc-std-workspace-core/src/lib.rs
@@ -0,0 +1,3 @@
+#![no_std]
+extern crate core as the_core;
+pub use the_core::*;
diff --git a/src/rustc-std-workspace/rustc-std-workspace-std/Cargo.toml b/src/rustc-std-workspace/rustc-std-workspace-std/Cargo.toml
new file mode 100644
index 00000000000..fcd1ca3deaf
--- /dev/null
+++ b/src/rustc-std-workspace/rustc-std-workspace-std/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "rustc-std-workspace-std"
+version = "1.0.1"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
+edition = "2021"
+license = "MIT/Apache-2.0"
+description = """
+crate for integration of crates.io crates into rust-lang/rust standard library workspace
+"""
+
+repository = "https://github.com/rust-lang/rust/tree/master/src/rustc-std-workspace"
diff --git a/src/rustc-std-workspace/rustc-std-workspace-std/src/lib.rs b/src/rustc-std-workspace/rustc-std-workspace-std/src/lib.rs
new file mode 100644
index 00000000000..f40d09cafbb
--- /dev/null
+++ b/src/rustc-std-workspace/rustc-std-workspace-std/src/lib.rs
@@ -0,0 +1 @@
+pub use std::*;
diff --git a/src/tools/clippy/clippy_lints/src/attrs/allow_attributes.rs b/src/tools/clippy/clippy_lints/src/attrs/allow_attributes.rs
index a5a7b9f74a6..1879391ec29 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/allow_attributes.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/allow_attributes.rs
@@ -3,11 +3,11 @@ use clippy_utils::diagnostics::span_lint_and_then;
 use clippy_utils::is_from_proc_macro;
 use rustc_ast::{AttrStyle, Attribute};
 use rustc_errors::Applicability;
-use rustc_lint::{LateContext, LintContext};
+use rustc_lint::{EarlyContext, LintContext};
 use rustc_middle::lint::in_external_macro;
 
 // Separate each crate's features.
-pub fn check<'cx>(cx: &LateContext<'cx>, attr: &'cx Attribute) {
+pub fn check<'cx>(cx: &EarlyContext<'cx>, attr: &'cx Attribute) {
     if !in_external_macro(cx.sess(), attr.span)
         && let AttrStyle::Outer = attr.style
         && let Some(ident) = attr.ident()
diff --git a/src/tools/clippy/clippy_lints/src/attrs/allow_attributes_without_reason.rs b/src/tools/clippy/clippy_lints/src/attrs/allow_attributes_without_reason.rs
index 5d4e864b9b0..788377fe83c 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/allow_attributes_without_reason.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/allow_attributes_without_reason.rs
@@ -2,12 +2,12 @@ use super::{ALLOW_ATTRIBUTES_WITHOUT_REASON, Attribute};
 use clippy_utils::diagnostics::span_lint_and_then;
 use clippy_utils::is_from_proc_macro;
 use rustc_ast::{MetaItemInner, MetaItemKind};
-use rustc_lint::{LateContext, LintContext};
+use rustc_lint::{EarlyContext, LintContext};
 use rustc_middle::lint::in_external_macro;
 use rustc_span::sym;
 use rustc_span::symbol::Symbol;
 
-pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[MetaItemInner], attr: &'cx Attribute) {
+pub(super) fn check<'cx>(cx: &EarlyContext<'cx>, name: Symbol, items: &[MetaItemInner], attr: &'cx Attribute) {
     // Check if the reason is present
     if let Some(item) = items.last().and_then(MetaItemInner::meta_item)
         && let MetaItemKind::NameValue(_) = &item.kind
diff --git a/src/tools/clippy/clippy_lints/src/attrs/blanket_clippy_restriction_lints.rs b/src/tools/clippy/clippy_lints/src/attrs/blanket_clippy_restriction_lints.rs
index 0baf889faa0..fecf3166406 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/blanket_clippy_restriction_lints.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/blanket_clippy_restriction_lints.rs
@@ -2,11 +2,11 @@ use super::BLANKET_CLIPPY_RESTRICTION_LINTS;
 use super::utils::extract_clippy_lint;
 use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_then};
 use rustc_ast::MetaItemInner;
-use rustc_lint::{LateContext, Level, LintContext};
+use rustc_lint::{EarlyContext, Level, LintContext};
 use rustc_span::symbol::Symbol;
 use rustc_span::{DUMMY_SP, sym};
 
-pub(super) fn check(cx: &LateContext<'_>, name: Symbol, items: &[MetaItemInner]) {
+pub(super) fn check(cx: &EarlyContext<'_>, name: Symbol, items: &[MetaItemInner]) {
     for lint in items {
         if let Some(lint_name) = extract_clippy_lint(lint) {
             if lint_name.as_str() == "restriction" && name != sym::allow {
@@ -23,7 +23,7 @@ pub(super) fn check(cx: &LateContext<'_>, name: Symbol, items: &[MetaItemInner])
     }
 }
 
-pub(super) fn check_command_line(cx: &LateContext<'_>) {
+pub(super) fn check_command_line(cx: &EarlyContext<'_>) {
     for (name, level) in &cx.sess().opts.lint_opts {
         if name == "clippy::restriction" && *level > Level::Allow {
             span_lint_and_then(
diff --git a/src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs b/src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs
index 1898c145c76..d3153ec6613 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs
@@ -1,11 +1,11 @@
 use super::DEPRECATED_SEMVER;
 use clippy_utils::diagnostics::span_lint;
 use rustc_ast::{LitKind, MetaItemLit};
-use rustc_lint::LateContext;
+use rustc_lint::EarlyContext;
 use rustc_span::Span;
 use semver::Version;
 
-pub(super) fn check(cx: &LateContext<'_>, span: Span, lit: &MetaItemLit) {
+pub(super) fn check(cx: &EarlyContext<'_>, span: Span, lit: &MetaItemLit) {
     if let LitKind::Str(is, _) = lit.kind {
         if is.as_str() == "TBD" || Version::parse(is.as_str()).is_ok() {
             return;
diff --git a/src/tools/clippy/clippy_lints/src/attrs/duplicated_attributes.rs b/src/tools/clippy/clippy_lints/src/attrs/duplicated_attributes.rs
index 55f8e1072db..2ddbc7a6a76 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/duplicated_attributes.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/duplicated_attributes.rs
@@ -2,12 +2,12 @@ use super::DUPLICATED_ATTRIBUTES;
 use clippy_utils::diagnostics::span_lint_and_then;
 use rustc_ast::{Attribute, MetaItem};
 use rustc_data_structures::fx::FxHashMap;
-use rustc_lint::LateContext;
+use rustc_lint::EarlyContext;
 use rustc_span::{Span, sym};
 use std::collections::hash_map::Entry;
 
 fn emit_if_duplicated(
-    cx: &LateContext<'_>,
+    cx: &EarlyContext<'_>,
     attr: &MetaItem,
     attr_paths: &mut FxHashMap<String, Span>,
     complete_path: String,
@@ -26,7 +26,7 @@ fn emit_if_duplicated(
 }
 
 fn check_duplicated_attr(
-    cx: &LateContext<'_>,
+    cx: &EarlyContext<'_>,
     attr: &MetaItem,
     attr_paths: &mut FxHashMap<String, Span>,
     parent: &mut Vec<String>,
@@ -65,7 +65,7 @@ fn check_duplicated_attr(
     }
 }
 
-pub fn check(cx: &LateContext<'_>, attrs: &[Attribute]) {
+pub fn check(cx: &EarlyContext<'_>, attrs: &[Attribute]) {
     let mut attr_paths = FxHashMap::default();
 
     for attr in attrs {
diff --git a/src/tools/clippy/clippy_lints/src/attrs/mixed_attributes_style.rs b/src/tools/clippy/clippy_lints/src/attrs/mixed_attributes_style.rs
index 5d2ea36b366..32c28c09c36 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/mixed_attributes_style.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/mixed_attributes_style.rs
@@ -3,7 +3,7 @@ use clippy_utils::diagnostics::span_lint;
 use rustc_ast::{AttrKind, AttrStyle, Attribute};
 use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::sync::Lrc;
-use rustc_lint::{LateContext, LintContext};
+use rustc_lint::{EarlyContext, LintContext};
 use rustc_span::source_map::SourceMap;
 use rustc_span::{SourceFile, Span, Symbol};
 
@@ -32,7 +32,7 @@ impl From<&AttrKind> for SimpleAttrKind {
     }
 }
 
-pub(super) fn check(cx: &LateContext<'_>, item_span: Span, attrs: &[Attribute]) {
+pub(super) fn check(cx: &EarlyContext<'_>, item_span: Span, attrs: &[Attribute]) {
     let mut inner_attr_kind: FxHashSet<SimpleAttrKind> = FxHashSet::default();
     let mut outer_attr_kind: FxHashSet<SimpleAttrKind> = FxHashSet::default();
 
@@ -64,7 +64,7 @@ pub(super) fn check(cx: &LateContext<'_>, item_span: Span, attrs: &[Attribute])
     }
 }
 
-fn lint_mixed_attrs(cx: &LateContext<'_>, attrs: &[Attribute]) {
+fn lint_mixed_attrs(cx: &EarlyContext<'_>, attrs: &[Attribute]) {
     let mut attrs_iter = attrs.iter().filter(|attr| !attr.span.from_expansion());
     let span = if let (Some(first), Some(last)) = (attrs_iter.next(), attrs_iter.last()) {
         first.span.with_hi(last.span.hi())
diff --git a/src/tools/clippy/clippy_lints/src/attrs/mod.rs b/src/tools/clippy/clippy_lints/src/attrs/mod.rs
index 1a34ca99fc2..684756ce87f 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/mod.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/mod.rs
@@ -14,8 +14,8 @@ mod utils;
 
 use clippy_config::Conf;
 use clippy_config::msrvs::{self, Msrv};
-use rustc_ast::{Attribute, MetaItemInner, MetaItemKind};
-use rustc_hir::{ImplItem, Item, ItemKind, TraitItem};
+use rustc_ast::{Attribute, MetaItemInner, MetaItemKind, self as ast};
+use rustc_hir::{ImplItem, Item, TraitItem};
 use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass};
 use rustc_session::impl_lint_pass;
 use rustc_span::sym;
@@ -414,15 +414,7 @@ pub struct Attributes {
 }
 
 impl_lint_pass!(Attributes => [
-    ALLOW_ATTRIBUTES,
-    ALLOW_ATTRIBUTES_WITHOUT_REASON,
     INLINE_ALWAYS,
-    DEPRECATED_SEMVER,
-    USELESS_ATTRIBUTE,
-    BLANKET_CLIPPY_RESTRICTION_LINTS,
-    SHOULD_PANIC_WITHOUT_EXPECT,
-    MIXED_ATTRIBUTES_STYLE,
-    DUPLICATED_ATTRIBUTES,
 ]);
 
 impl Attributes {
@@ -434,53 +426,11 @@ impl Attributes {
 }
 
 impl<'tcx> LateLintPass<'tcx> for Attributes {
-    fn check_crate(&mut self, cx: &LateContext<'tcx>) {
-        blanket_clippy_restriction_lints::check_command_line(cx);
-        duplicated_attributes::check(cx, cx.tcx.hir().krate_attrs());
-    }
-
-    fn check_attribute(&mut self, cx: &LateContext<'tcx>, attr: &'tcx Attribute) {
-        if let Some(items) = &attr.meta_item_list() {
-            if let Some(ident) = attr.ident() {
-                if is_lint_level(ident.name, attr.id) {
-                    blanket_clippy_restriction_lints::check(cx, ident.name, items);
-                }
-                if matches!(ident.name, sym::allow) && self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) {
-                    allow_attributes::check(cx, attr);
-                }
-                if matches!(ident.name, sym::allow | sym::expect) && self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION)
-                {
-                    allow_attributes_without_reason::check(cx, ident.name, items, attr);
-                }
-                if items.is_empty() || !attr.has_name(sym::deprecated) {
-                    return;
-                }
-                for item in items {
-                    if let MetaItemInner::MetaItem(mi) = &item
-                        && let MetaItemKind::NameValue(lit) = &mi.kind
-                        && mi.has_name(sym::since)
-                    {
-                        deprecated_semver::check(cx, item.span(), lit);
-                    }
-                }
-            }
-        }
-        if attr.has_name(sym::should_panic) {
-            should_panic_without_expect::check(cx, attr);
-        }
-    }
-
     fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
         let attrs = cx.tcx.hir().attrs(item.hir_id());
         if is_relevant_item(cx, item) {
             inline_always::check(cx, item.span, item.ident.name, attrs);
         }
-        match item.kind {
-            ItemKind::ExternCrate(..) | ItemKind::Use(..) => useless_attribute::check(cx, item, attrs),
-            _ => {},
-        }
-        mixed_attributes_style::check(cx, item.span, attrs);
-        duplicated_attributes::check(cx, attrs);
     }
 
     fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
@@ -526,3 +476,77 @@ impl EarlyLintPass for EarlyAttributes {
 
     extract_msrv_attr!(EarlyContext);
 }
+
+pub struct PostExpansionEarlyAttributes {
+    msrv: Msrv,
+}
+
+impl PostExpansionEarlyAttributes {
+    pub fn new(conf: &'static Conf) -> Self {
+        Self {
+            msrv: conf.msrv.clone(),
+        }
+    }
+}
+
+impl_lint_pass!(PostExpansionEarlyAttributes => [
+    ALLOW_ATTRIBUTES,
+    ALLOW_ATTRIBUTES_WITHOUT_REASON,
+    DEPRECATED_SEMVER,
+    USELESS_ATTRIBUTE,
+    BLANKET_CLIPPY_RESTRICTION_LINTS,
+    SHOULD_PANIC_WITHOUT_EXPECT,
+    MIXED_ATTRIBUTES_STYLE,
+    DUPLICATED_ATTRIBUTES,
+]);
+
+impl EarlyLintPass for PostExpansionEarlyAttributes {
+    fn check_crate(&mut self, cx: &EarlyContext<'_>, krate: &ast::Crate) {
+        blanket_clippy_restriction_lints::check_command_line(cx);
+        duplicated_attributes::check(cx, &krate.attrs);
+    }
+
+    fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) {
+        if let Some(items) = &attr.meta_item_list() {
+            if let Some(ident) = attr.ident() {
+                if matches!(ident.name, sym::allow) && self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) {
+                    allow_attributes::check(cx, attr);
+                }
+                if matches!(ident.name, sym::allow | sym::expect) && self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION)
+                {
+                    allow_attributes_without_reason::check(cx, ident.name, items, attr);
+                }
+                if is_lint_level(ident.name, attr.id) {
+                    blanket_clippy_restriction_lints::check(cx, ident.name, items);
+                }
+                if items.is_empty() || !attr.has_name(sym::deprecated) {
+                    return;
+                }
+                for item in items {
+                    if let MetaItemInner::MetaItem(mi) = &item
+                        && let MetaItemKind::NameValue(lit) = &mi.kind
+                        && mi.has_name(sym::since)
+                    {
+                        deprecated_semver::check(cx, item.span(), lit);
+                    }
+                }
+            }
+        }
+
+        if attr.has_name(sym::should_panic) {
+            should_panic_without_expect::check(cx, attr);
+        }
+    }
+
+    fn check_item(&mut self, cx: &EarlyContext<'_>, item: &'_ ast::Item) {
+        match item.kind {
+            ast::ItemKind::ExternCrate(..) | ast::ItemKind::Use(..) => useless_attribute::check(cx, item, &item.attrs),
+            _ => {},
+        }
+
+        mixed_attributes_style::check(cx, item.span, &item.attrs);
+        duplicated_attributes::check(cx, &item.attrs);
+    }
+
+    extract_msrv_attr!(EarlyContext);
+}
diff --git a/src/tools/clippy/clippy_lints/src/attrs/should_panic_without_expect.rs b/src/tools/clippy/clippy_lints/src/attrs/should_panic_without_expect.rs
index 2d45cbbf621..fadd5272880 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/should_panic_without_expect.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/should_panic_without_expect.rs
@@ -4,12 +4,12 @@ use rustc_ast::token::{Token, TokenKind};
 use rustc_ast::tokenstream::TokenTree;
 use rustc_ast::{AttrArgs, AttrArgsEq, AttrKind};
 use rustc_errors::Applicability;
-use rustc_lint::LateContext;
+use rustc_lint::EarlyContext;
 use rustc_span::sym;
 
-pub(super) fn check(cx: &LateContext<'_>, attr: &Attribute) {
+pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute) {
     if let AttrKind::Normal(normal_attr) = &attr.kind {
-        if let AttrArgs::Eq(_, AttrArgsEq::Hir(_)) = &normal_attr.item.args {
+        if let AttrArgs::Eq(_, AttrArgsEq::Ast(_)) = &normal_attr.item.args {
             // `#[should_panic = ".."]` found, good
             return;
         }
diff --git a/src/tools/clippy/clippy_lints/src/attrs/useless_attribute.rs b/src/tools/clippy/clippy_lints/src/attrs/useless_attribute.rs
index 72e6ce59d59..92b9f9cba52 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/useless_attribute.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/useless_attribute.rs
@@ -1,15 +1,15 @@
 use super::utils::{extract_clippy_lint, is_lint_level, is_word};
-use super::{Attribute, USELESS_ATTRIBUTE};
+use super::USELESS_ATTRIBUTE;
 use clippy_utils::diagnostics::span_lint_and_then;
 use clippy_utils::source::{SpanRangeExt, first_line_of_span};
 use rustc_ast::MetaItemInner;
 use rustc_errors::Applicability;
-use rustc_hir::{Item, ItemKind};
-use rustc_lint::{LateContext, LintContext};
+use rustc_ast::{Item, ItemKind, Attribute};
+use rustc_lint::{EarlyContext, LintContext};
 use rustc_middle::lint::in_external_macro;
 use rustc_span::sym;
 
-pub(super) fn check(cx: &LateContext<'_>, item: &Item<'_>, attrs: &[Attribute]) {
+pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
     let skip_unused_imports = attrs.iter().any(|attr| attr.has_name(sym::macro_use));
 
     for attr in attrs {
diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs
index 14110539709..3fd07ced0e4 100644
--- a/src/tools/clippy/clippy_lints/src/lib.rs
+++ b/src/tools/clippy/clippy_lints/src/lib.rs
@@ -412,6 +412,8 @@ use rustc_lint::{Lint, LintId};
 pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
     // NOTE: Do not add any more pre-expansion passes. These should be removed eventually.
     store.register_pre_expansion_pass(move || Box::new(attrs::EarlyAttributes::new(conf)));
+
+    store.register_early_pass(move || Box::new(attrs::PostExpansionEarlyAttributes::new(conf)));
 }
 
 #[derive(Default)]
diff --git a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs
index bfb3a76ad25..c5e2c8c09a2 100644
--- a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs
+++ b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs
@@ -21,7 +21,7 @@ use rustc_hir::{
     ImplItem, ImplItemKind, IsAuto, Item, ItemKind, Lit, LoopSource, MatchSource, MutTy, Node, Path, QPath, Safety,
     TraitItem, TraitItemKind, Ty, TyKind, UnOp, UnsafeSource, Variant, VariantData, YieldSource,
 };
-use rustc_lint::{LateContext, LintContext};
+use rustc_lint::{LateContext, LintContext, EarlyContext};
 use rustc_middle::ty::TyCtxt;
 use rustc_session::Session;
 use rustc_span::symbol::{Ident, kw};
@@ -429,11 +429,12 @@ impl_with_search_pat!((_cx: LateContext<'tcx>, self: ImplItem<'_>) => impl_item_
 impl_with_search_pat!((_cx: LateContext<'tcx>, self: FieldDef<'_>) => field_def_search_pat(self));
 impl_with_search_pat!((_cx: LateContext<'tcx>, self: Variant<'_>) => variant_search_pat(self));
 impl_with_search_pat!((_cx: LateContext<'tcx>, self: Ty<'_>) => ty_search_pat(self));
-impl_with_search_pat!((_cx: LateContext<'tcx>, self: Attribute) => attr_search_pat(self));
 impl_with_search_pat!((_cx: LateContext<'tcx>, self: Ident) => ident_search_pat(*self));
 impl_with_search_pat!((_cx: LateContext<'tcx>, self: Lit) => lit_search_pat(&self.node));
 impl_with_search_pat!((_cx: LateContext<'tcx>, self: Path<'_>) => path_search_pat(self));
 
+impl_with_search_pat!((_cx: EarlyContext<'tcx>, self: Attribute) => attr_search_pat(self));
+
 impl<'cx> WithSearchPat<'cx> for (&FnKind<'cx>, &Body<'cx>, HirId, Span) {
     type Context = LateContext<'cx>;
 
diff --git a/src/tools/clippy/tests/ui/allow_attributes.stderr b/src/tools/clippy/tests/ui/allow_attributes.stderr
index 10dac0bc808..023b4d7e404 100644
--- a/src/tools/clippy/tests/ui/allow_attributes.stderr
+++ b/src/tools/clippy/tests/ui/allow_attributes.stderr
@@ -19,13 +19,5 @@ error: #[allow] attribute found
 LL |     #[allow(unused)]
    |       ^^^^^ help: replace it with: `expect`
 
-error: #[allow] attribute found
-  --> tests/ui/allow_attributes.rs:52:7
-   |
-LL |     #[allow(unused)]
-   |       ^^^^^ help: replace it with: `expect`
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
diff --git a/src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr b/src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr
index 86d7845df04..9c1ac5af91b 100644
--- a/src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr
+++ b/src/tools/clippy/tests/ui/allow_attributes_without_reason.stderr
@@ -43,14 +43,5 @@ LL |     #[allow(unused)]
    |
    = help: try adding a reason at the end with `, reason = ".."`
 
-error: `allow` attribute without specifying a reason
-  --> tests/ui/allow_attributes_without_reason.rs:46:5
-   |
-LL |     #[allow(unused)]
-   |     ^^^^^^^^^^^^^^^^
-   |
-   = help: try adding a reason at the end with `, reason = ".."`
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: aborting due to 6 previous errors
+error: aborting due to 5 previous errors
 
diff --git a/src/tools/clippy/tests/ui/attrs.stderr b/src/tools/clippy/tests/ui/attrs.stderr
index cd409fc8701..a7fdceaba6f 100644
--- a/src/tools/clippy/tests/ui/attrs.stderr
+++ b/src/tools/clippy/tests/ui/attrs.stderr
@@ -1,12 +1,3 @@
-error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea
-  --> tests/ui/attrs.rs:5:1
-   |
-LL | #[inline(always)]
-   | ^^^^^^^^^^^^^^^^^
-   |
-   = note: `-D clippy::inline-always` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::inline_always)]`
-
 error: the since field must contain a semver-compliant version
   --> tests/ui/attrs.rs:27:14
    |
@@ -22,5 +13,14 @@ error: the since field must contain a semver-compliant version
 LL | #[deprecated(since = "1")]
    |              ^^^^^^^^^^^
 
+error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea
+  --> tests/ui/attrs.rs:5:1
+   |
+LL | #[inline(always)]
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = note: `-D clippy::inline-always` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::inline_always)]`
+
 error: aborting due to 3 previous errors
 
diff --git a/src/tools/clippy/tests/ui/blanket_clippy_restriction_lints.stderr b/src/tools/clippy/tests/ui/blanket_clippy_restriction_lints.stderr
index d410f25b2c2..1bad259b09a 100644
--- a/src/tools/clippy/tests/ui/blanket_clippy_restriction_lints.stderr
+++ b/src/tools/clippy/tests/ui/blanket_clippy_restriction_lints.stderr
@@ -1,12 +1,17 @@
 error: `clippy::restriction` is not meant to be enabled as a group
+   |
+   = note: because of the command line `--warn clippy::restriction`
+   = help: enable the restriction lints you need individually
+   = note: `-D clippy::blanket-clippy-restriction-lints` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::blanket_clippy_restriction_lints)]`
+
+error: `clippy::restriction` is not meant to be enabled as a group
   --> tests/ui/blanket_clippy_restriction_lints.rs:6:9
    |
 LL | #![warn(clippy::restriction)]
    |         ^^^^^^^^^^^^^^^^^^^
    |
    = help: enable the restriction lints you need individually
-   = note: `-D clippy::blanket-clippy-restriction-lints` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::blanket_clippy_restriction_lints)]`
 
 error: `clippy::restriction` is not meant to be enabled as a group
   --> tests/ui/blanket_clippy_restriction_lints.rs:8:9
@@ -24,10 +29,5 @@ LL | #![forbid(clippy::restriction)]
    |
    = help: enable the restriction lints you need individually
 
-error: `clippy::restriction` is not meant to be enabled as a group
-   |
-   = note: because of the command line `--warn clippy::restriction`
-   = help: enable the restriction lints you need individually
-
 error: aborting due to 4 previous errors
 
diff --git a/src/tools/rust-analyzer/.github/workflows/autopublish.yaml b/src/tools/rust-analyzer/.github/workflows/autopublish.yaml
index 4b97637088c..e0135a0269a 100644
--- a/src/tools/rust-analyzer/.github/workflows/autopublish.yaml
+++ b/src/tools/rust-analyzer/.github/workflows/autopublish.yaml
@@ -51,6 +51,7 @@ jobs:
           cargo workspaces rename --from proc-macro-api proc_macro_api
           cargo workspaces rename --from proc-macro-srv proc_macro_srv
           cargo workspaces rename --from project-model project_model
+          cargo workspaces rename --from test-fixture test_fixture
           cargo workspaces rename --from test-utils test_utils
           cargo workspaces rename --from text-edit text_edit
           # Remove library crates from the workspaces so we don't auto-publish them as well
diff --git a/src/tools/rust-analyzer/Cargo.lock b/src/tools/rust-analyzer/Cargo.lock
index 424357e8473..55705de9b2c 100644
--- a/src/tools/rust-analyzer/Cargo.lock
+++ b/src/tools/rust-analyzer/Cargo.lock
@@ -1492,9 +1492,9 @@ dependencies = [
 
 [[package]]
 name = "ra-ap-rustc_abi"
-version = "0.75.0"
+version = "0.76.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d5bc2cfc7264d84215a08875ef90a1d35f76b5c9ad1993515d2da7e4e40b2b4b"
+checksum = "709fde78db053c78c87776ec738677649f791645883f82ff145f68caf9f18e1a"
 dependencies = [
  "bitflags 2.6.0",
  "ra-ap-rustc_index",
@@ -1503,9 +1503,9 @@ dependencies = [
 
 [[package]]
 name = "ra-ap-rustc_index"
-version = "0.75.0"
+version = "0.76.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8929140697812e5dd09e19cf446d85146332363f0dbc125d4214834c34ead96"
+checksum = "da115d496e5abd65e2dceb6883d7597593badfe23fea3439202b8da5a11ea250"
 dependencies = [
  "arrayvec",
  "ra-ap-rustc_index_macros",
@@ -1514,9 +1514,9 @@ dependencies = [
 
 [[package]]
 name = "ra-ap-rustc_index_macros"
-version = "0.75.0"
+version = "0.76.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "514a3f5d04c8b4a2750f29746cc9abb1f78deb7e72e4ad1dc95bbc608f3db157"
+checksum = "be86d06a75a8125c1ace197d5030e6e02721348d32e572baea35c891669ad1e2"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1525,9 +1525,9 @@ dependencies = [
 
 [[package]]
 name = "ra-ap-rustc_lexer"
-version = "0.75.0"
+version = "0.76.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "276fcb1205da071a0cd64416f3f0e198043c11f176c5b501a45dbf0cb33979f2"
+checksum = "b64b46ae0d8f59acc32e64e0085532b831f0d6182d870a7cd86c046c2c46e722"
 dependencies = [
  "unicode-properties",
  "unicode-xid",
@@ -1535,9 +1535,9 @@ dependencies = [
 
 [[package]]
 name = "ra-ap-rustc_parse_format"
-version = "0.75.0"
+version = "0.76.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "961b30b22cfac296b14b72e9f95e79c16cebc8c926872755fb1568a6c4243a62"
+checksum = "dbdaad19ddbd0ff46e947ca8dbb6ae678a112d3938669fb3ad6bfd244917e24b"
 dependencies = [
  "ra-ap-rustc_index",
  "ra-ap-rustc_lexer",
@@ -1545,9 +1545,9 @@ dependencies = [
 
 [[package]]
 name = "ra-ap-rustc_pattern_analysis"
-version = "0.75.0"
+version = "0.76.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "614232513814a4b714fea7f11345d31c0c277bca3089bb6ca1ec20870bfc022a"
+checksum = "dc5761e37c78d98ede9f20f6b66526093d0be66aa256d5cbdf214495843ba74d"
 dependencies = [
  "ra-ap-rustc_index",
  "rustc-hash 2.0.0",
diff --git a/src/tools/rust-analyzer/Cargo.toml b/src/tools/rust-analyzer/Cargo.toml
index 1099d2cb918..94e7de553bf 100644
--- a/src/tools/rust-analyzer/Cargo.toml
+++ b/src/tools/rust-analyzer/Cargo.toml
@@ -84,11 +84,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
 vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
 vfs = { path = "./crates/vfs", version = "0.0.0" }
 
-ra-ap-rustc_lexer = { version = "0.75", default-features = false }
-ra-ap-rustc_parse_format = { version = "0.75", default-features = false }
-ra-ap-rustc_index = { version = "0.75", default-features = false }
-ra-ap-rustc_abi = { version = "0.75", default-features = false }
-ra-ap-rustc_pattern_analysis = { version = "0.75", default-features = false }
+ra-ap-rustc_lexer = { version = "0.76", default-features = false }
+ra-ap-rustc_parse_format = { version = "0.76", default-features = false }
+ra-ap-rustc_index = { version = "0.76", default-features = false }
+ra-ap-rustc_abi = { version = "0.76", default-features = false }
+ra-ap-rustc_pattern_analysis = { version = "0.76", default-features = false }
 
 # local crates that aren't published to crates.io. These should not have versions.
 test-fixture = { path = "./crates/test-fixture" }
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/body/lower.rs b/src/tools/rust-analyzer/crates/hir-def/src/body/lower.rs
index 0b108b54e67..1ab49e91569 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/body/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/body/lower.rs
@@ -407,7 +407,7 @@ impl ExprCollector<'_> {
                 let method_name = e.name_ref().map(|nr| nr.as_name()).unwrap_or_else(Name::missing);
                 let generic_args = e
                     .generic_arg_list()
-                    .and_then(|it| GenericArgs::from_ast(&self.ctx(), it))
+                    .and_then(|it| GenericArgs::from_ast(&mut self.ctx(), it))
                     .map(Box::new);
                 self.alloc_expr(
                     Expr::MethodCall { receiver, method_name, args, generic_args },
@@ -533,7 +533,7 @@ impl ExprCollector<'_> {
             ast::Expr::TryExpr(e) => self.collect_try_operator(syntax_ptr, e),
             ast::Expr::CastExpr(e) => {
                 let expr = self.collect_expr_opt(e.expr());
-                let type_ref = TypeRef::from_ast_opt(&self.ctx(), e.ty());
+                let type_ref = TypeRef::from_ast_opt(&mut self.ctx(), e.ty());
                 self.alloc_expr(Expr::Cast { expr, type_ref }, syntax_ptr)
             }
             ast::Expr::RefExpr(e) => {
@@ -572,13 +572,15 @@ impl ExprCollector<'_> {
                     arg_types.reserve_exact(num_params);
                     for param in pl.params() {
                         let pat = this.collect_pat_top(param.pat());
-                        let type_ref = param.ty().map(|it| TypeRef::from_ast(&this.ctx(), it));
+                        let type_ref = param.ty().map(|it| TypeRef::from_ast(&mut this.ctx(), it));
                         args.push(pat);
                         arg_types.push(type_ref);
                     }
                 }
-                let ret_type =
-                    e.ret_type().and_then(|r| r.ty()).map(|it| TypeRef::from_ast(&this.ctx(), it));
+                let ret_type = e
+                    .ret_type()
+                    .and_then(|r| r.ty())
+                    .map(|it| TypeRef::from_ast(&mut this.ctx(), it));
 
                 let prev_is_lowering_coroutine = mem::take(&mut this.is_lowering_coroutine);
                 let prev_try_block_label = this.current_try_block_label.take();
@@ -705,7 +707,7 @@ impl ExprCollector<'_> {
             ast::Expr::UnderscoreExpr(_) => self.alloc_expr(Expr::Underscore, syntax_ptr),
             ast::Expr::AsmExpr(e) => self.lower_inline_asm(e, syntax_ptr),
             ast::Expr::OffsetOfExpr(e) => {
-                let container = TypeRef::from_ast_opt(&self.ctx(), e.ty());
+                let container = TypeRef::from_ast_opt(&mut self.ctx(), e.ty());
                 let fields = e.fields().map(|it| it.as_name()).collect();
                 self.alloc_expr(Expr::OffsetOf(OffsetOf { container, fields }), syntax_ptr)
             }
@@ -1317,7 +1319,7 @@ impl ExprCollector<'_> {
                     return;
                 }
                 let pat = self.collect_pat_top(stmt.pat());
-                let type_ref = stmt.ty().map(|it| TypeRef::from_ast(&self.ctx(), it));
+                let type_ref = stmt.ty().map(|it| TypeRef::from_ast(&mut self.ctx(), it));
                 let initializer = stmt.initializer().map(|e| self.collect_expr(e));
                 let else_branch = stmt
                     .let_else()
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/data.rs b/src/tools/rust-analyzer/crates/hir-def/src/data.rs
index f49018eaf38..6d07dc8f9be 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/data.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/data.rs
@@ -37,6 +37,7 @@ pub struct FunctionData {
     pub name: Name,
     pub params: Box<[TypeRefId]>,
     pub ret_type: TypeRefId,
+    // FIXME: why are these stored here? They should be accessed via the query
     pub attrs: Attrs,
     pub visibility: RawVisibility,
     pub abi: Option<Symbol>,
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/dyn_map.rs b/src/tools/rust-analyzer/crates/hir-def/src/dyn_map.rs
index a59bbf7e221..22005695af6 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/dyn_map.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/dyn_map.rs
@@ -21,7 +21,79 @@
 //!
 //! This is a work of fiction. Any similarities to Kotlin's `BindingContext` are
 //! a coincidence.
-pub mod keys;
+
+pub mod keys {
+    use std::marker::PhantomData;
+
+    use hir_expand::{attrs::AttrId, MacroCallId};
+    use rustc_hash::FxHashMap;
+    use syntax::{ast, AstNode, AstPtr};
+
+    use crate::{
+        dyn_map::{DynMap, Policy},
+        BlockId, ConstId, EnumId, EnumVariantId, ExternCrateId, FieldId, FunctionId, ImplId,
+        LifetimeParamId, Macro2Id, MacroRulesId, ProcMacroId, StaticId, StructId, TraitAliasId,
+        TraitId, TypeAliasId, TypeOrConstParamId, UnionId, UseId,
+    };
+
+    pub type Key<K, V> = crate::dyn_map::Key<AstPtr<K>, V, AstPtrPolicy<K, V>>;
+
+    pub const BLOCK: Key<ast::BlockExpr, BlockId> = Key::new();
+    pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new();
+    pub const CONST: Key<ast::Const, ConstId> = Key::new();
+    pub const STATIC: Key<ast::Static, StaticId> = Key::new();
+    pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new();
+    pub const IMPL: Key<ast::Impl, ImplId> = Key::new();
+    pub const TRAIT: Key<ast::Trait, TraitId> = Key::new();
+    pub const TRAIT_ALIAS: Key<ast::TraitAlias, TraitAliasId> = Key::new();
+    pub const STRUCT: Key<ast::Struct, StructId> = Key::new();
+    pub const UNION: Key<ast::Union, UnionId> = Key::new();
+    pub const ENUM: Key<ast::Enum, EnumId> = Key::new();
+    pub const EXTERN_CRATE: Key<ast::ExternCrate, ExternCrateId> = Key::new();
+    pub const USE: Key<ast::Use, UseId> = Key::new();
+
+    pub const ENUM_VARIANT: Key<ast::Variant, EnumVariantId> = Key::new();
+    pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new();
+    pub const RECORD_FIELD: Key<ast::RecordField, FieldId> = Key::new();
+    pub const TYPE_PARAM: Key<ast::TypeParam, TypeOrConstParamId> = Key::new();
+    pub const CONST_PARAM: Key<ast::ConstParam, TypeOrConstParamId> = Key::new();
+    pub const LIFETIME_PARAM: Key<ast::LifetimeParam, LifetimeParamId> = Key::new();
+
+    pub const MACRO_RULES: Key<ast::MacroRules, MacroRulesId> = Key::new();
+    pub const MACRO2: Key<ast::MacroDef, Macro2Id> = Key::new();
+    pub const PROC_MACRO: Key<ast::Fn, ProcMacroId> = Key::new();
+    pub const MACRO_CALL: Key<ast::MacroCall, MacroCallId> = Key::new();
+    pub const ATTR_MACRO_CALL: Key<ast::Item, MacroCallId> = Key::new();
+    pub const DERIVE_MACRO_CALL: Key<ast::Attr, (AttrId, MacroCallId, Box<[Option<MacroCallId>]>)> =
+        Key::new();
+
+    /// XXX: AST Nodes and SyntaxNodes have identity equality semantics: nodes are
+    /// equal if they point to exactly the same object.
+    ///
+    /// In general, we do not guarantee that we have exactly one instance of a
+    /// syntax tree for each file. We probably should add such guarantee, but, for
+    /// the time being, we will use identity-less AstPtr comparison.
+    pub struct AstPtrPolicy<AST, ID> {
+        _phantom: PhantomData<(AST, ID)>,
+    }
+
+    impl<AST: AstNode + 'static, ID: 'static> Policy for AstPtrPolicy<AST, ID> {
+        type K = AstPtr<AST>;
+        type V = ID;
+        fn insert(map: &mut DynMap, key: AstPtr<AST>, value: ID) {
+            map.map
+                .entry::<FxHashMap<AstPtr<AST>, ID>>()
+                .or_insert_with(Default::default)
+                .insert(key, value);
+        }
+        fn get<'a>(map: &'a DynMap, key: &AstPtr<AST>) -> Option<&'a ID> {
+            map.map.get::<FxHashMap<AstPtr<AST>, ID>>()?.get(key)
+        }
+        fn is_empty(map: &DynMap) -> bool {
+            map.map.get::<FxHashMap<AstPtr<AST>, ID>>().map_or(true, |it| it.is_empty())
+        }
+    }
+}
 
 use std::{
     hash::Hash,
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/dyn_map/keys.rs b/src/tools/rust-analyzer/crates/hir-def/src/dyn_map/keys.rs
deleted file mode 100644
index 9d330a7bf1c..00000000000
--- a/src/tools/rust-analyzer/crates/hir-def/src/dyn_map/keys.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-//! keys to be used with `DynMap`
-
-use std::marker::PhantomData;
-
-use hir_expand::{attrs::AttrId, MacroCallId};
-use rustc_hash::FxHashMap;
-use syntax::{ast, AstNode, AstPtr};
-
-use crate::{
-    dyn_map::{DynMap, Policy},
-    BlockId, ConstId, EnumId, EnumVariantId, ExternCrateId, FieldId, FunctionId, ImplId,
-    LifetimeParamId, Macro2Id, MacroRulesId, ProcMacroId, StaticId, StructId, TraitAliasId,
-    TraitId, TypeAliasId, TypeOrConstParamId, UnionId, UseId,
-};
-
-pub type Key<K, V> = crate::dyn_map::Key<AstPtr<K>, V, AstPtrPolicy<K, V>>;
-
-pub const BLOCK: Key<ast::BlockExpr, BlockId> = Key::new();
-pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new();
-pub const CONST: Key<ast::Const, ConstId> = Key::new();
-pub const STATIC: Key<ast::Static, StaticId> = Key::new();
-pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new();
-pub const IMPL: Key<ast::Impl, ImplId> = Key::new();
-pub const TRAIT: Key<ast::Trait, TraitId> = Key::new();
-pub const TRAIT_ALIAS: Key<ast::TraitAlias, TraitAliasId> = Key::new();
-pub const STRUCT: Key<ast::Struct, StructId> = Key::new();
-pub const UNION: Key<ast::Union, UnionId> = Key::new();
-pub const ENUM: Key<ast::Enum, EnumId> = Key::new();
-pub const EXTERN_CRATE: Key<ast::ExternCrate, ExternCrateId> = Key::new();
-pub const USE: Key<ast::Use, UseId> = Key::new();
-
-pub const ENUM_VARIANT: Key<ast::Variant, EnumVariantId> = Key::new();
-pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new();
-pub const RECORD_FIELD: Key<ast::RecordField, FieldId> = Key::new();
-pub const TYPE_PARAM: Key<ast::TypeParam, TypeOrConstParamId> = Key::new();
-pub const CONST_PARAM: Key<ast::ConstParam, TypeOrConstParamId> = Key::new();
-pub const LIFETIME_PARAM: Key<ast::LifetimeParam, LifetimeParamId> = Key::new();
-
-pub const MACRO_RULES: Key<ast::MacroRules, MacroRulesId> = Key::new();
-pub const MACRO2: Key<ast::MacroDef, Macro2Id> = Key::new();
-pub const PROC_MACRO: Key<ast::Fn, ProcMacroId> = Key::new();
-pub const MACRO_CALL: Key<ast::MacroCall, MacroCallId> = Key::new();
-pub const ATTR_MACRO_CALL: Key<ast::Item, MacroCallId> = Key::new();
-pub const DERIVE_MACRO_CALL: Key<ast::Attr, (AttrId, MacroCallId, Box<[Option<MacroCallId>]>)> =
-    Key::new();
-
-/// XXX: AST Nodes and SyntaxNodes have identity equality semantics: nodes are
-/// equal if they point to exactly the same object.
-///
-/// In general, we do not guarantee that we have exactly one instance of a
-/// syntax tree for each file. We probably should add such guarantee, but, for
-/// the time being, we will use identity-less AstPtr comparison.
-pub struct AstPtrPolicy<AST, ID> {
-    _phantom: PhantomData<(AST, ID)>,
-}
-
-impl<AST: AstNode + 'static, ID: 'static> Policy for AstPtrPolicy<AST, ID> {
-    type K = AstPtr<AST>;
-    type V = ID;
-    fn insert(map: &mut DynMap, key: AstPtr<AST>, value: ID) {
-        map.map
-            .entry::<FxHashMap<AstPtr<AST>, ID>>()
-            .or_insert_with(Default::default)
-            .insert(key, value);
-    }
-    fn get<'a>(map: &'a DynMap, key: &AstPtr<AST>) -> Option<&'a ID> {
-        map.map.get::<FxHashMap<AstPtr<AST>, ID>>()?.get(key)
-    }
-    fn is_empty(map: &DynMap) -> bool {
-        map.map.get::<FxHashMap<AstPtr<AST>, ID>>().map_or(true, |it| it.is_empty())
-    }
-}
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expander.rs b/src/tools/rust-analyzer/crates/hir-def/src/expander.rs
index d430733fcad..5315c1c6fbd 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/expander.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/expander.rs
@@ -161,14 +161,14 @@ impl Expander {
         types_map: &mut TypesMap,
         types_source_map: &mut TypesSourceMap,
     ) -> Option<Path> {
-        let ctx = LowerCtx::with_span_map_cell(
+        let mut ctx = LowerCtx::with_span_map_cell(
             db,
             self.current_file_id,
             self.span_map.clone(),
             types_map,
             types_source_map,
         );
-        Path::from_src(&ctx, path)
+        Path::from_src(&mut ctx, path)
     }
 
     fn within_limit<F, T: ast::AstNode>(
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/generics.rs b/src/tools/rust-analyzer/crates/hir-def/src/generics.rs
index 6b79850e9c4..11e9bb0d886 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/generics.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/generics.rs
@@ -451,7 +451,7 @@ pub(crate) struct GenericParamsCollector {
 impl GenericParamsCollector {
     pub(crate) fn fill(
         &mut self,
-        lower_ctx: &LowerCtx<'_>,
+        lower_ctx: &mut LowerCtx<'_>,
         node: &dyn HasGenericParams,
         add_param_attrs: impl FnMut(
             Either<LocalTypeOrConstParamId, LocalLifetimeParamId>,
@@ -468,7 +468,7 @@ impl GenericParamsCollector {
 
     pub(crate) fn fill_bounds(
         &mut self,
-        lower_ctx: &LowerCtx<'_>,
+        lower_ctx: &mut LowerCtx<'_>,
         type_bounds: Option<ast::TypeBoundList>,
         target: Either<TypeRefId, LifetimeRef>,
     ) {
@@ -479,7 +479,7 @@ impl GenericParamsCollector {
 
     fn fill_params(
         &mut self,
-        lower_ctx: &LowerCtx<'_>,
+        lower_ctx: &mut LowerCtx<'_>,
         params: ast::GenericParamList,
         mut add_param_attrs: impl FnMut(
             Either<LocalTypeOrConstParamId, LocalLifetimeParamId>,
@@ -535,7 +535,11 @@ impl GenericParamsCollector {
         }
     }
 
-    fn fill_where_predicates(&mut self, lower_ctx: &LowerCtx<'_>, where_clause: ast::WhereClause) {
+    fn fill_where_predicates(
+        &mut self,
+        lower_ctx: &mut LowerCtx<'_>,
+        where_clause: ast::WhereClause,
+    ) {
         for pred in where_clause.predicates() {
             let target = if let Some(type_ref) = pred.ty() {
                 Either::Left(TypeRef::from_ast(lower_ctx, type_ref))
@@ -569,7 +573,7 @@ impl GenericParamsCollector {
 
     fn add_where_predicate_from_bound(
         &mut self,
-        lower_ctx: &LowerCtx<'_>,
+        lower_ctx: &mut LowerCtx<'_>,
         bound: ast::TypeBound,
         hrtb_lifetimes: Option<&[Name]>,
         target: Either<TypeRefId, LifetimeRef>,
@@ -670,8 +674,9 @@ impl GenericParamsCollector {
                 {
                     let (mut macro_types_map, mut macro_types_source_map) =
                         (TypesMap::default(), TypesSourceMap::default());
-                    let ctx = expander.ctx(db, &mut macro_types_map, &mut macro_types_source_map);
-                    let type_ref = TypeRef::from_ast(&ctx, expanded.tree());
+                    let mut ctx =
+                        expander.ctx(db, &mut macro_types_map, &mut macro_types_source_map);
+                    let type_ref = TypeRef::from_ast(&mut ctx, expanded.tree());
                     self.fill_implicit_impl_trait_args(
                         db,
                         generics_types_map,
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/hir/type_ref.rs b/src/tools/rust-analyzer/crates/hir-def/src/hir/type_ref.rs
index 2582340c0f8..4d83ef99c84 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/hir/type_ref.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/hir/type_ref.rs
@@ -98,7 +98,7 @@ pub struct TraitRef {
 
 impl TraitRef {
     /// Converts an `ast::PathType` to a `hir::TraitRef`.
-    pub(crate) fn from_ast(ctx: &LowerCtx<'_>, node: ast::Type) -> Option<Self> {
+    pub(crate) fn from_ast(ctx: &mut LowerCtx<'_>, node: ast::Type) -> Option<Self> {
         // FIXME: Use `Path::from_src`
         match node {
             ast::Type::PathType(path) => {
@@ -240,7 +240,7 @@ pub enum TraitBoundModifier {
 
 impl TypeRef {
     /// Converts an `ast::TypeRef` to a `hir::TypeRef`.
-    pub fn from_ast(ctx: &LowerCtx<'_>, node: ast::Type) -> TypeRefId {
+    pub fn from_ast(ctx: &mut LowerCtx<'_>, node: ast::Type) -> TypeRefId {
         let ty = match &node {
             ast::Type::ParenType(inner) => return TypeRef::from_ast_opt(ctx, inner.ty()),
             ast::Type::TupleType(inner) => TypeRef::Tuple(EmptyOptimizedThinVec::from_iter(
@@ -321,8 +321,9 @@ impl TypeRef {
                     // Disallow nested impl traits
                     TypeRef::Error
                 } else {
-                    let _guard = ctx.outer_impl_trait_scope(true);
-                    TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list()))
+                    ctx.with_outer_impl_trait_scope(true, |ctx| {
+                        TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list()))
+                    })
                 }
             }
             ast::Type::DynTraitType(inner) => {
@@ -336,7 +337,7 @@ impl TypeRef {
         ctx.alloc_type_ref(ty, AstPtr::new(&node))
     }
 
-    pub(crate) fn from_ast_opt(ctx: &LowerCtx<'_>, node: Option<ast::Type>) -> TypeRefId {
+    pub(crate) fn from_ast_opt(ctx: &mut LowerCtx<'_>, node: Option<ast::Type>) -> TypeRefId {
         match node {
             Some(node) => TypeRef::from_ast(ctx, node),
             None => ctx.alloc_error_type(),
@@ -410,7 +411,7 @@ impl TypeRef {
 }
 
 pub(crate) fn type_bounds_from_ast(
-    lower_ctx: &LowerCtx<'_>,
+    lower_ctx: &mut LowerCtx<'_>,
     type_bounds_opt: Option<ast::TypeBoundList>,
 ) -> ThinVec<TypeBound> {
     if let Some(type_bounds) = type_bounds_opt {
@@ -423,8 +424,8 @@ pub(crate) fn type_bounds_from_ast(
 }
 
 impl TypeBound {
-    pub(crate) fn from_ast(ctx: &LowerCtx<'_>, node: ast::TypeBound) -> Self {
-        let lower_path_type = |path_type: ast::PathType| ctx.lower_path(path_type.path()?);
+    pub(crate) fn from_ast(ctx: &mut LowerCtx<'_>, node: ast::TypeBound) -> Self {
+        let mut lower_path_type = |path_type: ast::PathType| ctx.lower_path(path_type.path()?);
 
         match node.kind() {
             ast::TypeBoundKind::PathType(path_type) => {
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs b/src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs
index a04f12cab76..e96e38eceeb 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs
@@ -361,9 +361,7 @@ impl ItemScope {
         self.macro_invocations.get(&call).copied()
     }
 
-    pub(crate) fn iter_macro_invoc(
-        &self,
-    ) -> impl Iterator<Item = (&AstId<ast::MacroCall>, &MacroCallId)> {
+    pub fn iter_macro_invoc(&self) -> impl Iterator<Item = (&AstId<ast::MacroCall>, &MacroCallId)> {
         self.macro_invocations.iter()
     }
 }
@@ -401,9 +399,7 @@ impl ItemScope {
         self.macro_invocations.insert(call, call_id);
     }
 
-    pub(crate) fn attr_macro_invocs(
-        &self,
-    ) -> impl Iterator<Item = (AstId<ast::Item>, MacroCallId)> + '_ {
+    pub fn attr_macro_invocs(&self) -> impl Iterator<Item = (AstId<ast::Item>, MacroCallId)> + '_ {
         self.attr_macros.iter().map(|(k, v)| (*k, *v))
     }
 
@@ -440,7 +436,7 @@ impl ItemScope {
         });
     }
 
-    pub(crate) fn derive_macro_invocs(
+    pub fn derive_macro_invocs(
         &self,
     ) -> impl Iterator<
         Item = (
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs b/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs
index bd17fce37b7..d519c1708b3 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs
@@ -234,11 +234,11 @@ impl<'a> Ctx<'a> {
     fn lower_struct(&mut self, strukt: &ast::Struct) -> Option<FileItemTreeId<Struct>> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
         let visibility = self.lower_visibility(strukt);
         let name = strukt.name()?.as_name();
         let ast_id = self.source_ast_id_map.ast_id(strukt);
-        let (fields, kind, attrs) = self.lower_fields(&strukt.kind(), &body_ctx);
+        let (fields, kind, attrs) = self.lower_fields(&strukt.kind(), &mut body_ctx);
         let (generic_params, generics_source_map) =
             self.lower_generic_params(HasImplicitSelf::No, strukt);
         types_map.shrink_to_fit();
@@ -273,7 +273,7 @@ impl<'a> Ctx<'a> {
     fn lower_fields(
         &mut self,
         strukt_kind: &ast::StructKind,
-        body_ctx: &LowerCtx<'_>,
+        body_ctx: &mut LowerCtx<'_>,
     ) -> (Box<[Field]>, FieldsShape, Vec<(usize, RawAttrs)>) {
         match strukt_kind {
             ast::StructKind::Record(it) => {
@@ -308,7 +308,11 @@ impl<'a> Ctx<'a> {
         }
     }
 
-    fn lower_record_field(&mut self, field: &ast::RecordField, body_ctx: &LowerCtx<'_>) -> Field {
+    fn lower_record_field(
+        &mut self,
+        field: &ast::RecordField,
+        body_ctx: &mut LowerCtx<'_>,
+    ) -> Field {
         let name = match field.name() {
             Some(name) => name.as_name(),
             None => Name::missing(),
@@ -323,7 +327,7 @@ impl<'a> Ctx<'a> {
         &mut self,
         idx: usize,
         field: &ast::TupleField,
-        body_ctx: &LowerCtx<'_>,
+        body_ctx: &mut LowerCtx<'_>,
     ) -> Field {
         let name = Name::new_tuple_field(idx);
         let visibility = self.lower_visibility(field);
@@ -334,13 +338,13 @@ impl<'a> Ctx<'a> {
     fn lower_union(&mut self, union: &ast::Union) -> Option<FileItemTreeId<Union>> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
         let visibility = self.lower_visibility(union);
         let name = union.name()?.as_name();
         let ast_id = self.source_ast_id_map.ast_id(union);
         let (fields, _, attrs) = match union.record_field_list() {
             Some(record_field_list) => {
-                self.lower_fields(&StructKind::Record(record_field_list), &body_ctx)
+                self.lower_fields(&StructKind::Record(record_field_list), &mut body_ctx)
             }
             None => (Box::default(), FieldsShape::Record, Vec::default()),
         };
@@ -409,12 +413,12 @@ impl<'a> Ctx<'a> {
     fn lower_variant(&mut self, variant: &ast::Variant) -> Idx<Variant> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
         let name = match variant.name() {
             Some(name) => name.as_name(),
             None => Name::missing(),
         };
-        let (fields, kind, attrs) = self.lower_fields(&variant.kind(), &body_ctx);
+        let (fields, kind, attrs) = self.lower_fields(&variant.kind(), &mut body_ctx);
         let ast_id = self.source_ast_id_map.ast_id(variant);
         types_map.shrink_to_fit();
         types_source_map.shrink_to_fit();
@@ -436,7 +440,7 @@ impl<'a> Ctx<'a> {
     fn lower_function(&mut self, func: &ast::Fn) -> Option<FileItemTreeId<Function>> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
 
         let visibility = self.lower_visibility(func);
         let name = func.name()?.as_name();
@@ -457,7 +461,7 @@ impl<'a> Ctx<'a> {
                     RawAttrs::new(self.db.upcast(), &self_param, self.span_map()),
                 );
                 let self_type = match self_param.ty() {
-                    Some(type_ref) => TypeRef::from_ast(&body_ctx, type_ref),
+                    Some(type_ref) => TypeRef::from_ast(&mut body_ctx, type_ref),
                     None => {
                         let self_type = body_ctx.alloc_type_ref_desugared(TypeRef::Path(
                             Name::new_symbol_root(sym::Self_.clone()).into(),
@@ -492,7 +496,7 @@ impl<'a> Ctx<'a> {
                         Param { type_ref: None }
                     }
                     None => {
-                        let type_ref = TypeRef::from_ast_opt(&body_ctx, param.ty());
+                        let type_ref = TypeRef::from_ast_opt(&mut body_ctx, param.ty());
                         Param { type_ref: Some(type_ref) }
                     }
                 };
@@ -502,7 +506,7 @@ impl<'a> Ctx<'a> {
 
         let ret_type = match func.ret_type() {
             Some(rt) => match rt.ty() {
-                Some(type_ref) => TypeRef::from_ast(&body_ctx, type_ref),
+                Some(type_ref) => TypeRef::from_ast(&mut body_ctx, type_ref),
                 None if rt.thin_arrow_token().is_some() => body_ctx.alloc_error_type(),
                 None => body_ctx.alloc_type_ref_desugared(TypeRef::unit()),
             },
@@ -581,11 +585,11 @@ impl<'a> Ctx<'a> {
     ) -> Option<FileItemTreeId<TypeAlias>> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
         let name = type_alias.name()?.as_name();
-        let type_ref = type_alias.ty().map(|it| TypeRef::from_ast(&body_ctx, it));
+        let type_ref = type_alias.ty().map(|it| TypeRef::from_ast(&mut body_ctx, it));
         let visibility = self.lower_visibility(type_alias);
-        let bounds = self.lower_type_bounds(type_alias, &body_ctx);
+        let bounds = self.lower_type_bounds(type_alias, &mut body_ctx);
         let ast_id = self.source_ast_id_map.ast_id(type_alias);
         let (generic_params, generics_source_map) =
             self.lower_generic_params(HasImplicitSelf::No, type_alias);
@@ -612,9 +616,9 @@ impl<'a> Ctx<'a> {
     fn lower_static(&mut self, static_: &ast::Static) -> Option<FileItemTreeId<Static>> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
         let name = static_.name()?.as_name();
-        let type_ref = TypeRef::from_ast_opt(&body_ctx, static_.ty());
+        let type_ref = TypeRef::from_ast_opt(&mut body_ctx, static_.ty());
         let visibility = self.lower_visibility(static_);
         let mutable = static_.mut_token().is_some();
         let has_safe_kw = static_.safe_token().is_some();
@@ -639,9 +643,9 @@ impl<'a> Ctx<'a> {
     fn lower_const(&mut self, konst: &ast::Const) -> FileItemTreeId<Const> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
         let name = konst.name().map(|it| it.as_name());
-        let type_ref = TypeRef::from_ast_opt(&body_ctx, konst.ty());
+        let type_ref = TypeRef::from_ast_opt(&mut body_ctx, konst.ty());
         let visibility = self.lower_visibility(konst);
         let ast_id = self.source_ast_id_map.ast_id(konst);
         types_map.shrink_to_fit();
@@ -724,14 +728,14 @@ impl<'a> Ctx<'a> {
     fn lower_impl(&mut self, impl_def: &ast::Impl) -> FileItemTreeId<Impl> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
 
         let ast_id = self.source_ast_id_map.ast_id(impl_def);
         // FIXME: If trait lowering fails, due to a non PathType for example, we treat this impl
         // as if it was an non-trait impl. Ideally we want to create a unique missing ref that only
         // equals itself.
-        let self_ty = TypeRef::from_ast_opt(&body_ctx, impl_def.self_ty());
-        let target_trait = impl_def.trait_().and_then(|tr| TraitRef::from_ast(&body_ctx, tr));
+        let self_ty = TypeRef::from_ast_opt(&mut body_ctx, impl_def.self_ty());
+        let target_trait = impl_def.trait_().and_then(|tr| TraitRef::from_ast(&mut body_ctx, tr));
         let is_negative = impl_def.excl_token().is_some();
         let is_unsafe = impl_def.unsafe_token().is_some();
 
@@ -870,13 +874,8 @@ impl<'a> Ctx<'a> {
     ) -> (Arc<GenericParams>, TypesSourceMap) {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
+        let mut body_ctx = self.body_ctx(&mut types_map, &mut types_source_map);
         debug_assert!(self.generic_param_attr_buffer.is_empty(),);
-        let add_param_attrs = |item: Either<LocalTypeOrConstParamId, LocalLifetimeParamId>,
-                               param| {
-            let attrs = RawAttrs::new(self.db.upcast(), &param, body_ctx.span_map());
-            debug_assert!(self.generic_param_attr_buffer.insert(item, attrs).is_none());
-        };
         body_ctx.take_impl_traits_bounds();
         let mut generics = GenericParamsCollector::default();
 
@@ -892,16 +891,19 @@ impl<'a> Ctx<'a> {
             );
             // add super traits as bounds on Self
             // i.e., `trait Foo: Bar` is equivalent to `trait Foo where Self: Bar`
-            generics.fill_bounds(
-                &body_ctx,
-                bounds,
-                Either::Left(body_ctx.alloc_type_ref_desugared(TypeRef::Path(
-                    Name::new_symbol_root(sym::Self_.clone()).into(),
-                ))),
-            );
+            let bound_target = Either::Left(body_ctx.alloc_type_ref_desugared(TypeRef::Path(
+                Name::new_symbol_root(sym::Self_.clone()).into(),
+            )));
+            generics.fill_bounds(&mut body_ctx, bounds, bound_target);
         }
 
-        generics.fill(&body_ctx, node, add_param_attrs);
+        let span_map = body_ctx.span_map().clone();
+        let add_param_attrs = |item: Either<LocalTypeOrConstParamId, LocalLifetimeParamId>,
+                               param| {
+            let attrs = RawAttrs::new(self.db.upcast(), &param, span_map.as_ref());
+            debug_assert!(self.generic_param_attr_buffer.insert(item, attrs).is_none());
+        };
+        generics.fill(&mut body_ctx, node, add_param_attrs);
 
         let generics = generics.finish(types_map, &mut types_source_map);
         (generics, types_source_map)
@@ -910,7 +912,7 @@ impl<'a> Ctx<'a> {
     fn lower_type_bounds(
         &mut self,
         node: &dyn ast::HasTypeBounds,
-        body_ctx: &LowerCtx<'_>,
+        body_ctx: &mut LowerCtx<'_>,
     ) -> Box<[TypeBound]> {
         match node.type_bound_list() {
             Some(bound_list) => {
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lib.rs b/src/tools/rust-analyzer/crates/hir-def/src/lib.rs
index f6ed826f04c..eb55ba1d53d 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/lib.rs
@@ -47,7 +47,6 @@ pub mod resolver;
 
 pub mod nameres;
 
-pub mod child_by_source;
 pub mod src;
 
 pub mod find_path;
@@ -354,9 +353,9 @@ impl_loc!(ProcMacroLoc, id: Function, container: CrateRootModuleId);
 pub struct BlockId(ra_salsa::InternId);
 #[derive(Debug, Hash, PartialEq, Eq, Clone)]
 pub struct BlockLoc {
-    ast_id: AstId<ast::BlockExpr>,
+    pub ast_id: AstId<ast::BlockExpr>,
     /// The containing module.
-    module: ModuleId,
+    pub module: ModuleId,
 }
 impl_intern!(BlockId, BlockLoc, intern_block, lookup_intern_block);
 
@@ -838,16 +837,18 @@ impl InTypeConstId {
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub enum GeneralConstId {
     ConstId(ConstId),
+    StaticId(StaticId),
     ConstBlockId(ConstBlockId),
     InTypeConstId(InTypeConstId),
 }
 
-impl_from!(ConstId, ConstBlockId, InTypeConstId for GeneralConstId);
+impl_from!(ConstId, StaticId, ConstBlockId, InTypeConstId for GeneralConstId);
 
 impl GeneralConstId {
     pub fn generic_def(self, db: &dyn DefDatabase) -> Option<GenericDefId> {
         match self {
             GeneralConstId::ConstId(it) => Some(it.into()),
+            GeneralConstId::StaticId(_) => None,
             GeneralConstId::ConstBlockId(it) => it.lookup(db).parent.as_generic_def_id(db),
             GeneralConstId::InTypeConstId(it) => it.lookup(db).owner.as_generic_def_id(db),
         }
@@ -855,6 +856,9 @@ impl GeneralConstId {
 
     pub fn name(self, db: &dyn DefDatabase) -> String {
         match self {
+            GeneralConstId::StaticId(it) => {
+                db.static_data(it).name.display(db.upcast(), Edition::CURRENT).to_string()
+            }
             GeneralConstId::ConstId(const_id) => db
                 .const_data(const_id)
                 .name
@@ -935,7 +939,7 @@ impl_from!(
 );
 
 impl GenericDefId {
-    fn file_id_and_params_of(
+    pub fn file_id_and_params_of(
         self,
         db: &dyn DefDatabase,
     ) -> (HirFileId, Option<ast::GenericParamList>) {
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lower.rs b/src/tools/rust-analyzer/crates/hir-def/src/lower.rs
index df5847929c5..6d1a3d17447 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/lower.rs
@@ -1,10 +1,7 @@
 //! Context for lowering paths.
-use std::cell::{OnceCell, RefCell};
+use std::{cell::OnceCell, mem};
 
-use hir_expand::{
-    span_map::{SpanMap, SpanMapRef},
-    AstId, HirFileId, InFile,
-};
+use hir_expand::{span_map::SpanMap, AstId, HirFileId, InFile};
 use span::{AstIdMap, AstIdNode};
 use stdx::thin_vec::ThinVec;
 use syntax::ast;
@@ -21,28 +18,11 @@ pub struct LowerCtx<'a> {
     file_id: HirFileId,
     span_map: OnceCell<SpanMap>,
     ast_id_map: OnceCell<Arc<AstIdMap>>,
-    impl_trait_bounds: RefCell<Vec<ThinVec<TypeBound>>>,
+    impl_trait_bounds: Vec<ThinVec<TypeBound>>,
     // Prevent nested impl traits like `impl Foo<impl Bar>`.
-    outer_impl_trait: RefCell<bool>,
-    types_map: RefCell<(&'a mut TypesMap, &'a mut TypesSourceMap)>,
-}
-
-pub(crate) struct OuterImplTraitGuard<'a, 'b> {
-    ctx: &'a LowerCtx<'b>,
-    old: bool,
-}
-
-impl<'a, 'b> OuterImplTraitGuard<'a, 'b> {
-    fn new(ctx: &'a LowerCtx<'b>, impl_trait: bool) -> Self {
-        let old = ctx.outer_impl_trait.replace(impl_trait);
-        Self { ctx, old }
-    }
-}
-
-impl Drop for OuterImplTraitGuard<'_, '_> {
-    fn drop(&mut self) {
-        self.ctx.outer_impl_trait.replace(self.old);
-    }
+    outer_impl_trait: bool,
+    types_map: &'a mut TypesMap,
+    types_source_map: &'a mut TypesSourceMap,
 }
 
 impl<'a> LowerCtx<'a> {
@@ -57,9 +37,10 @@ impl<'a> LowerCtx<'a> {
             file_id,
             span_map: OnceCell::new(),
             ast_id_map: OnceCell::new(),
-            impl_trait_bounds: RefCell::new(Vec::new()),
-            outer_impl_trait: RefCell::default(),
-            types_map: RefCell::new((types_map, types_source_map)),
+            impl_trait_bounds: Vec::new(),
+            outer_impl_trait: false,
+            types_map,
+            types_source_map,
         }
     }
 
@@ -75,17 +56,18 @@ impl<'a> LowerCtx<'a> {
             file_id,
             span_map,
             ast_id_map: OnceCell::new(),
-            impl_trait_bounds: RefCell::new(Vec::new()),
-            outer_impl_trait: RefCell::default(),
-            types_map: RefCell::new((types_map, types_source_map)),
+            impl_trait_bounds: Vec::new(),
+            outer_impl_trait: false,
+            types_map,
+            types_source_map,
         }
     }
 
-    pub(crate) fn span_map(&self) -> SpanMapRef<'_> {
-        self.span_map.get_or_init(|| self.db.span_map(self.file_id)).as_ref()
+    pub(crate) fn span_map(&self) -> &SpanMap {
+        self.span_map.get_or_init(|| self.db.span_map(self.file_id))
     }
 
-    pub(crate) fn lower_path(&self, ast: ast::Path) -> Option<Path> {
+    pub(crate) fn lower_path(&mut self, ast: ast::Path) -> Option<Path> {
         Path::from_src(self, ast)
     }
 
@@ -96,44 +78,44 @@ impl<'a> LowerCtx<'a> {
         )
     }
 
-    pub fn update_impl_traits_bounds(&self, bounds: ThinVec<TypeBound>) {
-        self.impl_trait_bounds.borrow_mut().push(bounds);
+    pub fn update_impl_traits_bounds_from_type_ref(&mut self, type_ref: TypeRefId) {
+        TypeRef::walk(type_ref, self.types_map, &mut |tr| {
+            if let TypeRef::ImplTrait(bounds) = tr {
+                self.impl_trait_bounds.push(bounds.clone());
+            }
+        });
     }
 
-    pub fn take_impl_traits_bounds(&self) -> Vec<ThinVec<TypeBound>> {
-        self.impl_trait_bounds.take()
+    pub fn take_impl_traits_bounds(&mut self) -> Vec<ThinVec<TypeBound>> {
+        mem::take(&mut self.impl_trait_bounds)
     }
 
     pub(crate) fn outer_impl_trait(&self) -> bool {
-        *self.outer_impl_trait.borrow()
+        self.outer_impl_trait
     }
 
-    pub(crate) fn outer_impl_trait_scope<'b>(
-        &'b self,
+    pub(crate) fn with_outer_impl_trait_scope<R>(
+        &mut self,
         impl_trait: bool,
-    ) -> OuterImplTraitGuard<'b, 'a> {
-        OuterImplTraitGuard::new(self, impl_trait)
+        f: impl FnOnce(&mut Self) -> R,
+    ) -> R {
+        let old = mem::replace(&mut self.outer_impl_trait, impl_trait);
+        let result = f(self);
+        self.outer_impl_trait = old;
+        result
     }
 
-    pub(crate) fn alloc_type_ref(&self, type_ref: TypeRef, node: TypePtr) -> TypeRefId {
-        let mut types_map = self.types_map.borrow_mut();
-        let (types_map, types_source_map) = &mut *types_map;
-        let id = types_map.types.alloc(type_ref);
-        types_source_map.types_map_back.insert(id, InFile::new(self.file_id, node));
+    pub(crate) fn alloc_type_ref(&mut self, type_ref: TypeRef, node: TypePtr) -> TypeRefId {
+        let id = self.types_map.types.alloc(type_ref);
+        self.types_source_map.types_map_back.insert(id, InFile::new(self.file_id, node));
         id
     }
 
-    pub(crate) fn alloc_type_ref_desugared(&self, type_ref: TypeRef) -> TypeRefId {
-        self.types_map.borrow_mut().0.types.alloc(type_ref)
-    }
-
-    pub(crate) fn alloc_error_type(&self) -> TypeRefId {
-        self.types_map.borrow_mut().0.types.alloc(TypeRef::Error)
+    pub(crate) fn alloc_type_ref_desugared(&mut self, type_ref: TypeRef) -> TypeRefId {
+        self.types_map.types.alloc(type_ref)
     }
 
-    // FIXME: If we alloc while holding this, well... Bad Things will happen. Need to change this
-    // to use proper mutability instead of interior mutability.
-    pub(crate) fn types_map(&self) -> std::cell::Ref<'_, TypesMap> {
-        std::cell::Ref::map(self.types_map.borrow(), |it| &*it.0)
+    pub(crate) fn alloc_error_type(&mut self) -> TypeRefId {
+        self.types_map.types.alloc(TypeRef::Error)
     }
 }
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/path.rs b/src/tools/rust-analyzer/crates/hir-def/src/path.rs
index dc6947c5b56..aa2c4a6f1bc 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/path.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/path.rs
@@ -121,7 +121,7 @@ pub enum GenericArg {
 impl Path {
     /// Converts an `ast::Path` to `Path`. Works with use trees.
     /// It correctly handles `$crate` based path from macro call.
-    pub fn from_src(ctx: &LowerCtx<'_>, path: ast::Path) -> Option<Path> {
+    pub fn from_src(ctx: &mut LowerCtx<'_>, path: ast::Path) -> Option<Path> {
         lower::lower_path(ctx, path)
     }
 
@@ -284,7 +284,7 @@ impl<'a> PathSegments<'a> {
 
 impl GenericArgs {
     pub(crate) fn from_ast(
-        lower_ctx: &LowerCtx<'_>,
+        lower_ctx: &mut LowerCtx<'_>,
         node: ast::GenericArgList,
     ) -> Option<GenericArgs> {
         lower::lower_generic_args(lower_ctx, node)
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/path/lower.rs b/src/tools/rust-analyzer/crates/hir-def/src/path/lower.rs
index c328b9c6ce2..553e615b94f 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/path/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/path/lower.rs
@@ -19,12 +19,11 @@ use crate::{
 
 /// Converts an `ast::Path` to `Path`. Works with use trees.
 /// It correctly handles `$crate` based path from macro call.
-pub(super) fn lower_path(ctx: &LowerCtx<'_>, mut path: ast::Path) -> Option<Path> {
+pub(super) fn lower_path(ctx: &mut LowerCtx<'_>, mut path: ast::Path) -> Option<Path> {
     let mut kind = PathKind::Plain;
     let mut type_anchor = None;
     let mut segments = Vec::new();
     let mut generic_args = Vec::new();
-    let span_map = ctx.span_map();
     loop {
         let segment = path.segment()?;
 
@@ -37,7 +36,7 @@ pub(super) fn lower_path(ctx: &LowerCtx<'_>, mut path: ast::Path) -> Option<Path
                 if name_ref.text() == "$crate" {
                     break kind = resolve_crate_root(
                         ctx.db.upcast(),
-                        span_map.span_for_range(name_ref.syntax().text_range()).ctx,
+                        ctx.span_map().span_for_range(name_ref.syntax().text_range()).ctx,
                     )
                     .map(PathKind::DollarCrate)
                     .unwrap_or(PathKind::Crate);
@@ -151,7 +150,7 @@ pub(super) fn lower_path(ctx: &LowerCtx<'_>, mut path: ast::Path) -> Option<Path
     // We follow what it did anyway :)
     if segments.len() == 1 && kind == PathKind::Plain {
         if let Some(_macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast) {
-            let syn_ctxt = span_map.span_for_range(path.segment()?.syntax().text_range()).ctx;
+            let syn_ctxt = ctx.span_map().span_for_range(path.segment()?.syntax().text_range()).ctx;
             if let Some(macro_call_id) = ctx.db.lookup_intern_syntax_context(syn_ctxt).outer_expn {
                 if ctx.db.lookup_intern_macro_call(macro_call_id).def.local_inner {
                     kind = match resolve_crate_root(ctx.db.upcast(), syn_ctxt) {
@@ -183,7 +182,7 @@ pub(super) fn lower_path(ctx: &LowerCtx<'_>, mut path: ast::Path) -> Option<Path
 }
 
 pub(super) fn lower_generic_args(
-    lower_ctx: &LowerCtx<'_>,
+    lower_ctx: &mut LowerCtx<'_>,
     node: ast::GenericArgList,
 ) -> Option<GenericArgs> {
     let mut args = Vec::new();
@@ -192,13 +191,7 @@ pub(super) fn lower_generic_args(
         match generic_arg {
             ast::GenericArg::TypeArg(type_arg) => {
                 let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.ty());
-                let types_map = lower_ctx.types_map();
-                TypeRef::walk(type_ref, &types_map, &mut |tr| {
-                    if let TypeRef::ImplTrait(bounds) = tr {
-                        lower_ctx.update_impl_traits_bounds(bounds.clone());
-                    }
-                });
-                drop(types_map);
+                lower_ctx.update_impl_traits_bounds_from_type_ref(type_ref);
                 args.push(GenericArg::Type(type_ref));
             }
             ast::GenericArg::AssocTypeArg(assoc_type_arg) => {
@@ -208,27 +201,22 @@ pub(super) fn lower_generic_args(
                 }
                 if let Some(name_ref) = assoc_type_arg.name_ref() {
                     // Nested impl traits like `impl Foo<Assoc = impl Bar>` are allowed
-                    let _guard = lower_ctx.outer_impl_trait_scope(false);
-                    let name = name_ref.as_name();
-                    let args = assoc_type_arg
-                        .generic_arg_list()
-                        .and_then(|args| lower_generic_args(lower_ctx, args));
-                    let type_ref = assoc_type_arg.ty().map(|it| TypeRef::from_ast(lower_ctx, it));
-                    let type_ref = type_ref.inspect(|&tr| {
-                        let types_map = lower_ctx.types_map();
-                        TypeRef::walk(tr, &types_map, &mut |tr| {
-                            if let TypeRef::ImplTrait(bounds) = tr {
-                                lower_ctx.update_impl_traits_bounds(bounds.clone());
-                            }
-                        });
-                        drop(types_map);
+                    lower_ctx.with_outer_impl_trait_scope(false, |lower_ctx| {
+                        let name = name_ref.as_name();
+                        let args = assoc_type_arg
+                            .generic_arg_list()
+                            .and_then(|args| lower_generic_args(lower_ctx, args));
+                        let type_ref =
+                            assoc_type_arg.ty().map(|it| TypeRef::from_ast(lower_ctx, it));
+                        let type_ref = type_ref
+                            .inspect(|&tr| lower_ctx.update_impl_traits_bounds_from_type_ref(tr));
+                        let bounds = if let Some(l) = assoc_type_arg.type_bound_list() {
+                            l.bounds().map(|it| TypeBound::from_ast(lower_ctx, it)).collect()
+                        } else {
+                            Box::default()
+                        };
+                        bindings.push(AssociatedTypeBinding { name, args, type_ref, bounds });
                     });
-                    let bounds = if let Some(l) = assoc_type_arg.type_bound_list() {
-                        l.bounds().map(|it| TypeBound::from_ast(lower_ctx, it)).collect()
-                    } else {
-                        Box::default()
-                    };
-                    bindings.push(AssociatedTypeBinding { name, args, type_ref, bounds });
                 }
             }
             ast::GenericArg::LifetimeArg(lifetime_arg) => {
@@ -258,7 +246,7 @@ pub(super) fn lower_generic_args(
 /// Collect `GenericArgs` from the parts of a fn-like path, i.e. `Fn(X, Y)
 /// -> Z` (which desugars to `Fn<(X, Y), Output=Z>`).
 fn lower_generic_args_from_fn_path(
-    ctx: &LowerCtx<'_>,
+    ctx: &mut LowerCtx<'_>,
     params: Option<ast::ParamList>,
     ret_type: Option<ast::RetType>,
 ) -> Option<GenericArgs> {
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs b/src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs
index 4bc78afacc0..05cd7bd37b4 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs
@@ -615,7 +615,7 @@ pub(crate) fn associated_ty_data_query(
     let type_alias_data = db.type_alias_data(type_alias);
     let generic_params = generics(db.upcast(), type_alias.into());
     let resolver = hir_def::resolver::HasResolver::resolver(type_alias, db.upcast());
-    let ctx =
+    let mut ctx =
         crate::TyLoweringContext::new(db, &resolver, &type_alias_data.types_map, type_alias.into())
             .with_type_param_mode(crate::lower::ParamLoweringMode::Variable);
 
@@ -627,14 +627,16 @@ pub(crate) fn associated_ty_data_query(
         .build();
     let self_ty = TyKind::Alias(AliasTy::Projection(pro_ty)).intern(Interner);
 
-    let mut bounds: Vec<_> = type_alias_data
-        .bounds
-        .iter()
-        .flat_map(|bound| ctx.lower_type_bound(bound, self_ty.clone(), false))
-        .filter_map(|pred| generic_predicate_to_inline_bound(db, &pred, &self_ty))
-        .collect();
+    let mut bounds = Vec::new();
+    for bound in &type_alias_data.bounds {
+        ctx.lower_type_bound(bound, self_ty.clone(), false).for_each(|pred| {
+            if let Some(pred) = generic_predicate_to_inline_bound(db, &pred, &self_ty) {
+                bounds.push(pred);
+            }
+        });
+    }
 
-    if !ctx.unsized_types.borrow().contains(&self_ty) {
+    if !ctx.unsized_types.contains(&self_ty) {
         let sized_trait = db
             .lang_item(resolver.krate(), LangItem::Sized)
             .and_then(|lang_item| lang_item.as_trait().map(to_chalk_trait_id));
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs b/src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs
index 091cfcd4654..142766c039b 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs
@@ -8,7 +8,7 @@ use hir_def::{
     path::Path,
     resolver::{Resolver, ValueNs},
     type_ref::LiteralConstRef,
-    ConstBlockLoc, EnumVariantId, GeneralConstId, StaticId,
+    ConstBlockLoc, EnumVariantId, GeneralConstId, HasModule as _, StaticId,
 };
 use hir_expand::Lookup;
 use stdx::never;
@@ -56,6 +56,21 @@ pub enum ConstEvalError {
     MirEvalError(MirEvalError),
 }
 
+impl ConstEvalError {
+    pub fn pretty_print(
+        &self,
+        f: &mut String,
+        db: &dyn HirDatabase,
+        span_formatter: impl Fn(span::FileId, span::TextRange) -> String,
+        edition: span::Edition,
+    ) -> std::result::Result<(), std::fmt::Error> {
+        match self {
+            ConstEvalError::MirLowerError(e) => e.pretty_print(f, db, span_formatter, edition),
+            ConstEvalError::MirEvalError(e) => e.pretty_print(f, db, span_formatter, edition),
+        }
+    }
+}
+
 impl From<MirLowerError> for ConstEvalError {
     fn from(value: MirLowerError) -> Self {
         match value {
@@ -236,6 +251,10 @@ pub(crate) fn const_eval_query(
         GeneralConstId::ConstId(c) => {
             db.monomorphized_mir_body(c.into(), subst, db.trait_environment(c.into()))?
         }
+        GeneralConstId::StaticId(s) => {
+            let krate = s.module(db.upcast()).krate();
+            db.monomorphized_mir_body(s.into(), subst, TraitEnvironment::empty(krate))?
+        }
         GeneralConstId::ConstBlockId(c) => {
             let ConstBlockLoc { parent, root } = db.lookup_intern_anonymous_const(c);
             let body = db.body(parent);
@@ -249,7 +268,7 @@ pub(crate) fn const_eval_query(
         }
         GeneralConstId::InTypeConstId(c) => db.mir_body(c.into())?,
     };
-    let c = interpret_mir(db, body, false, trait_env).0?;
+    let c = interpret_mir(db, body, false, trait_env)?.0?;
     Ok(c)
 }
 
@@ -262,7 +281,7 @@ pub(crate) fn const_eval_static_query(
         Substitution::empty(Interner),
         db.trait_environment_for_body(def.into()),
     )?;
-    let c = interpret_mir(db, body, false, None).0?;
+    let c = interpret_mir(db, body, false, None)?.0?;
     Ok(c)
 }
 
@@ -294,7 +313,7 @@ pub(crate) fn const_eval_discriminant_variant(
         Substitution::empty(Interner),
         db.trait_environment_for_body(def),
     )?;
-    let c = interpret_mir(db, mir_body, false, None).0?;
+    let c = interpret_mir(db, mir_body, false, None)?.0?;
     let c = if is_signed {
         try_const_isize(db, &c).unwrap()
     } else {
@@ -335,7 +354,7 @@ pub(crate) fn eval_to_const(
         }
     }
     if let Ok(mir_body) = lower_to_mir(ctx.db, ctx.owner, ctx.body, &infer, expr) {
-        if let Ok(result) = interpret_mir(db, Arc::new(mir_body), true, None).0 {
+        if let Ok((Ok(result), _)) = interpret_mir(db, Arc::new(mir_body), true, None) {
             return result;
         }
     }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/display.rs b/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
index 277dabe9aa3..4e95bdf219f 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
@@ -2033,7 +2033,7 @@ impl HirDisplayWithTypesMap for TypeRefId {
             TypeRef::Macro(macro_call) => {
                 let (mut types_map, mut types_source_map) =
                     (TypesMap::default(), TypesSourceMap::default());
-                let ctx = hir_def::lower::LowerCtx::new(
+                let mut ctx = hir_def::lower::LowerCtx::new(
                     f.db.upcast(),
                     macro_call.file_id,
                     &mut types_map,
@@ -2041,7 +2041,7 @@ impl HirDisplayWithTypesMap for TypeRefId {
                 );
                 let macro_call = macro_call.to_node(f.db.upcast());
                 match macro_call.path() {
-                    Some(path) => match Path::from_src(&ctx, path) {
+                    Some(path) => match Path::from_src(&mut ctx, path) {
                         Some(path) => path.hir_fmt(f, &types_map)?,
                         None => write!(f, "{{macro}}")?,
                     },
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs
index 3685ed56964..01e0b635b22 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs
@@ -1420,7 +1420,7 @@ impl<'a> InferenceContext<'a> {
             Some(path) => path,
             None => return (self.err_ty(), None),
         };
-        let ctx = crate::lower::TyLoweringContext::new(
+        let mut ctx = crate::lower::TyLoweringContext::new(
             self.db,
             &self.resolver,
             &self.body.types,
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/path.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/path.rs
index 442daa9f9ee..7550d197a3b 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/path.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/path.rs
@@ -151,7 +151,7 @@ impl InferenceContext<'_> {
             let last = path.segments().last()?;
 
             // Don't use `self.make_ty()` here as we need `orig_ns`.
-            let ctx = crate::lower::TyLoweringContext::new(
+            let mut ctx = crate::lower::TyLoweringContext::new(
                 self.db,
                 &self.resolver,
                 &self.body.types,
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs b/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs
index c5fa20bc8ac..0c1f63880cd 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs
@@ -6,8 +6,9 @@ use base_db::ra_salsa::Cycle;
 use chalk_ir::{AdtId, FloatTy, IntTy, TyKind, UintTy};
 use hir_def::{
     layout::{
-        BackendRepr, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError, LayoutData,
-        Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout, WrappingRange,
+        BackendRepr, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError,
+        LayoutData, Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout,
+        WrappingRange,
     },
     LocalFieldId, StructId,
 };
@@ -294,11 +295,12 @@ pub fn layout_of_ty_query(
                 .checked_mul(count, dl)
                 .ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
 
-            let backend_repr = if count != 0 && matches!(element.backend_repr, BackendRepr::Uninhabited) {
-                BackendRepr::Uninhabited
-            } else {
-                BackendRepr::Memory { sized: true }
-            };
+            let backend_repr =
+                if count != 0 && matches!(element.backend_repr, BackendRepr::Uninhabited) {
+                    BackendRepr::Uninhabited
+                } else {
+                    BackendRepr::Memory { sized: true }
+                };
 
             let largest_niche = if count != 0 { element.largest_niche } else { None };
 
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/lower.rs b/src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
index e3a92e52f61..b868ea95f85 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
@@ -6,8 +6,8 @@
 //!
 //! This usually involves resolving names, collecting generic arguments etc.
 use std::{
-    cell::{Cell, OnceCell, RefCell, RefMut},
-    iter,
+    cell::OnceCell,
+    iter, mem,
     ops::{self, Not as _},
 };
 
@@ -72,47 +72,32 @@ use crate::{
     TraitRefExt, Ty, TyBuilder, TyKind, WhereClause,
 };
 
-#[derive(Debug)]
-enum ImplTraitLoweringState {
+#[derive(Debug, Default)]
+struct ImplTraitLoweringState {
     /// When turning `impl Trait` into opaque types, we have to collect the
     /// bounds at the same time to get the IDs correct (without becoming too
-    /// complicated). I don't like using interior mutability (as for the
-    /// counter), but I've tried and failed to make the lifetimes work for
-    /// passing around a `&mut TyLoweringContext`. The core problem is that
-    /// we're grouping the mutable data (the counter and this field) together
-    /// with the immutable context (the references to the DB and resolver).
-    /// Splitting this up would be a possible fix.
-    Opaque(RefCell<Arena<ImplTrait>>),
-    Param(Cell<u16>),
-    Variable(Cell<u16>),
-    Disallowed,
+    /// complicated).
+    mode: ImplTraitLoweringMode,
+    // This is structured as a struct with fields and not as an enum because it helps with the borrow checker.
+    opaque_type_data: Arena<ImplTrait>,
+    param_and_variable_counter: u16,
 }
 impl ImplTraitLoweringState {
-    fn new(impl_trait_mode: ImplTraitLoweringMode) -> ImplTraitLoweringState {
-        match impl_trait_mode {
-            ImplTraitLoweringMode::Opaque => Self::Opaque(RefCell::new(Arena::new())),
-            ImplTraitLoweringMode::Param => Self::Param(Cell::new(0)),
-            ImplTraitLoweringMode::Variable => Self::Variable(Cell::new(0)),
-            ImplTraitLoweringMode::Disallowed => Self::Disallowed,
-        }
+    fn new(mode: ImplTraitLoweringMode) -> ImplTraitLoweringState {
+        Self { mode, opaque_type_data: Arena::new(), param_and_variable_counter: 0 }
     }
-
-    fn take(&self) -> Self {
-        match self {
-            Self::Opaque(x) => Self::Opaque(RefCell::new(x.take())),
-            Self::Param(x) => Self::Param(Cell::new(x.get())),
-            Self::Variable(x) => Self::Variable(Cell::new(x.get())),
-            Self::Disallowed => Self::Disallowed,
+    fn param(counter: u16) -> Self {
+        Self {
+            mode: ImplTraitLoweringMode::Param,
+            opaque_type_data: Arena::new(),
+            param_and_variable_counter: counter,
         }
     }
-
-    fn swap(&self, impl_trait_mode: &Self) {
-        match (self, impl_trait_mode) {
-            (Self::Opaque(x), Self::Opaque(y)) => x.swap(y),
-            (Self::Param(x), Self::Param(y)) => x.swap(y),
-            (Self::Variable(x), Self::Variable(y)) => x.swap(y),
-            (Self::Disallowed, Self::Disallowed) => (),
-            _ => panic!("mismatched lowering mode"),
+    fn variable(counter: u16) -> Self {
+        Self {
+            mode: ImplTraitLoweringMode::Variable,
+            opaque_type_data: Arena::new(),
+            param_and_variable_counter: counter,
         }
     }
 }
@@ -137,9 +122,9 @@ pub struct TyLoweringContext<'a> {
     /// possible currently, so this should be fine for now.
     pub type_param_mode: ParamLoweringMode,
     impl_trait_mode: ImplTraitLoweringState,
-    expander: RefCell<Option<Expander>>,
+    expander: Option<Expander>,
     /// Tracks types with explicit `?Sized` bounds.
-    pub(crate) unsized_types: RefCell<FxHashSet<Ty>>,
+    pub(crate) unsized_types: FxHashSet<Ty>,
 }
 
 impl<'a> TyLoweringContext<'a> {
@@ -159,7 +144,7 @@ impl<'a> TyLoweringContext<'a> {
         types_source_map: Option<&'a TypesSourceMap>,
         owner: Option<TypeOwnerId>,
     ) -> Self {
-        let impl_trait_mode = ImplTraitLoweringState::Disallowed;
+        let impl_trait_mode = ImplTraitLoweringState::new(ImplTraitLoweringMode::Disallowed);
         let type_param_mode = ParamLoweringMode::Placeholder;
         let in_binders = DebruijnIndex::INNERMOST;
         Self {
@@ -172,38 +157,26 @@ impl<'a> TyLoweringContext<'a> {
             in_binders,
             impl_trait_mode,
             type_param_mode,
-            expander: RefCell::new(None),
-            unsized_types: RefCell::default(),
+            expander: None,
+            unsized_types: FxHashSet::default(),
         }
     }
 
     pub fn with_debruijn<T>(
-        &self,
+        &mut self,
         debruijn: DebruijnIndex,
-        f: impl FnOnce(&TyLoweringContext<'_>) -> T,
+        f: impl FnOnce(&mut TyLoweringContext<'_>) -> T,
     ) -> T {
-        let impl_trait_mode = self.impl_trait_mode.take();
-        let expander = self.expander.take();
-        let unsized_types = self.unsized_types.take();
-        let new_ctx = Self {
-            in_binders: debruijn,
-            impl_trait_mode,
-            expander: RefCell::new(expander),
-            unsized_types: RefCell::new(unsized_types),
-            generics: self.generics.clone(),
-            ..*self
-        };
-        let result = f(&new_ctx);
-        self.impl_trait_mode.swap(&new_ctx.impl_trait_mode);
-        self.expander.replace(new_ctx.expander.into_inner());
-        self.unsized_types.replace(new_ctx.unsized_types.into_inner());
+        let old_debruijn = mem::replace(&mut self.in_binders, debruijn);
+        let result = f(self);
+        self.in_binders = old_debruijn;
         result
     }
 
     pub fn with_shifted_in<T>(
-        &self,
+        &mut self,
         debruijn: DebruijnIndex,
-        f: impl FnOnce(&TyLoweringContext<'_>) -> T,
+        f: impl FnOnce(&mut TyLoweringContext<'_>) -> T,
     ) -> T {
         self.with_debruijn(self.in_binders.shifted_in_from(debruijn), f)
     }
@@ -227,7 +200,7 @@ impl<'a> TyLoweringContext<'a> {
     }
 }
 
-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
 pub enum ImplTraitLoweringMode {
     /// `impl Trait` gets lowered into an opaque type that doesn't unify with
     /// anything except itself. This is used in places where values flow 'out',
@@ -244,6 +217,7 @@ pub enum ImplTraitLoweringMode {
     /// currently checking.
     Variable,
     /// `impl Trait` is disallowed and will be an error.
+    #[default]
     Disallowed,
 }
 
@@ -254,12 +228,13 @@ pub enum ParamLoweringMode {
 }
 
 impl<'a> TyLoweringContext<'a> {
-    pub fn lower_ty(&self, type_ref: TypeRefId) -> Ty {
+    pub fn lower_ty(&mut self, type_ref: TypeRefId) -> Ty {
         self.lower_ty_ext(type_ref).0
     }
 
-    pub fn lower_const(&self, const_ref: &ConstRef, const_type: Ty) -> Const {
+    pub fn lower_const(&mut self, const_ref: &ConstRef, const_type: Ty) -> Const {
         let Some(owner) = self.owner else { return unknown_const(const_type) };
+        let debruijn = self.in_binders;
         const_or_path_to_chalk(
             self.db,
             self.resolver,
@@ -268,7 +243,7 @@ impl<'a> TyLoweringContext<'a> {
             const_ref,
             self.type_param_mode,
             || self.generics(),
-            self.in_binders,
+            debruijn,
         )
     }
 
@@ -278,7 +253,7 @@ impl<'a> TyLoweringContext<'a> {
             .as_ref()
     }
 
-    pub fn lower_ty_ext(&self, type_ref_id: TypeRefId) -> (Ty, Option<TypeNs>) {
+    pub fn lower_ty_ext(&mut self, type_ref_id: TypeRefId) -> (Ty, Option<TypeNs>) {
         let mut res = None;
         let type_ref = &self.types_map[type_ref_id];
         let ty = match type_ref {
@@ -337,8 +312,8 @@ impl<'a> TyLoweringContext<'a> {
             }
             TypeRef::DynTrait(bounds) => self.lower_dyn_trait(bounds),
             TypeRef::ImplTrait(bounds) => {
-                match &self.impl_trait_mode {
-                    ImplTraitLoweringState::Opaque(opaque_type_data) => {
+                match self.impl_trait_mode.mode {
+                    ImplTraitLoweringMode::Opaque => {
                         let origin = match self.resolver.generic_def() {
                             Some(GenericDefId::FunctionId(it)) => Either::Left(it),
                             Some(GenericDefId::TypeAliasId(it)) => Either::Right(it),
@@ -350,7 +325,7 @@ impl<'a> TyLoweringContext<'a> {
                         // this dance is to make sure the data is in the right
                         // place even if we encounter more opaque types while
                         // lowering the bounds
-                        let idx = opaque_type_data.borrow_mut().alloc(ImplTrait {
+                        let idx = self.impl_trait_mode.opaque_type_data.alloc(ImplTrait {
                             bounds: crate::make_single_type_binders(Vec::default()),
                         });
                         // We don't want to lower the bounds inside the binders
@@ -366,7 +341,7 @@ impl<'a> TyLoweringContext<'a> {
                             .with_debruijn(DebruijnIndex::INNERMOST, |ctx| {
                                 ctx.lower_impl_trait(bounds, self.resolver.krate())
                             });
-                        opaque_type_data.borrow_mut()[idx] = actual_opaque_type_data;
+                        self.impl_trait_mode.opaque_type_data[idx] = actual_opaque_type_data;
 
                         let impl_trait_id = origin.either(
                             |f| ImplTraitId::ReturnTypeImplTrait(f, idx),
@@ -378,11 +353,13 @@ impl<'a> TyLoweringContext<'a> {
                         let parameters = generics.bound_vars_subst(self.db, self.in_binders);
                         TyKind::OpaqueType(opaque_ty_id, parameters).intern(Interner)
                     }
-                    ImplTraitLoweringState::Param(counter) => {
-                        let idx = counter.get();
+                    ImplTraitLoweringMode::Param => {
+                        let idx = self.impl_trait_mode.param_and_variable_counter;
                         // Count the number of `impl Trait` things that appear within our bounds.
                         // Since those have been emitted as implicit type args already.
-                        counter.set(idx + self.count_impl_traits(type_ref_id) as u16);
+                        self.impl_trait_mode.param_and_variable_counter =
+                            idx + self.count_impl_traits(type_ref_id) as u16;
+                        let db = self.db;
                         let kind = self
                             .generics()
                             .expect("param impl trait lowering must be in a generic def")
@@ -398,15 +375,17 @@ impl<'a> TyLoweringContext<'a> {
                             })
                             .nth(idx as usize)
                             .map_or(TyKind::Error, |id| {
-                                TyKind::Placeholder(to_placeholder_idx(self.db, id.into()))
+                                TyKind::Placeholder(to_placeholder_idx(db, id.into()))
                             });
                         kind.intern(Interner)
                     }
-                    ImplTraitLoweringState::Variable(counter) => {
-                        let idx = counter.get();
+                    ImplTraitLoweringMode::Variable => {
+                        let idx = self.impl_trait_mode.param_and_variable_counter;
                         // Count the number of `impl Trait` things that appear within our bounds.
                         // Since t hose have been emitted as implicit type args already.
-                        counter.set(idx + self.count_impl_traits(type_ref_id) as u16);
+                        self.impl_trait_mode.param_and_variable_counter =
+                            idx + self.count_impl_traits(type_ref_id) as u16;
+                        let debruijn = self.in_binders;
                         let kind = self
                             .generics()
                             .expect("variable impl trait lowering must be in a generic def")
@@ -423,33 +402,31 @@ impl<'a> TyLoweringContext<'a> {
                             })
                             .nth(idx as usize)
                             .map_or(TyKind::Error, |id| {
-                                TyKind::BoundVar(BoundVar { debruijn: self.in_binders, index: id })
+                                TyKind::BoundVar(BoundVar { debruijn, index: id })
                             });
                         kind.intern(Interner)
                     }
-                    ImplTraitLoweringState::Disallowed => {
+                    ImplTraitLoweringMode::Disallowed => {
                         // FIXME: report error
                         TyKind::Error.intern(Interner)
                     }
                 }
             }
             TypeRef::Macro(macro_call) => {
-                let (mut expander, recursion_start) = {
-                    match RefMut::filter_map(self.expander.borrow_mut(), Option::as_mut) {
+                let (expander, recursion_start) = {
+                    match &mut self.expander {
                         // There already is an expander here, this means we are already recursing
-                        Ok(expander) => (expander, false),
+                        Some(expander) => (expander, false),
                         // No expander was created yet, so we are at the start of the expansion recursion
                         // and therefore have to create an expander.
-                        Err(expander) => (
-                            RefMut::map(expander, |it| {
-                                it.insert(Expander::new(
-                                    self.db.upcast(),
-                                    macro_call.file_id,
-                                    self.resolver.module(),
-                                ))
-                            }),
-                            true,
-                        ),
+                        None => {
+                            let expander = self.expander.insert(Expander::new(
+                                self.db.upcast(),
+                                macro_call.file_id,
+                                self.resolver.module(),
+                            ));
+                            (expander, true)
+                        }
                     }
                 };
                 let ty = {
@@ -465,19 +442,16 @@ impl<'a> TyLoweringContext<'a> {
                             let (mut types_map, mut types_source_map) =
                                 (TypesMap::default(), TypesSourceMap::default());
 
-                            let ctx = expander.ctx(
+                            let mut ctx = expander.ctx(
                                 self.db.upcast(),
                                 &mut types_map,
                                 &mut types_source_map,
                             );
                             // FIXME: Report syntax errors in expansion here
-                            let type_ref = TypeRef::from_ast(&ctx, expanded.tree());
+                            let type_ref = TypeRef::from_ast(&mut ctx, expanded.tree());
 
-                            drop(expander);
-
-                            // FIXME: That may be better served by mutating `self` then restoring, but this requires
-                            // making it `&mut self`.
-                            let inner_ctx = TyLoweringContext {
+                            // Can't mutate `self`, must create a new instance, because of the lifetimes.
+                            let mut inner_ctx = TyLoweringContext {
                                 db: self.db,
                                 resolver: self.resolver,
                                 generics: self.generics.clone(),
@@ -486,30 +460,27 @@ impl<'a> TyLoweringContext<'a> {
                                 in_binders: self.in_binders,
                                 owner: self.owner,
                                 type_param_mode: self.type_param_mode,
-                                impl_trait_mode: self.impl_trait_mode.take(),
-                                expander: RefCell::new(self.expander.take()),
-                                unsized_types: RefCell::new(self.unsized_types.take()),
+                                impl_trait_mode: mem::take(&mut self.impl_trait_mode),
+                                expander: self.expander.take(),
+                                unsized_types: mem::take(&mut self.unsized_types),
                             };
 
                             let ty = inner_ctx.lower_ty(type_ref);
 
-                            self.impl_trait_mode.swap(&inner_ctx.impl_trait_mode);
-                            *self.expander.borrow_mut() = inner_ctx.expander.into_inner();
-                            *self.unsized_types.borrow_mut() = inner_ctx.unsized_types.into_inner();
+                            self.impl_trait_mode = inner_ctx.impl_trait_mode;
+                            self.expander = inner_ctx.expander;
+                            self.unsized_types = inner_ctx.unsized_types;
 
-                            self.expander.borrow_mut().as_mut().unwrap().exit(mark);
+                            self.expander.as_mut().unwrap().exit(mark);
                             Some(ty)
                         }
-                        _ => {
-                            drop(expander);
-                            None
-                        }
+                        _ => None,
                     }
                 };
 
                 // drop the expander, resetting it to pre-recursion state
                 if recursion_start {
-                    *self.expander.borrow_mut() = None;
+                    self.expander = None;
                 }
                 ty.unwrap_or_else(|| TyKind::Error.intern(Interner))
             }
@@ -544,7 +515,7 @@ impl<'a> TyLoweringContext<'a> {
     }
 
     pub(crate) fn lower_ty_relative_path(
-        &self,
+        &mut self,
         ty: Ty,
         // We need the original resolution to lower `Self::AssocTy` correctly
         res: Option<TypeNs>,
@@ -565,7 +536,7 @@ impl<'a> TyLoweringContext<'a> {
     }
 
     pub(crate) fn lower_partly_resolved_path(
-        &self,
+        &mut self,
         resolution: TypeNs,
         resolved_segment: PathSegment<'_>,
         remaining_segments: PathSegments<'_>,
@@ -706,7 +677,7 @@ impl<'a> TyLoweringContext<'a> {
         self.lower_ty_relative_path(ty, Some(resolution), remaining_segments)
     }
 
-    pub(crate) fn lower_path(&self, path: &Path) -> (Ty, Option<TypeNs>) {
+    pub(crate) fn lower_path(&mut self, path: &Path) -> (Ty, Option<TypeNs>) {
         // Resolve the path (in type namespace)
         if let Some(type_ref) = path.type_anchor() {
             let (ty, res) = self.lower_ty_ext(type_ref);
@@ -736,7 +707,7 @@ impl<'a> TyLoweringContext<'a> {
         self.lower_partly_resolved_path(resolution, resolved_segment, remaining_segments, false)
     }
 
-    fn select_associated_type(&self, res: Option<TypeNs>, segment: PathSegment<'_>) -> Ty {
+    fn select_associated_type(&mut self, res: Option<TypeNs>, segment: PathSegment<'_>) -> Ty {
         let Some((generics, res)) = self.generics().zip(res) else {
             return TyKind::Error.intern(Interner);
         };
@@ -746,6 +717,8 @@ impl<'a> TyLoweringContext<'a> {
             res,
             Some(segment.name.clone()),
             move |name, t, associated_ty| {
+                let generics = self.generics().unwrap();
+
                 if name != segment.name {
                     return None;
                 }
@@ -797,7 +770,7 @@ impl<'a> TyLoweringContext<'a> {
     }
 
     fn lower_path_inner(
-        &self,
+        &mut self,
         segment: PathSegment<'_>,
         typeable: TyDefId,
         infer_args: bool,
@@ -814,7 +787,7 @@ impl<'a> TyLoweringContext<'a> {
     /// Collect generic arguments from a path into a `Substs`. See also
     /// `create_substs_for_ast_path` and `def_to_ty` in rustc.
     pub(super) fn substs_from_path(
-        &self,
+        &mut self,
         path: &Path,
         // Note that we don't call `db.value_type(resolved)` here,
         // `ValueTyDefId` is just a convenient way to pass generics and
@@ -855,7 +828,7 @@ impl<'a> TyLoweringContext<'a> {
     }
 
     pub(super) fn substs_from_path_segment(
-        &self,
+        &mut self,
         segment: PathSegment<'_>,
         def: Option<GenericDefId>,
         infer_args: bool,
@@ -870,7 +843,7 @@ impl<'a> TyLoweringContext<'a> {
     }
 
     fn substs_from_args_and_bindings(
-        &self,
+        &mut self,
         args_and_bindings: Option<&GenericArgs>,
         def: Option<GenericDefId>,
         infer_args: bool,
@@ -959,11 +932,11 @@ impl<'a> TyLoweringContext<'a> {
                     self.db,
                     id,
                     arg,
-                    &mut (),
+                    self,
                     self.types_map,
-                    |_, type_ref| self.lower_ty(type_ref),
-                    |_, const_ref, ty| self.lower_const(const_ref, ty),
-                    |_, lifetime_ref| self.lower_lifetime(lifetime_ref),
+                    |this, type_ref| this.lower_ty(type_ref),
+                    |this, const_ref, ty| this.lower_const(const_ref, ty),
+                    |this, lifetime_ref| this.lower_lifetime(lifetime_ref),
                 );
                 substs.push(arg);
             }
@@ -1016,7 +989,7 @@ impl<'a> TyLoweringContext<'a> {
     }
 
     pub(crate) fn lower_trait_ref_from_resolved_path(
-        &self,
+        &mut self,
         resolved: TraitId,
         segment: PathSegment<'_>,
         explicit_self_ty: Ty,
@@ -1025,7 +998,7 @@ impl<'a> TyLoweringContext<'a> {
         TraitRef { trait_id: to_chalk_trait_id(resolved), substitution: substs }
     }
 
-    fn lower_trait_ref_from_path(&self, path: &Path, explicit_self_ty: Ty) -> Option<TraitRef> {
+    fn lower_trait_ref_from_path(&mut self, path: &Path, explicit_self_ty: Ty) -> Option<TraitRef> {
         let resolved = match self.resolver.resolve_path_in_type_ns_fully(self.db.upcast(), path)? {
             // FIXME(trait_alias): We need to handle trait alias here.
             TypeNs::TraitId(tr) => tr,
@@ -1035,12 +1008,16 @@ impl<'a> TyLoweringContext<'a> {
         Some(self.lower_trait_ref_from_resolved_path(resolved, segment, explicit_self_ty))
     }
 
-    fn lower_trait_ref(&self, trait_ref: &HirTraitRef, explicit_self_ty: Ty) -> Option<TraitRef> {
+    fn lower_trait_ref(
+        &mut self,
+        trait_ref: &HirTraitRef,
+        explicit_self_ty: Ty,
+    ) -> Option<TraitRef> {
         self.lower_trait_ref_from_path(&trait_ref.path, explicit_self_ty)
     }
 
     fn trait_ref_substs_from_path(
-        &self,
+        &mut self,
         segment: PathSegment<'_>,
         resolved: TraitId,
         explicit_self_ty: Ty,
@@ -1049,11 +1026,11 @@ impl<'a> TyLoweringContext<'a> {
     }
 
     pub(crate) fn lower_where_predicate<'b>(
-        &'b self,
+        &'b mut self,
         where_predicate: &'b WherePredicate,
         &def: &GenericDefId,
         ignore_bindings: bool,
-    ) -> impl Iterator<Item = QuantifiedWhereClause> + 'b {
+    ) -> impl Iterator<Item = QuantifiedWhereClause> + use<'a, 'b> {
         match where_predicate {
             WherePredicate::ForLifetime { target, bound, .. }
             | WherePredicate::TypeBound { target, bound } => {
@@ -1087,12 +1064,12 @@ impl<'a> TyLoweringContext<'a> {
         .into_iter()
     }
 
-    pub(crate) fn lower_type_bound(
-        &'a self,
-        bound: &'a TypeBound,
+    pub(crate) fn lower_type_bound<'b>(
+        &'b mut self,
+        bound: &'b TypeBound,
         self_ty: Ty,
         ignore_bindings: bool,
-    ) -> impl Iterator<Item = QuantifiedWhereClause> + 'a {
+    ) -> impl Iterator<Item = QuantifiedWhereClause> + use<'b, 'a> {
         let mut trait_ref = None;
         let clause = match bound {
             TypeBound::Path(path, TraitBoundModifier::None) => {
@@ -1111,7 +1088,7 @@ impl<'a> TyLoweringContext<'a> {
                     .lower_trait_ref_from_path(path, self_ty.clone())
                     .map(|trait_ref| trait_ref.hir_trait_id());
                 if trait_id == sized_trait {
-                    self.unsized_types.borrow_mut().insert(self_ty);
+                    self.unsized_types.insert(self_ty);
                 }
                 None
             }
@@ -1131,17 +1108,18 @@ impl<'a> TyLoweringContext<'a> {
         };
         clause.into_iter().chain(
             trait_ref
-                .into_iter()
                 .filter(move |_| !ignore_bindings)
-                .flat_map(move |tr| self.assoc_type_bindings_from_type_bound(bound, tr)),
+                .map(move |tr| self.assoc_type_bindings_from_type_bound(bound, tr))
+                .into_iter()
+                .flatten(),
         )
     }
 
-    fn assoc_type_bindings_from_type_bound(
-        &'a self,
-        bound: &'a TypeBound,
+    fn assoc_type_bindings_from_type_bound<'b>(
+        &'b mut self,
+        bound: &'b TypeBound,
         trait_ref: TraitRef,
-    ) -> impl Iterator<Item = QuantifiedWhereClause> + 'a {
+    ) -> impl Iterator<Item = QuantifiedWhereClause> + use<'b, 'a> {
         let last_segment = match bound {
             TypeBound::Path(path, TraitBoundModifier::None) | TypeBound::ForLifetime(_, path) => {
                 path.segments().last()
@@ -1192,22 +1170,16 @@ impl<'a> TyLoweringContext<'a> {
                     binding.type_ref.as_ref().map_or(0, |_| 1) + binding.bounds.len(),
                 );
                 if let Some(type_ref) = binding.type_ref {
-                    match (&self.types_map[type_ref], &self.impl_trait_mode) {
-                        (TypeRef::ImplTrait(_), ImplTraitLoweringState::Disallowed) => (),
-                        (
-                            _,
-                            ImplTraitLoweringState::Disallowed | ImplTraitLoweringState::Opaque(_),
-                        ) => {
+                    match (&self.types_map[type_ref], self.impl_trait_mode.mode) {
+                        (TypeRef::ImplTrait(_), ImplTraitLoweringMode::Disallowed) => (),
+                        (_, ImplTraitLoweringMode::Disallowed | ImplTraitLoweringMode::Opaque) => {
                             let ty = self.lower_ty(type_ref);
                             let alias_eq =
                                 AliasEq { alias: AliasTy::Projection(projection_ty.clone()), ty };
                             predicates
                                 .push(crate::wrap_empty_binders(WhereClause::AliasEq(alias_eq)));
                         }
-                        (
-                            _,
-                            ImplTraitLoweringState::Param(_) | ImplTraitLoweringState::Variable(_),
-                        ) => {
+                        (_, ImplTraitLoweringMode::Param | ImplTraitLoweringMode::Variable) => {
                             // Find the generic index for the target of our `bound`
                             let target_param_idx = self
                                 .resolver
@@ -1244,14 +1216,14 @@ impl<'a> TyLoweringContext<'a> {
                                     self.owner,
                                 )
                                 .with_type_param_mode(self.type_param_mode);
-                                match &self.impl_trait_mode {
-                                    ImplTraitLoweringState::Param(_) => {
+                                match self.impl_trait_mode.mode {
+                                    ImplTraitLoweringMode::Param => {
                                         ext.impl_trait_mode =
-                                            ImplTraitLoweringState::Param(Cell::new(counter));
+                                            ImplTraitLoweringState::param(counter);
                                     }
-                                    ImplTraitLoweringState::Variable(_) => {
+                                    ImplTraitLoweringMode::Variable => {
                                         ext.impl_trait_mode =
-                                            ImplTraitLoweringState::Variable(Cell::new(counter));
+                                            ImplTraitLoweringState::variable(counter);
                                     }
                                     _ => unreachable!(),
                                 }
@@ -1278,7 +1250,7 @@ impl<'a> TyLoweringContext<'a> {
             })
     }
 
-    fn lower_dyn_trait(&self, bounds: &[TypeBound]) -> Ty {
+    fn lower_dyn_trait(&mut self, bounds: &[TypeBound]) -> Ty {
         let self_ty = TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)).intern(Interner);
         // INVARIANT: The principal trait bound, if present, must come first. Others may be in any
         // order but should be in the same order for the same set but possibly different order of
@@ -1287,22 +1259,26 @@ impl<'a> TyLoweringContext<'a> {
         // These invariants are utilized by `TyExt::dyn_trait()` and chalk.
         let mut lifetime = None;
         let bounds = self.with_shifted_in(DebruijnIndex::ONE, |ctx| {
-            let mut bounds: Vec<_> = bounds
-                .iter()
-                .flat_map(|b| ctx.lower_type_bound(b, self_ty.clone(), false))
-                .filter(|b| match b.skip_binders() {
-                    WhereClause::Implemented(_) | WhereClause::AliasEq(_) => true,
-                    WhereClause::LifetimeOutlives(_) => false,
-                    WhereClause::TypeOutlives(t) => {
-                        lifetime = Some(t.lifetime.clone());
-                        false
+            let mut lowered_bounds = Vec::new();
+            for b in bounds {
+                ctx.lower_type_bound(b, self_ty.clone(), false).for_each(|b| {
+                    let filter = match b.skip_binders() {
+                        WhereClause::Implemented(_) | WhereClause::AliasEq(_) => true,
+                        WhereClause::LifetimeOutlives(_) => false,
+                        WhereClause::TypeOutlives(t) => {
+                            lifetime = Some(t.lifetime.clone());
+                            false
+                        }
+                    };
+                    if filter {
+                        lowered_bounds.push(b);
                     }
-                })
-                .collect();
+                });
+            }
 
             let mut multiple_regular_traits = false;
             let mut multiple_same_projection = false;
-            bounds.sort_unstable_by(|lhs, rhs| {
+            lowered_bounds.sort_unstable_by(|lhs, rhs| {
                 use std::cmp::Ordering;
                 match (lhs.skip_binders(), rhs.skip_binders()) {
                     (WhereClause::Implemented(lhs), WhereClause::Implemented(rhs)) => {
@@ -1344,13 +1320,13 @@ impl<'a> TyLoweringContext<'a> {
                 return None;
             }
 
-            bounds.first().and_then(|b| b.trait_id())?;
+            lowered_bounds.first().and_then(|b| b.trait_id())?;
 
             // As multiple occurrences of the same auto traits *are* permitted, we deduplicate the
             // bounds. We shouldn't have repeated elements besides auto traits at this point.
-            bounds.dedup();
+            lowered_bounds.dedup();
 
-            Some(QuantifiedWhereClauses::from_iter(Interner, bounds))
+            Some(QuantifiedWhereClauses::from_iter(Interner, lowered_bounds))
         });
 
         if let Some(bounds) = bounds {
@@ -1376,16 +1352,16 @@ impl<'a> TyLoweringContext<'a> {
         }
     }
 
-    fn lower_impl_trait(&self, bounds: &[TypeBound], krate: CrateId) -> ImplTrait {
+    fn lower_impl_trait(&mut self, bounds: &[TypeBound], krate: CrateId) -> ImplTrait {
         cov_mark::hit!(lower_rpit);
         let self_ty = TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)).intern(Interner);
         let predicates = self.with_shifted_in(DebruijnIndex::ONE, |ctx| {
-            let mut predicates: Vec<_> = bounds
-                .iter()
-                .flat_map(|b| ctx.lower_type_bound(b, self_ty.clone(), false))
-                .collect();
+            let mut predicates = Vec::new();
+            for b in bounds {
+                predicates.extend(ctx.lower_type_bound(b, self_ty.clone(), false));
+            }
 
-            if !ctx.unsized_types.borrow().contains(&self_ty) {
+            if !ctx.unsized_types.contains(&self_ty) {
                 let sized_trait = ctx
                     .db
                     .lang_item(krate, LangItem::Sized)
@@ -1562,7 +1538,7 @@ pub(crate) fn field_types_query(
     };
     let generics = generics(db.upcast(), def);
     let mut res = ArenaMap::default();
-    let ctx = TyLoweringContext::new(db, &resolver, var_data.types_map(), def.into())
+    let mut ctx = TyLoweringContext::new(db, &resolver, var_data.types_map(), def.into())
         .with_type_param_mode(ParamLoweringMode::Variable);
     for (field_id, field_data) in var_data.fields().iter() {
         res.insert(field_id, make_binders(db, &generics, ctx.lower_ty(field_data.type_ref)));
@@ -1596,7 +1572,7 @@ pub(crate) fn generic_predicates_for_param_query(
     let generics = generics(db.upcast(), def);
 
     // we have to filter out all other predicates *first*, before attempting to lower them
-    let predicate = |pred: &_, def: &_, ctx: &TyLoweringContext<'_>| match pred {
+    let predicate = |pred: &_, def: &_, ctx: &mut TyLoweringContext<'_>| match pred {
         WherePredicate::ForLifetime { target, bound, .. }
         | WherePredicate::TypeBound { target, bound, .. } => {
             let invalid_target = match target {
@@ -1642,16 +1618,19 @@ pub(crate) fn generic_predicates_for_param_query(
     let mut predicates = Vec::new();
     for (params, def) in resolver.all_generic_params() {
         ctx.types_map = &params.types_map;
-        predicates.extend(
-            params.where_predicates().filter(|pred| predicate(pred, def, &ctx)).flat_map(|pred| {
-                ctx.lower_where_predicate(pred, def, true).map(|p| make_binders(db, &generics, p))
-            }),
-        );
+        for pred in params.where_predicates() {
+            if predicate(pred, def, &mut ctx) {
+                predicates.extend(
+                    ctx.lower_where_predicate(pred, def, true)
+                        .map(|p| make_binders(db, &generics, p)),
+                );
+            }
+        }
     }
 
     let subst = generics.bound_vars_subst(db, DebruijnIndex::INNERMOST);
     if !subst.is_empty(Interner) {
-        let explicitly_unsized_tys = ctx.unsized_types.into_inner();
+        let explicitly_unsized_tys = ctx.unsized_types;
         if let Some(implicitly_sized_predicates) = implicitly_sized_clauses(
             db,
             param_id.parent,
@@ -1731,7 +1710,7 @@ pub(crate) fn trait_environment_query(
 
     let subst = generics(db.upcast(), def).placeholder_subst(db);
     if !subst.is_empty(Interner) {
-        let explicitly_unsized_tys = ctx.unsized_types.into_inner();
+        let explicitly_unsized_tys = ctx.unsized_types;
         if let Some(implicitly_sized_clauses) =
             implicitly_sized_clauses(db, def, &explicitly_unsized_tys, &subst, &resolver)
         {
@@ -1801,16 +1780,19 @@ where
     let mut predicates = Vec::new();
     for (params, def) in resolver.all_generic_params() {
         ctx.types_map = &params.types_map;
-        predicates.extend(params.where_predicates().filter(|pred| filter(pred, def)).flat_map(
-            |pred| {
-                ctx.lower_where_predicate(pred, def, false).map(|p| make_binders(db, &generics, p))
-            },
-        ));
+        for pred in params.where_predicates() {
+            if filter(pred, def) {
+                predicates.extend(
+                    ctx.lower_where_predicate(pred, def, false)
+                        .map(|p| make_binders(db, &generics, p)),
+                );
+            }
+        }
     }
 
     if generics.len() > 0 {
         let subst = generics.bound_vars_subst(db, DebruijnIndex::INNERMOST);
-        let explicitly_unsized_tys = ctx.unsized_types.into_inner();
+        let explicitly_unsized_tys = ctx.unsized_types;
         if let Some(implicitly_sized_predicates) =
             implicitly_sized_clauses(db, def, &explicitly_unsized_tys, &subst, &resolver)
         {
@@ -1906,7 +1888,8 @@ pub(crate) fn generic_defaults_query(db: &dyn HirDatabase, def: GenericDefId) ->
                     let mut val = p.default.as_ref().map_or_else(
                         || unknown_const_as_generic(db.const_param_ty(id)),
                         |c| {
-                            let c = ctx.lower_const(c, ctx.lower_ty(p.ty));
+                            let param_ty = ctx.lower_ty(p.ty);
+                            let c = ctx.lower_const(c, param_ty);
                             c.cast(Interner)
                         },
                     );
@@ -1946,11 +1929,11 @@ pub(crate) fn generic_defaults_recover(
 fn fn_sig_for_fn(db: &dyn HirDatabase, def: FunctionId) -> PolyFnSig {
     let data = db.function_data(def);
     let resolver = def.resolver(db.upcast());
-    let ctx_params = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
+    let mut ctx_params = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
         .with_impl_trait_mode(ImplTraitLoweringMode::Variable)
         .with_type_param_mode(ParamLoweringMode::Variable);
     let params = data.params.iter().map(|&tr| ctx_params.lower_ty(tr));
-    let ctx_ret = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
+    let mut ctx_ret = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
         .with_impl_trait_mode(ImplTraitLoweringMode::Opaque)
         .with_type_param_mode(ParamLoweringMode::Variable);
     let ret = ctx_ret.lower_ty(data.ret_type);
@@ -1982,7 +1965,7 @@ fn type_for_const(db: &dyn HirDatabase, def: ConstId) -> Binders<Ty> {
     let data = db.const_data(def);
     let generics = generics(db.upcast(), def.into());
     let resolver = def.resolver(db.upcast());
-    let ctx = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
+    let mut ctx = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
         .with_type_param_mode(ParamLoweringMode::Variable);
 
     make_binders(db, &generics, ctx.lower_ty(data.type_ref))
@@ -1992,7 +1975,7 @@ fn type_for_const(db: &dyn HirDatabase, def: ConstId) -> Binders<Ty> {
 fn type_for_static(db: &dyn HirDatabase, def: StaticId) -> Binders<Ty> {
     let data = db.static_data(def);
     let resolver = def.resolver(db.upcast());
-    let ctx = TyLoweringContext::new(db, &resolver, &data.types_map, def.into());
+    let mut ctx = TyLoweringContext::new(db, &resolver, &data.types_map, def.into());
 
     Binders::empty(Interner, ctx.lower_ty(data.type_ref))
 }
@@ -2001,7 +1984,7 @@ fn fn_sig_for_struct_constructor(db: &dyn HirDatabase, def: StructId) -> PolyFnS
     let struct_data = db.struct_data(def);
     let fields = struct_data.variant_data.fields();
     let resolver = def.resolver(db.upcast());
-    let ctx = TyLoweringContext::new(
+    let mut ctx = TyLoweringContext::new(
         db,
         &resolver,
         struct_data.variant_data.types_map(),
@@ -2038,7 +2021,7 @@ fn fn_sig_for_enum_variant_constructor(db: &dyn HirDatabase, def: EnumVariantId)
     let var_data = db.enum_variant_data(def);
     let fields = var_data.variant_data.fields();
     let resolver = def.resolver(db.upcast());
-    let ctx = TyLoweringContext::new(
+    let mut ctx = TyLoweringContext::new(
         db,
         &resolver,
         var_data.variant_data.types_map(),
@@ -2087,7 +2070,7 @@ fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders<Ty> {
     let generics = generics(db.upcast(), t.into());
     let resolver = t.resolver(db.upcast());
     let type_alias_data = db.type_alias_data(t);
-    let ctx = TyLoweringContext::new(db, &resolver, &type_alias_data.types_map, t.into())
+    let mut ctx = TyLoweringContext::new(db, &resolver, &type_alias_data.types_map, t.into())
         .with_impl_trait_mode(ImplTraitLoweringMode::Opaque)
         .with_type_param_mode(ParamLoweringMode::Variable);
     let inner = if type_alias_data.is_extern {
@@ -2169,7 +2152,7 @@ pub(crate) fn impl_self_ty_query(db: &dyn HirDatabase, impl_id: ImplId) -> Binde
     let impl_data = db.impl_data(impl_id);
     let resolver = impl_id.resolver(db.upcast());
     let generics = generics(db.upcast(), impl_id.into());
-    let ctx = TyLoweringContext::new(db, &resolver, &impl_data.types_map, impl_id.into())
+    let mut ctx = TyLoweringContext::new(db, &resolver, &impl_data.types_map, impl_id.into())
         .with_type_param_mode(ParamLoweringMode::Variable);
     make_binders(db, &generics, ctx.lower_ty(impl_data.self_ty))
 }
@@ -2179,7 +2162,8 @@ pub(crate) fn const_param_ty_query(db: &dyn HirDatabase, def: ConstParamId) -> T
     let parent_data = db.generic_params(def.parent());
     let data = &parent_data[def.local_id()];
     let resolver = def.parent().resolver(db.upcast());
-    let ctx = TyLoweringContext::new(db, &resolver, &parent_data.types_map, def.parent().into());
+    let mut ctx =
+        TyLoweringContext::new(db, &resolver, &parent_data.types_map, def.parent().into());
     match data {
         TypeOrConstParamData::TypeParamData(_) => {
             never!();
@@ -2201,7 +2185,7 @@ pub(crate) fn impl_self_ty_recover(
 pub(crate) fn impl_trait_query(db: &dyn HirDatabase, impl_id: ImplId) -> Option<Binders<TraitRef>> {
     let impl_data = db.impl_data(impl_id);
     let resolver = impl_id.resolver(db.upcast());
-    let ctx = TyLoweringContext::new(db, &resolver, &impl_data.types_map, impl_id.into())
+    let mut ctx = TyLoweringContext::new(db, &resolver, &impl_data.types_map, impl_id.into())
         .with_type_param_mode(ParamLoweringMode::Variable);
     let (self_ty, binders) = db.impl_self_ty(impl_id).into_value_and_skipped_binders();
     let target_trait = impl_data.target_trait.as_ref()?;
@@ -2215,17 +2199,13 @@ pub(crate) fn return_type_impl_traits(
     // FIXME unify with fn_sig_for_fn instead of doing lowering twice, maybe
     let data = db.function_data(def);
     let resolver = def.resolver(db.upcast());
-    let ctx_ret = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
+    let mut ctx_ret = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
         .with_impl_trait_mode(ImplTraitLoweringMode::Opaque)
         .with_type_param_mode(ParamLoweringMode::Variable);
     let _ret = ctx_ret.lower_ty(data.ret_type);
     let generics = generics(db.upcast(), def.into());
-    let return_type_impl_traits = ImplTraits {
-        impl_traits: match ctx_ret.impl_trait_mode {
-            ImplTraitLoweringState::Opaque(x) => x.into_inner(),
-            _ => unreachable!(),
-        },
-    };
+    let return_type_impl_traits =
+        ImplTraits { impl_traits: ctx_ret.impl_trait_mode.opaque_type_data };
     if return_type_impl_traits.impl_traits.is_empty() {
         None
     } else {
@@ -2239,18 +2219,13 @@ pub(crate) fn type_alias_impl_traits(
 ) -> Option<Arc<Binders<ImplTraits>>> {
     let data = db.type_alias_data(def);
     let resolver = def.resolver(db.upcast());
-    let ctx = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
+    let mut ctx = TyLoweringContext::new(db, &resolver, &data.types_map, def.into())
         .with_impl_trait_mode(ImplTraitLoweringMode::Opaque)
         .with_type_param_mode(ParamLoweringMode::Variable);
     if let Some(type_ref) = data.type_ref {
         let _ty = ctx.lower_ty(type_ref);
     }
-    let type_alias_impl_traits = ImplTraits {
-        impl_traits: match ctx.impl_trait_mode {
-            ImplTraitLoweringState::Opaque(x) => x.into_inner(),
-            _ => unreachable!(),
-        },
-    };
+    let type_alias_impl_traits = ImplTraits { impl_traits: ctx.impl_trait_mode.opaque_type_data };
     if type_alias_impl_traits.impl_traits.is_empty() {
         None
     } else {
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
index e73b9dc27d1..d7029651fc1 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs
@@ -12,8 +12,8 @@ use hir_def::{
     lang_item::LangItem,
     layout::{TagEncoding, Variants},
     resolver::{HasResolver, TypeNs, ValueNs},
-    AdtId, ConstId, DefWithBodyId, EnumVariantId, FunctionId, HasModule, ItemContainerId, Lookup,
-    StaticId, VariantId,
+    AdtId, DefWithBodyId, EnumVariantId, FunctionId, HasModule, ItemContainerId, Lookup, StaticId,
+    VariantId,
 };
 use hir_expand::{mod_path::path, name::Name, HirFileIdExt, InFile};
 use intern::sym;
@@ -40,8 +40,8 @@ use crate::{
     static_lifetime,
     traits::FnTrait,
     utils::{detect_variant_from_bytes, ClosureSubst},
-    CallableDefId, ClosureId, ComplexMemoryMap, Const, ConstScalar, FnDefId, Interner, MemoryMap,
-    Substitution, TraitEnvironment, Ty, TyBuilder, TyExt, TyKind,
+    CallableDefId, ClosureId, ComplexMemoryMap, Const, ConstData, ConstScalar, FnDefId, Interner,
+    MemoryMap, Substitution, TraitEnvironment, Ty, TyBuilder, TyExt, TyKind,
 };
 
 use super::{
@@ -585,13 +585,9 @@ pub fn interpret_mir(
     // (and probably should) do better here, for example by excluding bindings outside of the target expression.
     assert_placeholder_ty_is_unused: bool,
     trait_env: Option<Arc<TraitEnvironment>>,
-) -> (Result<Const>, MirOutput) {
+) -> Result<(Result<Const>, MirOutput)> {
     let ty = body.locals[return_slot()].ty.clone();
-    let mut evaluator =
-        match Evaluator::new(db, body.owner, assert_placeholder_ty_is_unused, trait_env) {
-            Ok(it) => it,
-            Err(e) => return (Err(e), MirOutput { stdout: vec![], stderr: vec![] }),
-        };
+    let mut evaluator = Evaluator::new(db, body.owner, assert_placeholder_ty_is_unused, trait_env)?;
     let it: Result<Const> = (|| {
         if evaluator.ptr_size() != std::mem::size_of::<usize>() {
             not_supported!("targets with different pointer size from host");
@@ -613,7 +609,7 @@ pub fn interpret_mir(
         };
         Ok(intern_const_scalar(ConstScalar::Bytes(bytes, memory_map), ty))
     })();
-    (it, MirOutput { stdout: evaluator.stdout, stderr: evaluator.stderr })
+    Ok((it, MirOutput { stdout: evaluator.stdout, stderr: evaluator.stderr }))
 }
 
 #[cfg(test)]
@@ -1899,8 +1895,8 @@ impl Evaluator<'_> {
 
     #[allow(clippy::double_parens)]
     fn allocate_const_in_heap(&mut self, locals: &Locals, konst: &Const) -> Result<Interval> {
-        let ty = &konst.data(Interner).ty;
-        let chalk_ir::ConstValue::Concrete(c) = &konst.data(Interner).value else {
+        let ConstData { ty, value: chalk_ir::ConstValue::Concrete(c) } = &konst.data(Interner)
+        else {
             not_supported!("evaluating non concrete constant");
         };
         let result_owner;
@@ -2908,14 +2904,14 @@ impl Evaluator<'_> {
 
 pub fn render_const_using_debug_impl(
     db: &dyn HirDatabase,
-    owner: ConstId,
+    owner: DefWithBodyId,
     c: &Const,
 ) -> Result<String> {
-    let mut evaluator = Evaluator::new(db, owner.into(), false, None)?;
+    let mut evaluator = Evaluator::new(db, owner, false, None)?;
     let locals = &Locals {
         ptr: ArenaMap::new(),
         body: db
-            .mir_body(owner.into())
+            .mir_body(owner)
             .map_err(|_| MirEvalError::NotSupported("unreachable".to_owned()))?,
         drop_flags: DropFlags::default(),
     };
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/tests.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/tests.rs
index 595a78da10f..30d11373732 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/tests.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/tests.rs
@@ -32,7 +32,7 @@ fn eval_main(db: &TestDB, file_id: EditionedFileId) -> Result<(String, String),
         )
         .map_err(|e| MirEvalError::MirLowerError(func_id, e))?;
 
-    let (result, output) = interpret_mir(db, body, false, None);
+    let (result, output) = interpret_mir(db, body, false, None)?;
     result?;
     Ok((output.stdout().into_owned(), output.stderr().into_owned()))
 }
diff --git a/src/tools/rust-analyzer/crates/hir/src/lib.rs b/src/tools/rust-analyzer/crates/hir/src/lib.rs
index 88eb3b127e0..ebd84fd2be2 100644
--- a/src/tools/rust-analyzer/crates/hir/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/lib.rs
@@ -34,7 +34,10 @@ pub mod term_search;
 
 mod display;
 
-use std::{mem::discriminant, ops::ControlFlow};
+use std::{
+    mem::discriminant,
+    ops::{ControlFlow, Not},
+};
 
 use arrayvec::ArrayVec;
 use base_db::{CrateDisplayName, CrateId, CrateOrigin};
@@ -2303,22 +2306,15 @@ impl Function {
         self,
         db: &dyn HirDatabase,
         span_formatter: impl Fn(FileId, TextRange) -> String,
-    ) -> String {
+    ) -> Result<String, ConstEvalError> {
         let krate = HasModule::krate(&self.id, db.upcast());
         let edition = db.crate_graph()[krate].edition;
-        let body = match db.monomorphized_mir_body(
+        let body = db.monomorphized_mir_body(
             self.id.into(),
             Substitution::empty(Interner),
             db.trait_environment(self.id.into()),
-        ) {
-            Ok(body) => body,
-            Err(e) => {
-                let mut r = String::new();
-                _ = e.pretty_print(&mut r, db, &span_formatter, edition);
-                return r;
-            }
-        };
-        let (result, output) = interpret_mir(db, body, false, None);
+        )?;
+        let (result, output) = interpret_mir(db, body, false, None)?;
         let mut text = match result {
             Ok(_) => "pass".to_owned(),
             Err(e) => {
@@ -2337,7 +2333,7 @@ impl Function {
             text += "\n--------- stderr ---------\n";
             text += &stderr;
         }
-        text
+        Ok(text)
     }
 }
 
@@ -2560,9 +2556,9 @@ impl Const {
     /// Evaluate the constant and return the result as a string.
     ///
     /// This function is intended for IDE assistance, different from [`Const::render_eval`].
-    pub fn eval(self, db: &dyn HirDatabase, edition: Edition) -> Result<String, ConstEvalError> {
+    pub fn eval(self, db: &dyn HirDatabase) -> Result<String, ConstEvalError> {
         let c = db.const_eval(self.id.into(), Substitution::empty(Interner), None)?;
-        Ok(format!("{}", c.display(db, edition)))
+        Ok(format!("{}", c.display(db, self.krate(db).edition(db))))
     }
 
     /// Evaluate the constant and return the result as a string, with more detailed information.
@@ -2597,7 +2593,7 @@ impl Const {
                 }
             }
         }
-        if let Ok(s) = mir::render_const_using_debug_impl(db, self.id, &c) {
+        if let Ok(s) = mir::render_const_using_debug_impl(db, self.id.into(), &c) {
             Ok(s)
         } else {
             Ok(format!("{}", c.display(db, edition)))
@@ -2636,6 +2632,53 @@ impl Static {
     pub fn ty(self, db: &dyn HirDatabase) -> Type {
         Type::from_value_def(db, self.id)
     }
+
+    /// Evaluate the static and return the result as a string.
+    ///
+    /// This function is intended for IDE assistance, different from [`Static::render_eval`].
+    pub fn eval(self, db: &dyn HirDatabase) -> Result<String, ConstEvalError> {
+        let c = db.const_eval(self.id.into(), Substitution::empty(Interner), None)?;
+        Ok(format!("{}", c.display(db, self.krate(db).edition(db))))
+    }
+
+    /// Evaluate the static and return the result as a string, with more detailed information.
+    ///
+    /// This function is intended for user-facing display.
+    pub fn render_eval(
+        self,
+        db: &dyn HirDatabase,
+        edition: Edition,
+    ) -> Result<String, ConstEvalError> {
+        let c = db.const_eval(self.id.into(), Substitution::empty(Interner), None)?;
+        let data = &c.data(Interner);
+        if let TyKind::Scalar(s) = data.ty.kind(Interner) {
+            if matches!(s, Scalar::Int(_) | Scalar::Uint(_)) {
+                if let hir_ty::ConstValue::Concrete(c) = &data.value {
+                    if let hir_ty::ConstScalar::Bytes(b, _) = &c.interned {
+                        let value = u128::from_le_bytes(mir::pad16(b, false));
+                        let value_signed =
+                            i128::from_le_bytes(mir::pad16(b, matches!(s, Scalar::Int(_))));
+                        let mut result = if let Scalar::Int(_) = s {
+                            value_signed.to_string()
+                        } else {
+                            value.to_string()
+                        };
+                        if value >= 10 {
+                            format_to!(result, " ({value:#X})");
+                            return Ok(result);
+                        } else {
+                            return Ok(result);
+                        }
+                    }
+                }
+            }
+        }
+        if let Ok(s) = mir::render_const_using_debug_impl(db, self.id.into(), &c) {
+            Ok(s)
+        } else {
+            Ok(format!("{}", c.display(db, edition)))
+        }
+    }
 }
 
 impl HasVisibility for Static {
@@ -2697,6 +2740,18 @@ impl Trait {
         hir_ty::dyn_compatibility::dyn_compatibility(db, self.id)
     }
 
+    pub fn dyn_compatibility_all_violations(
+        &self,
+        db: &dyn HirDatabase,
+    ) -> Option<Vec<DynCompatibilityViolation>> {
+        let mut violations = vec![];
+        hir_ty::dyn_compatibility::dyn_compatibility_with_callback(db, self.id, &mut |violation| {
+            violations.push(violation);
+            ControlFlow::Continue(())
+        });
+        violations.is_empty().not().then_some(violations)
+    }
+
     fn all_macro_calls(&self, db: &dyn HirDatabase) -> Box<[(AstId<ast::Item>, MacroCallId)]> {
         db.trait_data(self.id)
             .macro_calls
diff --git a/src/tools/rust-analyzer/crates/hir/src/semantics.rs b/src/tools/rust-analyzer/crates/hir/src/semantics.rs
index feb9a344d8a..9d3f8e5fba4 100644
--- a/src/tools/rust-analyzer/crates/hir/src/semantics.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/semantics.rs
@@ -1,5 +1,6 @@
 //! See `Semantics`.
 
+mod child_by_source;
 mod source_to_def;
 
 use std::{
@@ -1271,9 +1272,9 @@ impl<'db> SemanticsImpl<'db> {
         let analyze = self.analyze(ty.syntax())?;
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let ctx =
+        let mut ctx =
             LowerCtx::new(self.db.upcast(), analyze.file_id, &mut types_map, &mut types_source_map);
-        let type_ref = crate::TypeRef::from_ast(&ctx, ty.clone());
+        let type_ref = crate::TypeRef::from_ast(&mut ctx, ty.clone());
         let ty = hir_ty::TyLoweringContext::new_maybe_unowned(
             self.db,
             &analyze.resolver,
@@ -1289,9 +1290,9 @@ impl<'db> SemanticsImpl<'db> {
         let analyze = self.analyze(path.syntax())?;
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let ctx =
+        let mut ctx =
             LowerCtx::new(self.db.upcast(), analyze.file_id, &mut types_map, &mut types_source_map);
-        let hir_path = Path::from_src(&ctx, path.clone())?;
+        let hir_path = Path::from_src(&mut ctx, path.clone())?;
         match analyze.resolver.resolve_path_in_type_ns_fully(self.db.upcast(), &hir_path)? {
             TypeNs::TraitId(id) => Some(Trait { id }),
             _ => None,
@@ -1974,9 +1975,9 @@ impl SemanticsScope<'_> {
     pub fn speculative_resolve(&self, ast_path: &ast::Path) -> Option<PathResolution> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let ctx =
+        let mut ctx =
             LowerCtx::new(self.db.upcast(), self.file_id, &mut types_map, &mut types_source_map);
-        let path = Path::from_src(&ctx, ast_path.clone())?;
+        let path = Path::from_src(&mut ctx, ast_path.clone())?;
         resolve_hir_path(
             self.db,
             &self.resolver,
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/child_by_source.rs b/src/tools/rust-analyzer/crates/hir/src/semantics/child_by_source.rs
index 0438278ca27..ec65ea9a9a8 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/child_by_source.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/semantics/child_by_source.rs
@@ -8,7 +8,7 @@ use either::Either;
 use hir_expand::{attrs::collect_attrs, HirFileId};
 use syntax::{ast, AstPtr};
 
-use crate::{
+use hir_def::{
     db::DefDatabase,
     dyn_map::{
         keys::{self, Key},
@@ -23,7 +23,7 @@ use crate::{
     VariantId,
 };
 
-pub trait ChildBySource {
+pub(crate) trait ChildBySource {
     fn child_by_source(&self, db: &dyn DefDatabase, file_id: HirFileId) -> DynMap {
         let mut res = DynMap::default();
         self.child_by_source_to(db, &mut res, file_id);
diff --git a/src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs b/src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs
index 5357e824d09..08333c2d76c 100644
--- a/src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs
@@ -87,7 +87,6 @@
 
 use either::Either;
 use hir_def::{
-    child_by_source::ChildBySource,
     dyn_map::{
         keys::{self, Key},
         DynMap,
@@ -111,7 +110,10 @@ use syntax::{
     AstNode, AstPtr, SyntaxNode,
 };
 
-use crate::{db::HirDatabase, InFile, InlineAsmOperand, SemanticsImpl};
+use crate::{
+    db::HirDatabase, semantics::child_by_source::ChildBySource, InFile, InlineAsmOperand,
+    SemanticsImpl,
+};
 
 #[derive(Default)]
 pub(super) struct SourceToDefCache {
diff --git a/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs b/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs
index 8d6e228e14c..c16454cff68 100644
--- a/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs
@@ -616,9 +616,9 @@ impl SourceAnalyzer {
     ) -> Option<Macro> {
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let ctx =
+        let mut ctx =
             LowerCtx::new(db.upcast(), macro_call.file_id, &mut types_map, &mut types_source_map);
-        let path = macro_call.value.path().and_then(|ast| Path::from_src(&ctx, ast))?;
+        let path = macro_call.value.path().and_then(|ast| Path::from_src(&mut ctx, ast))?;
         self.resolver
             .resolve_path_as_macro(db.upcast(), path.mod_path()?, Some(MacroSubNs::Bang))
             .map(|(it, _)| it.into())
@@ -731,8 +731,9 @@ impl SourceAnalyzer {
 
         let (mut types_map, mut types_source_map) =
             (TypesMap::default(), TypesSourceMap::default());
-        let ctx = LowerCtx::new(db.upcast(), self.file_id, &mut types_map, &mut types_source_map);
-        let hir_path = Path::from_src(&ctx, path.clone())?;
+        let mut ctx =
+            LowerCtx::new(db.upcast(), self.file_id, &mut types_map, &mut types_source_map);
+        let hir_path = Path::from_src(&mut ctx, path.clone())?;
 
         // Case where path is a qualifier of a use tree, e.g. foo::bar::{Baz, Qux} where we are
         // trying to resolve foo::bar.
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs
index f01b4ea0fd4..83f4a6b123c 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_tuple_struct_to_named_struct.rs
@@ -104,7 +104,7 @@ fn edit_struct_def(
                 ast::make::tokens::single_newline().text(),
             );
             edit.insert(tuple_fields_text_range.start(), w.syntax().text());
-            if !w.syntax().last_token().is_some_and(|t| t.kind() == SyntaxKind::COMMA) {
+            if w.syntax().last_token().is_none_or(|t| t.kind() != SyntaxKind::COMMA) {
                 edit.insert(tuple_fields_text_range.start(), ",");
             }
             edit.insert(
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_fn_type_alias.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_fn_type_alias.rs
new file mode 100644
index 00000000000..f4b4c22d98d
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_fn_type_alias.rs
@@ -0,0 +1,430 @@
+use either::Either;
+use ide_db::assists::{AssistId, AssistKind, GroupLabel};
+use syntax::{
+    ast::{self, edit::IndentLevel, make, HasGenericParams, HasName},
+    syntax_editor, AstNode,
+};
+
+use crate::{AssistContext, Assists};
+
+// Assist: generate_fn_type_alias_named
+//
+// Generate a type alias for the function with named parameters.
+//
+// ```
+// unsafe fn fo$0o(n: i32) -> i32 { 42i32 }
+// ```
+// ->
+// ```
+// type ${0:FooFn} = unsafe fn(n: i32) -> i32;
+//
+// unsafe fn foo(n: i32) -> i32 { 42i32 }
+// ```
+
+// Assist: generate_fn_type_alias_unnamed
+//
+// Generate a type alias for the function with unnamed parameters.
+//
+// ```
+// unsafe fn fo$0o(n: i32) -> i32 { 42i32 }
+// ```
+// ->
+// ```
+// type ${0:FooFn} = unsafe fn(i32) -> i32;
+//
+// unsafe fn foo(n: i32) -> i32 { 42i32 }
+// ```
+
+pub(crate) fn generate_fn_type_alias(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
+    let name = ctx.find_node_at_offset::<ast::Name>()?;
+    let func = &name.syntax().parent()?;
+    let func_node = ast::Fn::cast(func.clone())?;
+    let param_list = func_node.param_list()?;
+
+    let assoc_owner = func.ancestors().nth(2).and_then(Either::<ast::Trait, ast::Impl>::cast);
+    // This is where we'll insert the type alias, since type aliases in `impl`s or `trait`s are not supported
+    let insertion_node = assoc_owner
+        .as_ref()
+        .map_or_else(|| func, |impl_| impl_.as_ref().either(AstNode::syntax, AstNode::syntax));
+
+    for style in ParamStyle::ALL {
+        acc.add_group(
+            &GroupLabel("Generate a type alias for function...".into()),
+            style.assist_id(),
+            style.label(),
+            func_node.syntax().text_range(),
+            |builder| {
+                let mut edit = builder.make_editor(func);
+
+                let alias_name = format!("{}Fn", stdx::to_camel_case(&name.to_string()));
+
+                let mut fn_params_vec = Vec::new();
+
+                if let Some(self_ty) =
+                    param_list.self_param().and_then(|p| ctx.sema.type_of_self(&p))
+                {
+                    let is_ref = self_ty.is_reference();
+                    let is_mut = self_ty.is_mutable_reference();
+
+                    if let Some(adt) = self_ty.strip_references().as_adt() {
+                        let inner_type = make::ty(adt.name(ctx.db()).as_str());
+
+                        let ast_self_ty =
+                            if is_ref { make::ty_ref(inner_type, is_mut) } else { inner_type };
+
+                        fn_params_vec.push(make::unnamed_param(ast_self_ty));
+                    }
+                }
+
+                fn_params_vec.extend(param_list.params().filter_map(|p| match style {
+                    ParamStyle::Named => Some(p),
+                    ParamStyle::Unnamed => p.ty().map(make::unnamed_param),
+                }));
+
+                let generic_params = func_node.generic_param_list();
+
+                let is_unsafe = func_node.unsafe_token().is_some();
+                let ty = make::ty_fn_ptr(
+                    None,
+                    is_unsafe,
+                    func_node.abi(),
+                    fn_params_vec.into_iter(),
+                    func_node.ret_type(),
+                );
+
+                // Insert new alias
+                let ty_alias = make::ty_alias(
+                    &alias_name,
+                    generic_params,
+                    None,
+                    None,
+                    Some((ast::Type::FnPtrType(ty), None)),
+                )
+                .clone_for_update();
+
+                let indent = IndentLevel::from_node(insertion_node);
+                edit.insert_all(
+                    syntax_editor::Position::before(insertion_node),
+                    vec![
+                        ty_alias.syntax().clone().into(),
+                        make::tokens::whitespace(&format!("\n\n{indent}")).into(),
+                    ],
+                );
+
+                if let Some(cap) = ctx.config.snippet_cap {
+                    if let Some(name) = ty_alias.name() {
+                        edit.add_annotation(name.syntax(), builder.make_placeholder_snippet(cap));
+                    }
+                }
+
+                builder.add_file_edits(ctx.file_id(), edit);
+            },
+        );
+    }
+
+    Some(())
+}
+
+enum ParamStyle {
+    Named,
+    Unnamed,
+}
+
+impl ParamStyle {
+    const ALL: &'static [ParamStyle] = &[ParamStyle::Named, ParamStyle::Unnamed];
+
+    fn assist_id(&self) -> AssistId {
+        let s = match self {
+            ParamStyle::Named => "generate_fn_type_alias_named",
+            ParamStyle::Unnamed => "generate_fn_type_alias_unnamed",
+        };
+
+        AssistId(s, AssistKind::Generate)
+    }
+
+    fn label(&self) -> &'static str {
+        match self {
+            ParamStyle::Named => "Generate a type alias for function with named params",
+            ParamStyle::Unnamed => "Generate a type alias for function with unnamed params",
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_assist_by_label;
+
+    use super::*;
+
+    #[test]
+    fn generate_fn_alias_unnamed_simple() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = fn(u32) -> i32;
+
+fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Unnamed.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_unnamed_unsafe() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+unsafe fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = unsafe fn(u32) -> i32;
+
+unsafe fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Unnamed.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_unnamed_extern() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+extern fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = extern fn(u32) -> i32;
+
+extern fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Unnamed.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_type_unnamed_extern_abi() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+extern "FooABI" fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = extern "FooABI" fn(u32) -> i32;
+
+extern "FooABI" fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Unnamed.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_unnamed_unsafe_extern_abi() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+unsafe extern "FooABI" fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = unsafe extern "FooABI" fn(u32) -> i32;
+
+unsafe extern "FooABI" fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Unnamed.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_unnamed_generics() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+fn fo$0o<A, B>(a: A, b: B) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn}<A, B> = fn(A, B) -> i32;
+
+fn foo<A, B>(a: A, b: B) -> i32 { return 42; }
+"#,
+            ParamStyle::Unnamed.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_unnamed_generics_bounds() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+fn fo$0o<A: Trait, B: Trait>(a: A, b: B) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn}<A: Trait, B: Trait> = fn(A, B) -> i32;
+
+fn foo<A: Trait, B: Trait>(a: A, b: B) -> i32 { return 42; }
+"#,
+            ParamStyle::Unnamed.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_unnamed_self() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+struct S;
+
+impl S {
+    fn fo$0o(&mut self, param: u32) -> i32 { return 42; }
+}
+"#,
+            r#"
+struct S;
+
+type ${0:FooFn} = fn(&mut S, u32) -> i32;
+
+impl S {
+    fn foo(&mut self, param: u32) -> i32 { return 42; }
+}
+"#,
+            ParamStyle::Unnamed.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_named_simple() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = fn(param: u32) -> i32;
+
+fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Named.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_named_unsafe() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+unsafe fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = unsafe fn(param: u32) -> i32;
+
+unsafe fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Named.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_named_extern() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+extern fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = extern fn(param: u32) -> i32;
+
+extern fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Named.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_type_named_extern_abi() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+extern "FooABI" fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = extern "FooABI" fn(param: u32) -> i32;
+
+extern "FooABI" fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Named.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_named_unsafe_extern_abi() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+unsafe extern "FooABI" fn fo$0o(param: u32) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn} = unsafe extern "FooABI" fn(param: u32) -> i32;
+
+unsafe extern "FooABI" fn foo(param: u32) -> i32 { return 42; }
+"#,
+            ParamStyle::Named.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_named_generics() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+fn fo$0o<A, B>(a: A, b: B) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn}<A, B> = fn(a: A, b: B) -> i32;
+
+fn foo<A, B>(a: A, b: B) -> i32 { return 42; }
+"#,
+            ParamStyle::Named.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_named_generics_bounds() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+fn fo$0o<A: Trait, B: Trait>(a: A, b: B) -> i32 { return 42; }
+"#,
+            r#"
+type ${0:FooFn}<A: Trait, B: Trait> = fn(a: A, b: B) -> i32;
+
+fn foo<A: Trait, B: Trait>(a: A, b: B) -> i32 { return 42; }
+"#,
+            ParamStyle::Named.label(),
+        );
+    }
+
+    #[test]
+    fn generate_fn_alias_named_self() {
+        check_assist_by_label(
+            generate_fn_type_alias,
+            r#"
+struct S;
+
+impl S {
+    fn fo$0o(&mut self, param: u32) -> i32 { return 42; }
+}
+"#,
+            r#"
+struct S;
+
+type ${0:FooFn} = fn(&mut S, param: u32) -> i32;
+
+impl S {
+    fn foo(&mut self, param: u32) -> i32 { return 42; }
+}
+"#,
+            ParamStyle::Named.label(),
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_const_as_literal.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_const_as_literal.rs
index 6b504a918b4..2bd4c4da1e2 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_const_as_literal.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_const_as_literal.rs
@@ -51,10 +51,7 @@ pub(crate) fn inline_const_as_literal(acc: &mut Assists, ctx: &AssistContext<'_>
             | ast::Expr::MatchExpr(_)
             | ast::Expr::MacroExpr(_)
             | ast::Expr::BinExpr(_)
-            | ast::Expr::CallExpr(_) => {
-                let edition = ctx.sema.scope(variable.syntax())?.krate().edition(ctx.db());
-                konst.eval(ctx.sema.db, edition).ok()?
-            }
+            | ast::Expr::CallExpr(_) => konst.eval(ctx.sema.db).ok()?,
             _ => return None,
         };
 
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/lib.rs b/src/tools/rust-analyzer/crates/ide-assists/src/lib.rs
index 8aaf5d6fff2..5c95b25f28d 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/lib.rs
@@ -161,6 +161,7 @@ mod handlers {
     mod generate_enum_is_method;
     mod generate_enum_projection_method;
     mod generate_enum_variant;
+    mod generate_fn_type_alias;
     mod generate_from_impl_for_enum;
     mod generate_function;
     mod generate_getter_or_setter;
@@ -289,6 +290,7 @@ mod handlers {
             generate_enum_projection_method::generate_enum_as_method,
             generate_enum_projection_method::generate_enum_try_into_method,
             generate_enum_variant::generate_enum_variant,
+            generate_fn_type_alias::generate_fn_type_alias,
             generate_from_impl_for_enum::generate_from_impl_for_enum,
             generate_function::generate_function,
             generate_impl::generate_impl,
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs b/src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs
index 933d45d7508..64b7ab1a123 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs
@@ -1549,6 +1549,36 @@ fn main() {
 }
 
 #[test]
+fn doctest_generate_fn_type_alias_named() {
+    check_doc_test(
+        "generate_fn_type_alias_named",
+        r#####"
+unsafe fn fo$0o(n: i32) -> i32 { 42i32 }
+"#####,
+        r#####"
+type ${0:FooFn} = unsafe fn(n: i32) -> i32;
+
+unsafe fn foo(n: i32) -> i32 { 42i32 }
+"#####,
+    )
+}
+
+#[test]
+fn doctest_generate_fn_type_alias_unnamed() {
+    check_doc_test(
+        "generate_fn_type_alias_unnamed",
+        r#####"
+unsafe fn fo$0o(n: i32) -> i32 { 42i32 }
+"#####,
+        r#####"
+type ${0:FooFn} = unsafe fn(i32) -> i32;
+
+unsafe fn foo(n: i32) -> i32 { 42i32 }
+"#####,
+    )
+}
+
+#[test]
 fn doctest_generate_from_impl_for_enum() {
     check_doc_test(
         "generate_from_impl_for_enum",
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render.rs
index ec3c2fe3556..0f00ad45f98 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/render.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/render.rs
@@ -281,8 +281,8 @@ pub(crate) fn render_resolution_with_import(
     import_edit: LocatedImport,
 ) -> Option<Builder> {
     let resolution = ScopeDef::from(import_edit.original_item);
-    let local_name = scope_def_to_name(resolution, &ctx, &import_edit)?;
-    //this now just renders the alias text, but we need to find the aliases earlier and call this with the alias instead
+    let local_name = get_import_name(resolution, &ctx, &import_edit)?;
+    // This now just renders the alias text, but we need to find the aliases earlier and call this with the alias instead.
     let doc_aliases = ctx.completion.doc_aliases_in_scope(resolution);
     let ctx = ctx.doc_aliases(doc_aliases);
     Some(render_resolution_path(ctx, path_ctx, local_name, Some(import_edit), resolution))
@@ -294,7 +294,7 @@ pub(crate) fn render_resolution_with_import_pat(
     import_edit: LocatedImport,
 ) -> Option<Builder> {
     let resolution = ScopeDef::from(import_edit.original_item);
-    let local_name = scope_def_to_name(resolution, &ctx, &import_edit)?;
+    let local_name = get_import_name(resolution, &ctx, &import_edit)?;
     Some(render_resolution_pat(ctx, pattern_ctx, local_name, Some(import_edit), resolution))
 }
 
@@ -357,6 +357,24 @@ pub(crate) fn render_expr(
     Some(item)
 }
 
+fn get_import_name(
+    resolution: ScopeDef,
+    ctx: &RenderContext<'_>,
+    import_edit: &LocatedImport,
+) -> Option<hir::Name> {
+    // FIXME: Temporary workaround for handling aliased import.
+    // This should be removed after we have proper support for importing alias.
+    // <https://github.com/rust-lang/rust-analyzer/issues/14079>
+
+    // If `item_to_import` matches `original_item`, we are importing the item itself (not its parent module).
+    // In this case, we can use the last segment of `import_path`, as it accounts for the aliased name.
+    if import_edit.item_to_import == import_edit.original_item {
+        import_edit.import_path.segments().last().cloned()
+    } else {
+        scope_def_to_name(resolution, ctx, import_edit)
+    }
+}
+
 fn scope_def_to_name(
     resolution: ScopeDef,
     ctx: &RenderContext<'_>,
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/tests/flyimport.rs b/src/tools/rust-analyzer/crates/ide-completion/src/tests/flyimport.rs
index 0b532064fb2..4b949e0d657 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/tests/flyimport.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/tests/flyimport.rs
@@ -1669,3 +1669,54 @@ mod module {
         "#]],
     );
 }
+
+#[test]
+fn re_export_aliased() {
+    check(
+        r#"
+mod outer {
+    mod inner {
+        pub struct BarStruct;
+        pub fn bar_fun() {}
+        pub mod bar {}
+    }
+    pub use inner::bar as foo;
+    pub use inner::bar_fun as foo_fun;
+    pub use inner::BarStruct as FooStruct;
+}
+fn function() {
+    foo$0
+}
+"#,
+        expect![[r#"
+            st FooStruct (use outer::FooStruct) BarStruct
+            md foo (use outer::foo)
+            fn foo_fun() (use outer::foo_fun) fn()
+        "#]],
+    );
+}
+
+#[test]
+fn re_export_aliased_pattern() {
+    check(
+        r#"
+mod outer {
+    mod inner {
+        pub struct BarStruct;
+        pub fn bar_fun() {}
+        pub mod bar {}
+    }
+    pub use inner::bar as foo;
+    pub use inner::bar_fun as foo_fun;
+    pub use inner::BarStruct as FooStruct;
+}
+fn function() {
+    let foo$0
+}
+"#,
+        expect![[r#"
+            st FooStruct (use outer::FooStruct)
+            md foo (use outer::foo)
+        "#]],
+    );
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs
index 45c723d09d4..1f1b6478d36 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs
@@ -382,7 +382,7 @@ pub fn semantic_diagnostics(
         // A bunch of parse errors in a file indicate some bigger structural parse changes in the
         // file, so we skip semantic diagnostics so we can show these faster.
         Some(m) => {
-            if !db.parse_errors(file_id).as_deref().is_some_and(|es| es.len() >= 16) {
+            if db.parse_errors(file_id).as_deref().is_none_or(|es| es.len() < 16) {
                 m.diagnostics(db, &mut diags, config.style_lints);
             }
         }
diff --git a/src/tools/rust-analyzer/crates/ide/src/hover.rs b/src/tools/rust-analyzer/crates/ide/src/hover.rs
index 6cac4f1ee48..332dfacbb43 100644
--- a/src/tools/rust-analyzer/crates/ide/src/hover.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/hover.rs
@@ -158,7 +158,7 @@ fn hover_offset(
     if let Some(doc_comment) = token_as_doc_comment(&original_token) {
         cov_mark::hit!(no_highlight_on_comment_hover);
         return doc_comment.get_definition_with_descend_at(sema, offset, |def, node, range| {
-            let res = hover_for_definition(sema, file_id, def, &node, None, config, edition);
+            let res = hover_for_definition(sema, file_id, def, &node, None, false, config, edition);
             Some(RangeInfo::new(range, res))
         });
     }
@@ -172,6 +172,7 @@ fn hover_offset(
             Definition::from(resolution?),
             &original_token.parent()?,
             None,
+            false,
             config,
             edition,
         );
@@ -218,6 +219,7 @@ fn hover_offset(
                                     break 'a vec![(
                                         Definition::Macro(macro_),
                                         sema.resolve_macro_call_arm(&macro_call),
+                                        false,
                                         node,
                                     )];
                                 }
@@ -234,19 +236,34 @@ fn hover_offset(
                             decl,
                             ..
                         }) => {
-                            vec![(Definition::ExternCrateDecl(decl), None, node)]
+                            vec![(Definition::ExternCrateDecl(decl), None, false, node)]
                         }
 
                         class => {
-                            multizip((class.definitions(), iter::repeat(None), iter::repeat(node)))
-                                .collect::<Vec<_>>()
+                            let is_def = matches!(class, IdentClass::NameClass(_));
+                            multizip((
+                                class.definitions(),
+                                iter::repeat(None),
+                                iter::repeat(is_def),
+                                iter::repeat(node),
+                            ))
+                            .collect::<Vec<_>>()
                         }
                     }
                 }
                 .into_iter()
-                .unique_by(|&(def, _, _)| def)
-                .map(|(def, macro_arm, node)| {
-                    hover_for_definition(sema, file_id, def, &node, macro_arm, config, edition)
+                .unique_by(|&(def, _, _, _)| def)
+                .map(|(def, macro_arm, hovered_definition, node)| {
+                    hover_for_definition(
+                        sema,
+                        file_id,
+                        def,
+                        &node,
+                        macro_arm,
+                        hovered_definition,
+                        config,
+                        edition,
+                    )
                 })
                 .collect::<Vec<_>>(),
             )
@@ -366,6 +383,7 @@ pub(crate) fn hover_for_definition(
     def: Definition,
     scope_node: &SyntaxNode,
     macro_arm: Option<u32>,
+    hovered_definition: bool,
     config: &HoverConfig,
     edition: Edition,
 ) -> HoverResult {
@@ -397,6 +415,7 @@ pub(crate) fn hover_for_definition(
         famous_defs.as_ref(),
         &notable_traits,
         macro_arm,
+        hovered_definition,
         config,
         edition,
     );
diff --git a/src/tools/rust-analyzer/crates/ide/src/hover/render.rs b/src/tools/rust-analyzer/crates/ide/src/hover/render.rs
index a31b14dbd3e..d9ddc2d015b 100644
--- a/src/tools/rust-analyzer/crates/ide/src/hover/render.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/hover/render.rs
@@ -273,7 +273,7 @@ pub(super) fn keyword(
     let markup = process_markup(
         sema.db,
         Definition::Module(doc_owner),
-        &markup(Some(docs.into()), description, None),
+        &markup(Some(docs.into()), description, None, None),
         config,
     );
     Some(HoverResult { markup, actions })
@@ -419,6 +419,7 @@ pub(super) fn definition(
     famous_defs: Option<&FamousDefs<'_, '_>>,
     notable_traits: &[(Trait, Vec<(Option<Type>, Name)>)],
     macro_arm: Option<u32>,
+    hovered_definition: bool,
     config: &HoverConfig,
     edition: Edition,
 ) -> Markup {
@@ -456,7 +457,7 @@ pub(super) fn definition(
         _ => def.label(db, edition),
     };
     let docs = def.docs(db, famous_defs, edition);
-    let value = (|| match def {
+    let value = || match def {
         Definition::Variant(it) => {
             if !it.parent_enum(db).is_data_carrying(db) {
                 match it.eval(db) {
@@ -485,18 +486,24 @@ pub(super) fn definition(
             }
         }
         Definition::Static(it) => {
-            let source = it.source(db)?;
-            let mut body = source.value.body()?.syntax().clone();
-            if let Some(macro_file) = source.file_id.macro_file() {
-                let span_map = db.expansion_span_map(macro_file);
-                body = prettify_macro_expansion(db, body, &span_map, it.krate(db).into());
+            let body = it.render_eval(db, edition);
+            match body {
+                Ok(it) => Some(it),
+                Err(_) => {
+                    let source = it.source(db)?;
+                    let mut body = source.value.body()?.syntax().clone();
+                    if let Some(macro_file) = source.file_id.macro_file() {
+                        let span_map = db.expansion_span_map(macro_file);
+                        body = prettify_macro_expansion(db, body, &span_map, it.krate(db).into());
+                    }
+                    Some(body.to_string())
+                }
             }
-            Some(body.to_string())
         }
         _ => None,
-    })();
+    };
 
-    let layout_info = match def {
+    let layout_info = || match def {
         Definition::Field(it) => render_memory_layout(
             config.memory_layout,
             || it.layout(db),
@@ -529,34 +536,38 @@ pub(super) fn definition(
         _ => None,
     };
 
-    let dyn_compatibility_info = if let Definition::Trait(it) = def {
-        let mut dyn_compatibility_info = String::new();
-        render_dyn_compatibility(db, &mut dyn_compatibility_info, it.dyn_compatibility(db));
-        Some(dyn_compatibility_info)
-    } else {
-        None
+    let dyn_compatibility_info = || match def {
+        Definition::Trait(it) => {
+            let mut dyn_compatibility_info = String::new();
+            render_dyn_compatibility(db, &mut dyn_compatibility_info, it.dyn_compatibility(db));
+            Some(dyn_compatibility_info)
+        }
+        _ => None,
     };
 
-    let mut desc = String::new();
-    if let Some(notable_traits) = render_notable_trait_comment(db, notable_traits, edition) {
-        desc.push_str(&notable_traits);
-        desc.push('\n');
-    }
-    if let Some(layout_info) = layout_info {
-        desc.push_str(&layout_info);
-        desc.push('\n');
-    }
-    if let Some(dyn_compatibility_info) = dyn_compatibility_info {
-        desc.push_str(&dyn_compatibility_info);
-        desc.push('\n');
+    let mut extra = String::new();
+    if hovered_definition {
+        if let Some(notable_traits) = render_notable_trait(db, notable_traits, edition) {
+            extra.push_str("\n___\n");
+            extra.push_str(&notable_traits);
+        }
+        if let Some(layout_info) = layout_info() {
+            extra.push_str("\n___\n");
+            extra.push_str(&layout_info);
+        }
+        if let Some(dyn_compatibility_info) = dyn_compatibility_info() {
+            extra.push_str("\n___\n");
+            extra.push_str(&dyn_compatibility_info);
+        }
     }
+    let mut desc = String::new();
     desc.push_str(&label);
-    if let Some(value) = value {
+    if let Some(value) = value() {
         desc.push_str(" = ");
         desc.push_str(&value);
     }
 
-    markup(docs.map(Into::into), desc, mod_path)
+    markup(docs.map(Into::into), desc, extra.is_empty().not().then_some(extra), mod_path)
 }
 
 pub(super) fn literal(
@@ -626,7 +637,7 @@ pub(super) fn literal(
     Some(s.into())
 }
 
-fn render_notable_trait_comment(
+fn render_notable_trait(
     db: &RootDatabase,
     notable_traits: &[(Trait, Vec<(Option<Type>, Name)>)],
     edition: Edition,
@@ -635,7 +646,7 @@ fn render_notable_trait_comment(
     let mut needs_impl_header = true;
     for (trait_, assoc_types) in notable_traits {
         desc.push_str(if mem::take(&mut needs_impl_header) {
-            "// Implements notable traits: "
+            "Implements notable traits: "
         } else {
             ", "
         });
@@ -728,13 +739,12 @@ fn type_info(
         )
         .into()
     } else {
-        let mut desc =
-            match render_notable_trait_comment(db, &notable_traits(db, &original), edition) {
-                Some(desc) => desc + "\n",
-                None => String::new(),
-            };
-        format_to!(desc, "{}", original.display(db, edition));
-        Markup::fenced_block(&desc)
+        let mut desc = format!("```rust\n{}\n```", original.display(db, edition));
+        if let Some(extra) = render_notable_trait(db, &notable_traits(db, &original), edition) {
+            desc.push_str("\n___\n");
+            desc.push_str(&extra);
+        };
+        desc.into()
     };
     if let Some(actions) = HoverAction::goto_type_from_targets(db, targets, edition) {
         res.actions.push(actions);
@@ -786,20 +796,16 @@ fn closure_ty(
     };
     let mut markup = format!("```rust\n{}", c.display_with_id(sema.db, edition));
 
+    if let Some(trait_) = c.fn_trait(sema.db).get_id(sema.db, original.krate(sema.db).into()) {
+        push_new_def(hir::Trait::from(trait_).into())
+    }
+    format_to!(markup, "\n{}\n```", c.display_with_impl(sema.db, edition),);
     if let Some(layout) =
         render_memory_layout(config.memory_layout, || original.layout(sema.db), |_| None, |_| None)
     {
-        format_to!(markup, " {layout}");
+        format_to!(markup, "\n___\n{layout}");
     }
-    if let Some(trait_) = c.fn_trait(sema.db).get_id(sema.db, original.krate(sema.db).into()) {
-        push_new_def(hir::Trait::from(trait_).into())
-    }
-    format_to!(
-        markup,
-        "\n{}\n```{adjusted}\n\n## Captures\n{}",
-        c.display_with_impl(sema.db, edition),
-        captures_rendered,
-    );
+    format_to!(markup, "{adjusted}\n\n## Captures\n{}", captures_rendered,);
 
     let mut res = HoverResult::default();
     if let Some(actions) = HoverAction::goto_type_from_targets(sema.db, targets, edition) {
@@ -824,7 +830,12 @@ fn definition_mod_path(db: &RootDatabase, def: &Definition, edition: Edition) ->
         .map(|module| path(db, module, definition_owner_name(db, def, edition), edition))
 }
 
-fn markup(docs: Option<String>, desc: String, mod_path: Option<String>) -> Markup {
+fn markup(
+    docs: Option<String>,
+    rust: String,
+    extra: Option<String>,
+    mod_path: Option<String>,
+) -> Markup {
     let mut buf = String::new();
 
     if let Some(mod_path) = mod_path {
@@ -832,7 +843,11 @@ fn markup(docs: Option<String>, desc: String, mod_path: Option<String>) -> Marku
             format_to!(buf, "```rust\n{}\n```\n\n", mod_path);
         }
     }
-    format_to!(buf, "```rust\n{}\n```", desc);
+    format_to!(buf, "```rust\n{}\n```", rust);
+
+    if let Some(extra) = extra {
+        buf.push_str(&extra);
+    }
 
     if let Some(doc) = docs {
         format_to!(buf, "\n___\n\n{}", doc);
@@ -862,7 +877,7 @@ fn render_memory_layout(
     let config = config?;
     let layout = layout().ok()?;
 
-    let mut label = String::from("// ");
+    let mut label = String::new();
 
     if let Some(render) = config.size {
         let size = match tag(&layout) {
@@ -994,55 +1009,53 @@ fn render_dyn_compatibility(
     safety: Option<DynCompatibilityViolation>,
 ) {
     let Some(osv) = safety else {
-        buf.push_str("// Dyn Compatible: Yes");
+        buf.push_str("Is Dyn compatible");
         return;
     };
-    buf.push_str("// Dyn Compatible: No\n// - Reason: ");
+    buf.push_str("Is not Dyn compatible due to ");
     match osv {
         DynCompatibilityViolation::SizedSelf => {
-            buf.push_str("has a `Self: Sized` bound");
+            buf.push_str("having a `Self: Sized` bound");
         }
         DynCompatibilityViolation::SelfReferential => {
-            buf.push_str("has a bound that references `Self`");
+            buf.push_str("having a bound that references `Self`");
         }
         DynCompatibilityViolation::Method(func, mvc) => {
             let name = hir::Function::from(func).name(db);
-            format_to!(
-                buf,
-                "has a method `{}` that is non dispatchable because of:\n//   - ",
-                name.as_str()
-            );
+            format_to!(buf, "having a method `{}` that is not dispatchable due to ", name.as_str());
             let desc = match mvc {
                 MethodViolationCode::StaticMethod => "missing a receiver",
-                MethodViolationCode::ReferencesSelfInput => "a parameter references `Self`",
-                MethodViolationCode::ReferencesSelfOutput => "the return type references `Self`",
+                MethodViolationCode::ReferencesSelfInput => "having a parameter referencing `Self`",
+                MethodViolationCode::ReferencesSelfOutput => "the return type referencing `Self`",
                 MethodViolationCode::ReferencesImplTraitInTrait => {
-                    "the return type contains `impl Trait`"
+                    "the return type containing `impl Trait`"
                 }
                 MethodViolationCode::AsyncFn => "being async",
                 MethodViolationCode::WhereClauseReferencesSelf => {
-                    "a where clause references `Self`"
+                    "a where clause referencing `Self`"
+                }
+                MethodViolationCode::Generic => "having a const or type generic parameter",
+                MethodViolationCode::UndispatchableReceiver => {
+                    "having a non-dispatchable receiver type"
                 }
-                MethodViolationCode::Generic => "a non-lifetime generic parameter",
-                MethodViolationCode::UndispatchableReceiver => "a non-dispatchable receiver type",
             };
             buf.push_str(desc);
         }
         DynCompatibilityViolation::AssocConst(const_) => {
             let name = hir::Const::from(const_).name(db);
             if let Some(name) = name {
-                format_to!(buf, "has an associated constant `{}`", name.as_str());
+                format_to!(buf, "having an associated constant `{}`", name.as_str());
             } else {
-                buf.push_str("has an associated constant");
+                buf.push_str("having an associated constant");
             }
         }
         DynCompatibilityViolation::GAT(alias) => {
             let name = hir::TypeAlias::from(alias).name(db);
-            format_to!(buf, "has a generic associated type `{}`", name.as_str());
+            format_to!(buf, "having a generic associated type `{}`", name.as_str());
         }
         DynCompatibilityViolation::HasNonCompatibleSuperTrait(super_trait) => {
             let name = hir::Trait::from(super_trait).name(db);
-            format_to!(buf, "has a dyn incompatible supertrait `{}`", name.as_str());
+            format_to!(buf, "having a dyn incompatible supertrait `{}`", name.as_str());
         }
     }
 }
diff --git a/src/tools/rust-analyzer/crates/ide/src/hover/tests.rs b/src/tools/rust-analyzer/crates/ide/src/hover/tests.rs
index 3e402630419..0ffbf988c35 100644
--- a/src/tools/rust-analyzer/crates/ide/src/hover/tests.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/hover/tests.rs
@@ -260,7 +260,6 @@ fn foo() {
             *local*
 
             ```rust
-            // size = 4, align = 4
             let local: i32
             ```
         "#]],
@@ -348,9 +347,11 @@ fn main() {
         expect![[r#"
             *|*
             ```rust
-            {closure#0} // size = 8, align = 8, niches = 1
+            {closure#0}
             impl Fn(i32) -> i32
             ```
+            ___
+            size = 8, align = 8, niches = 1
 
             ## Captures
             * `x` by immutable borrow
@@ -370,9 +371,11 @@ fn main() {
         expect![[r#"
             *|*
             ```rust
-            {closure#0} // size = 0, align = 1
+            {closure#0}
             impl Fn(i32) -> i32
             ```
+            ___
+            size = 0, align = 1
 
             ## Captures
             This closure captures nothing
@@ -403,9 +406,11 @@ fn main() {
         expect![[r#"
             *|*
             ```rust
-            {closure#0} // size = 16 (0x10), align = 8, niches = 1
+            {closure#0}
             impl FnOnce()
             ```
+            ___
+            size = 16 (0x10), align = 8, niches = 1
 
             ## Captures
             * `x.f1` by move
@@ -431,9 +436,11 @@ fn main() {
         expect![[r#"
             *|*
             ```rust
-            {closure#0} // size = 8, align = 8, niches = 1
+            {closure#0}
             impl FnMut()
             ```
+            ___
+            size = 8, align = 8, niches = 1
 
             ## Captures
             * `x` by mutable borrow
@@ -455,9 +462,11 @@ fn main() {
 "#,
         expect![[r#"
             ```rust
-            {closure#0} // size = 8, align = 8, niches = 1
+            {closure#0}
             impl FnOnce() -> S2
             ```
+            ___
+            size = 8, align = 8, niches = 1
             Coerced to: &impl FnOnce() -> S2
 
             ## Captures
@@ -551,9 +560,12 @@ fn main() {
             *iter*
 
             ```rust
-            // size = 8, align = 4
             let mut iter: Iter<Scan<OtherStruct<OtherStruct<i32>>, impl Fn(&mut u32, &u32, &mut u32) -> Option<u32>, u32>>
             ```
+
+            ---
+
+            size = 8, align = 4
         "#]],
     );
 }
@@ -793,9 +805,12 @@ struct Foo { fiel$0d_a: u8, field_b: i32, field_c: i16 }
             ```
 
             ```rust
-            // size = 1, align = 1, offset = 6
             field_a: u8
             ```
+
+            ---
+
+            size = 1, align = 1, offset = 6
         "#]],
     );
 }
@@ -819,7 +834,6 @@ fn main() {
             ```
 
             ```rust
-            // size = 4, align = 4, offset = 0
             pub field_a: u32
             ```
         "#]],
@@ -842,9 +856,12 @@ fn main() {
             ```
 
             ```rust
-            // size = 4, align = 4, offset = 0
             pub field_a: u32
             ```
+
+            ---
+
+            size = 4, align = 4, offset = 0
         "#]],
     );
 }
@@ -867,7 +884,6 @@ fn main() {
             ```
 
             ```rust
-            // size = 4, align = 4, offset = 0
             pub 0: u32
             ```
         "#]],
@@ -888,7 +904,6 @@ fn foo(foo: Foo) {
             ```
 
             ```rust
-            // size = 4, align = 4, offset = 0
             pub 0: u32
             ```
         "#]],
@@ -909,11 +924,14 @@ struct Foo$0(pub u32) where u32: Copy;
             ```
 
             ```rust
-            // size = 4, align = 4
             struct Foo(pub u32)
             where
                 u32: Copy,
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
 }
@@ -932,11 +950,14 @@ struct Foo$0 { field: u32 }
             ```
 
             ```rust
-            // size = 4, align = 4
             struct Foo {
                 field: u32,
             }
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
     check(
@@ -951,7 +972,6 @@ struct Foo$0 where u32: Copy { field: u32 }
             ```
 
             ```rust
-            // size = 4, align = 4
             struct Foo
             where
                 u32: Copy,
@@ -959,6 +979,10 @@ struct Foo$0 where u32: Copy { field: u32 }
                 field: u32,
             }
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
 }
@@ -978,13 +1002,16 @@ fn hover_record_struct_limit() {
             ```
 
             ```rust
-            // size = 12 (0xC), align = 4
             struct Foo {
                 a: u32,
                 b: i32,
                 c: i32,
             }
             ```
+
+            ---
+
+            size = 12 (0xC), align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1000,11 +1027,14 @@ fn hover_record_struct_limit() {
             ```
 
             ```rust
-            // size = 4, align = 4
             struct Foo {
                 a: u32,
             }
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1020,7 +1050,6 @@ fn hover_record_struct_limit() {
             ```
 
             ```rust
-            // size = 16 (0x10), align = 4
             struct Foo {
                 a: u32,
                 b: i32,
@@ -1028,6 +1057,10 @@ fn hover_record_struct_limit() {
                 /* … */
             }
             ```
+
+            ---
+
+            size = 16 (0x10), align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1043,9 +1076,12 @@ fn hover_record_struct_limit() {
             ```
 
             ```rust
-            // size = 12 (0xC), align = 4
             struct Foo
             ```
+
+            ---
+
+            size = 12 (0xC), align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1061,9 +1097,12 @@ fn hover_record_struct_limit() {
             ```
 
             ```rust
-            // size = 12 (0xC), align = 4
             struct Foo { /* … */ }
             ```
+
+            ---
+
+            size = 12 (0xC), align = 4
         "#]],
     );
 
@@ -1081,9 +1120,12 @@ fn hover_record_struct_limit() {
             ```
 
             ```rust
-            // size = 0, align = 1
             struct Foo {}
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -1103,9 +1145,12 @@ fn hover_record_variant_limit() {
             ```
 
             ```rust
-            // size = 12 (0xC), align = 4
             A { a: u32, b: i32, c: i32, }
             ```
+
+            ---
+
+            size = 12 (0xC), align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1121,9 +1166,12 @@ fn hover_record_variant_limit() {
             ```
 
             ```rust
-            // size = 4, align = 4
             A { a: u32, }
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1139,9 +1187,12 @@ fn hover_record_variant_limit() {
             ```
 
             ```rust
-            // size = 16 (0x10), align = 4
             A { a: u32, b: i32, c: i32, /* … */ }
             ```
+
+            ---
+
+            size = 16 (0x10), align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1157,9 +1208,12 @@ fn hover_record_variant_limit() {
             ```
 
             ```rust
-            // size = 12 (0xC), align = 4
             A
             ```
+
+            ---
+
+            size = 12 (0xC), align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1175,9 +1229,12 @@ fn hover_record_variant_limit() {
             ```
 
             ```rust
-            // size = 12 (0xC), align = 4
             A { /* … */ }
             ```
+
+            ---
+
+            size = 12 (0xC), align = 4
         "#]],
     );
 }
@@ -1195,12 +1252,15 @@ fn hover_enum_limit() {
             ```
 
             ```rust
-            // size = 1, align = 1, niches = 254
             enum Foo {
                 A,
                 B,
             }
             ```
+
+            ---
+
+            size = 1, align = 1, niches = 254
         "#]],
     );
     check_hover_enum_variants_limit(
@@ -1214,12 +1274,15 @@ fn hover_enum_limit() {
             ```
 
             ```rust
-            // size = 1, align = 1, niches = 254
             enum Foo {
                 A,
                 /* … */
             }
             ```
+
+            ---
+
+            size = 1, align = 1, niches = 254
         "#]],
     );
     check_hover_enum_variants_limit(
@@ -1233,9 +1296,12 @@ fn hover_enum_limit() {
             ```
 
             ```rust
-            // size = 1, align = 1, niches = 254
             enum Foo { /* … */ }
             ```
+
+            ---
+
+            size = 1, align = 1, niches = 254
         "#]],
     );
     check_hover_enum_variants_limit(
@@ -1249,9 +1315,12 @@ fn hover_enum_limit() {
             ```
 
             ```rust
-            // size = 1, align = 1, niches = 254
             enum Foo
             ```
+
+            ---
+
+            size = 1, align = 1, niches = 254
         "#]],
     );
     check_hover_enum_variants_limit(
@@ -1274,7 +1343,6 @@ fn hover_enum_limit() {
             ```
 
             ```rust
-            // size = 12 (0xC), align = 4, niches = 4294967288
             enum Enum {
                 Variant {},
                 Variant2 { /* … */ },
@@ -1286,6 +1354,10 @@ fn hover_enum_limit() {
                 /* … */
             }
             ```
+
+            ---
+
+            size = 12 (0xC), align = 4, niches = 4294967288
         "#]],
     );
 }
@@ -1303,12 +1375,15 @@ fn hover_union_limit() {
             ```
 
             ```rust
-            // size = 4, align = 4
             union Foo {
                 a: u32,
                 b: i32,
             }
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1322,12 +1397,15 @@ fn hover_union_limit() {
             ```
 
             ```rust
-            // size = 4, align = 4
             union Foo {
                 a: u32,
                 /* … */
             }
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1341,9 +1419,12 @@ fn hover_union_limit() {
             ```
 
             ```rust
-            // size = 4, align = 4
             union Foo { /* … */ }
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
     check_hover_fields_limit(
@@ -1357,9 +1438,12 @@ fn hover_union_limit() {
             ```
 
             ```rust
-            // size = 4, align = 4
             union Foo
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
 }
@@ -1378,11 +1462,14 @@ struct Foo$0 where u32: Copy;
             ```
 
             ```rust
-            // size = 0, align = 1
             struct Foo
             where
                 u32: Copy,
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -1457,7 +1544,7 @@ const foo$0: u32 = {
             ```
 
             ```rust
-            static foo: u32 = 456
+            static foo: u32 = 456 (0x1C8)
             ```
         "#]],
     );
@@ -1548,9 +1635,12 @@ fn main() {
             *zz*
 
             ```rust
-            // size = 8, align = 4
             let zz: Test<i32>
             ```
+
+            ---
+
+            size = 8, align = 4
         "#]],
     );
     check_hover_range(
@@ -1600,9 +1690,12 @@ fn main() { let b$0ar = Some(12); }
             *bar*
 
             ```rust
-            // size = 4, align = 4
             let bar: Option<i32>
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
 }
@@ -1670,7 +1763,6 @@ fn hover_for_local_variable() {
             *foo*
 
             ```rust
-            // size = 4, align = 4
             foo: i32
             ```
         "#]],
@@ -1685,9 +1777,12 @@ fn hover_for_local_variable_pat() {
             *foo*
 
             ```rust
-            // size = 4, align = 4
             foo: i32
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     )
 }
@@ -1700,7 +1795,6 @@ fn hover_local_var_edge() {
             *foo*
 
             ```rust
-            // size = 4, align = 4
             foo: i32
             ```
         "#]],
@@ -1715,9 +1809,12 @@ fn hover_for_param_edge() {
             *foo*
 
             ```rust
-            // size = 4, align = 4
             foo: i32
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     )
 }
@@ -1760,9 +1857,12 @@ fn main() { let foo_$0test = Thing::new(); }
             *foo_test*
 
             ```rust
-            // size = 4, align = 4
             let foo_test: Thing
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     )
 }
@@ -1985,7 +2085,6 @@ fn y() {
             *x*
 
             ```rust
-            // size = 4, align = 4
             let x: i32
             ```
         "#]],
@@ -2116,7 +2215,6 @@ fn foo(bar:u32) { let a = id!(ba$0r); }
             *bar*
 
             ```rust
-            // size = 4, align = 4
             bar: u32
             ```
         "#]],
@@ -2135,7 +2233,6 @@ fn foo(bar:u32) { let a = id!(ba$0r); }
             *bar*
 
             ```rust
-            // size = 4, align = 4
             bar: u32
             ```
         "#]],
@@ -2371,9 +2468,12 @@ fn test_hover_function_pointer_show_identifiers() {
             ```
 
             ```rust
-            // size = 8, align = 8, niches = 1
             type foo = fn(a: i32, b: i32) -> i32
             ```
+
+            ---
+
+            size = 8, align = 8, niches = 1
         "#]],
     );
 }
@@ -2390,9 +2490,12 @@ fn test_hover_function_pointer_no_identifier() {
             ```
 
             ```rust
-            // size = 8, align = 8, niches = 1
             type foo = fn(i32, i32) -> i32
             ```
+
+            ---
+
+            size = 8, align = 8, niches = 1
         "#]],
     );
 }
@@ -2537,7 +2640,6 @@ fn foo() { let bar = Ba$0r; }
             ```
 
             ```rust
-            // size = 0, align = 1
             struct Bar
             ```
 
@@ -2574,7 +2676,6 @@ fn foo() { let bar = Ba$0r; }
             ```
 
             ```rust
-            // size = 0, align = 1
             struct Bar
             ```
 
@@ -2604,7 +2705,6 @@ fn foo() { let bar = Ba$0r; }
             ```
 
             ```rust
-            // size = 0, align = 1
             struct Bar
             ```
 
@@ -2633,12 +2733,15 @@ pub struct B$0ar
             ```
 
             ```rust
-            // size = 0, align = 1
             pub struct Bar
             ```
 
             ---
 
+            size = 0, align = 1
+
+            ---
+
             [external](https://www.google.com)
         "#]],
     );
@@ -2661,12 +2764,15 @@ pub struct B$0ar
             ```
 
             ```rust
-            // size = 0, align = 1
             pub struct Bar
             ```
 
             ---
 
+            size = 0, align = 1
+
+            ---
+
             [baz](Baz)
         "#]],
     );
@@ -2751,9 +2857,12 @@ fn test_hover_layout_of_variant() {
             ```
 
             ```rust
-            // size = 4, align = 2
             Variant1(u8, u16)
             ```
+
+            ---
+
+            size = 4, align = 2
         "#]],
     );
 }
@@ -2794,9 +2903,12 @@ struct S$0<T>(core::marker::PhantomData<T>);
             ```
 
             ```rust
-            // size = 0, align = 1
             struct S<T>(PhantomData<T>)
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -2816,12 +2928,15 @@ fn test_hover_layout_of_enum() {
             ```
 
             ```rust
-            // size = 16 (0x10), align = 8, niches = 254
             enum Foo {
                 Variant1( /* … */ ),
                 Variant2( /* … */ ),
             }
             ```
+
+            ---
+
+            size = 16 (0x10), align = 8, niches = 254
         "#]],
     );
 }
@@ -4133,9 +4248,12 @@ fn main() {
             *f*
 
             ```rust
-            // size = 8, align = 8, niches = 1
             let f: &i32
             ```
+
+            ---
+
+            size = 8, align = 8, niches = 1
             ---
 
             ```rust
@@ -4143,9 +4261,12 @@ fn main() {
             ```
 
             ```rust
-            // size = 4, align = 4, offset = 0
             f: i32
             ```
+
+            ---
+
+            size = 4, align = 4, offset = 0
         "#]],
     );
 }
@@ -4165,9 +4286,12 @@ struct S$0T<const C: usize = 1, T = Foo>(T);
             ```
 
             ```rust
-            // size = 0, align = 1
             struct ST<const C: usize = 1, T = Foo>(T)
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4187,9 +4311,12 @@ struct S$0T<const C: usize = {40 + 2}, T = Foo>(T);
             ```
 
             ```rust
-            // size = 0, align = 1
             struct ST<const C: usize = {const}, T = Foo>(T)
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4210,9 +4337,12 @@ struct S$0T<const C: usize = VAL, T = Foo>(T);
             ```
 
             ```rust
-            // size = 0, align = 1
             struct ST<const C: usize = VAL, T = Foo>(T)
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4231,9 +4361,12 @@ fn main() {
             *value*
 
             ```rust
-            // size = 0, align = 1
             let value: Const<1>
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4252,9 +4385,12 @@ fn main() {
             *value*
 
             ```rust
-            // size = 0, align = 1
             let value: Const<0>
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4273,9 +4409,12 @@ fn main() {
             *value*
 
             ```rust
-            // size = 0, align = 1
             let value: Const<-1>
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4294,9 +4433,12 @@ fn main() {
             *value*
 
             ```rust
-            // size = 0, align = 1
             let value: Const<true>
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4315,9 +4457,12 @@ fn main() {
             *value*
 
             ```rust
-            // size = 0, align = 1
             let value: Const<'🦀'>
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4335,9 +4480,12 @@ impl Foo {
             *self*
 
             ```rust
-            // size = 8, align = 8, niches = 1
             self: &Foo
             ```
+
+            ---
+
+            size = 8, align = 8, niches = 1
         "#]],
     );
 }
@@ -4356,9 +4504,12 @@ impl Foo {
             *self*
 
             ```rust
-            // size = 0, align = 1
             self: Arc<Foo>
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4755,9 +4906,12 @@ type Fo$0o2 = Foo<2>;
             ```
 
             ```rust
-            // size = 0, align = 1
             type Foo2 = Foo<2>
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -4798,12 +4952,15 @@ enum E {
             ```
 
             ```rust
-            // size = 1, align = 1
             A = 8
             ```
 
             ---
 
+            size = 1, align = 1
+
+            ---
+
             This is a doc
         "#]],
     );
@@ -4824,12 +4981,15 @@ enum E {
             ```
 
             ```rust
-            // size = 1, align = 1
             A = 12 (0xC)
             ```
 
             ---
 
+            size = 1, align = 1
+
+            ---
+
             This is a doc
         "#]],
     );
@@ -4851,12 +5011,15 @@ enum E {
             ```
 
             ```rust
-            // size = 1, align = 1
             B = 2
             ```
 
             ---
 
+            size = 1, align = 1
+
+            ---
+
             This is a doc
         "#]],
     );
@@ -4878,12 +5041,15 @@ enum E {
             ```
 
             ```rust
-            // size = 1, align = 1
             B = 5
             ```
 
             ---
 
+            size = 1, align = 1
+
+            ---
+
             This is a doc
         "#]],
     );
@@ -5750,7 +5916,6 @@ fn foo(e: E) {
             ```
 
             ```rust
-            // size = 0, align = 1
             A = 3
             ```
 
@@ -5799,9 +5964,12 @@ fn main() {
             *tile4*
 
             ```rust
-            // size = 32 (0x20), align = 4
             let tile4: [u32; 8]
             ```
+
+            ---
+
+            size = 32 (0x20), align = 4
         "#]],
     );
 }
@@ -6036,7 +6204,6 @@ pub fn gimme() -> theitem::TheItem {
             ```
 
             ```rust
-            // size = 0, align = 1
             pub struct TheItem
             ```
 
@@ -6185,7 +6352,6 @@ mod string {
             ```
 
             ```rust
-            // size = 0, align = 1
             struct String
             ```
 
@@ -6948,7 +7114,6 @@ foo_macro!(
             ```
 
             ```rust
-            // size = 0, align = 1
             pub struct Foo
             ```
 
@@ -6974,7 +7139,6 @@ pub struct Foo(i32);
             ```
 
             ```rust
-            // size = 4, align = 4
             pub struct Foo(i32)
             ```
 
@@ -7099,9 +7263,12 @@ enum Enum {
             ```
 
             ```rust
-            // size = 4, align = 4
             RecordV { field: u32, }
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
 }
@@ -7122,9 +7289,12 @@ enum Enum {
             ```
 
             ```rust
-            // size = 4, align = 4
             field: u32
             ```
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
 }
@@ -7175,7 +7345,6 @@ impl T$0 for () {}
             ```
 
             ```rust
-            // Dyn Compatible: Yes
             trait T {}
             ```
         "#]],
@@ -7195,7 +7364,6 @@ impl T$0 for () {}
             ```
 
             ```rust
-            // Dyn Compatible: Yes
             trait T {}
             ```
         "#]],
@@ -7219,9 +7387,6 @@ impl T$0 for () {}
             ```
 
             ```rust
-            // Dyn Compatible: No
-            // - Reason: has a method `func` that is non dispatchable because of:
-            //   - missing a receiver
             trait T { /* … */ }
             ```
         "#]],
@@ -7245,9 +7410,6 @@ impl T$0 for () {}
             ```
 
             ```rust
-            // Dyn Compatible: No
-            // - Reason: has a method `func` that is non dispatchable because of:
-            //   - missing a receiver
             trait T {
                 fn func();
                 const FLAG: i32;
@@ -7275,9 +7437,6 @@ impl T$0 for () {}
             ```
 
             ```rust
-            // Dyn Compatible: No
-            // - Reason: has a method `func` that is non dispatchable because of:
-            //   - missing a receiver
             trait T {
                 fn func();
                 const FLAG: i32;
@@ -7305,9 +7464,6 @@ impl T$0 for () {}
             ```
 
             ```rust
-            // Dyn Compatible: No
-            // - Reason: has a method `func` that is non dispatchable because of:
-            //   - missing a receiver
             trait T {
                 fn func();
                 const FLAG: i32;
@@ -7784,7 +7940,6 @@ fn test() {
             ```
 
             ```rust
-            // size = 4, align = 4, offset = 0
             f: u32
             ```
         "#]],
@@ -7804,9 +7959,12 @@ fn test() {
             *s*
 
             ```rust
-            // size = 0, align = 1
             let s: S
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -7825,7 +7983,6 @@ fn test() {
             *foo*
 
             ```rust
-            // size = 4, align = 4
             let foo: i32
             ```
         "#]],
@@ -7846,7 +8003,6 @@ format_args!("{aaaaa$0}");
             *aaaaa*
 
             ```rust
-            // size = 16 (0x10), align = 8, niches = 1
             let aaaaa: &str
             ```
         "#]],
@@ -7867,7 +8023,6 @@ format_args!("{$0aaaaa}");
             *aaaaa*
 
             ```rust
-            // size = 16 (0x10), align = 8, niches = 1
             let aaaaa: &str
             ```
         "#]],
@@ -7888,7 +8043,6 @@ format_args!(r"{$0aaaaa}");
             *aaaaa*
 
             ```rust
-            // size = 16 (0x10), align = 8, niches = 1
             let aaaaa: &str
             ```
         "#]],
@@ -7914,7 +8068,6 @@ foo!(r"{$0aaaaa}");
             *aaaaa*
 
             ```rust
-            // size = 16 (0x10), align = 8, niches = 1
             let aaaaa: &str
             ```
         "#]],
@@ -8386,10 +8539,16 @@ fn main(notable$0: u32) {}
             *notable*
 
             ```rust
-            // Implements notable traits: Notable<Assoc = &str, Assoc2 = char>
-            // size = 4, align = 4
             notable: u32
             ```
+
+            ---
+
+            Implements notable traits: Notable\<Assoc = &str, Assoc2 = char>
+
+            ---
+
+            size = 4, align = 4
         "#]],
     );
 }
@@ -8418,8 +8577,6 @@ impl Iterator for S {
             ```
 
             ```rust
-            // Implements notable traits: Notable, Future<Output = u32>, Iterator<Item = S>
-            // size = 0, align = 1
             struct S
             ```
         "#]],
@@ -8478,9 +8635,12 @@ extern "C" {
             ```
 
             ```rust
-            // size = 0, align = 1
             type Ty
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -8506,9 +8666,10 @@ fn main() {
 "#,
         expect![[r#"
             ```rust
-            // Implements notable traits: Notable, Future<Output = u32>, Iterator<Item = S>
             S
-            ```"#]],
+            ```
+            ___
+            Implements notable traits: Notable, Future<Output = u32>, Iterator<Item = S>"#]],
     );
 }
 
@@ -8618,11 +8779,14 @@ struct Pedro$0<'a> {
             ```
 
             ```rust
-            // size = 16 (0x10), align = 8, niches = 1
             struct Pedro<'a> {
                 hola: &str,
             }
             ```
+
+            ---
+
+            size = 16 (0x10), align = 8, niches = 1
         "#]],
     )
 }
@@ -8655,9 +8819,12 @@ fn main(a$0: T) {}
             *a*
 
             ```rust
-            // size = 0, align = 1
             a: T
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -8678,7 +8845,6 @@ fn test() {
             *f*
 
             ```rust
-            // size = 0, align = 1
             let f: fn bar<3>(bool)
             ```
         "#]],
@@ -8706,9 +8872,12 @@ fn main() {
             *x*
 
             ```rust
-            // size = 0, align = 1
             let x: fn f<S, i32>()
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 }
@@ -9037,12 +9206,15 @@ type A$0 = B;
             ```
 
             ```rust
-            // size = 0, align = 1
             type A = B
             ```
 
             ---
 
+            size = 0, align = 1
+
+            ---
+
             *This is the documentation for* `struct B`
 
             Docs for B
@@ -9067,12 +9239,15 @@ type A$0 = B;
             ```
 
             ```rust
-            // size = 0, align = 1
             type A = B
             ```
 
             ---
 
+            size = 0, align = 1
+
+            ---
+
             *This is the documentation for* `struct C`
 
             Docs for C
@@ -9098,12 +9273,15 @@ type A$0 = B;
             ```
 
             ```rust
-            // size = 0, align = 1
             type A = B
             ```
 
             ---
 
+            size = 0, align = 1
+
+            ---
+
             *This is the documentation for* `struct C`
 
             Docs for C
@@ -9127,9 +9305,12 @@ type A$0 = B;
             ```
 
             ```rust
-            // size = 0, align = 1
             type A = B
             ```
+
+            ---
+
+            size = 0, align = 1
         "#]],
     );
 
@@ -9159,7 +9340,6 @@ use a::A$0;
             ```
 
             ```rust
-            // size = 0, align = 1
             pub type A = B
             ```
 
@@ -9171,3 +9351,68 @@ use a::A$0;
         "#]],
     );
 }
+
+#[test]
+fn dyn_compat() {
+    check(
+        r#"
+trait Compat$0 {}
+"#,
+        expect![[r#"
+            *Compat*
+
+            ```rust
+            test
+            ```
+
+            ```rust
+            trait Compat
+            ```
+
+            ---
+
+            Is Dyn compatible
+        "#]],
+    );
+    check(
+        r#"
+trait UnCompat$0 {
+    fn f<T>() {}
+}
+"#,
+        expect![[r#"
+            *UnCompat*
+
+            ```rust
+            test
+            ```
+
+            ```rust
+            trait UnCompat
+            ```
+
+            ---
+
+            Is not Dyn compatible due to having a method `f` that is not dispatchable due to missing a receiver
+        "#]],
+    );
+    check(
+        r#"
+trait UnCompat {
+    fn f<T>() {}
+}
+fn f<T: UnCompat$0>
+"#,
+        expect![[r#"
+            *UnCompat*
+
+            ```rust
+            test
+            ```
+
+            ```rust
+            trait UnCompat
+            ```
+        "#]],
+    );
+}
diff --git a/src/tools/rust-analyzer/crates/ide/src/interpret.rs b/src/tools/rust-analyzer/crates/ide/src/interpret.rs
new file mode 100644
index 00000000000..5fa6f4e4842
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide/src/interpret.rs
@@ -0,0 +1,64 @@
+use hir::{DefWithBody, Semantics};
+use ide_db::{base_db::SourceRootDatabase, FilePosition, LineIndexDatabase, RootDatabase};
+use std::time::{Duration, Instant};
+use stdx::format_to;
+use syntax::{algo::ancestors_at_offset, ast, AstNode, TextRange};
+
+// Feature: Interpret A Function, Static Or Const.
+//
+// |===
+// | Editor  | Action Name
+//
+// | VS Code | **rust-analyzer: Interpret**
+// |===
+pub(crate) fn interpret(db: &RootDatabase, position: FilePosition) -> String {
+    match find_and_interpret(db, position) {
+        Some((duration, mut result)) => {
+            result.push('\n');
+            format_to!(result, "----------------------\n");
+            format_to!(result, "  Finished in {}s\n", duration.as_secs_f32());
+            result
+        }
+        _ => "Not inside a function, const or static".to_owned(),
+    }
+}
+
+fn find_and_interpret(db: &RootDatabase, position: FilePosition) -> Option<(Duration, String)> {
+    let sema = Semantics::new(db);
+    let source_file = sema.parse_guess_edition(position.file_id);
+
+    let item = ancestors_at_offset(source_file.syntax(), position.offset)
+        .filter(|it| !ast::MacroCall::can_cast(it.kind()))
+        .find_map(ast::Item::cast)?;
+    let def: DefWithBody = match item {
+        ast::Item::Fn(it) => sema.to_def(&it)?.into(),
+        ast::Item::Const(it) => sema.to_def(&it)?.into(),
+        ast::Item::Static(it) => sema.to_def(&it)?.into(),
+        _ => return None,
+    };
+    let span_formatter = |file_id, text_range: TextRange| {
+        let path = &db
+            .source_root(db.file_source_root(file_id))
+            .path_for_file(&file_id)
+            .map(|x| x.to_string());
+        let path = path.as_deref().unwrap_or("<unknown file>");
+        match db.line_index(file_id).try_line_col(text_range.start()) {
+            Some(line_col) => format!("file://{path}:{}:{}", line_col.line + 1, line_col.col),
+            None => format!("file://{path} range {text_range:?}"),
+        }
+    };
+    let start_time = Instant::now();
+    let res = match def {
+        DefWithBody::Function(it) => it.eval(db, span_formatter),
+        DefWithBody::Static(it) => it.eval(db),
+        DefWithBody::Const(it) => it.eval(db),
+        _ => unreachable!(),
+    };
+    let res = res.unwrap_or_else(|e| {
+        let mut r = String::new();
+        _ = e.pretty_print(&mut r, db, span_formatter, def.module(db).krate().edition(db));
+        r
+    });
+    let duration = Instant::now() - start_time;
+    Some((duration, res))
+}
diff --git a/src/tools/rust-analyzer/crates/ide/src/interpret_function.rs b/src/tools/rust-analyzer/crates/ide/src/interpret_function.rs
deleted file mode 100644
index ff1317d135c..00000000000
--- a/src/tools/rust-analyzer/crates/ide/src/interpret_function.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-use hir::Semantics;
-use ide_db::{base_db::SourceRootDatabase, FilePosition, LineIndexDatabase, RootDatabase};
-use std::{fmt::Write, time::Instant};
-use syntax::{algo::ancestors_at_offset, ast, AstNode, TextRange};
-
-// Feature: Interpret Function
-//
-// |===
-// | Editor  | Action Name
-//
-// | VS Code | **rust-analyzer: Interpret Function**
-// |===
-pub(crate) fn interpret_function(db: &RootDatabase, position: FilePosition) -> String {
-    let start_time = Instant::now();
-    let mut result =
-        find_and_interpret(db, position).unwrap_or_else(|| "Not inside a function body".to_owned());
-    let duration = Instant::now() - start_time;
-    writeln!(result).unwrap();
-    writeln!(result, "----------------------").unwrap();
-    writeln!(result, "  Finished in {}s", duration.as_secs_f32()).unwrap();
-    result
-}
-
-fn find_and_interpret(db: &RootDatabase, position: FilePosition) -> Option<String> {
-    let sema = Semantics::new(db);
-    let source_file = sema.parse_guess_edition(position.file_id);
-
-    let item = ancestors_at_offset(source_file.syntax(), position.offset)
-        .filter(|it| !ast::MacroCall::can_cast(it.kind()))
-        .find_map(ast::Item::cast)?;
-    let def = match item {
-        ast::Item::Fn(it) => sema.to_def(&it)?,
-        _ => return None,
-    };
-    let span_formatter = |file_id, text_range: TextRange| {
-        let path = &db
-            .source_root(db.file_source_root(file_id))
-            .path_for_file(&file_id)
-            .map(|x| x.to_string());
-        let path = path.as_deref().unwrap_or("<unknown file>");
-        match db.line_index(file_id).try_line_col(text_range.start()) {
-            Some(line_col) => format!("file://{path}#{}:{}", line_col.line + 1, line_col.col),
-            None => format!("file://{path} range {text_range:?}"),
-        }
-    };
-    Some(def.eval(db, span_formatter))
-}
diff --git a/src/tools/rust-analyzer/crates/ide/src/lib.rs b/src/tools/rust-analyzer/crates/ide/src/lib.rs
index d053c4b3c93..d4ef9570e1a 100644
--- a/src/tools/rust-analyzer/crates/ide/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/lib.rs
@@ -33,7 +33,7 @@ mod goto_type_definition;
 mod highlight_related;
 mod hover;
 mod inlay_hints;
-mod interpret_function;
+mod interpret;
 mod join_lines;
 mod markdown_remove;
 mod matching_brace;
@@ -350,7 +350,7 @@ impl Analysis {
     }
 
     pub fn interpret_function(&self, position: FilePosition) -> Cancellable<String> {
-        self.with_db(|db| interpret_function::interpret_function(db, position))
+        self.with_db(|db| interpret::interpret(db, position))
     }
 
     pub fn view_item_tree(&self, file_id: FileId) -> Cancellable<String> {
diff --git a/src/tools/rust-analyzer/crates/ide/src/static_index.rs b/src/tools/rust-analyzer/crates/ide/src/static_index.rs
index 1cbe8c62a81..0f4b5e7d87a 100644
--- a/src/tools/rust-analyzer/crates/ide/src/static_index.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/static_index.rs
@@ -212,6 +212,7 @@ impl StaticIndex<'_> {
                         def,
                         &node,
                         None,
+                        false,
                         &hover_config,
                         edition,
                     )),
diff --git a/src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs b/src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs
index a62cbc7fb29..aecafb444c3 100644
--- a/src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs
+++ b/src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs
@@ -398,6 +398,8 @@ define_symbols! {
     rustc_const_panic_str,
     rustc_deprecated_safe_2024,
     rustc_has_incoherent_inherent_impls,
+    rustc_intrinsic,
+    rustc_intrinsic_must_be_overridden,
     rustc_layout_scalar_valid_range_end,
     rustc_layout_scalar_valid_range_start,
     rustc_legacy_const_generics,
diff --git a/src/tools/rust-analyzer/crates/parser/src/grammar.rs b/src/tools/rust-analyzer/crates/parser/src/grammar.rs
index 7ae1e5f82e5..a50a2182a7b 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar.rs
@@ -67,7 +67,7 @@ pub(crate) mod entry {
         }
 
         pub(crate) fn pat_top(p: &mut Parser<'_>) {
-            patterns::pattern_top(p);
+            patterns::pattern(p);
         }
 
         pub(crate) fn ty(p: &mut Parser<'_>) {
@@ -80,7 +80,8 @@ pub(crate) mod entry {
             paths::type_path(p);
         }
         pub(crate) fn item(p: &mut Parser<'_>) {
-            items::item_or_macro(p, true);
+            // We can set `is_in_extern=true`, because it only allows `safe fn`, and there is no ambiguity here.
+            items::item_or_macro(p, true, true);
         }
         // Parse a meta item , which excluded [], e.g : #[ MetaItem ]
         pub(crate) fn meta_item(p: &mut Parser<'_>) {
@@ -116,7 +117,7 @@ pub(crate) mod entry {
 
         pub(crate) fn pattern(p: &mut Parser<'_>) {
             let m = p.start();
-            patterns::pattern_top(p);
+            patterns::pattern(p);
             if p.at(EOF) {
                 m.abandon(p);
                 return;
diff --git a/src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs b/src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs
index 861fcedda2a..e565874a421 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar/expressions.rs
@@ -66,7 +66,7 @@ pub(super) fn stmt(p: &mut Parser<'_>, semicolon: Semicolon) {
 
     // test block_items
     // fn a() { fn b() {} }
-    let m = match items::opt_item(p, m) {
+    let m = match items::opt_item(p, m, false) {
         Ok(()) => return,
         Err(m) => m,
     };
diff --git a/src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs b/src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs
index 2333e6c862b..97e0392ce15 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar/expressions/atom.rs
@@ -660,7 +660,7 @@ fn for_expr(p: &mut Parser<'_>, m: Option<Marker>) -> CompletedMarker {
 fn let_expr(p: &mut Parser<'_>) -> CompletedMarker {
     let m = p.start();
     p.bump(T![let]);
-    patterns::pattern_top(p);
+    patterns::pattern(p);
     p.expect(T![=]);
     expr_let(p);
     m.complete(p, LET_EXPR)
diff --git a/src/tools/rust-analyzer/crates/parser/src/grammar/items.rs b/src/tools/rust-analyzer/crates/parser/src/grammar/items.rs
index c4dce0daa5b..7d98499008d 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar/items.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar/items.rs
@@ -20,7 +20,8 @@ use super::*;
 pub(super) fn mod_contents(p: &mut Parser<'_>, stop_on_r_curly: bool) {
     attributes::inner_attrs(p);
     while !(p.at(EOF) || (p.at(T!['}']) && stop_on_r_curly)) {
-        item_or_macro(p, stop_on_r_curly);
+        // We can set `is_in_extern=true`, because it only allows `safe fn`, and there is no ambiguity here.
+        item_or_macro(p, stop_on_r_curly, true);
     }
 }
 
@@ -41,11 +42,11 @@ pub(super) const ITEM_RECOVERY_SET: TokenSet = TokenSet::new(&[
     T![;],
 ]);
 
-pub(super) fn item_or_macro(p: &mut Parser<'_>, stop_on_r_curly: bool) {
+pub(super) fn item_or_macro(p: &mut Parser<'_>, stop_on_r_curly: bool, is_in_extern: bool) {
     let m = p.start();
     attributes::outer_attrs(p);
 
-    let m = match opt_item(p, m) {
+    let m = match opt_item(p, m, is_in_extern) {
         Ok(()) => {
             if p.at(T![;]) {
                 p.err_and_bump(
@@ -91,7 +92,7 @@ pub(super) fn item_or_macro(p: &mut Parser<'_>, stop_on_r_curly: bool) {
 }
 
 /// Try to parse an item, completing `m` in case of success.
-pub(super) fn opt_item(p: &mut Parser<'_>, m: Marker) -> Result<(), Marker> {
+pub(super) fn opt_item(p: &mut Parser<'_>, m: Marker, is_in_extern: bool) -> Result<(), Marker> {
     // test_err pub_expr
     // fn foo() { pub 92; }
     let has_visibility = opt_visibility(p, false);
@@ -135,7 +136,9 @@ pub(super) fn opt_item(p: &mut Parser<'_>, m: Marker) -> Result<(), Marker> {
         has_mods = true;
     }
 
-    if p.at_contextual_kw(T![safe]) {
+    // test safe_outside_of_extern
+    // fn foo() { safe = true; }
+    if is_in_extern && p.at_contextual_kw(T![safe]) {
         p.eat_contextual_kw(T![safe]);
         has_mods = true;
     }
diff --git a/src/tools/rust-analyzer/crates/parser/src/grammar/items/traits.rs b/src/tools/rust-analyzer/crates/parser/src/grammar/items/traits.rs
index c215185d632..47f86ce8c6c 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar/items/traits.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar/items/traits.rs
@@ -94,7 +94,7 @@ pub(crate) fn assoc_item_list(p: &mut Parser<'_>) {
             error_block(p, "expected an item");
             continue;
         }
-        item_or_macro(p, true);
+        item_or_macro(p, true, false);
     }
     p.expect(T!['}']);
     m.complete(p, ASSOC_ITEM_LIST);
diff --git a/src/tools/rust-analyzer/crates/parser/src/grammar/patterns.rs b/src/tools/rust-analyzer/crates/parser/src/grammar/patterns.rs
index ed01fca2acd..460051a0f4a 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar/patterns.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar/patterns.rs
@@ -20,14 +20,9 @@ const PAT_TOP_FIRST: TokenSet = PATTERN_FIRST.union(TokenSet::new(&[T![|]]));
 const RANGE_PAT_END_FIRST: TokenSet =
     expressions::LITERAL_FIRST.union(paths::PATH_FIRST).union(TokenSet::new(&[T![-], T![const]]));
 
-pub(crate) fn pattern(p: &mut Parser<'_>) {
-    let m = p.start();
-    pattern_r(p, m, false, PAT_RECOVERY_SET);
-}
-
 /// Parses a pattern list separated by pipes `|`.
-pub(super) fn pattern_top(p: &mut Parser<'_>) {
-    pattern_top_r(p, PAT_RECOVERY_SET);
+pub(crate) fn pattern(p: &mut Parser<'_>) {
+    pattern_r(p, PAT_RECOVERY_SET);
 }
 
 pub(crate) fn pattern_single(p: &mut Parser<'_>) {
@@ -37,9 +32,7 @@ pub(crate) fn pattern_single(p: &mut Parser<'_>) {
 /// Parses a pattern list separated by pipes `|`
 /// using the given `recovery_set`.
 pub(super) fn pattern_top_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
-    let m = p.start();
-    let has_leading_pipe = p.eat(T![|]);
-    pattern_r(p, m, has_leading_pipe, recovery_set);
+    pattern_r(p, recovery_set);
 }
 
 // test or_pattern
@@ -53,7 +46,10 @@ pub(super) fn pattern_top_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
 // }
 /// Parses a pattern list separated by pipes `|`, with no leading `|`,using the
 /// given `recovery_set`.
-fn pattern_r(p: &mut Parser<'_>, m: Marker, has_leading_pipe: bool, recovery_set: TokenSet) {
+fn pattern_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
+    let m = p.start();
+    let has_leading_pipe = p.eat(T![|]);
+
     pattern_single_r(p, recovery_set);
 
     if !p.at(T![|]) && !has_leading_pipe {
@@ -319,6 +315,8 @@ fn record_pat_field(p: &mut Parser<'_>) {
         IDENT | INT_NUMBER if p.nth(1) == T![:] => {
             name_ref_or_index(p);
             p.bump(T![:]);
+            // test record_field_pat_leading_or
+            // fn foo() { let R { a: | 1 | 2 } = 0; }
             pattern(p);
         }
         // test_err record_pat_field_eq_recovery
@@ -438,7 +436,7 @@ fn tuple_pat(p: &mut Parser<'_>) -> CompletedMarker {
         }
         has_rest |= p.at(T![..]);
 
-        pattern_top(p);
+        pattern(p);
         if !p.at(T![')']) {
             has_comma = true;
             p.expect(T![,]);
@@ -465,7 +463,7 @@ fn slice_pat(p: &mut Parser<'_>) -> CompletedMarker {
 
 fn pat_list(p: &mut Parser<'_>, ket: SyntaxKind) {
     while !p.at(EOF) && !p.at(ket) {
-        pattern_top(p);
+        pattern(p);
         if !p.eat(T![,]) {
             if p.at_ts(PAT_TOP_FIRST) {
                 p.error(format!("expected {:?}, got {:?}", T![,], p.current()));
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/generated/runner.rs b/src/tools/rust-analyzer/crates/parser/test_data/generated/runner.rs
index 164d0f36f1b..62b381b6688 100644
--- a/src/tools/rust-analyzer/crates/parser/test_data/generated/runner.rs
+++ b/src/tools/rust-analyzer/crates/parser/test_data/generated/runner.rs
@@ -493,6 +493,10 @@ mod ok {
         run_and_expect_no_errors("test_data/parser/inline/ok/record_field_list.rs");
     }
     #[test]
+    fn record_field_pat_leading_or() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/record_field_pat_leading_or.rs");
+    }
+    #[test]
     fn record_lit() { run_and_expect_no_errors("test_data/parser/inline/ok/record_lit.rs"); }
     #[test]
     fn record_literal_field_with_attr() {
@@ -527,6 +531,10 @@ mod ok {
         run_and_expect_no_errors("test_data/parser/inline/ok/return_type_syntax_in_path.rs");
     }
     #[test]
+    fn safe_outside_of_extern() {
+        run_and_expect_no_errors("test_data/parser/inline/ok/safe_outside_of_extern.rs");
+    }
+    #[test]
     fn self_param() { run_and_expect_no_errors("test_data/parser/inline/ok/self_param.rs"); }
     #[test]
     fn self_param_outer_attr() {
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_pat_leading_or.rast b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_pat_leading_or.rast
new file mode 100644
index 00000000000..4ef6c1c45f5
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_pat_leading_or.rast
@@ -0,0 +1,54 @@
+SOURCE_FILE
+  FN
+    FN_KW "fn"
+    WHITESPACE " "
+    NAME
+      IDENT "foo"
+    PARAM_LIST
+      L_PAREN "("
+      R_PAREN ")"
+    WHITESPACE " "
+    BLOCK_EXPR
+      STMT_LIST
+        L_CURLY "{"
+        WHITESPACE " "
+        LET_STMT
+          LET_KW "let"
+          WHITESPACE " "
+          RECORD_PAT
+            PATH
+              PATH_SEGMENT
+                NAME_REF
+                  IDENT "R"
+            WHITESPACE " "
+            RECORD_PAT_FIELD_LIST
+              L_CURLY "{"
+              WHITESPACE " "
+              RECORD_PAT_FIELD
+                NAME_REF
+                  IDENT "a"
+                COLON ":"
+                WHITESPACE " "
+                OR_PAT
+                  PIPE "|"
+                  WHITESPACE " "
+                  LITERAL_PAT
+                    LITERAL
+                      INT_NUMBER "1"
+                  WHITESPACE " "
+                  PIPE "|"
+                  WHITESPACE " "
+                  LITERAL_PAT
+                    LITERAL
+                      INT_NUMBER "2"
+              WHITESPACE " "
+              R_CURLY "}"
+          WHITESPACE " "
+          EQ "="
+          WHITESPACE " "
+          LITERAL
+            INT_NUMBER "0"
+          SEMICOLON ";"
+        WHITESPACE " "
+        R_CURLY "}"
+  WHITESPACE "\n"
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_pat_leading_or.rs b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_pat_leading_or.rs
new file mode 100644
index 00000000000..a5e7510c140
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_pat_leading_or.rs
@@ -0,0 +1 @@
+fn foo() { let R { a: | 1 | 2 } = 0; }
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/safe_outside_of_extern.rast b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/safe_outside_of_extern.rast
new file mode 100644
index 00000000000..c9398eaa993
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/safe_outside_of_extern.rast
@@ -0,0 +1,30 @@
+SOURCE_FILE
+  FN
+    FN_KW "fn"
+    WHITESPACE " "
+    NAME
+      IDENT "foo"
+    PARAM_LIST
+      L_PAREN "("
+      R_PAREN ")"
+    WHITESPACE " "
+    BLOCK_EXPR
+      STMT_LIST
+        L_CURLY "{"
+        WHITESPACE " "
+        EXPR_STMT
+          BIN_EXPR
+            PATH_EXPR
+              PATH
+                PATH_SEGMENT
+                  NAME_REF
+                    IDENT "safe"
+            WHITESPACE " "
+            EQ "="
+            WHITESPACE " "
+            LITERAL
+              TRUE_KW "true"
+          SEMICOLON ";"
+        WHITESPACE " "
+        R_CURLY "}"
+  WHITESPACE "\n"
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/safe_outside_of_extern.rs b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/safe_outside_of_extern.rs
new file mode 100644
index 00000000000..a4d75e63ea7
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/safe_outside_of_extern.rs
@@ -0,0 +1 @@
+fn foo() { safe = true; }
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/process.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/process.rs
index c965257a5c5..4045e25fdf1 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/src/process.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/process.rs
@@ -56,8 +56,8 @@ impl ProcMacroProcessSrv {
         match srv.version_check() {
             Ok(v) if v > CURRENT_API_VERSION => Err(io::Error::new(
                 io::ErrorKind::Other,
-                format!(
-                    "proc-macro server's api version ({v}) is newer than rust-analyzer's ({CURRENT_API_VERSION})"
+                format!( "The version of the proc-macro server ({v}) in your Rust toolchain is newer than the version supported by your rust-analyzer ({CURRENT_API_VERSION}).
+            This will prevent proc-macro expansion from working. Please consider updating your rust-analyzer to ensure compatibility with your current toolchain."
                 ),
             )),
             Ok(v) => {
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs
index 51c81a0d1a6..155fb6f7c88 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -172,7 +172,6 @@ impl flags::AnalysisStats {
         let mut num_decls = 0;
         let mut bodies = Vec::new();
         let mut adts = Vec::new();
-        let mut consts = Vec::new();
         let mut file_ids = Vec::new();
         while let Some(module) = visit_queue.pop() {
             if visited_modules.insert(module) {
@@ -193,7 +192,6 @@ impl flags::AnalysisStats {
                         }
                         ModuleDef::Const(c) => {
                             bodies.push(DefWithBody::from(c));
-                            consts.push(c)
                         }
                         ModuleDef::Static(s) => bodies.push(DefWithBody::from(s)),
                         _ => (),
@@ -207,7 +205,6 @@ impl flags::AnalysisStats {
                             AssocItem::Function(f) => bodies.push(DefWithBody::from(f)),
                             AssocItem::Const(c) => {
                                 bodies.push(DefWithBody::from(c));
-                                consts.push(c);
                             }
                             _ => (),
                         }
@@ -220,7 +217,10 @@ impl flags::AnalysisStats {
             visited_modules.len(),
             bodies.len(),
             adts.len(),
-            consts.len(),
+            bodies
+                .iter()
+                .filter(|it| matches!(it, DefWithBody::Const(_) | DefWithBody::Static(_)))
+                .count(),
         );
         let crate_def_map_time = crate_def_map_sw.elapsed();
         eprintln!("{:<20} {}", "Item Collection:", crate_def_map_time);
@@ -247,7 +247,7 @@ impl flags::AnalysisStats {
         }
 
         if !self.skip_const_eval {
-            self.run_const_eval(db, &consts, verbosity);
+            self.run_const_eval(db, &bodies, verbosity);
         }
 
         if self.run_all_ide_things {
@@ -320,18 +320,23 @@ impl flags::AnalysisStats {
         report_metric("data layout time", data_layout_time.time.as_millis() as u64, "ms");
     }
 
-    fn run_const_eval(&self, db: &RootDatabase, consts: &[hir::Const], verbosity: Verbosity) {
+    fn run_const_eval(&self, db: &RootDatabase, bodies: &[DefWithBody], verbosity: Verbosity) {
         let mut sw = self.stop_watch();
         let mut all = 0;
         let mut fail = 0;
-        for &c in consts {
+        for &b in bodies {
+            let res = match b {
+                DefWithBody::Const(c) => c.render_eval(db, Edition::LATEST),
+                DefWithBody::Static(s) => s.render_eval(db, Edition::LATEST),
+                _ => continue,
+            };
             all += 1;
-            let Err(error) = c.render_eval(db, Edition::LATEST) else {
+            let Err(error) = res else {
                 continue;
             };
             if verbosity.is_spammy() {
                 let full_name =
-                    full_name_of_item(db, c.module(db), c.name(db).unwrap_or(Name::missing()));
+                    full_name_of_item(db, b.module(db), b.name(db).unwrap_or(Name::missing()));
                 println!("Const eval for {full_name} failed due {error:?}");
             }
             fail += 1;
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/run_tests.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/run_tests.rs
index 11534bbeba9..7398b9a9ef0 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/run_tests.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/run_tests.rs
@@ -61,12 +61,11 @@ impl flags::RunTests {
             }
             let mut sw_one = StopWatch::start();
             let result = test.eval(db, span_formatter);
-            if result.trim() == "pass" {
-                pass_count += 1;
-            } else {
-                fail_count += 1;
+            match &result {
+                Ok(result) if result.trim() == "pass" => pass_count += 1,
+                _ => fail_count += 1,
             }
-            println!("{result}");
+            println!("{result:?}");
             eprintln!("{:<20} {}", format!("test {}", full_name), sw_one.elapsed());
         }
         println!("{pass_count} passed, {fail_count} failed, {ignore_count} ignored");
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs
index 271a9c0f3d1..1db616898e8 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs
@@ -463,6 +463,11 @@ impl ClientCapabilities {
             .unwrap_or_default()
     }
 
+    pub fn diagnostics_refresh(&self) -> bool {
+        (|| -> _ { self.0.workspace.as_ref()?.diagnostic.as_ref()?.refresh_support })()
+            .unwrap_or_default()
+    }
+
     pub fn inlay_hint_resolve_support_properties(&self) -> FxHashSet<&str> {
         self.0
             .text_document
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs
index 9a51df80fe1..73fce42437f 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs
@@ -417,8 +417,6 @@ impl GlobalState {
                 }
             }
 
-            let supports_diagnostic_pull_model = self.config.text_document_diagnostic();
-
             let client_refresh = became_quiescent || state_changed;
             if client_refresh {
                 // Refresh semantic tokens if the client supports it.
@@ -437,7 +435,7 @@ impl GlobalState {
                     self.send_request::<lsp_types::request::InlayHintRefreshRequest>((), |_, _| ());
                 }
 
-                if supports_diagnostic_pull_model {
+                if self.config.diagnostics_refresh() {
                     self.send_request::<lsp_types::request::WorkspaceDiagnosticRefresh>(
                         (),
                         |_, _| (),
@@ -448,7 +446,7 @@ impl GlobalState {
             let project_or_mem_docs_changed =
                 became_quiescent || state_changed || memdocs_added_or_removed;
             if project_or_mem_docs_changed
-                && !supports_diagnostic_pull_model
+                && !self.config.text_document_diagnostic()
                 && self.config.publish_diagnostics(None)
             {
                 self.update_diagnostics();
diff --git a/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs b/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs
index fcdc97ce327..2ec83d23b27 100644
--- a/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs
+++ b/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs
@@ -15,7 +15,11 @@ use parser::{Edition, T};
 use rowan::NodeOrToken;
 use stdx::{format_to, format_to_acc, never};
 
-use crate::{ast, utils::is_raw_identifier, AstNode, SourceFile, SyntaxKind, SyntaxToken};
+use crate::{
+    ast::{self, Param},
+    utils::is_raw_identifier,
+    AstNode, SourceFile, SyntaxKind, SyntaxToken,
+};
 
 /// While the parent module defines basic atomic "constructors", the `ext`
 /// module defines shortcuts for common things.
@@ -198,6 +202,38 @@ pub fn ty_alias(
     ast_from_text(&s)
 }
 
+pub fn ty_fn_ptr<I: Iterator<Item = Param>>(
+    for_lifetime_list: Option<ast::GenericParamList>,
+    is_unsafe: bool,
+    abi: Option<ast::Abi>,
+    params: I,
+    ret_type: Option<ast::RetType>,
+) -> ast::FnPtrType {
+    let mut s = String::from("type __ = ");
+
+    if let Some(list) = for_lifetime_list {
+        format_to!(s, "for{} ", list);
+    }
+
+    if is_unsafe {
+        s.push_str("unsafe ");
+    }
+
+    if let Some(abi) = abi {
+        format_to!(s, "{} ", abi)
+    }
+
+    s.push_str("fn");
+
+    format_to!(s, "({})", params.map(|p| p.to_string()).join(", "));
+
+    if let Some(ret_type) = ret_type {
+        format_to!(s, " {}", ret_type);
+    }
+
+    ast_from_text(&s)
+}
+
 pub fn assoc_item_list() -> ast::AssocItemList {
     ast_from_text("impl C for D {}")
 }
@@ -862,6 +898,10 @@ pub fn item_const(
     ast_from_text(&format!("{visibility} const {name}: {ty} = {expr};"))
 }
 
+pub fn unnamed_param(ty: ast::Type) -> ast::Param {
+    ast_from_text(&format!("fn f({ty}) {{ }}"))
+}
+
 pub fn param(pat: ast::Pat, ty: ast::Type) -> ast::Param {
     ast_from_text(&format!("fn f({pat}: {ty}) {{ }}"))
 }
diff --git a/src/tools/rust-analyzer/crates/test-fixture/Cargo.toml b/src/tools/rust-analyzer/crates/test-fixture/Cargo.toml
index f9565721dd5..c860e7b1183 100644
--- a/src/tools/rust-analyzer/crates/test-fixture/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/test-fixture/Cargo.toml
@@ -5,7 +5,6 @@ rust-version.workspace = true
 edition.workspace = true
 license.workspace = true
 authors.workspace = true
-publish = false
 
 [dependencies]
 hir-expand.workspace = true
diff --git a/src/tools/rust-analyzer/docs/dev/setup.md b/src/tools/rust-analyzer/docs/dev/setup.md
new file mode 100644
index 00000000000..d8a7840d376
--- /dev/null
+++ b/src/tools/rust-analyzer/docs/dev/setup.md
@@ -0,0 +1,57 @@
+# Setup Guide
+
+This guide gives a simplified opinionated setup for developers contributing to rust-analyzer using Visual Studio Code to make changes and Visual Studio Code Insiders to test those changes. This guide will assume you have Visual Studio Code and Visual Studio Code Insiders installed.
+
+## Prerequisites
+
+Since rust-analyzer is a Rust project, you will need to install Rust. You can download and install the latest stable version of Rust [here](https://www.rust-lang.org/tools/install).
+
+## Step-by-Step Setup
+
+**Step 01**: Fork the rust-analyzer repository and clone the fork to your local machine.
+
+**Step 02**: Open the project in Visual Studio Code.
+
+**Step 03**: Open a terminal and run `cargo build` to build the project.
+
+**Step 04**: Install the language server locally by running the following command:
+
+```sh
+cargo xtask install --server --code-bin code-insiders --dev-rel
+```
+
+In the output of this command, there should be a file path provided to the installed binary on  your local machine.
+It should look something like the following output below:
+
+```
+Installing <path-to-rust-analyzer-binary>
+Installed package `rust-analyzer v0.0.0 (<path-to-rust-analyzer-binary>)` (executable `rust-analyzer.exe`)
+```
+
+In Visual Studio Code Insiders, you will want to open your User Settings (JSON) from the Command Palette. From there you should ensure that the `rust-analyzer.server.path` key is set to the `<path-to-rust-analyzer-binary>`. This will tell Visual Studio Code Insiders to use the locally installed version that you can debug.
+
+The User Settings (JSON) file should contain the following:
+
+```json
+{
+    "rust-analyzer.server.path": "<path-to-rust-analyzer-binary>"
+}
+```
+
+Now you should be able to make changes to rust-analyzer in Visual Studio Code and then view the changes in Visual Studio Code Insiders.
+
+## Debugging rust-analyzer
+The simplest way to debug rust-analyzer is to use the `eprintln!` macro. The reason why we use `eprintln!` instead of `println!` is because the language server uses `stdout` to send messages. So instead we will debug using `stderr`.
+
+An example debugging statement could go into the `main_loop.rs` file which can be found at `crates/rust-analyzer/src/main_loop.rs`. Inside the `main_loop` we will add the following `eprintln!` to test debugging rust-analyzer:
+
+```rs
+eprintln!("Hello, world!");
+```
+
+Now we run `cargo build` and `sh
+cargo xtask install --server --code-bin code-insiders --dev-rel` to reinstall the server.
+
+Now on Visual Studio Code Insiders, we should be able to open the Output tab on our terminal and switch to Rust Analyzer Language Server to see the `eprintln!` statement we just wrote.
+
+If you are able to see your output, you now have a complete workflow for debugging rust-analyzer.
diff --git a/src/tools/rust-analyzer/editors/code/package.json b/src/tools/rust-analyzer/editors/code/package.json
index 6eebdf9f016..ccc8c0e3842 100644
--- a/src/tools/rust-analyzer/editors/code/package.json
+++ b/src/tools/rust-analyzer/editors/code/package.json
@@ -125,7 +125,7 @@
             },
             {
                 "command": "rust-analyzer.interpretFunction",
-                "title": "Interpret Function",
+                "title": "Interpret",
                 "category": "rust-analyzer (debug command)"
             },
             {
diff --git a/src/tools/rust-analyzer/rust-version b/src/tools/rust-analyzer/rust-version
index ffb312d06e6..00f4f743a7c 100644
--- a/src/tools/rust-analyzer/rust-version
+++ b/src/tools/rust-analyzer/rust-version
@@ -1 +1 @@
-a9d17627d241645a54c1134a20f1596127fedb60
+145f9cf95de1fbde3fa11e98461310e0373253e6
diff --git a/src/tools/rust-analyzer/xtask/src/tidy.rs b/src/tools/rust-analyzer/xtask/src/tidy.rs
index c3d531344a1..35412be8764 100644
--- a/src/tools/rust-analyzer/xtask/src/tidy.rs
+++ b/src/tools/rust-analyzer/xtask/src/tidy.rs
@@ -135,7 +135,6 @@ Apache-2.0 WITH LLVM-exception
 Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
 Apache-2.0/MIT
 BSD-2-Clause OR Apache-2.0 OR MIT
-BSD-3-Clause
 CC0-1.0
 ISC
 MIT
diff --git a/tests/rustdoc-ui/show-coverage-json.rs b/tests/rustdoc-ui/show-coverage-json.rs
new file mode 100644
index 00000000000..3851e34fe35
--- /dev/null
+++ b/tests/rustdoc-ui/show-coverage-json.rs
@@ -0,0 +1,13 @@
+//@ compile-flags: -Z unstable-options --show-coverage --output-format=json
+//@ check-pass
+
+mod bar {
+    /// a
+    ///
+    /// ```
+    /// let x = 0;
+    /// ```
+    pub struct Foo;
+}
+
+pub use bar::Foo;
diff --git a/tests/rustdoc-ui/show-coverage-json.stdout b/tests/rustdoc-ui/show-coverage-json.stdout
new file mode 100644
index 00000000000..ed5b5a60212
--- /dev/null
+++ b/tests/rustdoc-ui/show-coverage-json.stdout
@@ -0,0 +1 @@
+{"$DIR/show-coverage-json.rs":{"total":2,"with_docs":1,"total_examples":2,"with_examples":1}}
diff --git a/tests/rustdoc-ui/show-coverage.rs b/tests/rustdoc-ui/show-coverage.rs
new file mode 100644
index 00000000000..00bb1606a82
--- /dev/null
+++ b/tests/rustdoc-ui/show-coverage.rs
@@ -0,0 +1,13 @@
+//@ compile-flags: -Z unstable-options --show-coverage
+//@ check-pass
+
+mod bar {
+    /// a
+    ///
+    /// ```
+    /// let x = 0;
+    /// ```
+    pub struct Foo;
+}
+
+pub use bar::Foo;
diff --git a/tests/rustdoc-ui/show-coverage.stdout b/tests/rustdoc-ui/show-coverage.stdout
new file mode 100644
index 00000000000..b3b7679771f
--- /dev/null
+++ b/tests/rustdoc-ui/show-coverage.stdout
@@ -0,0 +1,7 @@
++-------------------------------------+------------+------------+------------+------------+
+| File                                | Documented | Percentage |   Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...ests/rustdoc-ui/show-coverage.rs |          1 |      50.0% |          1 |      50.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total                               |          1 |      50.0% |          1 |      50.0% |
++-------------------------------------+------------+------------+------------+------------+
diff --git a/tests/rustdoc/const-intrinsic.rs b/tests/rustdoc/const-intrinsic.rs
index 520e253469c..8444d4a3aa7 100644
--- a/tests/rustdoc/const-intrinsic.rs
+++ b/tests/rustdoc/const-intrinsic.rs
@@ -1,20 +1,26 @@
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
 #![feature(staged_api)]
 
 #![crate_name = "foo"]
 #![stable(since="1.0.0", feature="rust1")]
 
-extern "rust-intrinsic" {
-    //@ has 'foo/fn.transmute.html'
-    //@ has - '//pre[@class="rust item-decl"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U'
-    #[stable(since="1.0.0", feature="rust1")]
-    #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
-    pub fn transmute<T, U>(_: T) -> U;
+//@ has 'foo/fn.transmute.html'
+//@ has - '//pre[@class="rust item-decl"]' 'pub const unsafe fn transmute<T, U>(_: T) -> U'
+#[stable(since="1.0.0", feature="rust1")]
+#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn transmute<T, U>(_: T) -> U {
+    loop {}
+}
 
-    //@ has 'foo/fn.unreachable.html'
-    //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !'
-    #[stable(since="1.0.0", feature="rust1")]
-    pub fn unreachable() -> !;
+//@ has 'foo/fn.unreachable.html'
+//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe fn unreachable() -> !'
+#[stable(since="1.0.0", feature="rust1")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub unsafe fn unreachable() -> ! {
+    loop {}
 }
 
 extern "C" {
diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.rs b/tests/ui-fulldeps/hash-stable-is-unstable.rs
index e5d158a2661..dc778695287 100644
--- a/tests/ui-fulldeps/hash-stable-is-unstable.rs
+++ b/tests/ui-fulldeps/hash-stable-is-unstable.rs
@@ -1,24 +1,25 @@
+//@ ignore-stage1 FIXME: this line can be removed once these new error messages are in stage 0 rustc
 //@ compile-flags: -Zdeduplicate-diagnostics=yes
 extern crate rustc_data_structures;
-//~^ use of unstable library feature 'rustc_private'
+//~^ use of unstable library feature `rustc_private`
 //~| NOTE: issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
 //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 extern crate rustc_macros;
-//~^ use of unstable library feature 'rustc_private'
+//~^ use of unstable library feature `rustc_private`
 //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
 //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 extern crate rustc_query_system;
-//~^ use of unstable library feature 'rustc_private'
+//~^ use of unstable library feature `rustc_private`
 //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
 //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 use rustc_macros::HashStable;
-//~^ use of unstable library feature 'rustc_private'
+//~^ use of unstable library feature `rustc_private`
 //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
 //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 #[derive(HashStable)]
-//~^ use of unstable library feature 'rustc_private'
+//~^ use of unstable library feature `rustc_private`
 //~| NOTE: in this expansion of #[derive(HashStable)]
 //~| NOTE: in this expansion of #[derive(HashStable)]
 //~| NOTE: in this expansion of #[derive(HashStable)]
diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.stderr b/tests/ui-fulldeps/hash-stable-is-unstable.stderr
index c9aac624cbb..8d809175875 100644
--- a/tests/ui-fulldeps/hash-stable-is-unstable.stderr
+++ b/tests/ui-fulldeps/hash-stable-is-unstable.stderr
@@ -1,5 +1,5 @@
-error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
-  --> $DIR/hash-stable-is-unstable.rs:2:1
+error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
+  --> $DIR/hash-stable-is-unstable.rs:3:1
    |
 LL | extern crate rustc_data_structures;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,8 +8,8 @@ LL | extern crate rustc_data_structures;
    = help: add `#![feature(rustc_private)]` 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]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
-  --> $DIR/hash-stable-is-unstable.rs:6:1
+error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
+  --> $DIR/hash-stable-is-unstable.rs:7:1
    |
 LL | extern crate rustc_macros;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -18,8 +18,8 @@ LL | extern crate rustc_macros;
    = help: add `#![feature(rustc_private)]` 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]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
-  --> $DIR/hash-stable-is-unstable.rs:10:1
+error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
+  --> $DIR/hash-stable-is-unstable.rs:11:1
    |
 LL | extern crate rustc_query_system;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -28,8 +28,8 @@ LL | extern crate rustc_query_system;
    = help: add `#![feature(rustc_private)]` 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]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
-  --> $DIR/hash-stable-is-unstable.rs:15:5
+error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
+  --> $DIR/hash-stable-is-unstable.rs:16:5
    |
 LL | use rustc_macros::HashStable;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -38,8 +38,8 @@ LL | use rustc_macros::HashStable;
    = help: add `#![feature(rustc_private)]` 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]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
-  --> $DIR/hash-stable-is-unstable.rs:20:10
+error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
+  --> $DIR/hash-stable-is-unstable.rs:21:10
    |
 LL | #[derive(HashStable)]
    |          ^^^^^^^^^^
diff --git a/tests/ui-fulldeps/pathless-extern-unstable.rs b/tests/ui-fulldeps/pathless-extern-unstable.rs
index 2da1a7f0ddc..27272135696 100644
--- a/tests/ui-fulldeps/pathless-extern-unstable.rs
+++ b/tests/ui-fulldeps/pathless-extern-unstable.rs
@@ -1,9 +1,10 @@
+//@ ignore-stage1 FIXME: this line can be removed once these new error messages are in stage 0 rustc
 //@ edition:2018
 //@ compile-flags:--extern rustc_middle
 
 // Test that `--extern rustc_middle` fails with `rustc_private`.
 
 pub use rustc_middle;
-//~^ ERROR use of unstable library feature 'rustc_private'
+//~^ ERROR use of unstable library feature `rustc_private`
 
 fn main() {}
diff --git a/tests/ui-fulldeps/pathless-extern-unstable.stderr b/tests/ui-fulldeps/pathless-extern-unstable.stderr
index 36e56adfdbd..a78b69f4d20 100644
--- a/tests/ui-fulldeps/pathless-extern-unstable.stderr
+++ b/tests/ui-fulldeps/pathless-extern-unstable.stderr
@@ -1,5 +1,5 @@
-error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
-  --> $DIR/pathless-extern-unstable.rs:6:9
+error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
+  --> $DIR/pathless-extern-unstable.rs:7:9
    |
 LL | pub use rustc_middle;
    |         ^^^^^^^^^^^^
diff --git a/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs b/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs
index ddb9278bafa..91641489cc9 100644
--- a/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs
+++ b/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs
@@ -4,6 +4,6 @@
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
 
-type Data = aux::Owner::Data; //~ ERROR use of unstable library feature 'data'
+type Data = aux::Owner::Data; //~ ERROR use of unstable library feature `data`
 
 fn main() {}
diff --git a/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr b/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr
index ab8cdb6f80a..132d566fecd 100644
--- a/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr
+++ b/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'data'
+error[E0658]: use of unstable library feature `data`
   --> $DIR/assoc-inherent-unstable.rs:7:13
    |
 LL | type Data = aux::Owner::Data;
diff --git a/tests/ui/async-await/async-fn/edition-2015.rs b/tests/ui/async-await/async-fn/edition-2015.rs
index 50448313b30..e38179758f6 100644
--- a/tests/ui/async-await/async-fn/edition-2015.rs
+++ b/tests/ui/async-await/async-fn/edition-2015.rs
@@ -3,7 +3,7 @@ fn foo(x: impl async Fn()) -> impl async Fn() { x }
 //~| ERROR `async` trait bounds are only allowed in Rust 2018 or later
 //~| ERROR async closures are unstable
 //~| ERROR async closures are unstable
-//~| ERROR use of unstable library feature 'async_closure'
-//~| ERROR use of unstable library feature 'async_closure'
+//~| ERROR use of unstable library feature `async_closure`
+//~| ERROR use of unstable library feature `async_closure`
 
 fn main() {}
diff --git a/tests/ui/async-await/async-fn/edition-2015.stderr b/tests/ui/async-await/async-fn/edition-2015.stderr
index 358bb3e112e..25101cb65df 100644
--- a/tests/ui/async-await/async-fn/edition-2015.stderr
+++ b/tests/ui/async-await/async-fn/edition-2015.stderr
@@ -38,7 +38,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = help: to use an async block, remove the `||`: `async {`
 
-error[E0658]: use of unstable library feature 'async_closure'
+error[E0658]: use of unstable library feature `async_closure`
   --> $DIR/edition-2015.rs:1:42
    |
 LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
@@ -48,7 +48,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
    = help: add `#![feature(async_closure)]` 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]: use of unstable library feature 'async_closure'
+error[E0658]: use of unstable library feature `async_closure`
   --> $DIR/edition-2015.rs:1:22
    |
 LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
diff --git a/tests/ui/box/alloc-unstable-fail.rs b/tests/ui/box/alloc-unstable-fail.rs
index 9427571648c..e209af97d7f 100644
--- a/tests/ui/box/alloc-unstable-fail.rs
+++ b/tests/ui/box/alloc-unstable-fail.rs
@@ -2,5 +2,5 @@ use std::boxed::Box;
 
 fn main() {
     let _boxed: Box<u32, _> = Box::new(10);
-    //~^ ERROR use of unstable library feature 'allocator_api'
+    //~^ ERROR use of unstable library feature `allocator_api`
 }
diff --git a/tests/ui/box/alloc-unstable-fail.stderr b/tests/ui/box/alloc-unstable-fail.stderr
index 9e1e12a2b6a..6ce63a79966 100644
--- a/tests/ui/box/alloc-unstable-fail.stderr
+++ b/tests/ui/box/alloc-unstable-fail.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'allocator_api'
+error[E0658]: use of unstable library feature `allocator_api`
   --> $DIR/alloc-unstable-fail.rs:4:26
    |
 LL |     let _boxed: Box<u32, _> = Box::new(10);
diff --git a/tests/ui/closures/coerce-unsafe-to-closure.stderr b/tests/ui/closures/coerce-unsafe-to-closure.stderr
index 2538fc0361c..013b9009da4 100644
--- a/tests/ui/closures/coerce-unsafe-to-closure.stderr
+++ b/tests/ui/closures/coerce-unsafe-to-closure.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
+error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
   --> $DIR/coerce-unsafe-to-closure.rs:2:44
    |
 LL |     let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
@@ -6,7 +6,7 @@ LL |     let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
    |                                        |
    |                                        required by a bound introduced by this call
    |
-   = help: the trait `FnOnce(&str)` is not implemented for fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
+   = help: the trait `FnOnce(&str)` is not implemented for fn item `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
    = note: unsafe function cannot be called generically without an unsafe block
 note: required by a bound in `Option::<T>::map`
   --> $SRC_DIR/core/src/option.rs:LL:COL
diff --git a/tests/ui/conditional-compilation/cfg_accessible-unstable.rs b/tests/ui/conditional-compilation/cfg_accessible-unstable.rs
index e9247e67a2a..9ac98dbd6e7 100644
--- a/tests/ui/conditional-compilation/cfg_accessible-unstable.rs
+++ b/tests/ui/conditional-compilation/cfg_accessible-unstable.rs
@@ -1,2 +1,2 @@
-#[cfg_accessible(std)] //~ ERROR use of unstable library feature 'cfg_accessible'
+#[cfg_accessible(std)] //~ ERROR use of unstable library feature `cfg_accessible`
 fn main() {}
diff --git a/tests/ui/conditional-compilation/cfg_accessible-unstable.stderr b/tests/ui/conditional-compilation/cfg_accessible-unstable.stderr
index 201f6a13f1f..c994f4e67ac 100644
--- a/tests/ui/conditional-compilation/cfg_accessible-unstable.stderr
+++ b/tests/ui/conditional-compilation/cfg_accessible-unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'cfg_accessible': `cfg_accessible` is not fully implemented
+error[E0658]: use of unstable library feature `cfg_accessible`: `cfg_accessible` is not fully implemented
   --> $DIR/cfg_accessible-unstable.rs:1:3
    |
 LL | #[cfg_accessible(std)]
diff --git a/tests/ui/consts/auxiliary/unstable_intrinsic.rs b/tests/ui/consts/auxiliary/unstable_intrinsic.rs
index edef499dbb1..9e53a8feb5d 100644
--- a/tests/ui/consts/auxiliary/unstable_intrinsic.rs
+++ b/tests/ui/consts/auxiliary/unstable_intrinsic.rs
@@ -1,26 +1,13 @@
 #![feature(staged_api, rustc_attrs, intrinsics)]
 #![stable(since="1.0.0", feature = "stable")]
 
-#[stable(since="1.0.0", feature = "stable")]
-pub mod old_way {
-    extern "rust-intrinsic" {
-        #[unstable(feature = "unstable", issue = "42")]
-        pub fn size_of_val<T>(x: *const T) -> usize;
-
-        #[unstable(feature = "unstable", issue = "42")]
-        #[rustc_const_unstable(feature = "unstable", issue = "42")]
-        pub fn min_align_of_val<T>(x: *const T) -> usize;
-    }
-}
-
-#[stable(since="1.0.0", feature = "stable")]
-pub mod new_way {
-    #[unstable(feature = "unstable", issue = "42")]
-    #[rustc_intrinsic]
-    pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 }
-
-    #[unstable(feature = "unstable", issue = "42")]
-    #[rustc_const_unstable(feature = "unstable", issue = "42")]
-    #[rustc_intrinsic]
-    pub const unsafe fn min_align_of_val<T>(x: *const T) -> usize { 42 }
-}
+#[unstable(feature = "unstable", issue = "42")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 }
+
+#[unstable(feature = "unstable", issue = "42")]
+#[rustc_const_unstable(feature = "unstable", issue = "42")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn min_align_of_val<T>(x: *const T) -> usize { 42 }
diff --git a/tests/ui/consts/const-compare-bytes-ub.rs b/tests/ui/consts/const-compare-bytes-ub.rs
index 903ba15e622..9dafae1efd1 100644
--- a/tests/ui/consts/const-compare-bytes-ub.rs
+++ b/tests/ui/consts/const-compare-bytes-ub.rs
@@ -1,7 +1,6 @@
 //@ check-fail
 
 #![feature(core_intrinsics)]
-#![feature(const_intrinsic_compare_bytes)]
 use std::intrinsics::compare_bytes;
 use std::mem::MaybeUninit;
 
diff --git a/tests/ui/consts/const-compare-bytes-ub.stderr b/tests/ui/consts/const-compare-bytes-ub.stderr
index 7f83dee6409..9ef5c8ad43a 100644
--- a/tests/ui/consts/const-compare-bytes-ub.stderr
+++ b/tests/ui/consts/const-compare-bytes-ub.stderr
@@ -1,47 +1,47 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-compare-bytes-ub.rs:10:9
+  --> $DIR/const-compare-bytes-ub.rs:9:9
    |
 LL |         compare_bytes(0 as *const u8, 2 as *const u8, 1)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got a null pointer
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-compare-bytes-ub.rs:14:9
+  --> $DIR/const-compare-bytes-ub.rs:13:9
    |
 LL |         compare_bytes(1 as *const u8, 0 as *const u8, 1)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance)
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-compare-bytes-ub.rs:18:9
+  --> $DIR/const-compare-bytes-ub.rs:17:9
    |
 LL |         compare_bytes(1 as *const u8, 2 as *const u8, 1)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance)
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-compare-bytes-ub.rs:22:9
+  --> $DIR/const-compare-bytes-ub.rs:21:9
    |
 LL |         compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0 which is only 3 bytes from the end of the allocation
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-compare-bytes-ub.rs:26:9
+  --> $DIR/const-compare-bytes-ub.rs:25:9
    |
 LL |         compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC1 which is only 3 bytes from the end of the allocation
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-compare-bytes-ub.rs:30:9
+  --> $DIR/const-compare-bytes-ub.rs:29:9
    |
 LL |         compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC2[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-compare-bytes-ub.rs:34:9
+  --> $DIR/const-compare-bytes-ub.rs:33:9
    |
 LL |         compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC3[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/const-compare-bytes-ub.rs:38:9
+  --> $DIR/const-compare-bytes-ub.rs:37:9
    |
 LL |         compare_bytes([&1].as_ptr().cast(), [&2].as_ptr().cast(), std::mem::size_of::<usize>())
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
diff --git a/tests/ui/consts/const-compare-bytes.rs b/tests/ui/consts/const-compare-bytes.rs
index 8596a2d9df9..cd5cdfd0400 100644
--- a/tests/ui/consts/const-compare-bytes.rs
+++ b/tests/ui/consts/const-compare-bytes.rs
@@ -1,7 +1,6 @@
 //@ run-pass
 
 #![feature(core_intrinsics)]
-#![feature(const_intrinsic_compare_bytes)]
 use std::intrinsics::compare_bytes;
 
 fn main() {
diff --git a/tests/ui/consts/const-eval/simd/insert_extract.rs b/tests/ui/consts/const-eval/simd/insert_extract.rs
index 57d4b4888ca..e5873ea26e8 100644
--- a/tests/ui/consts/const-eval/simd/insert_extract.rs
+++ b/tests/ui/consts/const-eval/simd/insert_extract.rs
@@ -1,6 +1,6 @@
 //@ run-pass
 #![feature(repr_simd)]
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
 #![feature(staged_api)]
 #![stable(feature = "foo", since = "1.3.37")]
 #![allow(non_camel_case_types)]
@@ -10,14 +10,18 @@
 #[repr(simd)] struct u16x2([u16; 2]);
 #[repr(simd)] struct f32x4([f32; 4]);
 
-extern "rust-intrinsic" {
-    #[stable(feature = "foo", since = "1.3.37")]
-    #[rustc_const_stable(feature = "foo", since = "1.3.37")]
-    fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T;
+#[stable(feature = "foo", since = "1.3.37")]
+#[rustc_const_stable(feature = "foo", since = "1.3.37")]
+#[rustc_intrinsic]
+const unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T {
+    unimplemented!()
+}
 
-    #[stable(feature = "foo", since = "1.3.37")]
-    #[rustc_const_stable(feature = "foo", since = "1.3.37")]
-    fn simd_extract<T, U>(x: T, idx: u32) -> U;
+#[stable(feature = "foo", since = "1.3.37")]
+#[rustc_const_stable(feature = "foo", since = "1.3.37")]
+#[rustc_intrinsic]
+const unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U {
+    unimplemented!()
 }
 
 fn main() {
diff --git a/tests/ui/consts/const-unstable-intrinsic.rs b/tests/ui/consts/const-unstable-intrinsic.rs
index 050abc6dd46..56b552b6a3f 100644
--- a/tests/ui/consts/const-unstable-intrinsic.rs
+++ b/tests/ui/consts/const-unstable-intrinsic.rs
@@ -14,63 +14,51 @@ fn main() {
 const fn const_main() {
     let x = 42;
     unsafe {
-        unstable_intrinsic::old_way::size_of_val(&x);
-        //~^ERROR: unstable library feature 'unstable'
-        //~|ERROR: cannot call non-const intrinsic
-        unstable_intrinsic::old_way::min_align_of_val(&x);
-        //~^ERROR: unstable library feature 'unstable'
-        //~|ERROR: not yet stable as a const intrinsic
-        unstable_intrinsic::new_way::size_of_val(&x);
-        //~^ERROR: unstable library feature 'unstable'
+        unstable_intrinsic::size_of_val(&x);
+        //~^ERROR: unstable library feature `unstable`
         //~|ERROR: cannot be (indirectly) exposed to stable
-        unstable_intrinsic::new_way::min_align_of_val(&x);
-        //~^ERROR: unstable library feature 'unstable'
+        unstable_intrinsic::min_align_of_val(&x);
+        //~^ERROR: unstable library feature `unstable`
         //~|ERROR: not yet stable as a const intrinsic
 
-        old_way::size_of_val(&x);
-        //~^ERROR: cannot call non-const intrinsic
-        old_way::min_align_of_val(&x);
-        //~^ERROR: cannot use `#[feature(local)]`
-        new_way::size_of_val(&x);
+        size_of_val(&x);
         //~^ERROR: cannot be (indirectly) exposed to stable
-        new_way::min_align_of_val(&x);
+        min_align_of_val(&x);
         //~^ERROR: cannot use `#[feature(local)]`
     }
 }
 
-#[stable(since="1.0.0", feature = "stable")]
-pub mod old_way {
-    extern "rust-intrinsic" {
-        #[unstable(feature = "local", issue = "42")]
-        pub fn size_of_val<T>(x: *const T) -> usize;
-
-        #[unstable(feature = "local", issue = "42")]
-        #[rustc_const_unstable(feature = "local", issue = "42")]
-        pub fn min_align_of_val<T>(x: *const T) -> usize;
-    }
-}
-
-#[stable(since="1.0.0", feature = "stable")]
-pub mod new_way {
-    #[unstable(feature = "local", issue = "42")]
-    #[rustc_intrinsic]
-    pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 }
+#[unstable(feature = "local", issue = "42")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 }
 
-    #[unstable(feature = "local", issue = "42")]
-    #[rustc_const_unstable(feature = "local", issue = "42")]
-    #[rustc_intrinsic]
-    pub const unsafe fn min_align_of_val<T>(x: *const T) -> usize { 42 }
-}
+#[unstable(feature = "local", issue = "42")]
+#[rustc_const_unstable(feature = "local", issue = "42")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub const unsafe fn min_align_of_val<T>(x: *const T) -> usize { 42 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
 #[inline]
 pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
     // Const stability attributes are not inherited from parent items.
-    extern "rust-intrinsic" {
-        fn copy<T>(src: *const T, dst: *mut T, count: usize);
+    #[rustc_intrinsic]
+    #[rustc_intrinsic_must_be_overridden]
+    const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
+        unimplemented!()
     }
 
     unsafe { copy(src, dst, count) }
-    //~^ ERROR cannot call non-const intrinsic
+    //~^ ERROR cannot be (indirectly) exposed to stable
+}
+
+// Ensure that a fallback body is recursively-const-checked.
+mod fallback {
+    #[rustc_intrinsic]
+    const unsafe fn copy<T>(src: *const T, _dst: *mut T, _count: usize) {
+        super::size_of_val(src);
+        //~^ ERROR cannot be (indirectly) exposed to stable
+    }
 }
diff --git a/tests/ui/consts/const-unstable-intrinsic.stderr b/tests/ui/consts/const-unstable-intrinsic.stderr
index 33a434c503d..3e605f3d003 100644
--- a/tests/ui/consts/const-unstable-intrinsic.stderr
+++ b/tests/ui/consts/const-unstable-intrinsic.stderr
@@ -1,84 +1,52 @@
-error[E0658]: use of unstable library feature 'unstable'
+error[E0658]: use of unstable library feature `unstable`
   --> $DIR/const-unstable-intrinsic.rs:17:9
    |
-LL |         unstable_intrinsic::old_way::size_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         unstable_intrinsic::size_of_val(&x);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information
    = help: add `#![feature(unstable)]` 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]: use of unstable library feature 'unstable'
+error[E0658]: use of unstable library feature `unstable`
   --> $DIR/const-unstable-intrinsic.rs:20:9
    |
-LL |         unstable_intrinsic::old_way::min_align_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information
-   = help: add `#![feature(unstable)]` 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]: use of unstable library feature 'unstable'
-  --> $DIR/const-unstable-intrinsic.rs:23:9
-   |
-LL |         unstable_intrinsic::new_way::size_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information
-   = help: add `#![feature(unstable)]` 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]: use of unstable library feature 'unstable'
-  --> $DIR/const-unstable-intrinsic.rs:26:9
-   |
-LL |         unstable_intrinsic::new_way::min_align_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         unstable_intrinsic::min_align_of_val(&x);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information
    = help: add `#![feature(unstable)]` 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: cannot call non-const intrinsic `size_of_val` in constant functions
+error: intrinsic `unstable_intrinsic::size_of_val` cannot be (indirectly) exposed to stable
   --> $DIR/const-unstable-intrinsic.rs:17:9
    |
-LL |         unstable_intrinsic::old_way::size_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         unstable_intrinsic::size_of_val(&x);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval)
 
 error: `min_align_of_val` is not yet stable as a const intrinsic
   --> $DIR/const-unstable-intrinsic.rs:20:9
    |
-LL |         unstable_intrinsic::old_way::min_align_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         unstable_intrinsic::min_align_of_val(&x);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(unstable)]` to the crate attributes to enable
 
-error: intrinsic `unstable_intrinsic::new_way::size_of_val` cannot be (indirectly) exposed to stable
-  --> $DIR/const-unstable-intrinsic.rs:23:9
+error: intrinsic `size_of_val` cannot be (indirectly) exposed to stable
+  --> $DIR/const-unstable-intrinsic.rs:24:9
    |
-LL |         unstable_intrinsic::new_way::size_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         size_of_val(&x);
+   |         ^^^^^^^^^^^^^^^
    |
-   = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_indirect]` (but this requires team approval)
-
-error: `min_align_of_val` is not yet stable as a const intrinsic
-  --> $DIR/const-unstable-intrinsic.rs:26:9
-   |
-LL |         unstable_intrinsic::new_way::min_align_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: add `#![feature(unstable)]` to the crate attributes to enable
-
-error: cannot call non-const intrinsic `size_of_val` in constant functions
-  --> $DIR/const-unstable-intrinsic.rs:30:9
-   |
-LL |         old_way::size_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval)
 
 error: const function that might be (indirectly) exposed to stable cannot use `#[feature(local)]`
-  --> $DIR/const-unstable-intrinsic.rs:32:9
+  --> $DIR/const-unstable-intrinsic.rs:26:9
    |
-LL |         old_way::min_align_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         min_align_of_val(&x);
+   |         ^^^^^^^^^^^^^^^^^^^^
    |
 help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
    |
@@ -91,37 +59,22 @@ LL + #[rustc_allow_const_fn_unstable(local)]
 LL | const fn const_main() {
    |
 
-error: intrinsic `new_way::size_of_val` cannot be (indirectly) exposed to stable
-  --> $DIR/const-unstable-intrinsic.rs:34:9
+error: intrinsic `copy::copy` cannot be (indirectly) exposed to stable
+  --> $DIR/const-unstable-intrinsic.rs:53:14
    |
-LL |         new_way::size_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     unsafe { copy(src, dst, count) }
+   |              ^^^^^^^^^^^^^^^^^^^^^
    |
-   = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_indirect]` (but this requires team approval)
+   = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval)
 
-error: const function that might be (indirectly) exposed to stable cannot use `#[feature(local)]`
-  --> $DIR/const-unstable-intrinsic.rs:36:9
-   |
-LL |         new_way::min_align_of_val(&x);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+error: intrinsic `size_of_val` cannot be (indirectly) exposed to stable
+  --> $DIR/const-unstable-intrinsic.rs:61:9
    |
-help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
+LL |         super::size_of_val(src);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
    |
-LL + #[rustc_const_unstable(feature = "...", issue = "...")]
-LL | const fn const_main() {
-   |
-help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval)
-   |
-LL + #[rustc_allow_const_fn_unstable(local)]
-LL | const fn const_main() {
-   |
-
-error: cannot call non-const intrinsic `copy` in constant functions
-  --> $DIR/const-unstable-intrinsic.rs:74:14
-   |
-LL |     unsafe { copy(src, dst, count) }
-   |              ^^^^^^^^^^^^^^^^^^^^^
+   = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval)
 
-error: aborting due to 13 previous errors
+error: aborting due to 8 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/consts/copy-intrinsic.rs b/tests/ui/consts/copy-intrinsic.rs
index 62917c0b98b..08fbcc107e7 100644
--- a/tests/ui/consts/copy-intrinsic.rs
+++ b/tests/ui/consts/copy-intrinsic.rs
@@ -1,17 +1,21 @@
 #![stable(feature = "dummy", since = "1.0.0")]
 
 // ignore-tidy-linelength
-#![feature(intrinsics, staged_api)]
+#![feature(intrinsics, staged_api, rustc_attrs)]
 use std::mem;
 
-extern "rust-intrinsic" {
-    #[stable(feature = "dummy", since = "1.0.0")]
-    #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
-    fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
+#[stable(feature = "dummy", since = "1.0.0")]
+#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
+#[rustc_intrinsic]
+const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
+    unimplemented!()
+}
 
-    #[stable(feature = "dummy", since = "1.0.0")]
-    #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
-    fn copy<T>(src: *const T, dst: *mut T, count: usize);
+#[stable(feature = "dummy", since = "1.0.0")]
+#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
+#[rustc_intrinsic]
+const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
+    unimplemented!()
 }
 
 const COPY_ZERO: () = unsafe {
diff --git a/tests/ui/consts/copy-intrinsic.stderr b/tests/ui/consts/copy-intrinsic.stderr
index 29a88f6270b..41af3a2cd2d 100644
--- a/tests/ui/consts/copy-intrinsic.stderr
+++ b/tests/ui/consts/copy-intrinsic.stderr
@@ -1,23 +1,23 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/copy-intrinsic.rs:30:5
+  --> $DIR/copy-intrinsic.rs:34:5
    |
 LL |     copy_nonoverlapping(0x100 as *const i32, dangle, 1);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got 0x100[noalloc] which is a dangling pointer (it has no provenance)
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/copy-intrinsic.rs:39:5
+  --> $DIR/copy-intrinsic.rs:43:5
    |
 LL |     copy_nonoverlapping(dangle, 0x100 as *mut i32, 1);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x28 which is at or beyond the end of the allocation of size 4 bytes
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/copy-intrinsic.rs:46:5
+  --> $DIR/copy-intrinsic.rs:50:5
    |
 LL |     copy(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy`
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/copy-intrinsic.rs:52:5
+  --> $DIR/copy-intrinsic.rs:56:5
    |
 LL |     copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy_nonoverlapping`
diff --git a/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs
new file mode 100644
index 00000000000..c4fb620fea4
--- /dev/null
+++ b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs
@@ -0,0 +1,11 @@
+// Duplicate implementations of Copy/Clone should not trigger
+// borrow check warnings
+// See #131083
+
+#[derive(Copy, Clone)]
+#[derive(Copy, Clone)]
+//~^ ERROR conflicting implementations of trait `Clone` for type `E`
+//~| ERROR conflicting implementations of trait `Copy` for type `E`
+enum E {}
+
+fn main() {}
diff --git a/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr
new file mode 100644
index 00000000000..f8e1db33f53
--- /dev/null
+++ b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr
@@ -0,0 +1,23 @@
+error[E0119]: conflicting implementations of trait `Copy` for type `E`
+  --> $DIR/duplicate-derive-copy-clone-diagnostics.rs:6:10
+   |
+LL | #[derive(Copy, Clone)]
+   |          ---- first implementation here
+LL | #[derive(Copy, Clone)]
+   |          ^^^^ conflicting implementation for `E`
+   |
+   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `Clone` for type `E`
+  --> $DIR/duplicate-derive-copy-clone-diagnostics.rs:6:16
+   |
+LL | #[derive(Copy, Clone)]
+   |                ----- first implementation here
+LL | #[derive(Copy, Clone)]
+   |                ^^^^^ conflicting implementation for `E`
+   |
+   = note: this error originates in the derive macro `Clone` (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 E0119`.
diff --git a/tests/ui/derives/rustc-decodable-issue-123156.stderr b/tests/ui/derives/rustc-decodable-issue-123156.stderr
index ee7b33d59bb..93a993b90d8 100644
--- a/tests/ui/derives/rustc-decodable-issue-123156.stderr
+++ b/tests/ui/derives/rustc-decodable-issue-123156.stderr
@@ -1,5 +1,5 @@
 Future incompatibility report: Future breakage diagnostic:
-warning: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code
+warning: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code
   --> $DIR/rustc-decodable-issue-123156.rs:10:10
    |
 LL | #[derive(RustcDecodable)]
diff --git a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr
index 57851ed417e..4c4f0663eeb 100644
--- a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr
+++ b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr
@@ -41,6 +41,10 @@ LL |     Struct { a, b } = Struct { a: 1, b: 2 };
    |               ~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     Struct { a, b: _ } = Struct { a: 1, b: 2 };
+   |               ~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     Struct { a, .. } = Struct { a: 1, b: 2 };
    |               ~~~~~~
 
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr
index e56af28f3fb..be17476524a 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr
@@ -15,6 +15,10 @@ note: required by a bound in `check`
    |
 LL | fn check(a: impl Foo) {}
    |                  ^^^ required by this bound in `check`
+help: use a unary tuple instead
+   |
+LL |     check(((),));
+   |           +  ++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr
index 629fc59361d..ca9a6ebc1c4 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr
@@ -12,6 +12,10 @@ note: required by a bound in `check`
    |
 LL | fn check(a: impl Foo) {}
    |                  ^^^ required by this bound in `check`
+help: use a unary tuple instead
+   |
+LL |     check(((),));
+   |           +  ++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr
index 629fc59361d..ca9a6ebc1c4 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr
@@ -12,6 +12,10 @@ note: required by a bound in `check`
    |
 LL | fn check(a: impl Foo) {}
    |                  ^^^ required by this bound in `check`
+help: use a unary tuple instead
+   |
+LL |     check(((),));
+   |           +  ++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr
index 9ae97e4a994..7bbafcf0a27 100644
--- a/tests/ui/error-codes/E0027.stderr
+++ b/tests/ui/error-codes/E0027.stderr
@@ -10,6 +10,10 @@ LL |         Dog { age: x, name } => {}
    |                     ~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |         Dog { age: x, name: _ } => {}
+   |                     ~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         Dog { age: x, .. } => {}
    |                     ~~~~~~
 
@@ -25,6 +29,10 @@ LL |         Dog { name: x, age } => {}
    |                      ~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |         Dog { name: x, age: _ } => {}
+   |                      ~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         Dog { name: x, .. } => {}
    |                      ~~~~~~
 
@@ -40,6 +48,10 @@ LL |         Dog { name: x, age } => {}
    |                      ~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |         Dog { name: x, age: _ } => {}
+   |                      ~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         Dog { name: x, .. } => {}
    |                      ~~~~~~
 
@@ -55,6 +67,10 @@ LL |         Dog { name, age } => {}
    |             ~~~~~~~~~~~~~
 help: if you don't care about these missing fields, you can explicitly ignore them
    |
+LL |         Dog { name: _, age: _ } => {}
+   |             ~~~~~~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         Dog { .. } => {}
    |             ~~~~~~
 
diff --git a/tests/ui/explore-issue-38412.rs b/tests/ui/explore-issue-38412.rs
index 836cb98b5b3..e1295a96ba5 100644
--- a/tests/ui/explore-issue-38412.rs
+++ b/tests/ui/explore-issue-38412.rs
@@ -18,7 +18,7 @@ fn main() {
 
     let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
         Record::new();
-    //~^^ ERROR use of unstable library feature 'unstable_undeclared'
+    //~^^ ERROR use of unstable library feature `unstable_undeclared`
 
     let r = Record::new();
     let t = Tuple::new();
diff --git a/tests/ui/explore-issue-38412.stderr b/tests/ui/explore-issue-38412.stderr
index a45ec688855..884184ec16e 100644
--- a/tests/ui/explore-issue-38412.stderr
+++ b/tests/ui/explore-issue-38412.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_undeclared'
+error[E0658]: use of unstable library feature `unstable_undeclared`
   --> $DIR/explore-issue-38412.rs:19:63
    |
 LL |     let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
@@ -8,7 +8,7 @@ LL |     let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_un
    = help: add `#![feature(unstable_undeclared)]` 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]: use of unstable library feature 'unstable_undeclared'
+error[E0658]: use of unstable library feature `unstable_undeclared`
   --> $DIR/explore-issue-38412.rs:28:5
    |
 LL |     r.a_unstable_undeclared_pub;
@@ -36,7 +36,7 @@ error[E0616]: field `d_priv` of struct `Record` is private
 LL |     r.d_priv;
    |       ^^^^^^ private field
 
-error[E0658]: use of unstable library feature 'unstable_undeclared'
+error[E0658]: use of unstable library feature `unstable_undeclared`
   --> $DIR/explore-issue-38412.rs:35:5
    |
 LL |     t.2;
@@ -64,7 +64,7 @@ error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private
 LL |     t.5;
    |       ^ private field
 
-error[E0658]: use of unstable library feature 'unstable_undeclared'
+error[E0658]: use of unstable library feature `unstable_undeclared`
   --> $DIR/explore-issue-38412.rs:42:7
    |
 LL |     r.unstable_undeclared_trait_method();
@@ -74,7 +74,7 @@ LL |     r.unstable_undeclared_trait_method();
    = help: add `#![feature(unstable_undeclared)]` 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]: use of unstable library feature 'unstable_undeclared'
+error[E0658]: use of unstable library feature `unstable_undeclared`
   --> $DIR/explore-issue-38412.rs:46:7
    |
 LL |     r.unstable_undeclared();
@@ -117,7 +117,7 @@ LL |     r.private();
 LL |         fn private(&self) -> i32 { self.d_priv }
    |         ------------------------ private method defined here
 
-error[E0658]: use of unstable library feature 'unstable_undeclared'
+error[E0658]: use of unstable library feature `unstable_undeclared`
   --> $DIR/explore-issue-38412.rs:55:7
    |
 LL |     t.unstable_undeclared_trait_method();
@@ -127,7 +127,7 @@ LL |     t.unstable_undeclared_trait_method();
    = help: add `#![feature(unstable_undeclared)]` 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]: use of unstable library feature 'unstable_undeclared'
+error[E0658]: use of unstable library feature `unstable_undeclared`
   --> $DIR/explore-issue-38412.rs:59:7
    |
 LL |     t.unstable_undeclared();
diff --git a/tests/ui/feature-gates/bench.rs b/tests/ui/feature-gates/bench.rs
index 2ce1d50fbb0..12e646f7a32 100644
--- a/tests/ui/feature-gates/bench.rs
+++ b/tests/ui/feature-gates/bench.rs
@@ -1,9 +1,9 @@
 //@ edition:2018
 
-#[bench] //~ ERROR use of unstable library feature 'test'
+#[bench] //~ ERROR use of unstable library feature `test`
          //~| WARN this was previously accepted
 fn bench() {}
 
-use bench as _; //~ ERROR use of unstable library feature 'test'
+use bench as _; //~ ERROR use of unstable library feature `test`
                 //~| WARN this was previously accepted
 fn main() {}
diff --git a/tests/ui/feature-gates/bench.stderr b/tests/ui/feature-gates/bench.stderr
index df935560fd6..de78e863012 100644
--- a/tests/ui/feature-gates/bench.stderr
+++ b/tests/ui/feature-gates/bench.stderr
@@ -1,4 +1,4 @@
-error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
+error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
   --> $DIR/bench.rs:3:3
    |
 LL | #[bench]
@@ -8,7 +8,7 @@ LL | #[bench]
    = note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266>
    = note: `#[deny(soft_unstable)]` on by default
 
-error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
+error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
   --> $DIR/bench.rs:7:5
    |
 LL | use bench as _;
@@ -20,7 +20,7 @@ LL | use bench as _;
 error: aborting due to 2 previous errors
 
 Future incompatibility report: Future breakage diagnostic:
-error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
+error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
   --> $DIR/bench.rs:3:3
    |
 LL | #[bench]
@@ -31,7 +31,7 @@ LL | #[bench]
    = note: `#[deny(soft_unstable)]` on by default
 
 Future breakage diagnostic:
-error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
+error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
   --> $DIR/bench.rs:7:5
    |
 LL | use bench as _;
diff --git a/tests/ui/feature-gates/feature-gate-alloc-error-handler.rs b/tests/ui/feature-gates/feature-gate-alloc-error-handler.rs
index 2d099e24db8..a2a4b3f19d9 100644
--- a/tests/ui/feature-gates/feature-gate-alloc-error-handler.rs
+++ b/tests/ui/feature-gates/feature-gate-alloc-error-handler.rs
@@ -5,7 +5,7 @@
 
 use core::alloc::Layout;
 
-#[alloc_error_handler] //~ ERROR use of unstable library feature 'alloc_error_handler'
+#[alloc_error_handler] //~ ERROR use of unstable library feature `alloc_error_handler`
 fn oom(info: Layout) -> ! {
     loop {}
 }
diff --git a/tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr b/tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr
index 2ebd7cd9b02..ae41ee55d3d 100644
--- a/tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr
+++ b/tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'alloc_error_handler'
+error[E0658]: use of unstable library feature `alloc_error_handler`
   --> $DIR/feature-gate-alloc-error-handler.rs:8:3
    |
 LL | #[alloc_error_handler]
diff --git a/tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr b/tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr
index 36a017dd53c..15ef257fbd8 100644
--- a/tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr
+++ b/tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'autodiff'
+error[E0658]: use of unstable library feature `autodiff`
   --> $DIR/feature-gate-autodiff-use.rs:13:3
    |
 LL | #[autodiff(dfoo, Reverse)]
@@ -8,7 +8,7 @@ LL | #[autodiff(dfoo, Reverse)]
    = help: add `#![feature(autodiff)]` 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]: use of unstable library feature 'autodiff'
+error[E0658]: use of unstable library feature `autodiff`
   --> $DIR/feature-gate-autodiff-use.rs:9:5
    |
 LL | use std::autodiff::autodiff;
diff --git a/tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr b/tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr
index 4b767f824c8..f59e4955452 100644
--- a/tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr
+++ b/tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'autodiff'
+error[E0658]: use of unstable library feature `autodiff`
   --> $DIR/feature-gate-autodiff-use.rs:13:3
    |
 LL | #[autodiff(dfoo, Reverse)]
@@ -14,7 +14,7 @@ error: this rustc version does not support autodiff
 LL | #[autodiff(dfoo, Reverse)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error[E0658]: use of unstable library feature 'autodiff'
+error[E0658]: use of unstable library feature `autodiff`
   --> $DIR/feature-gate-autodiff-use.rs:9:5
    |
 LL | use std::autodiff::autodiff;
diff --git a/tests/ui/feature-gates/feature-gate-autodiff-use.rs b/tests/ui/feature-gates/feature-gate-autodiff-use.rs
index 2276a79d6e2..602e830b0b2 100644
--- a/tests/ui/feature-gates/feature-gate-autodiff-use.rs
+++ b/tests/ui/feature-gates/feature-gate-autodiff-use.rs
@@ -7,11 +7,11 @@
 #![crate_type = "lib"]
 
 use std::autodiff::autodiff;
-//[has_support]~^ ERROR use of unstable library feature 'autodiff'
-//[no_support]~^^ ERROR use of unstable library feature 'autodiff'
+//[has_support]~^ ERROR use of unstable library feature `autodiff`
+//[no_support]~^^ ERROR use of unstable library feature `autodiff`
 
 #[autodiff(dfoo, Reverse)]
-//[has_support]~^ ERROR use of unstable library feature 'autodiff' [E0658]
-//[no_support]~^^ ERROR use of unstable library feature 'autodiff' [E0658]
+//[has_support]~^ ERROR use of unstable library feature `autodiff` [E0658]
+//[no_support]~^^ ERROR use of unstable library feature `autodiff` [E0658]
 //[no_support]~| ERROR this rustc version does not support autodiff
 fn foo() {}
diff --git a/tests/ui/feature-gates/feature-gate-concat_bytes.rs b/tests/ui/feature-gates/feature-gate-concat_bytes.rs
index 07d63cb11e0..abdaa725784 100644
--- a/tests/ui/feature-gates/feature-gate-concat_bytes.rs
+++ b/tests/ui/feature-gates/feature-gate-concat_bytes.rs
@@ -1,4 +1,4 @@
 fn main() {
-    let a = concat_bytes!(b'A', b"BC"); //~ ERROR use of unstable library feature 'concat_bytes'
+    let a = concat_bytes!(b'A', b"BC"); //~ ERROR use of unstable library feature `concat_bytes`
     assert_eq!(a, &[65, 66, 67]);
 }
diff --git a/tests/ui/feature-gates/feature-gate-concat_bytes.stderr b/tests/ui/feature-gates/feature-gate-concat_bytes.stderr
index ed9692d3693..4f75e143e9a 100644
--- a/tests/ui/feature-gates/feature-gate-concat_bytes.stderr
+++ b/tests/ui/feature-gates/feature-gate-concat_bytes.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'concat_bytes'
+error[E0658]: use of unstable library feature `concat_bytes`
   --> $DIR/feature-gate-concat_bytes.rs:2:13
    |
 LL |     let a = concat_bytes!(b'A', b"BC");
diff --git a/tests/ui/feature-gates/feature-gate-concat_idents.stderr b/tests/ui/feature-gates/feature-gate-concat_idents.stderr
index eaaef0f2539..d0f4fe62d04 100644
--- a/tests/ui/feature-gates/feature-gate-concat_idents.stderr
+++ b/tests/ui/feature-gates/feature-gate-concat_idents.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
   --> $DIR/feature-gate-concat_idents.rs:5:13
    |
 LL |     let a = concat_idents!(X, Y_1);
@@ -8,7 +8,7 @@ LL |     let a = concat_idents!(X, Y_1);
    = help: add `#![feature(concat_idents)]` 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]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
   --> $DIR/feature-gate-concat_idents.rs:6:13
    |
 LL |     let b = concat_idents!(X, Y_2);
diff --git a/tests/ui/feature-gates/feature-gate-concat_idents2.stderr b/tests/ui/feature-gates/feature-gate-concat_idents2.stderr
index 2fe786ff406..2052813ea4a 100644
--- a/tests/ui/feature-gates/feature-gate-concat_idents2.stderr
+++ b/tests/ui/feature-gates/feature-gate-concat_idents2.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
   --> $DIR/feature-gate-concat_idents2.rs:2:5
    |
 LL |     concat_idents!(a, b);
diff --git a/tests/ui/feature-gates/feature-gate-concat_idents3.stderr b/tests/ui/feature-gates/feature-gate-concat_idents3.stderr
index a7daa1f949f..b186601d0ed 100644
--- a/tests/ui/feature-gates/feature-gate-concat_idents3.stderr
+++ b/tests/ui/feature-gates/feature-gate-concat_idents3.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
   --> $DIR/feature-gate-concat_idents3.rs:5:20
    |
 LL |     assert_eq!(10, concat_idents!(X, Y_1));
@@ -8,7 +8,7 @@ LL |     assert_eq!(10, concat_idents!(X, Y_1));
    = help: add `#![feature(concat_idents)]` 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]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
   --> $DIR/feature-gate-concat_idents3.rs:6:20
    |
 LL |     assert_eq!(20, concat_idents!(X, Y_2));
diff --git a/tests/ui/feature-gates/feature-gate-custom_mir.stderr b/tests/ui/feature-gates/feature-gate-custom_mir.stderr
index 118eab144bf..eeceb0355ee 100644
--- a/tests/ui/feature-gates/feature-gate-custom_mir.stderr
+++ b/tests/ui/feature-gates/feature-gate-custom_mir.stderr
@@ -7,7 +7,7 @@ LL | #[custom_mir(dialect = "built")]
    = help: add `#![feature(custom_mir)]` 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]: use of unstable library feature 'custom_mir': MIR is an implementation detail and extremely unstable
+error[E0658]: use of unstable library feature `custom_mir`: MIR is an implementation detail and extremely unstable
   --> $DIR/feature-gate-custom_mir.rs:4:5
    |
 LL | use core::intrinsics::mir::*;
@@ -16,7 +16,7 @@ LL | use core::intrinsics::mir::*;
    = help: add `#![feature(custom_mir)]` 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]: use of unstable library feature 'custom_mir': MIR is an implementation detail and extremely unstable
+error[E0658]: use of unstable library feature `custom_mir`: MIR is an implementation detail and extremely unstable
   --> $DIR/feature-gate-custom_mir.rs:10:13
    |
 LL |             Return()
diff --git a/tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr b/tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr
index 016be980d4d..7744759be57 100644
--- a/tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr
+++ b/tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'custom_test_frameworks': custom test frameworks are an unstable feature
+error[E0658]: use of unstable library feature `custom_test_frameworks`: custom test frameworks are an unstable feature
   --> $DIR/feature-gate-custom_test_frameworks.rs:3:3
    |
 LL | #[test_case]
diff --git a/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs b/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs
index 69bc70e8666..d730849dcf6 100644
--- a/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs
+++ b/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs
@@ -1,6 +1,6 @@
-use std::marker::CoercePointee; //~ ERROR use of unstable library feature 'derive_coerce_pointee'
+use std::marker::CoercePointee; //~ ERROR use of unstable library feature `derive_coerce_pointee`
 
-#[derive(CoercePointee)] //~ ERROR use of unstable library feature 'derive_coerce_pointee'
+#[derive(CoercePointee)] //~ ERROR use of unstable library feature `derive_coerce_pointee`
 #[repr(transparent)]
 struct MyPointer<'a, #[pointee] T: ?Sized> {
     ptr: &'a T,
diff --git a/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr b/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr
index 0b52ceb782a..19babe149d9 100644
--- a/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr
+++ b/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'derive_coerce_pointee'
+error[E0658]: use of unstable library feature `derive_coerce_pointee`
   --> $DIR/feature-gate-derive-coerce-pointee.rs:3:10
    |
 LL | #[derive(CoercePointee)]
@@ -8,7 +8,7 @@ LL | #[derive(CoercePointee)]
    = help: add `#![feature(derive_coerce_pointee)]` 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]: use of unstable library feature 'derive_coerce_pointee'
+error[E0658]: use of unstable library feature `derive_coerce_pointee`
   --> $DIR/feature-gate-derive-coerce-pointee.rs:1:5
    |
 LL | use std::marker::CoercePointee;
diff --git a/tests/ui/feature-gates/feature-gate-format_args_nl.stderr b/tests/ui/feature-gates/feature-gate-format_args_nl.stderr
index f72d34d9b0b..c7e8f8c686f 100644
--- a/tests/ui/feature-gates/feature-gate-format_args_nl.stderr
+++ b/tests/ui/feature-gates/feature-gate-format_args_nl.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'format_args_nl': `format_args_nl` is only for internal language use and is subject to change
+error[E0658]: use of unstable library feature `format_args_nl`: `format_args_nl` is only for internal language use and is subject to change
   --> $DIR/feature-gate-format_args_nl.rs:2:5
    |
 LL |     format_args_nl!("");
diff --git a/tests/ui/feature-gates/feature-gate-log_syntax.stderr b/tests/ui/feature-gates/feature-gate-log_syntax.stderr
index 0eba231a287..78152b50e89 100644
--- a/tests/ui/feature-gates/feature-gate-log_syntax.stderr
+++ b/tests/ui/feature-gates/feature-gate-log_syntax.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'log_syntax': `log_syntax!` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `log_syntax`: `log_syntax!` is not stable enough for use and is subject to change
   --> $DIR/feature-gate-log_syntax.rs:2:5
    |
 LL |     log_syntax!()
diff --git a/tests/ui/feature-gates/feature-gate-log_syntax2.stderr b/tests/ui/feature-gates/feature-gate-log_syntax2.stderr
index e1f92dd60a3..8875de2281b 100644
--- a/tests/ui/feature-gates/feature-gate-log_syntax2.stderr
+++ b/tests/ui/feature-gates/feature-gate-log_syntax2.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'log_syntax': `log_syntax!` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `log_syntax`: `log_syntax!` is not stable enough for use and is subject to change
   --> $DIR/feature-gate-log_syntax2.rs:2:22
    |
 LL |     println!("{:?}", log_syntax!());
diff --git a/tests/ui/feature-gates/feature-gate-naked_functions.rs b/tests/ui/feature-gates/feature-gate-naked_functions.rs
index 5fe0bbdc774..abb55b9a557 100644
--- a/tests/ui/feature-gates/feature-gate-naked_functions.rs
+++ b/tests/ui/feature-gates/feature-gate-naked_functions.rs
@@ -1,13 +1,13 @@
 //@ needs-asm-support
 
 use std::arch::naked_asm;
-//~^ ERROR use of unstable library feature 'naked_functions'
+//~^ ERROR use of unstable library feature `naked_functions`
 
 #[naked]
 //~^ the `#[naked]` attribute is an experimental feature
 extern "C" fn naked() {
     naked_asm!("")
-    //~^ ERROR use of unstable library feature 'naked_functions'
+    //~^ ERROR use of unstable library feature `naked_functions`
     //~| ERROR: requires unsafe
 }
 
@@ -15,7 +15,7 @@ extern "C" fn naked() {
 //~^ the `#[naked]` attribute is an experimental feature
 extern "C" fn naked_2() -> isize {
     naked_asm!("")
-    //~^ ERROR use of unstable library feature 'naked_functions'
+    //~^ ERROR use of unstable library feature `naked_functions`
     //~| ERROR: requires unsafe
 }
 
diff --git a/tests/ui/feature-gates/feature-gate-naked_functions.stderr b/tests/ui/feature-gates/feature-gate-naked_functions.stderr
index 709234eb023..9bfb9275bb2 100644
--- a/tests/ui/feature-gates/feature-gate-naked_functions.stderr
+++ b/tests/ui/feature-gates/feature-gate-naked_functions.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'naked_functions'
+error[E0658]: use of unstable library feature `naked_functions`
   --> $DIR/feature-gate-naked_functions.rs:9:5
    |
 LL |     naked_asm!("")
@@ -8,7 +8,7 @@ LL |     naked_asm!("")
    = help: add `#![feature(naked_functions)]` 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]: use of unstable library feature 'naked_functions'
+error[E0658]: use of unstable library feature `naked_functions`
   --> $DIR/feature-gate-naked_functions.rs:17:5
    |
 LL |     naked_asm!("")
@@ -38,7 +38,7 @@ LL | #[naked]
    = help: add `#![feature(naked_functions)]` 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]: use of unstable library feature 'naked_functions'
+error[E0658]: use of unstable library feature `naked_functions`
   --> $DIR/feature-gate-naked_functions.rs:3:5
    |
 LL | use std::arch::naked_asm;
diff --git a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs
index 13f8fd5fe22..71caf43806d 100644
--- a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs
+++ b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs
@@ -5,11 +5,11 @@ extern crate rustc_serialize; //~ERROR can't find crate for `rustc_serialize`
 
 #[derive(
     RustcEncodable,
-    //~^   ERROR   use of unstable library feature 'rustc_encodable_decodable'
+    //~^   ERROR   use of unstable library feature `rustc_encodable_decodable`
     //~^^  WARNING this was previously accepted by the compiler
     //~^^^ WARNING use of deprecated macro `RustcEncodable`
     RustcDecodable,
-    //~^   ERROR   use of unstable library feature 'rustc_encodable_decodable'
+    //~^   ERROR   use of unstable library feature `rustc_encodable_decodable`
     //~^^  WARNING this was previously accepted by the compiler
     //~^^^ WARNING use of deprecated macro `RustcDecodable`
 )]
diff --git a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr
index 02b74dacf4d..b949dbb9da2 100644
--- a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr
+++ b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr
@@ -6,7 +6,7 @@ LL | extern crate rustc_serialize;
    |
    = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`
 
-error: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code
+error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code
   --> $DIR/feature-gate-rustc_encodable_decodable.rs:7:5
    |
 LL |     RustcEncodable,
@@ -24,7 +24,7 @@ LL |     RustcEncodable,
    |
    = note: `#[warn(deprecated)]` on by default
 
-error: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code
+error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code
   --> $DIR/feature-gate-rustc_encodable_decodable.rs:11:5
    |
 LL |     RustcDecodable,
@@ -43,7 +43,7 @@ error: aborting due to 3 previous errors; 2 warnings emitted
 
 For more information about this error, try `rustc --explain E0463`.
 Future incompatibility report: Future breakage diagnostic:
-error: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code
+error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code
   --> $DIR/feature-gate-rustc_encodable_decodable.rs:7:5
    |
 LL |     RustcEncodable,
@@ -54,7 +54,7 @@ LL |     RustcEncodable,
    = note: `#[deny(soft_unstable)]` on by default
 
 Future breakage diagnostic:
-error: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code
+error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code
   --> $DIR/feature-gate-rustc_encodable_decodable.rs:11:5
    |
 LL |     RustcDecodable,
diff --git a/tests/ui/feature-gates/feature-gate-trace_macros.stderr b/tests/ui/feature-gates/feature-gate-trace_macros.stderr
index 68d3f75e995..4c6cfce7d3d 100644
--- a/tests/ui/feature-gates/feature-gate-trace_macros.stderr
+++ b/tests/ui/feature-gates/feature-gate-trace_macros.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change
   --> $DIR/feature-gate-trace_macros.rs:2:5
    |
 LL |     trace_macros!(true);
diff --git a/tests/ui/feature-gates/feature-gate-type_ascription.rs b/tests/ui/feature-gates/feature-gate-type_ascription.rs
index 5c3f0e37df6..ef3923b6ff2 100644
--- a/tests/ui/feature-gates/feature-gate-type_ascription.rs
+++ b/tests/ui/feature-gates/feature-gate-type_ascription.rs
@@ -1,5 +1,5 @@
 // Type ascription is unstable
 
 fn main() {
-    let a = type_ascribe!(10, u8); //~ ERROR use of unstable library feature 'type_ascription': placeholder syntax for type ascription
+    let a = type_ascribe!(10, u8); //~ ERROR use of unstable library feature `type_ascription`: placeholder syntax for type ascription
 }
diff --git a/tests/ui/feature-gates/feature-gate-type_ascription.stderr b/tests/ui/feature-gates/feature-gate-type_ascription.stderr
index 88da58d07e1..f59e6435c8e 100644
--- a/tests/ui/feature-gates/feature-gate-type_ascription.stderr
+++ b/tests/ui/feature-gates/feature-gate-type_ascription.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'type_ascription': placeholder syntax for type ascription
+error[E0658]: use of unstable library feature `type_ascription`: placeholder syntax for type ascription
   --> $DIR/feature-gate-type_ascription.rs:4:13
    |
 LL |     let a = type_ascribe!(10, u8);
diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs
index 42f7c5f0fba..bc5b48741b0 100644
--- a/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs
+++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs
@@ -1,9 +1,9 @@
 #![allow(dead_code)]
 
 fn foo<F: Fn()>(mut f: F) {
-    f.call(()); //~ ERROR use of unstable library feature 'fn_traits'
-    f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits'
-    f.call_once(()); //~ ERROR use of unstable library feature 'fn_traits'
+    f.call(()); //~ ERROR use of unstable library feature `fn_traits`
+    f.call_mut(()); //~ ERROR use of unstable library feature `fn_traits`
+    f.call_once(()); //~ ERROR use of unstable library feature `fn_traits`
 }
 
 fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr
index 0ef732d391b..6a5f0c8e6a6 100644
--- a/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr
+++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'fn_traits'
+error[E0658]: use of unstable library feature `fn_traits`
   --> $DIR/feature-gate-unboxed-closures-method-calls.rs:4:7
    |
 LL |     f.call(());
@@ -8,7 +8,7 @@ LL |     f.call(());
    = help: add `#![feature(fn_traits)]` 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]: use of unstable library feature 'fn_traits'
+error[E0658]: use of unstable library feature `fn_traits`
   --> $DIR/feature-gate-unboxed-closures-method-calls.rs:5:7
    |
 LL |     f.call_mut(());
@@ -18,7 +18,7 @@ LL |     f.call_mut(());
    = help: add `#![feature(fn_traits)]` 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]: use of unstable library feature 'fn_traits'
+error[E0658]: use of unstable library feature `fn_traits`
   --> $DIR/feature-gate-unboxed-closures-method-calls.rs:6:7
    |
 LL |     f.call_once(());
diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs
index 25c90492eb8..137e7d71e91 100644
--- a/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs
+++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs
@@ -1,9 +1,9 @@
 #![allow(dead_code)]
 
 fn foo<F: Fn()>(mut f: F) {
-    Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits'
-    FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature 'fn_traits'
-    FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature 'fn_traits'
+    Fn::call(&f, ()); //~ ERROR use of unstable library feature `fn_traits`
+    FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature `fn_traits`
+    FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature `fn_traits`
 }
 
 fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr
index f4d75fc6a86..90695fa4c46 100644
--- a/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr
+++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'fn_traits'
+error[E0658]: use of unstable library feature `fn_traits`
   --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:4:5
    |
 LL |     Fn::call(&f, ());
@@ -8,7 +8,7 @@ LL |     Fn::call(&f, ());
    = help: add `#![feature(fn_traits)]` 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]: use of unstable library feature 'fn_traits'
+error[E0658]: use of unstable library feature `fn_traits`
   --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:5:5
    |
 LL |     FnMut::call_mut(&mut f, ());
@@ -18,7 +18,7 @@ LL |     FnMut::call_mut(&mut f, ());
    = help: add `#![feature(fn_traits)]` 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]: use of unstable library feature 'fn_traits'
+error[E0658]: use of unstable library feature `fn_traits`
   --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:6:5
    |
 LL |     FnOnce::call_once(f, ());
diff --git a/tests/ui/feature-gates/issue-49983-see-issue-0.stderr b/tests/ui/feature-gates/issue-49983-see-issue-0.stderr
index 8f090c9eef9..29a2845852e 100644
--- a/tests/ui/feature-gates/issue-49983-see-issue-0.stderr
+++ b/tests/ui/feature-gates/issue-49983-see-issue-0.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'ptr_internals': use `NonNull` instead and consider `PhantomData<T>` (if you also use `#[may_dangle]`), `Send`, and/or `Sync`
+error[E0658]: use of unstable library feature `ptr_internals`: use `NonNull` instead and consider `PhantomData<T>` (if you also use `#[may_dangle]`), `Send`, and/or `Sync`
   --> $DIR/issue-49983-see-issue-0.rs:4:30
    |
 LL | #[allow(unused_imports)] use core::ptr::Unique;
diff --git a/tests/ui/feature-gates/rustc-private.rs b/tests/ui/feature-gates/rustc-private.rs
index aa44f790c8a..2605f595b6c 100644
--- a/tests/ui/feature-gates/rustc-private.rs
+++ b/tests/ui/feature-gates/rustc-private.rs
@@ -1,5 +1,5 @@
 // gate-test-rustc_private
 
-extern crate cfg_if; //~ ERROR  use of unstable library feature 'rustc_private'
+extern crate cfg_if; //~ ERROR  use of unstable library feature `rustc_private`
 
 fn main() {}
diff --git a/tests/ui/feature-gates/rustc-private.stderr b/tests/ui/feature-gates/rustc-private.stderr
index 96cc98619fd..74594c712f2 100644
--- a/tests/ui/feature-gates/rustc-private.stderr
+++ b/tests/ui/feature-gates/rustc-private.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
+error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
   --> $DIR/rustc-private.rs:3:1
    |
 LL | extern crate cfg_if;
diff --git a/tests/ui/feature-gates/trace_macros-gate.stderr b/tests/ui/feature-gates/trace_macros-gate.stderr
index 1313a0e8ae2..6ca9d1573d9 100644
--- a/tests/ui/feature-gates/trace_macros-gate.stderr
+++ b/tests/ui/feature-gates/trace_macros-gate.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change
   --> $DIR/trace_macros-gate.rs:4:5
    |
 LL |     trace_macros!();
@@ -14,7 +14,7 @@ error: trace_macros! accepts only `true` or `false`
 LL |     trace_macros!();
    |     ^^^^^^^^^^^^^^^
 
-error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change
   --> $DIR/trace_macros-gate.rs:6:5
    |
 LL |     trace_macros!(true);
@@ -24,7 +24,7 @@ LL |     trace_macros!(true);
    = help: add `#![feature(trace_macros)]` 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]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change
   --> $DIR/trace_macros-gate.rs:7:5
    |
 LL |     trace_macros!(false);
@@ -34,7 +34,7 @@ LL |     trace_macros!(false);
    = help: add `#![feature(trace_macros)]` 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]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change
+error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change
   --> $DIR/trace_macros-gate.rs:10:26
    |
 LL |         ($x: ident) => { trace_macros!($x) }
diff --git a/tests/ui/imports/issue-37887.stderr b/tests/ui/imports/issue-37887.stderr
index 02c2c803262..cc191a17c29 100644
--- a/tests/ui/imports/issue-37887.stderr
+++ b/tests/ui/imports/issue-37887.stderr
@@ -9,7 +9,7 @@ help: consider importing the `test` crate
 LL + extern crate test;
    |
 
-error[E0658]: use of unstable library feature 'test'
+error[E0658]: use of unstable library feature `test`
   --> $DIR/issue-37887.rs:2:5
    |
 LL |     extern crate test;
diff --git a/tests/ui/imports/resolve-other-libc.rs b/tests/ui/imports/resolve-other-libc.rs
index d848f8260aa..e23083276ce 100644
--- a/tests/ui/imports/resolve-other-libc.rs
+++ b/tests/ui/imports/resolve-other-libc.rs
@@ -6,7 +6,7 @@
 // indicates that `libc` was wrongly resolved to `libc` shipped with the
 // compiler:
 //
-//   error[E0658]: use of unstable library feature 'rustc_private': \
+//   error[E0658]: use of unstable library feature `rustc_private`: \
 //           this crate is being loaded from the sysroot
 //
 extern crate libc; //~ ERROR: extern location for libc does not exist: test.rlib
diff --git a/tests/ui/inference/inference_unstable_forced.stderr b/tests/ui/inference/inference_unstable_forced.stderr
index 26eaddd2707..e3b5b292cd4 100644
--- a/tests/ui/inference/inference_unstable_forced.stderr
+++ b/tests/ui/inference/inference_unstable_forced.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'ipu_flatten'
+error[E0658]: use of unstable library feature `ipu_flatten`
   --> $DIR/inference_unstable_forced.rs:11:20
    |
 LL |     assert_eq!('x'.ipu_flatten(), 0);
diff --git a/tests/ui/internal/internal-unstable-noallow.rs b/tests/ui/internal/internal-unstable-noallow.rs
index 9d925c86122..57ddb93d880 100644
--- a/tests/ui/internal/internal-unstable-noallow.rs
+++ b/tests/ui/internal/internal-unstable-noallow.rs
@@ -4,10 +4,10 @@
 // the // ~ form.
 
 //@ aux-build:internal_unstable.rs
-//@ error-pattern:use of unstable library feature 'function'
-//@ error-pattern:use of unstable library feature 'struct_field'
-//@ error-pattern:use of unstable library feature 'method'
-//@ error-pattern:use of unstable library feature 'struct2_field'
+//@ error-pattern:use of unstable library feature `function`
+//@ error-pattern:use of unstable library feature `struct_field`
+//@ error-pattern:use of unstable library feature `method`
+//@ error-pattern:use of unstable library feature `struct2_field`
 
 #[macro_use]
 extern crate internal_unstable;
diff --git a/tests/ui/internal/internal-unstable-noallow.stderr b/tests/ui/internal/internal-unstable-noallow.stderr
index b39456b1cae..22f42abbd11 100644
--- a/tests/ui/internal/internal-unstable-noallow.stderr
+++ b/tests/ui/internal/internal-unstable-noallow.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'function'
+error[E0658]: use of unstable library feature `function`
   --> $DIR/internal-unstable-noallow.rs:16:5
    |
 LL |     call_unstable_noallow!();
@@ -8,7 +8,7 @@ LL |     call_unstable_noallow!();
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: this error originates in the macro `call_unstable_noallow` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0658]: use of unstable library feature 'struct_field'
+error[E0658]: use of unstable library feature `struct_field`
   --> $DIR/internal-unstable-noallow.rs:18:5
    |
 LL |     construct_unstable_noallow!(0);
@@ -18,7 +18,7 @@ LL |     construct_unstable_noallow!(0);
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: this error originates in the macro `construct_unstable_noallow` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0658]: use of unstable library feature 'method'
+error[E0658]: use of unstable library feature `method`
   --> $DIR/internal-unstable-noallow.rs:20:35
    |
 LL |     |x: internal_unstable::Foo| { call_method_noallow!(x) };
@@ -28,7 +28,7 @@ LL |     |x: internal_unstable::Foo| { call_method_noallow!(x) };
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: this error originates in the macro `call_method_noallow` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0658]: use of unstable library feature 'struct2_field'
+error[E0658]: use of unstable library feature `struct2_field`
   --> $DIR/internal-unstable-noallow.rs:22:35
    |
 LL |     |x: internal_unstable::Bar| { access_field_noallow!(x) };
diff --git a/tests/ui/internal/internal-unstable-thread-local.stderr b/tests/ui/internal/internal-unstable-thread-local.stderr
index 58c7b3f67eb..c0510b39e50 100644
--- a/tests/ui/internal/internal-unstable-thread-local.stderr
+++ b/tests/ui/internal/internal-unstable-thread-local.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'function'
+error[E0658]: use of unstable library feature `function`
   --> $DIR/internal-unstable-thread-local.rs:9:32
    |
 LL | thread_local!(static BAR: () = internal_unstable::unstable());
diff --git a/tests/ui/internal/internal-unstable.stderr b/tests/ui/internal/internal-unstable.stderr
index 78b9109d1c2..ea74175f09b 100644
--- a/tests/ui/internal/internal-unstable.stderr
+++ b/tests/ui/internal/internal-unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'function'
+error[E0658]: use of unstable library feature `function`
   --> $DIR/internal-unstable.rs:48:25
    |
 LL |     pass_through_allow!(internal_unstable::unstable());
@@ -7,7 +7,7 @@ LL |     pass_through_allow!(internal_unstable::unstable());
    = help: add `#![feature(function)]` 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]: use of unstable library feature 'function'
+error[E0658]: use of unstable library feature `function`
   --> $DIR/internal-unstable.rs:50:27
    |
 LL |     pass_through_noallow!(internal_unstable::unstable());
@@ -16,7 +16,7 @@ LL |     pass_through_noallow!(internal_unstable::unstable());
    = help: add `#![feature(function)]` 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]: use of unstable library feature 'function'
+error[E0658]: use of unstable library feature `function`
   --> $DIR/internal-unstable.rs:54:22
    |
 LL |     println!("{:?}", internal_unstable::unstable());
@@ -25,7 +25,7 @@ LL |     println!("{:?}", internal_unstable::unstable());
    = help: add `#![feature(function)]` 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]: use of unstable library feature 'function'
+error[E0658]: use of unstable library feature `function`
   --> $DIR/internal-unstable.rs:56:10
    |
 LL |     bar!(internal_unstable::unstable());
@@ -34,7 +34,7 @@ LL |     bar!(internal_unstable::unstable());
    = help: add `#![feature(function)]` 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]: use of unstable library feature 'function'
+error[E0658]: use of unstable library feature `function`
   --> $DIR/internal-unstable.rs:18:9
    |
 LL |         internal_unstable::unstable();
diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs
index 99f98c3f27a..76b6a8c8395 100644
--- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs
+++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs
@@ -1,5 +1,4 @@
 #![feature(core_intrinsics)]
-#![feature(const_intrinsic_raw_eq)]
 
 const RAW_EQ_PADDING: bool = unsafe {
     std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16))
diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
index bedfc8283ea..b8fdfe7bef3 100644
--- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
+++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
@@ -1,11 +1,11 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/intrinsic-raw_eq-const-bad.rs:5:5
+  --> $DIR/intrinsic-raw_eq-const-bad.rs:4:5
    |
 LL |     std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16))
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC0[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/intrinsic-raw_eq-const-bad.rs:11:5
+  --> $DIR/intrinsic-raw_eq-const-bad.rs:10:5
    |
 LL |     std::intrinsics::raw_eq(&(&0), &(&1))
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
@@ -14,7 +14,7 @@ LL |     std::intrinsics::raw_eq(&(&0), &(&1))
    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/intrinsic-raw_eq-const-bad.rs:19:5
+  --> $DIR/intrinsic-raw_eq-const-bad.rs:18:5
    |
 LL |     std::intrinsics::raw_eq(aref, aref)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment 1, but alignment 4 is required
diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const.rs
index 47b4e20dfbb..b37def85bb7 100644
--- a/tests/ui/intrinsics/intrinsic-raw_eq-const.rs
+++ b/tests/ui/intrinsics/intrinsic-raw_eq-const.rs
@@ -1,7 +1,6 @@
 //@ run-pass
 
 #![feature(core_intrinsics)]
-#![feature(const_intrinsic_raw_eq)]
 
 pub fn main() {
     use std::intrinsics::raw_eq;
diff --git a/tests/ui/intrinsics/reify-intrinsic.stderr b/tests/ui/intrinsics/reify-intrinsic.stderr
index 21b7bf4e1cb..7af17147f28 100644
--- a/tests/ui/intrinsics/reify-intrinsic.stderr
+++ b/tests/ui/intrinsics/reify-intrinsic.stderr
@@ -7,9 +7,9 @@ LL |     let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::tr
    |            expected due to this
    |
    = note: expected fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize`
-                 found fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
+                 found fn item `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
 
-error[E0606]: casting `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid
+error[E0606]: casting `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid
   --> $DIR/reify-intrinsic.rs:11:13
    |
 LL |     let _ = std::mem::transmute as unsafe extern "rust-intrinsic" fn(isize) -> usize;
diff --git a/tests/ui/intrinsics/unchecked_math_unstable.stderr b/tests/ui/intrinsics/unchecked_math_unstable.stderr
index c2a116b6200..b284567f8af 100644
--- a/tests/ui/intrinsics/unchecked_math_unstable.stderr
+++ b/tests/ui/intrinsics/unchecked_math_unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
+error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
   --> $DIR/unchecked_math_unstable.rs:4:19
    |
 LL |         let add = std::intrinsics::unchecked_add(x, y);
@@ -7,7 +7,7 @@ LL |         let add = std::intrinsics::unchecked_add(x, y);
    = help: add `#![feature(core_intrinsics)]` 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]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
+error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
   --> $DIR/unchecked_math_unstable.rs:5:19
    |
 LL |         let sub = std::intrinsics::unchecked_sub(x, y);
@@ -16,7 +16,7 @@ LL |         let sub = std::intrinsics::unchecked_sub(x, y);
    = help: add `#![feature(core_intrinsics)]` 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]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
+error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
   --> $DIR/unchecked_math_unstable.rs:6:19
    |
 LL |         let mul = std::intrinsics::unchecked_mul(x, y);
diff --git a/tests/ui/issues/issue-52489.rs b/tests/ui/issues/issue-52489.rs
index 95a3d43105c..c1e1cb41c76 100644
--- a/tests/ui/issues/issue-52489.rs
+++ b/tests/ui/issues/issue-52489.rs
@@ -3,6 +3,6 @@
 //@ compile-flags:--extern issue_52489
 
 use issue_52489;
-//~^ ERROR use of unstable library feature 'issue_52489_unstable'
+//~^ ERROR use of unstable library feature `issue_52489_unstable`
 
 fn main() {}
diff --git a/tests/ui/issues/issue-52489.stderr b/tests/ui/issues/issue-52489.stderr
index fa88725bceb..8e5b87b7f0f 100644
--- a/tests/ui/issues/issue-52489.stderr
+++ b/tests/ui/issues/issue-52489.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'issue_52489_unstable'
+error[E0658]: use of unstable library feature `issue_52489_unstable`
   --> $DIR/issue-52489.rs:5:5
    |
 LL | use issue_52489;
diff --git a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr
index cceaddf7803..206a6801065 100644
--- a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr
+++ b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr
@@ -71,6 +71,10 @@ LL |     cachedcoso.call_once(1);
    |
 note: required by a bound in `call_once`
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+help: use a unary tuple instead
+   |
+LL |     cachedcoso.call_once((1,));
+   |                          + ++
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/layout/thaw-transmute-invalid-enum.rs b/tests/ui/layout/thaw-transmute-invalid-enum.rs
index 835dcc04996..a7c2e1a86de 100644
--- a/tests/ui/layout/thaw-transmute-invalid-enum.rs
+++ b/tests/ui/layout/thaw-transmute-invalid-enum.rs
@@ -2,13 +2,13 @@
 
 mod assert {
     use std::mem::{Assume, TransmuteFrom};
-    //~^ ERROR: use of unstable library feature 'transmutability'
-    //~| ERROR: use of unstable library feature 'transmutability'
+    //~^ ERROR: use of unstable library feature `transmutability`
+    //~| ERROR: use of unstable library feature `transmutability`
 
     pub fn is_transmutable<Src, Dst>()
     where
         Dst: TransmuteFrom<Src>,
-        //~^ ERROR: use of unstable library feature 'transmutability'
+        //~^ ERROR: use of unstable library feature `transmutability`
     {
     }
 }
diff --git a/tests/ui/layout/thaw-transmute-invalid-enum.stderr b/tests/ui/layout/thaw-transmute-invalid-enum.stderr
index e6a5399c66b..d12fc4694e0 100644
--- a/tests/ui/layout/thaw-transmute-invalid-enum.stderr
+++ b/tests/ui/layout/thaw-transmute-invalid-enum.stderr
@@ -20,7 +20,7 @@ LL | |     V = 0xFF,
 LL | | }
    | |_- not a struct or union
 
-error[E0658]: use of unstable library feature 'transmutability'
+error[E0658]: use of unstable library feature `transmutability`
   --> $DIR/thaw-transmute-invalid-enum.rs:4:20
    |
 LL |     use std::mem::{Assume, TransmuteFrom};
@@ -30,7 +30,7 @@ LL |     use std::mem::{Assume, TransmuteFrom};
    = help: add `#![feature(transmutability)]` 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]: use of unstable library feature 'transmutability'
+error[E0658]: use of unstable library feature `transmutability`
   --> $DIR/thaw-transmute-invalid-enum.rs:4:28
    |
 LL |     use std::mem::{Assume, TransmuteFrom};
@@ -40,7 +40,7 @@ LL |     use std::mem::{Assume, TransmuteFrom};
    = help: add `#![feature(transmutability)]` 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]: use of unstable library feature 'transmutability'
+error[E0658]: use of unstable library feature `transmutability`
   --> $DIR/thaw-transmute-invalid-enum.rs:10:14
    |
 LL |         Dst: TransmuteFrom<Src>,
diff --git a/tests/ui/lint/expansion-time.rs b/tests/ui/lint/expansion-time.rs
index 1e1f8f9e1b6..d0f26a87385 100644
--- a/tests/ui/lint/expansion-time.rs
+++ b/tests/ui/lint/expansion-time.rs
@@ -11,7 +11,7 @@ macro_rules! m { ($i) => {} } //~ WARN missing fragment specifier
 
 #[warn(soft_unstable)]
 mod benches {
-    #[bench] //~ WARN use of unstable library feature 'test'
+    #[bench] //~ WARN use of unstable library feature `test`
              //~| WARN this was previously accepted
     fn foo() {}
 }
diff --git a/tests/ui/lint/expansion-time.stderr b/tests/ui/lint/expansion-time.stderr
index e490ae91a48..f65627c2c08 100644
--- a/tests/ui/lint/expansion-time.stderr
+++ b/tests/ui/lint/expansion-time.stderr
@@ -26,7 +26,7 @@ note: the lint level is defined here
 LL | #[warn(missing_fragment_specifier)]
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
+warning: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
   --> $DIR/expansion-time.rs:14:7
    |
 LL |     #[bench]
@@ -70,7 +70,7 @@ LL | #[warn(missing_fragment_specifier)]
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Future breakage diagnostic:
-warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
+warning: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable
   --> $DIR/expansion-time.rs:14:7
    |
 LL |     #[bench]
diff --git a/tests/ui/lint/lint-output-format.stderr b/tests/ui/lint/lint-output-format.stderr
index c399b6cdbc2..23a36eb4c87 100644
--- a/tests/ui/lint/lint-output-format.stderr
+++ b/tests/ui/lint/lint-output-format.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-output-format.rs:6:1
    |
 LL | extern crate lint_output_format;
@@ -7,7 +7,7 @@ LL | extern crate lint_output_format;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-output-format.rs:7:26
    |
 LL | use lint_output_format::{foo, bar};
@@ -16,7 +16,7 @@ LL | use lint_output_format::{foo, bar};
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-output-format.rs:7:31
    |
 LL | use lint_output_format::{foo, bar};
@@ -25,7 +25,7 @@ LL | use lint_output_format::{foo, bar};
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-output-format.rs:12:14
    |
 LL |     let _y = bar();
diff --git a/tests/ui/lint/lint-stability-2.rs b/tests/ui/lint/lint-stability-2.rs
index 644b12670a6..50e84a6f4a7 100644
--- a/tests/ui/lint/lint-stability-2.rs
+++ b/tests/ui/lint/lint-stability-2.rs
@@ -66,15 +66,15 @@ mod cross_crate {
         <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
 
         foo.method_unstable_text();
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         Foo::method_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         <Foo>::method_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         foo.trait_unstable_text();
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         <Foo>::trait_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
 
         stable();
         foo.method_stable();
@@ -139,9 +139,9 @@ mod cross_crate {
         foo.trait_unstable(); //~ ERROR use of unstable library feature
         <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
         foo.trait_unstable_text();
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         <Foo>::trait_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         foo.trait_stable();
         Trait::trait_stable(&foo);
         <Foo>::trait_stable(&foo);
@@ -157,7 +157,7 @@ mod cross_crate {
         //~^ ERROR use of unstable library feature
         foo.trait_unstable(); //~ ERROR use of unstable library feature
         foo.trait_unstable_text();
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         foo.trait_stable();
     }
 
diff --git a/tests/ui/lint/lint-stability-2.stderr b/tests/ui/lint/lint-stability-2.stderr
index 20d49780a91..b3357bfe232 100644
--- a/tests/ui/lint/lint-stability-2.stderr
+++ b/tests/ui/lint/lint-stability-2.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:40:13
    |
 LL |         foo.method_deprecated_unstable();
@@ -7,7 +7,7 @@ LL |         foo.method_deprecated_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:42:9
    |
 LL |         Foo::method_deprecated_unstable(&foo);
@@ -16,7 +16,7 @@ LL |         Foo::method_deprecated_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:44:9
    |
 LL |         <Foo>::method_deprecated_unstable(&foo);
@@ -25,7 +25,7 @@ LL |         <Foo>::method_deprecated_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:46:13
    |
 LL |         foo.trait_deprecated_unstable();
@@ -34,7 +34,7 @@ LL |         foo.trait_deprecated_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:48:9
    |
 LL |         <Foo>::trait_deprecated_unstable(&foo);
@@ -43,7 +43,7 @@ LL |         <Foo>::trait_deprecated_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:51:13
    |
 LL |         foo.method_deprecated_unstable_text();
@@ -52,7 +52,7 @@ LL |         foo.method_deprecated_unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:53:9
    |
 LL |         Foo::method_deprecated_unstable_text(&foo);
@@ -61,7 +61,7 @@ LL |         Foo::method_deprecated_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:55:9
    |
 LL |         <Foo>::method_deprecated_unstable_text(&foo);
@@ -70,7 +70,7 @@ LL |         <Foo>::method_deprecated_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:57:13
    |
 LL |         foo.trait_deprecated_unstable_text();
@@ -79,7 +79,7 @@ LL |         foo.trait_deprecated_unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:59:9
    |
 LL |         <Foo>::trait_deprecated_unstable_text(&foo);
@@ -88,7 +88,7 @@ LL |         <Foo>::trait_deprecated_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:62:13
    |
 LL |         foo.method_unstable();
@@ -97,7 +97,7 @@ LL |         foo.method_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:63:9
    |
 LL |         Foo::method_unstable(&foo);
@@ -106,7 +106,7 @@ LL |         Foo::method_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:64:9
    |
 LL |         <Foo>::method_unstable(&foo);
@@ -115,7 +115,7 @@ LL |         <Foo>::method_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:65:13
    |
 LL |         foo.trait_unstable();
@@ -124,7 +124,7 @@ LL |         foo.trait_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:66:9
    |
 LL |         <Foo>::trait_unstable(&foo);
@@ -133,7 +133,7 @@ LL |         <Foo>::trait_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability-2.rs:68:13
    |
 LL |         foo.method_unstable_text();
@@ -142,7 +142,7 @@ LL |         foo.method_unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability-2.rs:70:9
    |
 LL |         Foo::method_unstable_text(&foo);
@@ -151,7 +151,7 @@ LL |         Foo::method_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability-2.rs:72:9
    |
 LL |         <Foo>::method_unstable_text(&foo);
@@ -160,7 +160,7 @@ LL |         <Foo>::method_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability-2.rs:74:13
    |
 LL |         foo.trait_unstable_text();
@@ -169,7 +169,7 @@ LL |         foo.trait_unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability-2.rs:76:9
    |
 LL |         <Foo>::trait_unstable_text(&foo);
@@ -178,7 +178,7 @@ LL |         <Foo>::trait_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:131:13
    |
 LL |         foo.trait_deprecated_unstable();
@@ -187,7 +187,7 @@ LL |         foo.trait_deprecated_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:133:9
    |
 LL |         <Foo>::trait_deprecated_unstable(&foo);
@@ -196,7 +196,7 @@ LL |         <Foo>::trait_deprecated_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:135:13
    |
 LL |         foo.trait_deprecated_unstable_text();
@@ -205,7 +205,7 @@ LL |         foo.trait_deprecated_unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:137:9
    |
 LL |         <Foo>::trait_deprecated_unstable_text(&foo);
@@ -214,7 +214,7 @@ LL |         <Foo>::trait_deprecated_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:139:13
    |
 LL |         foo.trait_unstable();
@@ -223,7 +223,7 @@ LL |         foo.trait_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:140:9
    |
 LL |         <Foo>::trait_unstable(&foo);
@@ -232,7 +232,7 @@ LL |         <Foo>::trait_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability-2.rs:141:13
    |
 LL |         foo.trait_unstable_text();
@@ -241,7 +241,7 @@ LL |         foo.trait_unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability-2.rs:143:9
    |
 LL |         <Foo>::trait_unstable_text(&foo);
@@ -250,7 +250,7 @@ LL |         <Foo>::trait_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:154:13
    |
 LL |         foo.trait_deprecated_unstable();
@@ -259,7 +259,7 @@ LL |         foo.trait_deprecated_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:156:13
    |
 LL |         foo.trait_deprecated_unstable_text();
@@ -268,7 +268,7 @@ LL |         foo.trait_deprecated_unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-2.rs:158:13
    |
 LL |         foo.trait_unstable();
@@ -277,7 +277,7 @@ LL |         foo.trait_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability-2.rs:159:13
    |
 LL |         foo.trait_unstable_text();
diff --git a/tests/ui/lint/lint-stability-fields.stderr b/tests/ui/lint/lint-stability-fields.stderr
index 9dffe94c12e..9cd3753cc3b 100644
--- a/tests/ui/lint/lint-stability-fields.stderr
+++ b/tests/ui/lint/lint-stability-fields.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:56:17
    |
 LL |         let x = Unstable {
@@ -7,7 +7,7 @@ LL |         let x = Unstable {
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:66:13
    |
 LL |         let Unstable {
@@ -16,7 +16,7 @@ LL |         let Unstable {
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:72:13
    |
 LL |         let Unstable
@@ -25,7 +25,7 @@ LL |         let Unstable
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:77:17
    |
 LL |         let x = reexport::Unstable2(1, 2, 3);
@@ -34,7 +34,7 @@ LL |         let x = reexport::Unstable2(1, 2, 3);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:79:17
    |
 LL |         let x = Unstable2(1, 2, 3);
@@ -43,7 +43,7 @@ LL |         let x = Unstable2(1, 2, 3);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:85:13
    |
 LL |         let Unstable2
@@ -52,7 +52,7 @@ LL |         let Unstable2
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:90:13
    |
 LL |         let Unstable2
@@ -61,7 +61,7 @@ LL |         let Unstable2
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:95:17
    |
 LL |         let x = Deprecated {
@@ -70,7 +70,7 @@ LL |         let x = Deprecated {
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:105:13
    |
 LL |         let Deprecated {
@@ -79,7 +79,7 @@ LL |         let Deprecated {
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:111:13
    |
 LL |         let Deprecated
@@ -88,7 +88,7 @@ LL |         let Deprecated
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:115:17
    |
 LL |         let x = Deprecated2(1, 2, 3);
@@ -97,7 +97,7 @@ LL |         let x = Deprecated2(1, 2, 3);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:121:13
    |
 LL |         let Deprecated2
@@ -106,7 +106,7 @@ LL |         let Deprecated2
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:126:13
    |
 LL |         let Deprecated2
@@ -115,7 +115,7 @@ LL |         let Deprecated2
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:21:13
    |
 LL |             override1: 2,
@@ -124,7 +124,7 @@ LL |             override1: 2,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:22:13
    |
 LL |             override2: 3,
@@ -133,7 +133,7 @@ LL |             override2: 3,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:27:17
    |
 LL |         let _ = x.override1;
@@ -142,7 +142,7 @@ LL |         let _ = x.override1;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:28:17
    |
 LL |         let _ = x.override2;
@@ -151,7 +151,7 @@ LL |         let _ = x.override2;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:33:13
    |
 LL |             override1: _,
@@ -160,7 +160,7 @@ LL |             override1: _,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:34:13
    |
 LL |             override2: _,
@@ -169,7 +169,7 @@ LL |             override2: _,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:43:17
    |
 LL |         let _ = x.1;
@@ -178,7 +178,7 @@ LL |         let _ = x.1;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:44:17
    |
 LL |         let _ = x.2;
@@ -187,7 +187,7 @@ LL |         let _ = x.2;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:48:20
    |
 LL |                    _,
@@ -196,7 +196,7 @@ LL |                    _,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:49:20
    |
 LL |                    _,
@@ -205,7 +205,7 @@ LL |                    _,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:57:13
    |
 LL |             inherit: 1,
@@ -214,7 +214,7 @@ LL |             inherit: 1,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:59:13
    |
 LL |             override2: 3,
@@ -223,7 +223,7 @@ LL |             override2: 3,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:62:17
    |
 LL |         let _ = x.inherit;
@@ -232,7 +232,7 @@ LL |         let _ = x.inherit;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:64:17
    |
 LL |         let _ = x.override2;
@@ -241,7 +241,7 @@ LL |         let _ = x.override2;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:67:13
    |
 LL |             inherit: _,
@@ -250,7 +250,7 @@ LL |             inherit: _,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:69:13
    |
 LL |             override2: _
@@ -259,7 +259,7 @@ LL |             override2: _
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:81:17
    |
 LL |         let _ = x.0;
@@ -268,7 +268,7 @@ LL |         let _ = x.0;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:83:17
    |
 LL |         let _ = x.2;
@@ -277,7 +277,7 @@ LL |         let _ = x.2;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:86:14
    |
 LL |             (_,
@@ -286,7 +286,7 @@ LL |             (_,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:88:14
    |
 LL |              _)
@@ -295,7 +295,7 @@ LL |              _)
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:96:13
    |
 LL |             inherit: 1,
@@ -304,7 +304,7 @@ LL |             inherit: 1,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:98:13
    |
 LL |             override2: 3,
@@ -313,7 +313,7 @@ LL |             override2: 3,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:101:17
    |
 LL |         let _ = x.inherit;
@@ -322,7 +322,7 @@ LL |         let _ = x.inherit;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:103:17
    |
 LL |         let _ = x.override2;
@@ -331,7 +331,7 @@ LL |         let _ = x.override2;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:106:13
    |
 LL |             inherit: _,
@@ -340,7 +340,7 @@ LL |             inherit: _,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:108:13
    |
 LL |             override2: _
@@ -349,7 +349,7 @@ LL |             override2: _
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:117:17
    |
 LL |         let _ = x.0;
@@ -358,7 +358,7 @@ LL |         let _ = x.0;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:119:17
    |
 LL |         let _ = x.2;
@@ -367,7 +367,7 @@ LL |         let _ = x.2;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:122:14
    |
 LL |             (_,
@@ -376,7 +376,7 @@ LL |             (_,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability-fields.rs:124:14
    |
 LL |              _)
diff --git a/tests/ui/lint/lint-stability.rs b/tests/ui/lint/lint-stability.rs
index eaf9796df6a..f080b5e4bbe 100644
--- a/tests/ui/lint/lint-stability.rs
+++ b/tests/ui/lint/lint-stability.rs
@@ -61,11 +61,11 @@ mod cross_crate {
         <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
 
         unstable_text();
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         Trait::trait_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         <Foo as Trait>::trait_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
 
         stable();
         foo.method_stable();
@@ -152,9 +152,9 @@ mod cross_crate {
         Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature
         <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
         Trait::trait_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         <Foo as Trait>::trait_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'unstable_test_feature': text
+        //~^ ERROR use of unstable library feature `unstable_test_feature`: text
         foo.trait_stable();
         Trait::trait_stable(&foo);
         <Foo>::trait_stable(&foo);
diff --git a/tests/ui/lint/lint-stability.stderr b/tests/ui/lint/lint-stability.stderr
index af5816d4564..a22fce70a4a 100644
--- a/tests/ui/lint/lint-stability.stderr
+++ b/tests/ui/lint/lint-stability.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:17:5
    |
 LL |     extern crate stability_cfg2;
@@ -7,7 +7,7 @@ LL |     extern crate stability_cfg2;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:45:9
    |
 LL |         deprecated_unstable();
@@ -16,7 +16,7 @@ LL |         deprecated_unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:47:9
    |
 LL |         Trait::trait_deprecated_unstable(&foo);
@@ -25,7 +25,7 @@ LL |         Trait::trait_deprecated_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:49:9
    |
 LL |         <Foo as Trait>::trait_deprecated_unstable(&foo);
@@ -34,7 +34,7 @@ LL |         <Foo as Trait>::trait_deprecated_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:52:9
    |
 LL |         deprecated_unstable_text();
@@ -43,7 +43,7 @@ LL |         deprecated_unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:54:9
    |
 LL |         Trait::trait_deprecated_unstable_text(&foo);
@@ -52,7 +52,7 @@ LL |         Trait::trait_deprecated_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:56:9
    |
 LL |         <Foo as Trait>::trait_deprecated_unstable_text(&foo);
@@ -61,7 +61,7 @@ LL |         <Foo as Trait>::trait_deprecated_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:59:9
    |
 LL |         unstable();
@@ -70,7 +70,7 @@ LL |         unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:60:9
    |
 LL |         Trait::trait_unstable(&foo);
@@ -79,7 +79,7 @@ LL |         Trait::trait_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:61:9
    |
 LL |         <Foo as Trait>::trait_unstable(&foo);
@@ -88,7 +88,7 @@ LL |         <Foo as Trait>::trait_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability.rs:63:9
    |
 LL |         unstable_text();
@@ -97,7 +97,7 @@ LL |         unstable_text();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability.rs:65:9
    |
 LL |         Trait::trait_unstable_text(&foo);
@@ -106,7 +106,7 @@ LL |         Trait::trait_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability.rs:67:9
    |
 LL |         <Foo as Trait>::trait_unstable_text(&foo);
@@ -115,7 +115,7 @@ LL |         <Foo as Trait>::trait_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:99:17
    |
 LL |         let _ = DeprecatedUnstableStruct {
@@ -124,7 +124,7 @@ LL |         let _ = DeprecatedUnstableStruct {
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:103:17
    |
 LL |         let _ = UnstableStruct { i: 0 };
@@ -133,7 +133,7 @@ LL |         let _ = UnstableStruct { i: 0 };
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:107:17
    |
 LL |         let _ = DeprecatedUnstableUnitStruct;
@@ -142,7 +142,7 @@ LL |         let _ = DeprecatedUnstableUnitStruct;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:109:17
    |
 LL |         let _ = UnstableUnitStruct;
@@ -151,7 +151,7 @@ LL |         let _ = UnstableUnitStruct;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:113:17
    |
 LL |         let _ = Enum::DeprecatedUnstableVariant;
@@ -160,7 +160,7 @@ LL |         let _ = Enum::DeprecatedUnstableVariant;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:115:17
    |
 LL |         let _ = Enum::UnstableVariant;
@@ -169,7 +169,7 @@ LL |         let _ = Enum::UnstableVariant;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:119:17
    |
 LL |         let _ = DeprecatedUnstableTupleStruct (1);
@@ -178,7 +178,7 @@ LL |         let _ = DeprecatedUnstableTupleStruct (1);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:121:17
    |
 LL |         let _ = UnstableTupleStruct (1);
@@ -187,7 +187,7 @@ LL |         let _ = UnstableTupleStruct (1);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:130:25
    |
 LL |         macro_test_arg!(deprecated_unstable_text());
@@ -196,7 +196,7 @@ LL |         macro_test_arg!(deprecated_unstable_text());
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:144:9
    |
 LL |         Trait::trait_deprecated_unstable(&foo);
@@ -205,7 +205,7 @@ LL |         Trait::trait_deprecated_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:146:9
    |
 LL |         <Foo as Trait>::trait_deprecated_unstable(&foo);
@@ -214,7 +214,7 @@ LL |         <Foo as Trait>::trait_deprecated_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:148:9
    |
 LL |         Trait::trait_deprecated_unstable_text(&foo);
@@ -223,7 +223,7 @@ LL |         Trait::trait_deprecated_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:150:9
    |
 LL |         <Foo as Trait>::trait_deprecated_unstable_text(&foo);
@@ -232,7 +232,7 @@ LL |         <Foo as Trait>::trait_deprecated_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:152:9
    |
 LL |         Trait::trait_unstable(&foo);
@@ -241,7 +241,7 @@ LL |         Trait::trait_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:153:9
    |
 LL |         <Foo as Trait>::trait_unstable(&foo);
@@ -250,7 +250,7 @@ LL |         <Foo as Trait>::trait_unstable(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability.rs:154:9
    |
 LL |         Trait::trait_unstable_text(&foo);
@@ -259,7 +259,7 @@ LL |         Trait::trait_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/lint-stability.rs:156:9
    |
 LL |         <Foo as Trait>::trait_unstable_text(&foo);
@@ -268,7 +268,7 @@ LL |         <Foo as Trait>::trait_unstable_text(&foo);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:172:10
    |
 LL |     impl UnstableTrait for S { }
@@ -277,7 +277,7 @@ LL |     impl UnstableTrait for S { }
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:174:24
    |
 LL |     trait LocalTrait : UnstableTrait { }
@@ -286,7 +286,7 @@ LL |     trait LocalTrait : UnstableTrait { }
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:179:9
    |
 LL |         fn trait_unstable(&self) {}
@@ -295,7 +295,7 @@ LL |         fn trait_unstable(&self) {}
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:184:5
    |
 LL |     extern crate inherited_stability;
@@ -304,7 +304,7 @@ LL |     extern crate inherited_stability;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:185:9
    |
 LL |     use self::inherited_stability::*;
@@ -313,7 +313,7 @@ LL |     use self::inherited_stability::*;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:188:9
    |
 LL |         unstable();
@@ -322,7 +322,7 @@ LL |         unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:191:9
    |
 LL |         stable_mod::unstable();
@@ -331,7 +331,7 @@ LL |         stable_mod::unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:194:9
    |
 LL |         unstable_mod::deprecated();
@@ -340,7 +340,7 @@ LL |         unstable_mod::deprecated();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:195:9
    |
 LL |         unstable_mod::unstable();
@@ -349,7 +349,7 @@ LL |         unstable_mod::unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:197:17
    |
 LL |         let _ = Unstable::UnstableVariant;
@@ -358,7 +358,7 @@ LL |         let _ = Unstable::UnstableVariant;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:198:17
    |
 LL |         let _ = Unstable::StableVariant;
@@ -367,7 +367,7 @@ LL |         let _ = Unstable::StableVariant;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:88:48
    |
 LL |         struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
@@ -376,7 +376,7 @@ LL |         struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/lint-stability.rs:92:13
    |
 LL |             TypeUnstable = u8,
diff --git a/tests/ui/macros/macro-stability.rs b/tests/ui/macros/macro-stability.rs
index a909b14f47b..cd419d51354 100644
--- a/tests/ui/macros/macro-stability.rs
+++ b/tests/ui/macros/macro-stability.rs
@@ -19,10 +19,10 @@ macro local_unstable_modern() {}
 macro_rules! local_deprecated{ () => () }
 
 fn main() {
-    local_unstable!(); //~ ERROR use of unstable library feature 'local_unstable'
-    local_unstable_modern!(); //~ ERROR use of unstable library feature 'local_unstable'
-    unstable_macro!(); //~ ERROR use of unstable library feature 'unstable_macros'
-    // unstable_macro_modern!(); // ERROR use of unstable library feature 'unstable_macros'
+    local_unstable!(); //~ ERROR use of unstable library feature `local_unstable`
+    local_unstable_modern!(); //~ ERROR use of unstable library feature `local_unstable`
+    unstable_macro!(); //~ ERROR use of unstable library feature `unstable_macros`
+    // unstable_macro_modern!(); // ERROR use of unstable library feature `unstable_macros`
 
     deprecated_macro!();
     //~^ WARN use of deprecated macro `deprecated_macro`: deprecation note
diff --git a/tests/ui/macros/macro-stability.stderr b/tests/ui/macros/macro-stability.stderr
index 21b6cef5c9c..fd8f029b4c4 100644
--- a/tests/ui/macros/macro-stability.stderr
+++ b/tests/ui/macros/macro-stability.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'local_unstable'
+error[E0658]: use of unstable library feature `local_unstable`
   --> $DIR/macro-stability.rs:22:5
    |
 LL |     local_unstable!();
@@ -7,7 +7,7 @@ LL |     local_unstable!();
    = help: add `#![feature(local_unstable)]` 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]: use of unstable library feature 'local_unstable'
+error[E0658]: use of unstable library feature `local_unstable`
   --> $DIR/macro-stability.rs:23:5
    |
 LL |     local_unstable_modern!();
@@ -16,7 +16,7 @@ LL |     local_unstable_modern!();
    = help: add `#![feature(local_unstable)]` 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]: use of unstable library feature 'unstable_macros'
+error[E0658]: use of unstable library feature `unstable_macros`
   --> $DIR/macro-stability.rs:24:5
    |
 LL |     unstable_macro!();
diff --git a/tests/ui/offset-of/offset-of-unstable.stderr b/tests/ui/offset-of/offset-of-unstable.stderr
index 44ccad3ff39..d249e1b176d 100644
--- a/tests/ui/offset-of/offset-of-unstable.stderr
+++ b/tests/ui/offset-of/offset-of-unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/offset-of-unstable.rs:12:9
    |
 LL |         Unstable,
@@ -7,7 +7,7 @@ LL |         Unstable,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/offset-of-unstable.rs:21:9
    |
 LL |         UnstableWithStableFieldType,
@@ -16,7 +16,7 @@ LL |         UnstableWithStableFieldType,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/offset-of-unstable.rs:26:9
    |
 LL |         UnstableWithStableFieldType,
@@ -25,7 +25,7 @@ LL |         UnstableWithStableFieldType,
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/offset-of-unstable.rs:10:5
    |
 LL | /     offset_of!(
@@ -39,7 +39,7 @@ LL | |     );
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/offset-of-unstable.rs:16:5
    |
 LL |     offset_of!(StableWithUnstableField, unstable);
@@ -49,7 +49,7 @@ LL |     offset_of!(StableWithUnstableField, unstable);
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/offset-of-unstable.rs:18:5
    |
 LL |     offset_of!(StableWithUnstableFieldType, stable.unstable);
@@ -59,7 +59,7 @@ LL |     offset_of!(StableWithUnstableFieldType, stable.unstable);
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/offset-of-unstable.rs:19:5
    |
 LL | /     offset_of!(
@@ -73,7 +73,7 @@ LL | |     );
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/offset-of-unstable.rs:24:5
    |
 LL | /     offset_of!(
diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap.rs b/tests/ui/on-unimplemented/suggest_tuple_wrap.rs
new file mode 100644
index 00000000000..010a47aef62
--- /dev/null
+++ b/tests/ui/on-unimplemented/suggest_tuple_wrap.rs
@@ -0,0 +1,19 @@
+pub trait Argument {}
+impl Argument for u8 {}
+impl Argument for i8 {}
+impl Argument for String {}
+impl Argument for &str {}
+
+pub trait TupleArgs {}
+impl<A: Argument> TupleArgs for (A,) {}
+impl<A: Argument, B: Argument> TupleArgs for (A, B) {}
+impl<A: Argument, B: Argument, C: Argument> TupleArgs for (A, B, C) {}
+
+fn convert_into_tuple(_x: impl TupleArgs) {}
+
+fn main() {
+    convert_into_tuple(42_u8);
+    //~^ ERROR E0277
+    //~| HELP the following other types implement trait `TupleArgs`
+    //~| HELP use a unary tuple instead
+}
diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap.stderr b/tests/ui/on-unimplemented/suggest_tuple_wrap.stderr
new file mode 100644
index 00000000000..93dd43aafd9
--- /dev/null
+++ b/tests/ui/on-unimplemented/suggest_tuple_wrap.stderr
@@ -0,0 +1,25 @@
+error[E0277]: the trait bound `u8: TupleArgs` is not satisfied
+  --> $DIR/suggest_tuple_wrap.rs:15:24
+   |
+LL |     convert_into_tuple(42_u8);
+   |     ------------------ ^^^^^ the trait `TupleArgs` is not implemented for `u8`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the following other types implement trait `TupleArgs`:
+             (A, B)
+             (A, B, C)
+             (A,)
+note: required by a bound in `convert_into_tuple`
+  --> $DIR/suggest_tuple_wrap.rs:12:32
+   |
+LL | fn convert_into_tuple(_x: impl TupleArgs) {}
+   |                                ^^^^^^^^^ required by this bound in `convert_into_tuple`
+help: use a unary tuple instead
+   |
+LL |     convert_into_tuple((42_u8,));
+   |                        +     ++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs
new file mode 100644
index 00000000000..e0036d30187
--- /dev/null
+++ b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs
@@ -0,0 +1,26 @@
+struct Tuple;
+
+impl From<(u8,)> for Tuple {
+    fn from(_: (u8,)) -> Self {
+        todo!()
+    }
+}
+impl From<(u8, u8)> for Tuple {
+    fn from(_: (u8, u8)) -> Self {
+        todo!()
+    }
+}
+impl From<(u8, u8, u8)> for Tuple {
+    fn from(_: (u8, u8, u8)) -> Self {
+        todo!()
+    }
+}
+
+fn convert_into_tuple(_x: impl Into<Tuple>) {}
+
+fn main() {
+    convert_into_tuple(42_u8);
+    //~^ ERROR E0277
+    //~| HELP use a unary tuple instead
+    //~| HELP the following other types implement trait `From<T>`
+}
diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr
new file mode 100644
index 00000000000..6ee08d2cd1b
--- /dev/null
+++ b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr
@@ -0,0 +1,26 @@
+error[E0277]: the trait bound `Tuple: From<u8>` is not satisfied
+  --> $DIR/suggest_tuple_wrap_root_obligation.rs:22:24
+   |
+LL |     convert_into_tuple(42_u8);
+   |     ------------------ ^^^^^ the trait `From<u8>` is not implemented for `Tuple`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the following other types implement trait `From<T>`:
+             `Tuple` implements `From<(u8, u8)>`
+             `Tuple` implements `From<(u8, u8, u8)>`
+             `Tuple` implements `From<(u8,)>`
+   = note: required for `u8` to implement `Into<Tuple>`
+note: required by a bound in `convert_into_tuple`
+  --> $DIR/suggest_tuple_wrap_root_obligation.rs:19:32
+   |
+LL | fn convert_into_tuple(_x: impl Into<Tuple>) {}
+   |                                ^^^^^^^^^^^ required by this bound in `convert_into_tuple`
+help: use a unary tuple instead
+   |
+LL |     convert_into_tuple((42_u8,));
+   |                        +     ++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/overloaded/overloaded-calls-nontuple.stderr b/tests/ui/overloaded/overloaded-calls-nontuple.stderr
index 45a84fc4d7b..22598f3a390 100644
--- a/tests/ui/overloaded/overloaded-calls-nontuple.stderr
+++ b/tests/ui/overloaded/overloaded-calls-nontuple.stderr
@@ -38,6 +38,10 @@ LL |         self.call_mut(z)
    |
 note: required by a bound in `call_mut`
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+help: use a unary tuple instead
+   |
+LL |         self.call_mut((z,))
+   |                       + ++
 
 error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
   --> $DIR/overloaded-calls-nontuple.rs:29:10
diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr
index f277bfbc884..158eac9a1bd 100644
--- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr
+++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr
@@ -21,6 +21,10 @@ LL |     let HiddenStruct { one, two, .. } = HiddenStruct::default();
    |                           ~~~~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     let HiddenStruct { one, two: _, .. } = HiddenStruct::default();
+   |                           ~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     let HiddenStruct { one, .. } = HiddenStruct::default();
    |                           ~~~~~~
 
@@ -36,6 +40,10 @@ LL |     let HiddenStruct { one, hide, two } = HiddenStruct::default();
    |                                 ~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     let HiddenStruct { one, hide, two: _ } = HiddenStruct::default();
+   |                                 ~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     let HiddenStruct { one, hide, .. } = HiddenStruct::default();
    |                                 ~~~~~~
 
@@ -51,6 +59,10 @@ LL |     let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden:
    |                       ~~~~~~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 };
+   |                       ~~~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 };
    |                       ~~~~~~
 
diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr
index cf98c51a2b4..d6e9bac7c13 100644
--- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr
+++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr
@@ -10,6 +10,10 @@ LL |     let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
    |                                ~~~~~~~~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default();
+   |                                ~~~~~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     let UnstableStruct { stable, .. } = UnstableStruct::default();
    |                                ~~~~~~
 
diff --git a/tests/ui/pattern/usefulness/unstable-gated-fields.stderr b/tests/ui/pattern/usefulness/unstable-gated-fields.stderr
index e4f5fa06b3f..bb10e439ee2 100644
--- a/tests/ui/pattern/usefulness/unstable-gated-fields.stderr
+++ b/tests/ui/pattern/usefulness/unstable-gated-fields.stderr
@@ -10,6 +10,10 @@ LL |     let UnstableStruct { stable, stable2, unstable } = UnstableStruct::defa
    |                                         ~~~~~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     let UnstableStruct { stable, stable2, unstable: _ } = UnstableStruct::default();
+   |                                         ~~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
    |                                         ~~~~~~
 
@@ -25,6 +29,10 @@ LL |     let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::defa
    |                                          ~~~~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     let UnstableStruct { stable, unstable, stable2: _ } = UnstableStruct::default();
+   |                                          ~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     let UnstableStruct { stable, unstable, .. } = UnstableStruct::default();
    |                                          ~~~~~~
 
diff --git a/tests/ui/pin-macro/cant_access_internals.rs b/tests/ui/pin-macro/cant_access_internals.rs
index 17fe7fa0738..36a47d0fdf9 100644
--- a/tests/ui/pin-macro/cant_access_internals.rs
+++ b/tests/ui/pin-macro/cant_access_internals.rs
@@ -8,5 +8,5 @@ use core::{
 
 fn main() {
     let mut phantom_pinned = pin!(PhantomPinned);
-    mem::take(phantom_pinned.__pointer); //~ ERROR use of unstable library feature 'unsafe_pin_internals'
+    mem::take(phantom_pinned.__pointer); //~ ERROR use of unstable library feature `unsafe_pin_internals`
 }
diff --git a/tests/ui/pin-macro/cant_access_internals.stderr b/tests/ui/pin-macro/cant_access_internals.stderr
index 444314a9d8b..8ad897bbbb9 100644
--- a/tests/ui/pin-macro/cant_access_internals.stderr
+++ b/tests/ui/pin-macro/cant_access_internals.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unsafe_pin_internals'
+error[E0658]: use of unstable library feature `unsafe_pin_internals`
   --> $DIR/cant_access_internals.rs:11:15
    |
 LL |     mem::take(phantom_pinned.__pointer);
diff --git a/tests/ui/proc-macro/expand-to-unstable.stderr b/tests/ui/proc-macro/expand-to-unstable.stderr
index 9eb701d9702..563c7ae8f95 100644
--- a/tests/ui/proc-macro/expand-to-unstable.stderr
+++ b/tests/ui/proc-macro/expand-to-unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
+error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
   --> $DIR/expand-to-unstable.rs:8:10
    |
 LL | #[derive(Unstable)]
diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs
index 2509416ad87..2b6bbf12650 100644
--- a/tests/ui/repr/16-bit-repr-c-enum.rs
+++ b/tests/ui/repr/16-bit-repr-c-enum.rs
@@ -21,11 +21,12 @@ enum Foo {
     Bar,
 }
 
-extern "rust-intrinsic" {
-    #[stable(feature = "intrinsics_for_test", since = "3.3.3")]
-    #[rustc_const_stable(feature = "intrinsics_for_test", since = "3.3.3")]
-    #[rustc_safe_intrinsic]
-    fn size_of<T>() -> usize;
+#[stable(feature = "intrinsics_for_test", since = "3.3.3")]
+#[rustc_const_stable(feature = "intrinsics_for_test", since = "3.3.3")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+const fn size_of<T>() -> usize {
+    loop {}
 }
 
 #[lang="sized"]
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr
index af6d05c1f96..08584349626 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'structural_match'
+error[E0658]: use of unstable library feature `structural_match`
   --> $DIR/feature-gate.rs:29:6
    |
 LL | impl std::marker::StructuralPartialEq for Foo { }
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs
index 839e9085440..711b07fee3b 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs
@@ -27,7 +27,7 @@ fn main() { //[with_gate]~ ERROR fatal error triggered by #[rustc_error]
 }
 
 impl std::marker::StructuralPartialEq for Foo { }
-//[no_gate]~^ ERROR use of unstable library feature 'structural_match'
+//[no_gate]~^ ERROR use of unstable library feature `structural_match`
 
 impl PartialEq<Foo> for Foo {
     fn eq(&self, other: &Self) -> bool {
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs
index 4dc5932feab..5d9a8cfcac1 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs
@@ -38,3 +38,9 @@ pub enum NonExhaustiveCLikeEnum {
     Four = 4,
     Five = 5,
 }
+
+#[repr(C)]
+pub struct NormalStructWithNonExhaustiveCLikeEnum {
+    one: u8,
+    two: NonExhaustiveCLikeEnum,
+}
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs
index c7f470fb787..858e3374eac 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs
@@ -8,7 +8,7 @@ extern crate types;
 
 use types::{
     NonExhaustiveCLikeEnum, NonExhaustiveEnum, NonExhaustiveVariants,
-    NormalStruct, TupleStruct, UnitStruct,
+    NormalStruct, TupleStruct, UnitStruct, NormalStructWithNonExhaustiveCLikeEnum
 };
 
 extern "C" {
@@ -27,6 +27,9 @@ extern "C" {
 // These should pass without remark, as they're C-compatible, despite being "non-exhaustive".
 extern "C" {
     pub fn non_exhaustive_c_compat_enum(_: NonExhaustiveCLikeEnum);
+    pub fn non_exhaustive_c_compat_enum_ret() -> *mut NonExhaustiveCLikeEnum;
+    pub fn struct_w_non_exhaustive_c_like_enum(_: NormalStructWithNonExhaustiveCLikeEnum);
+    pub fn struct_w_non_exhaustive_c_like_enum_ret() -> *mut NormalStructWithNonExhaustiveCLikeEnum;
 }
 
 fn main() {}
diff --git a/tests/ui/stability-attribute/accidental-stable-in-unstable.rs b/tests/ui/stability-attribute/accidental-stable-in-unstable.rs
index f8bbe90cfc5..86a9d2066eb 100644
--- a/tests/ui/stability-attribute/accidental-stable-in-unstable.rs
+++ b/tests/ui/stability-attribute/accidental-stable-in-unstable.rs
@@ -3,7 +3,7 @@ extern crate core;
 
 // Known accidental stabilizations with no known users, slated for un-stabilization
 // fully stable @ core::char::UNICODE_VERSION
-use core::unicode::UNICODE_VERSION; //~ ERROR use of unstable library feature 'unicode_internals'
+use core::unicode::UNICODE_VERSION; //~ ERROR use of unstable library feature `unicode_internals`
 
 // Known accidental stabilizations with known users
 // fully stable @ core::mem::transmute
diff --git a/tests/ui/stability-attribute/accidental-stable-in-unstable.stderr b/tests/ui/stability-attribute/accidental-stable-in-unstable.stderr
index 4abf8243d2f..9943e6d7ac6 100644
--- a/tests/ui/stability-attribute/accidental-stable-in-unstable.stderr
+++ b/tests/ui/stability-attribute/accidental-stable-in-unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unicode_internals'
+error[E0658]: use of unstable library feature `unicode_internals`
   --> $DIR/accidental-stable-in-unstable.rs:6:5
    |
 LL | use core::unicode::UNICODE_VERSION;
diff --git a/tests/ui/stability-attribute/allow-unstable-reexport.rs b/tests/ui/stability-attribute/allow-unstable-reexport.rs
index d2f1593c31a..b6ed2110918 100644
--- a/tests/ui/stability-attribute/allow-unstable-reexport.rs
+++ b/tests/ui/stability-attribute/allow-unstable-reexport.rs
@@ -20,11 +20,11 @@ pub use lint_stability_reexport::unstable_text;
 // Ensure items which aren't marked as unstable can't re-export unstable items
 #[stable(feature = "lint_stability", since = "1.0.0")]
 pub use lint_stability::unstable as unstable2;
-//~^ ERROR use of unstable library feature 'unstable_test_feature'
+//~^ ERROR use of unstable library feature `unstable_test_feature`
 
 fn main() {
     // Since we didn't enable the feature in this crate, we still can't
     // use these items, even though they're in scope from the `use`s which are now allowed.
-    unstable(); //~ ERROR use of unstable library feature 'unstable_test_feature'
-    unstable_text(); //~ ERROR use of unstable library feature 'unstable_test_feature'
+    unstable(); //~ ERROR use of unstable library feature `unstable_test_feature`
+    unstable_text(); //~ ERROR use of unstable library feature `unstable_test_feature`
 }
diff --git a/tests/ui/stability-attribute/allow-unstable-reexport.stderr b/tests/ui/stability-attribute/allow-unstable-reexport.stderr
index af75b6afb04..f869eeb790e 100644
--- a/tests/ui/stability-attribute/allow-unstable-reexport.stderr
+++ b/tests/ui/stability-attribute/allow-unstable-reexport.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/allow-unstable-reexport.rs:22:9
    |
 LL | pub use lint_stability::unstable as unstable2;
@@ -7,7 +7,7 @@ LL | pub use lint_stability::unstable as unstable2;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/allow-unstable-reexport.rs:28:5
    |
 LL |     unstable();
@@ -16,7 +16,7 @@ LL |     unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': text
+error[E0658]: use of unstable library feature `unstable_test_feature`: text
   --> $DIR/allow-unstable-reexport.rs:29:5
    |
 LL |     unstable_text();
diff --git a/tests/ui/stability-attribute/allowed-through-unstable.rs b/tests/ui/stability-attribute/allowed-through-unstable.rs
index 6bce5c87ddb..29911a70be9 100644
--- a/tests/ui/stability-attribute/allowed-through-unstable.rs
+++ b/tests/ui/stability-attribute/allowed-through-unstable.rs
@@ -6,4 +6,4 @@
 extern crate allowed_through_unstable_core;
 
 use allowed_through_unstable_core::unstable_module::OldStableTraitAllowedThoughUnstable;
-use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable; //~ ERROR use of unstable library feature 'unstable_test_feature'
+use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable; //~ ERROR use of unstable library feature `unstable_test_feature`
diff --git a/tests/ui/stability-attribute/allowed-through-unstable.stderr b/tests/ui/stability-attribute/allowed-through-unstable.stderr
index 5c8e6358b7c..00eea9f730d 100644
--- a/tests/ui/stability-attribute/allowed-through-unstable.stderr
+++ b/tests/ui/stability-attribute/allowed-through-unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/allowed-through-unstable.rs:9:5
    |
 LL | use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable;
diff --git a/tests/ui/stability-attribute/default-body-stability-err.stderr b/tests/ui/stability-attribute/default-body-stability-err.stderr
index 9d8ad81f102..6173de5020b 100644
--- a/tests/ui/stability-attribute/default-body-stability-err.stderr
+++ b/tests/ui/stability-attribute/default-body-stability-err.stderr
@@ -5,7 +5,7 @@ LL | impl JustTrait for Type {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: default implementation of `CONSTANT` is unstable
-   = note: use of unstable library feature 'constant_default_body'
+   = note: use of unstable library feature `constant_default_body`
    = help: add `#![feature(constant_default_body)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
@@ -16,7 +16,7 @@ LL | impl JustTrait for Type {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: default implementation of `fun` is unstable
-   = note: use of unstable library feature 'fun_default_body'
+   = note: use of unstable library feature `fun_default_body`
    = help: add `#![feature(fun_default_body)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
@@ -27,7 +27,7 @@ LL | impl JustTrait for Type {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: default implementation of `fun2` is unstable
-   = note: use of unstable library feature 'fun_default_body': reason
+   = note: use of unstable library feature `fun_default_body`: reason
    = help: add `#![feature(fun_default_body)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
@@ -43,7 +43,7 @@ LL | | }
    | |_^
    |
    = note: default implementation of `eq` is unstable
-   = note: use of unstable library feature 'eq_default_body'
+   = note: use of unstable library feature `eq_default_body`
    = help: add `#![feature(eq_default_body)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
diff --git a/tests/ui/stability-attribute/generics-default-stability-trait.rs b/tests/ui/stability-attribute/generics-default-stability-trait.rs
index ba8ee143d4a..a2302959638 100644
--- a/tests/ui/stability-attribute/generics-default-stability-trait.rs
+++ b/tests/ui/stability-attribute/generics-default-stability-trait.rs
@@ -13,15 +13,15 @@ impl Trait1 for S {
 
 struct S;
 
-impl Trait1<usize> for S { //~ ERROR use of unstable library feature 'unstable_default'
+impl Trait1<usize> for S { //~ ERROR use of unstable library feature `unstable_default`
     fn foo() -> usize { 0 }
 }
 
-impl Trait1<isize> for S { //~ ERROR use of unstable library feature 'unstable_default'
+impl Trait1<isize> for S { //~ ERROR use of unstable library feature `unstable_default`
     fn foo() -> isize { 0 }
 }
 
-impl Trait2<usize> for S { //~ ERROR use of unstable library feature 'unstable_default'
+impl Trait2<usize> for S { //~ ERROR use of unstable library feature `unstable_default`
     fn foo() -> usize { 0 }
 }
 
diff --git a/tests/ui/stability-attribute/generics-default-stability-trait.stderr b/tests/ui/stability-attribute/generics-default-stability-trait.stderr
index 699e7c83c70..21b21fdb945 100644
--- a/tests/ui/stability-attribute/generics-default-stability-trait.stderr
+++ b/tests/ui/stability-attribute/generics-default-stability-trait.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability-trait.rs:16:13
    |
 LL | impl Trait1<usize> for S {
@@ -7,7 +7,7 @@ LL | impl Trait1<usize> for S {
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability-trait.rs:20:13
    |
 LL | impl Trait1<isize> for S {
@@ -16,7 +16,7 @@ LL | impl Trait1<isize> for S {
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability-trait.rs:24:13
    |
 LL | impl Trait2<usize> for S {
diff --git a/tests/ui/stability-attribute/generics-default-stability-where.rs b/tests/ui/stability-attribute/generics-default-stability-where.rs
index f8a2fb4873a..a7bc1756d78 100644
--- a/tests/ui/stability-attribute/generics-default-stability-where.rs
+++ b/tests/ui/stability-attribute/generics-default-stability-where.rs
@@ -4,7 +4,7 @@ extern crate unstable_generic_param;
 
 use unstable_generic_param::*;
 
-impl<T> Trait3<usize> for T where T: Trait2<usize> { //~ ERROR use of unstable library feature 'unstable_default'
+impl<T> Trait3<usize> for T where T: Trait2<usize> { //~ ERROR use of unstable library feature `unstable_default`
 //~^ ERROR `T` must be used as the type parameter for some local type
     fn foo() -> usize { T::foo() }
 }
diff --git a/tests/ui/stability-attribute/generics-default-stability-where.stderr b/tests/ui/stability-attribute/generics-default-stability-where.stderr
index 8e4089970f5..9437f5d65fa 100644
--- a/tests/ui/stability-attribute/generics-default-stability-where.stderr
+++ b/tests/ui/stability-attribute/generics-default-stability-where.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability-where.rs:7:45
    |
 LL | impl<T> Trait3<usize> for T where T: Trait2<usize> {
diff --git a/tests/ui/stability-attribute/generics-default-stability.rs b/tests/ui/stability-attribute/generics-default-stability.rs
index abd45b651ee..e1b3971f70c 100644
--- a/tests/ui/stability-attribute/generics-default-stability.rs
+++ b/tests/ui/stability-attribute/generics-default-stability.rs
@@ -20,12 +20,12 @@ impl Trait3<usize> for S {
 fn main() {
     let _ = S;
 
-    let _: Struct1<isize> = Struct1 { field: 1 }; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Struct1<isize> = Struct1 { field: 1 }; //~ ERROR use of unstable library feature `unstable_default`
 
     let _ = STRUCT1; // ok
     let _: Struct1 = STRUCT1; // ok
-    let _: Struct1<usize> = STRUCT1; //~ ERROR use of unstable library feature 'unstable_default'
-    let _: Struct1<isize> = Struct1 { field: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Struct1<usize> = STRUCT1; //~ ERROR use of unstable library feature `unstable_default`
+    let _: Struct1<isize> = Struct1 { field: 0 }; //~ ERROR use of unstable library feature `unstable_default`
 
     // Instability is not enforced for generic type parameters used in public fields.
     // Note how the unstable type default `usize` leaks,
@@ -54,10 +54,10 @@ fn main() {
 
     let _ = STRUCT3;
     let _: Struct3 = STRUCT3; // ok
-    let _: Struct3<isize, usize> = STRUCT3; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Struct3<isize, usize> = STRUCT3; //~ ERROR use of unstable library feature `unstable_default`
     let _: Struct3<isize> = STRUCT3; // ok
-    let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
-    let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature `unstable_default`
+    let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature `unstable_default`
     let _ = STRUCT3.field1; // ok
     let _: isize = STRUCT3.field1; // ok
     let _ = STRUCT3.field1 + 1; // ok
@@ -81,15 +81,15 @@ fn main() {
     //~^^^ use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated]
 
     let _ = STRUCT5;
-    let _: Struct5<isize> = Struct5 { field: 1 }; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Struct5<isize> = Struct5 { field: 1 }; //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
     //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
     //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated]
     let _ = STRUCT5;
     let _: Struct5 = STRUCT5; //~ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
-    let _: Struct5<usize> = STRUCT5; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Struct5<usize> = STRUCT5; //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
-    let _: Struct5<isize> = Struct5 { field: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Struct5<isize> = Struct5 { field: 0 }; //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
     //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
     //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated]
@@ -97,12 +97,12 @@ fn main() {
     let _: Struct6<isize> = Struct6 { field: 1 }; // ok
     let _: Struct6<isize> = Struct6 { field: 0 }; // ok
 
-    let _: Alias1<isize> = Alias1::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Alias1<isize> = Alias1::Some(1); //~ ERROR use of unstable library feature `unstable_default`
 
     let _ = ALIAS1; // ok
     let _: Alias1 = ALIAS1; // ok
-    let _: Alias1<usize> = ALIAS1; //~ ERROR use of unstable library feature 'unstable_default'
-    let _: Alias1<isize> = Alias1::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Alias1<usize> = ALIAS1; //~ ERROR use of unstable library feature `unstable_default`
+    let _: Alias1<isize> = Alias1::Some(0); //~ ERROR use of unstable library feature `unstable_default`
 
     // Instability is not enforced for generic type parameters used in public fields.
     // Note how the unstable type default `usize` leaks,
@@ -130,10 +130,10 @@ fn main() {
 
     let _ = ALIAS3;
     let _: Alias3 = ALIAS3; // ok
-    let _: Alias3<isize, usize> = ALIAS3; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Alias3<isize, usize> = ALIAS3; //~ ERROR use of unstable library feature `unstable_default`
     let _: Alias3<isize> = ALIAS3; // ok
-    let _: Alias3<isize, isize> = Alias3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default'
-    let _: Alias3<usize, usize> = Alias3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Alias3<isize, isize> = Alias3::Ok(0); //~ ERROR use of unstable library feature `unstable_default`
+    let _: Alias3<usize, usize> = Alias3::Ok(0); //~ ERROR use of unstable library feature `unstable_default`
     let _ = ALIAS3.unwrap(); // ok
     let _: isize = ALIAS3.unwrap(); // ok
     let _ = ALIAS3.unwrap() + 1; // ok
@@ -155,26 +155,26 @@ fn main() {
     //~^^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated]
 
     let _ = ALIAS5;
-    let _: Alias5<isize> = Alias5::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Alias5<isize> = Alias5::Some(1); //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
     //~^^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
     let _ = ALIAS5;
     let _: Alias5 = ALIAS5; //~ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
-    let _: Alias5<usize> = ALIAS5; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Alias5<usize> = ALIAS5; //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
-    let _: Alias5<isize> = Alias5::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Alias5<isize> = Alias5::Some(0); //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
     //~^^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
 
     let _: Alias6<isize> = Alias6::Some(1); // ok
     let _: Alias6<isize> = Alias6::Some(0); // ok
 
-    let _: Enum1<isize> = Enum1::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Enum1<isize> = Enum1::Some(1); //~ ERROR use of unstable library feature `unstable_default`
 
     let _ = ENUM1; // ok
     let _: Enum1 = ENUM1; // ok
-    let _: Enum1<usize> = ENUM1; //~ ERROR use of unstable library feature 'unstable_default'
-    let _: Enum1<isize> = Enum1::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Enum1<usize> = ENUM1; //~ ERROR use of unstable library feature `unstable_default`
+    let _: Enum1<isize> = Enum1::Some(0); //~ ERROR use of unstable library feature `unstable_default`
 
     // Instability is not enforced for generic type parameters used in public fields.
     // Note how the unstable type default `usize` leaks,
@@ -202,10 +202,10 @@ fn main() {
 
     let _ = ENUM3;
     let _: Enum3 = ENUM3; // ok
-    let _: Enum3<isize, usize> = ENUM3; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Enum3<isize, usize> = ENUM3; //~ ERROR use of unstable library feature `unstable_default`
     let _: Enum3<isize> = ENUM3; // ok
-    let _: Enum3<isize, isize> = Enum3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default'
-    let _: Enum3<usize, usize> = Enum3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Enum3<isize, isize> = Enum3::Ok(0); //~ ERROR use of unstable library feature `unstable_default`
+    let _: Enum3<usize, usize> = Enum3::Ok(0); //~ ERROR use of unstable library feature `unstable_default`
     if let Enum3::Ok(x) = ENUM3 {let _ = x;} // ok
     if let Enum3::Ok(x) = ENUM3 {let _: isize = x;} // ok
     if let Enum3::Ok(x) = ENUM3 {let _ = x + 1;} // ok
@@ -227,21 +227,21 @@ fn main() {
     //~^^ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
 
     let _ = ENUM5;
-    let _: Enum5<isize> = Enum5::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Enum5<isize> = Enum5::Some(1); //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated]
     //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
     let _ = ENUM5;
     let _: Enum5 = ENUM5; //~ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
-    let _: Enum5<usize> = ENUM5; //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Enum5<usize> = ENUM5; //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
-    let _: Enum5<isize> = Enum5::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
+    let _: Enum5<isize> = Enum5::Some(0); //~ ERROR use of unstable library feature `unstable_default`
     //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated]
     //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
 
     let _: Enum6<isize> = Enum6::Some(1); // ok
     let _: Enum6<isize> = Enum6::Some(0); // ok
 
-    let _: Box1<isize, System> = Box1::new(1); //~ ERROR use of unstable library feature 'box_alloc_param'
+    let _: Box1<isize, System> = Box1::new(1); //~ ERROR use of unstable library feature `box_alloc_param`
     let _: Box1<isize> = Box1::new(1); // ok
 
     let _: Box2<isize, System> = Box2::new(1); // ok
diff --git a/tests/ui/stability-attribute/generics-default-stability.stderr b/tests/ui/stability-attribute/generics-default-stability.stderr
index b1b91a850e9..f4f51a14248 100644
--- a/tests/ui/stability-attribute/generics-default-stability.stderr
+++ b/tests/ui/stability-attribute/generics-default-stability.stderr
@@ -216,7 +216,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum5`: test
 LL |     let _: Enum5<isize> = Enum5::Some(0);
    |            ^^^^^
 
-error[E0658]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:23:20
    |
 LL |     let _: Struct1<isize> = Struct1 { field: 1 };
@@ -225,7 +225,7 @@ LL |     let _: Struct1<isize> = Struct1 { field: 1 };
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:27:20
    |
 LL |     let _: Struct1<usize> = STRUCT1;
@@ -234,7 +234,7 @@ LL |     let _: Struct1<usize> = STRUCT1;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:28:20
    |
 LL |     let _: Struct1<isize> = Struct1 { field: 0 };
@@ -243,7 +243,7 @@ LL |     let _: Struct1<isize> = Struct1 { field: 0 };
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:57:27
    |
 LL |     let _: Struct3<isize, usize> = STRUCT3;
@@ -252,7 +252,7 @@ LL |     let _: Struct3<isize, usize> = STRUCT3;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:59:27
    |
 LL |     let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 };
@@ -261,7 +261,7 @@ LL |     let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 };
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:60:27
    |
 LL |     let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 };
@@ -270,7 +270,7 @@ LL |     let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 };
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:84:20
    |
 LL |     let _: Struct5<isize> = Struct5 { field: 1 };
@@ -279,7 +279,7 @@ LL |     let _: Struct5<isize> = Struct5 { field: 1 };
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:90:20
    |
 LL |     let _: Struct5<usize> = STRUCT5;
@@ -288,7 +288,7 @@ LL |     let _: Struct5<usize> = STRUCT5;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:92:20
    |
 LL |     let _: Struct5<isize> = Struct5 { field: 0 };
@@ -297,7 +297,7 @@ LL |     let _: Struct5<isize> = Struct5 { field: 0 };
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:100:19
    |
 LL |     let _: Alias1<isize> = Alias1::Some(1);
@@ -306,7 +306,7 @@ LL |     let _: Alias1<isize> = Alias1::Some(1);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:104:19
    |
 LL |     let _: Alias1<usize> = ALIAS1;
@@ -315,7 +315,7 @@ LL |     let _: Alias1<usize> = ALIAS1;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:105:19
    |
 LL |     let _: Alias1<isize> = Alias1::Some(0);
@@ -324,7 +324,7 @@ LL |     let _: Alias1<isize> = Alias1::Some(0);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:133:26
    |
 LL |     let _: Alias3<isize, usize> = ALIAS3;
@@ -333,7 +333,7 @@ LL |     let _: Alias3<isize, usize> = ALIAS3;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:135:26
    |
 LL |     let _: Alias3<isize, isize> = Alias3::Ok(0);
@@ -342,7 +342,7 @@ LL |     let _: Alias3<isize, isize> = Alias3::Ok(0);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:136:26
    |
 LL |     let _: Alias3<usize, usize> = Alias3::Ok(0);
@@ -351,7 +351,7 @@ LL |     let _: Alias3<usize, usize> = Alias3::Ok(0);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:158:19
    |
 LL |     let _: Alias5<isize> = Alias5::Some(1);
@@ -360,7 +360,7 @@ LL |     let _: Alias5<isize> = Alias5::Some(1);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:163:19
    |
 LL |     let _: Alias5<usize> = ALIAS5;
@@ -369,7 +369,7 @@ LL |     let _: Alias5<usize> = ALIAS5;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:165:19
    |
 LL |     let _: Alias5<isize> = Alias5::Some(0);
@@ -378,7 +378,7 @@ LL |     let _: Alias5<isize> = Alias5::Some(0);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:172:18
    |
 LL |     let _: Enum1<isize> = Enum1::Some(1);
@@ -387,7 +387,7 @@ LL |     let _: Enum1<isize> = Enum1::Some(1);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:176:18
    |
 LL |     let _: Enum1<usize> = ENUM1;
@@ -396,7 +396,7 @@ LL |     let _: Enum1<usize> = ENUM1;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:177:18
    |
 LL |     let _: Enum1<isize> = Enum1::Some(0);
@@ -405,7 +405,7 @@ LL |     let _: Enum1<isize> = Enum1::Some(0);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:205:25
    |
 LL |     let _: Enum3<isize, usize> = ENUM3;
@@ -414,7 +414,7 @@ LL |     let _: Enum3<isize, usize> = ENUM3;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:207:25
    |
 LL |     let _: Enum3<isize, isize> = Enum3::Ok(0);
@@ -423,7 +423,7 @@ LL |     let _: Enum3<isize, isize> = Enum3::Ok(0);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:208:25
    |
 LL |     let _: Enum3<usize, usize> = Enum3::Ok(0);
@@ -432,7 +432,7 @@ LL |     let _: Enum3<usize, usize> = Enum3::Ok(0);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:230:18
    |
 LL |     let _: Enum5<isize> = Enum5::Some(1);
@@ -441,7 +441,7 @@ LL |     let _: Enum5<isize> = Enum5::Some(1);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:235:18
    |
 LL |     let _: Enum5<usize> = ENUM5;
@@ -450,7 +450,7 @@ LL |     let _: Enum5<usize> = ENUM5;
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'unstable_default'
+error[E0658]: use of unstable library feature `unstable_default`
   --> $DIR/generics-default-stability.rs:237:18
    |
 LL |     let _: Enum5<isize> = Enum5::Some(0);
@@ -459,7 +459,7 @@ LL |     let _: Enum5<isize> = Enum5::Some(0);
    = help: add `#![feature(unstable_default)]` 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]: use of unstable library feature 'box_alloc_param'
+error[E0658]: use of unstable library feature `box_alloc_param`
   --> $DIR/generics-default-stability.rs:244:24
    |
 LL |     let _: Box1<isize, System> = Box1::new(1);
diff --git a/tests/ui/stability-attribute/issue-28075.rs b/tests/ui/stability-attribute/issue-28075.rs
index 8fc2ffe3dc9..b6b231d4afa 100644
--- a/tests/ui/stability-attribute/issue-28075.rs
+++ b/tests/ui/stability-attribute/issue-28075.rs
@@ -7,7 +7,7 @@
 extern crate lint_stability;
 
 use lint_stability::{unstable, deprecated};
-//~^ ERROR use of unstable library feature 'unstable_test_feature'
+//~^ ERROR use of unstable library feature `unstable_test_feature`
 
 fn main() {
 }
diff --git a/tests/ui/stability-attribute/issue-28075.stderr b/tests/ui/stability-attribute/issue-28075.stderr
index 282686d82bb..d10a27b874e 100644
--- a/tests/ui/stability-attribute/issue-28075.stderr
+++ b/tests/ui/stability-attribute/issue-28075.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/issue-28075.rs:9:22
    |
 LL | use lint_stability::{unstable, deprecated};
diff --git a/tests/ui/stability-attribute/issue-28388-3.rs b/tests/ui/stability-attribute/issue-28388-3.rs
index 2f61146f6e3..7b6b6ce7f4b 100644
--- a/tests/ui/stability-attribute/issue-28388-3.rs
+++ b/tests/ui/stability-attribute/issue-28388-3.rs
@@ -5,7 +5,7 @@
 extern crate lint_stability;
 
 use lint_stability::UnstableEnum::{};
-//~^ ERROR use of unstable library feature 'unstable_test_feature'
+//~^ ERROR use of unstable library feature `unstable_test_feature`
 use lint_stability::StableEnum::{}; // OK
 
 fn main() {}
diff --git a/tests/ui/stability-attribute/issue-28388-3.stderr b/tests/ui/stability-attribute/issue-28388-3.stderr
index 56ca57591ce..def27c0b44d 100644
--- a/tests/ui/stability-attribute/issue-28388-3.stderr
+++ b/tests/ui/stability-attribute/issue-28388-3.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/issue-28388-3.rs:7:5
    |
 LL | use lint_stability::UnstableEnum::{};
diff --git a/tests/ui/stability-attribute/missing-const-stability.rs b/tests/ui/stability-attribute/missing-const-stability.rs
index 6d49996c3b5..10c31d79438 100644
--- a/tests/ui/stability-attribute/missing-const-stability.rs
+++ b/tests/ui/stability-attribute/missing-const-stability.rs
@@ -36,10 +36,4 @@ impl const Bar for Foo {
 pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 }
 //~^ ERROR function has missing const stability attribute
 
-extern "rust-intrinsic" {
-    #[stable(feature = "stable", since = "1.0.0")]
-    #[rustc_const_stable_indirect]
-    pub fn min_align_of_val<T>(x: *const T) -> usize;
-}
-
 fn main() {}
diff --git a/tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs b/tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs
index 47f885a43d6..0cc1dd20fd8 100644
--- a/tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs
+++ b/tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs
@@ -5,9 +5,9 @@
 
 extern crate stability_attribute_implies;
 use stability_attribute_implies::{foo, foobar};
-//~^ ERROR use of unstable library feature 'foobar'
+//~^ ERROR use of unstable library feature `foobar`
 
 fn main() {
     foo(); // no error - stable
-    foobar(); //~ ERROR use of unstable library feature 'foobar'
+    foobar(); //~ ERROR use of unstable library feature `foobar`
 }
diff --git a/tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr b/tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr
index b35ee6c1291..a625ef504b1 100644
--- a/tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr
+++ b/tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'foobar'
+error[E0658]: use of unstable library feature `foobar`
   --> $DIR/stability-attribute-implies-no-feature.rs:7:40
    |
 LL | use stability_attribute_implies::{foo, foobar};
@@ -8,7 +8,7 @@ LL | use stability_attribute_implies::{foo, foobar};
    = help: add `#![feature(foobar)]` 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]: use of unstable library feature 'foobar'
+error[E0658]: use of unstable library feature `foobar`
   --> $DIR/stability-attribute-implies-no-feature.rs:12:5
    |
 LL |     foobar();
diff --git a/tests/ui/stability-attribute/stability-attribute-issue.rs b/tests/ui/stability-attribute/stability-attribute-issue.rs
index 2d25c0c8bd7..e9d1f144e6b 100644
--- a/tests/ui/stability-attribute/stability-attribute-issue.rs
+++ b/tests/ui/stability-attribute/stability-attribute-issue.rs
@@ -6,7 +6,7 @@ use stability_attribute_issue::*;
 
 fn main() {
     unstable();
-    //~^ ERROR use of unstable library feature 'unstable_test_feature'
+    //~^ ERROR use of unstable library feature `unstable_test_feature`
     unstable_msg();
-    //~^ ERROR use of unstable library feature 'unstable_test_feature': message
+    //~^ ERROR use of unstable library feature `unstable_test_feature`: message
 }
diff --git a/tests/ui/stability-attribute/stability-attribute-issue.stderr b/tests/ui/stability-attribute/stability-attribute-issue.stderr
index 336e0f1718f..9dc6f441987 100644
--- a/tests/ui/stability-attribute/stability-attribute-issue.stderr
+++ b/tests/ui/stability-attribute/stability-attribute-issue.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/stability-attribute-issue.rs:8:5
    |
 LL |     unstable();
@@ -8,7 +8,7 @@ LL |     unstable();
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature': message
+error[E0658]: use of unstable library feature `unstable_test_feature`: message
   --> $DIR/stability-attribute-issue.rs:10:5
    |
 LL |     unstable_msg();
diff --git a/tests/ui/stability-attribute/stable-in-unstable.rs b/tests/ui/stability-attribute/stable-in-unstable.rs
index d10845d49a3..1fe084f6e59 100644
--- a/tests/ui/stability-attribute/stable-in-unstable.rs
+++ b/tests/ui/stability-attribute/stable-in-unstable.rs
@@ -13,8 +13,8 @@ extern crate stable_in_unstable_core;
 extern crate stable_in_unstable_std;
 
 mod isolated1 {
-    use stable_in_unstable_core::new_unstable_module; //~ ERROR use of unstable library feature 'unstable_test_feature'
-    use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature 'unstable_test_feature'
+    use stable_in_unstable_core::new_unstable_module; //~ ERROR use of unstable library feature `unstable_test_feature`
+    use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature `unstable_test_feature`
 }
 
 mod isolated2 {
@@ -26,7 +26,7 @@ mod isolated2 {
 }
 
 mod isolated3 {
-    use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature 'unstable_test_feature'
+    use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature `unstable_test_feature`
 
     struct LocalType;
 
@@ -36,7 +36,7 @@ mod isolated3 {
 mod isolated4 {
     struct LocalType;
 
-    impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {} //~ ERROR use of unstable library feature 'unstable_test_feature'
+    impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {} //~ ERROR use of unstable library feature `unstable_test_feature`
 }
 
 mod isolated5 {
@@ -46,9 +46,9 @@ mod isolated5 {
 }
 
 mod isolated6 {
-    use stable_in_unstable_core::new_unstable_module::{OldTrait}; //~ ERROR use of unstable library feature 'unstable_test_feature'
+    use stable_in_unstable_core::new_unstable_module::{OldTrait}; //~ ERROR use of unstable library feature `unstable_test_feature`
 }
 
 mod isolated7 {
-    use stable_in_unstable_core::new_unstable_module::*; //~ ERROR use of unstable library feature 'unstable_test_feature'
+    use stable_in_unstable_core::new_unstable_module::*; //~ ERROR use of unstable library feature `unstable_test_feature`
 }
diff --git a/tests/ui/stability-attribute/stable-in-unstable.stderr b/tests/ui/stability-attribute/stable-in-unstable.stderr
index eb73f047acd..b37b4dfd586 100644
--- a/tests/ui/stability-attribute/stable-in-unstable.stderr
+++ b/tests/ui/stability-attribute/stable-in-unstable.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/stable-in-unstable.rs:16:9
    |
 LL |     use stable_in_unstable_core::new_unstable_module;
@@ -8,7 +8,7 @@ LL |     use stable_in_unstable_core::new_unstable_module;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/stable-in-unstable.rs:17:9
    |
 LL |     use stable_in_unstable_core::new_unstable_module::OldTrait;
@@ -18,7 +18,7 @@ LL |     use stable_in_unstable_core::new_unstable_module::OldTrait;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/stable-in-unstable.rs:29:9
    |
 LL |     use stable_in_unstable_core::new_unstable_module::OldTrait;
@@ -28,7 +28,7 @@ LL |     use stable_in_unstable_core::new_unstable_module::OldTrait;
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/stable-in-unstable.rs:39:10
    |
 LL |     impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {}
@@ -38,7 +38,7 @@ LL |     impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalTy
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/stable-in-unstable.rs:49:56
    |
 LL |     use stable_in_unstable_core::new_unstable_module::{OldTrait};
@@ -48,7 +48,7 @@ LL |     use stable_in_unstable_core::new_unstable_module::{OldTrait};
    = help: add `#![feature(unstable_test_feature)]` 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]: use of unstable library feature 'unstable_test_feature'
+error[E0658]: use of unstable library feature `unstable_test_feature`
   --> $DIR/stable-in-unstable.rs:53:9
    |
 LL |     use stable_in_unstable_core::new_unstable_module::*;
diff --git a/tests/ui/stability-attribute/suggest-vec-allocator-api.rs b/tests/ui/stability-attribute/suggest-vec-allocator-api.rs
index fac52ab77c6..61a48c19e72 100644
--- a/tests/ui/stability-attribute/suggest-vec-allocator-api.rs
+++ b/tests/ui/stability-attribute/suggest-vec-allocator-api.rs
@@ -1,9 +1,9 @@
 fn main() {
-    let _: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api'
+    let _: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature `allocator_api`
     #[rustfmt::skip]
     let _: Vec<
         String,
-        _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api'
-    let _ = Vec::<u16, _>::new(); //~ ERROR use of unstable library feature 'allocator_api'
-    let _boxed: Box<u32, _> = Box::new(10); //~ ERROR use of unstable library feature 'allocator_api'
+        _> = vec![]; //~ ERROR use of unstable library feature `allocator_api`
+    let _ = Vec::<u16, _>::new(); //~ ERROR use of unstable library feature `allocator_api`
+    let _boxed: Box<u32, _> = Box::new(10); //~ ERROR use of unstable library feature `allocator_api`
 }
diff --git a/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr b/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr
index d7fcba4ced5..6662ceda90b 100644
--- a/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr
+++ b/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'allocator_api'
+error[E0658]: use of unstable library feature `allocator_api`
   --> $DIR/suggest-vec-allocator-api.rs:2:20
    |
 LL |     let _: Vec<u8, _> = vec![];
@@ -10,7 +10,7 @@ LL |     let _: Vec<u8, _> = vec![];
    = help: add `#![feature(allocator_api)]` 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]: use of unstable library feature 'allocator_api'
+error[E0658]: use of unstable library feature `allocator_api`
   --> $DIR/suggest-vec-allocator-api.rs:6:9
    |
 LL |         _> = vec![];
@@ -26,7 +26,7 @@ LL +         String,
 LL ~         _)> = vec![];
    |
 
-error[E0658]: use of unstable library feature 'allocator_api'
+error[E0658]: use of unstable library feature `allocator_api`
   --> $DIR/suggest-vec-allocator-api.rs:8:26
    |
 LL |     let _boxed: Box<u32, _> = Box::new(10);
@@ -36,7 +36,7 @@ LL |     let _boxed: Box<u32, _> = Box::new(10);
    = help: add `#![feature(allocator_api)]` 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]: use of unstable library feature 'allocator_api'
+error[E0658]: use of unstable library feature `allocator_api`
   --> $DIR/suggest-vec-allocator-api.rs:7:24
    |
 LL |     let _ = Vec::<u16, _>::new();
diff --git a/tests/ui/structs/struct-field-cfg.stderr b/tests/ui/structs/struct-field-cfg.stderr
index 2b9ba85ddcb..f30d343d582 100644
--- a/tests/ui/structs/struct-field-cfg.stderr
+++ b/tests/ui/structs/struct-field-cfg.stderr
@@ -24,6 +24,10 @@ LL |     let Foo { present } = foo;
    |             ~~~~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     let Foo { present: _ } = foo;
+   |             ~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     let Foo { .. } = foo;
    |             ~~~~~~
 
diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr
index 78bb018cb4b..d1d68121cf1 100644
--- a/tests/ui/structs/struct-pat-derived-error.stderr
+++ b/tests/ui/structs/struct-pat-derived-error.stderr
@@ -27,6 +27,10 @@ LL |         let A { x, y, b, c } = self.d;
    |                     ~~~~~~~~
 help: if you don't care about these missing fields, you can explicitly ignore them
    |
+LL |         let A { x, y, b: _, c: _ } = self.d;
+   |                     ~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         let A { x, y, .. } = self.d;
    |                     ~~~~~~
 
diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr
index 0b837a47a82..5f1ab2f9d68 100644
--- a/tests/ui/structs/struct-tuple-field-names.stderr
+++ b/tests/ui/structs/struct-tuple-field-names.stderr
@@ -32,6 +32,10 @@ LL |     if let E::S { 0: a, 1: _ } = x {
    |                       ~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     if let E::S { 0: a, 1: _ } = x {
+   |                       ~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     if let E::S { 0: a, .. } = x {
    |                       ~~~~~~
 
diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr
index e8503f540c2..af530e2b759 100644
--- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr
+++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr
@@ -19,6 +19,10 @@ LL |         Foo::Bar { a, aa: 1, c, b } => (),
    |                               ~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |         Foo::Bar { a, aa: 1, c, b: _ } => (),
+   |                               ~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         Foo::Bar { a, aa: 1, c, .. } => (),
    |                               ~~~~~~
 
@@ -43,6 +47,10 @@ LL |         Foo::Baz { bb: 1.0, a } => (),
    |                           ~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |         Foo::Baz { bb: 1.0, a: _ } => (),
+   |                           ~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         Foo::Baz { bb: 1.0, .. } => (),
    |                           ~~~~~~
 
@@ -64,6 +72,10 @@ LL |         Foo::Bar { a, aa: "", c, b } => (),
    |                                ~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |         Foo::Bar { a, aa: "", c, b: _ } => (),
+   |                                ~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         Foo::Bar { a, aa: "", c, .. } => (),
    |                                ~~~~~~
 
@@ -85,6 +97,10 @@ LL |         Foo::Baz { bb: "", a } => (),
    |                          ~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |         Foo::Baz { bb: "", a: _ } => (),
+   |                          ~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |         Foo::Baz { bb: "", .. } => (),
    |                          ~~~~~~
 
diff --git a/tests/ui/target-feature/feature-hierarchy.rs b/tests/ui/target-feature/feature-hierarchy.rs
index 7f14d700ecb..d62b86693c2 100644
--- a/tests/ui/target-feature/feature-hierarchy.rs
+++ b/tests/ui/target-feature/feature-hierarchy.rs
@@ -18,10 +18,12 @@ trait Sized {}
 trait Copy {}
 impl Copy for bool {}
 
-extern "rust-intrinsic" {
-    #[stable(feature = "test", since = "1.0.0")]
-    #[rustc_const_stable(feature = "test", since = "1.0.0")]
-    fn unreachable() -> !;
+#[stable(feature = "test", since = "1.0.0")]
+#[rustc_const_stable(feature = "test", since = "1.0.0")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+const unsafe fn unreachable() -> ! {
+    loop {}
 }
 
 #[rustc_builtin_macro]
diff --git a/tests/ui/target-feature/no-llvm-leaks.rs b/tests/ui/target-feature/no-llvm-leaks.rs
index f0c887bc1e0..10268686405 100644
--- a/tests/ui/target-feature/no-llvm-leaks.rs
+++ b/tests/ui/target-feature/no-llvm-leaks.rs
@@ -16,10 +16,12 @@ trait Sized {}
 trait Copy {}
 impl Copy for bool {}
 
-extern "rust-intrinsic" {
-    #[stable(feature = "test", since = "1.0.0")]
-    #[rustc_const_stable(feature = "test", since = "1.0.0")]
-    fn unreachable() -> !;
+#[stable(feature = "test", since = "1.0.0")]
+#[rustc_const_stable(feature = "test", since = "1.0.0")]
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+const unsafe fn unreachable() -> ! {
+    loop {}
 }
 
 #[rustc_builtin_macro]
diff --git a/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs b/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs
new file mode 100644
index 00000000000..48a98efea5e
--- /dev/null
+++ b/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs
@@ -0,0 +1,20 @@
+// issue#132534
+
+trait X {
+    fn a<T>() -> T::unknown<{}> {}
+    //~^ ERROR: associated type `unknown` not found for `T`
+    //~| ERROR: associated type `unknown` not found for `T`
+}
+
+trait Y {
+    fn a() -> NOT_EXIST::unknown<{}> {}
+    //~^ ERROR: failed to resolve: use of undeclared type `NOT_EXIST`
+}
+
+trait Z<T> {
+    fn a() -> T::unknown<{}> {}
+    //~^ ERROR: associated type `unknown` not found for `T`
+    //~| ERROR: associated type `unknown` not found for `T`
+}
+
+fn main() {}
diff --git a/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr b/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr
new file mode 100644
index 00000000000..9598c373e6e
--- /dev/null
+++ b/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr
@@ -0,0 +1,38 @@
+error[E0220]: associated type `unknown` not found for `T`
+  --> $DIR/unknown-assoc-with-const-arg.rs:4:21
+   |
+LL |     fn a<T>() -> T::unknown<{}> {}
+   |                     ^^^^^^^ associated type `unknown` not found
+
+error[E0220]: associated type `unknown` not found for `T`
+  --> $DIR/unknown-assoc-with-const-arg.rs:15:18
+   |
+LL |     fn a() -> T::unknown<{}> {}
+   |                  ^^^^^^^ associated type `unknown` not found
+
+error[E0220]: associated type `unknown` not found for `T`
+  --> $DIR/unknown-assoc-with-const-arg.rs:4:21
+   |
+LL |     fn a<T>() -> T::unknown<{}> {}
+   |                     ^^^^^^^ associated type `unknown` not found
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0220]: associated type `unknown` not found for `T`
+  --> $DIR/unknown-assoc-with-const-arg.rs:15:18
+   |
+LL |     fn a() -> T::unknown<{}> {}
+   |                  ^^^^^^^ associated type `unknown` not found
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0433]: failed to resolve: use of undeclared type `NOT_EXIST`
+  --> $DIR/unknown-assoc-with-const-arg.rs:10:15
+   |
+LL |     fn a() -> NOT_EXIST::unknown<{}> {}
+   |               ^^^^^^^^^ use of undeclared type `NOT_EXIST`
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0220, E0433.
+For more information about an error, try `rustc --explain E0220`.
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
index 3ccae5a83e6..95f6f32f21d 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'derive_const'
+error[E0658]: use of unstable library feature `derive_const`
   --> $DIR/derive-const-gate.rs:1:3
    |
 LL | #[derive_const(Default)]
diff --git a/tests/ui/traits/issue-78372.rs b/tests/ui/traits/issue-78372.rs
index b97835bbc57..82b13cc0b62 100644
--- a/tests/ui/traits/issue-78372.rs
+++ b/tests/ui/traits/issue-78372.rs
@@ -1,8 +1,8 @@
-use std::ops::DispatchFromDyn; //~ ERROR use of unstable library feature 'dispatch_from_dyn'
+use std::ops::DispatchFromDyn; //~ ERROR use of unstable library feature `dispatch_from_dyn`
 struct Smaht<T, MISC>(PhantomData); //~ ERROR cannot find type `PhantomData` in this scope
 impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} //~ ERROR cannot find type `U` in this scope
 //~^ ERROR cannot find type `MISC` in this scope
-//~| ERROR use of unstable library feature 'dispatch_from_dyn'
+//~| ERROR use of unstable library feature `dispatch_from_dyn`
 //~| ERROR the trait `DispatchFromDyn` may only be implemented for a coercion between structures
 trait Foo: X<u32> {}
 trait X<T> {
diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr
index 9b93ffe8efb..4cc2c59fd8d 100644
--- a/tests/ui/traits/issue-78372.stderr
+++ b/tests/ui/traits/issue-78372.stderr
@@ -37,7 +37,7 @@ help: you might be missing a type parameter
 LL | impl<T, MISC> DispatchFromDyn<Smaht<U, MISC>> for T {}
    |       ++++++
 
-error[E0658]: use of unstable library feature 'dispatch_from_dyn'
+error[E0658]: use of unstable library feature `dispatch_from_dyn`
   --> $DIR/issue-78372.rs:1:5
    |
 LL | use std::ops::DispatchFromDyn;
@@ -46,7 +46,7 @@ LL | use std::ops::DispatchFromDyn;
    = help: add `#![feature(dispatch_from_dyn)]` 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]: use of unstable library feature 'dispatch_from_dyn'
+error[E0658]: use of unstable library feature `dispatch_from_dyn`
   --> $DIR/issue-78372.rs:3:9
    |
 LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
diff --git a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs
index 07133aa5614..7fe2324698e 100644
--- a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs
+++ b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs
@@ -3,7 +3,7 @@
 #![crate_type = "lib"]
 
 use std::mem::TransmuteFrom;
-//~^ ERROR use of unstable library feature 'transmutability' [E0658]
+//~^ ERROR use of unstable library feature `transmutability` [E0658]
 
 use std::mem::Assume;
-//~^ ERROR use of unstable library feature 'transmutability' [E0658]
+//~^ ERROR use of unstable library feature `transmutability` [E0658]
diff --git a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr
index a2096cd53e5..e4ad720ff69 100644
--- a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr
+++ b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'transmutability'
+error[E0658]: use of unstable library feature `transmutability`
   --> $DIR/feature-missing.rs:5:5
    |
 LL | use std::mem::TransmuteFrom;
@@ -8,7 +8,7 @@ LL | use std::mem::TransmuteFrom;
    = help: add `#![feature(transmutability)]` 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]: use of unstable library feature 'transmutability'
+error[E0658]: use of unstable library feature `transmutability`
   --> $DIR/feature-missing.rs:8:5
    |
 LL | use std::mem::Assume;
diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs
index 3c507a9669d..e638f3c6c40 100644
--- a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs
+++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs
@@ -3,12 +3,12 @@
 use std::pat::pattern_type;
 
 type NonNullU32 = pattern_type!(u32 is 1..);
-//~^ use of unstable library feature 'core_pattern_type'
+//~^ use of unstable library feature `core_pattern_type`
 type Percent = pattern_type!(u32 is 0..=100);
-//~^ use of unstable library feature 'core_pattern_type'
+//~^ use of unstable library feature `core_pattern_type`
 type Negative = pattern_type!(i32 is ..=0);
-//~^ use of unstable library feature 'core_pattern_type'
+//~^ use of unstable library feature `core_pattern_type`
 type Positive = pattern_type!(i32 is 0..);
-//~^ use of unstable library feature 'core_pattern_type'
+//~^ use of unstable library feature `core_pattern_type`
 type Always = pattern_type!(Option<u32> is Some(_));
-//~^ use of unstable library feature 'core_pattern_type'
+//~^ use of unstable library feature `core_pattern_type`
diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr b/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr
index 03e91b52a2a..6cbadf370a7 100644
--- a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr
+++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of unstable library feature 'core_pattern_type'
+error[E0658]: use of unstable library feature `core_pattern_type`
   --> $DIR/feature-gate-pattern_types.rs:5:19
    |
 LL | type NonNullU32 = pattern_type!(u32 is 1..);
@@ -8,7 +8,7 @@ LL | type NonNullU32 = pattern_type!(u32 is 1..);
    = help: add `#![feature(core_pattern_type)]` 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]: use of unstable library feature 'core_pattern_type'
+error[E0658]: use of unstable library feature `core_pattern_type`
   --> $DIR/feature-gate-pattern_types.rs:7:16
    |
 LL | type Percent = pattern_type!(u32 is 0..=100);
@@ -18,7 +18,7 @@ LL | type Percent = pattern_type!(u32 is 0..=100);
    = help: add `#![feature(core_pattern_type)]` 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]: use of unstable library feature 'core_pattern_type'
+error[E0658]: use of unstable library feature `core_pattern_type`
   --> $DIR/feature-gate-pattern_types.rs:9:17
    |
 LL | type Negative = pattern_type!(i32 is ..=0);
@@ -28,7 +28,7 @@ LL | type Negative = pattern_type!(i32 is ..=0);
    = help: add `#![feature(core_pattern_type)]` 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]: use of unstable library feature 'core_pattern_type'
+error[E0658]: use of unstable library feature `core_pattern_type`
   --> $DIR/feature-gate-pattern_types.rs:11:17
    |
 LL | type Positive = pattern_type!(i32 is 0..);
@@ -38,7 +38,7 @@ LL | type Positive = pattern_type!(i32 is 0..);
    = help: add `#![feature(core_pattern_type)]` 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]: use of unstable library feature 'core_pattern_type'
+error[E0658]: use of unstable library feature `core_pattern_type`
   --> $DIR/feature-gate-pattern_types.rs:13:15
    |
 LL | type Always = pattern_type!(Option<u32> is Some(_));
diff --git a/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr b/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr
index 96ac481438f..b9bdf6f9a39 100644
--- a/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr
+++ b/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr
@@ -10,6 +10,10 @@ LL |     let foo::Foo { visible, .. } = foo::Foo::default();
    |                  ~~~~~~~~~~~~~~~
 help: if you don't care about this missing field, you can explicitly ignore it
    |
+LL |     let foo::Foo { visible: _, .. } = foo::Foo::default();
+   |                  ~~~~~~~~~~~~~~~~~~
+help: or always ignore missing fields here
+   |
 LL |     let foo::Foo { .. } = foo::Foo::default();
    |                  ~~~~~~