Rollup merge of #156399 - rajgandhi1:unexpected_type_fix, r=jdonszelmann

fix improper ctypes in Znext solver

Fixes rust-lang/rust#156352.
diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml
index 4d2e298..9512e74 100644
--- a/.github/workflows/dependencies.yml
+++ b/.github/workflows/dependencies.yml
@@ -94,11 +94,11 @@
         uses: actions/checkout@v5
 
       - name: download Cargo.lock from update job
-        uses: actions/download-artifact@v4
+        uses: actions/download-artifact@v8
         with:
           name: Cargo-lock
       - name: download cargo-update log from update job
-        uses: actions/download-artifact@v4
+        uses: actions/download-artifact@v8
         with:
           name: cargo-updates
 
diff --git a/Cargo.lock b/Cargo.lock
index a3f7b3a..fdfbb37 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -64,9 +64,9 @@
 
 [[package]]
 name = "annotate-snippets"
-version = "0.12.15"
+version = "0.12.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92570a3f9c98e7e84df84b71d0965ac99b1871fcd75a3773a3bd1bad13f64cf7"
+checksum = "f211a51805bc641f3ad5b7664c77d2547af685cc33b4cd8d31964027a46f13f1"
 dependencies = [
  "anstyle",
  "memchr",
@@ -3958,7 +3958,7 @@
 name = "rustc_errors"
 version = "0.0.0"
 dependencies = [
- "annotate-snippets 0.12.15",
+ "annotate-snippets 0.12.16",
  "anstream",
  "anstyle",
  "derive_setters",
@@ -4010,9 +4010,7 @@
 name = "rustc_feature"
 version = "0.0.0"
 dependencies = [
- "rustc_ast",
  "rustc_data_structures",
- "rustc_hir",
  "rustc_span",
  "serde",
  "serde_json",
@@ -6070,6 +6068,7 @@
 name = "unicode-table-generator"
 version = "0.1.0"
 dependencies = [
+ "rustc-hash 2.1.1",
  "ucd-parse",
 ]
 
diff --git a/RELEASES.md b/RELEASES.md
index 3ef0743..9dfb5c8 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -77,6 +77,7 @@
 - [For `export_name`, `link_name`, and `link_section` attributes, if multiple of the same attribute is present, the first one now takes precedence.](https://github.com/rust-lang/rust/pull/153041)
 - [Update the minimum external LLVM to 21](https://github.com/rust-lang/rust/pull/153684)
 - On `avr` targets, C's `double` type is 32-bit by default, so [change `c_double` to `f32` on `avr` targets to match](https://github.com/rust-lang/rust/pull/154647). This is a breaking change, but necessary to make `c_double` match C's double.
+- [`BTreeMap::append()` was optimized, which may now cause panics for types with incorrect `Ord` impls](https://github.com/rust-lang/rust/pull/153107)
 
 <a id="1.96.0-Internal-Changes"></a>
 
diff --git a/compiler/rustc_abi/src/canon_abi.rs b/compiler/rustc_abi/src/canon_abi.rs
index 316cb05..6b4963a 100644
--- a/compiler/rustc_abi/src/canon_abi.rs
+++ b/compiler/rustc_abi/src/canon_abi.rs
@@ -28,6 +28,7 @@ pub enum CanonAbi {
     Rust,
     RustCold,
     RustPreserveNone,
+    RustTail,
 
     /// An ABI that rustc does not know how to call or define.
     Custom,
@@ -59,7 +60,10 @@ pub enum CanonAbi {
 impl CanonAbi {
     pub fn is_rustic_abi(self) -> bool {
         match self {
-            CanonAbi::Rust | CanonAbi::RustCold | CanonAbi::RustPreserveNone => true,
+            CanonAbi::Rust
+            | CanonAbi::RustCold
+            | CanonAbi::RustPreserveNone
+            | CanonAbi::RustTail => true,
             CanonAbi::C
             | CanonAbi::Custom
             | CanonAbi::Swift
@@ -81,6 +85,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
             CanonAbi::Rust => ExternAbi::Rust,
             CanonAbi::RustCold => ExternAbi::RustCold,
             CanonAbi::RustPreserveNone => ExternAbi::RustPreserveNone,
+            CanonAbi::RustTail => ExternAbi::RustTail,
             CanonAbi::Custom => ExternAbi::Custom,
             CanonAbi::Swift => ExternAbi::Swift,
             CanonAbi::Arm(arm_call) => match arm_call {
diff --git a/compiler/rustc_abi/src/extern_abi.rs b/compiler/rustc_abi/src/extern_abi.rs
index 3def8a8..f30b923 100644
--- a/compiler/rustc_abi/src/extern_abi.rs
+++ b/compiler/rustc_abi/src/extern_abi.rs
@@ -49,6 +49,11 @@ pub enum ExternAbi {
     /// forcing callers to save all registers.
     RustPreserveNone,
 
+    /// Ensures that calls in tail position can always be optimized into a jump.
+    ///
+    /// This ABI is not stable, and relies on LLVM implementation details.
+    RustTail,
+
     /// Unstable impl detail that directly uses Rust types to describe the ABI to LLVM.
     /// Even normally-compatible Rust types can become ABI-incompatible with this ABI!
     Unadjusted,
@@ -205,6 +210,7 @@ fn from_str(s: &str) -> Result<$e_name, Self::Err> {
             System { unwind: true } =><= "system-unwind",
             SysV64 { unwind: false } =><= "sysv64",
             SysV64 { unwind: true } =><= "sysv64-unwind",
+            RustTail =><= "tail",
             Thiscall { unwind: false } =><= "thiscall",
             Thiscall { unwind: true } =><= "thiscall-unwind",
             Unadjusted =><= "unadjusted",
@@ -280,7 +286,7 @@ impl ExternAbi {
     /// - are subject to change between compiler versions
     pub fn is_rustic_abi(self) -> bool {
         use ExternAbi::*;
-        matches!(self, Rust | RustCall | RustCold | RustPreserveNone)
+        matches!(self, Rust | RustCall | RustCold | RustPreserveNone | RustTail)
     }
 
     /// Returns whether the ABI supports C variadics. This only controls whether we allow *imports*
@@ -354,6 +360,7 @@ pub fn supports_guaranteed_tail_call(self) -> bool {
             | Self::SysV64 { .. }
             | Self::Win64 { .. }
             | Self::RustPreserveNone
+            | Self::RustTail
             | Self::Swift => true,
         }
     }
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index 6e036e5..b8339c7 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -509,8 +509,6 @@ pub enum WherePredicateKind {
     BoundPredicate(WhereBoundPredicate),
     /// A lifetime predicate (e.g., `'a: 'b + 'c`).
     RegionPredicate(WhereRegionPredicate),
-    /// An equality predicate (unsupported).
-    EqPredicate(WhereEqPredicate),
 }
 
 /// A type bound.
@@ -3908,6 +3906,13 @@ pub struct EiiImpl {
     pub is_default: bool,
 }
 
+#[derive(Clone, Encodable, Decodable, Debug, Walkable, PartialEq, Eq)]
+pub enum DelegationSource {
+    Single,
+    List,
+    Glob,
+}
+
 #[derive(Clone, Encodable, Decodable, Debug, Walkable)]
 pub struct Delegation {
     /// Path resolution id.
@@ -3918,7 +3923,7 @@ pub struct Delegation {
     pub rename: Option<Ident>,
     pub body: Option<Box<Block>>,
     /// The item was expanded from a glob delegation item.
-    pub from_glob: bool,
+    pub source: DelegationSource,
 }
 
 impl Delegation {
diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs
index 1e96d1d..19255e5 100644
--- a/compiler/rustc_ast/src/visit.rs
+++ b/compiler/rustc_ast/src/visit.rs
@@ -431,6 +431,7 @@ pub fn ctxt(&self) -> Option<FnCtxt> {
             Delegation,
             DelegationMac,
             DelegationSuffixes,
+            DelegationSource,
             DelimArgs,
             DelimSpan,
             EnumDef,
diff --git a/compiler/rustc_ast_lowering/src/asm.rs b/compiler/rustc_ast_lowering/src/asm.rs
index e8df8ce..5628dff 100644
--- a/compiler/rustc_ast_lowering/src/asm.rs
+++ b/compiler/rustc_ast_lowering/src/asm.rs
@@ -9,8 +9,7 @@
 use rustc_span::{Span, sym};
 use rustc_target::asm;
 
-use super::LoweringContext;
-use super::errors::{
+use crate::diagnostics::{
     AbiSpecifiedMultipleTimes, AttSyntaxOnlyX86, ClobberAbiNotSupported,
     InlineAsmUnsupportedTarget, InvalidAbiClobberAbi, InvalidAsmTemplateModifierConst,
     InvalidAsmTemplateModifierLabel, InvalidAsmTemplateModifierRegClass,
@@ -18,7 +17,9 @@
     InvalidRegisterClass, RegisterClassOnlyClobber, RegisterClassOnlyClobberStable,
     RegisterConflict,
 };
-use crate::{AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, ParamMode};
+use crate::{
+    AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode,
+};
 
 impl<'hir> LoweringContext<'_, 'hir> {
     pub(crate) fn lower_inline_asm(
diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs
index a5cd643..68ae9e6 100644
--- a/compiler/rustc_ast_lowering/src/delegation.rs
+++ b/compiler/rustc_ast_lowering/src/delegation.rs
@@ -37,24 +37,29 @@
 //! also be emitted during HIR ty lowering.
 
 use std::iter;
+use std::ops::ControlFlow;
 
 use ast::visit::Visitor;
 use hir::def::{DefKind, Res};
 use hir::{BodyId, HirId};
 use rustc_abi::ExternAbi;
 use rustc_ast as ast;
+use rustc_ast::node_id::NodeMap;
 use rustc_ast::*;
 use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
 use rustc_hir::attrs::{AttributeKind, InlineAttr};
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_hir::{self as hir, FnDeclFlags};
 use rustc_middle::span_bug;
-use rustc_middle::ty::{Asyncness, TyCtxt};
+use rustc_middle::ty::{Asyncness, PerOwnerResolverData, TyCtxt};
 use rustc_span::symbol::kw;
 use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
 
 use crate::delegation::generics::{GenericsGenerationResult, GenericsGenerationResults};
-use crate::errors::{CycleInDelegationSignatureResolution, UnresolvedDelegationCallee};
+use crate::diagnostics::{
+    CycleInDelegationSignatureResolution, DelegationAttemptedBlockWithDefsDeletion,
+    DelegationBlockSpecifiedWhenNoParams, UnresolvedDelegationCallee,
+};
 use crate::{
     AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode,
     ResolverAstLoweringExt, index_crate,
@@ -198,10 +203,14 @@ pub(crate) fn lower_delegation(
 
         let (param_count, c_variadic) = self.param_count(sig_id);
 
+        if !self.check_block_soundness(delegation, sig_id, is_method, param_count) {
+            return self.generate_delegation_error(span, delegation);
+        }
+
         let mut generics = self.uplift_delegation_generics(delegation, sig_id, is_method);
 
         let (body_id, call_expr_id) =
-            self.lower_delegation_body(delegation, is_method, param_count, &mut generics, span);
+            self.lower_delegation_body(delegation, sig_id, param_count, &mut generics, span);
 
         let decl = self.lower_delegation_decl(
             sig_id,
@@ -227,6 +236,82 @@ pub(crate) fn lower_delegation(
         DelegationResults { body_id, sig, ident, generics }
     }
 
+    fn check_block_soundness(
+        &self,
+        delegation: &Delegation,
+        sig_id: DefId,
+        is_method: bool,
+        param_count: usize,
+    ) -> bool {
+        let Some(block) = delegation.body.as_ref() else { return true };
+        let should_generate_block = self.should_generate_block(delegation, sig_id, is_method);
+
+        // Report an error if user has explicitly specified delegation's target expression
+        // in a single delegation when reused function has no params.
+        if param_count == 0 && should_generate_block {
+            self.dcx().emit_err(DelegationBlockSpecifiedWhenNoParams { span: block.span });
+            return false;
+        }
+
+        struct DefinitionsFinder<'a> {
+            all_owners: &'a NodeMap<PerOwnerResolverData<'a>>,
+            // `self.owner.node_id_to_def_id`
+            nested_def_ids: &'a NodeMap<LocalDefId>,
+        }
+
+        impl<'a> ast::visit::Visitor<'a> for DefinitionsFinder<'a> {
+            type Result = ControlFlow<()>;
+
+            fn visit_id(&mut self, id: NodeId) -> Self::Result {
+                /*
+                    (from `tests\ui\delegation\target-expr-removal-defs-inside.rs`):
+                    ```rust
+                        reuse impl Trait for S1 {
+                            some::path::<{ fn foo() {} }>::xd();
+                            fn foo() {}
+                            self.0
+                        }
+                    ```
+
+                    Constant from unresolved path will be in `nested_owners`,
+                    `fn foo() {}` will not be in `nested_owners` but will be in `owners`,
+                    both have `LocalDefId`, so we check those two maps.
+                */
+                match self.all_owners.contains_key(&id) || self.nested_def_ids.contains_key(&id) {
+                    true => ControlFlow::Break(()),
+                    false => ControlFlow::Continue(()),
+                }
+            }
+        }
+
+        let mut collector = DefinitionsFinder {
+            all_owners: &self.resolver.owners,
+            nested_def_ids: &self.owner.node_id_to_def_id,
+        };
+
+        let contains_defs = collector.visit_block(block).is_break();
+
+        // If there are definitions inside and we can't delete target expression, so report an error.
+        // FIXME(fn_delegation): support deletion of target expression with defs inside.
+        if !should_generate_block && contains_defs {
+            self.dcx().emit_err(DelegationAttemptedBlockWithDefsDeletion { span: block.span });
+            return false;
+        }
+
+        true
+    }
+
+    fn should_generate_block(
+        &self,
+        delegation: &Delegation,
+        sig_id: DefId,
+        is_method: bool,
+    ) -> bool {
+        is_method
+            || matches!(self.tcx.def_kind(sig_id), DefKind::Fn)
+            || matches!(delegation.source, DelegationSource::Single)
+    }
+
     fn add_attrs_if_needed(&mut self, span: Span, sig_id: DefId) {
         let new_attrs =
             self.create_new_attrs(ATTRS_ADDITIONS, span, sig_id, self.attrs.get(&PARENT_ID));
@@ -415,7 +500,7 @@ fn generate_arg(
     fn lower_delegation_body(
         &mut self,
         delegation: &Delegation,
-        is_method: bool,
+        sig_id: DefId,
         param_count: usize,
         generics: &mut GenericsGenerationResults<'hir>,
         span: Span,
@@ -428,6 +513,8 @@ fn lower_delegation_body(
             let mut args: Vec<hir::Expr<'_>> = Vec::with_capacity(param_count);
             let mut stmts: &[hir::Stmt<'hir>] = &[];
 
+            let is_method = this.is_method(sig_id, span);
+
             for idx in 0..param_count {
                 let (param, pat_node_id) = this.generate_param(is_method, idx, span);
                 parameters.push(param);
@@ -437,6 +524,7 @@ fn lower_delegation_body(
 
                 let arg = if let Some(block) = block
                     && idx == 0
+                    && this.should_generate_block(delegation, sig_id, is_method)
                 {
                     let mut self_resolver = SelfResolver {
                         ctxt: this,
@@ -467,17 +555,6 @@ fn lower_delegation_body(
                 args.push(arg);
             }
 
-            // If we have no params in signature function but user still wrote some code in
-            // delegation body, then add this code as first arg, eventually an error will be shown,
-            // also nested delegations may need to access information about this code (#154332),
-            // so it is better to leave this code as opposed to bodies of extern functions,
-            // which are completely erased from existence.
-            if param_count == 0
-                && let Some(block) = block
-            {
-                args.push(this.lower_block_expr(&block));
-            }
-
             let (final_expr, hir_id) =
                 this.finalize_body_lowering(delegation, stmts, args, generics, span);
 
diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/diagnostics.rs
similarity index 94%
rename from compiler/rustc_ast_lowering/src/errors.rs
rename to compiler/rustc_ast_lowering/src/diagnostics.rs
index a1c1d1e..31f0942 100644
--- a/compiler/rustc_ast_lowering/src/errors.rs
+++ b/compiler/rustc_ast_lowering/src/diagnostics.rs
@@ -123,6 +123,17 @@ pub(crate) struct AwaitOnlyInAsyncFnAndBlocks {
 }
 
 #[derive(Diagnostic)]
+#[diag("a function cannot be both `comptime` and `const`")]
+pub(crate) struct ConstComptimeFn {
+    #[primary_span]
+    #[suggestion("remove the `const`", applicability = "machine-applicable", code = "")]
+    #[note("`const` implies the function can be called at runtime, too")]
+    pub span: Span,
+    #[label("`comptime` because of this")]
+    pub attr_span: Span,
+}
+
+#[derive(Diagnostic)]
 #[diag("too many parameters for a coroutine (expected 0 or 1 parameters)", code = E0628)]
 pub(crate) struct CoroutineTooManyParameters {
     #[primary_span]
@@ -535,3 +546,17 @@ pub(crate) struct CycleInDelegationSignatureResolution {
     #[primary_span]
     pub span: Span,
 }
+
+#[derive(Diagnostic)]
+#[diag("delegation's target expression is specified for function with no params")]
+pub(crate) struct DelegationBlockSpecifiedWhenNoParams {
+    #[primary_span]
+    pub span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag("attempted to delete delegation's target expression that contains definitions inside")]
+pub(crate) struct DelegationAttemptedBlockWithDefsDeletion {
+    #[primary_span]
+    pub span: Span,
+}
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index ce20aaf..23c7159 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -19,17 +19,17 @@
 
 mod closure;
 
-use super::errors::{
+use crate::diagnostics::{
     AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks,
-    FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd, MatchArmWithNoBody,
-    MoveExprOnlyInPlainClosures, NeverPatternWithBody, NeverPatternWithGuard,
-    UnderscoreExprLhsAssign,
+    FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd,
+    InvalidLegacyConstGenericArg, MatchArmWithNoBody, MoveExprOnlyInPlainClosures,
+    NeverPatternWithBody, NeverPatternWithGuard, UnderscoreExprLhsAssign, UseConstGenericArg,
+    YieldInClosure,
 };
-use super::{
-    GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode, ResolverAstLoweringExt,
+use crate::{
+    AllowReturnTypeNotation, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext,
+    ParamMode, ResolverAstLoweringExt, TryBlockScope,
 };
-use crate::errors::{InvalidLegacyConstGenericArg, UseConstGenericArg, YieldInClosure};
-use crate::{AllowReturnTypeNotation, ImplTraitPosition, TryBlockScope};
 
 pub(super) struct WillCreateDefIdsVisitor;
 
diff --git a/compiler/rustc_ast_lowering/src/expr/closure.rs b/compiler/rustc_ast_lowering/src/expr/closure.rs
index 1c2a22e..cc2c6ae2 100644
--- a/compiler/rustc_ast_lowering/src/expr/closure.rs
+++ b/compiler/rustc_ast_lowering/src/expr/closure.rs
@@ -7,7 +7,7 @@
 
 use super::{LoweringContext, MoveExprInitializerFinder, MoveExprState};
 use crate::FnDeclKind;
-use crate::errors::{ClosureCannotBeStatic, CoroutineTooManyParameters};
+use crate::diagnostics::{ClosureCannotBeStatic, CoroutineTooManyParameters};
 
 impl<'hir> LoweringContext<'_, 'hir> {
     // Entry point for `ExprKind::Closure`. Plain closures go through
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs
index 99c3155..336c644 100644
--- a/compiler/rustc_ast_lowering/src/item.rs
+++ b/compiler/rustc_ast_lowering/src/item.rs
@@ -19,12 +19,15 @@
 use thin_vec::ThinVec;
 use tracing::instrument;
 
-use super::errors::{InvalidAbi, InvalidAbiSuggestion, TupleStructWithDefault, UnionWithDefault};
+use super::diagnostics::{
+    InvalidAbi, InvalidAbiSuggestion, TupleStructWithDefault, UnionWithDefault,
+};
 use super::stability::{enabled_names, gate_unstable_abi};
 use super::{
     AstOwner, FnDeclKind, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext,
     ParamMode, RelaxedBoundForbiddenReason, RelaxedBoundPolicy, ResolverAstLoweringExt,
 };
+use crate::diagnostics::ConstComptimeFn;
 
 /// Wraps either IndexVec (during `hir_crate`), which acts like a primary
 /// storage for most of the MaybeOwners, or FxIndexMap during delayed AST -> HIR
@@ -1771,12 +1774,23 @@ pub(super) fn lower_fn_header(
             safety.into()
         };
 
-        hir::FnHeader {
-            safety,
-            asyncness,
-            constness: self.lower_constness(h.constness),
-            abi: self.lower_extern(h.ext),
+        let mut constness = self.lower_constness(h.constness);
+        if let Some(&attr_span) = find_attr!(attrs, RustcComptime(span) => span) {
+            match std::mem::replace(&mut constness, rustc_hir::Constness::Const { always: true }) {
+                rustc_hir::Constness::Const { always: true } => {
+                    unreachable!("lower_constness cannot produce comptime")
+                }
+                // A function can't be `const` and `comptime` at the same time
+                rustc_hir::Constness::Const { always: false } => {
+                    let Const::Yes(span) = h.constness else { unreachable!() };
+                    self.dcx().emit_err(ConstComptimeFn { span, attr_span });
+                }
+                // Good
+                rustc_hir::Constness::NotConst => {}
+            }
         }
+
+        hir::FnHeader { safety, asyncness, constness, abi: self.lower_extern(h.ext) }
     }
 
     pub(super) fn lower_abi(&mut self, abi_str: StrLit) -> ExternAbi {
@@ -1838,7 +1852,7 @@ fn error_on_invalid_abi(&self, abi: StrLit) {
 
     pub(super) fn lower_constness(&mut self, c: Const) -> hir::Constness {
         match c {
-            Const::Yes(_) => hir::Constness::Const,
+            Const::Yes(_) => hir::Constness::Const { always: false },
             Const::No => hir::Constness::NotConst,
         }
     }
@@ -2109,18 +2123,6 @@ fn lower_where_predicate(
                     in_where_clause: true,
                 })
             }
-            WherePredicateKind::EqPredicate(WhereEqPredicate { lhs_ty, rhs_ty }) => {
-                hir::WherePredicateKind::EqPredicate(hir::WhereEqPredicate {
-                    lhs_ty: self.lower_ty_alloc(
-                        lhs_ty,
-                        ImplTraitContext::Disallowed(ImplTraitPosition::Bound),
-                    ),
-                    rhs_ty: self.lower_ty_alloc(
-                        rhs_ty,
-                        ImplTraitContext::Disallowed(ImplTraitPosition::Bound),
-                    ),
-                })
-            }
         });
         hir::WherePredicate { hir_id, span, kind }
     }
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index 6dc7de2..8b4a279 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -70,7 +70,7 @@
 use thin_vec::ThinVec;
 use tracing::{debug, instrument, trace};
 
-use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait};
+use crate::diagnostics::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait};
 use crate::item::Owners;
 
 macro_rules! arena_vec {
@@ -83,7 +83,7 @@ macro_rules! arena_vec {
 mod block;
 mod contract;
 mod delegation;
-mod errors;
+mod diagnostics;
 mod expr;
 mod format;
 mod index;
@@ -1145,17 +1145,21 @@ fn lower_assoc_item_constraint(
                     {
                         let err = match (&data.inputs[..], &data.output) {
                             ([_, ..], FnRetTy::Default(_)) => {
-                                errors::BadReturnTypeNotation::Inputs { span: data.inputs_span }
+                                diagnostics::BadReturnTypeNotation::Inputs {
+                                    span: data.inputs_span,
+                                }
                             }
                             ([], FnRetTy::Default(_)) => {
-                                errors::BadReturnTypeNotation::NeedsDots { span: data.inputs_span }
+                                diagnostics::BadReturnTypeNotation::NeedsDots {
+                                    span: data.inputs_span,
+                                }
                             }
                             // The case `T: Trait<method(..) -> Ret>` is handled in the parser.
                             (_, FnRetTy::Ty(ty)) => {
                                 let span = data.inputs_span.shrink_to_hi().to(ty.span);
-                                errors::BadReturnTypeNotation::Output {
+                                diagnostics::BadReturnTypeNotation::Output {
                                     span,
-                                    suggestion: errors::RTNSuggestion {
+                                    suggestion: diagnostics::RTNSuggestion {
                                         output: span,
                                         input: data.inputs_span,
                                     },
@@ -1226,7 +1230,7 @@ fn lower_assoc_item_constraint(
                         _ => None,
                     };
 
-                    let guar = self.dcx().emit_err(errors::MisplacedAssocTyBinding {
+                    let guar = self.dcx().emit_err(diagnostics::MisplacedAssocTyBinding {
                         span: constraint.span,
                         suggestion,
                     });
@@ -1529,7 +1533,7 @@ fn lower_ty(&mut self, t: &Ty, itctx: ImplTraitContext) -> hir::Ty<'hir> {
                             ast::GenericBound::Use(_, span) => Some(span),
                             _ => None,
                         }) {
-                            self.tcx.dcx().emit_err(errors::NoPreciseCapturesOnApit { span });
+                            self.tcx.dcx().emit_err(diagnostics::NoPreciseCapturesOnApit { span });
                         }
 
                         let def_id = self.local_def_id(*def_node_id);
@@ -2123,7 +2127,7 @@ fn lower_generic_param_kind(
                     .filter(|_| match source {
                         hir::GenericParamSource::Generics => true,
                         hir::GenericParamSource::Binder => {
-                            self.dcx().emit_err(errors::GenericParamDefaultInBinder {
+                            self.dcx().emit_err(diagnostics::GenericParamDefaultInBinder {
                                 span: param.span(),
                             });
 
@@ -2154,7 +2158,8 @@ fn lower_generic_param_kind(
                     .filter(|anon_const| match source {
                         hir::GenericParamSource::Generics => true,
                         hir::GenericParamSource::Binder => {
-                            let err = errors::GenericParamDefaultInBinder { span: param.span() };
+                            let err =
+                                diagnostics::GenericParamDefaultInBinder { span: param.span() };
                             if expr::WillCreateDefIdsVisitor
                                 .visit_expr(&anon_const.value)
                                 .is_break()
diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs
index cf0615b..8780b70 100644
--- a/compiler/rustc_ast_lowering/src/pat.rs
+++ b/compiler/rustc_ast_lowering/src/pat.rs
@@ -7,10 +7,10 @@
 use rustc_middle::span_bug;
 use rustc_span::{DesugaringKind, Ident, Span, Spanned, respan};
 
-use super::errors::{
+use crate::diagnostics::{
     ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding,
 };
-use super::{
+use crate::{
     AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode,
 };
 
diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs
index f5a306a..42c4af5 100644
--- a/compiler/rustc_ast_lowering/src/path.rs
+++ b/compiler/rustc_ast_lowering/src/path.rs
@@ -11,11 +11,11 @@
 use smallvec::smallvec;
 use tracing::{debug, instrument};
 
-use super::errors::{
+use crate::diagnostics::{
     AsyncBoundNotOnTrait, AsyncBoundOnlyForFnTraits, BadReturnTypeNotation,
     GenericTypeWithParentheses, RTNSuggestion, UseAngleBrackets,
 };
-use super::{
+use crate::{
     AllowReturnTypeNotation, GenericArgsCtor, GenericArgsMode, ImplTraitContext, ImplTraitPosition,
     LifetimeRes, LoweringContext, ParamMode,
 };
diff --git a/compiler/rustc_ast_lowering/src/stability.rs b/compiler/rustc_ast_lowering/src/stability.rs
index 00b6a35..b58087e 100644
--- a/compiler/rustc_ast_lowering/src/stability.rs
+++ b/compiler/rustc_ast_lowering/src/stability.rs
@@ -100,6 +100,9 @@ pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
             feature: sym::rust_preserve_none_cc,
             explain: GateReason::Experimental,
         }),
+        ExternAbi::RustTail => {
+            Err(UnstableAbi { abi, feature: sym::rust_tail_cc, explain: GateReason::Experimental })
+        }
         ExternAbi::RustInvalid => {
             Err(UnstableAbi { abi, feature: sym::rustc_attrs, explain: GateReason::ImplDetail })
         }
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs
index afaee6e..081de1a 100644
--- a/compiler/rustc_ast_passes/src/ast_validation.rs
+++ b/compiler/rustc_ast_passes/src/ast_validation.rs
@@ -17,7 +17,6 @@
 //! require name resolution or type checking, or other kinds of complex analysis.
 
 use std::mem;
-use std::ops::{Deref, DerefMut};
 use std::str::FromStr;
 
 use itertools::{Either, Itertools};
@@ -37,9 +36,8 @@
 };
 use rustc_span::{Ident, Span, kw, sym};
 use rustc_target::spec::{AbiMap, AbiMapping};
-use thin_vec::thin_vec;
 
-use crate::errors::{self, TildeConstReason};
+use crate::diagnostics::{self, TildeConstReason};
 
 /// Is `self` allowed semantically as the first parameter in an `FnDecl`?
 enum SelfSemantic {
@@ -161,7 +159,7 @@ fn with_tilde_const(
     fn check_type_alias_where_clause_location(
         &mut self,
         ty_alias: &TyAlias,
-    ) -> Result<(), errors::WhereClauseBeforeTypeAlias> {
+    ) -> Result<(), diagnostics::WhereClauseBeforeTypeAlias> {
         if ty_alias.ty.is_none() || !ty_alias.generics.where_clause.has_where_token {
             return Ok(());
         }
@@ -189,16 +187,16 @@ fn check_type_alias_where_clause_location(
                 state.print_where_predicate(p);
             }
 
-            errors::WhereClauseBeforeTypeAliasSugg::Move {
+            diagnostics::WhereClauseBeforeTypeAliasSugg::Move {
                 left: span,
                 snippet: state.s.eof(),
                 right: ty_alias.after_where_clause.span.shrink_to_hi(),
             }
         } else {
-            errors::WhereClauseBeforeTypeAliasSugg::Remove { span }
+            diagnostics::WhereClauseBeforeTypeAliasSugg::Remove { span }
         };
 
-        Err(errors::WhereClauseBeforeTypeAlias { span, sugg })
+        Err(diagnostics::WhereClauseBeforeTypeAlias { span, sugg })
     }
 
     fn with_impl_trait(&mut self, outer_span: Option<Span>, f: impl FnOnce(&mut Self)) {
@@ -226,7 +224,7 @@ fn walk_ty(&mut self, t: &Ty) {
                 if let Some(bound1) = use_bounds.next()
                     && let Some(bound2) = use_bounds.next()
                 {
-                    self.dcx().emit_err(errors::DuplicatePreciseCapturing { bound1, bound2 });
+                    self.dcx().emit_err(diagnostics::DuplicatePreciseCapturing { bound1, bound2 });
                 }
             }
             TyKind::TraitObject(..) => self
@@ -241,12 +239,16 @@ fn dcx(&self) -> DiagCtxtHandle<'a> {
         self.sess.dcx()
     }
 
-    fn visibility_not_permitted(&self, vis: &Visibility, note: errors::VisibilityNotPermittedNote) {
+    fn visibility_not_permitted(
+        &self,
+        vis: &Visibility,
+        note: diagnostics::VisibilityNotPermittedNote,
+    ) {
         if let VisibilityKind::Inherited = vis.kind {
             return;
         }
 
-        self.dcx().emit_err(errors::VisibilityNotPermitted {
+        self.dcx().emit_err(diagnostics::VisibilityNotPermitted {
             span: vis.span,
             note,
             remove_qualifier_sugg: vis.span,
@@ -276,7 +278,7 @@ fn check_impl_fn_not_const(&self, constness: Const, parent_constness: Const) {
             return;
         };
 
-        self.dcx().emit_err(errors::ImplFnConst { span, parent_constness });
+        self.dcx().emit_err(diagnostics::ImplFnConst { span, parent_constness });
     }
 
     fn check_trait_fn_not_const(&self, constness: Const, parent: &TraitOrImpl) {
@@ -309,7 +311,7 @@ fn check_trait_fn_not_const(&self, constness: Const, parent: &TraitOrImpl) {
         };
 
         let parent_constness = parent.constness();
-        self.dcx().emit_err(errors::TraitFnConst {
+        self.dcx().emit_err(diagnostics::TraitFnConst {
             span,
             in_impl: matches!(parent, TraitOrImpl::TraitImpl { .. }),
             const_context_label: parent_constness,
@@ -341,7 +343,7 @@ fn check_async_fn_in_const_trait_or_impl(&self, sig: &FnSig, parent: &TraitOrImp
             TraitOrImpl::Impl { .. } => "impl",
         };
 
-        self.dcx().emit_err(errors::AsyncFnInConstTraitOrTraitImpl {
+        self.dcx().emit_err(diagnostics::AsyncFnInConstTraitOrTraitImpl {
             async_keyword,
             context,
             const_keyword,
@@ -361,7 +363,7 @@ fn check_decl_num_args(&self, fn_decl: &FnDecl) {
         let max_num_args: usize = u16::MAX.into();
         if fn_decl.inputs.len() > max_num_args {
             let Param { span, .. } = fn_decl.inputs[0];
-            self.dcx().emit_fatal(errors::FnParamTooMany { span, max_num_args });
+            self.dcx().emit_fatal(diagnostics::FnParamTooMany { span, max_num_args });
         }
     }
 
@@ -373,7 +375,7 @@ fn check_decl_cvariadic_pos(&self, fn_decl: &FnDecl) {
             [ps @ .., _] => {
                 for Param { ty, span, .. } in ps {
                     if let TyKind::CVarArgs = ty.kind {
-                        self.dcx().emit_err(errors::FnParamCVarArgsNotLast { span: *span });
+                        self.dcx().emit_err(diagnostics::FnParamCVarArgsNotLast { span: *span });
                     }
                 }
             }
@@ -400,9 +402,9 @@ fn check_decl_attrs(&self, fn_decl: &FnDecl) {
             })
             .for_each(|attr| {
                 if attr.is_doc_comment() {
-                    self.dcx().emit_err(errors::FnParamDocComment { span: attr.span });
+                    self.dcx().emit_err(diagnostics::FnParamDocComment { span: attr.span });
                 } else {
-                    self.dcx().emit_err(errors::FnParamForbiddenAttr { span: attr.span });
+                    self.dcx().emit_err(diagnostics::FnParamForbiddenAttr { span: attr.span });
                 }
             });
     }
@@ -410,7 +412,7 @@ fn check_decl_attrs(&self, fn_decl: &FnDecl) {
     fn check_decl_self_param(&self, fn_decl: &FnDecl, self_semantic: SelfSemantic) {
         if let (SelfSemantic::No, [param, ..]) = (self_semantic, &*fn_decl.inputs) {
             if param.is_self() {
-                self.dcx().emit_err(errors::FnParamForbiddenSelf { span: param.span });
+                self.dcx().emit_err(diagnostics::FnParamForbiddenSelf { span: param.span });
             }
         }
     }
@@ -424,6 +426,7 @@ fn check_extern_fn_signature(&self, abi: ExternAbi, ctxt: FnCtxt, ident: &Ident,
                     | CanonAbi::Rust
                     | CanonAbi::RustCold
                     | CanonAbi::RustPreserveNone
+                    | CanonAbi::RustTail
                     | CanonAbi::Swift
                     | CanonAbi::Arm(_)
                     | CanonAbi::X86(_) => { /* nothing to check */ }
@@ -462,7 +465,8 @@ fn check_extern_fn_signature(&self, abi: ExternAbi, ctxt: FnCtxt, ident: &Ident,
                                 if spans.is_empty() {
                                     spans = vec![sig.span];
                                 }
-                                self.dcx().emit_err(errors::AbiX86Interrupt { spans, param_count });
+                                self.dcx()
+                                    .emit_err(diagnostics::AbiX86Interrupt { spans, param_count });
                             }
 
                             self.reject_return(abi, sig);
@@ -485,12 +489,15 @@ fn reject_safe_fn(&self, abi: ExternAbi, ctxt: FnCtxt, sig: &FnSig) {
             Safety::Safe(safe_span) => {
                 let source_map = self.sess.psess.source_map();
                 let safe_span = source_map.span_until_non_whitespace(safe_span.to(sig.span));
-                dcx.emit_err(errors::AbiCustomSafeForeignFunction { span: sig.span, safe_span });
+                dcx.emit_err(diagnostics::AbiCustomSafeForeignFunction {
+                    span: sig.span,
+                    safe_span,
+                });
             }
             Safety::Default => match ctxt {
                 FnCtxt::Foreign => { /* all good */ }
                 FnCtxt::Free | FnCtxt::Assoc(_) => {
-                    dcx.emit_err(errors::AbiCustomSafeFunction {
+                    dcx.emit_err(diagnostics::AbiCustomSafeFunction {
                         span: sig.span,
                         abi,
                         unsafe_span: sig.span.shrink_to_lo(),
@@ -508,7 +515,7 @@ fn reject_coroutine(&self, abi: ExternAbi, sig: &FnSig) {
                 .source_map()
                 .span_until_non_whitespace(coroutine_kind.span().to(sig.span));
 
-            self.dcx().emit_err(errors::AbiCannotBeCoroutine {
+            self.dcx().emit_err(diagnostics::AbiCannotBeCoroutine {
                 span: sig.span,
                 abi,
                 coroutine_kind_span,
@@ -525,7 +532,7 @@ fn reject_return(&self, abi: ExternAbi, sig: &FnSig) {
                 _ => true,
             }
         {
-            self.dcx().emit_err(errors::AbiMustNotHaveReturnType { span: ret_ty.span, abi });
+            self.dcx().emit_err(diagnostics::AbiMustNotHaveReturnType { span: ret_ty.span, abi });
         }
     }
 
@@ -546,7 +553,7 @@ fn reject_params_or_return(&self, abi: ExternAbi, ident: &Ident, sig: &FnSig) {
             let suggestion_span = header_span.shrink_to_hi().to(sig.decl.output.span());
             let padding = if header_span.is_empty() { "" } else { " " };
 
-            self.dcx().emit_err(errors::AbiMustNotHaveParametersOrReturnType {
+            self.dcx().emit_err(diagnostics::AbiMustNotHaveParametersOrReturnType {
                 spans,
                 symbol: ident.name,
                 suggestion_span,
@@ -567,7 +574,7 @@ fn check_item_safety(&self, span: Span, safety: Safety) {
                 if matches!(safety, Safety::Unsafe(_) | Safety::Safe(_))
                     && extern_safety == Safety::Default
                 {
-                    self.dcx().emit_err(errors::InvalidSafetyOnExtern {
+                    self.dcx().emit_err(diagnostics::InvalidSafetyOnExtern {
                         item_span: span,
                         block: Some(self.current_extern_span().shrink_to_lo()),
                     });
@@ -575,7 +582,7 @@ fn check_item_safety(&self, span: Span, safety: Safety) {
             }
             None => {
                 if matches!(safety, Safety::Safe(_)) {
-                    self.dcx().emit_err(errors::InvalidSafetyOnItem { span });
+                    self.dcx().emit_err(diagnostics::InvalidSafetyOnItem { span });
                 }
             }
         }
@@ -583,7 +590,7 @@ fn check_item_safety(&self, span: Span, safety: Safety) {
 
     fn check_fn_ptr_safety(&self, span: Span, safety: Safety) {
         if matches!(safety, Safety::Safe(_)) {
-            self.dcx().emit_err(errors::InvalidSafetyOnFnPtr { span });
+            self.dcx().emit_err(diagnostics::InvalidSafetyOnFnPtr { span });
         }
     }
 
@@ -597,11 +604,11 @@ fn check_defaultness(
         match defaultness {
             Defaultness::Default(def_span) if matches!(allow_default, AllowDefault::No) => {
                 let span = self.sess.source_map().guess_head_span(span);
-                self.dcx().emit_err(errors::ForbiddenDefault { span, def_span });
+                self.dcx().emit_err(diagnostics::ForbiddenDefault { span, def_span });
             }
             Defaultness::Final(def_span) if matches!(allow_final, AllowFinal::No) => {
                 let span = self.sess.source_map().guess_head_span(span);
-                self.dcx().emit_err(errors::ForbiddenFinal { span, def_span });
+                self.dcx().emit_err(diagnostics::ForbiddenFinal { span, def_span });
             }
             _ => (),
         }
@@ -612,7 +619,7 @@ fn check_final_has_body(&self, item: &Item<AssocItemKind>, defaultness: Defaultn
             && let Defaultness::Final(def_span) = defaultness
         {
             let span = self.sess.source_map().guess_head_span(item.span);
-            self.dcx().emit_err(errors::ForbiddenFinalWithoutBody { span, def_span });
+            self.dcx().emit_err(diagnostics::ForbiddenFinalWithoutBody { span, def_span });
         }
     }
 
@@ -635,12 +642,12 @@ fn check_type_no_bounds(&self, bounds: &[GenericBound], ctx: &str) {
             [b0] => b0.span(),
             [b0, .., bl] => b0.span().to(bl.span()),
         };
-        self.dcx().emit_err(errors::BoundInContext { span, ctx });
+        self.dcx().emit_err(diagnostics::BoundInContext { span, ctx });
     }
 
     fn check_foreign_ty_genericless(&self, generics: &Generics, after_where_clause: &WhereClause) {
         let cannot_have = |span, descr, remove_descr| {
-            self.dcx().emit_err(errors::ExternTypesCannotHave {
+            self.dcx().emit_err(diagnostics::ExternTypesCannotHave {
                 span,
                 descr,
                 remove_descr,
@@ -666,7 +673,7 @@ fn check_foreign_kind_bodyless(&self, ident: Ident, kind: &str, body_span: Optio
         let Some(body_span) = body_span else {
             return;
         };
-        self.dcx().emit_err(errors::BodyInExtern {
+        self.dcx().emit_err(diagnostics::BodyInExtern {
             span: ident.span,
             body: body_span,
             block: self.current_extern_span(),
@@ -679,7 +686,7 @@ fn check_foreign_fn_bodyless(&self, ident: Ident, body: Option<&Block>) {
         let Some(body) = body else {
             return;
         };
-        self.dcx().emit_err(errors::FnBodyInExtern {
+        self.dcx().emit_err(diagnostics::FnBodyInExtern {
             span: ident.span,
             body: body.span,
             block: self.current_extern_span(),
@@ -697,7 +704,7 @@ fn check_foreign_fn_headerless(
         FnHeader { safety: _, coroutine_kind, constness, ext }: FnHeader,
     ) {
         let report_err = |span, kw| {
-            self.dcx().emit_err(errors::FnQualifierInExtern {
+            self.dcx().emit_err(diagnostics::FnQualifierInExtern {
                 span,
                 kw,
                 block: self.current_extern_span(),
@@ -720,7 +727,7 @@ fn check_foreign_fn_headerless(
     /// An item in `extern { ... }` cannot use non-ascii identifier.
     fn check_foreign_item_ascii_only(&self, ident: Ident) {
         if !ident.as_str().is_ascii() {
-            self.dcx().emit_err(errors::ExternItemAscii {
+            self.dcx().emit_err(diagnostics::ExternItemAscii {
                 span: ident.span,
                 block: self.current_extern_span(),
             });
@@ -752,7 +759,7 @@ fn check_c_variadic_type(&self, fk: FnKind<'_>, attrs: &AttrVec) {
         }
 
         if let Some(coroutine_kind) = sig.header.coroutine_kind {
-            self.dcx().emit_err(errors::CoroutineAndCVariadic {
+            self.dcx().emit_err(diagnostics::CoroutineAndCVariadic {
                 spans: vec![coroutine_kind.span(), variadic_param.span],
                 coroutine_kind: coroutine_kind.as_str(),
                 coroutine_span: coroutine_kind.span(),
@@ -765,7 +772,7 @@ fn check_c_variadic_type(&self, fk: FnKind<'_>, attrs: &AttrVec) {
             FnCtxt::Free | FnCtxt::Assoc(_) => {
                 match self.sess.target.supports_c_variadic_definitions() {
                     CVariadicStatus::NotSupported => {
-                        self.dcx().emit_err(errors::CVariadicNotSupported {
+                        self.dcx().emit_err(diagnostics::CVariadicNotSupported {
                             variadic_span: variadic_param.span,
                             target: &*self.sess.target.llvm_target,
                         });
@@ -785,7 +792,7 @@ fn check_c_variadic_type(&self, fk: FnKind<'_>, attrs: &AttrVec) {
                 match sig.header.ext {
                     Extern::Implicit(_) => {
                         if !matches!(sig.header.safety, Safety::Unsafe(_)) {
-                            self.dcx().emit_err(errors::CVariadicMustBeUnsafe {
+                            self.dcx().emit_err(diagnostics::CVariadicMustBeUnsafe {
                                 span: variadic_param.span,
                                 unsafe_span: sig.safety_span(),
                             });
@@ -800,14 +807,14 @@ fn check_c_variadic_type(&self, fk: FnKind<'_>, attrs: &AttrVec) {
                         self.check_c_variadic_abi(abi, attrs, variadic_param.span, sig);
 
                         if !matches!(sig.header.safety, Safety::Unsafe(_)) {
-                            self.dcx().emit_err(errors::CVariadicMustBeUnsafe {
+                            self.dcx().emit_err(diagnostics::CVariadicMustBeUnsafe {
                                 span: variadic_param.span,
                                 unsafe_span: sig.safety_span(),
                             });
                         }
                     }
                     Extern::None => {
-                        let err = errors::CVariadicNoExtern { span: variadic_param.span };
+                        let err = diagnostics::CVariadicNoExtern { span: variadic_param.span };
                         self.dcx().emit_err(err);
                     }
                 }
@@ -854,7 +861,7 @@ fn check_c_variadic_abi(
                 }
                 CVariadicStatus::NotSupported => {
                     // Some ABIs, e.g. `extern "Rust"`, never support c-variadic functions.
-                    self.dcx().emit_err(errors::CVariadicBadNakedExtern {
+                    self.dcx().emit_err(diagnostics::CVariadicBadNakedExtern {
                         span: dotdotdot_span,
                         abi: abi.as_str(),
                         extern_span: sig.extern_span(),
@@ -862,7 +869,7 @@ fn check_c_variadic_abi(
                 }
             }
         } else if !matches!(abi, ExternAbi::C { .. }) {
-            self.dcx().emit_err(errors::CVariadicBadExtern {
+            self.dcx().emit_err(diagnostics::CVariadicBadExtern {
                 span: dotdotdot_span,
                 abi: abi.as_str(),
                 extern_span: sig.extern_span(),
@@ -874,7 +881,7 @@ fn check_item_named(&self, ident: Ident, kind: &str) {
         if ident.name != kw::Underscore {
             return;
         }
-        self.dcx().emit_err(errors::ItemUnderscore { span: ident.span, kind });
+        self.dcx().emit_err(diagnostics::ItemUnderscore { span: ident.span, kind });
     }
 
     fn check_nomangle_item_asciionly(&self, ident: Ident, item_span: Span) {
@@ -882,26 +889,26 @@ fn check_nomangle_item_asciionly(&self, ident: Ident, item_span: Span) {
             return;
         }
         let span = self.sess.source_map().guess_head_span(item_span);
-        self.dcx().emit_err(errors::NoMangleAscii { span });
+        self.dcx().emit_err(diagnostics::NoMangleAscii { span });
     }
 
     fn check_mod_file_item_asciionly(&self, ident: Ident) {
         if ident.name.as_str().is_ascii() {
             return;
         }
-        self.dcx().emit_err(errors::ModuleNonAscii { span: ident.span, name: ident.name });
+        self.dcx().emit_err(diagnostics::ModuleNonAscii { span: ident.span, name: ident.name });
     }
 
     fn deny_const_auto_traits(&self, constness: Const) {
         if let Const::Yes(span) = constness {
-            self.dcx().emit_err(errors::ConstAutoTrait { span });
+            self.dcx().emit_err(diagnostics::ConstAutoTrait { span });
         }
     }
 
     fn deny_generic_params(&self, generics: &Generics, ident_span: Span) {
         if !generics.params.is_empty() {
             self.dcx()
-                .emit_err(errors::AutoTraitGeneric { span: generics.span, ident: ident_span });
+                .emit_err(diagnostics::AutoTraitGeneric { span: generics.span, ident: ident_span });
         }
     }
 
@@ -909,7 +916,7 @@ fn deny_super_traits(&self, bounds: &GenericBounds, ident: Span) {
         if let [.., last] = &bounds[..] {
             let span = bounds.iter().map(|b| b.span()).collect();
             let removal = ident.shrink_to_hi().to(last.span());
-            self.dcx().emit_err(errors::AutoTraitBounds { span, removal, ident });
+            self.dcx().emit_err(diagnostics::AutoTraitBounds { span, removal, ident });
         }
     }
 
@@ -917,7 +924,7 @@ fn deny_where_clause(&self, where_clause: &WhereClause, ident: Span) {
         if !where_clause.predicates.is_empty() {
             // FIXME: The current diagnostic is misleading since it only talks about
             // super trait and lifetime bounds while we should just say “bounds”.
-            self.dcx().emit_err(errors::AutoTraitBounds {
+            self.dcx().emit_err(diagnostics::AutoTraitBounds {
                 span: vec![where_clause.span],
                 removal: where_clause.span,
                 ident,
@@ -929,7 +936,7 @@ fn deny_items(&self, trait_items: &[Box<AssocItem>], ident_span: Span) {
         if !trait_items.is_empty() {
             let spans: Vec<_> = trait_items.iter().map(|i| i.kind.ident().unwrap().span).collect();
             let total = trait_items.first().unwrap().span.to(trait_items.last().unwrap().span);
-            self.dcx().emit_err(errors::AutoTraitItems { spans, total, ident: ident_span });
+            self.dcx().emit_err(diagnostics::AutoTraitItems { spans, total, ident: ident_span });
         }
     }
 
@@ -975,13 +982,13 @@ fn check_generic_args_before_constraints(&self, data: &AngleBracketedArgs) {
         let args_len = arg_spans.len();
         let constraint_len = constraint_spans.len();
         // ...and then error:
-        self.dcx().emit_err(errors::ArgsBeforeConstraint {
+        self.dcx().emit_err(diagnostics::ArgsBeforeConstraint {
             arg_spans: arg_spans.clone(),
             constraints: constraint_spans[0],
             args: *arg_spans.iter().last().unwrap(),
             data: data.span,
-            constraint_spans: errors::EmptyLabelManySpans(constraint_spans),
-            arg_spans2: errors::EmptyLabelManySpans(arg_spans),
+            constraint_spans: diagnostics::EmptyLabelManySpans(constraint_spans),
+            arg_spans2: diagnostics::EmptyLabelManySpans(arg_spans),
             suggestion: self.correct_generic_order_suggestion(data),
             constraint_len,
             args_len,
@@ -994,7 +1001,7 @@ fn visit_ty_common(&mut self, ty: &Ty) {
                 self.check_fn_ptr_safety(bfty.decl_span, bfty.safety);
                 self.check_fn_decl(&bfty.decl, SelfSemantic::No);
                 Self::check_decl_no_pat(&bfty.decl, |span, _, _| {
-                    self.dcx().emit_err(errors::PatternFnPointer { span });
+                    self.dcx().emit_err(diagnostics::PatternFnPointer { span });
                 });
                 if let Extern::Implicit(extern_span) = bfty.ext {
                     self.handle_missing_abi(extern_span, ty.id);
@@ -1005,8 +1012,9 @@ fn visit_ty_common(&mut self, ty: &Ty) {
                 for bound in bounds {
                     if let GenericBound::Outlives(lifetime) = bound {
                         if any_lifetime_bounds {
-                            self.dcx()
-                                .emit_err(errors::TraitObjectBound { span: lifetime.ident.span });
+                            self.dcx().emit_err(diagnostics::TraitObjectBound {
+                                span: lifetime.ident.span,
+                            });
                             break;
                         }
                         any_lifetime_bounds = true;
@@ -1015,7 +1023,7 @@ fn visit_ty_common(&mut self, ty: &Ty) {
             }
             TyKind::ImplTrait(_, bounds) => {
                 if let Some(outer_impl_trait_sp) = self.outer_impl_trait_span {
-                    self.dcx().emit_err(errors::NestedImplTrait {
+                    self.dcx().emit_err(diagnostics::NestedImplTrait {
                         span: ty.span,
                         outer: outer_impl_trait_sp,
                         inner: ty.span,
@@ -1023,7 +1031,7 @@ fn visit_ty_common(&mut self, ty: &Ty) {
                 }
 
                 if !bounds.iter().any(|b| matches!(b, GenericBound::Trait(..))) {
-                    self.dcx().emit_err(errors::AtLeastOneTrait { span: ty.span });
+                    self.dcx().emit_err(diagnostics::AtLeastOneTrait { span: ty.span });
                 }
             }
             _ => {}
@@ -1034,7 +1042,7 @@ fn handle_missing_abi(&mut self, span: Span, id: NodeId) {
         // FIXME(davidtwco): This is a hack to detect macros which produce spans of the
         // call site which do not have a macro backtrace. See #61963.
         if span.edition().at_least_edition_future() && self.features.explicit_extern_abis() {
-            self.dcx().emit_err(errors::MissingAbi { span });
+            self.dcx().emit_err(diagnostics::MissingAbi { span });
         } else if self
             .sess
             .source_map()
@@ -1045,7 +1053,7 @@ fn handle_missing_abi(&mut self, span: Span, id: NodeId) {
                 MISSING_ABI,
                 id,
                 span,
-                errors::MissingAbiSugg { span, default_abi: ExternAbi::FALLBACK },
+                diagnostics::MissingAbiSugg { span, default_abi: ExternAbi::FALLBACK },
             )
         }
     }
@@ -1126,7 +1134,7 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara
         ordered_params += ">";
 
         for (param_ord, (max_param, spans)) in &out_of_order {
-            dcx.emit_err(errors::OutOfOrderParams {
+            dcx.emit_err(diagnostics::OutOfOrderParams {
                 spans: spans.clone(),
                 sugg_span: span,
                 param_ord: param_ord.to_string(),
@@ -1171,15 +1179,15 @@ fn visit_item(&mut self, item: &Item) {
                 self.visit_attrs_vis(&item.attrs, &item.vis);
                 self.visibility_not_permitted(
                     &item.vis,
-                    errors::VisibilityNotPermittedNote::TraitImpl,
+                    diagnostics::VisibilityNotPermittedNote::TraitImpl,
                 );
                 if let TyKind::Dummy = self_ty.kind {
                     // Abort immediately otherwise the `TyKind::Dummy` will reach HIR lowering,
                     // which isn't allowed. Not a problem for this obscure, obsolete syntax.
-                    self.dcx().emit_fatal(errors::ObsoleteAuto { span: item.span });
+                    self.dcx().emit_fatal(diagnostics::ObsoleteAuto { span: item.span });
                 }
                 if let (&Safety::Unsafe(span), &ImplPolarity::Negative(sp)) = (safety, polarity) {
-                    self.dcx().emit_err(errors::UnsafeNegativeImpl {
+                    self.dcx().emit_err(diagnostics::UnsafeNegativeImpl {
                         span: sp.to(t.path.span),
                         negative: sp,
                         r#unsafe: span,
@@ -1212,7 +1220,7 @@ fn visit_item(&mut self, item: &Item) {
                 self.visit_attrs_vis(&item.attrs, &item.vis);
                 self.visibility_not_permitted(
                     &item.vis,
-                    errors::VisibilityNotPermittedNote::IndividualImplItems,
+                    diagnostics::VisibilityNotPermittedNote::IndividualImplItems,
                 );
 
                 let disallowed = matches!(constness, ast::Const::No)
@@ -1254,19 +1262,19 @@ fn visit_item(&mut self, item: &Item) {
 
                 let is_intrinsic = item.attrs.iter().any(|a| a.has_name(sym::rustc_intrinsic));
                 if body.is_none() && !is_intrinsic && !self.is_sdylib_interface {
-                    self.dcx().emit_err(errors::FnWithoutBody {
+                    self.dcx().emit_err(diagnostics::FnWithoutBody {
                         span: item.span,
                         replace_span: self.ending_semi_or_hi(item.span),
                         extern_block_suggestion: match sig.header.ext {
                             Extern::None => None,
                             Extern::Implicit(start_span) => {
-                                Some(errors::ExternBlockSuggestion::Implicit {
+                                Some(diagnostics::ExternBlockSuggestion::Implicit {
                                     start_span,
                                     end_span: item.span.shrink_to_hi(),
                                 })
                             }
                             Extern::Explicit(abi, start_span) => {
-                                Some(errors::ExternBlockSuggestion::Explicit {
+                                Some(diagnostics::ExternBlockSuggestion::Explicit {
                                     start_span,
                                     end_span: item.span.shrink_to_hi(),
                                     abi: abi.symbol_unescaped,
@@ -1283,18 +1291,18 @@ fn visit_item(&mut self, item: &Item) {
                 let old_item = mem::replace(&mut self.extern_mod_span, Some(item.span));
                 self.visibility_not_permitted(
                     &item.vis,
-                    errors::VisibilityNotPermittedNote::IndividualForeignItems,
+                    diagnostics::VisibilityNotPermittedNote::IndividualForeignItems,
                 );
 
                 if &Safety::Default == safety {
                     if item.span.at_least_rust_2024() {
-                        self.dcx().emit_err(errors::MissingUnsafeOnExtern { span: item.span });
+                        self.dcx().emit_err(diagnostics::MissingUnsafeOnExtern { span: item.span });
                     } else {
                         self.lint_buffer.buffer_lint(
                             MISSING_UNSAFE_ON_EXTERN,
                             item.id,
                             item.span,
-                            errors::MissingUnsafeOnExternLint {
+                            diagnostics::MissingUnsafeOnExternLint {
                                 suggestion: item.span.shrink_to_lo(),
                             },
                         );
@@ -1315,12 +1323,12 @@ fn visit_item(&mut self, item: &Item) {
                 for variant in &def.variants {
                     self.visibility_not_permitted(
                         &variant.vis,
-                        errors::VisibilityNotPermittedNote::EnumVariant,
+                        diagnostics::VisibilityNotPermittedNote::EnumVariant,
                     );
                     for field in variant.data.fields() {
                         self.visibility_not_permitted(
                             &field.vis,
-                            errors::VisibilityNotPermittedNote::EnumVariant,
+                            diagnostics::VisibilityNotPermittedNote::EnumVariant,
                         );
                     }
                 }
@@ -1364,7 +1372,7 @@ fn visit_item(&mut self, item: &Item) {
             }
             ItemKind::Mod(safety, ident, mod_kind) => {
                 if let &Safety::Unsafe(span) = safety {
-                    self.dcx().emit_err(errors::UnsafeItem { span, kind: "module" });
+                    self.dcx().emit_err(diagnostics::UnsafeItem { span, kind: "module" });
                 }
                 // Ensure that `path` attributes on modules are recorded as used (cf. issue #35584).
                 if !matches!(mod_kind, ModKind::Loaded(_, Inline::Yes, _))
@@ -1381,13 +1389,15 @@ fn visit_item(&mut self, item: &Item) {
                         item.attrs.iter().find(|attr| attr.has_name(sym::rustc_scalable_vector));
                     if let Some(attr) = scalable_vector_attr {
                         if !matches!(vdata, VariantData::Tuple(..)) {
-                            this.dcx()
-                                .emit_err(errors::ScalableVectorNotTupleStruct { span: item.span });
+                            this.dcx().emit_err(diagnostics::ScalableVectorNotTupleStruct {
+                                span: item.span,
+                            });
                         }
                         if !self.sess.target.arch.supports_scalable_vectors()
                             && !self.sess.opts.actually_rustdoc
                         {
-                            this.dcx().emit_err(errors::ScalableVectorBadArch { span: attr.span });
+                            this.dcx()
+                                .emit_err(diagnostics::ScalableVectorBadArch { span: attr.span });
                         }
                     }
 
@@ -1403,7 +1413,7 @@ fn visit_item(&mut self, item: &Item) {
             }
             ItemKind::Union(ident, generics, vdata) => {
                 if vdata.fields().is_empty() {
-                    self.dcx().emit_err(errors::FieldlessUnion { span: item.span });
+                    self.dcx().emit_err(diagnostics::FieldlessUnion { span: item.span });
                 }
                 self.with_tilde_const(Some(TildeConstReason::Union { span: item.span }), |this| {
                     match vdata {
@@ -1419,7 +1429,7 @@ fn visit_item(&mut self, item: &Item) {
             ItemKind::Const(ConstItem { defaultness, ident, rhs_kind, .. }) => {
                 self.check_defaultness(item.span, *defaultness, AllowDefault::No, AllowFinal::No);
                 if !rhs_kind.has_expr() {
-                    self.dcx().emit_err(errors::ConstWithoutBody {
+                    self.dcx().emit_err(diagnostics::ConstWithoutBody {
                         span: item.span,
                         replace_span: self.ending_semi_or_hi(item.span),
                     });
@@ -1432,7 +1442,7 @@ fn visit_item(&mut self, item: &Item) {
                         UNUSED_VISIBILITIES,
                         item.id,
                         item.vis.span,
-                        errors::UnusedVisibility { span: item.vis.span },
+                        diagnostics::UnusedVisibility { span: item.vis.span },
                     )
                 }
 
@@ -1441,11 +1451,11 @@ fn visit_item(&mut self, item: &Item) {
             ItemKind::Static(StaticItem { expr, safety, .. }) => {
                 self.check_item_safety(item.span, *safety);
                 if matches!(safety, Safety::Unsafe(_)) {
-                    self.dcx().emit_err(errors::UnsafeStatic { span: item.span });
+                    self.dcx().emit_err(diagnostics::UnsafeStatic { span: item.span });
                 }
 
                 if expr.is_none() {
-                    self.dcx().emit_err(errors::StaticWithoutBody {
+                    self.dcx().emit_err(diagnostics::StaticWithoutBody {
                         span: item.span,
                         replace_span: self.ending_semi_or_hi(item.span),
                     });
@@ -1457,7 +1467,7 @@ fn visit_item(&mut self, item: &Item) {
             ) => {
                 self.check_defaultness(item.span, *defaultness, AllowDefault::No, AllowFinal::No);
                 if ty.is_none() {
-                    self.dcx().emit_err(errors::TyAliasWithoutBody {
+                    self.dcx().emit_err(diagnostics::TyAliasWithoutBody {
                         span: item.span,
                         replace_span: self.ending_semi_or_hi(item.span),
                     });
@@ -1469,7 +1479,7 @@ fn visit_item(&mut self, item: &Item) {
                         self.dcx().emit_err(err);
                     }
                 } else if after_where_clause.has_where_token {
-                    self.dcx().emit_err(errors::WhereClauseAfterTypeAlias {
+                    self.dcx().emit_err(diagnostics::WhereClauseAfterTypeAlias {
                         span: after_where_clause.span,
                         help: self.sess.is_nightly_build(),
                     });
@@ -1499,7 +1509,7 @@ fn visit_foreign_item(&mut self, fi: &ForeignItem) {
                 if let Some(attr) = attr::find_by_name(fi.attrs(), sym::track_caller)
                     && self.extern_mod_abi != Some(ExternAbi::Rust)
                 {
-                    self.dcx().emit_err(errors::RequiresRustAbi {
+                    self.dcx().emit_err(diagnostics::RequiresRustAbi {
                         track_caller_span: attr.span,
                         extern_abi_span: self.current_extern_span(),
                     });
@@ -1573,7 +1583,7 @@ fn visit_generics(&mut self, generics: &Generics) {
                 }
                 GenericParamKind::Type { .. } | GenericParamKind::Const { .. } => {
                     if let Some(span) = prev_param_default {
-                        self.dcx().emit_err(errors::GenericDefaultTrailing { span });
+                        self.dcx().emit_err(diagnostics::GenericDefaultTrailing { span });
                         break;
                     }
                 }
@@ -1581,14 +1591,8 @@ fn visit_generics(&mut self, generics: &Generics) {
         }
 
         validate_generic_param_order(self.dcx(), &generics.params, generics.span);
-
-        for predicate in &generics.where_clause.predicates {
-            let span = predicate.span;
-            if let WherePredicateKind::EqPredicate(predicate) = &predicate.kind {
-                deny_equality_constraints(self, predicate, span, generics);
-            }
-        }
         walk_list!(self, visit_generic_param, &generics.params);
+
         for predicate in &generics.where_clause.predicates {
             match &predicate.kind {
                 WherePredicateKind::BoundPredicate(bound_pred) => {
@@ -1602,8 +1606,9 @@ fn visit_generics(&mut self, generics: &Generics) {
                             match bound {
                                 GenericBound::Trait(t) => {
                                     if !t.bound_generic_params.is_empty() {
-                                        self.dcx()
-                                            .emit_err(errors::NestedLifetimes { span: t.span });
+                                        self.dcx().emit_err(diagnostics::NestedLifetimes {
+                                            span: t.span,
+                                        });
                                     }
                                 }
                                 GenericBound::Outlives(_) => {}
@@ -1612,7 +1617,7 @@ fn visit_generics(&mut self, generics: &Generics) {
                         }
                     }
                 }
-                _ => {}
+                WherePredicateKind::RegionPredicate(_) => {}
             }
             self.visit_where_predicate(predicate);
         }
@@ -1627,12 +1632,13 @@ fn visit_param_bound(&mut self, bound: &GenericBound, ctxt: BoundKind) {
                         BoundConstness::Always(_),
                         BoundPolarity::Positive,
                     ) => {
-                        self.dcx().emit_err(errors::ConstBoundTraitObject { span: trait_ref.span });
+                        self.dcx()
+                            .emit_err(diagnostics::ConstBoundTraitObject { span: trait_ref.span });
                     }
                     (_, BoundConstness::Maybe(span), BoundPolarity::Positive)
                         if let Some(reason) = self.disallow_tilde_const =>
                     {
-                        self.dcx().emit_err(errors::TildeConstDisallowed { span, reason });
+                        self.dcx().emit_err(diagnostics::TildeConstDisallowed { span, reason });
                     }
                     _ => {}
                 }
@@ -1645,7 +1651,7 @@ fn visit_param_bound(&mut self, bound: &GenericBound, ctxt: BoundKind) {
                         Some(ast::GenericArgs::AngleBracketed(args)) => {
                             for arg in &args.args {
                                 if let ast::AngleBracketedArg::Constraint(constraint) = arg {
-                                    self.dcx().emit_err(errors::ConstraintOnNegativeBound {
+                                    self.dcx().emit_err(diagnostics::ConstraintOnNegativeBound {
                                         span: constraint.span,
                                     });
                                 }
@@ -1653,9 +1659,11 @@ fn visit_param_bound(&mut self, bound: &GenericBound, ctxt: BoundKind) {
                         }
                         // The lowered form of parenthesized generic args contains an associated type binding.
                         Some(ast::GenericArgs::Parenthesized(args)) => {
-                            self.dcx().emit_err(errors::NegativeBoundWithParentheticalNotation {
-                                span: args.span,
-                            });
+                            self.dcx().emit_err(
+                                diagnostics::NegativeBoundWithParentheticalNotation {
+                                    span: args.span,
+                                },
+                            );
                         }
                         Some(ast::GenericArgs::ParenthesizedElided(_)) | None => {}
                     }
@@ -1665,7 +1673,7 @@ fn visit_param_bound(&mut self, bound: &GenericBound, ctxt: BoundKind) {
             GenericBound::Use(_, span) => match ctxt {
                 BoundKind::Impl => {}
                 BoundKind::Bound | BoundKind::TraitObject | BoundKind::SuperTraits => {
-                    self.dcx().emit_err(errors::PreciseCapturingNotAllowedHere {
+                    self.dcx().emit_err(diagnostics::PreciseCapturingNotAllowedHere {
                         loc: ctxt.descr(),
                         span: *span,
                     });
@@ -1705,7 +1713,7 @@ fn visit_fn(&mut self, fk: FnKind<'_>, attrs: &AttrVec, span: Span, id: NodeId)
                 if let Some(attr) = attr::find_by_name(attrs, sym::track_caller)
                     && extern_abi != ExternAbi::Rust
                 {
-                    self.dcx().emit_err(errors::RequiresRustAbi {
+                    self.dcx().emit_err(diagnostics::RequiresRustAbi {
                         track_caller_span: attr.span,
                         extern_abi_span,
                     });
@@ -1722,7 +1730,7 @@ fn visit_fn(&mut self, fk: FnKind<'_>, attrs: &AttrVec, span: Span, id: NodeId)
             ..
         }) = fk.header()
         {
-            self.dcx().emit_err(errors::ConstAndCoroutine {
+            self.dcx().emit_err(diagnostics::ConstAndCoroutine {
                 spans: vec![coroutine_kind.span(), const_span],
                 const_span,
                 coroutine_span: coroutine_kind.span(),
@@ -1754,11 +1762,11 @@ fn visit_fn(&mut self, fk: FnKind<'_>, attrs: &AttrVec, span: Span, id: NodeId)
                             id,
                             span,
                             move |dcx, level| {
-                                let sub = errors::PatternsInFnsWithoutBodySub { ident, span };
+                                let sub = diagnostics::PatternsInFnsWithoutBodySub { ident, span };
                                 if is_foreign {
-                                    errors::PatternsInFnsWithoutBody::Foreign { sub }
+                                    diagnostics::PatternsInFnsWithoutBody::Foreign { sub }
                                 } else {
-                                    errors::PatternsInFnsWithoutBody::Bodiless { sub }
+                                    diagnostics::PatternsInFnsWithoutBody::Bodiless { sub }
                                 }
                                 .into_diag(dcx, level)
                             },
@@ -1766,8 +1774,10 @@ fn visit_fn(&mut self, fk: FnKind<'_>, attrs: &AttrVec, span: Span, id: NodeId)
                     }
                 } else {
                     match ctxt {
-                        FnCtxt::Foreign => self.dcx().emit_err(errors::PatternInForeign { span }),
-                        _ => self.dcx().emit_err(errors::PatternInBodiless { span }),
+                        FnCtxt::Foreign => {
+                            self.dcx().emit_err(diagnostics::PatternInForeign { span })
+                        }
+                        _ => self.dcx().emit_err(diagnostics::PatternInBodiless { span }),
                     };
                 }
             });
@@ -1814,7 +1824,7 @@ fn visit_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) {
             match &item.kind {
                 AssocItemKind::Const(ConstItem { rhs_kind, .. }) => {
                     if !rhs_kind.has_expr() {
-                        self.dcx().emit_err(errors::AssocConstWithoutBody {
+                        self.dcx().emit_err(diagnostics::AssocConstWithoutBody {
                             span: item.span,
                             replace_span: self.ending_semi_or_hi(item.span),
                         });
@@ -1822,7 +1832,7 @@ fn visit_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) {
                 }
                 AssocItemKind::Fn(Fn { body, .. }) => {
                     if body.is_none() && !self.is_sdylib_interface {
-                        self.dcx().emit_err(errors::AssocFnWithoutBody {
+                        self.dcx().emit_err(diagnostics::AssocFnWithoutBody {
                             span: item.span,
                             replace_span: self.ending_semi_or_hi(item.span),
                         });
@@ -1830,7 +1840,7 @@ fn visit_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) {
                 }
                 AssocItemKind::Type(TyAlias { bounds, ty, .. }) => {
                     if ty.is_none() {
-                        self.dcx().emit_err(errors::AssocTypeWithoutBody {
+                        self.dcx().emit_err(diagnostics::AssocTypeWithoutBody {
                             span: item.span,
                             replace_span: self.ending_semi_or_hi(item.span),
                         });
@@ -1845,8 +1855,8 @@ fn visit_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) {
             && let Err(err) = self.check_type_alias_where_clause_location(ty_alias)
         {
             let sugg = match err.sugg {
-                errors::WhereClauseBeforeTypeAliasSugg::Remove { .. } => None,
-                errors::WhereClauseBeforeTypeAliasSugg::Move { snippet, right, .. } => {
+                diagnostics::WhereClauseBeforeTypeAliasSugg::Remove { .. } => None,
+                diagnostics::WhereClauseBeforeTypeAliasSugg::Move { snippet, right, .. } => {
                     Some((right, snippet))
                 }
             };
@@ -1862,17 +1872,17 @@ fn visit_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) {
                 move |dcx, level| {
                     let suggestion = match sugg {
                         Some((right_sp, sugg)) => {
-                            errors::DeprecatedWhereClauseLocationSugg::MoveToEnd {
+                            diagnostics::DeprecatedWhereClauseLocationSugg::MoveToEnd {
                                 left: left_sp,
                                 right: right_sp,
                                 sugg,
                             }
                         }
-                        None => errors::DeprecatedWhereClauseLocationSugg::RemoveWhere {
+                        None => diagnostics::DeprecatedWhereClauseLocationSugg::RemoveWhere {
                             span: err.span,
                         },
                     };
-                    errors::DeprecatedWhereClauseLocation { suggestion }.into_diag(dcx, level)
+                    diagnostics::DeprecatedWhereClauseLocation { suggestion }.into_diag(dcx, level)
                 },
             );
         }
@@ -1881,7 +1891,7 @@ fn visit_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) {
             Some(parent @ (TraitOrImpl::Trait { .. } | TraitOrImpl::TraitImpl { .. })) => {
                 self.visibility_not_permitted(
                     &item.vis,
-                    errors::VisibilityNotPermittedNote::TraitImpl,
+                    diagnostics::VisibilityNotPermittedNote::TraitImpl,
                 );
                 if let AssocItemKind::Fn(Fn { sig, .. }) = &item.kind {
                     self.check_trait_fn_not_const(sig.header.constness, parent);
@@ -1944,170 +1954,6 @@ fn visit_anon_const(&mut self, anon_const: &AnonConst) {
     }
 }
 
-/// When encountering an equality constraint in a `where` clause, emit an error. If the code seems
-/// like it's setting an associated type, provide an appropriate suggestion.
-fn deny_equality_constraints(
-    this: &AstValidator<'_>,
-    predicate: &WhereEqPredicate,
-    predicate_span: Span,
-    generics: &Generics,
-) {
-    let mut err = errors::EqualityInWhere { span: predicate_span, assoc: None, assoc2: None };
-
-    // Given `<A as Foo>::Bar = RhsTy`, suggest `A: Foo<Bar = RhsTy>`.
-    if let TyKind::Path(Some(qself), full_path) = &predicate.lhs_ty.kind
-        && let TyKind::Path(None, path) = &qself.ty.kind
-        && let [PathSegment { ident, args: None, .. }] = &path.segments[..]
-    {
-        for param in &generics.params {
-            if param.ident == *ident
-                && let [PathSegment { ident, args, .. }] = &full_path.segments[qself.position..]
-            {
-                // Make a new `Path` from `foo::Bar` to `Foo<Bar = RhsTy>`.
-                let mut assoc_path = full_path.clone();
-                // Remove `Bar` from `Foo::Bar`.
-                assoc_path.segments.pop();
-                let len = assoc_path.segments.len() - 1;
-                let gen_args = args.as_deref().cloned();
-                // Build `<Bar = RhsTy>`.
-                let arg = AngleBracketedArg::Constraint(AssocItemConstraint {
-                    id: rustc_ast::node_id::DUMMY_NODE_ID,
-                    ident: *ident,
-                    gen_args,
-                    kind: AssocItemConstraintKind::Equality {
-                        term: predicate.rhs_ty.clone().into(),
-                    },
-                    span: ident.span,
-                });
-                // Add `<Bar = RhsTy>` to `Foo`.
-                match &mut assoc_path.segments[len].args {
-                    Some(args) => match args.deref_mut() {
-                        GenericArgs::Parenthesized(_) | GenericArgs::ParenthesizedElided(..) => {
-                            continue;
-                        }
-                        GenericArgs::AngleBracketed(args) => {
-                            args.args.push(arg);
-                        }
-                    },
-                    empty_args => {
-                        *empty_args = Some(
-                            AngleBracketedArgs { span: ident.span, args: thin_vec![arg] }.into(),
-                        );
-                    }
-                }
-                err.assoc = Some(errors::AssociatedSuggestion {
-                    span: predicate_span,
-                    ident: *ident,
-                    param: param.ident,
-                    path: pprust::path_to_string(&assoc_path),
-                })
-            }
-        }
-    }
-
-    let mut suggest =
-        |poly: &PolyTraitRef, potential_assoc: &PathSegment, predicate: &WhereEqPredicate| {
-            if let [trait_segment] = &poly.trait_ref.path.segments[..] {
-                let assoc = pprust::path_to_string(&ast::Path::from_ident(potential_assoc.ident));
-                let ty = pprust::ty_to_string(&predicate.rhs_ty);
-                let (args, span) = match &trait_segment.args {
-                    Some(args) => match args.deref() {
-                        ast::GenericArgs::AngleBracketed(args) => {
-                            let Some(arg) = args.args.last() else {
-                                return;
-                            };
-                            (format!(", {assoc} = {ty}"), arg.span().shrink_to_hi())
-                        }
-                        _ => return,
-                    },
-                    None => (format!("<{assoc} = {ty}>"), trait_segment.span().shrink_to_hi()),
-                };
-                let removal_span = if generics.where_clause.predicates.len() == 1 {
-                    // We're removing th eonly where bound left, remove the whole thing.
-                    generics.where_clause.span
-                } else {
-                    let mut span = predicate_span;
-                    let mut prev_span: Option<Span> = None;
-                    let mut preds = generics.where_clause.predicates.iter().peekable();
-                    // Find the predicate that shouldn't have been in the where bound list.
-                    while let Some(pred) = preds.next() {
-                        if let WherePredicateKind::EqPredicate(_) = pred.kind
-                            && pred.span == predicate_span
-                        {
-                            if let Some(next) = preds.peek() {
-                                // This is the first predicate, remove the trailing comma as well.
-                                span = span.with_hi(next.span.lo());
-                            } else if let Some(prev_span) = prev_span {
-                                // Remove the previous comma as well.
-                                span = span.with_lo(prev_span.hi());
-                            }
-                        }
-                        prev_span = Some(pred.span);
-                    }
-                    span
-                };
-                err.assoc2 = Some(errors::AssociatedSuggestion2 {
-                    span,
-                    args,
-                    predicate: removal_span,
-                    trait_segment: trait_segment.ident,
-                    potential_assoc: potential_assoc.ident,
-                });
-            }
-        };
-
-    if let TyKind::Path(None, full_path) = &predicate.lhs_ty.kind {
-        // Given `A: Foo, Foo::Bar = RhsTy`, suggest `A: Foo<Bar = RhsTy>`.
-        for bounds in generics.params.iter().map(|p| &p.bounds).chain(
-            generics.where_clause.predicates.iter().filter_map(|pred| match &pred.kind {
-                WherePredicateKind::BoundPredicate(p) => Some(&p.bounds),
-                _ => None,
-            }),
-        ) {
-            for bound in bounds {
-                if let GenericBound::Trait(poly) = bound
-                    && poly.modifiers == TraitBoundModifiers::NONE
-                {
-                    if full_path.segments[..full_path.segments.len() - 1]
-                        .iter()
-                        .map(|segment| segment.ident.name)
-                        .zip(poly.trait_ref.path.segments.iter().map(|segment| segment.ident.name))
-                        .all(|(a, b)| a == b)
-                        && let Some(potential_assoc) = full_path.segments.last()
-                    {
-                        suggest(poly, potential_assoc, predicate);
-                    }
-                }
-            }
-        }
-        // Given `A: Foo, A::Bar = RhsTy`, suggest `A: Foo<Bar = RhsTy>`.
-        if let [potential_param, potential_assoc] = &full_path.segments[..] {
-            for (ident, bounds) in generics.params.iter().map(|p| (p.ident, &p.bounds)).chain(
-                generics.where_clause.predicates.iter().filter_map(|pred| match &pred.kind {
-                    WherePredicateKind::BoundPredicate(p)
-                        if let ast::TyKind::Path(None, path) = &p.bounded_ty.kind
-                            && let [segment] = &path.segments[..] =>
-                    {
-                        Some((segment.ident, &p.bounds))
-                    }
-                    _ => None,
-                }),
-            ) {
-                if ident == potential_param.ident {
-                    for bound in bounds {
-                        if let ast::GenericBound::Trait(poly) = bound
-                            && poly.modifiers == TraitBoundModifiers::NONE
-                        {
-                            suggest(poly, potential_assoc, predicate);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    this.dcx().emit_err(err);
-}
-
 pub fn check_crate(
     sess: &Session,
     features: &Features,
diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/diagnostics.rs
similarity index 95%
rename from compiler/rustc_ast_passes/src/errors.rs
rename to compiler/rustc_ast_passes/src/diagnostics.rs
index a6b75cb..89284ca 100644
--- a/compiler/rustc_ast_passes/src/errors.rs
+++ b/compiler/rustc_ast_passes/src/diagnostics.rs
@@ -879,49 +879,6 @@ pub(crate) struct PatternInBodiless {
 }
 
 #[derive(Diagnostic)]
-#[diag("equality constraints are not yet supported in `where` clauses")]
-#[note("see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information")]
-pub(crate) struct EqualityInWhere {
-    #[primary_span]
-    #[label("not supported")]
-    pub span: Span,
-    #[subdiagnostic]
-    pub assoc: Option<AssociatedSuggestion>,
-    #[subdiagnostic]
-    pub assoc2: Option<AssociatedSuggestion2>,
-}
-
-#[derive(Subdiagnostic)]
-#[suggestion(
-    "if `{$ident}` is an associated type you're trying to set, use the associated type binding syntax",
-    code = "{param}: {path}",
-    style = "verbose",
-    applicability = "maybe-incorrect"
-)]
-pub(crate) struct AssociatedSuggestion {
-    #[primary_span]
-    pub span: Span,
-    pub ident: Ident,
-    pub param: Ident,
-    pub path: String,
-}
-
-#[derive(Subdiagnostic)]
-#[multipart_suggestion(
-    "if `{$trait_segment}::{$potential_assoc}` is an associated type you're trying to set, use the associated type binding syntax",
-    applicability = "maybe-incorrect"
-)]
-pub(crate) struct AssociatedSuggestion2 {
-    #[suggestion_part(code = "{args}")]
-    pub span: Span,
-    pub args: String,
-    #[suggestion_part(code = "")]
-    pub predicate: Span,
-    pub trait_segment: Ident,
-    pub potential_assoc: Ident,
-}
-
-#[derive(Diagnostic)]
 #[diag("`#![feature]` may not be used on the {$channel} release channel", code = E0554)]
 pub(crate) struct FeatureOnNonNightly {
     #[primary_span]
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs
index fd0070b..09672d1 100644
--- a/compiler/rustc_ast_passes/src/feature_gate.rs
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs
@@ -10,7 +10,7 @@
 use rustc_span::{Span, Spanned, Symbol, sym};
 use thin_vec::ThinVec;
 
-use crate::errors;
+use crate::diagnostics;
 
 /// The common case.
 macro_rules! gate {
@@ -133,7 +133,7 @@ fn check_late_bound_lifetime_defs(&self, params: &[ast::GenericParam]) {
                 .collect();
 
             if !const_param_spans.is_empty() {
-                self.sess.dcx().emit_err(errors::ForbiddenConstParam { const_param_spans });
+                self.sess.dcx().emit_err(diagnostics::ForbiddenConstParam { const_param_spans });
             }
         }
 
@@ -144,9 +144,9 @@ fn check_late_bound_lifetime_defs(&self, params: &[ast::GenericParam]) {
                     // Issue #149695
                     // Abort immediately otherwise items defined in complex bounds will be lowered into HIR,
                     // which will cause ICEs when errors of the items visit unlowered parents.
-                    self.sess.dcx().emit_fatal(errors::ForbiddenBound { spans });
+                    self.sess.dcx().emit_fatal(diagnostics::ForbiddenBound { spans });
                 } else {
-                    self.sess.dcx().emit_err(errors::ForbiddenBound { spans });
+                    self.sess.dcx().emit_err(diagnostics::ForbiddenBound { spans });
                 }
             }
         }
@@ -553,7 +553,7 @@ macro_rules! gate_all {
     // Under no circumstances do we want to advertise the feature name to users!
     if !visitor.features.negative_bounds() {
         for &span in spans.get(&sym::negative_bounds).into_iter().flatten() {
-            sess.dcx().emit_err(errors::NegativeBoundUnsupported { span });
+            sess.dcx().emit_err(diagnostics::NegativeBoundUnsupported { span });
         }
     }
 
@@ -570,7 +570,7 @@ macro_rules! gate_all {
                     .emit();
             } else {
                 let suggestion = span.shrink_to_hi();
-                sess.dcx().emit_err(errors::MatchArmWithNoBody { span, suggestion });
+                sess.dcx().emit_err(diagnostics::MatchArmWithNoBody { span, suggestion });
             }
         }
     }
@@ -645,7 +645,7 @@ fn maybe_stage_features(sess: &Session, features: &Features, krate: &ast::Crate)
         AttributeParser::parse_limited(sess, &krate.attrs, &[sym::feature])
     {
         // `feature(...)` used on non-nightly. This is definitely an error.
-        let mut err = errors::FeatureOnNonNightly {
+        let mut err = diagnostics::FeatureOnNonNightly {
             span: first_span,
             channel: option_env!("CFG_RELEASE_CHANNEL").unwrap_or("(unknown)"),
             stable_features: vec![],
@@ -662,7 +662,7 @@ fn maybe_stage_features(sess: &Session, features: &Features, krate: &ast::Crate)
                 .map(|feat| feat.stable_since)
                 .flatten();
             if let Some(since) = stable_since {
-                err.stable_features.push(errors::StableFeature { name, since });
+                err.stable_features.push(diagnostics::StableFeature { name, since });
             } else {
                 all_stable = false;
             }
@@ -688,7 +688,11 @@ fn check_incompatible_features(sess: &Session, features: &Features) {
             && let Some((f2_name, f2_span)) = enabled_features.clone().find(|(name, _)| name == f2)
         {
             let spans = vec![f1_span, f2_span];
-            sess.dcx().emit_err(errors::IncompatibleFeatures { spans, f1: f1_name, f2: f2_name });
+            sess.dcx().emit_err(diagnostics::IncompatibleFeatures {
+                spans,
+                f1: f1_name,
+                f2: f2_name,
+            });
         }
     }
 }
@@ -709,7 +713,11 @@ fn check_dependent_features(sess: &Session, features: &Features) {
                 .map(|s| format!("`{}`", s.as_str()))
                 .intersperse(String::from(", "))
                 .collect();
-            sess.dcx().emit_err(errors::MissingDependentFeatures { parent_span, parent, missing });
+            sess.dcx().emit_err(diagnostics::MissingDependentFeatures {
+                parent_span,
+                parent,
+                missing,
+            });
         }
     }
 }
@@ -727,7 +735,7 @@ fn check_new_solver_banned_features(sess: &Session, features: &Features) {
         .map(|feat| feat.attr_sp)
     {
         #[allow(rustc::symbol_intern_string_literal)]
-        sess.dcx().emit_err(errors::IncompatibleFeatures {
+        sess.dcx().emit_err(diagnostics::IncompatibleFeatures {
             spans: vec![gce_span],
             f1: Symbol::intern("-Znext-solver=globally"),
             f2: sym::generic_const_exprs,
@@ -749,7 +757,7 @@ fn check_features_requiring_new_solver(sess: &Session, features: &Features) {
         .map(|feat| feat.attr_sp)
     {
         #[allow(rustc::symbol_intern_string_literal)]
-        sess.dcx().emit_err(errors::MissingDependentFeatures {
+        sess.dcx().emit_err(diagnostics::MissingDependentFeatures {
             parent_span: gca_span,
             parent: sym::generic_const_args,
             missing: String::from("-Znext-solver=globally"),
diff --git a/compiler/rustc_ast_passes/src/lib.rs b/compiler/rustc_ast_passes/src/lib.rs
index 8bf51dd..86ad758 100644
--- a/compiler/rustc_ast_passes/src/lib.rs
+++ b/compiler/rustc_ast_passes/src/lib.rs
@@ -9,5 +9,5 @@
 // tidy-alphabetical-end
 
 pub mod ast_validation;
-mod errors;
+mod diagnostics;
 pub mod feature_gate;
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/item.rs b/compiler/rustc_ast_pretty/src/pprust/state/item.rs
index 820c49c..86fb0e6 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/item.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/item.rs
@@ -869,14 +869,6 @@ pub fn print_where_predicate(&mut self, predicate: &ast::WherePredicate) {
                     self.print_lifetime_bounds(bounds);
                 }
             }
-            ast::WherePredicateKind::EqPredicate(ast::WhereEqPredicate {
-                lhs_ty, rhs_ty, ..
-            }) => {
-                self.print_type(lhs_ty);
-                self.space();
-                self.word_space("=");
-                self.print_type(rhs_ty);
-            }
         }
     }
 
diff --git a/compiler/rustc_attr_parsing/src/attributes/autodiff.rs b/compiler/rustc_attr_parsing/src/attributes/autodiff.rs
index 1ca433a..890cb33 100644
--- a/compiler/rustc_attr_parsing/src/attributes/autodiff.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/autodiff.rs
@@ -2,7 +2,7 @@
 
 use rustc_ast::LitKind;
 use rustc_ast::expand::autodiff_attrs::{DiffActivity, DiffMode};
-use rustc_feature::{AttributeStability, AttributeTemplate, template};
+use rustc_feature::AttributeStability;
 use rustc_hir::attrs::{AttributeKind, RustcAutodiff};
 use rustc_hir::{MethodKind, Target};
 use rustc_span::{Symbol, sym};
@@ -13,7 +13,7 @@
 use crate::context::AcceptContext;
 use crate::parser::{ArgParser, MetaItemOrLitParser};
 use crate::target_checking::AllowedTargets;
-use crate::unstable;
+use crate::{AttributeTemplate, template, unstable};
 
 pub(crate) struct RustcAutodiffParser;
 
diff --git a/compiler/rustc_attr_parsing/src/attributes/cfg.rs b/compiler/rustc_attr_parsing/src/attributes/cfg.rs
index edbb4b2..3a2f0ea 100644
--- a/compiler/rustc_attr_parsing/src/attributes/cfg.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/cfg.rs
@@ -4,9 +4,7 @@
 use rustc_ast::tokenstream::DelimSpan;
 use rustc_ast::{AttrItem, Attribute, LitKind, ast, token};
 use rustc_errors::{Applicability, Diagnostic, PResult, msg};
-use rustc_feature::{
-    AttrSuggestionStyle, AttributeTemplate, Features, GatedCfg, find_gated_cfg, template,
-};
+use rustc_feature::{Features, GatedCfg, find_gated_cfg};
 use rustc_hir::attrs::CfgEntry;
 use rustc_hir::{AttrPath, RustcVersion, Target};
 use rustc_parse::parser::{ForceCollect, Parser, Recovery};
@@ -28,7 +26,10 @@
     AttributeParseError, AttributeParseErrorReason, CfgAttrBadDelim, MetaBadDelimSugg,
     ParsedDescription,
 };
-use crate::{AttributeParser, check_cfg, parse_version, session_diagnostics};
+use crate::{
+    AttrSuggestionStyle, AttributeParser, AttributeTemplate, check_cfg, parse_version,
+    session_diagnostics, template,
+};
 
 pub const CFG_TEMPLATE: AttributeTemplate = template!(
     List: &["predicate"],
diff --git a/compiler/rustc_attr_parsing/src/attributes/cfg_select.rs b/compiler/rustc_attr_parsing/src/attributes/cfg_select.rs
index f6b49fe..934dfb5 100644
--- a/compiler/rustc_attr_parsing/src/attributes/cfg_select.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/cfg_select.rs
@@ -3,7 +3,7 @@
 use rustc_ast::{AttrStyle, NodeId, token};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::{Diagnostic, MultiSpan};
-use rustc_feature::{AttributeTemplate, Features};
+use rustc_feature::Features;
 use rustc_hir::attrs::CfgEntry;
 use rustc_hir::{AttrPath, Target};
 use rustc_parse::exp;
@@ -14,7 +14,9 @@
 
 use crate::attributes::AttributeSafety;
 use crate::parser::{AllowExprMetavar, MetaItemOrLitParser};
-use crate::{AttributeParser, ParsedDescription, ShouldEmit, errors, parse_cfg_entry};
+use crate::{
+    AttributeParser, AttributeTemplate, ParsedDescription, ShouldEmit, diagnostics, parse_cfg_entry,
+};
 
 #[derive(Clone)]
 pub enum CfgSelectPredicate {
@@ -189,10 +191,10 @@ fn lint_unreachable(
             lint_node_id,
             move |dcx, level| match wildcard_span {
                 Some(wildcard_span) => {
-                    errors::UnreachableCfgSelectPredicateWildcard { span, wildcard_span }
+                    diagnostics::UnreachableCfgSelectPredicateWildcard { span, wildcard_span }
                         .into_diag(dcx, level)
                 }
-                None => errors::UnreachableCfgSelectPredicate { span }.into_diag(dcx, level),
+                None => diagnostics::UnreachableCfgSelectPredicate { span }.into_diag(dcx, level),
             },
         );
     };
diff --git a/compiler/rustc_attr_parsing/src/attributes/crate_level.rs b/compiler/rustc_attr_parsing/src/attributes/crate_level.rs
index d6d9b76..eb78bc0 100644
--- a/compiler/rustc_attr_parsing/src/attributes/crate_level.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/crate_level.rs
@@ -5,7 +5,7 @@
 use rustc_span::edit_distance::find_best_match_for_name;
 
 use super::prelude::*;
-use crate::errors::{UnknownCrateTypes, UnknownCrateTypesSuggestion};
+use crate::diagnostics::{UnknownCrateTypes, UnknownCrateTypesSuggestion};
 
 pub(crate) struct CrateNameParser;
 
@@ -13,7 +13,8 @@ impl SingleAttributeParser for CrateNameParser {
     const PATH: &[Symbol] = &[sym::crate_name];
     const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError;
     const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const STABILITY: AttributeStability = AttributeStability::Stable;
 
     fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
@@ -31,7 +32,8 @@ impl CombineAttributeParser for CrateTypeParser {
     const PATH: &[Symbol] = &[sym::crate_type];
     type Item = CrateType;
     const CONVERT: ConvertFn<Self::Item> = |items, _| AttributeKind::CrateType(items);
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const TEMPLATE: AttributeTemplate =
         template!(NameValueStr: "crate type", "https://doc.rust-lang.org/reference/linkage.html");
     const STABILITY: AttributeStability = AttributeStability::Stable;
@@ -74,7 +76,8 @@ impl SingleAttributeParser for RecursionLimitParser {
     const PATH: &[Symbol] = &[sym::recursion_limit];
     const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError;
     const TEMPLATE: AttributeTemplate = template!(NameValueStr: "N", "https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute");
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const STABILITY: AttributeStability = AttributeStability::Stable;
 
     fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
@@ -105,7 +108,8 @@ impl SingleAttributeParser for TypeLengthLimitParser {
     const PATH: &[Symbol] = &[sym::type_length_limit];
     const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError;
     const TEMPLATE: AttributeTemplate = template!(NameValueStr: "N");
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const STABILITY: AttributeStability = AttributeStability::Stable;
 
     fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
@@ -147,7 +151,8 @@ impl NoArgsAttributeParser for NoCoreParser {
 impl NoArgsAttributeParser for NoStdParser {
     const PATH: &[Symbol] = &[sym::no_std];
     const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn;
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const STABILITY: AttributeStability = AttributeStability::Stable;
     const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NoStd;
 }
@@ -157,7 +162,8 @@ impl NoArgsAttributeParser for NoStdParser {
 impl NoArgsAttributeParser for NoMainParser {
     const PATH: &[Symbol] = &[sym::no_main];
     const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn;
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const STABILITY: AttributeStability = AttributeStability::Stable;
     const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NoMain;
 }
@@ -176,7 +182,8 @@ impl NoArgsAttributeParser for RustcCoherenceIsCoreParser {
 impl SingleAttributeParser for WindowsSubsystemParser {
     const PATH: &[Symbol] = &[sym::windows_subsystem];
     const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError;
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const TEMPLATE: AttributeTemplate = template!(NameValueStr: ["windows", "console"], "https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute");
     const STABILITY: AttributeStability = AttributeStability::Stable;
 
@@ -231,7 +238,8 @@ impl NoArgsAttributeParser for ProfilerRuntimeParser {
 impl NoArgsAttributeParser for NoBuiltinsParser {
     const PATH: &[Symbol] = &[sym::no_builtins];
     const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn;
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const STABILITY: AttributeStability = AttributeStability::Stable;
     const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::NoBuiltins;
 }
@@ -269,7 +277,8 @@ impl CombineAttributeParser for FeatureParser {
     const PATH: &[Symbol] = &[sym::feature];
     type Item = Ident;
     const CONVERT: ConvertFn<Self::Item> = AttributeKind::Feature;
-    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
+    const ALLOWED_TARGETS: AllowedTargets =
+        AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]);
     const TEMPLATE: AttributeTemplate = template!(List: &["feature1, feature2, ..."]);
     const STABILITY: AttributeStability = AttributeStability::Stable;
 
diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/do_not_recommend.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/do_not_recommend.rs
index 4cb1f20..5b61e83 100644
--- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/do_not_recommend.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/do_not_recommend.rs
@@ -1,4 +1,4 @@
-use rustc_feature::{AttributeStability, AttributeTemplate, template};
+use rustc_feature::AttributeStability;
 use rustc_hir::Target;
 use rustc_hir::attrs::AttributeKind;
 use rustc_session::lint::builtin::{
@@ -8,9 +8,10 @@
 
 use crate::attributes::{OnDuplicate, SingleAttributeParser};
 use crate::context::AcceptContext;
-use crate::errors::IncorrectDoNotRecommendLocation;
+use crate::diagnostics::IncorrectDoNotRecommendLocation;
 use crate::parser::ArgParser;
 use crate::target_checking::{ALL_TARGETS, AllowedTargets};
+use crate::{AttributeTemplate, template};
 
 pub(crate) struct DoNotRecommendParser;
 impl SingleAttributeParser for DoNotRecommendParser {
@@ -26,7 +27,7 @@ fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<Attribute
         if !matches!(args, ArgParser::NoArgs) {
             cx.emit_lint(
                 MALFORMED_DIAGNOSTIC_ATTRIBUTES,
-                crate::errors::DoNotRecommendDoesNotExpectArgs,
+                crate::diagnostics::DoNotRecommendDoesNotExpectArgs,
                 attr_span,
             );
         }
diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs
index f85095e..00adce2 100644
--- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs
@@ -1,12 +1,9 @@
 use std::ops::Range;
 
-use rustc_errors::E0232;
-use rustc_hir::AttrPath;
 use rustc_hir::attrs::diagnostic::{
     Directive, Filter, FilterFormatString, Flag, FormatArg, FormatString, LitOrArg, Name,
     NameValue, Piece, Predicate,
 };
-use rustc_macros::Diagnostic;
 use rustc_parse_format::{
     Argument, FormatSpec, ParseError, ParseMode, Parser, Piece as RpfPiece, Position,
 };
@@ -17,9 +14,10 @@
 use thin_vec::{ThinVec, thin_vec};
 
 use crate::context::AcceptContext;
-use crate::errors::{
-    FormatWarning, IgnoredDiagnosticOption, MalFormedDiagnosticAttributeLint,
-    MissingOptionsForDiagnosticAttribute, NonMetaItemDiagnosticAttribute, WrappedParserError,
+use crate::diagnostics::{
+    DupesNotAllowed, FormatWarning, IgnoredDiagnosticOption, InvalidOnClause,
+    MalFormedDiagnosticAttributeLint, MissingOptionsForDiagnosticAttribute,
+    NonMetaItemDiagnosticAttribute, WrappedParserError,
 };
 use crate::parser::{ArgParser, MetaItemListParser, MetaItemOrLitParser, MetaItemParser};
 
@@ -611,54 +609,3 @@ fn parse_filter_format(input: Symbol) -> FilterFormatString {
         .collect();
     FilterFormatString { pieces }
 }
-
-#[derive(Diagnostic)]
-pub(crate) enum InvalidOnClause {
-    #[diag("empty `on`-clause in `#[rustc_on_unimplemented]`", code = E0232)]
-    Empty {
-        #[primary_span]
-        #[label("empty `on`-clause here")]
-        span: Span,
-    },
-    #[diag("expected a single predicate in `not(..)`", code = E0232)]
-    ExpectedOnePredInNot {
-        #[primary_span]
-        #[label("unexpected quantity of predicates here")]
-        span: Span,
-    },
-    #[diag("literals inside `on`-clauses are not supported", code = E0232)]
-    UnsupportedLiteral {
-        #[primary_span]
-        #[label("unexpected literal here")]
-        span: Span,
-    },
-    #[diag("expected an identifier inside this `on`-clause", code = E0232)]
-    ExpectedIdentifier {
-        #[primary_span]
-        #[label("expected an identifier here, not `{$path}`")]
-        span: Span,
-        path: AttrPath,
-    },
-    #[diag("this predicate is invalid", code = E0232)]
-    InvalidPredicate {
-        #[primary_span]
-        #[label("expected one of `any`, `all` or `not` here, not `{$invalid_pred}`")]
-        span: Span,
-        invalid_pred: Symbol,
-    },
-    #[diag("invalid flag in `on`-clause", code = E0232)]
-    InvalidFlag {
-        #[primary_span]
-        #[label(
-            "expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `{$invalid_flag}`"
-        )]
-        span: Span,
-        invalid_flag: Symbol,
-    },
-}
-
-#[derive(Diagnostic)]
-#[diag(
-    "using multiple `rustc_on_unimplemented` (or mixing it with `diagnostic::on_unimplemented`) is not supported"
-)]
-pub(crate) struct DupesNotAllowed;
diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs
index c8d137c..42159e8 100644
--- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs
@@ -4,7 +4,7 @@
 
 use crate::attributes::diagnostic::*;
 use crate::attributes::prelude::*;
-use crate::errors::DiagnosticOnConstOnlyForTraitImpls;
+use crate::diagnostics::DiagnosticOnConstOnlyForTraitImpls;
 #[derive(Default)]
 pub(crate) struct OnConstParser {
     span: Option<Span>,
diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs
index 0b78ac9..38d2e7f 100644
--- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs
@@ -1,4 +1,4 @@
-use rustc_feature::{AttributeStability, template};
+use rustc_feature::AttributeStability;
 use rustc_hir::attrs::AttributeKind;
 use rustc_session::lint::builtin::MISPLACED_DIAGNOSTIC_ATTRIBUTES;
 use rustc_span::sym;
@@ -6,9 +6,10 @@
 use crate::attributes::diagnostic::*;
 use crate::attributes::prelude::*;
 use crate::context::AcceptContext;
-use crate::errors::DiagnosticOnMoveOnlyForAdt;
+use crate::diagnostics::DiagnosticOnMoveOnlyForAdt;
 use crate::parser::ArgParser;
 use crate::target_checking::{ALL_TARGETS, AllowedTargets};
+use crate::template;
 
 #[derive(Default)]
 pub(crate) struct OnMoveParser {
diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs
index 6fe5de8..b06bf88 100644
--- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs
@@ -4,7 +4,7 @@
 
 use crate::attributes::diagnostic::*;
 use crate::attributes::prelude::*;
-use crate::errors::DiagnosticOnUnimplementedOnlyForTraits;
+use crate::diagnostics::DiagnosticOnUnimplementedOnlyForTraits;
 
 #[derive(Default)]
 pub(crate) struct OnUnimplementedParser {
diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs
index 4833b70..0cc8d3e 100644
--- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs
@@ -5,7 +5,7 @@
 use crate::ShouldEmit;
 use crate::attributes::diagnostic::*;
 use crate::attributes::prelude::*;
-use crate::errors::DiagnosticOnUnknownOnlyForImports;
+use crate::diagnostics::DiagnosticOnUnknownOnlyForImports;
 
 #[derive(Default)]
 pub(crate) struct OnUnknownParser {
diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unmatch_args.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unmatch_args.rs
index b941ee1..4d6f833 100644
--- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unmatch_args.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unmatch_args.rs
@@ -4,7 +4,7 @@
 
 use crate::attributes::diagnostic::*;
 use crate::attributes::prelude::*;
-use crate::errors::DiagnosticOnUnmatchArgsOnlyForMacros;
+use crate::diagnostics::DiagnosticOnUnmatchArgsOnlyForMacros;
 
 #[derive(Default)]
 pub(crate) struct OnUnmatchArgsParser {
diff --git a/compiler/rustc_attr_parsing/src/attributes/doc.rs b/compiler/rustc_attr_parsing/src/attributes/doc.rs
index 42024a4..382f053 100644
--- a/compiler/rustc_attr_parsing/src/attributes/doc.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/doc.rs
@@ -1,6 +1,6 @@
 use rustc_ast::ast::{AttrStyle, LitKind, MetaItemLit};
 use rustc_errors::{Applicability, msg};
-use rustc_feature::{AttributeStability, template};
+use rustc_feature::AttributeStability;
 use rustc_hir::Target;
 use rustc_hir::attrs::{
     AttributeKind, CfgEntry, CfgHideShow, CfgInfo, DocAttribute, DocInline, HideOrShow,
@@ -10,9 +10,9 @@
 use thin_vec::ThinVec;
 
 use super::prelude::{ALL_TARGETS, AllowedTargets};
-use super::{AcceptMapping, AttributeParser};
+use super::{AcceptMapping, AttributeParser, template};
 use crate::context::{AcceptContext, FinalizeContext};
-use crate::errors::{
+use crate::diagnostics::{
     AttrCrateLevelOnly, DocAliasDuplicated, DocAutoCfgExpectsHideOrShow,
     DocAutoCfgHideShowExpectsList, DocAutoCfgHideShowUnexpectedItem, DocAutoCfgWrongLiteral,
     DocTestLiteral, DocTestTakesList, DocTestUnknown, DocUnknownAny, DocUnknownInclude,
diff --git a/compiler/rustc_attr_parsing/src/attributes/dummy.rs b/compiler/rustc_attr_parsing/src/attributes/dummy.rs
index 9e2c642..d436c7f 100644
--- a/compiler/rustc_attr_parsing/src/attributes/dummy.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/dummy.rs
@@ -1,4 +1,4 @@
-use rustc_feature::{AttributeStability, AttributeTemplate, template};
+use rustc_feature::AttributeStability;
 use rustc_hir::attrs::AttributeKind;
 use rustc_span::{Symbol, sym};
 
@@ -6,7 +6,7 @@
 use crate::context::AcceptContext;
 use crate::parser::ArgParser;
 use crate::target_checking::AllowedTargets;
-use crate::unstable;
+use crate::{AttributeTemplate, template, unstable};
 
 pub(crate) struct RustcDummyParser;
 impl SingleAttributeParser for RustcDummyParser {
diff --git a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
index e172fb0..8ad202b 100644
--- a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
@@ -35,7 +35,6 @@ pub(crate) struct MacroUseParser {
 const MACRO_USE_ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[
     Allow(Target::Mod),
     Allow(Target::ExternCrate),
-    Allow(Target::Crate),
     Error(Target::WherePredicate),
 ]);
 
diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs
index 73662bb..325db4f 100644
--- a/compiler/rustc_attr_parsing/src/attributes/mod.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs
@@ -20,7 +20,7 @@
 
 use std::marker::PhantomData;
 
-use rustc_feature::{AttributeStability, AttributeTemplate, template};
+use rustc_feature::AttributeStability;
 use rustc_hir::attrs::AttributeKind;
 use rustc_span::edition::Edition;
 use rustc_span::{Span, Symbol};
@@ -30,6 +30,7 @@
 use crate::parser::ArgParser;
 use crate::session_diagnostics::UnusedMultiple;
 use crate::target_checking::AllowedTargets;
+use crate::{AttributeTemplate, template};
 
 /// All the parsers require roughly the same imports, so this prelude has most of the often-needed ones.
 mod prelude;
diff --git a/compiler/rustc_attr_parsing/src/attributes/prelude.rs b/compiler/rustc_attr_parsing/src/attributes/prelude.rs
index 15d5485..4dd8f71 100644
--- a/compiler/rustc_attr_parsing/src/attributes/prelude.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/prelude.rs
@@ -1,7 +1,5 @@
 // data structures
 #[doc(hidden)]
-pub(super) use rustc_feature::{AttributeTemplate, template};
-#[doc(hidden)]
 pub(super) use rustc_hir::attrs::AttributeKind;
 #[doc(hidden)]
 pub(super) use rustc_hir::{MethodKind, Target};
@@ -27,3 +25,4 @@
 pub(super) use crate::target_checking::{ALL_TARGETS, AllowedTargets};
 #[doc(hidden)]
 pub(super) use crate::unstable;
+pub(super) use crate::{AttributeTemplate, template};
diff --git a/compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs
index e6c9d80..887eb66 100644
--- a/compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs
@@ -121,7 +121,7 @@ fn parse_derive_like(
             if rustc_feature::is_builtin_attr_name(ident.name) {
                 cx.emit_lint(
                     AMBIGUOUS_DERIVE_HELPERS,
-                    crate::errors::AmbiguousDeriveHelpers,
+                    crate::diagnostics::AmbiguousDeriveHelpers,
                     ident.span,
                 );
             }
diff --git a/compiler/rustc_attr_parsing/src/attributes/prototype.rs b/compiler/rustc_attr_parsing/src/attributes/prototype.rs
index 40d6a80..ddc40e6 100644
--- a/compiler/rustc_attr_parsing/src/attributes/prototype.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/prototype.rs
@@ -1,6 +1,6 @@
 //! Attributes that are only used on function prototypes.
 
-use rustc_feature::{AttributeStability, AttributeTemplate, template};
+use rustc_feature::AttributeStability;
 use rustc_hir::Target;
 use rustc_hir::attrs::{AttributeKind, MirDialect, MirPhase};
 use rustc_span::{Span, Symbol, sym};
@@ -10,7 +10,7 @@
 use crate::parser::{ArgParser, NameValueParser};
 use crate::target_checking::AllowedTargets;
 use crate::target_checking::Policy::Allow;
-use crate::{session_diagnostics, unstable};
+use crate::{AttributeTemplate, session_diagnostics, template, unstable};
 
 pub(crate) struct CustomMirParser;
 
diff --git a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
index 6e1060e..6552c9d 100644
--- a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
@@ -11,7 +11,7 @@
 
 use super::prelude::*;
 use super::util::parse_single_integer;
-use crate::errors;
+use crate::diagnostics;
 use crate::session_diagnostics::{
     AttributeRequiresOpt, CguFieldsMissing, RustcScalableVectorCountOutOfRange, UnknownLangItem,
 };
@@ -58,7 +58,8 @@ fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<Attribute
             };
 
             let Some(ident) = meta.ident() else {
-                cx.dcx().emit_err(errors::MustBeNameOfAssociatedFunction { span: meta.span() });
+                cx.dcx()
+                    .emit_err(diagnostics::MustBeNameOfAssociatedFunction { span: meta.span() });
                 errored = true;
                 continue;
             };
diff --git a/compiler/rustc_attr_parsing/src/attributes/semantics.rs b/compiler/rustc_attr_parsing/src/attributes/semantics.rs
index 3e341aa..07c07eb 100644
--- a/compiler/rustc_attr_parsing/src/attributes/semantics.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/semantics.rs
@@ -9,3 +9,15 @@ impl NoArgsAttributeParser for MayDangleParser {
     const STABILITY: AttributeStability = unstable!(dropck_eyepatch);
     const CREATE: fn(span: Span) -> AttributeKind = AttributeKind::MayDangle;
 }
+
+pub(crate) struct ComptimeParser;
+impl NoArgsAttributeParser for ComptimeParser {
+    const PATH: &[Symbol] = &[sym::rustc_comptime];
+    const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error;
+    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
+        Allow(Target::Method(MethodKind::Inherent)),
+        Allow(Target::Fn),
+    ]);
+    const STABILITY: AttributeStability = unstable!(rustc_attrs);
+    const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcComptime;
+}
diff --git a/compiler/rustc_attr_parsing/src/check_cfg.rs b/compiler/rustc_attr_parsing/src/check_cfg.rs
index 33db99c..44c44c6 100644
--- a/compiler/rustc_attr_parsing/src/check_cfg.rs
+++ b/compiler/rustc_attr_parsing/src/check_cfg.rs
@@ -4,7 +4,7 @@
 use rustc_span::edit_distance::find_best_match_for_name;
 use rustc_span::{ExpnKind, Ident, Span, Symbol, sym};
 
-use crate::errors;
+use crate::diagnostics;
 
 const MAX_CHECK_CFG_NAMES_OR_VALUES: usize = 35;
 
@@ -61,38 +61,47 @@ fn to_check_cfg_arg(name: Ident, value: Option<Symbol>, quotes: EscapeQuotes) ->
 fn cargo_help_sub(
     sess: &Session,
     inst: &impl Fn(EscapeQuotes) -> String,
-) -> errors::UnexpectedCfgCargoHelp {
+) -> diagnostics::UnexpectedCfgCargoHelp {
     // We don't want to suggest the `build.rs` way to expected cfgs if we are already in a
     // `build.rs`. We therefor do a best effort check (looking if the `--crate-name` is
     // `build_script_build`) to try to figure out if we are building a Cargo build script
 
     let unescaped = &inst(EscapeQuotes::No);
     if let Some("build_script_build") = sess.opts.crate_name.as_deref() {
-        errors::UnexpectedCfgCargoHelp::lint_cfg(unescaped)
+        diagnostics::UnexpectedCfgCargoHelp::lint_cfg(unescaped)
     } else {
-        errors::UnexpectedCfgCargoHelp::lint_cfg_and_build_rs(unescaped, &inst(EscapeQuotes::Yes))
+        diagnostics::UnexpectedCfgCargoHelp::lint_cfg_and_build_rs(
+            unescaped,
+            &inst(EscapeQuotes::Yes),
+        )
     }
 }
 
-fn rustc_macro_help(span: Span) -> Option<errors::UnexpectedCfgRustcMacroHelp> {
+fn rustc_macro_help(span: Span) -> Option<diagnostics::UnexpectedCfgRustcMacroHelp> {
     let oexpn = span.ctxt().outer_expn_data();
     if let Some(def_id) = oexpn.macro_def_id
         && let ExpnKind::Macro(macro_kind, macro_name) = oexpn.kind
         && def_id.krate != LOCAL_CRATE
     {
-        Some(errors::UnexpectedCfgRustcMacroHelp { macro_kind: macro_kind.descr(), macro_name })
+        Some(diagnostics::UnexpectedCfgRustcMacroHelp {
+            macro_kind: macro_kind.descr(),
+            macro_name,
+        })
     } else {
         None
     }
 }
 
-fn cargo_macro_help(span: Span) -> Option<errors::UnexpectedCfgCargoMacroHelp> {
+fn cargo_macro_help(span: Span) -> Option<diagnostics::UnexpectedCfgCargoMacroHelp> {
     let oexpn = span.ctxt().outer_expn_data();
     if let Some(def_id) = oexpn.macro_def_id
         && def_id.krate != LOCAL_CRATE
         && let ExpnKind::Macro(macro_kind, macro_name) = oexpn.kind
     {
-        Some(errors::UnexpectedCfgCargoMacroHelp { macro_kind: macro_kind.descr(), macro_name })
+        Some(diagnostics::UnexpectedCfgCargoMacroHelp {
+            macro_kind: macro_kind.descr(),
+            macro_name,
+        })
     } else {
         None
     }
@@ -102,7 +111,7 @@ pub(crate) fn unexpected_cfg_name(
     sess: &Session,
     (name, name_span): (Symbol, Span),
     value: Option<(Symbol, Span)>,
-) -> errors::UnexpectedCfgName {
+) -> diagnostics::UnexpectedCfgName {
     #[allow(rustc::potential_query_instability)]
     let possibilities: Vec<Symbol> = sess.check_config.expecteds.keys().copied().collect();
 
@@ -136,12 +145,12 @@ fn miscapitalized_boolean(name: Symbol) -> Option<bool> {
     }
 
     let code_sugg = if is_feature_cfg && is_from_cargo {
-        errors::unexpected_cfg_name::CodeSuggestion::DefineFeatures
+        diagnostics::unexpected_cfg_name::CodeSuggestion::DefineFeatures
     // Suggest correct `version("..")` predicate syntax
     } else if let Some((_value, value_span)) = value
         && name == sym::version
     {
-        errors::unexpected_cfg_name::CodeSuggestion::VersionSyntax {
+        diagnostics::unexpected_cfg_name::CodeSuggestion::VersionSyntax {
             between_name_and_value: name_span.between(value_span),
             after_value: value_span.shrink_to_hi(),
         }
@@ -156,7 +165,7 @@ fn miscapitalized_boolean(name: Symbol) -> Option<bool> {
             .span_to_snippet(name_span)
             .map_or(true, |snippet| !snippet.contains("r#"))
     {
-        errors::unexpected_cfg_name::CodeSuggestion::BooleanLiteral {
+        diagnostics::unexpected_cfg_name::CodeSuggestion::BooleanLiteral {
             span: name_span,
             literal: boolean,
         }
@@ -176,7 +185,10 @@ fn miscapitalized_boolean(name: Symbol) -> Option<bool> {
                 if !possibilities.is_empty() {
                     let possibilities =
                         possibilities.iter().copied().cloned().collect::<Vec<_>>().into();
-                    Some(errors::unexpected_cfg_name::ExpectedValues { best_match, possibilities })
+                    Some(diagnostics::unexpected_cfg_name::ExpectedValues {
+                        best_match,
+                        possibilities,
+                    })
                 } else {
                     None
                 }
@@ -185,37 +197,37 @@ fn miscapitalized_boolean(name: Symbol) -> Option<bool> {
             let best_match = Ident::new(best_match, name_span);
             if let Some((value, value_span)) = value {
                 if best_match_values.contains(&Some(value)) {
-                    errors::unexpected_cfg_name::CodeSuggestion::SimilarNameAndValue {
+                    diagnostics::unexpected_cfg_name::CodeSuggestion::SimilarNameAndValue {
                         span: name_span,
                         code: best_match.to_string(),
                     }
                 } else if best_match_values.contains(&None) {
-                    errors::unexpected_cfg_name::CodeSuggestion::SimilarNameNoValue {
+                    diagnostics::unexpected_cfg_name::CodeSuggestion::SimilarNameNoValue {
                         span: name_span.to(value_span),
                         code: best_match.to_string(),
                     }
                 } else if let Some(first_value) = possibilities.first() {
-                    errors::unexpected_cfg_name::CodeSuggestion::SimilarNameDifferentValues {
+                    diagnostics::unexpected_cfg_name::CodeSuggestion::SimilarNameDifferentValues {
                         span: name_span.to(value_span),
                         code: format!("{best_match} = \"{first_value}\""),
                         expected: get_possibilities_sub(),
                     }
                 } else {
-                    errors::unexpected_cfg_name::CodeSuggestion::SimilarNameDifferentValues {
+                    diagnostics::unexpected_cfg_name::CodeSuggestion::SimilarNameDifferentValues {
                         span: name_span.to(value_span),
                         code: best_match.to_string(),
                         expected: get_possibilities_sub(),
                     }
                 }
             } else {
-                errors::unexpected_cfg_name::CodeSuggestion::SimilarName {
+                diagnostics::unexpected_cfg_name::CodeSuggestion::SimilarName {
                     span: name_span,
                     code: best_match.to_string(),
                     expected: get_possibilities_sub(),
                 }
             }
         } else {
-            errors::unexpected_cfg_name::CodeSuggestion::SimilarName {
+            diagnostics::unexpected_cfg_name::CodeSuggestion::SimilarName {
                 span: name_span,
                 code: best_match.to_string(),
                 expected: None,
@@ -226,7 +238,7 @@ fn miscapitalized_boolean(name: Symbol) -> Option<bool> {
             names_possibilities.sort();
             names_possibilities
                 .iter()
-                .map(|cfg_name| errors::unexpected_cfg_name::FoundWithSimilarValue {
+                .map(|cfg_name| diagnostics::unexpected_cfg_name::FoundWithSimilarValue {
                     span: name_span,
                     code: format!("{cfg_name} = \"{name}\""),
                 })
@@ -240,14 +252,14 @@ fn miscapitalized_boolean(name: Symbol) -> Option<bool> {
         let expected_names = if !possibilities.is_empty() {
             let possibilities: Vec<_> =
                 possibilities.into_iter().map(|s| Ident::new(s, name_span)).collect();
-            Some(errors::unexpected_cfg_name::ExpectedNames {
+            Some(diagnostics::unexpected_cfg_name::ExpectedNames {
                 possibilities: possibilities.into(),
                 and_more,
             })
         } else {
             None
         };
-        errors::unexpected_cfg_name::CodeSuggestion::SimilarValues {
+        diagnostics::unexpected_cfg_name::CodeSuggestion::SimilarValues {
             with_similar_values: similar_values,
             expected_names,
         }
@@ -263,26 +275,26 @@ fn miscapitalized_boolean(name: Symbol) -> Option<bool> {
         } else {
             None
         };
-        errors::unexpected_cfg_name::InvocationHelp::Cargo {
+        diagnostics::unexpected_cfg_name::InvocationHelp::Cargo {
             help,
             macro_help: cargo_macro_help(name_span),
         }
     } else {
-        let help = errors::UnexpectedCfgRustcHelp::new(&inst(EscapeQuotes::No));
-        errors::unexpected_cfg_name::InvocationHelp::Rustc {
+        let help = diagnostics::UnexpectedCfgRustcHelp::new(&inst(EscapeQuotes::No));
+        diagnostics::unexpected_cfg_name::InvocationHelp::Rustc {
             help,
             macro_help: rustc_macro_help(name_span),
         }
     };
 
-    errors::UnexpectedCfgName { code_sugg, invocation_help, name }
+    diagnostics::UnexpectedCfgName { code_sugg, invocation_help, name }
 }
 
 pub(crate) fn unexpected_cfg_value(
     sess: &Session,
     (name, name_span): (Symbol, Span),
     value: Option<(Symbol, Span)>,
-) -> errors::UnexpectedCfgValue {
+) -> diagnostics::UnexpectedCfgValue {
     let Some(ExpectedValues::Some(values)) = &sess.check_config.expecteds.get(&name) else {
         panic!(
             "it shouldn't be possible to have a diagnostic on a value whose name is not in values"
@@ -313,13 +325,13 @@ pub(crate) fn unexpected_cfg_value(
             .iter()
             .take(max_suggestions)
             .copied()
-            .map(|name| errors::unexpected_cfg_value::ChangeNameSuggestion {
+            .map(|name| diagnostics::unexpected_cfg_value::ChangeNameSuggestion {
                 span: name_span,
                 name,
                 value,
             })
             .collect::<Vec<_>>();
-        errors::unexpected_cfg_value::CodeSuggestion::ChangeName { suggestions }
+        diagnostics::unexpected_cfg_value::CodeSuggestion::ChangeName { suggestions }
     } else if !possibilities.is_empty() {
         // Show the full list if all possible values for a given name, but don't do it
         // for names as the possibilities could be very long
@@ -329,7 +341,7 @@ pub(crate) fn unexpected_cfg_value(
                 possibilities.clone(),
                 FilterWellKnownNames::No,
             );
-            errors::unexpected_cfg_value::ExpectedValues {
+            diagnostics::unexpected_cfg_value::ExpectedValues {
                 name,
                 have_none_possibility,
                 possibilities: possibilities.into(),
@@ -340,7 +352,7 @@ pub(crate) fn unexpected_cfg_value(
         let suggestion = if let Some((value, value_span)) = value {
             // Suggest the most probable if we found one
             if let Some(best_match) = find_best_match_for_name(&possibilities, value, None) {
-                Some(errors::unexpected_cfg_value::ChangeValueSuggestion::SimilarName {
+                Some(diagnostics::unexpected_cfg_value::ChangeValueSuggestion::SimilarName {
                     span: value_span,
                     best_match,
                 })
@@ -348,7 +360,7 @@ pub(crate) fn unexpected_cfg_value(
                 None
             }
         } else if let &[first_possibility] = &possibilities[..] {
-            Some(errors::unexpected_cfg_value::ChangeValueSuggestion::SpecifyValue {
+            Some(diagnostics::unexpected_cfg_value::ChangeValueSuggestion::SpecifyValue {
                 span: name_span.shrink_to_hi(),
                 first_possibility,
             })
@@ -356,21 +368,25 @@ pub(crate) fn unexpected_cfg_value(
             None
         };
 
-        errors::unexpected_cfg_value::CodeSuggestion::ChangeValue { expected_values, suggestion }
+        diagnostics::unexpected_cfg_value::CodeSuggestion::ChangeValue {
+            expected_values,
+            suggestion,
+        }
     } else if have_none_possibility {
-        let suggestion =
-            value.map(|(_value, value_span)| errors::unexpected_cfg_value::RemoveValueSuggestion {
+        let suggestion = value.map(|(_value, value_span)| {
+            diagnostics::unexpected_cfg_value::RemoveValueSuggestion {
                 span: name_span.shrink_to_hi().to(value_span),
-            });
-        errors::unexpected_cfg_value::CodeSuggestion::RemoveValue { suggestion, name }
+            }
+        });
+        diagnostics::unexpected_cfg_value::CodeSuggestion::RemoveValue { suggestion, name }
     } else {
         let span = if let Some((_value, value_span)) = value {
             name_span.to(value_span)
         } else {
             name_span
         };
-        let suggestion = errors::unexpected_cfg_value::RemoveConditionSuggestion { span };
-        errors::unexpected_cfg_value::CodeSuggestion::RemoveCondition { suggestion, name }
+        let suggestion = diagnostics::unexpected_cfg_value::RemoveConditionSuggestion { span };
+        diagnostics::unexpected_cfg_value::CodeSuggestion::RemoveCondition { suggestion, name }
     };
 
     // We don't want to encourage people to add values to a well-known names, as these are
@@ -391,32 +407,32 @@ pub(crate) fn unexpected_cfg_value(
     let invocation_help = if is_from_cargo {
         let help = if name == sym::feature && !is_from_external_macro {
             if let Some((value, _value_span)) = value {
-                Some(errors::unexpected_cfg_value::CargoHelp::AddFeature { value })
+                Some(diagnostics::unexpected_cfg_value::CargoHelp::AddFeature { value })
             } else {
-                Some(errors::unexpected_cfg_value::CargoHelp::DefineFeatures)
+                Some(diagnostics::unexpected_cfg_value::CargoHelp::DefineFeatures)
             }
         } else if can_suggest_adding_value && !is_from_external_macro {
-            Some(errors::unexpected_cfg_value::CargoHelp::Other(cargo_help_sub(sess, &inst)))
+            Some(diagnostics::unexpected_cfg_value::CargoHelp::Other(cargo_help_sub(sess, &inst)))
         } else {
             None
         };
-        errors::unexpected_cfg_value::InvocationHelp::Cargo {
+        diagnostics::unexpected_cfg_value::InvocationHelp::Cargo {
             help,
             macro_help: cargo_macro_help(name_span),
         }
     } else {
         let help = if can_suggest_adding_value {
-            Some(errors::UnexpectedCfgRustcHelp::new(&inst(EscapeQuotes::No)))
+            Some(diagnostics::UnexpectedCfgRustcHelp::new(&inst(EscapeQuotes::No)))
         } else {
             None
         };
-        errors::unexpected_cfg_value::InvocationHelp::Rustc {
+        diagnostics::unexpected_cfg_value::InvocationHelp::Rustc {
             help,
             macro_help: rustc_macro_help(name_span),
         }
     };
 
-    errors::UnexpectedCfgValue {
+    diagnostics::UnexpectedCfgValue {
         code_sugg,
         invocation_help,
         has_value: value.is_some(),
diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs
index 3ef8c66..8da5058 100644
--- a/compiler/rustc_attr_parsing/src/context.rs
+++ b/compiler/rustc_attr_parsing/src/context.rs
@@ -11,7 +11,7 @@
 use rustc_ast::{AttrStyle, MetaItemLit, Safety};
 use rustc_data_structures::sync::{DynSend, DynSync};
 use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level, MultiSpan};
-use rustc_feature::{AttrSuggestionStyle, AttributeStability, AttributeTemplate};
+use rustc_feature::AttributeStability;
 use rustc_hir::AttrPath;
 use rustc_hir::attrs::AttributeKind;
 use rustc_parse::parser::Recovery;
@@ -56,7 +56,7 @@
 use crate::attributes::rustc_allocator::*;
 use crate::attributes::rustc_dump::*;
 use crate::attributes::rustc_internal::*;
-use crate::attributes::semantics::*;
+use crate::attributes::semantics::{ComptimeParser, *};
 use crate::attributes::stability::*;
 use crate::attributes::test_attrs::*;
 use crate::attributes::traits::*;
@@ -71,7 +71,7 @@
     ParsedDescription,
 };
 use crate::target_checking::AllowedTargets;
-use crate::{AttributeParser, EmitAttribute};
+use crate::{AttrSuggestionStyle, AttributeParser, AttributeTemplate, EmitAttribute};
 
 type GroupType = LazyLock<GroupTypeInner>;
 
@@ -234,6 +234,7 @@ macro_rules! attribute_parsers {
         Single<WithoutArgs<AutomaticallyDerivedParser>>,
         Single<WithoutArgs<ColdParser>>,
         Single<WithoutArgs<CompilerBuiltinsParser>>,
+        Single<WithoutArgs<ComptimeParser>>,
         Single<WithoutArgs<ConstContinueParser>>,
         Single<WithoutArgs<CoroutineParser>>,
         Single<WithoutArgs<DefaultLibAllocatorParser>>,
@@ -1054,7 +1055,11 @@ pub(crate) fn warn_empty_attribute(&mut self, span: Span) {
         let valid_without_list = self.template.word;
         self.emit_lint(
             rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
-            crate::errors::EmptyAttributeList { attr_span: span, attr_path, valid_without_list },
+            crate::diagnostics::EmptyAttributeList {
+                attr_span: span,
+                attr_path,
+                valid_without_list,
+            },
             span,
         );
     }
@@ -1071,7 +1076,7 @@ pub(crate) fn warn_ill_formed_attribute_input_with_help(
         let span = self.attr_span;
         self.emit_lint(
             lint,
-            crate::errors::IllFormedAttributeInput::new(&suggestions, None, help.as_deref()),
+            crate::diagnostics::IllFormedAttributeInput::new(&suggestions, None, help.as_deref()),
             span,
         );
     }
diff --git a/compiler/rustc_attr_parsing/src/errors.rs b/compiler/rustc_attr_parsing/src/diagnostics.rs
similarity index 92%
rename from compiler/rustc_attr_parsing/src/errors.rs
rename to compiler/rustc_attr_parsing/src/diagnostics.rs
index 5f89829..220da9b 100644
--- a/compiler/rustc_attr_parsing/src/errors.rs
+++ b/compiler/rustc_attr_parsing/src/diagnostics.rs
@@ -1,4 +1,5 @@
-use rustc_errors::{Applicability, DiagArgValue, MultiSpan};
+use rustc_errors::{Applicability, DiagArgValue, E0232, MultiSpan};
+use rustc_hir::AttrPath;
 use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_span::{Span, Symbol};
 
@@ -148,6 +149,8 @@ pub(crate) struct InvalidAttrStyle {
     pub crate_root_path: String,
     #[help("the crate root is at `{$crate_root_path}`")]
     pub show_crate_root_help: bool,
+    #[primary_span]
+    pub span: Span,
 }
 
 #[derive(Diagnostic)]
@@ -772,3 +775,54 @@ pub(crate) enum CargoHelp {
         Other(#[subdiagnostic] super::UnexpectedCfgCargoHelp),
     }
 }
+
+#[derive(Diagnostic)]
+pub(crate) enum InvalidOnClause {
+    #[diag("empty `on`-clause in `#[rustc_on_unimplemented]`", code = E0232)]
+    Empty {
+        #[primary_span]
+        #[label("empty `on`-clause here")]
+        span: Span,
+    },
+    #[diag("expected a single predicate in `not(..)`", code = E0232)]
+    ExpectedOnePredInNot {
+        #[primary_span]
+        #[label("unexpected quantity of predicates here")]
+        span: Span,
+    },
+    #[diag("literals inside `on`-clauses are not supported", code = E0232)]
+    UnsupportedLiteral {
+        #[primary_span]
+        #[label("unexpected literal here")]
+        span: Span,
+    },
+    #[diag("expected an identifier inside this `on`-clause", code = E0232)]
+    ExpectedIdentifier {
+        #[primary_span]
+        #[label("expected an identifier here, not `{$path}`")]
+        span: Span,
+        path: AttrPath,
+    },
+    #[diag("this predicate is invalid", code = E0232)]
+    InvalidPredicate {
+        #[primary_span]
+        #[label("expected one of `any`, `all` or `not` here, not `{$invalid_pred}`")]
+        span: Span,
+        invalid_pred: Symbol,
+    },
+    #[diag("invalid flag in `on`-clause", code = E0232)]
+    InvalidFlag {
+        #[primary_span]
+        #[label(
+            "expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `{$invalid_flag}`"
+        )]
+        span: Span,
+        invalid_flag: Symbol,
+    },
+}
+
+#[derive(Diagnostic)]
+#[diag(
+    "using multiple `rustc_on_unimplemented` (or mixing it with `diagnostic::on_unimplemented`) is not supported"
+)]
+pub(crate) struct DupesNotAllowed;
diff --git a/compiler/rustc_attr_parsing/src/interface.rs b/compiler/rustc_attr_parsing/src/interface.rs
index cf5a722..e8bef70 100644
--- a/compiler/rustc_attr_parsing/src/interface.rs
+++ b/compiler/rustc_attr_parsing/src/interface.rs
@@ -8,7 +8,7 @@
 use rustc_ast::{AttrItemKind, AttrStyle, CRATE_NODE_ID, NodeId, Safety};
 use rustc_data_structures::sync::{DynSend, DynSync};
 use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level, MultiSpan};
-use rustc_feature::{AttributeTemplate, Features};
+use rustc_feature::{BUILTIN_ATTRIBUTE_MAP, Features};
 use rustc_hir::attrs::AttributeKind;
 use rustc_hir::{AttrArgs, AttrItem, AttrPath, Attribute, HashIgnoredAttrId, Target};
 use rustc_lint_defs::RegisteredTools;
@@ -23,7 +23,7 @@
 use crate::early_parsed::{EARLY_PARSED_ATTRIBUTES, EarlyParsedState};
 use crate::parser::{AllowExprMetavar, ArgParser, PathParser, RefPathParser};
 use crate::session_diagnostics::ParsedDescription;
-use crate::{OmitDoc, ShouldEmit};
+use crate::{AttributeTemplate, OmitDoc, ShouldEmit};
 
 pub struct EmitAttribute(
     pub  Box<
@@ -355,6 +355,9 @@ pub fn parse_attribute_list(
                             &mut emit_lint,
                         );
                         self.check_attribute_stability(&attr_path, attr_span, accept.stability);
+                        if let [part] = parts.as_slice() {
+                            debug_assert!(BUILTIN_ATTRIBUTE_MAP.contains(&part));
+                        }
 
                         let Some(args) = ArgParser::from_attr_args(
                             args,
diff --git a/compiler/rustc_attr_parsing/src/lib.rs b/compiler/rustc_attr_parsing/src/lib.rs
index 98b7bfe..3d6148f 100644
--- a/compiler/rustc_attr_parsing/src/lib.rs
+++ b/compiler/rustc_attr_parsing/src/lib.rs
@@ -97,14 +97,15 @@
 mod attributes;
 mod check_cfg;
 mod context;
+mod diagnostics;
 mod early_parsed;
-mod errors;
 mod interface;
 pub mod parser;
 mod safety;
 mod session_diagnostics;
 mod stability;
 mod target_checking;
+mod template;
 pub mod validate_attr;
 
 pub use attributes::AttributeSafety;
@@ -117,3 +118,4 @@
 pub use interface::{AttributeParser, EmitAttribute};
 pub use rustc_parse::parser::Recovery;
 pub use session_diagnostics::ParsedDescription;
+pub use template::{AttrSuggestionStyle, AttributeTemplate};
diff --git a/compiler/rustc_attr_parsing/src/parser.rs b/compiler/rustc_attr_parsing/src/parser.rs
index 4d714fc..5450a51 100644
--- a/compiler/rustc_attr_parsing/src/parser.rs
+++ b/compiler/rustc_attr_parsing/src/parser.rs
@@ -30,8 +30,8 @@
 
 use crate::ShouldEmit;
 use crate::session_diagnostics::{
-    InvalidMetaItem, InvalidMetaItemQuoteIdentSugg, InvalidMetaItemRemoveNegSugg, MetaBadDelim,
-    MetaBadDelimSugg, SuffixedLiteralInAttribute,
+    AdditionalCommaSuggestion, ExpectedComma, InvalidMetaItem, InvalidMetaItemQuoteIdentSugg,
+    InvalidMetaItemRemoveNegSugg, MetaBadDelim, MetaBadDelimSugg, SuffixedLiteralInAttribute,
 };
 
 #[derive(Clone, Debug)]
@@ -704,6 +704,44 @@ fn expected_lit(&mut self) -> Diag<'sess> {
         self.parser.dcx().create_err(err)
     }
 
+    fn should_continue_parsing_meta_items(&mut self) -> Result<bool, Diag<'sess>> {
+        if self.parser.eat(exp!(Comma)) {
+            return Ok(true);
+        } else if self.parser.token == token::Eof {
+            return Ok(false);
+        }
+
+        let mut snapshot = self.parser.create_snapshot_for_diagnostic();
+        if matches!(self.should_emit, ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed }) {
+            let mut missing_commas = ThinVec::new();
+            let mut found_comma = false;
+            while self.parser.token != token::Eof {
+                let span = self.parser.prev_token.span.shrink_to_hi();
+                self.should_emit = ShouldEmit::Nothing;
+                match self.parse_meta_item_inner() {
+                    Ok(_) => {
+                        if !found_comma {
+                            missing_commas.push(span);
+                        }
+                    }
+                    Err(e) => {
+                        e.cancel();
+                        break;
+                    }
+                }
+                found_comma = self.parser.eat(exp!(Comma));
+            }
+
+            let mut missing_commas = missing_commas.into_iter();
+            if let Some(span) = missing_commas.next() {
+                let additional =
+                    missing_commas.map(|span| AdditionalCommaSuggestion { span }).collect();
+                return Err(self.parser.dcx().create_err(ExpectedComma { span, additional }));
+            }
+        }
+        snapshot.unexpected_any()
+    }
+
     fn parse(
         tokens: TokenStream,
         psess: &'sess ParseSess,
@@ -724,15 +762,11 @@ fn parse(
         while this.parser.token != token::Eof {
             sub_parsers.push(this.parse_meta_item_inner()?);
 
-            if !this.parser.eat(exp!(Comma)) {
+            if !this.should_continue_parsing_meta_items()? {
                 break;
             }
         }
 
-        if parser.token != token::Eof {
-            parser.unexpected()?;
-        }
-
         Ok(MetaItemListParser { sub_parsers, span })
     }
 }
diff --git a/compiler/rustc_attr_parsing/src/safety.rs b/compiler/rustc_attr_parsing/src/safety.rs
index 5f22c0a..857ba23 100644
--- a/compiler/rustc_attr_parsing/src/safety.rs
+++ b/compiler/rustc_attr_parsing/src/safety.rs
@@ -6,7 +6,7 @@
 use rustc_span::Span;
 
 use crate::attributes::AttributeSafety;
-use crate::{AttributeParser, EmitAttribute, ShouldEmit, errors};
+use crate::{AttributeParser, EmitAttribute, ShouldEmit, diagnostics};
 
 impl<'sess> AttributeParser<'sess> {
     pub fn check_attribute_safety(
@@ -76,7 +76,7 @@ pub fn check_attribute_safety(
                         LintId::of(UNSAFE_ATTR_OUTSIDE_UNSAFE),
                         path_span.into(),
                         EmitAttribute(Box::new(move |dcx, level, _| {
-                            errors::UnsafeAttrOutsideUnsafeLint {
+                            diagnostics::UnsafeAttrOutsideUnsafeLint {
                                 span: path_span,
                                 suggestion: not_from_proc_macro
                                     .then(|| (diag_span.shrink_to_lo(), diag_span.shrink_to_hi()))
diff --git a/compiler/rustc_attr_parsing/src/session_diagnostics.rs b/compiler/rustc_attr_parsing/src/session_diagnostics.rs
index b4afdfd..121cac7 100644
--- a/compiler/rustc_attr_parsing/src/session_diagnostics.rs
+++ b/compiler/rustc_attr_parsing/src/session_diagnostics.rs
@@ -4,13 +4,13 @@
 use rustc_errors::{
     Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
 };
-use rustc_feature::AttributeTemplate;
 use rustc_hir::AttrPath;
 use rustc_hir::attrs::{MirDialect, MirPhase};
 use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_span::{Span, Symbol};
 use rustc_target::spec::TargetTuple;
 
+use crate::AttributeTemplate;
 use crate::context::Suggestion;
 
 #[derive(Diagnostic)]
@@ -1032,3 +1032,25 @@ pub(crate) struct SanitizeInvalidStatic {
     pub span: Span,
     pub field: &'static str,
 }
+
+#[derive(Diagnostic)]
+#[diag("attribute items not separated with `,`")]
+pub(crate) struct ExpectedComma {
+    #[primary_span]
+    #[suggestion(
+        "try adding `,` here",
+        code = ",",
+        applicability = "maybe-incorrect",
+        style = "short"
+    )]
+    pub span: Span,
+    #[subdiagnostic]
+    pub additional: Vec<AdditionalCommaSuggestion>,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion("try adding `,` here", code = ",", applicability = "maybe-incorrect", style = "short")]
+pub(crate) struct AdditionalCommaSuggestion {
+    #[primary_span]
+    pub span: Span,
+}
diff --git a/compiler/rustc_attr_parsing/src/target_checking.rs b/compiler/rustc_attr_parsing/src/target_checking.rs
index 483a3d6..13ed7c5 100644
--- a/compiler/rustc_attr_parsing/src/target_checking.rs
+++ b/compiler/rustc_attr_parsing/src/target_checking.rs
@@ -8,7 +8,7 @@
 use rustc_span::{BytePos, FileName, RemapPathScopeComponents, Span, Symbol, sym};
 
 use crate::context::AcceptContext;
-use crate::errors::{
+use crate::diagnostics::{
     InvalidAttrAtCrateLevel, ItemFollowingInnerAttr, UnsupportedAttributesInWhere,
 };
 use crate::session_diagnostics::{InvalidTarget, InvalidTargetHelp};
@@ -114,7 +114,11 @@ pub(crate) fn check_target(
         // For crate-level attributes we emit a specific set of lints to warn
         // people about accidentally not using them on the crate.
         if let &AllowedTargets::AllowList(&[Allow(Target::Crate)]) = allowed_targets {
-            Self::check_crate_level(cx);
+            Self::check_crate_level(cx, false);
+            return;
+        }
+        if let &AllowedTargets::AllowListWarnRest(&[Allow(Target::Crate)]) = allowed_targets {
+            Self::check_crate_level(cx, true);
             return;
         }
 
@@ -181,7 +185,7 @@ fn target_checking_help(
         }
     }
 
-    pub(crate) fn check_crate_level(cx: &mut AcceptContext<'_, 'sess>) {
+    pub(crate) fn check_crate_level(cx: &mut AcceptContext<'_, 'sess>, warn: bool) {
         if cx.target == Target::Crate {
             return;
         }
@@ -205,19 +209,20 @@ pub(crate) fn check_crate_level(cx: &mut AcceptContext<'_, 'sess>) {
             })
             .unwrap_or_default();
 
-        let target = cx.target;
-        cx.emit_lint(
-            rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
-            crate::errors::InvalidAttrStyle {
-                name,
-                is_used_as_inner,
-                target_span: (!is_used_as_inner).then_some(target_span),
-                target: target.name(),
-                crate_root_path,
-                show_crate_root_help,
-            },
-            attr_span,
-        );
+        let diag = crate::diagnostics::InvalidAttrStyle {
+            name,
+            is_used_as_inner,
+            target_span: (!is_used_as_inner).then_some(target_span),
+            target: cx.target.name(),
+            crate_root_path,
+            show_crate_root_help,
+            span: attr_span,
+        };
+        if warn {
+            cx.emit_lint(rustc_session::lint::builtin::UNUSED_ATTRIBUTES, diag, attr_span);
+        } else {
+            cx.emit_err(diag);
+        }
     }
 
     // FIXME: Fix "Cannot determine resolution" error and remove built-in macros
diff --git a/compiler/rustc_attr_parsing/src/template.rs b/compiler/rustc_attr_parsing/src/template.rs
new file mode 100644
index 0000000..b8de6ba
--- /dev/null
+++ b/compiler/rustc_attr_parsing/src/template.rs
@@ -0,0 +1,118 @@
+use rustc_ast::ast::Safety;
+use rustc_hir::AttrStyle;
+use rustc_span::Symbol;
+
+/// A template that the attribute input must match.
+/// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now.
+#[derive(Clone, Copy, Default)]
+pub struct AttributeTemplate {
+    /// If `true`, the attribute is allowed to be a bare word like `#[test]`.
+    pub word: bool,
+    /// If `Some`, the attribute is allowed to take a list of items like `#[allow(..)]`.
+    pub list: Option<&'static [&'static str]>,
+    /// If non-empty, the attribute is allowed to take a list containing exactly
+    /// one of the listed words, like `#[coverage(off)]`.
+    pub one_of: &'static [Symbol],
+    /// If `Some`, the attribute is allowed to be a name/value pair where the
+    /// value is a string, like `#[must_use = "reason"]`.
+    pub name_value_str: Option<&'static [&'static str]>,
+    /// A link to the document for this attribute.
+    pub docs: Option<&'static str>,
+}
+
+pub enum AttrSuggestionStyle {
+    /// The suggestion is styled for a normal attribute.
+    /// The `AttrStyle` determines whether this is an inner or outer attribute.
+    Attribute(AttrStyle),
+    /// The suggestion is styled for an attribute embedded into another attribute.
+    /// For example, attributes inside `#[cfg_attr(true, attr(...)]`.
+    EmbeddedAttribute,
+    /// The suggestion is styled for macros that are parsed with attribute parsers.
+    /// For example, the `cfg!(predicate)` macro.
+    Macro,
+}
+
+impl AttributeTemplate {
+    pub fn suggestions(
+        &self,
+        style: AttrSuggestionStyle,
+        safety: Safety,
+        name: impl std::fmt::Display,
+    ) -> Vec<String> {
+        let (start, macro_call, end) = match style {
+            AttrSuggestionStyle::Attribute(AttrStyle::Outer) => ("#[", "", "]"),
+            AttrSuggestionStyle::Attribute(AttrStyle::Inner) => ("#![", "", "]"),
+            AttrSuggestionStyle::Macro => ("", "!", ""),
+            AttrSuggestionStyle::EmbeddedAttribute => ("", "", ""),
+        };
+
+        let mut suggestions = vec![];
+
+        let (safety_start, safety_end) = match safety {
+            Safety::Unsafe(_) => ("unsafe(", ")"),
+            _ => ("", ""),
+        };
+
+        if self.word {
+            debug_assert!(macro_call.is_empty(), "Macro suggestions use list style");
+            suggestions.push(format!("{start}{safety_start}{name}{safety_end}{end}"));
+        }
+        if let Some(descr) = self.list {
+            for descr in descr {
+                suggestions.push(format!(
+                    "{start}{safety_start}{name}{macro_call}({descr}){safety_end}{end}"
+                ));
+            }
+        }
+        suggestions.extend(
+            self.one_of
+                .iter()
+                .map(|&word| format!("{start}{safety_start}{name}({word}){safety_end}{end}")),
+        );
+        if let Some(descr) = self.name_value_str {
+            debug_assert!(macro_call.is_empty(), "Macro suggestions use list style");
+            for descr in descr {
+                suggestions
+                    .push(format!("{start}{safety_start}{name} = \"{descr}\"{safety_end}{end}"));
+            }
+        }
+        suggestions.sort();
+
+        suggestions
+    }
+}
+
+/// A convenience macro for constructing attribute templates.
+/// E.g., `template!(Word, List: "description")` means that the attribute
+/// supports forms `#[attr]` and `#[attr(description)]`.
+#[macro_export]
+macro_rules! template {
+    (Word) => { $crate::template!(@ true, None, &[], None, None) };
+    (Word, $link: literal) => { $crate::template!(@ true, None, &[], None, Some($link)) };
+    (List: $descr: expr) => { $crate::template!(@ false, Some($descr), &[], None, None) };
+    (List: $descr: expr, $link: literal) => { $crate::template!(@ false, Some($descr), &[], None, Some($link)) };
+    (OneOf: $one_of: expr) => { $crate::template!(@ false, None, $one_of, None, None) };
+    (NameValueStr: [$($descr: literal),* $(,)?]) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), None) };
+    (NameValueStr: [$($descr: literal),* $(,)?], $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), Some($link)) };
+    (NameValueStr: $descr: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), None) };
+    (NameValueStr: $descr: literal, $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), Some($link)) };
+    (Word, List: $descr: expr) => { $crate::template!(@ true, Some($descr), &[], None, None) };
+    (Word, List: $descr: expr, $link: literal) => { $crate::template!(@ true, Some($descr), &[], None, Some($link)) };
+    (Word, NameValueStr: $descr: expr) => { $crate::template!(@ true, None, &[], Some(&[$descr]), None) };
+    (Word, NameValueStr: $descr: expr, $link: literal) => { $crate::template!(@ true, None, &[], Some(&[$descr]), Some($link)) };
+    (List: $descr1: expr, NameValueStr: $descr2: expr) => {
+        $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), None)
+    };
+    (List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
+        $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), Some($link))
+    };
+    (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => {
+        $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), None)
+    };
+    (Word, List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
+        $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), Some($link))
+    };
+    (@ $word: expr, $list: expr, $one_of: expr, $name_value_str: expr, $link: expr) => { $crate::AttributeTemplate {
+        word: $word, list: $list, one_of: $one_of, name_value_str: $name_value_str, docs: $link,
+    } };
+}
diff --git a/compiler/rustc_attr_parsing/src/validate_attr.rs b/compiler/rustc_attr_parsing/src/validate_attr.rs
index 4df2b3d..22a4743 100644
--- a/compiler/rustc_attr_parsing/src/validate_attr.rs
+++ b/compiler/rustc_attr_parsing/src/validate_attr.rs
@@ -9,7 +9,7 @@
     self as ast, AttrArgs, Attribute, DelimArgs, MetaItem, MetaItemInner, MetaItemKind, Safety,
 };
 use rustc_errors::{Applicability, Diagnostic, PResult};
-use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP, template};
+use rustc_feature::BUILTIN_ATTRIBUTE_MAP;
 use rustc_hir::AttrPath;
 use rustc_parse::parse_in;
 use rustc_session::errors::report_lit_error;
@@ -17,7 +17,7 @@
 use rustc_session::parse::ParseSess;
 use rustc_span::{Span, Symbol, sym};
 
-use crate::{AttributeParser, session_diagnostics as errors};
+use crate::{AttributeParser, AttributeTemplate, session_diagnostics as errors, template};
 
 pub fn check_attr(psess: &ParseSess, attr: &Attribute) {
     if attr.is_doc_comment() || attr.has_name(sym::cfg_trace) || attr.has_name(sym::cfg_attr_trace)
@@ -215,7 +215,7 @@ pub fn emit_malformed_attribute(
             span,
             ast::CRATE_NODE_ID,
             move |dcx, level| {
-                crate::errors::IllFormedAttributeInput::new(&suggestions, template.docs, None)
+                crate::diagnostics::IllFormedAttributeInput::new(&suggestions, template.docs, None)
                     .into_diag(dcx, level)
             },
         );
diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
index 48e7571..cc02206 100644
--- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
@@ -96,6 +96,12 @@ enum GroupedMoveError<'tcx> {
     },
 }
 
+struct PatternBindingInfo {
+    pat_span: Span,
+    binding_spans: Vec<Span>,
+    has_mutable_by_value_binding: bool,
+}
+
 impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
     pub(crate) fn report_move_errors(&mut self) {
         let grouped_errors = self.group_move_errors();
@@ -735,8 +741,11 @@ fn add_move_hints(
     ) {
         match error {
             GroupedMoveError::MovesFromPlace { mut binds_to, move_from, .. } => {
-                self.add_borrow_suggestions(err, span, !binds_to.is_empty());
+                binds_to.sort();
+                binds_to.dedup();
+
                 if binds_to.is_empty() {
+                    self.add_borrow_suggestions(err, span, false);
                     let place_ty = move_from.ty(self.body, self.infcx.tcx).ty;
                     let place_desc = match self.describe_place(move_from.as_ref()) {
                         Some(desc) => format!("`{desc}`"),
@@ -754,16 +763,30 @@ fn add_move_hints(
                         span,
                     });
                 } else {
-                    binds_to.sort();
-                    binds_to.dedup();
-
-                    self.add_move_error_details(err, &binds_to, &[]);
+                    let binding_info = self.pattern_binding_info(&binds_to);
+                    let suggest_pattern_binding = binding_info.as_ref().is_some_and(|info| {
+                        self.should_suggest_pattern_binding_instead(span, info)
+                    });
+                    let desugar_spans = if suggest_pattern_binding {
+                        self.add_move_error_suggestions(err, &binds_to)
+                    } else {
+                        if self.should_suggest_borrow_instead(span, binding_info.as_ref()) {
+                            self.add_borrow_suggestions(err, span, true);
+                        }
+                        None
+                    };
+                    self.add_move_error_details(
+                        err,
+                        &binds_to,
+                        desugar_spans.as_deref().unwrap_or_default(),
+                    );
                 }
             }
             GroupedMoveError::MovesFromValue { mut binds_to, .. } => {
                 binds_to.sort();
                 binds_to.dedup();
-                let desugar_spans = self.add_move_error_suggestions(err, &binds_to);
+                let desugar_spans =
+                    self.add_move_error_suggestions(err, &binds_to).unwrap_or_default();
                 self.add_move_error_details(err, &binds_to, &desugar_spans);
             }
             // No binding. Nothing to suggest.
@@ -947,7 +970,102 @@ fn add_borrow_suggestions(
         }
     }
 
-    fn add_move_error_suggestions(&self, err: &mut Diag<'_>, binds_to: &[Local]) -> Vec<Span> {
+    fn should_suggest_pattern_binding_instead(
+        &self,
+        span: Span,
+        binding_info: &PatternBindingInfo,
+    ) -> bool {
+        let Some(expr) = self.find_expr(span) else {
+            return false;
+        };
+
+        let typeck_results = self.infcx.tcx.typeck(self.mir_def_id());
+        let projection_qualifies = match expr.kind {
+            hir::ExprKind::Field(base, ..) => {
+                !typeck_results.node_type_opt(base.hir_id).is_some_and(|base_ty| {
+                    binding_info.has_mutable_by_value_binding
+                        && matches!(base_ty.kind(), ty::Ref(_, _, hir::Mutability::Not))
+                })
+            }
+            hir::ExprKind::Index(base, ..) => typeck_results
+                .node_type_opt(base.hir_id)
+                .is_some_and(|base_ty| match base_ty.kind() {
+                    ty::Ref(_, _, hir::Mutability::Not) | ty::RawPtr(..) => false,
+                    ty::Ref(_, _, hir::Mutability::Mut) => {
+                        binding_info.has_mutable_by_value_binding
+                    }
+                    _ => true,
+                }),
+            _ => false,
+        };
+        if !projection_qualifies {
+            return false;
+        }
+
+        let is_single_binding = binding_info.binding_spans.len() == 1
+            && binding_info.binding_spans[0] == binding_info.pat_span;
+        !is_single_binding
+    }
+
+    fn should_suggest_borrow_instead(
+        &self,
+        span: Span,
+        binding_info: Option<&PatternBindingInfo>,
+    ) -> bool {
+        if !binding_info.is_some_and(|info| info.has_mutable_by_value_binding) {
+            return true;
+        }
+
+        let Some(expr) = self.find_expr(span) else {
+            return true;
+        };
+
+        let Some(base) = (match expr.kind {
+            hir::ExprKind::Field(base, _) | hir::ExprKind::Index(base, ..) => Some(base),
+            _ => None,
+        }) else {
+            return true;
+        };
+
+        !self
+            .infcx
+            .tcx
+            .typeck(self.mir_def_id())
+            .node_type_opt(base.hir_id)
+            .is_some_and(|base_ty| matches!(base_ty.kind(), ty::Ref(_, _, hir::Mutability::Not)))
+    }
+
+    fn pattern_binding_info(&self, binds_to: &[Local]) -> Option<PatternBindingInfo> {
+        let mut pat_span = None;
+        let mut binding_spans = Vec::new();
+        let mut has_mutable_by_value_binding = false;
+        for local in binds_to {
+            let bind_to = &self.body.local_decls[*local];
+            if let LocalInfo::User(BindingForm::Var(VarBindingForm {
+                pat_span: pat_sp,
+                binding_mode,
+                ..
+            })) = *bind_to.local_info()
+            {
+                pat_span = Some(pat_sp);
+                binding_spans.push(bind_to.source_info.span);
+                has_mutable_by_value_binding |=
+                    matches!(binding_mode, hir::BindingMode(hir::ByRef::No, hir::Mutability::Mut));
+            }
+        }
+
+        Some(PatternBindingInfo {
+            pat_span: pat_span?,
+            binding_spans,
+            has_mutable_by_value_binding,
+        })
+    }
+
+    fn add_move_error_suggestions(
+        &self,
+        err: &mut Diag<'_>,
+        binds_to: &[Local],
+    ) -> Option<Vec<Span>> {
         /// A HIR visitor to associate each binding with a `&` or `&mut` that could be removed to
         /// make it bind by reference instead (if possible)
         struct BindingFinder<'tcx> {
@@ -1050,27 +1168,20 @@ fn visit_pat(&mut self, p: &'tcx hir::Pat<'tcx>) {
                 self.has_adjustments = parent_has_adjustments;
             }
         }
-        let mut pat_span = None;
-        let mut binding_spans = Vec::new();
-        for local in binds_to {
-            let bind_to = &self.body.local_decls[*local];
-            if let LocalInfo::User(BindingForm::Var(VarBindingForm { pat_span: pat_sp, .. })) =
-                *bind_to.local_info()
-            {
-                pat_span = Some(pat_sp);
-                binding_spans.push(bind_to.source_info.span);
-            }
-        }
-        let Some(pat_span) = pat_span else { return Vec::new() };
+        let Some(binding_info) = self.pattern_binding_info(binds_to) else {
+            return None;
+        };
 
         let tcx = self.infcx.tcx;
-        let Some(body) = tcx.hir_maybe_body_owned_by(self.mir_def_id()) else { return Vec::new() };
+        let Some(body) = tcx.hir_maybe_body_owned_by(self.mir_def_id()) else {
+            return None;
+        };
         let typeck_results = self.infcx.tcx.typeck(self.mir_def_id());
         let mut finder = BindingFinder {
             typeck_results,
             tcx,
-            pat_span,
-            binding_spans,
+            pat_span: binding_info.pat_span,
+            binding_spans: binding_info.binding_spans,
             found_pat: false,
             ref_pat: None,
             has_adjustments: false,
@@ -1101,7 +1212,8 @@ fn visit_pat(&mut self, p: &'tcx hir::Pat<'tcx>) {
         for (span, msg, suggestion) in suggestions {
             err.span_suggestion_verbose(span, msg, suggestion, Applicability::MachineApplicable);
         }
-        finder.desugar_binding_spans
+
+        Some(finder.desugar_binding_spans)
     }
 
     fn add_move_error_details(
diff --git a/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs b/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
index bca2de04..4d93fa0 100644
--- a/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
+++ b/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
@@ -1,7 +1,7 @@
 use rustc_data_structures::fx::FxHashSet;
 use rustc_hir::def_id::LocalDefId;
 use rustc_infer::infer::SubregionOrigin;
-use rustc_infer::infer::canonical::QueryRegionConstraints;
+use rustc_infer::infer::canonical::{QueryRegionConstraint, QueryRegionConstraints};
 use rustc_infer::infer::outlives::env::RegionBoundPairs;
 use rustc_infer::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
 use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
@@ -74,9 +74,9 @@ pub(super) fn convert_all(&mut self, query_constraints: &QueryRegionConstraints<
         let assumptions =
             elaborate::elaborate_outlives_assumptions(self.infcx.tcx, assumptions.iter().copied());
 
-        for &(constraint, constraint_category, _) in constraints {
+        for &QueryRegionConstraint { constraint, category, .. } in constraints {
             constraint.iter_outlives().for_each(|predicate| {
-                self.convert(predicate, constraint_category, &assumptions);
+                self.convert(predicate, category, &assumptions);
             });
         }
     }
@@ -296,7 +296,7 @@ fn normalize_and_add_type_outlives_constraints(
                 // FIXME(higher_ranked_auto): What should we do with the assumptions here?
                 if let Some(QueryRegionConstraints { constraints, assumptions: _ }) = constraints {
                     next_outlives_predicates.extend(constraints.iter().flat_map(
-                        |(constraint, category, _)| {
+                        |QueryRegionConstraint { constraint, category, .. }| {
                             constraint.iter_outlives().map(|outlives| (outlives, *category))
                         },
                     ));
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index b1cf754..450ac46 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -1760,11 +1760,14 @@ fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, location: Locat
             let tcx = self.tcx();
             let maybe_uneval = match constant.const_ {
                 Const::Ty(_, ct) => match ct.kind() {
-                    ty::ConstKind::Unevaluated(uv) => Some(UnevaluatedConst {
-                        def: uv.kind.def_id(),
-                        args: uv.args,
-                        promoted: None,
-                    }),
+                    ty::ConstKind::Unevaluated(uv) => match uv.kind {
+                        ty::UnevaluatedConstKind::Projection { def_id }
+                        | ty::UnevaluatedConstKind::Inherent { def_id }
+                        | ty::UnevaluatedConstKind::Free { def_id }
+                        | ty::UnevaluatedConstKind::Anon { def_id } => {
+                            Some(UnevaluatedConst { def: def_id, args: uv.args, promoted: None })
+                        }
+                    },
                     _ => None,
                 },
                 Const::Unevaluated(uv, _) => Some(uv),
diff --git a/compiler/rustc_builtin_macros/src/alloc_error_handler.rs b/compiler/rustc_builtin_macros/src/alloc_error_handler.rs
index 5f78758..544ad86 100644
--- a/compiler/rustc_builtin_macros/src/alloc_error_handler.rs
+++ b/compiler/rustc_builtin_macros/src/alloc_error_handler.rs
@@ -6,7 +6,7 @@
 use rustc_span::{Ident, Span, kw, sym};
 use thin_vec::{ThinVec, thin_vec};
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::check_builtin_macro_attribute;
 
 pub(crate) fn expand(
@@ -31,7 +31,7 @@ pub(crate) fn expand(
     {
         (item, fn_kind.ident, true, ecx.with_def_site_ctxt(fn_kind.sig.span))
     } else {
-        ecx.dcx().emit_err(errors::AllocErrorMustBeFn { span: item.span() });
+        ecx.dcx().emit_err(diagnostics::AllocErrorMustBeFn { span: item.span() });
         return vec![orig_item];
     };
 
diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs
index a1e14b5..b67b1fd 100644
--- a/compiler/rustc_builtin_macros/src/asm.rs
+++ b/compiler/rustc_builtin_macros/src/asm.rs
@@ -12,7 +12,7 @@
 use rustc_target::asm::InlineAsmArch;
 use smallvec::smallvec;
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::{ExprToSpannedString, expr_to_spanned_string};
 
 /// Validated assembly arguments, ready for macro expansion.
@@ -65,7 +65,7 @@ fn validate_asm_args<'a>(
     for arg in args {
         for attr in arg.attributes.0.iter() {
             if !matches!(attr.name(), Some(sym::cfg | sym::cfg_attr)) {
-                ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
+                ecx.dcx().emit_err(diagnostics::AsmAttributeNotSupported { span: attr.span() });
             }
         }
 
@@ -86,7 +86,7 @@ fn validate_asm_args<'a>(
                             ) => {}
                         ast::ExprKind::MacCall(..) => {}
                         _ => {
-                            let err = dcx.create_err(errors::AsmExpectedOther {
+                            let err = dcx.create_err(diagnostics::AsmExpectedOther {
                                 span: template.span,
                                 is_inline_asm: matches!(asm_macro, AsmMacro::Asm),
                             });
@@ -111,12 +111,12 @@ fn validate_asm_args<'a>(
 
                 if explicit_reg {
                     if name.is_some() {
-                        dcx.emit_err(errors::AsmExplicitRegisterName { span });
+                        dcx.emit_err(diagnostics::AsmExplicitRegisterName { span });
                     }
                     validated.reg_args.insert(slot);
                 } else if let Some(name) = name {
                     if let Some(&prev) = validated.named_args.get(&name) {
-                        dcx.emit_err(errors::AsmDuplicateArg {
+                        dcx.emit_err(diagnostics::AsmDuplicateArg {
                             span,
                             name,
                             prev: validated.operands[prev].1,
@@ -130,7 +130,7 @@ fn validate_asm_args<'a>(
                     let explicit =
                         validated.reg_args.iter().map(|p| validated.operands[p].1).collect();
 
-                    dcx.emit_err(errors::AsmPositionalAfter { span, named, explicit });
+                    dcx.emit_err(diagnostics::AsmPositionalAfter { span, named, explicit });
                 }
             }
             AsmArgKind::Options(new_options) => {
@@ -141,7 +141,7 @@ fn validate_asm_args<'a>(
 
                     if !asm_macro.is_supported_option(options) {
                         // Tool-only output.
-                        dcx.emit_err(errors::AsmUnsupportedOption {
+                        dcx.emit_err(diagnostics::AsmUnsupportedOption {
                             span,
                             symbol,
                             span_with_comma,
@@ -149,7 +149,7 @@ fn validate_asm_args<'a>(
                         });
                     } else if validated.options.contains(options) {
                         // Tool-only output.
-                        dcx.emit_err(errors::AsmOptAlreadyprovided {
+                        dcx.emit_err(diagnostics::AsmOptAlreadyprovided {
                             span,
                             symbol,
                             span_with_comma,
@@ -178,13 +178,13 @@ fn validate_asm_args<'a>(
         && validated.options.contains(ast::InlineAsmOptions::READONLY)
     {
         let spans = validated.options_spans.clone();
-        dcx.emit_err(errors::AsmMutuallyExclusive { spans, opt1: "nomem", opt2: "readonly" });
+        dcx.emit_err(diagnostics::AsmMutuallyExclusive { spans, opt1: "nomem", opt2: "readonly" });
     }
     if validated.options.contains(ast::InlineAsmOptions::PURE)
         && validated.options.contains(ast::InlineAsmOptions::NORETURN)
     {
         let spans = validated.options_spans.clone();
-        dcx.emit_err(errors::AsmMutuallyExclusive { spans, opt1: "pure", opt2: "noreturn" });
+        dcx.emit_err(diagnostics::AsmMutuallyExclusive { spans, opt1: "pure", opt2: "noreturn" });
     }
     if validated.options.contains(ast::InlineAsmOptions::PURE)
         && !validated
@@ -192,7 +192,7 @@ fn validate_asm_args<'a>(
             .intersects(ast::InlineAsmOptions::NOMEM | ast::InlineAsmOptions::READONLY)
     {
         let spans = validated.options_spans.clone();
-        dcx.emit_err(errors::AsmPureCombine { spans });
+        dcx.emit_err(diagnostics::AsmPureCombine { spans });
     }
 
     let mut have_real_output = false;
@@ -223,24 +223,24 @@ fn validate_asm_args<'a>(
         }
     }
     if validated.options.contains(ast::InlineAsmOptions::PURE) && !have_real_output {
-        dcx.emit_err(errors::AsmPureNoOutput { spans: validated.options_spans.clone() });
+        dcx.emit_err(diagnostics::AsmPureNoOutput { spans: validated.options_spans.clone() });
     }
     if validated.options.contains(ast::InlineAsmOptions::NORETURN)
         && !outputs_sp.is_empty()
         && labels_sp.is_empty()
     {
-        let err = dcx.create_err(errors::AsmNoReturn { outputs_sp });
+        let err = dcx.create_err(diagnostics::AsmNoReturn { outputs_sp });
         // Bail out now since this is likely to confuse MIR
         return Err(err);
     }
     if validated.options.contains(ast::InlineAsmOptions::MAY_UNWIND) && !labels_sp.is_empty() {
-        dcx.emit_err(errors::AsmMayUnwind { labels_sp });
+        dcx.emit_err(diagnostics::AsmMayUnwind { labels_sp });
     }
 
     if !validated.clobber_abis.is_empty() {
         match asm_macro {
             AsmMacro::GlobalAsm | AsmMacro::NakedAsm => {
-                let err = dcx.create_err(errors::AsmUnsupportedClobberAbi {
+                let err = dcx.create_err(diagnostics::AsmUnsupportedClobberAbi {
                     spans: validated.clobber_abis.iter().map(|(_, span)| *span).collect(),
                     macro_name: asm_macro.macro_name(),
                 });
@@ -250,7 +250,7 @@ fn validate_asm_args<'a>(
             }
             AsmMacro::Asm => {
                 if !regclass_outputs.is_empty() {
-                    dcx.emit_err(errors::AsmClobberNoReg {
+                    dcx.emit_err(diagnostics::AsmClobberNoReg {
                         spans: regclass_outputs,
                         clobbers: validated.clobber_abis.iter().map(|(_, span)| *span).collect(),
                     });
@@ -354,7 +354,7 @@ fn expand_preparsed_asm(
                     lint::builtin::BAD_ASM_STYLE,
                     find_span(".intel_syntax"),
                     ecx.current_expansion.lint_node_id,
-                    errors::AvoidIntelSyntax,
+                    diagnostics::AvoidIntelSyntax,
                 );
             }
             if template_str.contains(".att_syntax") {
@@ -362,7 +362,7 @@ fn expand_preparsed_asm(
                     lint::builtin::BAD_ASM_STYLE,
                     find_span(".att_syntax"),
                     ecx.current_expansion.lint_node_id,
-                    errors::AvoidAttSyntax,
+                    diagnostics::AvoidAttSyntax,
                 );
             }
         }
@@ -482,7 +482,7 @@ fn expand_preparsed_asm(
                                 None => {
                                     let span = arg.position_span;
                                     ecx.dcx()
-                                        .create_err(errors::AsmNoMatchedArgumentName {
+                                        .create_err(diagnostics::AsmNoMatchedArgumentName {
                                             name: name.to_owned(),
                                             span: span_in_template(span),
                                         })
@@ -497,7 +497,7 @@ fn expand_preparsed_asm(
                     let mut modifier = chars.next();
                     if chars.next().is_some() {
                         let span = arg.format.ty_span.map(span_in_template).unwrap_or(template_sp);
-                        ecx.dcx().emit_err(errors::AsmModifierInvalid { span });
+                        ecx.dcx().emit_err(diagnostics::AsmModifierInvalid { span });
                         modifier = None;
                     }
 
diff --git a/compiler/rustc_builtin_macros/src/assert.rs b/compiler/rustc_builtin_macros/src/assert.rs
index 855da5c..444510e 100644
--- a/compiler/rustc_builtin_macros/src/assert.rs
+++ b/compiler/rustc_builtin_macros/src/assert.rs
@@ -11,8 +11,8 @@
 use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
 use thin_vec::thin_vec;
 
+use crate::diagnostics;
 use crate::edition_panic::use_panic_2021;
-use crate::errors;
 
 pub(crate) fn expand_assert<'cx>(
     cx: &'cx mut ExtCtxt<'_>,
@@ -114,7 +114,7 @@ fn parse_assert<'a>(cx: &ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<
     let mut parser = cx.new_parser_from_tts(stream);
 
     if parser.token == token::Eof {
-        return Err(cx.dcx().create_err(errors::AssertRequiresBoolean { span: sp }));
+        return Err(cx.dcx().create_err(diagnostics::AssertRequiresBoolean { span: sp }));
     }
 
     let cond_expr = parser.parse_expr()?;
@@ -127,7 +127,8 @@ fn parse_assert<'a>(cx: &ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<
     //
     // Emit an error about semicolon and suggest removing it.
     if parser.token == token::Semi {
-        cx.dcx().emit_err(errors::AssertRequiresExpression { span: sp, token: parser.token.span });
+        cx.dcx()
+            .emit_err(diagnostics::AssertRequiresExpression { span: sp, token: parser.token.span });
         parser.bump();
     }
 
@@ -140,7 +141,7 @@ fn parse_assert<'a>(cx: &ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<
     let custom_message =
         if let token::Literal(token::Lit { kind: token::Str, .. }) = parser.token.kind {
             let comma = parser.prev_token.span.shrink_to_hi();
-            cx.dcx().emit_err(errors::AssertMissingComma { span: parser.token.span, comma });
+            cx.dcx().emit_err(diagnostics::AssertMissingComma { span: parser.token.span, comma });
 
             parse_custom_message(&mut parser)
         } else if parser.eat(exp!(Comma)) {
diff --git a/compiler/rustc_builtin_macros/src/autodiff.rs b/compiler/rustc_builtin_macros/src/autodiff.rs
index 76c43e0..595a8b1 100644
--- a/compiler/rustc_builtin_macros/src/autodiff.rs
+++ b/compiler/rustc_builtin_macros/src/autodiff.rs
@@ -24,7 +24,7 @@ mod llvm_enzyme {
     use thin_vec::{ThinVec, thin_vec};
     use tracing::{debug, trace};
 
-    use crate::errors;
+    use crate::diagnostics;
 
     pub(crate) fn outer_normal_attr(
         kind: &Box<rustc_ast::NormalAttr>,
@@ -101,7 +101,7 @@ pub(crate) fn from_ast(
             match x.try_into() {
                 Ok(x) => x,
                 Err(_) => {
-                    dcx.emit_err(errors::AutoDiffInvalidWidth {
+                    dcx.emit_err(diagnostics::AutoDiffInvalidWidth {
                         span: meta_item[1].span(),
                         width: x,
                     });
@@ -120,7 +120,7 @@ pub(crate) fn from_ast(
             match res {
                 Ok(x) => activities.push(x),
                 Err(_) => {
-                    dcx.emit_err(errors::AutoDiffUnknownActivity {
+                    dcx.emit_err(diagnostics::AutoDiffUnknownActivity {
                         span: x.span(),
                         act: activity_str,
                     });
@@ -238,14 +238,14 @@ pub(crate) fn expand_with_mode(
             }
             _ => None,
         }) else {
-            dcx.emit_err(errors::AutoDiffInvalidApplication { span: item.span() });
+            dcx.emit_err(diagnostics::AutoDiffInvalidApplication { span: item.span() });
             return vec![item];
         };
 
         let meta_item_vec: ThinVec<MetaItemInner> = match meta_item.kind {
             ast::MetaItemKind::List(ref vec) => vec.clone(),
             _ => {
-                dcx.emit_err(errors::AutoDiffMissingConfig { span: item.span() });
+                dcx.emit_err(diagnostics::AutoDiffMissingConfig { span: item.span() });
                 return vec![item];
             }
         };
@@ -257,7 +257,7 @@ pub(crate) fn expand_with_mode(
         let mut ts: Vec<TokenTree> = vec![];
         if meta_item_vec.len() < 1 {
             // At the bare minimum, we need a fnc name.
-            dcx.emit_err(errors::AutoDiffMissingConfig { span: item.span() });
+            dcx.emit_err(diagnostics::AutoDiffMissingConfig { span: item.span() });
             return vec![item];
         }
 
@@ -658,7 +658,7 @@ fn gen_enzyme_decl(
         let sig_args = sig.decl.inputs.len() + if has_ret { 1 } else { 0 };
         let num_activities = x.input_activity.len() + if x.has_ret_activity() { 1 } else { 0 };
         if sig_args != num_activities {
-            dcx.emit_err(errors::AutoDiffInvalidNumberActivities {
+            dcx.emit_err(diagnostics::AutoDiffInvalidNumberActivities {
                 span,
                 expected: sig_args,
                 found: num_activities,
@@ -679,7 +679,7 @@ fn gen_enzyme_decl(
         let mut errors = false;
         for (arg, activity) in sig.decl.inputs.iter().zip(x.input_activity.iter()) {
             if !valid_input_activity(x.mode, *activity) {
-                dcx.emit_err(errors::AutoDiffInvalidApplicationModeAct {
+                dcx.emit_err(diagnostics::AutoDiffInvalidApplicationModeAct {
                     span,
                     mode: x.mode.to_string(),
                     act: activity.to_string(),
@@ -687,7 +687,7 @@ fn gen_enzyme_decl(
                 errors = true;
             }
             if !valid_ty_for_activity(&arg.ty, *activity) {
-                dcx.emit_err(errors::AutoDiffInvalidTypeForActivity {
+                dcx.emit_err(diagnostics::AutoDiffInvalidTypeForActivity {
                     span: arg.ty.span,
                     act: activity.to_string(),
                 });
@@ -696,7 +696,7 @@ fn gen_enzyme_decl(
         }
 
         if has_ret && !valid_ret_activity(x.mode, x.ret_activity) {
-            dcx.emit_err(errors::AutoDiffInvalidRetAct {
+            dcx.emit_err(diagnostics::AutoDiffInvalidRetAct {
                 span,
                 mode: x.mode.to_string(),
                 act: x.ret_activity.to_string(),
diff --git a/compiler/rustc_builtin_macros/src/cfg.rs b/compiler/rustc_builtin_macros/src/cfg.rs
index 2872cff..f2771f1 100644
--- a/compiler/rustc_builtin_macros/src/cfg.rs
+++ b/compiler/rustc_builtin_macros/src/cfg.rs
@@ -16,7 +16,7 @@
 use rustc_parse::parser::Recovery;
 use rustc_span::{ErrorGuaranteed, Span, sym};
 
-use crate::errors;
+use crate::diagnostics;
 
 pub(crate) fn expand_cfg(
     cx: &mut ExtCtxt<'_>,
@@ -38,7 +38,7 @@ pub(crate) fn expand_cfg(
 fn parse_cfg(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream) -> Result<CfgEntry, ErrorGuaranteed> {
     let mut parser = cx.new_parser_from_tts(tts);
     if parser.token == token::Eof {
-        return Err(cx.dcx().emit_err(errors::RequiresCfgPattern { span }));
+        return Err(cx.dcx().emit_err(diagnostics::RequiresCfgPattern { span }));
     }
 
     let meta = MetaItemOrLitParser::parse_single(
@@ -70,7 +70,7 @@ fn parse_cfg(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream) -> Result<CfgEntry,
     let _ = parser.eat(exp!(Comma));
 
     if !parser.eat(exp!(Eof)) {
-        return Err(cx.dcx().emit_err(errors::OneCfgPattern { span }));
+        return Err(cx.dcx().emit_err(diagnostics::OneCfgPattern { span }));
     }
 
     Ok(cfg)
diff --git a/compiler/rustc_builtin_macros/src/cfg_accessible.rs b/compiler/rustc_builtin_macros/src/cfg_accessible.rs
index 48d8000..25964c9 100644
--- a/compiler/rustc_builtin_macros/src/cfg_accessible.rs
+++ b/compiler/rustc_builtin_macros/src/cfg_accessible.rs
@@ -1,17 +1,16 @@
 //! Implementation of the `#[cfg_accessible(path)]` attribute macro.
 
 use rustc_ast as ast;
-use rustc_attr_parsing::validate_attr;
+use rustc_attr_parsing::{AttributeTemplate, validate_attr};
 use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier};
-use rustc_feature::AttributeTemplate;
 use rustc_span::{Span, sym};
 
-use crate::errors;
+use crate::diagnostics;
 
 pub(crate) struct Expander;
 
 fn validate_input<'a>(ecx: &ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> {
-    use errors::CfgAccessibleInvalid::*;
+    use diagnostics::CfgAccessibleInvalid::*;
     match mi.meta_item_list() {
         None => {}
         Some([]) => {
@@ -62,7 +61,7 @@ fn expand(
             Ok(true) => ExpandResult::Ready(vec![item]),
             Ok(false) => ExpandResult::Ready(Vec::new()),
             Err(Indeterminate) if ecx.force_mode => {
-                ecx.dcx().emit_err(errors::CfgAccessibleIndeterminate { span });
+                ecx.dcx().emit_err(diagnostics::CfgAccessibleIndeterminate { span });
                 ExpandResult::Ready(vec![item])
             }
             Err(Indeterminate) => ExpandResult::Retry(item),
diff --git a/compiler/rustc_builtin_macros/src/cfg_select.rs b/compiler/rustc_builtin_macros/src/cfg_select.rs
index 3509872..526ddd6 100644
--- a/compiler/rustc_builtin_macros/src/cfg_select.rs
+++ b/compiler/rustc_builtin_macros/src/cfg_select.rs
@@ -6,7 +6,7 @@
 use rustc_span::{Ident, Span, sym};
 use smallvec::SmallVec;
 
-use crate::errors::CfgSelectNoMatches;
+use crate::diagnostics::CfgSelectNoMatches;
 
 /// This intermediate structure is used to emit parse errors for the branches that are not chosen.
 /// The `MacResult` instance below parses all branches, emitting any errors it encounters, but only
diff --git a/compiler/rustc_builtin_macros/src/concat.rs b/compiler/rustc_builtin_macros/src/concat.rs
index c200539..f359b83 100644
--- a/compiler/rustc_builtin_macros/src/concat.rs
+++ b/compiler/rustc_builtin_macros/src/concat.rs
@@ -4,7 +4,7 @@
 use rustc_session::errors::report_lit_error;
 use rustc_span::Symbol;
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::get_exprs_from_tts;
 
 pub(crate) fn expand_concat(
@@ -38,10 +38,10 @@ pub(crate) fn expand_concat(
                     accumulator.push_str(&b.to_string());
                 }
                 Ok(LitKind::CStr(..)) => {
-                    guar = Some(cx.dcx().emit_err(errors::ConcatCStrLit { span: e.span }));
+                    guar = Some(cx.dcx().emit_err(diagnostics::ConcatCStrLit { span: e.span }));
                 }
                 Ok(LitKind::Byte(..) | LitKind::ByteStr(..)) => {
-                    guar = Some(cx.dcx().emit_err(errors::ConcatBytestr { span: e.span }));
+                    guar = Some(cx.dcx().emit_err(diagnostics::ConcatBytestr { span: e.span }));
                 }
                 Ok(LitKind::Err(guarantee)) => {
                     guar = Some(guarantee);
@@ -62,7 +62,7 @@ pub(crate) fn expand_concat(
                 }
             }
             ExprKind::IncludedBytes(..) => {
-                cx.dcx().emit_err(errors::ConcatBytestr { span: e.span });
+                cx.dcx().emit_err(diagnostics::ConcatBytestr { span: e.span });
             }
             ExprKind::Err(guarantee) => {
                 guar = Some(guarantee);
@@ -75,7 +75,7 @@ pub(crate) fn expand_concat(
     }
 
     ExpandResult::Ready(if !missing_literal.is_empty() {
-        let guar = cx.dcx().emit_err(errors::ConcatMissingLiteral { spans: missing_literal });
+        let guar = cx.dcx().emit_err(diagnostics::ConcatMissingLiteral { spans: missing_literal });
         DummyResult::any(sp, guar)
     } else if let Some(guar) = guar {
         DummyResult::any(sp, guar)
diff --git a/compiler/rustc_builtin_macros/src/concat_bytes.rs b/compiler/rustc_builtin_macros/src/concat_bytes.rs
index 8885017..f86b1da 100644
--- a/compiler/rustc_builtin_macros/src/concat_bytes.rs
+++ b/compiler/rustc_builtin_macros/src/concat_bytes.rs
@@ -4,7 +4,7 @@
 use rustc_session::errors::report_lit_error;
 use rustc_span::{ErrorGuaranteed, Span};
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::get_exprs_from_tts;
 
 /// Emits errors for literal expressions that are invalid inside and outside of an array.
@@ -14,7 +14,7 @@ fn invalid_type_err(
     span: Span,
     is_nested: bool,
 ) -> ErrorGuaranteed {
-    use errors::{
+    use diagnostics::{
         ConcatBytesInvalid, ConcatBytesInvalidSuggestion, ConcatBytesNonU8, ConcatBytesOob,
     };
     let snippet = cx.sess.source_map().span_to_snippet(span).ok();
@@ -105,7 +105,10 @@ fn handle_array_element(
                 Ok(LitKind::Byte(val)) => return Some(val),
                 Ok(LitKind::ByteStr(..)) => {
                     guar.get_or_insert_with(|| {
-                        dcx.emit_err(errors::ConcatBytesArray { span: expr.span, bytestr: true })
+                        dcx.emit_err(diagnostics::ConcatBytesArray {
+                            span: expr.span,
+                            bytestr: true,
+                        })
                     });
                 }
                 _ => {
@@ -115,12 +118,12 @@ fn handle_array_element(
         }
         ExprKind::Array(_) | ExprKind::Repeat(_, _) => {
             guar.get_or_insert_with(|| {
-                dcx.emit_err(errors::ConcatBytesArray { span: expr.span, bytestr: false })
+                dcx.emit_err(diagnostics::ConcatBytesArray { span: expr.span, bytestr: false })
             });
         }
         ExprKind::IncludedBytes(..) => {
             guar.get_or_insert_with(|| {
-                dcx.emit_err(errors::ConcatBytesArray { span: expr.span, bytestr: false })
+                dcx.emit_err(diagnostics::ConcatBytesArray { span: expr.span, bytestr: false })
             });
         }
         _ => missing_literals.push(expr.span),
@@ -167,9 +170,10 @@ pub(crate) fn expand_concat_bytes(
                         }
                     }
                 } else {
-                    guar = Some(
-                        cx.dcx().emit_err(errors::ConcatBytesBadRepeat { span: count.value.span }),
-                    );
+                    guar =
+                        Some(cx.dcx().emit_err(diagnostics::ConcatBytesBadRepeat {
+                            span: count.value.span,
+                        }));
                 }
             }
             &ExprKind::Lit(token_lit) => match LitKind::from_token_lit(token_lit) {
@@ -196,7 +200,8 @@ pub(crate) fn expand_concat_bytes(
         }
     }
     ExpandResult::Ready(if !missing_literals.is_empty() {
-        let guar = cx.dcx().emit_err(errors::ConcatBytesMissingLiteral { spans: missing_literals });
+        let guar =
+            cx.dcx().emit_err(diagnostics::ConcatBytesMissingLiteral { spans: missing_literals });
         MacEager::expr(DummyResult::raw_expr(sp, Some(guar)))
     } else if let Some(guar) = guar {
         MacEager::expr(DummyResult::raw_expr(sp, Some(guar)))
diff --git a/compiler/rustc_builtin_macros/src/derive.rs b/compiler/rustc_builtin_macros/src/derive.rs
index 09d827b..da85a8a 100644
--- a/compiler/rustc_builtin_macros/src/derive.rs
+++ b/compiler/rustc_builtin_macros/src/derive.rs
@@ -1,15 +1,14 @@
 use rustc_ast as ast;
 use rustc_ast::{GenericParamKind, ItemKind, MetaItemInner, MetaItemKind, StmtKind};
-use rustc_attr_parsing::validate_attr;
+use rustc_attr_parsing::{AttributeTemplate, validate_attr};
 use rustc_expand::base::{
     Annotatable, DeriveResolution, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier,
 };
-use rustc_feature::AttributeTemplate;
 use rustc_session::Session;
 use rustc_span::{ErrorGuaranteed, Ident, Span, sym};
 
 use crate::cfg_eval::cfg_eval;
-use crate::errors;
+use crate::diagnostics;
 
 pub(crate) struct Expander {
     pub is_const: bool,
@@ -131,7 +130,7 @@ fn report_bad_target(
     let bad_target =
         !matches!(item_kind, Some(ItemKind::Struct(..) | ItemKind::Enum(..) | ItemKind::Union(..)));
     if bad_target {
-        return Err(sess.dcx().emit_err(errors::BadDeriveTarget { span, item: item.span() }));
+        return Err(sess.dcx().emit_err(diagnostics::BadDeriveTarget { span, item: item.span() }));
     }
     Ok(())
 }
@@ -141,11 +140,11 @@ fn report_unexpected_meta_item_lit(sess: &Session, lit: &ast::MetaItemLit) {
         ast::LitKind::Str(_, ast::StrStyle::Cooked)
             if rustc_lexer::is_ident(lit.symbol.as_str()) =>
         {
-            errors::BadDeriveLitHelp::StrLit { sym: lit.symbol }
+            diagnostics::BadDeriveLitHelp::StrLit { sym: lit.symbol }
         }
-        _ => errors::BadDeriveLitHelp::Other,
+        _ => diagnostics::BadDeriveLitHelp::Other,
     };
-    sess.dcx().emit_err(errors::BadDeriveLit { span: lit.span, help });
+    sess.dcx().emit_err(diagnostics::BadDeriveLit { span: lit.span, help });
 }
 
 fn report_path_args(sess: &Session, meta: &ast::MetaItem) {
@@ -154,10 +153,10 @@ fn report_path_args(sess: &Session, meta: &ast::MetaItem) {
     match meta.kind {
         MetaItemKind::Word => {}
         MetaItemKind::List(..) => {
-            sess.dcx().emit_err(errors::DerivePathArgsList { span });
+            sess.dcx().emit_err(diagnostics::DerivePathArgsList { span });
         }
         MetaItemKind::NameValue(..) => {
-            sess.dcx().emit_err(errors::DerivePathArgsValue { span });
+            sess.dcx().emit_err(diagnostics::DerivePathArgsValue { span });
         }
     }
 }
diff --git a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs
index 1d9551f..80296a4 100644
--- a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs
@@ -12,7 +12,7 @@
 use rustc_span::{Ident, Span, Symbol, sym};
 use thin_vec::{ThinVec, thin_vec};
 
-use crate::errors;
+use crate::diagnostics;
 
 macro_rules! path {
     ($span:expr, $($part:ident)::*) => { vec![$(Ident::new(sym::$part, $span),)*] }
@@ -396,8 +396,7 @@ fn visit_where_predicate_kind(&mut self, kind: &mut ast::WherePredicateKind) {
                     self.visit_param_bound(bound, BoundKind::Bound)
                 }
             }
-            rustc_ast::WherePredicateKind::RegionPredicate(_)
-            | rustc_ast::WherePredicateKind::EqPredicate(_) => {}
+            rustc_ast::WherePredicateKind::RegionPredicate(_) => {}
         }
     }
 }
@@ -409,7 +408,7 @@ struct DetectNonGenericPointeeAttr<'a, 'b> {
 impl<'a, 'b> rustc_ast::visit::Visitor<'a> for DetectNonGenericPointeeAttr<'a, 'b> {
     fn visit_attribute(&mut self, attr: &'a rustc_ast::Attribute) -> Self::Result {
         if attr.has_name(sym::pointee) {
-            self.cx.dcx().emit_err(errors::NonGenericPointee { span: attr.span });
+            self.cx.dcx().emit_err(diagnostics::NonGenericPointee { span: attr.span });
         }
     }
 
@@ -457,7 +456,7 @@ struct AlwaysErrorOnGenericParam<'a, 'b> {
 impl<'a, 'b> rustc_ast::visit::Visitor<'a> for AlwaysErrorOnGenericParam<'a, 'b> {
     fn visit_attribute(&mut self, attr: &'a rustc_ast::Attribute) -> Self::Result {
         if attr.has_name(sym::pointee) {
-            self.cx.dcx().emit_err(errors::NonGenericPointee { span: attr.span });
+            self.cx.dcx().emit_err(diagnostics::NonGenericPointee { span: attr.span });
         }
     }
 }
diff --git a/compiler/rustc_builtin_macros/src/deriving/default.rs b/compiler/rustc_builtin_macros/src/deriving/default.rs
index 263ba29..cf48ff9 100644
--- a/compiler/rustc_builtin_macros/src/deriving/default.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/default.rs
@@ -9,7 +9,7 @@
 
 use crate::deriving::generic::ty::*;
 use crate::deriving::generic::*;
-use crate::errors;
+use crate::diagnostics;
 
 pub(crate) fn expand_deriving_default(
     cx: &ExtCtxt<'_>,
@@ -177,10 +177,13 @@ fn extract_default_variant<'a>(
                 .filter(|variant| !attr::contains_name(&variant.attrs, sym::non_exhaustive));
 
             let suggs = possible_defaults
-                .map(|v| errors::NoDefaultVariantSugg { span: v.span.shrink_to_lo() })
+                .map(|v| diagnostics::NoDefaultVariantSugg { span: v.span.shrink_to_lo() })
                 .collect();
-            let guar =
-                cx.dcx().emit_err(errors::NoDefaultVariant { span: trait_span, item_span, suggs });
+            let guar = cx.dcx().emit_err(diagnostics::NoDefaultVariant {
+                span: trait_span,
+                item_span,
+                suggs,
+            });
 
             return Err(guar);
         }
@@ -196,11 +199,13 @@ fn extract_default_variant<'a>(
                                 .filter_map(|attr| (attr.span != keep).then_some(attr.span))
                         })
                         .collect();
-                    (!spans.is_empty())
-                        .then_some(errors::MultipleDefaultsSugg { spans, ident: variant.ident })
+                    (!spans.is_empty()).then_some(diagnostics::MultipleDefaultsSugg {
+                        spans,
+                        ident: variant.ident,
+                    })
                 })
                 .collect();
-            let guar = cx.dcx().emit_err(errors::MultipleDefaults {
+            let guar = cx.dcx().emit_err(diagnostics::MultipleDefaults {
                 span: trait_span,
                 first: first.span,
                 additional: rest.iter().map(|v| v.span).collect(),
@@ -223,12 +228,13 @@ fn extract_default_variant<'a>(
         } else {
             ""
         };
-        let guar = cx.dcx().emit_err(errors::NonUnitDefault { span: variant.ident.span, post });
+        let guar =
+            cx.dcx().emit_err(diagnostics::NonUnitDefault { span: variant.ident.span, post });
         return Err(guar);
     }
 
     if let Some(non_exhaustive_attr) = attr::find_by_name(&variant.attrs, sym::non_exhaustive) {
-        let guar = cx.dcx().emit_err(errors::NonExhaustiveDefault {
+        let guar = cx.dcx().emit_err(diagnostics::NonExhaustiveDefault {
             span: variant.ident.span,
             non_exhaustive: non_exhaustive_attr.span,
         });
@@ -252,10 +258,10 @@ fn validate_default_attribute(
             "this method must only be called with a variant that has a `#[default]` attribute",
         ),
         [first, rest @ ..] => {
-            let sugg = errors::MultipleDefaultAttrsSugg {
+            let sugg = diagnostics::MultipleDefaultAttrsSugg {
                 spans: rest.iter().map(|attr| attr.span).collect(),
             };
-            let guar = cx.dcx().emit_err(errors::MultipleDefaultAttrs {
+            let guar = cx.dcx().emit_err(diagnostics::MultipleDefaultAttrs {
                 span: default_variant.ident.span,
                 first: first.span,
                 first_rest: rest[0].span,
@@ -268,7 +274,7 @@ fn validate_default_attribute(
         }
     };
     if !attr.is_word() {
-        let guar = cx.dcx().emit_err(errors::DefaultHasArg { span: attr.span });
+        let guar = cx.dcx().emit_err(diagnostics::DefaultHasArg { span: attr.span });
 
         return Err(guar);
     }
@@ -287,7 +293,7 @@ fn visit_attribute(&mut self, attr: &'a rustc_ast::Attribute) {
             } else {
                 ""
             };
-            self.cx.dcx().emit_err(errors::NonUnitDefault { span: attr.span, post });
+            self.cx.dcx().emit_err(diagnostics::NonUnitDefault { span: attr.span, post });
         }
 
         rustc_ast::visit::walk_attribute(self, attr);
diff --git a/compiler/rustc_builtin_macros/src/deriving/from.rs b/compiler/rustc_builtin_macros/src/deriving/from.rs
index 2e4369f..c5fd0d8 100644
--- a/compiler/rustc_builtin_macros/src/deriving/from.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/from.rs
@@ -11,7 +11,7 @@
     combine_substructure,
 };
 use crate::deriving::pathvec_std;
-use crate::errors;
+use crate::diagnostics;
 
 /// Generate an implementation of the `From` trait, provided that `item`
 /// is a struct or a tuple struct with exactly one field.
@@ -38,7 +38,7 @@ pub(crate) fn expand_deriving_from(
             if let [field] = data.fields() {
                 Ok(field.clone())
             } else {
-                let guar = cx.dcx().emit_err(errors::DeriveFromWrongFieldCount {
+                let guar = cx.dcx().emit_err(diagnostics::DeriveFromWrongFieldCount {
                     span: err_span(),
                     multiple_fields: data.fields().len() > 1,
                 });
@@ -46,7 +46,7 @@ pub(crate) fn expand_deriving_from(
             }
         }
         ItemKind::Enum(_, _, _) | ItemKind::Union(_, _, _) => {
-            let guar = cx.dcx().emit_err(errors::DeriveFromWrongTarget {
+            let guar = cx.dcx().emit_err(diagnostics::DeriveFromWrongTarget {
                 span: err_span(),
                 kind: &format!("{} {}", item.kind.article(), item.kind.descr()),
             });
diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
index 8b8af16..ff6b15b 100644
--- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
@@ -194,7 +194,7 @@
 use thin_vec::{ThinVec, thin_vec};
 use ty::{Bounds, Path, Ref, Self_, Ty};
 
-use crate::{deriving, errors};
+use crate::{deriving, diagnostics};
 
 pub(crate) mod ty;
 
@@ -456,7 +456,7 @@ fn visit_poly_trait_ref(&mut self, trait_ref: &'a ast::PolyTraitRef) {
         }
 
         fn visit_mac_call(&mut self, mac: &ast::MacCall) {
-            self.cx.dcx().emit_err(errors::DeriveMacroCall { span: mac.span() });
+            self.cx.dcx().emit_err(diagnostics::DeriveMacroCall { span: mac.span() });
         }
     }
 
@@ -525,7 +525,7 @@ pub(crate) fn expand_ext(
                                 is_packed,
                             )
                         } else {
-                            cx.dcx().emit_err(errors::DeriveUnion { span: mitem.span });
+                            cx.dcx().emit_err(diagnostics::DeriveUnion { span: mitem.span });
                             return;
                         }
                     }
diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/diagnostics.rs
similarity index 100%
rename from compiler/rustc_builtin_macros/src/errors.rs
rename to compiler/rustc_builtin_macros/src/diagnostics.rs
diff --git a/compiler/rustc_builtin_macros/src/eii.rs b/compiler/rustc_builtin_macros/src/eii.rs
index d8d749c..9bb34cd 100644
--- a/compiler/rustc_builtin_macros/src/eii.rs
+++ b/compiler/rustc_builtin_macros/src/eii.rs
@@ -9,7 +9,7 @@
 use rustc_span::{ErrorGuaranteed, Ident, Span, kw, sym};
 use thin_vec::{ThinVec, thin_vec};
 
-use crate::errors::{
+use crate::diagnostics::{
     EiiAttributeNotSupported, EiiExternTargetExpectedList, EiiExternTargetExpectedMacro,
     EiiExternTargetExpectedUnsafe, EiiMacroExpectedMaxOneArgument, EiiOnlyOnce,
     EiiSharedMacroInStatementPosition, EiiSharedMacroTarget, EiiStaticArgumentRequired,
diff --git a/compiler/rustc_builtin_macros/src/env.rs b/compiler/rustc_builtin_macros/src/env.rs
index d9af43f..aaa9117 100644
--- a/compiler/rustc_builtin_macros/src/env.rs
+++ b/compiler/rustc_builtin_macros/src/env.rs
@@ -15,7 +15,7 @@
 use rustc_span::{Ident, Span, Symbol, kw, sym};
 use thin_vec::thin_vec;
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::{expr_to_string, get_exprs_from_tts, get_single_expr_from_tts};
 
 fn lookup_env<'cx>(cx: &'cx ExtCtxt<'_>, var: Symbol) -> Result<Symbol, VarError> {
@@ -76,7 +76,7 @@ pub(crate) fn expand_option_env<'cx>(
                 unreachable!("`expr_to_string` ensures this is a string lit")
             };
 
-            let guar = cx.dcx().emit_err(errors::EnvNotUnicode { span: sp, var: *symbol });
+            let guar = cx.dcx().emit_err(diagnostics::EnvNotUnicode { span: sp, var: *symbol });
             return ExpandResult::Ready(DummyResult::any(sp, guar));
         }
         Ok(value) => cx.expr_call_global(
@@ -98,7 +98,7 @@ pub(crate) fn expand_env<'cx>(
     };
     let mut exprs = match mac {
         Ok(exprs) if exprs.is_empty() || exprs.len() > 2 => {
-            let guar = cx.dcx().emit_err(errors::EnvTakesArgs { span: sp });
+            let guar = cx.dcx().emit_err(diagnostics::EnvTakesArgs { span: sp });
             return ExpandResult::Ready(DummyResult::any(sp, guar));
         }
         Err(guar) => return ExpandResult::Ready(DummyResult::any(sp, guar)),
@@ -145,24 +145,26 @@ pub(crate) fn expand_env<'cx>(
             let guar = match err {
                 VarError::NotPresent => {
                     if let Some(msg_from_user) = custom_msg {
-                        cx.dcx()
-                            .emit_err(errors::EnvNotDefinedWithUserMessage { span, msg_from_user })
+                        cx.dcx().emit_err(diagnostics::EnvNotDefinedWithUserMessage {
+                            span,
+                            msg_from_user,
+                        })
                     } else if let Some(suggested_var) = find_similar_cargo_var(var)
                         && suggested_var != var
                     {
-                        cx.dcx().emit_err(errors::EnvNotDefined::CargoEnvVarTypo {
+                        cx.dcx().emit_err(diagnostics::EnvNotDefined::CargoEnvVarTypo {
                             span,
                             var: *symbol,
                             suggested_var: Symbol::intern(suggested_var),
                         })
                     } else if is_cargo_env_var(var) {
-                        cx.dcx().emit_err(errors::EnvNotDefined::CargoEnvVar {
+                        cx.dcx().emit_err(diagnostics::EnvNotDefined::CargoEnvVar {
                             span,
                             var: *symbol,
                             var_expr: pprust::expr_to_string(&var_expr),
                         })
                     } else {
-                        cx.dcx().emit_err(errors::EnvNotDefined::CustomEnvVar {
+                        cx.dcx().emit_err(diagnostics::EnvNotDefined::CustomEnvVar {
                             span,
                             var: *symbol,
                             var_expr: pprust::expr_to_string(&var_expr),
@@ -170,7 +172,7 @@ pub(crate) fn expand_env<'cx>(
                     }
                 }
                 VarError::NotUnicode(_) => {
-                    cx.dcx().emit_err(errors::EnvNotUnicode { span, var: *symbol })
+                    cx.dcx().emit_err(diagnostics::EnvNotUnicode { span, var: *symbol })
                 }
             };
 
diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs
index 6bb3fa8..007251f 100644
--- a/compiler/rustc_builtin_macros/src/format.rs
+++ b/compiler/rustc_builtin_macros/src/format.rs
@@ -20,7 +20,7 @@
 use rustc_parse_format as parse;
 use rustc_span::{BytePos, ErrorGuaranteed, Ident, InnerSpan, Span, Symbol};
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::{ExprToSpannedString, expr_to_spanned_string};
 
 // The format_args!() macro is expanded in three steps:
@@ -73,7 +73,9 @@ fn parse_args<'a>(ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a,
 
     // parse the format string
     let fmtstr = match p.token.kind {
-        token::Eof => return Err(ecx.dcx().create_err(errors::FormatRequiresString { span: sp })),
+        token::Eof => {
+            return Err(ecx.dcx().create_err(diagnostics::FormatRequiresString { span: sp }));
+        }
         // This allows us to properly handle cases when the first comma
         // after the format string is mistakenly replaced with any operator,
         // which cause the expression parser to eat too much tokens.
@@ -122,7 +124,7 @@ fn parse_args<'a>(ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a,
                 p.expect(exp!(Eq))?;
                 let expr = p.parse_expr()?;
                 if let Some((_, prev)) = args.by_name(ident.name) {
-                    ecx.dcx().emit_err(errors::FormatDuplicateArg {
+                    ecx.dcx().emit_err(diagnostics::FormatDuplicateArg {
                         span: ident.span,
                         prev: prev.kind.ident().unwrap().span,
                         duplicate: ident.span,
@@ -135,7 +137,7 @@ fn parse_args<'a>(ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a,
             _ => {
                 let expr = p.parse_expr()?;
                 if !args.named_args().is_empty() {
-                    return Err(ecx.dcx().create_err(errors::PositionalAfterNamed {
+                    return Err(ecx.dcx().create_err(diagnostics::PositionalAfterNamed {
                         span: expr.span,
                         args: args
                             .named_args()
@@ -304,7 +306,7 @@ fn make_format_args(
             // argument span here.
             fmt_span
         };
-        let mut e = errors::InvalidFormatString {
+        let mut e = diagnostics::InvalidFormatString {
             span: sp,
             note_: None,
             label_: None,
@@ -313,12 +315,12 @@ fn make_format_args(
             label1: err.label,
         };
         if let Some(note) = err.note {
-            e.note_ = Some(errors::InvalidFormatStringNote { note });
+            e.note_ = Some(diagnostics::InvalidFormatStringNote { note });
         }
         if let Some((label, span)) = err.secondary_label
             && is_source_literal
         {
-            e.label_ = Some(errors::InvalidFormatStringLabel {
+            e.label_ = Some(diagnostics::InvalidFormatStringLabel {
                 span: fmt_span.from_inner(InnerSpan::new(span.start, span.end)),
                 label,
             });
@@ -333,7 +335,7 @@ fn make_format_args(
                         Some(arg) => arg.expr.span,
                         None => fmt_span,
                     };
-                    e.sugg_ = Some(errors::InvalidFormatStringSuggestion::UsePositional {
+                    e.sugg_ = Some(diagnostics::InvalidFormatStringSuggestion::UsePositional {
                         captured: captured_arg_span,
                         len: args.unnamed_args().len().to_string(),
                         span: span.shrink_to_hi(),
@@ -344,19 +346,22 @@ fn make_format_args(
             parse::Suggestion::RemoveRawIdent(span) => {
                 if is_source_literal {
                     let span = fmt_span.from_inner(InnerSpan::new(span.start, span.end));
-                    e.sugg_ = Some(errors::InvalidFormatStringSuggestion::RemoveRawIdent { span })
+                    e.sugg_ =
+                        Some(diagnostics::InvalidFormatStringSuggestion::RemoveRawIdent { span })
                 }
             }
             parse::Suggestion::ReorderFormatParameter(span, replacement) => {
                 let span = fmt_span.from_inner(InnerSpan::new(span.start, span.end));
-                e.sugg_ = Some(errors::InvalidFormatStringSuggestion::ReorderFormatParameter {
-                    span,
-                    replacement,
-                });
+                e.sugg_ =
+                    Some(diagnostics::InvalidFormatStringSuggestion::ReorderFormatParameter {
+                        span,
+                        replacement,
+                    });
             }
             parse::Suggestion::AddMissingColon(span) => {
                 let span = fmt_span.from_inner(InnerSpan::new(span.start, span.end));
-                e.sugg_ = Some(errors::InvalidFormatStringSuggestion::AddMissingColon { span });
+                e.sugg_ =
+                    Some(diagnostics::InvalidFormatStringSuggestion::AddMissingColon { span });
             }
             parse::Suggestion::UseRustDebugPrintingMacro => {
                 // This targets `println!("{=}", x);` and `println!("{0=}", x);`
@@ -367,7 +372,7 @@ fn make_format_args(
 
                         let call_span = macro_span.source_callsite();
                         e.sugg_ = Some(
-                            errors::InvalidFormatStringSuggestion::UseRustDebugPrintingMacro {
+                            diagnostics::InvalidFormatStringSuggestion::UseRustDebugPrintingMacro {
                                 macro_span: call_span,
                                 replacement,
                             },
@@ -436,7 +441,7 @@ enum ArgRef<'a> {
                     } else {
                         // For the moment capturing variables from format strings expanded from macros is
                         // disabled (see RFC #2795)
-                        let guar = ecx.dcx().emit_err(errors::FormatNoArgNamed { span, name });
+                        let guar = ecx.dcx().emit_err(diagnostics::FormatNoArgNamed { span, name });
                         unnamed_arg_after_named_arg = true;
                         DummyResult::raw_expr(span, Some(guar))
                     };
@@ -659,7 +664,7 @@ enum ArgRef<'a> {
                             (None, String::new())
                         };
 
-                    errors::NamedArgumentUsedPositionally {
+                    diagnostics::NamedArgumentUsedPositionally {
                         named_arg_sp: arg_name.span,
                         position_label_sp: position_sp_for_msg,
                         suggestion,
@@ -701,12 +706,12 @@ fn invalid_placeholder_type_error(
             ("X", "UpperHex"),
         ]
         .into_iter()
-        .map(|(fmt, trait_name)| errors::FormatUnknownTraitSugg { span: sp, fmt, trait_name })
+        .map(|(fmt, trait_name)| diagnostics::FormatUnknownTraitSugg { span: sp, fmt, trait_name })
         .collect()
     } else {
         vec![]
     };
-    ecx.dcx().emit_err(errors::FormatUnknownTrait { span: sp.unwrap_or(fmt_span), ty, suggs });
+    ecx.dcx().emit_err(diagnostics::FormatUnknownTrait { span: sp.unwrap_or(fmt_span), ty, suggs });
 }
 
 fn report_missing_placeholders(
@@ -723,12 +728,14 @@ fn report_missing_placeholders(
     fmt_span: Span,
 ) {
     let mut diag = if let &[(span, named)] = &unused[..] {
-        ecx.dcx().create_err(errors::FormatUnusedArg { span, named })
+        ecx.dcx().create_err(diagnostics::FormatUnusedArg { span, named })
     } else {
-        let unused_labels =
-            unused.iter().map(|&(span, named)| errors::FormatUnusedArg { span, named }).collect();
+        let unused_labels = unused
+            .iter()
+            .map(|&(span, named)| diagnostics::FormatUnusedArg { span, named })
+            .collect();
         let unused_spans = unused.iter().map(|&(span, _)| span).collect();
-        ecx.dcx().create_err(errors::FormatUnusedArgs {
+        ecx.dcx().create_err(diagnostics::FormatUnusedArgs {
             fmt: fmt_span,
             unused: unused_spans,
             unused_labels,
@@ -920,12 +927,12 @@ fn report_redundant_format_arguments<'a>(
         }
 
         let sugg = if args.named_args().len() == 0 {
-            Some(errors::FormatRedundantArgsSugg { spans: suggestion_spans })
+            Some(diagnostics::FormatRedundantArgsSugg { spans: suggestion_spans })
         } else {
             None
         };
 
-        return Some(ecx.dcx().create_err(errors::FormatRedundantArgs {
+        return Some(ecx.dcx().create_err(diagnostics::FormatRedundantArgs {
             n: args_spans.len(),
             span: MultiSpan::from(args_spans),
             note: multispan,
@@ -1034,7 +1041,7 @@ fn report_invalid_references(
         } else {
             MultiSpan::from_spans(spans)
         };
-        e = ecx.dcx().create_err(errors::FormatPositionalMismatch {
+        e = ecx.dcx().create_err(diagnostics::FormatPositionalMismatch {
             span,
             n: num_placeholders,
             desc: num_args_desc,
diff --git a/compiler/rustc_builtin_macros/src/global_allocator.rs b/compiler/rustc_builtin_macros/src/global_allocator.rs
index 684411d..db034f6 100644
--- a/compiler/rustc_builtin_macros/src/global_allocator.rs
+++ b/compiler/rustc_builtin_macros/src/global_allocator.rs
@@ -9,7 +9,7 @@
 use rustc_span::{Ident, Span, Symbol, kw, sym};
 use thin_vec::{ThinVec, thin_vec};
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::check_builtin_macro_attribute;
 
 pub(crate) fn expand(
@@ -34,13 +34,14 @@ pub(crate) fn expand(
     {
         (item, *ident, true, ecx.with_def_site_ctxt(ty.span))
     } else {
-        ecx.dcx().emit_err(errors::AllocMustStatics { span: item.span() });
+        ecx.dcx().emit_err(diagnostics::AllocMustStatics { span: item.span() });
         return vec![orig_item];
     };
 
     // Forbid `#[thread_local]` attributes on the item
     if let Some(attr) = item.attrs.iter().find(|x| x.has_name(sym::thread_local)) {
-        ecx.dcx().emit_err(errors::AllocCannotThreadLocal { span: item.span, attr: attr.span });
+        ecx.dcx()
+            .emit_err(diagnostics::AllocCannotThreadLocal { span: item.span, attr: attr.span });
         return vec![orig_item];
     }
 
diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs
index 9e29262..4a5ff44 100644
--- a/compiler/rustc_builtin_macros/src/lib.rs
+++ b/compiler/rustc_builtin_macros/src/lib.rs
@@ -33,10 +33,10 @@
 mod define_opaque;
 mod derive;
 mod deriving;
+mod diagnostics;
 mod edition_panic;
 mod eii;
 mod env;
-mod errors;
 mod format;
 mod format_foreign;
 mod global_allocator;
diff --git a/compiler/rustc_builtin_macros/src/offload.rs b/compiler/rustc_builtin_macros/src/offload.rs
index 9dbd2d4..d20c07f 100644
--- a/compiler/rustc_builtin_macros/src/offload.rs
+++ b/compiler/rustc_builtin_macros/src/offload.rs
@@ -6,7 +6,7 @@
 use rustc_span::{Ident, Span, sym};
 use thin_vec::thin_vec;
 
-use crate::errors;
+use crate::diagnostics;
 
 fn compile_for_device(ecx: &mut ExtCtxt<'_>) -> bool {
     ecx.sess.opts.unstable_opts.offload.contains(&Offload::Device)
@@ -74,7 +74,7 @@ pub(crate) fn expand_kernel(
     let dcx = ecx.sess.dcx();
 
     let Some((vis, sig, ident, generics, body)) = extract_fn(&item) else {
-        dcx.emit_err(errors::AutoDiffInvalidApplication { span: item.span() });
+        dcx.emit_err(diagnostics::AutoDiffInvalidApplication { span: item.span() });
         return vec![item];
     };
 
diff --git a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs
index aa936b4..32865f2 100644
--- a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs
+++ b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs
@@ -12,18 +12,16 @@
 use rustc_session::Session;
 use rustc_span::hygiene::AstPass;
 use rustc_span::source_map::SourceMap;
-use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, sym};
+use rustc_span::{DUMMY_SP, Ident, Span, kw, sym};
 use smallvec::smallvec;
 use thin_vec::{ThinVec, thin_vec};
 
-use crate::errors;
+use crate::diagnostics;
 
 struct ProcMacroDerive {
     id: NodeId,
-    trait_name: Symbol,
     function_ident: Ident,
     span: Span,
-    attrs: ThinVec<Symbol>,
 }
 
 struct ProcMacroDef {
@@ -91,7 +89,7 @@ pub fn inject(
 impl<'a> CollectProcMacros<'a> {
     fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) {
         if self.is_proc_macro_crate && self.in_root && vis.kind.is_pub() {
-            self.dcx.emit_err(errors::ProcMacro { span: sp });
+            self.dcx.emit_err(diagnostics::ProcMacro { span: sp });
         }
     }
 
@@ -101,15 +99,12 @@ fn collect_custom_derive(
         function_ident: Ident,
         attr: &'a ast::Attribute,
     ) {
-        let Some(rustc_hir::Attribute::Parsed(AttributeKind::ProcMacroDerive {
-            trait_name,
-            helper_attrs,
-            ..
-        })) = AttributeParser::parse_limited(
-            self.session,
-            slice::from_ref(attr),
-            &[sym::proc_macro_derive],
-        )
+        let Some(rustc_hir::Attribute::Parsed(AttributeKind::ProcMacroDerive { .. })) =
+            AttributeParser::parse_limited(
+                self.session,
+                slice::from_ref(attr),
+                &[sym::proc_macro_derive],
+            )
         else {
             return;
         };
@@ -118,9 +113,7 @@ fn collect_custom_derive(
             self.macros.push(ProcMacro::Derive(ProcMacroDerive {
                 id: item.id,
                 span: item.span,
-                trait_name,
                 function_ident,
-                attrs: helper_attrs,
             }));
         } else {
             let msg = if !self.in_root {
@@ -174,7 +167,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
     fn visit_item(&mut self, item: &'a ast::Item) {
         if let ast::ItemKind::MacroDef(..) = item.kind {
             if self.is_proc_macro_crate && attr::contains_name(&item.attrs, sym::macro_export) {
-                self.dcx.emit_err(errors::ExportMacroRules {
+                self.dcx.emit_err(diagnostics::ExportMacroRules {
                     span: self.source_map.guess_head_span(item.span),
                 });
             }
@@ -238,7 +231,7 @@ fn visit_item(&mut self, item: &'a ast::Item) {
 
         if !self.is_proc_macro_crate {
             self.dcx
-                .create_err(errors::AttributeOnlyUsableWithCrateType {
+                .create_err(diagnostics::AttributeOnlyUsableWithCrateType {
                     span: attr.span,
                     path: &pprust::path_to_string(&attr.get_normal_item().path),
                 })
@@ -291,10 +284,9 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> Box<ast::Item> {
 
     let bridge = Ident::new(sym::bridge, span);
     let client = Ident::new(sym::client, span);
-    let proc_macro_ty = Ident::new(sym::ProcMacro, span);
-    let custom_derive = Ident::new(sym::custom_derive, span);
-    let attr = Ident::new(sym::attr, span);
-    let bang = Ident::new(sym::bang, span);
+    let client_ty = Ident::new(sym::Client, span);
+    let expand1 = Ident::new(sym::expand1, span);
+    let expand2 = Ident::new(sym::expand2, span);
 
     // We add NodeIds to 'resolver.proc_macros' in the order
     // that we generate expressions. The position of each NodeId
@@ -312,7 +304,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> Box<ast::Item> {
             let proc_macro_ty_method_path = |cx: &ExtCtxt<'_>, method| {
                 cx.expr_path(cx.path(
                     span.with_ctxt(harness_span.ctxt()),
-                    vec![proc_macro, bridge, client, proc_macro_ty, method],
+                    vec![proc_macro, bridge, client, client_ty, method],
                 ))
             };
             match m {
@@ -322,25 +314,15 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> Box<ast::Item> {
                     // accepts it.
                     cx.expr_call(
                         harness_span,
-                        proc_macro_ty_method_path(cx, custom_derive),
-                        thin_vec![
-                            cx.expr_str(span, cd.trait_name),
-                            cx.expr_array_ref(
-                                span,
-                                cd.attrs
-                                    .iter()
-                                    .map(|&s| cx.expr_str(span, s))
-                                    .collect::<ThinVec<_>>(),
-                            ),
-                            local_path(cx, cd.function_ident),
-                        ],
+                        proc_macro_ty_method_path(cx, expand1),
+                        thin_vec![local_path(cx, cd.function_ident)],
                     )
                 }
                 ProcMacro::Attr(ca) | ProcMacro::Bang(ca) => {
                     cx.resolver.declare_proc_macro(ca.id);
                     let ident = match m {
-                        ProcMacro::Attr(_) => attr,
-                        ProcMacro::Bang(_) => bang,
+                        ProcMacro::Attr(_) => expand2,
+                        ProcMacro::Bang(_) => expand1,
                         ProcMacro::Derive(_) => unreachable!(),
                     };
 
@@ -349,10 +331,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> Box<ast::Item> {
                     cx.expr_call(
                         harness_span,
                         proc_macro_ty_method_path(cx, ident),
-                        thin_vec![
-                            cx.expr_str(span, ca.function_ident.name),
-                            local_path(cx, ca.function_ident),
-                        ],
+                        thin_vec![local_path(cx, ca.function_ident)],
                     )
                 }
             }
@@ -367,7 +346,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> Box<ast::Item> {
             cx.ty(
                 span,
                 ast::TyKind::Slice(
-                    cx.ty_path(cx.path(span, vec![proc_macro, bridge, client, proc_macro_ty])),
+                    cx.ty_path(cx.path(span, vec![proc_macro, bridge, client, client_ty])),
                 ),
             ),
             None,
diff --git a/compiler/rustc_builtin_macros/src/source_util.rs b/compiler/rustc_builtin_macros/src/source_util.rs
index ab7a9c3..fe2b5e1 100644
--- a/compiler/rustc_builtin_macros/src/source_util.rs
+++ b/compiler/rustc_builtin_macros/src/source_util.rs
@@ -21,7 +21,7 @@
 use rustc_span::{ByteSymbol, Pos, Span, Symbol};
 use smallvec::SmallVec;
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::{
     check_zero_tts, get_single_str_from_tts, get_single_str_spanned_from_tts, parse_expr,
 };
@@ -153,7 +153,7 @@ fn make_expr(self: Box<ExpandInclude<'a>>) -> Option<Box<ast::Expr>> {
                     INCOMPLETE_INCLUDE,
                     p.token.span,
                     self.node_id,
-                    errors::IncompleteInclude,
+                    diagnostics::IncompleteInclude,
                 );
             }
             Some(expr)
@@ -176,7 +176,7 @@ fn make_expr(self: Box<ExpandInclude<'a>>) -> Option<Box<ast::Expr>> {
                     Ok(Some(item)) => ret.push(item),
                     Ok(None) => {
                         if p.token != token::Eof {
-                            p.dcx().emit_err(errors::ExpectedItem {
+                            p.dcx().emit_err(diagnostics::ExpectedItem {
                                 span: p.token.span,
                                 token: &pprust::token_to_string(&p.token),
                             });
diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs
index ac86595..fda0660 100644
--- a/compiler/rustc_builtin_macros/src/test.rs
+++ b/compiler/rustc_builtin_macros/src/test.rs
@@ -14,7 +14,7 @@
 use thin_vec::{ThinVec, thin_vec};
 use tracing::debug;
 
-use crate::errors;
+use crate::diagnostics;
 use crate::util::{check_builtin_macro_attribute, warn_on_duplicate_attribute};
 
 /// #[test_case] is used by custom test authors to mark tests
@@ -44,7 +44,7 @@ pub(crate) fn expand_test_case(
             }
         }
         _ => {
-            ecx.dcx().emit_err(errors::TestCaseNonItem { span: anno_item.span() });
+            ecx.dcx().emit_err(diagnostics::TestCaseNonItem { span: anno_item.span() });
             return vec![];
         }
     };
@@ -136,7 +136,7 @@ pub(crate) fn expand_test_or_bench(
     }
 
     if let Some(attr) = attr::find_by_name(&item.attrs, sym::naked) {
-        cx.dcx().emit_err(errors::NakedFunctionTestingAttribute {
+        cx.dcx().emit_err(diagnostics::NakedFunctionTestingAttribute {
             testing_span: attr_sp,
             naked_span: attr.span,
         });
@@ -525,27 +525,31 @@ fn check_test_signature(
     let dcx = cx.dcx();
 
     if let ast::Safety::Unsafe(span) = f.sig.header.safety {
-        return Err(dcx.emit_err(errors::TestBadFn { span: i.span, cause: span, kind: "unsafe" }));
+        return Err(dcx.emit_err(diagnostics::TestBadFn {
+            span: i.span,
+            cause: span,
+            kind: "unsafe",
+        }));
     }
 
     if let Some(coroutine_kind) = f.sig.header.coroutine_kind {
         match coroutine_kind {
             ast::CoroutineKind::Async { span, .. } => {
-                return Err(dcx.emit_err(errors::TestBadFn {
+                return Err(dcx.emit_err(diagnostics::TestBadFn {
                     span: i.span,
                     cause: span,
                     kind: "async",
                 }));
             }
             ast::CoroutineKind::Gen { span, .. } => {
-                return Err(dcx.emit_err(errors::TestBadFn {
+                return Err(dcx.emit_err(diagnostics::TestBadFn {
                     span: i.span,
                     cause: span,
                     kind: "gen",
                 }));
             }
             ast::CoroutineKind::AsyncGen { span, .. } => {
-                return Err(dcx.emit_err(errors::TestBadFn {
+                return Err(dcx.emit_err(diagnostics::TestBadFn {
                     span: i.span,
                     cause: span,
                     kind: "async gen",
@@ -588,7 +592,7 @@ fn check_bench_signature(
     // N.B., inadequate check, but we're running
     // well before resolve, can't get too deep.
     if f.sig.decl.inputs.len() != 1 {
-        return Err(cx.dcx().emit_err(errors::BenchSig { span: i.span }));
+        return Err(cx.dcx().emit_err(diagnostics::BenchSig { span: i.span }));
     }
     Ok(())
 }
diff --git a/compiler/rustc_builtin_macros/src/test_harness.rs b/compiler/rustc_builtin_macros/src/test_harness.rs
index db5aecd..0b68b44 100644
--- a/compiler/rustc_builtin_macros/src/test_harness.rs
+++ b/compiler/rustc_builtin_macros/src/test_harness.rs
@@ -22,7 +22,7 @@
 use thin_vec::{ThinVec, thin_vec};
 use tracing::debug;
 
-use crate::errors;
+use crate::diagnostics;
 
 #[derive(Clone)]
 struct Test {
@@ -71,7 +71,7 @@ pub fn inject(
                     // Silently allow compiling with panic=abort on these platforms,
                     // but with old behavior (abort if a test fails).
                 } else {
-                    dcx.emit_err(errors::TestsNotSupport {});
+                    dcx.emit_err(diagnostics::TestsNotSupport {});
                 }
                 PanicStrategy::Unwind
             }
@@ -166,7 +166,7 @@ fn visit_item(&mut self, i: &'a ast::Item) {
                 UNNAMEABLE_TEST_ITEMS,
                 attr.span,
                 i.id,
-                errors::UnnameableTestItems,
+                diagnostics::UnnameableTestItems,
             );
         }
     }
diff --git a/compiler/rustc_builtin_macros/src/trace_macros.rs b/compiler/rustc_builtin_macros/src/trace_macros.rs
index 8264c17..88837e0 100644
--- a/compiler/rustc_builtin_macros/src/trace_macros.rs
+++ b/compiler/rustc_builtin_macros/src/trace_macros.rs
@@ -2,7 +2,7 @@
 use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
 use rustc_span::{Span, kw};
 
-use crate::errors;
+use crate::diagnostics;
 
 pub(crate) fn expand_trace_macros(
     cx: &mut ExtCtxt<'_>,
@@ -21,7 +21,7 @@ pub(crate) fn expand_trace_macros(
     };
     err |= iter.next().is_some();
     if err {
-        cx.dcx().emit_err(errors::TraceMacros { span: sp });
+        cx.dcx().emit_err(diagnostics::TraceMacros { span: sp });
     } else {
         cx.set_trace_macros(value);
     }
diff --git a/compiler/rustc_builtin_macros/src/util.rs b/compiler/rustc_builtin_macros/src/util.rs
index 9ac3d0e7e..c6ea732 100644
--- a/compiler/rustc_builtin_macros/src/util.rs
+++ b/compiler/rustc_builtin_macros/src/util.rs
@@ -1,16 +1,15 @@
 use rustc_ast::tokenstream::TokenStream;
 use rustc_ast::{self as ast, AttrStyle, Attribute, MetaItem, attr, token};
-use rustc_attr_parsing::validate_attr;
+use rustc_attr_parsing::{AttributeTemplate, validate_attr};
 use rustc_errors::{Applicability, Diag, ErrorGuaranteed};
 use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt};
 use rustc_expand::expand::AstFragment;
-use rustc_feature::AttributeTemplate;
 use rustc_lint_defs::builtin::DUPLICATE_MACRO_ATTRIBUTES;
 use rustc_parse::{exp, parser};
 use rustc_session::errors::report_lit_error;
 use rustc_span::{BytePos, Span, Symbol};
 
-use crate::errors;
+use crate::diagnostics;
 
 pub(crate) fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) {
     // All the built-in macro attributes are "words" at the moment.
@@ -48,7 +47,7 @@ pub(crate) fn warn_on_duplicate_attribute(ecx: &ExtCtxt<'_>, item: &Annotatable,
                 DUPLICATE_MACRO_ATTRIBUTES,
                 attr.span,
                 ecx.current_expansion.lint_node_id,
-                errors::DuplicateMacroAttribute,
+                diagnostics::DuplicateMacroAttribute,
             );
         }
     }
@@ -150,7 +149,7 @@ pub(crate) fn expr_to_string(
 /// (this should be done as rarely as possible).
 pub(crate) fn check_zero_tts(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream, name: &str) {
     if !tts.is_empty() {
-        cx.dcx().emit_err(errors::TakesNoArguments { span, name });
+        cx.dcx().emit_err(diagnostics::TakesNoArguments { span, name });
     }
 }
 
@@ -209,7 +208,7 @@ pub(crate) fn get_single_expr_from_tts(
 ) -> ExpandResult<Result<Box<ast::Expr>, ErrorGuaranteed>, ()> {
     let mut p = cx.new_parser_from_tts(tts);
     if p.token == token::Eof {
-        let guar = cx.dcx().emit_err(errors::OnlyOneArgument { span, name });
+        let guar = cx.dcx().emit_err(diagnostics::OnlyOneArgument { span, name });
         return ExpandResult::Ready(Err(guar));
     }
     let ret = match parse_expr(&mut p) {
@@ -219,7 +218,7 @@ pub(crate) fn get_single_expr_from_tts(
     let _ = p.eat(exp!(Comma));
 
     if p.token != token::Eof {
-        cx.dcx().emit_err(errors::OnlyOneArgument { span, name });
+        cx.dcx().emit_err(diagnostics::OnlyOneArgument { span, name });
     }
     ExpandResult::Ready(Ok(ret))
 }
@@ -253,7 +252,7 @@ pub(crate) fn get_exprs_from_tts(
             continue;
         }
         if p.token != token::Eof {
-            let guar = cx.dcx().emit_err(errors::ExpectedCommaInList { span: p.token.span });
+            let guar = cx.dcx().emit_err(diagnostics::ExpectedCommaInList { span: p.token.span });
             return ExpandResult::Ready(Err(guar));
         }
     }
diff --git a/compiler/rustc_codegen_cranelift/.github/workflows/cranelift-release-branch.yml b/compiler/rustc_codegen_cranelift/.github/workflows/cranelift-release-branch.yml
new file mode 100644
index 0000000..5cfdc3e
--- /dev/null
+++ b/compiler/rustc_codegen_cranelift/.github/workflows/cranelift-release-branch.yml
@@ -0,0 +1,64 @@
+name: Test upcoming Cranelift release branch
+
+on:
+  schedule:
+    - cron: "0 3 6 * *"
+  workflow_dispatch: {}
+
+permissions: {}
+
+env:
+  CARGO_BUILD_INCREMENTAL: false
+  RUSTFLAGS: "-Dwarnings"
+
+jobs:
+  test_upcoming_cranelift_release:
+    runs-on: ubuntu-latest
+    timeout-minutes: 90
+
+    steps:
+      - uses: actions/checkout@v6
+
+      - name: Determine latest Wasmtime release branch
+        id: wasmtime_release_branch
+        run: |
+          branches="$(
+            git ls-remote --heads https://github.com/bytecodealliance/wasmtime.git "refs/heads/release-*" \
+              | awk '{print $2}' \
+              | sed 's#refs/heads/##' \
+              | sort -V
+          )"
+          if [[ -z "${branches}" ]]; then
+            echo "No wasmtime release branches found"
+            exit 1
+          fi
+          latest="$(echo "${branches}" | tail -n 1)"
+          echo "Latest release branch: ${latest}"
+          echo "branch=${latest}" >> "$GITHUB_OUTPUT"
+
+      - name: Patch Cargo.toml to use release branch Cranelift
+        run: |
+          cat >>Cargo.toml <<EOF
+          [patch.crates-io]
+          cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "$(echo $WASMTIME_RELEASE_BRANCH)" }
+          cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "$(echo $WASMTIME_RELEASE_BRANCH)" }
+          cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "$(echo $WASMTIME_RELEASE_BRANCH)" }
+          cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "$(echo $WASMTIME_RELEASE_BRANCH)" }
+          cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "$(echo $WASMTIME_RELEASE_BRANCH)" }
+          cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "$(echo $WASMTIME_RELEASE_BRANCH)" }
+          EOF
+          cargo check -p rustc-hash # update lockfile
+        env:
+          WASMTIME_RELEASE_BRANCH: ${{ steps.wasmtime_release_branch.outputs.branch }}
+
+      - name: Prepare dependencies
+        run: ./y.sh prepare
+
+      - name: Build (sysroot none)
+        run: ./y.sh build --sysroot none
+
+      - name: Test
+        env:
+          TARGET_TRIPLE: x86_64-unknown-linux-gnu
+        run: ./y.sh test
+
diff --git a/compiler/rustc_codegen_cranelift/.github/workflows/main.yml b/compiler/rustc_codegen_cranelift/.github/workflows/main.yml
index a3ab9a9..1be63e3 100644
--- a/compiler/rustc_codegen_cranelift/.github/workflows/main.yml
+++ b/compiler/rustc_codegen_cranelift/.github/workflows/main.yml
@@ -119,7 +119,8 @@
     - name: Test
       env:
         TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
-      run: ./y.sh test
+      # Skip `graviola` on Windows, too slow
+      run: ./y.sh test ${{ runner.os == 'Windows' && '--skip-test test.graviola' || '' }}
 
     - name: Install LLVM standard library
       run: rustup target add ${{ matrix.env.TARGET_TRIPLE }}
@@ -128,7 +129,8 @@
     - name: Test with LLVM sysroot
       env:
         TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
-      run: ./y.sh test --sysroot llvm --no-unstable-features
+      # Skip `graviola` on Windows, too slow
+      run: ./y.sh test --sysroot llvm --no-unstable-features ${{ runner.os == 'Windows' && '--skip-test test.graviola' || '' }}
 
 
   # This job doesn't use cg_clif in any way. It checks that all cg_clif tests work with cg_llvm too.
@@ -242,8 +244,7 @@
     runs-on: ubuntu-latest
     timeout-minutes: 10
     if: ${{ github.ref == 'refs/heads/main' }}
-    # FIXME add bench back once rust-lang/cargo#16925 has been fixed
-    needs: [todo_check, rustfmt, test, dist]
+    needs: [todo_check, rustfmt, test, bench, dist]
 
     permissions:
       contents: write # for creating the dev tag and release
@@ -256,7 +257,7 @@
       - uses: actions/checkout@v6
 
       - name: Download all built artifacts
-        uses: actions/download-artifact@v4
+        uses: actions/download-artifact@v8
         with:
           path: artifacts/
 
diff --git a/compiler/rustc_codegen_cranelift/Cargo.lock b/compiler/rustc_codegen_cranelift/Cargo.lock
index ca623ea..1f793d6 100644
--- a/compiler/rustc_codegen_cranelift/Cargo.lock
+++ b/compiler/rustc_codegen_cranelift/Cargo.lock
@@ -43,27 +43,27 @@
 
 [[package]]
 name = "cranelift-assembler-x64"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6edb5bdd1af46714e3224a017fabbbd57f70df4e840eb5ad6a7429dc456119d6"
+checksum = "8c80cf55a351448317210f26c434be761bcb25e7b36116ec92f89540b73e2833"
 dependencies = [
  "cranelift-assembler-x64-meta",
 ]
 
 [[package]]
 name = "cranelift-assembler-x64-meta"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a819599186e1b1a1f88d464e06045696afc7aa3e0cc018aa0b2999cb63d1d088"
+checksum = "07937ca8617b340162fe3a4716be885b5847e9b56d6c7a89abbe4d42340fdc91"
 dependencies = [
  "cranelift-srcgen",
 ]
 
 [[package]]
 name = "cranelift-bforest"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36e2c152d488e03c87b913bc2ed3414416eb1e0d66d61b49af60bf456a9665c7"
+checksum = "88217b08180882436d54c0133274885c590698ae854e352bede1cda041230800"
 dependencies = [
  "cranelift-entity",
  "wasmtime-internal-core",
@@ -71,18 +71,18 @@
 
 [[package]]
 name = "cranelift-bitset"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6559d4fbc253d1396e1f6beeae57fa88a244f02aaf0cde2a735afd3492d9b2e"
+checksum = "d5c3cf7ba29fa56e56040848e34835d4e45988b2760ef212413409af95ffd8c1"
 dependencies = [
  "wasmtime-internal-core",
 ]
 
 [[package]]
 name = "cranelift-codegen"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96d9315d98d6e0a64454d4c83be2ee0e8055c3f80c3b2d7bcad7079f281a06ff"
+checksum = "ebe1aac2efd4cba2047845fce38a68519935a30e20c8a6294ba7e2f448fe722d"
 dependencies = [
  "bumpalo",
  "cranelift-assembler-x64",
@@ -94,7 +94,7 @@
  "cranelift-entity",
  "cranelift-isle",
  "gimli",
- "hashbrown 0.16.1",
+ "hashbrown 0.17.0",
  "libm",
  "log",
  "regalloc2",
@@ -107,9 +107,9 @@
 
 [[package]]
 name = "cranelift-codegen-meta"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d89c00a88081c55e3087c45bebc77e0cc973de2d7b44ef6a943c7122647b89f5"
+checksum = "0909eaf9d6f18f5bf802d50608cb4368ac340fbd03cc44f2888d1cfcc3faa64e"
 dependencies = [
  "cranelift-assembler-x64-meta",
  "cranelift-codegen-shared",
@@ -119,24 +119,24 @@
 
 [[package]]
 name = "cranelift-codegen-shared"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "879f77c497a1eb6273482aa1ac3b23cb8563ff04edb39ed5dfcfd28c8deff8f5"
+checksum = "c95a8da8be283f49cda7d0ef228c94f10d791e517b27b0c7e282dadd2e79ce45"
 
 [[package]]
 name = "cranelift-control"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "498dc1f17a6910c88316d49c7176d8fa97cf10c30859c32a266040449317f963"
+checksum = "f5b19c81145146da1f7afda2e7f52111842fe6793512e740ad5cf3f5639e6212"
 dependencies = [
  "arbitrary",
 ]
 
 [[package]]
 name = "cranelift-entity"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2acba797f6a46042ce82aaf7680d0c3567fe2001e238db9df649fd104a2727f"
+checksum = "4a55309b47e6633ab05821304206cb1e92952e845b1224985562bb7ac1e92323"
 dependencies = [
  "cranelift-bitset",
  "wasmtime-internal-core",
@@ -144,9 +144,9 @@
 
 [[package]]
 name = "cranelift-frontend"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dca3df1d107d98d88f159ad1d5eaa2d5cdb678b3d5bcfadc6fc83d8ebb448ea"
+checksum = "064d2d3533d9608f1cf44c8899cf2f7f33feb70300b0fb83e687b0d9e7b91147"
 dependencies = [
  "cranelift-codegen",
  "log",
@@ -156,15 +156,15 @@
 
 [[package]]
 name = "cranelift-isle"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f62dd18116d88bed649871feceda79dad7b59cc685ea8998c2b3e64d0e689602"
+checksum = "1ac4e0bc095b2dab2212d1e99d7a74b62afc1485db023f1c0cb34a68758f7bd1"
 
 [[package]]
 name = "cranelift-jit"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a4942770ce6662b44d903493d7c5b00f9a986a713a61aae148306eaef21ebd4"
+checksum = "5b48c2a0720c7d62aadd508c662b9bf666b614a47a888589e553e0511620635e"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -174,6 +174,7 @@
  "cranelift-native",
  "libc",
  "log",
+ "memmap2",
  "region",
  "target-lexicon",
  "wasmtime-internal-jit-icache-coherence",
@@ -182,9 +183,9 @@
 
 [[package]]
 name = "cranelift-module"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb5ca0d214ecee44405ea9f0c65a5318b41ac469e8258fd9fe944e564c1c1b0b"
+checksum = "28f05d9efce7a4e8c2ceec49c76d26e53f1ee8cb13de822b6ca5118d48f50976"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -193,9 +194,9 @@
 
 [[package]]
 name = "cranelift-native"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f843b80360d7fdf61a6124642af7597f6d55724cf521210c34af8a1c66daca6e"
+checksum = "09a40053f5cb925451dd1d57393d14ad3145c8e0786701c27b5415ebb9a3ba4f"
 dependencies = [
  "cranelift-codegen",
  "libc",
@@ -204,9 +205,9 @@
 
 [[package]]
 name = "cranelift-object"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9d212d15015c374333b11b833111b7c7e686bfaec02385af53611050bce7e9d"
+checksum = "5f7a263727954f7b310796e1b5543e6dfd6afed7e15c62f2454b51b6f38a39e1"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -219,9 +220,9 @@
 
 [[package]]
 name = "cranelift-srcgen"
-version = "0.131.0"
+version = "0.132.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "090ee5de58c6f17eb5e3a5ae8cf1695c7efea04ec4dd0ecba6a5b996c9bad7dc"
+checksum = "a3ceab9a53f7d362c89841fbaa8e63e44d47c40e91dc96ee6f777fca5d6b323b"
 
 [[package]]
 name = "crc32fast"
@@ -264,18 +265,9 @@
 
 [[package]]
 name = "hashbrown"
-version = "0.15.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
-
-[[package]]
-name = "hashbrown"
 version = "0.16.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
-dependencies = [
- "foldhash",
-]
 
 [[package]]
 name = "hashbrown"
@@ -304,9 +296,9 @@
 
 [[package]]
 name = "libc"
-version = "0.2.180"
+version = "0.2.186"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
+checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
 
 [[package]]
 name = "libloading"
@@ -346,6 +338,15 @@
 checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
 
 [[package]]
+name = "memmap2"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4"
+dependencies = [
+ "libc",
+]
+
+[[package]]
 name = "object"
 version = "0.39.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -377,13 +378,13 @@
 
 [[package]]
 name = "regalloc2"
-version = "0.15.0"
+version = "0.15.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "952ddbfc6f9f64d006c3efd8c9851a6ba2f2b944ba94730db255d55006e0ffda"
+checksum = "de2c52737737f8609e94f975dee22854a2d5c125772d4b1cf292120f4d45c186"
 dependencies = [
  "allocator-api2",
  "bumpalo",
- "hashbrown 0.15.5",
+ "hashbrown 0.17.0",
  "log",
  "rustc-hash",
  "smallvec",
@@ -491,19 +492,19 @@
 
 [[package]]
 name = "wasmtime-internal-core"
-version = "44.0.0"
+version = "45.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "816a61a75275c6be435131fc625a4f5956daf24d9f9f59443e81cbef228929b3"
+checksum = "1bdae4b55b15a23d774b15f6e7cd90ae0d0aa17c47c12b4db098b3dd11ba9d58"
 dependencies = [
- "hashbrown 0.16.1",
+ "hashbrown 0.17.0",
  "libm",
 ]
 
 [[package]]
 name = "wasmtime-internal-jit-icache-coherence"
-version = "44.0.0"
+version = "45.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fd683a94490bf755d016a09697b0955602c50106b1ded97d16983ab2ded9fed"
+checksum = "8a312ba8bb77955dcd44294a223e7f124c3071ff966583d385d3f6a4639c62e3"
 dependencies = [
  "cfg-if",
  "libc",
diff --git a/compiler/rustc_codegen_cranelift/Cargo.toml b/compiler/rustc_codegen_cranelift/Cargo.toml
index b775809..17ddbad 100644
--- a/compiler/rustc_codegen_cranelift/Cargo.toml
+++ b/compiler/rustc_codegen_cranelift/Cargo.toml
@@ -8,12 +8,12 @@
 
 [dependencies]
 # These have to be in sync with each other
-cranelift-codegen = { version = "0.131.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
-cranelift-frontend = { version = "0.131.0" }
-cranelift-module = { version = "0.131.0" }
-cranelift-native = { version = "0.131.0" }
-cranelift-jit = { version = "0.131.0", optional = true }
-cranelift-object = { version = "0.131.0" }
+cranelift-codegen = { version = "0.132.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
+cranelift-frontend = { version = "0.132.0" }
+cranelift-module = { version = "0.132.0" }
+cranelift-native = { version = "0.132.0" }
+cranelift-jit = { version = "0.132.0", optional = true }
+cranelift-object = { version = "0.132.0" }
 target-lexicon = "0.13"
 gimli = { version = "0.33", default-features = false, features = ["write"] }
 object = { version = "0.39.1", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
@@ -22,14 +22,14 @@
 libloading = { version = "0.9.0", optional = true }
 smallvec = "1.8.1"
 
-[patch.crates-io]
 # Uncomment to use an unreleased version of cranelift
-#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
-#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
-#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
-#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
-#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
-#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
+#[patch.crates-io]
+#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-45.0.0" }
+#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-45.0.0" }
+#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-45.0.0" }
+#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-45.0.0" }
+#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-45.0.0" }
+#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-45.0.0" }
 
 # Uncomment to use local checkout of cranelift
 #cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
diff --git a/compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs b/compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
index 762b2be..e90e7cc 100644
--- a/compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
@@ -7,6 +7,7 @@
     "Gankra",
     "abi-cafe",
     "94d38030419eb00a1ba80e5e2b4d763dcee58db4",
+    &[],
     "6efb4457893c8670",
     "abi-cafe",
 );
diff --git a/compiler/rustc_codegen_cranelift/build_system/bench.rs b/compiler/rustc_codegen_cranelift/build_system/bench.rs
index 91353ba..aa7bf4e 100644
--- a/compiler/rustc_codegen_cranelift/build_system/bench.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/bench.rs
@@ -12,6 +12,7 @@
     "ebobby",
     "simple-raytracer",
     "804a7a21b9e673a482797aa289a18ed480e4d813",
+    &[],
     "ad6f59a2331a3f56",
     "<none>",
 );
diff --git a/compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs b/compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs
index 216c87f..5c8b719 100644
--- a/compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs
@@ -231,6 +231,8 @@ fn build_clif_sysroot_for_triple(
     // inlining.
     rustflags.push("-Zinline-mir".to_owned());
 
+    rustflags.push("-Zdisable-incr-comp-backend-caching".to_owned());
+
     if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") {
         rustflags.push("--remap-path-prefix".to_owned());
         rustflags.push(format!("library/={}/library", prefix.to_str().unwrap()));
diff --git a/compiler/rustc_codegen_cranelift/build_system/main.rs b/compiler/rustc_codegen_cranelift/build_system/main.rs
index 0720d72..852fda9 100644
--- a/compiler/rustc_codegen_cranelift/build_system/main.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/main.rs
@@ -59,7 +59,6 @@ fn main() {
     if env::var_os("RUST_BACKTRACE").is_none() {
         env::set_var("RUST_BACKTRACE", "1");
     }
-    env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
 
     let mut args = env::args().skip(1);
     let command = match args.next().as_deref() {
diff --git a/compiler/rustc_codegen_cranelift/build_system/prepare.rs b/compiler/rustc_codegen_cranelift/build_system/prepare.rs
index ba5cc9a..1bc56e3 100644
--- a/compiler/rustc_codegen_cranelift/build_system/prepare.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/prepare.rs
@@ -11,11 +11,13 @@ pub(crate) fn prepare(dirs: &Dirs) {
     std::fs::create_dir_all(&dirs.download_dir).unwrap();
     crate::tests::RAND_REPO.fetch(dirs);
     crate::tests::REGEX_REPO.fetch(dirs);
+    crate::tests::GRAVIOLA_REPO.fetch(dirs);
 }
 
 pub(crate) struct GitRepo {
     url: GitRepoUrl,
     rev: &'static str,
+    submodules: &'static [&'static str],
     content_hash: &'static str,
     patch_name: &'static str,
 }
@@ -71,10 +73,17 @@ pub(crate) const fn github(
         user: &'static str,
         repo: &'static str,
         rev: &'static str,
+        submodules: &'static [&'static str],
         content_hash: &'static str,
         patch_name: &'static str,
     ) -> GitRepo {
-        GitRepo { url: GitRepoUrl::Github { user, repo }, rev, content_hash, patch_name }
+        GitRepo {
+            url: GitRepoUrl::Github { user, repo },
+            rev,
+            submodules,
+            content_hash,
+            patch_name,
+        }
     }
 
     fn download_dir(&self, dirs: &Dirs) -> PathBuf {
@@ -132,6 +141,7 @@ pub(crate) fn fetch(&self, dirs: &Dirs) {
                     &download_dir,
                     &format!("https://github.com/{}/{}.git", user, repo),
                     self.rev,
+                    self.submodules,
                 );
             }
         }
@@ -160,7 +170,7 @@ pub(crate) fn patch(&self, dirs: &Dirs) {
     }
 }
 
-fn clone_repo(download_dir: &Path, repo: &str, rev: &str) {
+fn clone_repo(download_dir: &Path, repo: &str, rev: &str, submodules: &[&str]) {
     eprintln!("[CLONE] {}", repo);
 
     match fs::remove_dir_all(download_dir) {
@@ -180,6 +190,13 @@ fn clone_repo(download_dir: &Path, repo: &str, rev: &str) {
     checkout_cmd.arg("-q").arg(rev);
     spawn_and_wait(checkout_cmd);
 
+    if !submodules.is_empty() {
+        let mut submodule_cmd = git_command(download_dir, "submodule");
+        submodule_cmd.arg("update").arg("--init");
+        submodule_cmd.args(submodules);
+        spawn_and_wait(submodule_cmd);
+    }
+
     std::fs::remove_dir_all(download_dir.join(".git")).unwrap();
 }
 
diff --git a/compiler/rustc_codegen_cranelift/build_system/tests.rs b/compiler/rustc_codegen_cranelift/build_system/tests.rs
index 3b6a2e7..685bf8c 100644
--- a/compiler/rustc_codegen_cranelift/build_system/tests.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/tests.rs
@@ -125,6 +125,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
     "rust-random",
     "rand",
     "1f4507a8e1cf8050e4ceef95eeda8f64645b6719",
+    &[],
     "981f8bf489338978",
     "rand",
 );
@@ -135,12 +136,24 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
     "rust-lang",
     "regex",
     "061ee815ef2c44101dba7b0b124600fcb03c1912",
+    &[],
     "dc26aefbeeac03ca",
     "regex",
 );
 
 static REGEX: CargoProject = CargoProject::new(REGEX_REPO.source_dir(), "regex_target");
 
+pub(crate) static GRAVIOLA_REPO: GitRepo = GitRepo::github(
+    "ctz",
+    "graviola",
+    "c779b83cfd7114c4802293700c92cfb5e05cb4b7",
+    &["thirdparty/cavp", "thirdparty/wycheproof"],
+    "e0925ceb21a56101",
+    "graviola",
+);
+
+static GRAVIOLA: CargoProject = CargoProject::new(GRAVIOLA_REPO.source_dir(), "graviola_target");
+
 static PORTABLE_SIMD_SRC: RelPath = RelPath::build("portable-simd");
 
 static PORTABLE_SIMD: CargoProject = CargoProject::new(PORTABLE_SIMD_SRC, "portable-simd_target");
@@ -199,6 +212,43 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
             spawn_and_wait(build_cmd);
         }
     }),
+    TestCase::custom("test.graviola", &|runner| {
+        let (arch, _) = runner.target_compiler.triple.split_once('-').unwrap();
+
+        if !["aarch64", "x86_64"].contains(&arch) {
+            eprintln!("Skipping `graviola` tests: unsupported target");
+            return;
+        }
+
+        GRAVIOLA_REPO.patch(&runner.dirs);
+        GRAVIOLA.clean(&runner.dirs);
+
+        if runner.is_native {
+            let mut test_cmd = GRAVIOLA.test(&runner.target_compiler, &runner.dirs);
+
+            // FIXME: Disable AVX-512 until intrinsics are supported.
+            test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512f", "1");
+            test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512bw", "1");
+            test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512vl", "1");
+
+            test_cmd.args([
+                "-p",
+                "graviola",
+                "--lib",
+                "--",
+                "-q",
+                // FIXME: Disable AVX-512 until intrinsics are supported.
+                "--skip",
+                "check_counter512",
+            ]);
+            spawn_and_wait(test_cmd);
+        } else {
+            eprintln!("Cross-Compiling: Not running tests");
+            let mut build_cmd = GRAVIOLA.build(&runner.target_compiler, &runner.dirs);
+            build_cmd.args(["-p", "graviola", "--lib"]);
+            spawn_and_wait(build_cmd);
+        }
+    }),
     TestCase::custom("test.portable-simd", &|runner| {
         apply_patches(
             &runner.dirs,
diff --git a/compiler/rustc_codegen_cranelift/config.txt b/compiler/rustc_codegen_cranelift/config.txt
index 7263135..7c516e2 100644
--- a/compiler/rustc_codegen_cranelift/config.txt
+++ b/compiler/rustc_codegen_cranelift/config.txt
@@ -20,7 +20,7 @@
 
 testsuite.base_sysroot
 aot.arbitrary_self_types_pointers_and_wrappers
-#jit.std_example # FIXME(#1619) broken for some reason
+jit.std_example
 aot.std_example
 aot.dst_field_align
 aot.subslice-patterns-const-eval
@@ -36,4 +36,5 @@
 testsuite.extended_sysroot
 test.rust-random/rand
 test.regex
+test.graviola
 test.portable-simd
diff --git a/compiler/rustc_codegen_cranelift/example/neon.rs b/compiler/rustc_codegen_cranelift/example/neon.rs
index 98a2a7a..1aec5ba 100644
--- a/compiler/rustc_codegen_cranelift/example/neon.rs
+++ b/compiler/rustc_codegen_cranelift/example/neon.rs
@@ -10,6 +10,25 @@
 use std::simd::*;
 
 #[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "crc")]
+unsafe fn test_crc32() {
+    assert!(std::arch::is_aarch64_feature_detected!("crc"));
+
+    let a: u32 = 42;
+    let b: u64 = 0xdeadbeef;
+
+    assert_eq!(__crc32b(a, b as u8), 0xEB0E363F);
+    assert_eq!(__crc32h(a, b as u16), 0x9A54BD80);
+    assert_eq!(__crc32w(a, b as u32), 0xF491F059);
+    assert_eq!(__crc32d(a, b as u64), 0xD14BBEA6);
+
+    assert_eq!(__crc32cb(a, b as u8), 0xF67C32D8);
+    assert_eq!(__crc32ch(a, b as u16), 0x479108B8);
+    assert_eq!(__crc32cw(a, b as u32), 0x979F49F8);
+    assert_eq!(__crc32cd(a, b as u64), 0x0E6BE593);
+}
+
+#[cfg(target_arch = "aarch64")]
 unsafe fn test_vpmin_s8() {
     let a = i8x8::from([1, -2, 3, -4, 5, 6, 7, 8]);
     let b = i8x8::from([0, 3, 2, 5, 4, 7, 6, 9]);
@@ -241,6 +260,272 @@ unsafe fn test_vrndnq_f32() {
 }
 
 #[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "aes")]
+unsafe fn test_vaeseq_u8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.crypto.aese
+    let a = u8x16::from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+    let b = u8x16::from([16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]);
+    let e = u8x16::from([
+        0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca,
+        0xca,
+    ]);
+    let r: u8x16 = unsafe { transmute(vaeseq_u8(transmute(a), transmute(b))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "aes")]
+unsafe fn test_vaesdq_u8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.crypto.aesd
+    let a = u8x16::from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+    let b = u8x16::from([16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]);
+    let e = u8x16::from([
+        0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c,
+        0x7c,
+    ]);
+    let r: u8x16 = unsafe { transmute(vaesdq_u8(transmute(a), transmute(b))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "aes")]
+unsafe fn test_vaesmcq_u8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.crypto.aesmc
+    let a = u8x16::from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+    let e = u8x16::from([2, 7, 0, 5, 6, 3, 4, 1, 10, 15, 8, 13, 14, 11, 12, 9]);
+    let r: u8x16 = unsafe { transmute(vaesmcq_u8(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "aes")]
+unsafe fn test_vaesimcq_u8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.crypto.aesimc
+    let a = u8x16::from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+    let e = u8x16::from([10, 15, 8, 13, 14, 11, 12, 9, 2, 7, 0, 5, 6, 3, 4, 1]);
+    let r: u8x16 = unsafe { transmute(vaesimcq_u8(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "sha2")]
+unsafe fn test_vsha256hq_u32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.crypto.sha256h
+    let a = u32x4::from([0, 1, 2, 3]);
+    let b = u32x4::from([4, 5, 6, 7]);
+    let c = u32x4::from([8, 9, 10, 11]);
+    let e = u32x4::from([0x27bb4ae0, 0xd8f61f7c, 0xb7c1ecdc, 0x10800215]);
+    let r: u32x4 = unsafe { transmute(vsha256hq_u32(transmute(a), transmute(b), transmute(c))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "sha2")]
+unsafe fn test_vsha256h2q_u32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.crypto.sha256h2
+    let a = u32x4::from([0, 1, 2, 3]);
+    let b = u32x4::from([4, 5, 6, 7]);
+    let c = u32x4::from([8, 9, 10, 11]);
+    let e = u32x4::from([0x6989ee0d, 0x4b055920, 0x52800a12, 0x00000014]);
+    let r: u32x4 = unsafe { transmute(vsha256h2q_u32(transmute(a), transmute(b), transmute(c))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "sha2")]
+unsafe fn test_vsha256su0q_u32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.crypto.sha256su0
+    let a = u32x4::from([0, 1, 2, 3]);
+    let b = u32x4::from([4, 5, 6, 7]);
+    let e = u32x4::from([0x02004000, 0x04008001, 0x0600c002, 0x08010003]);
+    let r: u32x4 = unsafe { transmute(vsha256su0q_u32(transmute(a), transmute(b))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "sha2")]
+unsafe fn test_vsha256su1q_u32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.crypto.sha256su1
+    let a = u32x4::from([0, 1, 2, 3]);
+    let b = u32x4::from([4, 5, 6, 7]);
+    let c = u32x4::from([8, 9, 10, 11]);
+    let e = u32x4::from([0x00044005, 0x0004e007, 0xa802211b, 0xec036145]);
+    let r: u32x4 = unsafe { transmute(vsha256su1q_u32(transmute(a), transmute(b), transmute(c))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+#[target_feature(enable = "aes")]
+fn test_vmull_p64() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.pmull64
+    let a: u64 = 3;
+    let b: u64 = 6;
+    let e: u128 = 10;
+    let r: u128 = vmull_p64(a, b);
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vmull_p8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.pmull.v8i16
+    let a = u8x8::from([0, 1, 2, 3, 4, 5, 6, 7]);
+    let b = u8x8::from([8, 9, 10, 11, 12, 13, 14, 15]);
+    let e = u16x8::from([0x0000, 0x0009, 0x0014, 0x001d, 0x0030, 0x0039, 0x0024, 0x002d]);
+    let r: u16x8 = unsafe { transmute(vmull_p8(transmute(a), transmute(b))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vqdmulh_s16() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.sqdmulh.v4i16
+    let a = i16x4::from([1, 2, 4, 8]);
+    let b = i16x4::from([16384, 16384, 16384, 16384]);
+    let e = i16x4::from([0, 1, 2, 4]);
+    let r: i16x4 = unsafe { transmute(vqdmulh_s16(transmute(a), transmute(b))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vqdmulh_s32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.sqdmulh.v2i32
+    let a = i32x2::from([1, 2]);
+    let b = i32x2::from([1073741824, 1073741824]);
+    let e = i32x2::from([0, 1]);
+    let r: i32x2 = unsafe { transmute(vqdmulh_s32(transmute(a), transmute(b))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vqdmulhq_s16() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.sqdmulh.v8i16
+    let a = i16x8::from([1, 2, 4, 8, 16, 32, 64, 128]);
+    let b = i16x8::from([16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384]);
+    let e = i16x8::from([0, 1, 2, 4, 8, 16, 32, 64]);
+    let r: i16x8 = unsafe { transmute(vqdmulhq_s16(transmute(a), transmute(b))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vqdmulhq_s32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.sqdmulh.v4i32
+    let a = i32x4::from([1, 2, 4, 8]);
+    let b = i32x4::from([1073741824, 1073741824, 1073741824, 1073741824]);
+    let e = i32x4::from([0, 1, 2, 4]);
+    let r: i32x4 = unsafe { transmute(vqdmulhq_s32(transmute(a), transmute(b))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddl_s8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.saddlp.v4i16.v8i8
+    let a = i8x8::from([1, 2, 3, 4, -5, -6, -7, -8]);
+    let e = i16x4::from([3, 7, -11, -15]);
+    let r: i16x4 = unsafe { transmute(vpaddl_s8(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddl_s16() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.saddlp.v2i32.v4i16
+    let a = i16x4::from([1, 2, -3, -4]);
+    let e = i32x2::from([3, -7]);
+    let r: i32x2 = unsafe { transmute(vpaddl_s16(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddl_s32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.saddlp.v1i64.v2i32
+    let a = i32x2::from([1, -2]);
+    let e = i64x1::from([-1]);
+    let r: i64x1 = unsafe { transmute(vpaddl_s32(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddlq_s8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.saddlp.v8i16.v16i8
+    let a = i8x16::from([1, 2, 3, 4, 5, 6, 7, 8, -9, -10, -11, -12, -13, -14, -15, -16]);
+    let e = i16x8::from([3, 7, 11, 15, -19, -23, -27, -31]);
+    let r: i16x8 = unsafe { transmute(vpaddlq_s8(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddlq_s16() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.saddlp.v4i32.v8i16
+    let a = i16x8::from([1, 2, 3, 4, -5, -6, -7, -8]);
+    let e = i32x4::from([3, 7, -11, -15]);
+    let r: i32x4 = unsafe { transmute(vpaddlq_s16(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddlq_s32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.saddlp.v2i64.v4i32
+    let a = i32x4::from([1, 2, -3, -4]);
+    let e = i64x2::from([3, -7]);
+    let r: i64x2 = unsafe { transmute(vpaddlq_s32(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddl_u8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.uaddlp.v4i16.v8i8
+    let a = u8x8::from([255, 254, 253, 252, 251, 250, 249, 248]);
+    let e = u16x4::from([509, 505, 501, 497]);
+    let r: u16x4 = unsafe { transmute(vpaddl_u8(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddl_u16() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.uaddlp.v2i32.v4i16
+    let a = u16x4::from([65535, 65534, 65533, 65532]);
+    let e = u32x2::from([131069, 131065]);
+    let r: u32x2 = unsafe { transmute(vpaddl_u16(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddl_u32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.uaddlp.v1i64.v2i32
+    let a = u32x2::from([4294967295, 4294967294]);
+    let e = u64x1::from([8589934589]);
+    let r: u64x1 = unsafe { transmute(vpaddl_u32(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddlq_u8() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.uaddlp.v8i16.v16i8
+    let a = u8x16::from([
+        255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240,
+    ]);
+    let e = u16x8::from([509, 505, 501, 497, 493, 489, 485, 481]);
+    let r: u16x8 = unsafe { transmute(vpaddlq_u8(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddlq_u16() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.uaddlp.v4i32.v8i16
+    let a = u16x8::from([65535, 65534, 65533, 65532, 65531, 65530, 65529, 65528]);
+    let e = u32x4::from([131069, 131065, 131061, 131057]);
+    let r: u32x4 = unsafe { transmute(vpaddlq_u16(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
+unsafe fn test_vpaddlq_u32() {
+    // AArch64 llvm intrinsic: llvm.aarch64.neon.uaddlp.v2i64.v4i32
+    let a = u32x4::from([4294967295, 4294967294, 4294967293, 4294967292]);
+    let e = u64x2::from([8589934589, 8589934585]);
+    let r: u64x2 = unsafe { transmute(vpaddlq_u32(transmute(a))) };
+    assert_eq!(r, e);
+}
+
+#[cfg(target_arch = "aarch64")]
 fn main() {
     unsafe {
         test_vpmin_s8();
@@ -272,6 +557,40 @@ fn main() {
         test_vminq_f32();
         test_vaddvq_f32();
         test_vrndnq_f32();
+
+        test_crc32();
+
+        test_vaeseq_u8();
+        test_vaesdq_u8();
+        test_vaesmcq_u8();
+        test_vaesimcq_u8();
+
+        test_vsha256hq_u32();
+        test_vsha256h2q_u32();
+        test_vsha256su0q_u32();
+        test_vsha256su1q_u32();
+
+        test_vmull_p64();
+        test_vmull_p8();
+
+        test_vqdmulh_s16();
+        test_vqdmulh_s32();
+        test_vqdmulhq_s16();
+        test_vqdmulhq_s32();
+
+        test_vpaddl_s8();
+        test_vpaddl_s16();
+        test_vpaddl_s32();
+        test_vpaddlq_s8();
+        test_vpaddlq_s16();
+        test_vpaddlq_s32();
+
+        test_vpaddl_u8();
+        test_vpaddl_u16();
+        test_vpaddl_u32();
+        test_vpaddlq_u8();
+        test_vpaddlq_u16();
+        test_vpaddlq_u32();
     }
 }
 
diff --git a/compiler/rustc_codegen_cranelift/example/std_example.rs b/compiler/rustc_codegen_cranelift/example/std_example.rs
index f0e38ae..252344b 100644
--- a/compiler/rustc_codegen_cranelift/example/std_example.rs
+++ b/compiler/rustc_codegen_cranelift/example/std_example.rs
@@ -2,8 +2,6 @@
 #![allow(internal_features)]
 
 #[cfg(target_arch = "x86_64")]
-use std::arch::asm;
-#[cfg(target_arch = "x86_64")]
 use std::arch::x86_64::*;
 use std::hint::black_box;
 use std::io::Write;
@@ -591,7 +589,7 @@ unsafe fn test_xmm_roundtrip() {
         let input = [1u8; 16];
         let mut output = [0u8; 16];
 
-        asm!(
+        std::arch::asm!(
             "movups {xmm}, [{input}]",
             "movups [{output}], {xmm}",
             input = in(reg) input.as_ptr(),
@@ -611,7 +609,7 @@ unsafe fn test_ymm_roundtrip() {
         let input = [1u8; 32];
         let mut output = [0u8; 32];
 
-        asm!(
+        std::arch::asm!(
             "vmovups {ymm}, [{input}]",
             "vmovups [{output}], {ymm}",
             input = in(reg) input.as_ptr(),
@@ -631,7 +629,7 @@ unsafe fn test_zmm_roundtrip() {
         let input = [1u8; 64];
         let mut output = [0u8; 64];
 
-        asm!(
+        std::arch::asm!(
             "vmovups {zmm}, [{input}]",
             "vmovups [{output}], {zmm}",
             input = in(reg) input.as_ptr(),
diff --git a/compiler/rustc_codegen_cranelift/patches/0001-portable-simd-Disable-f16-usage-in-portable-simd.patch b/compiler/rustc_codegen_cranelift/patches/0001-portable-simd-Disable-f16-usage-in-portable-simd.patch
index 029e493..a2fcd97 100644
--- a/compiler/rustc_codegen_cranelift/patches/0001-portable-simd-Disable-f16-usage-in-portable-simd.patch
+++ b/compiler/rustc_codegen_cranelift/patches/0001-portable-simd-Disable-f16-usage-in-portable-simd.patch
@@ -154,6 +154,21 @@
  
 -impl_trait! { f16 { bits: u16, mask: i16 }, f32 { bits: u32, mask: i32 }, f64 { bits: u64, mask: i64 } }
 +impl_trait! { f32 { bits: u32, mask: i32 }, f64 { bits: u64, mask: i64 } }
+diff --git a/crates/core_simd/src/simd/prelude.rs b/crates/core_simd/src/simd/prelude.rs
+index 51b8def..6e93f16 100644
+--- a/crates/core_simd/src/simd/prelude.rs
++++ b/crates/core_simd/src/simd/prelude.rs
+@@ -14,10 +14,6 @@ pub use super::{
+     simd_swizzle,
+ };
+ 
+-#[rustfmt::skip]
+-#[doc(no_inline)]
+-pub use super::{f16x1, f16x2, f16x4, f16x8, f16x16, f16x32, f16x64};
+-
+ #[rustfmt::skip]
+ #[doc(no_inline)]
+ pub use super::{f32x1, f32x2, f32x4, f32x8, f32x16, f32x32, f32x64};
 diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs
 index fbef69f..c8e0b8c 100644
 --- a/crates/core_simd/src/vector.rs
diff --git a/compiler/rustc_codegen_cranelift/patches/0027-stdlib-128bit-atomic-operations.patch b/compiler/rustc_codegen_cranelift/patches/0027-stdlib-128bit-atomic-operations.patch
index b7276e4..717495c 100644
--- a/compiler/rustc_codegen_cranelift/patches/0027-stdlib-128bit-atomic-operations.patch
+++ b/compiler/rustc_codegen_cranelift/patches/0027-stdlib-128bit-atomic-operations.patch
@@ -34,17 +34,17 @@
  #[cfg(target_has_atomic_load_store = "8")]
  #[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
 diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
-index bf2b6d59f88..d5ccce03bbf 100644
+index 8a9a0b5..92ed9a6 100644
 --- a/library/core/src/sync/atomic.rs
 +++ b/library/core/src/sync/atomic.rs
-@@ -3585,42 +3585,6 @@ pub const fn as_ptr(&self) -> *mut $int_type {
+@@ -3762,42 +3757,6 @@ atomic_int! {
      8,
      u64 AtomicU64
  }
 -#[cfg(target_has_atomic_load_store = "128")]
 -atomic_int! {
 -    cfg(target_has_atomic = "128"),
--    cfg(target_has_atomic_equal_alignment = "128"),
+-    cfg(target_has_atomic_primitive_alignment = "128"),
 -    unstable(feature = "integer_atomics", issue = "99069"),
 -    unstable(feature = "integer_atomics", issue = "99069"),
 -    unstable(feature = "integer_atomics", issue = "99069"),
@@ -62,7 +62,7 @@
 -#[cfg(target_has_atomic_load_store = "128")]
 -atomic_int! {
 -    cfg(target_has_atomic = "128"),
--    cfg(target_has_atomic_equal_alignment = "128"),
+-    cfg(target_has_atomic_primitive_alignment = "128"),
 -    unstable(feature = "integer_atomics", issue = "99069"),
 -    unstable(feature = "integer_atomics", issue = "99069"),
 -    unstable(feature = "integer_atomics", issue = "99069"),
diff --git a/compiler/rustc_codegen_cranelift/patches/0029-sysroot_tests-disable-f16-math.patch b/compiler/rustc_codegen_cranelift/patches/0029-sysroot_tests-disable-f16-math.patch
index 2aeb4a8..8d21359 100644
--- a/compiler/rustc_codegen_cranelift/patches/0029-sysroot_tests-disable-f16-math.patch
+++ b/compiler/rustc_codegen_cranelift/patches/0029-sysroot_tests-disable-f16-math.patch
@@ -7,11 +7,389 @@
  coretests/tests/num/floats.rs | 26 +++++++++++++-------------
  1 file changed, 13 insertions(+), 13 deletions(-)
 
-diff --git a/coretests/tests/floats/mod.rs b/coretests/tests/floats/mod.rs
-index c61961f8584..d7b4fa20322 100644
+diff --git a/coretests/tests/num/floats.rs b/coretests/tests/num/floats.rs
+index 1d7956b..01e4caa 100644
 --- a/coretests/tests/num/floats.rs
 +++ b/coretests/tests/num/floats.rs
-@@ -1534,7 +1534,7 @@ fn s_nan() -> Float {
+@@ -444,7 +444,7 @@ pub(crate) use float_test;
+ float_test! {
+     name: num,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -463,7 +463,7 @@ float_test! {
+     name: num_rem,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -476,7 +476,7 @@ float_test! {
+ float_test! {
+     name: nan,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -496,7 +496,7 @@ float_test! {
+ float_test! {
+     name: infinity,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -514,7 +514,7 @@ float_test! {
+ float_test! {
+     name: neg_infinity,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -532,7 +532,7 @@ float_test! {
+ float_test! {
+     name: zero,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -550,7 +550,7 @@ float_test! {
+ float_test! {
+     name: neg_zero,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -570,7 +570,7 @@ float_test! {
+ float_test! {
+     name: one,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -588,7 +588,7 @@ float_test! {
+ float_test! {
+     name: is_nan,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -609,7 +609,7 @@ float_test! {
+ float_test! {
+     name: is_infinite,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -630,7 +630,7 @@ float_test! {
+ float_test! {
+     name: is_finite,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -651,7 +651,7 @@ float_test! {
+ float_test! {
+     name: is_normal,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -673,7 +673,7 @@ float_test! {
+ float_test! {
+     name: classify,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+     },
+     test {
+         let nan: Float = Float::NAN;
+@@ -695,7 +695,7 @@ float_test! {
+     name: min,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -737,7 +737,7 @@ float_test! {
+     name: max,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -780,7 +780,7 @@ float_test! {
+     name: minimum,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -812,7 +812,7 @@ float_test! {
+     name: maximum,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -845,7 +845,7 @@ float_test! {
+     name: midpoint,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -898,7 +898,7 @@ float_test! {
+     attrs: {
+         const: #[cfg(false)],
+         // Needs powi
+-        f16: #[cfg(target_has_reliable_f16_math)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128_math)],
+     },
+     test {
+@@ -929,7 +929,7 @@ float_test! {
+     name: abs,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -948,7 +948,7 @@ float_test! {
+     name: copysign,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -964,7 +964,7 @@ float_test! {
+     attrs: {
+         const: #[cfg(false)],
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -982,7 +982,7 @@ float_test! {
+     attrs: {
+         const: #[cfg(false)],
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -998,7 +998,7 @@ float_test! {
+     name: floor,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1028,7 +1028,7 @@ float_test! {
+     name: ceil,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1058,7 +1058,7 @@ float_test! {
+     name: round,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1089,7 +1089,7 @@ float_test! {
+     name: round_ties_even,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1120,7 +1120,7 @@ float_test! {
+     name: trunc,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1150,7 +1150,7 @@ float_test! {
+     name: fract,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1182,7 +1182,7 @@ float_test! {
+     name: signum,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1200,7 +1200,7 @@ float_test! {
+ float_test! {
+     name: is_sign_positive,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -1219,7 +1219,7 @@ float_test! {
+ float_test! {
+     name: is_sign_negative,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -1238,7 +1238,7 @@ float_test! {
+ float_test! {
+     name: next_up,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -1269,7 +1269,7 @@ float_test! {
+ float_test! {
+     name: next_down,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -1303,7 +1303,7 @@ float_test! {
+     attrs: {
+         const: #[cfg(false)],
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1321,7 +1321,7 @@ float_test! {
+     name: clamp_min_greater_than_max,
+     attrs: {
+         const: #[cfg(false)],
+-        f16: #[should_panic, cfg(target_has_reliable_f16)],
++        f16: #[should_panic, cfg(false)],
+         f32: #[should_panic],
+         f64: #[should_panic],
+         f128: #[should_panic, cfg(target_has_reliable_f128)],
+@@ -1335,7 +1335,7 @@ float_test! {
+     name: clamp_min_is_nan,
+     attrs: {
+         const: #[cfg(false)],
+-        f16: #[should_panic, cfg(target_has_reliable_f16)],
++        f16: #[should_panic, cfg(false)],
+         f32: #[should_panic],
+         f64: #[should_panic],
+         f128: #[should_panic, cfg(target_has_reliable_f128)],
+@@ -1349,7 +1349,7 @@ float_test! {
+     name: clamp_max_is_nan,
+     attrs: {
+         const: #[cfg(false)],
+-        f16: #[should_panic, cfg(target_has_reliable_f16)],
++        f16: #[should_panic, cfg(false)],
+         f32: #[should_panic],
+         f64: #[should_panic],
+         f128: #[should_panic, cfg(target_has_reliable_f128)],
+@@ -1363,7 +1363,7 @@ float_test! {
+     name: total_cmp,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1469,7 +1469,7 @@ float_test! {
+     attrs: {
+         const: #[cfg(false)],
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1526,7 +1526,7 @@ float_test! {
+     name: recip,
+     attrs: {
+         // Miri only uses softfloats here, so that always works
+-        f16: #[cfg(any(miri, target_has_reliable_f16_math))],
++        f16: #[cfg(false)],
+         f128: #[cfg(any(miri, target_has_reliable_f128_math))],
+     },
+     test {
+@@ -1549,7 +1549,7 @@ float_test! {
+     name: powi,
+     attrs: {
+         const: #[cfg(false)],
+-        f16: #[cfg(target_has_reliable_f16_math)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128_math)],
+     },
+     test {
+@@ -1570,7 +1570,7 @@ float_test! {
      name: powf,
      attrs: {
          const: #[cfg(false)],
@@ -20,7 +398,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1557,7 +1557,7 @@ fn s_nan() -> Float {
+@@ -1593,7 +1593,7 @@ float_test! {
      name: exp,
      attrs: {
          const: #[cfg(false)],
@@ -29,7 +407,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1578,7 +1578,7 @@ fn s_nan() -> Float {
+@@ -1614,7 +1614,7 @@ float_test! {
      name: exp2,
      attrs: {
          const: #[cfg(false)],
@@ -38,7 +416,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1598,7 +1598,7 @@ fn s_nan() -> Float {
+@@ -1634,7 +1634,7 @@ float_test! {
      name: ln,
      attrs: {
          const: #[cfg(false)],
@@ -47,7 +425,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1620,7 +1620,7 @@ fn s_nan() -> Float {
+@@ -1656,7 +1656,7 @@ float_test! {
      name: log,
      attrs: {
          const: #[cfg(false)],
@@ -56,7 +434,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1645,7 +1645,7 @@ fn s_nan() -> Float {
+@@ -1681,7 +1681,7 @@ float_test! {
      name: log2,
      attrs: {
          const: #[cfg(false)],
@@ -65,7 +443,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1668,7 +1668,7 @@ fn s_nan() -> Float {
+@@ -1704,7 +1704,7 @@ float_test! {
      name: log10,
      attrs: {
          const: #[cfg(false)],
@@ -74,7 +452,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1692,7 +1692,7 @@ fn s_nan() -> Float {
+@@ -1728,7 +1728,7 @@ float_test! {
      name: asinh,
      attrs: {
          const: #[cfg(false)],
@@ -83,7 +461,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1725,7 +1725,7 @@ fn s_nan() -> Float {
+@@ -1764,7 +1764,7 @@ float_test! {
      name: acosh,
      attrs: {
          const: #[cfg(false)],
@@ -92,7 +470,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1753,7 +1753,7 @@ fn s_nan() -> Float {
+@@ -1795,7 +1795,7 @@ float_test! {
      name: atanh,
      attrs: {
          const: #[cfg(false)],
@@ -101,7 +479,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1779,7 +1779,7 @@ fn s_nan() -> Float {
+@@ -1821,7 +1821,7 @@ float_test! {
      name: gamma,
      attrs: {
          const: #[cfg(false)],
@@ -110,7 +488,7 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -1814,7 +1814,7 @@ fn s_nan() -> Float {
+@@ -1856,7 +1856,7 @@ float_test! {
      name: ln_gamma,
      attrs: {
          const: #[cfg(false)],
@@ -119,7 +497,79 @@
          f128: #[cfg(target_has_reliable_f128_math)],
      },
      test {
-@@ -2027,7 +2027,7 @@ fn s_nan() -> Float {
+@@ -1874,7 +1874,7 @@ float_test! {
+ float_test! {
+     name: to_degrees,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -1895,7 +1895,7 @@ float_test! {
+ float_test! {
+     name: to_radians,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -1916,7 +1916,7 @@ float_test! {
+ float_test! {
+     name: to_algebraic,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -1940,7 +1940,7 @@ float_test! {
+ float_test! {
+     name: to_bits_conv,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -1967,7 +1967,7 @@ float_test! {
+ float_test! {
+     name: mul_add,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         // FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/
+         f32: #[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)],
+         f64: #[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)],
+@@ -1992,7 +1992,7 @@ float_test! {
+ float_test! {
+     name: from,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -2049,7 +2049,7 @@ float_test! {
+ float_test! {
+     name: max_exact_integer_constant,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -2091,7 +2091,7 @@ float_test! {
+ float_test! {
+     name: min_exact_integer_constant,
+     attrs: {
+-        f16: #[cfg(target_has_reliable_f16)],
++        f16: #[cfg(false)],
+         f128: #[cfg(target_has_reliable_f128)],
+     },
+     test {
+@@ -2156,7 +2156,7 @@ float_test! {
      attrs: {
          // FIXME(f16_f128): add math tests when available
          const: #[cfg(false)],
diff --git a/compiler/rustc_codegen_cranelift/rust-toolchain.toml b/compiler/rustc_codegen_cranelift/rust-toolchain.toml
index 4860781..faadf08 100644
--- a/compiler/rustc_codegen_cranelift/rust-toolchain.toml
+++ b/compiler/rustc_codegen_cranelift/rust-toolchain.toml
@@ -1,4 +1,4 @@
 [toolchain]
-channel = "nightly-2026-04-28"
+channel = "nightly-2026-06-06"
 components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"]
 profile = "minimal"
diff --git a/compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh b/compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh
index 7ce54a4..ab31c43 100644
--- a/compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh
@@ -54,7 +54,7 @@
 --- a/src/bootstrap/bootstrap.py
 +++ b/src/bootstrap/bootstrap.py
 @@ -1147,6 +1147,8 @@ class RustBuild(object):
-             args += ["-Zwarnings"]
+         if deny_warnings:
              env["CARGO_BUILD_WARNINGS"] = "deny"
 
 +        env["RUSTFLAGS"] += " -Zbinary-dep-depinfo"
diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
index 4a663c4..683adeb 100755
--- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
@@ -88,6 +88,8 @@
 rm -r tests/run-make/no-builtins-lto
 rm -r tests/run-make/reachable-extern-fn-available-lto
 rm -r tests/run-make/no-builtins-linker-plugin-lto
+rm -r tests/run-make/fat-then-thin-lto
+rm -r tests/run-make/cross-lang-lto-upstream-rlibs
 
 # coverage instrumentation
 rm tests/ui/consts/precise-drop-with-coverage.rs
@@ -146,6 +148,7 @@
 rm tests/ui/abi/large-byval-align.rs # exceeds implementation limit of Cranelift
 rm -r tests/run-make/short-ice # ICE backtrace begin/end marker mismatch
 rm -r tests/run-make/naked-dead-code-elimination # function not eliminated
+rm tests/ui/codegen/huge-stacks.rs # Cranelift doesn't allow stack frames to exceed 4GB
 
 # doesn't work due to the way the rustc test suite is invoked.
 # should work when using ./x.py test the way it is intended
diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
index a8b179f..0eb4930 100644
--- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
@@ -31,6 +31,11 @@
 use crate::debuginfo::EXCEPTION_HANDLER_CLEANUP;
 use crate::prelude::*;
 
+struct ArgValue<'tcx> {
+    value: CValue<'tcx>,
+    is_underaligned_pointee: bool,
+}
+
 fn clif_sig_from_fn_abi<'tcx>(
     tcx: TyCtxt<'tcx>,
     default_call_conv: CallConv,
@@ -55,8 +60,9 @@ pub(crate) fn conv_to_call_conv(
     match c {
         CanonAbi::Rust | CanonAbi::RustCold | CanonAbi::C => default_call_conv,
 
-        // Cranelift doesn't currently have anything for this.
-        CanonAbi::RustPreserveNone => default_call_conv,
+        CanonAbi::RustPreserveNone | CanonAbi::RustTail => {
+            sess.dcx().fatal(format!("call conv {c:?} is LLVM-specific"))
+        }
 
         // Functions with this calling convention can only be called from assembly, but it is
         // possible to declare an `extern "custom"` block, so the backend still needs a calling
@@ -71,7 +77,7 @@ pub(crate) fn conv_to_call_conv(
         },
 
         CanonAbi::Interrupt(_) | CanonAbi::Arm(_) | CanonAbi::Swift => {
-            sess.dcx().fatal("call conv {c:?} is not yet implemented")
+            sess.dcx().fatal(format!("call conv {c:?} is not yet implemented"))
         }
         CanonAbi::GpuKernel => {
             unreachable!("tried to use {c:?} call conv which only exists on an unsupported target")
@@ -245,8 +251,8 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
 
     // None means pass_mode == NoPass
     enum ArgKind<'tcx> {
-        Normal(Option<CValue<'tcx>>),
-        Spread(Vec<Option<CValue<'tcx>>>),
+        Normal(Option<ArgValue<'tcx>>),
+        Spread(Vec<Option<ArgValue<'tcx>>>),
     }
 
     // FIXME implement variadics in cranelift
@@ -299,8 +305,12 @@ enum ArgKind<'tcx> {
     if fx.instance.def.requires_caller_location(fx.tcx) {
         // Store caller location for `#[track_caller]`.
         let arg_abi = arg_abis_iter.next().unwrap();
-        fx.caller_location =
-            Some(cvalue_for_param(fx, None, None, arg_abi, &mut block_params_iter).unwrap());
+        let param = cvalue_for_param(fx, None, None, arg_abi, &mut block_params_iter).unwrap();
+        assert!(
+            !param.is_underaligned_pointee,
+            "caller location argument should not be underaligned",
+        );
+        fx.caller_location = Some(param.value);
     }
 
     assert_eq!(arg_abis_iter.next(), None, "ArgAbi left behind for {:?}", fx.fn_abi);
@@ -311,23 +321,24 @@ enum ArgKind<'tcx> {
     for (local, arg_kind, ty) in func_params {
         // While this is normally an optimization to prevent an unnecessary copy when an argument is
         // not mutated by the current function, this is necessary to support unsized arguments.
-        if let ArgKind::Normal(Some(val)) = arg_kind {
-            if let Some((addr, meta)) = val.try_to_ptr() {
-                // Ownership of the value at the backing storage for an argument is passed to the
-                // callee per the ABI, so it is fine to borrow the backing storage of this argument
-                // to prevent a copy.
+        if let ArgKind::Normal(Some(ArgValue { value: val, is_underaligned_pointee: false })) =
+            arg_kind
+            && let Some((addr, meta)) = val.try_to_ptr()
+        {
+            // Ownership of the value at the backing storage for an argument is passed to the
+            // callee per the ABI, so it is fine to borrow the backing storage of this argument
+            // to prevent a copy.
 
-                let place = if let Some(meta) = meta {
-                    CPlace::for_ptr_with_extra(addr, meta, val.layout())
-                } else {
-                    CPlace::for_ptr(addr, val.layout())
-                };
+            let place = if let Some(meta) = meta {
+                CPlace::for_ptr_with_extra(addr, meta, val.layout())
+            } else {
+                CPlace::for_ptr(addr, val.layout())
+            };
 
-                self::comments::add_local_place_comments(fx, place, local);
+            self::comments::add_local_place_comments(fx, place, local);
 
-                assert_eq!(fx.local_map.push(place), local);
-                continue;
-            }
+            assert_eq!(fx.local_map.push(place), local);
+            continue;
         }
 
         let layout = fx.layout_of(ty);
@@ -338,13 +349,22 @@ enum ArgKind<'tcx> {
         match arg_kind {
             ArgKind::Normal(param) => {
                 if let Some(param) = param {
-                    place.write_cvalue(fx, param);
+                    if param.is_underaligned_pointee {
+                        place.write_cvalue_transmute(fx, param.value);
+                    } else {
+                        place.write_cvalue(fx, param.value);
+                    }
                 }
             }
             ArgKind::Spread(params) => {
                 for (i, param) in params.into_iter().enumerate() {
                     if let Some(param) = param {
-                        place.place_field(fx, FieldIdx::new(i)).write_cvalue(fx, param);
+                        let field_place = place.place_field(fx, FieldIdx::new(i));
+                        if param.is_underaligned_pointee {
+                            field_place.write_cvalue_transmute(fx, param.value);
+                        } else {
+                            field_place.write_cvalue(fx, param.value);
+                        }
                     }
                 }
             }
diff --git a/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs b/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs
index edbee60..612f89e 100644
--- a/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs
+++ b/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs
@@ -7,6 +7,7 @@
 };
 use smallvec::{SmallVec, smallvec};
 
+use super::ArgValue;
 use crate::prelude::*;
 use crate::value_and_place::assert_assignable;
 
@@ -285,7 +286,7 @@ pub(super) fn cvalue_for_param<'tcx>(
     local_field: Option<usize>,
     arg_abi: &ArgAbi<'tcx, Ty<'tcx>>,
     block_params_iter: &mut impl Iterator<Item = Value>,
-) -> Option<CValue<'tcx>> {
+) -> Option<ArgValue<'tcx>> {
     let block_params = arg_abi
         .get_abi_param(fx.tcx)
         .into_iter()
@@ -306,30 +307,42 @@ pub(super) fn cvalue_for_param<'tcx>(
         arg_abi.layout,
     );
 
-    match arg_abi.mode {
-        PassMode::Ignore => None,
+    let value = match arg_abi.mode {
+        PassMode::Ignore => return None,
         PassMode::Direct(_) => {
             assert_eq!(block_params.len(), 1, "{:?}", block_params);
-            Some(CValue::by_val(block_params[0], arg_abi.layout))
+            CValue::by_val(block_params[0], arg_abi.layout)
         }
         PassMode::Pair(_, _) => {
             assert_eq!(block_params.len(), 2, "{:?}", block_params);
-            Some(CValue::by_val_pair(block_params[0], block_params[1], arg_abi.layout))
+            CValue::by_val_pair(block_params[0], block_params[1], arg_abi.layout)
         }
         PassMode::Cast { ref cast, .. } => {
-            Some(from_casted_value(fx, &block_params, arg_abi.layout, cast))
+            from_casted_value(fx, &block_params, arg_abi.layout, cast)
         }
-        PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => {
+        PassMode::Indirect { attrs, meta_attrs: None, on_stack: _ } => {
             assert_eq!(block_params.len(), 1, "{:?}", block_params);
-            Some(CValue::by_ref(Pointer::new(block_params[0]), arg_abi.layout))
+            if let Some(pointee_align) = attrs.pointee_align
+                && pointee_align < arg_abi.layout.align.abi
+                && arg_abi.layout.is_sized()
+                && arg_abi.layout.size != Size::ZERO
+            {
+                // Underaligned pointer: treat as `[u8; size]` and transmute-copy into the real type.
+                let bytes_ty = Ty::new_array(fx.tcx, fx.tcx.types.u8, arg_abi.layout.size.bytes());
+                let bytes_layout = fx.layout_of(bytes_ty);
+                return Some(ArgValue {
+                    value: CValue::by_ref(Pointer::new(block_params[0]), bytes_layout),
+                    is_underaligned_pointee: true,
+                });
+            } else {
+                CValue::by_ref(Pointer::new(block_params[0]), arg_abi.layout)
+            }
         }
         PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
             assert_eq!(block_params.len(), 2, "{:?}", block_params);
-            Some(CValue::by_ref_unsized(
-                Pointer::new(block_params[0]),
-                block_params[1],
-                arg_abi.layout,
-            ))
+            CValue::by_ref_unsized(Pointer::new(block_params[0]), block_params[1], arg_abi.layout)
         }
-    }
+    };
+
+    Some(ArgValue { value, is_underaligned_pointee: false })
 }
diff --git a/compiler/rustc_codegen_cranelift/src/allocator.rs b/compiler/rustc_codegen_cranelift/src/allocator.rs
index 4a9b0c0..3c18748 100644
--- a/compiler/rustc_codegen_cranelift/src/allocator.rs
+++ b/compiler/rustc_codegen_cranelift/src/allocator.rs
@@ -5,20 +5,11 @@
 use rustc_ast::expand::allocator::{
     AllocatorMethod, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, default_fn_name, global_fn_name,
 };
-use rustc_codegen_ssa::base::{allocator_kind_for_codegen, allocator_shim_contents};
 use rustc_symbol_mangling::mangle_internal_symbol;
 
 use crate::prelude::*;
 
-/// Returns whether an allocator shim was created
-pub(crate) fn codegen(tcx: TyCtxt<'_>, module: &mut dyn Module) -> bool {
-    let Some(kind) = allocator_kind_for_codegen(tcx) else { return false };
-    let methods = allocator_shim_contents(tcx, kind);
-    codegen_inner(tcx, module, &methods);
-    true
-}
-
-fn codegen_inner(tcx: TyCtxt<'_>, module: &mut dyn Module, methods: &[AllocatorMethod]) {
+pub(crate) fn codegen(tcx: TyCtxt<'_>, module: &mut dyn Module, methods: &[AllocatorMethod]) {
     let usize_ty = module.target_config().pointer_type();
 
     for method in methods {
diff --git a/compiler/rustc_codegen_cranelift/src/analyze.rs b/compiler/rustc_codegen_cranelift/src/analyze.rs
index 72380f5..c4a31ca 100644
--- a/compiler/rustc_codegen_cranelift/src/analyze.rs
+++ b/compiler/rustc_codegen_cranelift/src/analyze.rs
@@ -23,14 +23,10 @@ pub(crate) fn analyze(fx: &FunctionCx<'_, '_, '_>) -> IndexVec<Local, SsaKind> {
 
     for bb in fx.mir.basic_blocks.iter() {
         for stmt in bb.statements.iter() {
-            match &stmt.kind {
-                Assign(place_and_rval) => match &place_and_rval.1 {
-                    Rvalue::Ref(_, _, place) | Rvalue::RawPtr(_, place) => {
-                        flag_map[place.local] = SsaKind::NotSsa;
-                    }
-                    _ => {}
-                },
-                _ => {}
+            if let Assign(place_and_rval) = &stmt.kind
+                && let Rvalue::Ref(_, _, place) | Rvalue::RawPtr(_, place) = &place_and_rval.1
+            {
+                flag_map[place.local] = SsaKind::NotSsa;
             }
         }
     }
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs
index 2edbdb5..467ecee 100644
--- a/compiler/rustc_codegen_cranelift/src/base.rs
+++ b/compiler/rustc_codegen_cranelift/src/base.rs
@@ -147,7 +147,7 @@ pub(crate) fn codegen_fn<'tcx>(
 }
 
 pub(crate) fn compile_fn(
-    profiler: &SelfProfilerRef,
+    prof: &SelfProfilerRef,
     output_filenames: &OutputFilenames,
     should_write_ir: bool,
     cached_context: &mut Context,
@@ -156,8 +156,7 @@ pub(crate) fn compile_fn(
     global_asm: &mut String,
     codegened_func: CodegenedFunction,
 ) {
-    let _timer =
-        profiler.generic_activity_with_arg("compile function", &*codegened_func.symbol_name);
+    let _timer = prof.generic_activity_with_arg("compile function", &*codegened_func.symbol_name);
 
     let clif_comments = codegened_func.clif_comments;
     global_asm.push_str(&codegened_func.inline_asm);
@@ -196,7 +195,7 @@ pub(crate) fn compile_fn(
     };
 
     // Define function
-    profiler.generic_activity("define function").run(|| {
+    prof.generic_activity("define function").run(|| {
         context.want_disasm = should_write_ir;
         match module.define_function(codegened_func.func_id, context) {
             Ok(()) => {}
@@ -248,7 +247,7 @@ pub(crate) fn compile_fn(
     }
 
     // Define debuginfo for function
-    profiler.generic_activity("generate debug info").run(|| {
+    prof.generic_activity("generate debug info").run(|| {
         if let Some(debug_context) = debug_context {
             codegened_func.func_debug_cx.unwrap().finalize(
                 debug_context,
@@ -1052,7 +1051,7 @@ pub(crate) fn codegen_operand<'tcx>(
         Operand::RuntimeChecks(checks) => {
             let val = checks.value(fx.tcx.sess);
             let layout = fx.layout_of(fx.tcx.types.bool);
-            return CValue::const_val(fx, layout, val.into());
+            CValue::const_val(fx, layout, val.into())
         }
     }
 }
diff --git a/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs b/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs
deleted file mode 100644
index b5a81fc..0000000
--- a/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs
+++ /dev/null
@@ -1,205 +0,0 @@
-use std::sync::{Arc, Condvar, Mutex};
-
-use rustc_data_structures::jobserver::{self, HelperThread};
-use rustc_errors::DiagCtxtHandle;
-
-// FIXME don't panic when a worker thread panics
-
-pub(super) struct ConcurrencyLimiter {
-    helper_thread: Option<Mutex<HelperThread>>,
-    state: Arc<Mutex<state::ConcurrencyLimiterState>>,
-    available_token_condvar: Arc<Condvar>,
-    finished: bool,
-}
-
-impl ConcurrencyLimiter {
-    pub(super) fn new(pending_jobs: usize) -> Self {
-        let state = Arc::new(Mutex::new(state::ConcurrencyLimiterState::new(pending_jobs)));
-        let available_token_condvar = Arc::new(Condvar::new());
-
-        let state_helper = state.clone();
-        let available_token_condvar_helper = available_token_condvar.clone();
-        let helper_thread = jobserver::client()
-            .clone()
-            .into_helper_thread(move |token| {
-                let mut state = state_helper.lock().unwrap();
-                match token {
-                    Ok(token) => {
-                        state.add_new_token(token);
-                        available_token_condvar_helper.notify_one();
-                    }
-                    Err(err) => {
-                        state.poison(format!("failed to acquire jobserver token: {}", err));
-                        // Notify all threads waiting for a token to give them a chance to
-                        // gracefully exit.
-                        available_token_condvar_helper.notify_all();
-                    }
-                }
-            })
-            .unwrap();
-        ConcurrencyLimiter {
-            helper_thread: Some(Mutex::new(helper_thread)),
-            state,
-            available_token_condvar,
-            finished: false,
-        }
-    }
-
-    pub(super) fn acquire(&self, dcx: DiagCtxtHandle<'_>) -> ConcurrencyLimiterToken {
-        let mut state = self.state.lock().unwrap();
-        loop {
-            state.assert_invariants();
-
-            match state.try_start_job() {
-                Ok(true) => {
-                    return ConcurrencyLimiterToken {
-                        state: self.state.clone(),
-                        available_token_condvar: self.available_token_condvar.clone(),
-                    };
-                }
-                Ok(false) => {}
-                Err(err) => {
-                    // An error happened when acquiring the token. Raise it as fatal error.
-                    // Make sure to drop the mutex guard first to prevent poisoning the mutex.
-                    drop(state);
-                    if let Some(err) = err {
-                        dcx.fatal(err);
-                    } else {
-                        // The error was already emitted, but compilation continued. Raise a silent
-                        // fatal error.
-                        rustc_errors::FatalError.raise();
-                    }
-                }
-            }
-
-            self.helper_thread.as_ref().unwrap().lock().unwrap().request_token();
-            state = self.available_token_condvar.wait(state).unwrap();
-        }
-    }
-
-    pub(crate) fn finished(mut self) {
-        self.helper_thread.take();
-
-        // Assert that all jobs have finished
-        let state = Mutex::get_mut(Arc::get_mut(&mut self.state).unwrap()).unwrap();
-        state.assert_done();
-
-        self.finished = true;
-    }
-}
-
-impl Drop for ConcurrencyLimiter {
-    fn drop(&mut self) {
-        if !self.finished && !std::thread::panicking() {
-            panic!("Forgot to call finished() on ConcurrencyLimiter");
-        }
-    }
-}
-
-#[derive(Debug)]
-pub(super) struct ConcurrencyLimiterToken {
-    state: Arc<Mutex<state::ConcurrencyLimiterState>>,
-    available_token_condvar: Arc<Condvar>,
-}
-
-impl Drop for ConcurrencyLimiterToken {
-    fn drop(&mut self) {
-        let mut state = self.state.lock().unwrap();
-        state.job_finished();
-        self.available_token_condvar.notify_one();
-    }
-}
-
-mod state {
-    use rustc_data_structures::jobserver::Acquired;
-
-    #[derive(Debug)]
-    pub(super) struct ConcurrencyLimiterState {
-        pending_jobs: usize,
-        active_jobs: usize,
-
-        poisoned: bool,
-        stored_error: Option<String>,
-
-        // None is used to represent the implicit token, Some to represent explicit tokens
-        tokens: Vec<Option<Acquired>>,
-    }
-
-    impl ConcurrencyLimiterState {
-        pub(super) fn new(pending_jobs: usize) -> Self {
-            ConcurrencyLimiterState {
-                pending_jobs,
-                active_jobs: 0,
-                poisoned: false,
-                stored_error: None,
-                tokens: vec![None],
-            }
-        }
-
-        pub(super) fn assert_invariants(&self) {
-            // There must be no excess active jobs
-            assert!(self.active_jobs <= self.pending_jobs);
-
-            // There may not be more active jobs than there are tokens
-            assert!(self.active_jobs <= self.tokens.len());
-        }
-
-        pub(super) fn assert_done(&self) {
-            assert_eq!(self.pending_jobs, 0);
-            assert_eq!(self.active_jobs, 0);
-        }
-
-        pub(super) fn add_new_token(&mut self, token: Acquired) {
-            self.tokens.push(Some(token));
-            self.drop_excess_capacity();
-        }
-
-        pub(super) fn try_start_job(&mut self) -> Result<bool, Option<String>> {
-            if self.poisoned {
-                return Err(self.stored_error.take());
-            }
-
-            if self.active_jobs < self.tokens.len() {
-                // Using existing token
-                self.job_started();
-                return Ok(true);
-            }
-
-            Ok(false)
-        }
-
-        pub(super) fn job_started(&mut self) {
-            self.assert_invariants();
-            self.active_jobs += 1;
-            self.drop_excess_capacity();
-            self.assert_invariants();
-        }
-
-        pub(super) fn job_finished(&mut self) {
-            self.assert_invariants();
-            self.pending_jobs -= 1;
-            self.active_jobs -= 1;
-            self.assert_invariants();
-            self.drop_excess_capacity();
-            self.assert_invariants();
-        }
-
-        pub(super) fn poison(&mut self, error: String) {
-            self.poisoned = true;
-            self.stored_error = Some(error);
-        }
-
-        fn drop_excess_capacity(&mut self) {
-            self.assert_invariants();
-
-            // Drop all tokens that can never be used anymore
-            self.tokens.truncate(std::cmp::max(self.pending_jobs, 1));
-
-            // Keep some excess tokens to satisfy requests faster
-            const MAX_EXTRA_CAPACITY: usize = 2;
-            self.tokens.truncate(std::cmp::max(self.active_jobs + MAX_EXTRA_CAPACITY, 1));
-
-            self.assert_invariants();
-        }
-    }
-}
diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs
index f85d21d..c986666 100644
--- a/compiler/rustc_codegen_cranelift/src/constant.rs
+++ b/compiler/rustc_codegen_cranelift/src/constant.rs
@@ -455,7 +455,8 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
             } else {
                 ("", section_name.as_str())
             };
-            data.set_segment_section(segment_name, section_name);
+            // FIXME pass correct section flags on Mach-O
+            data.set_segment_section(segment_name, section_name, 0);
         }
 
         let bytes = alloc.inspect_with_uninit_and_ptr_outside_interpreter(0..alloc.len()).to_vec();
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
index 1ce4243..4b0260a 100644
--- a/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
+++ b/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
@@ -204,7 +204,7 @@ pub(crate) fn add_function(
 
                     let mut data = DataDescription::new();
                     data.define(gcc_except_table.writer.into_vec().into_boxed_slice());
-                    data.set_segment_section("", ".gcc_except_table");
+                    data.set_segment_section("", ".gcc_except_table", 0);
 
                     for reloc in &gcc_except_table.relocs {
                         match reloc.name {
diff --git a/compiler/rustc_codegen_cranelift/src/driver/aot.rs b/compiler/rustc_codegen_cranelift/src/driver/aot.rs
index 323fec0..fcaf80d 100644
--- a/compiler/rustc_codegen_cranelift/src/driver/aot.rs
+++ b/compiler/rustc_codegen_cranelift/src/driver/aot.rs
@@ -1,184 +1,103 @@
 //! The AOT driver uses [`cranelift_object`] to write object files suitable for linking into a
 //! standalone executable.
 
-use std::env;
+use std::convert::Infallible;
 use std::fs::File;
 use std::io::BufWriter;
 use std::path::PathBuf;
 use std::sync::Arc;
-use std::thread::JoinHandle;
+use std::time::Instant;
 
 use cranelift_object::{ObjectBuilder, ObjectModule};
-use rustc_codegen_ssa::assert_module_sources::CguReuse;
-use rustc_codegen_ssa::back::write::produce_final_output_artifacts;
-use rustc_codegen_ssa::base::determine_cgu_reuse;
-use rustc_codegen_ssa::{CompiledModule, CompiledModules, ModuleKind};
+use rustc_ast::expand::allocator::AllocatorMethod;
+use rustc_codegen_ssa::back::lto::ThinModule;
+use rustc_codegen_ssa::back::write::{
+    CodegenContext, FatLtoInput, ModuleConfig, SharedEmitter, TargetMachineFactoryFn, ThinLtoInput,
+};
+use rustc_codegen_ssa::traits::{ExtraBackendMethods, WriteBackendMethods};
+use rustc_codegen_ssa::{CompiledModule, ModuleCodegen, ModuleKind};
 use rustc_data_structures::profiling::SelfProfilerRef;
-use rustc_data_structures::stable_hash::{StableHash, StableHashCtxt, StableHasher};
-use rustc_data_structures::sync::{IntoDynSyncSend, par_map};
+use rustc_errors::DiagCtxt;
 use rustc_hir::attrs::Linkage as RLinkage;
-use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::WorkProduct;
 use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
-use rustc_middle::mono::{CodegenUnit, MonoItem, MonoItemData, Visibility};
+use rustc_middle::mono::{MonoItem, MonoItemData, Visibility};
 use rustc_session::Session;
-use rustc_session::config::{OutputFilenames, OutputType};
+use rustc_session::config::{OptLevel, OutputFilenames, OutputType};
+use rustc_span::Symbol;
 
 use crate::base::CodegenedFunction;
-use crate::concurrency_limiter::{ConcurrencyLimiter, ConcurrencyLimiterToken};
 use crate::debuginfo::TypeDebugContext;
 use crate::global_asm::{GlobalAsmConfig, GlobalAsmContext};
 use crate::prelude::*;
 use crate::unwind_module::UnwindModule;
 
-fn disable_incr_cache() -> bool {
-    env::var("CG_CLIF_DISABLE_INCR_CACHE").as_deref() == Ok("1")
+pub(crate) struct AotModule {
+    producer: String,
+    global_asm_config: GlobalAsmConfig,
+    module: UnwindModule<ObjectModule>,
+    debug_context: Option<DebugContext>,
+    codegened_functions: Vec<CodegenedFunction>,
+    global_asm: String,
 }
 
-struct ModuleCodegenResult {
-    module: CompiledModule,
-    existing_work_product: Option<(WorkProductId, WorkProduct)>,
-}
+fn make_module(tcx: TyCtxt<'_>, cgu_name: &str) -> AotModule {
+    let isa = crate::build_isa(tcx.sess, false);
 
-enum OngoingModuleCodegen {
-    Sync(Result<ModuleCodegenResult, String>),
-    Async(JoinHandle<Result<ModuleCodegenResult, String>>),
-}
-
-impl StableHash for OngoingModuleCodegen {
-    fn stable_hash<Hcx: StableHashCtxt>(&self, _: &mut Hcx, _: &mut StableHasher) {
-        // do nothing
-    }
-}
-
-pub(crate) struct OngoingCodegen {
-    modules: Vec<OngoingModuleCodegen>,
-    allocator_module: Option<CompiledModule>,
-    concurrency_limiter: ConcurrencyLimiter,
-}
-
-impl OngoingCodegen {
-    pub(crate) fn join(
-        self,
-        sess: &Session,
-        outputs: &OutputFilenames,
-    ) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
-        let mut work_products = FxIndexMap::default();
-        let mut modules = vec![];
-        let disable_incr_cache = disable_incr_cache();
-
-        for module_codegen in self.modules {
-            let module_codegen_result = match module_codegen {
-                OngoingModuleCodegen::Sync(module_codegen_result) => module_codegen_result,
-                OngoingModuleCodegen::Async(join_handle) => match join_handle.join() {
-                    Ok(module_codegen_result) => module_codegen_result,
-                    Err(panic) => std::panic::resume_unwind(panic),
-                },
-            };
-
-            let module_codegen_result = match module_codegen_result {
-                Ok(module_codegen_result) => module_codegen_result,
-                Err(err) => sess.dcx().fatal(err),
-            };
-            let ModuleCodegenResult { module, existing_work_product } = module_codegen_result;
-
-            if let Some((work_product_id, work_product)) = existing_work_product {
-                work_products.insert(work_product_id, work_product);
-            } else {
-                let work_product = if disable_incr_cache {
-                    None
-                } else if let Some(global_asm_object) = &module.global_asm_object {
-                    rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
-                        sess,
-                        &module.name,
-                        &[("o", module.object.as_ref().unwrap()), ("asm.o", global_asm_object)],
-                        &[],
-                    )
-                } else {
-                    rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
-                        sess,
-                        &module.name,
-                        &[("o", module.object.as_ref().unwrap())],
-                        &[],
-                    )
-                };
-                if let Some((work_product_id, work_product)) = work_product {
-                    work_products.insert(work_product_id, work_product);
-                }
-            }
-
-            modules.push(module);
-        }
-
-        self.concurrency_limiter.finished();
-
-        sess.dcx().abort_if_errors();
-
-        let compiled_modules = CompiledModules { modules, allocator_module: self.allocator_module };
-
-        produce_final_output_artifacts(sess, &compiled_modules, outputs);
-
-        (compiled_modules, work_products)
-    }
-}
-
-fn make_module(sess: &Session, name: String) -> UnwindModule<ObjectModule> {
-    let isa = crate::build_isa(sess, false);
-
-    let mut builder =
-        ObjectBuilder::new(isa, name + ".o", cranelift_module::default_libcall_names()).unwrap();
+    let mut builder = ObjectBuilder::new(
+        isa,
+        cgu_name.to_owned() + ".o",
+        cranelift_module::default_libcall_names(),
+    )
+    .unwrap();
 
     // Disable function sections by default on MSVC as it causes significant slowdowns with link.exe.
     // Maybe link.exe has exponential behavior when there are many sections with the same name? Also
     // explicitly disable it on MinGW as rustc already disables it by default on MinGW and as such
     // isn't tested. If rustc enables it in the future on MinGW, we can re-enable it too once it has
     // been on MinGW.
-    let default_function_sections = sess.target.function_sections && !sess.target.is_like_windows;
+    let default_function_sections =
+        tcx.sess.target.function_sections && !tcx.sess.target.is_like_windows;
     builder.per_function_section(
-        sess.opts.unstable_opts.function_sections.unwrap_or(default_function_sections),
+        tcx.sess.opts.unstable_opts.function_sections.unwrap_or(default_function_sections),
     );
 
-    UnwindModule::new(ObjectModule::new(builder), true)
+    let module = UnwindModule::new(ObjectModule::new(builder), true);
+
+    let producer = crate::debuginfo::producer(tcx.sess);
+    let global_asm_config = GlobalAsmConfig::new(tcx.sess);
+    let debug_context = DebugContext::new(tcx, module.isa(), false, cgu_name);
+    let codegened_functions = vec![];
+    let global_asm = String::new();
+
+    AotModule {
+        producer,
+        global_asm_config,
+        module,
+        debug_context,
+        codegened_functions,
+        global_asm,
+    }
 }
 
-fn emit_cgu(
+fn emit_module(
     output_filenames: &OutputFilenames,
     prof: &SelfProfilerRef,
-    name: String,
     module: UnwindModule<ObjectModule>,
     debug: Option<DebugContext>,
-    global_asm_object_file: Option<PathBuf>,
-    producer: &str,
-) -> Result<ModuleCodegenResult, String> {
+    kind: ModuleKind,
+    name: String,
+    global_asm_object: Option<PathBuf>,
+    producer_str: &str,
+) -> Result<CompiledModule, String> {
     let mut product = module.finish();
 
     if let Some(mut debug) = debug {
         debug.emit(&mut product);
     }
 
-    let module = emit_module(
-        output_filenames,
-        prof,
-        product.object,
-        ModuleKind::Regular,
-        name.clone(),
-        global_asm_object_file,
-        producer,
-    )?;
-
-    Ok(ModuleCodegenResult { module, existing_work_product: None })
-}
-
-fn emit_module(
-    output_filenames: &OutputFilenames,
-    prof: &SelfProfilerRef,
-    mut object: cranelift_object::object::write::Object<'_>,
-    kind: ModuleKind,
-    name: String,
-    global_asm_object: Option<PathBuf>,
-    producer_str: &str,
-) -> Result<CompiledModule, String> {
-    if object.format() == cranelift_object::object::BinaryFormat::Elf {
-        let comment_section = object.add_section(
+    if product.object.format() == cranelift_object::object::BinaryFormat::Elf {
+        let comment_section = product.object.add_section(
             Vec::new(),
             b".comment".to_vec(),
             cranelift_object::object::SectionKind::OtherString,
@@ -186,7 +105,7 @@ fn emit_module(
         let mut producer = vec![0];
         producer.extend(producer_str.as_bytes());
         producer.push(0);
-        object.set_section_data(comment_section, producer, 1);
+        product.object.set_section_data(comment_section, producer, 1);
     }
 
     let tmp_file = output_filenames.temp_path_for_cgu(OutputType::Object, &name);
@@ -196,7 +115,7 @@ fn emit_module(
     };
 
     let mut file = BufWriter::new(file);
-    if let Err(err) = object.write_stream(&mut file) {
+    if let Err(err) = product.object.write_stream(&mut file) {
         return Err(format!("error writing object file: {}", err));
     }
     let file = match file.into_inner() {
@@ -225,87 +144,22 @@ fn emit_module(
     })
 }
 
-fn reuse_workproduct_for_cgu(
-    tcx: TyCtxt<'_>,
-    cgu: &CodegenUnit<'_>,
-) -> Result<ModuleCodegenResult, String> {
-    let work_product = cgu.previous_work_product(tcx);
-    let obj_out_regular =
-        tcx.output_filenames(()).temp_path_for_cgu(OutputType::Object, cgu.name().as_str());
-    let source_file_regular = rustc_incremental::in_incr_comp_dir_sess(
-        tcx.sess,
-        work_product.saved_files.get("o").expect("no saved object file in work product"),
-    );
-
-    if let Err(err) = rustc_fs_util::link_or_copy(&source_file_regular, &obj_out_regular) {
-        return Err(format!(
-            "unable to copy {} to {}: {}",
-            source_file_regular.display(),
-            obj_out_regular.display(),
-            err
-        ));
-    }
-
-    let obj_out_global_asm =
-        tcx.output_filenames(()).temp_path_ext_for_cgu("asm.o", cgu.name().as_str());
-    let source_file_global_asm = if let Some(asm_o) = work_product.saved_files.get("asm.o") {
-        let source_file_global_asm = rustc_incremental::in_incr_comp_dir_sess(tcx.sess, asm_o);
-        if let Err(err) = rustc_fs_util::link_or_copy(&source_file_global_asm, &obj_out_global_asm)
-        {
-            return Err(format!(
-                "unable to copy {} to {}: {}",
-                source_file_global_asm.display(),
-                obj_out_global_asm.display(),
-                err
-            ));
-        }
-        Some(source_file_global_asm)
-    } else {
-        None
-    };
-
-    Ok(ModuleCodegenResult {
-        module: CompiledModule {
-            name: cgu.name().to_string(),
-            kind: ModuleKind::Regular,
-            object: Some(obj_out_regular),
-            global_asm_object: source_file_global_asm.as_ref().map(|_| obj_out_global_asm),
-            dwarf_object: None,
-            bytecode: None,
-            assembly: None,
-            llvm_ir: None,
-            links_from_incr_cache: if let Some(source_file_global_asm) = source_file_global_asm {
-                vec![source_file_regular, source_file_global_asm]
-            } else {
-                vec![source_file_regular]
-            },
-        },
-        existing_work_product: Some((cgu.work_product_id(), work_product)),
-    })
-}
-
-fn codegen_cgu_content(
-    tcx: TyCtxt<'_>,
-    module: &mut dyn Module,
-    cgu_name: rustc_span::Symbol,
-) -> (Option<DebugContext>, Vec<CodegenedFunction>, String) {
+fn codegen_cgu(tcx: TyCtxt<'_>, cgu_name: Symbol) -> AotModule {
     let _timer = tcx.prof.generic_activity_with_arg("codegen cgu", cgu_name.as_str());
 
     let cgu = tcx.codegen_unit(cgu_name);
     let mono_items = cgu.items_in_deterministic_order(tcx);
 
-    let mut debug_context = DebugContext::new(tcx, module.isa(), false, cgu_name.as_str());
-    let mut global_asm = String::new();
+    let mut module = make_module(tcx, cgu_name.as_str());
     let mut type_dbg = TypeDebugContext::default();
-    super::predefine_mono_items(tcx, module, &mono_items);
-    let mut codegened_functions = vec![];
+    super::predefine_mono_items(tcx, &mut module.module, &mono_items);
     for (mono_item, item_data) in mono_items {
         match mono_item {
             MonoItem::Fn(instance) => {
                 let flags = tcx.codegen_instance_attrs(instance.def).flags;
                 if flags.contains(CodegenFnAttrFlags::NAKED) {
                     rustc_codegen_ssa::mir::naked_asm::codegen_naked_asm(
-                        &mut GlobalAsmContext { tcx, global_asm: &mut global_asm },
+                        &mut GlobalAsmContext { tcx, global_asm: &mut module.global_asm },
                         instance,
                         MonoItemData {
                             linkage: RLinkage::External,
@@ -321,186 +175,219 @@ fn codegen_cgu_content(
                 }
                 let codegened_function = crate::base::codegen_fn(
                     tcx,
-                    cgu_name,
-                    debug_context.as_mut(),
+                    cgu.name(),
+                    module.debug_context.as_mut(),
                     &mut type_dbg,
                     Function::new(),
-                    module,
+                    &mut module.module,
                     instance,
                 );
-                codegened_functions.push(codegened_function);
+                module.codegened_functions.push(codegened_function);
             }
             MonoItem::Static(def_id) => {
-                let data_id = crate::constant::codegen_static(tcx, module, def_id);
-                if let Some(debug_context) = debug_context.as_mut() {
+                let data_id = crate::constant::codegen_static(tcx, &mut module.module, def_id);
+                if let Some(debug_context) = module.debug_context.as_mut() {
                     debug_context.define_static(tcx, &mut type_dbg, def_id, data_id);
                 }
             }
             MonoItem::GlobalAsm(item_id) => {
                 rustc_codegen_ssa::base::codegen_global_asm(
-                    &mut GlobalAsmContext { tcx, global_asm: &mut global_asm },
+                    &mut GlobalAsmContext { tcx, global_asm: &mut module.global_asm },
                     item_id,
                 );
             }
         }
     }
-    crate::main_shim::maybe_create_entry_wrapper(tcx, module, false, cgu.is_primary());
+    crate::main_shim::maybe_create_entry_wrapper(tcx, &mut module.module, false, cgu.is_primary());
 
-    (debug_context, codegened_functions, global_asm)
+    module
 }
 
-fn module_codegen(
-    tcx: TyCtxt<'_>,
-    global_asm_config: Arc<GlobalAsmConfig>,
-    cgu_name: rustc_span::Symbol,
-    token: ConcurrencyLimiterToken,
-) -> OngoingModuleCodegen {
-    let mut module = make_module(tcx.sess, cgu_name.as_str().to_string());
+fn compile_cgu(
+    prof: &SelfProfilerRef,
+    output_filenames: &OutputFilenames,
+    should_write_ir: bool,
+    mut aot_module: AotModule,
+    cgu_name: String,
+    kind: ModuleKind,
+) -> Result<CompiledModule, String> {
+    prof.generic_activity_with_arg("compile functions", &*cgu_name).run(|| {
+        cranelift_codegen::timing::set_thread_profiler(Box::new(super::MeasuremeProfiler(
+            prof.clone(),
+        )));
 
-    let (mut debug_context, codegened_functions, mut global_asm) =
-        codegen_cgu_content(tcx, &mut module, cgu_name);
+        let mut cached_context = Context::new();
+        for codegened_func in aot_module.codegened_functions {
+            crate::base::compile_fn(
+                &prof,
+                &output_filenames,
+                should_write_ir,
+                &mut cached_context,
+                &mut aot_module.module,
+                aot_module.debug_context.as_mut(),
+                &mut aot_module.global_asm,
+                codegened_func,
+            );
+        }
+    });
 
-    let cgu_name = cgu_name.as_str().to_owned();
-
-    let producer = crate::debuginfo::producer(tcx.sess);
-
-    let profiler = tcx.prof.clone();
-    let output_filenames = tcx.output_filenames(()).clone();
-    let should_write_ir = crate::pretty_clif::should_write_ir(tcx.sess);
-
-    OngoingModuleCodegen::Async(std::thread::spawn(move || {
-        profiler.clone().generic_activity_with_arg("compile functions", &*cgu_name).run(|| {
-            cranelift_codegen::timing::set_thread_profiler(Box::new(super::MeasuremeProfiler(
-                profiler.clone(),
-            )));
-
-            let mut cached_context = Context::new();
-            for codegened_func in codegened_functions {
-                crate::base::compile_fn(
-                    &profiler,
-                    &output_filenames,
-                    should_write_ir,
-                    &mut cached_context,
-                    &mut module,
-                    debug_context.as_mut(),
-                    &mut global_asm,
-                    codegened_func,
-                );
+    let global_asm_object_file =
+        prof.generic_activity_with_arg("compile assembly", &*cgu_name).run(|| {
+            if aot_module.global_asm.is_empty() {
+                return Ok::<_, String>(None);
             }
-        });
 
-        let global_asm_object_file =
-            profiler.generic_activity_with_arg("compile assembly", &*cgu_name).run(|| {
-                crate::global_asm::compile_global_asm(&global_asm_config, &cgu_name, global_asm)
-            })?;
+            let global_asm_object_file = output_filenames.temp_path_ext_for_cgu("asm.o", &cgu_name);
+            crate::global_asm::compile_global_asm(
+                &aot_module.global_asm_config,
+                aot_module.global_asm,
+                &global_asm_object_file,
+            )?;
 
-        let codegen_result =
-            profiler.generic_activity_with_arg("write object file", &*cgu_name).run(|| {
-                emit_cgu(
-                    &global_asm_config.output_filenames,
-                    &profiler,
-                    cgu_name,
-                    module,
-                    debug_context,
-                    global_asm_object_file,
-                    &producer,
-                )
-            });
-        std::mem::drop(token);
-        codegen_result
-    }))
-}
+            Ok(Some(global_asm_object_file))
+        })?;
 
-fn emit_allocator_module(tcx: TyCtxt<'_>) -> Option<CompiledModule> {
-    let mut allocator_module = make_module(tcx.sess, "allocator_shim".to_string());
-    let created_alloc_shim = crate::allocator::codegen(tcx, &mut allocator_module);
-
-    if created_alloc_shim {
-        let product = allocator_module.finish();
-
-        match emit_module(
-            tcx.output_filenames(()),
-            &tcx.sess.prof,
-            product.object,
-            ModuleKind::Allocator,
-            "allocator_shim".to_owned(),
-            None,
-            &crate::debuginfo::producer(tcx.sess),
-        ) {
-            Ok(allocator_module) => Some(allocator_module),
-            Err(err) => tcx.dcx().fatal(err),
-        }
-    } else {
-        None
-    }
-}
-
-pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box<OngoingCodegen> {
-    let cgus = tcx.collect_and_partition_mono_items(()).codegen_units;
-
-    if tcx.dep_graph.is_fully_enabled() {
-        for cgu in cgus {
-            tcx.ensure_ok().codegen_unit(cgu.name());
-        }
-    }
-
-    // Calculate the CGU reuse
-    let cgu_reuse = tcx.sess.time("find_cgu_reuse", || {
-        cgus.iter().map(|cgu| determine_cgu_reuse(tcx, cgu)).collect::<Vec<_>>()
-    });
-
-    rustc_codegen_ssa::assert_module_sources::assert_module_sources(tcx, &|cgu_reuse_tracker| {
-        for (i, cgu) in cgus.iter().enumerate() {
-            let cgu_reuse = cgu_reuse[i];
-            cgu_reuse_tracker.set_actual_reuse(cgu.name().as_str(), cgu_reuse);
-        }
-    });
-
-    let global_asm_config = Arc::new(crate::global_asm::GlobalAsmConfig::new(tcx));
-
-    let disable_incr_cache = disable_incr_cache();
-    let (todo_cgus, done_cgus) =
-        cgus.iter().enumerate().partition::<Vec<_>, _>(|&(i, _)| match cgu_reuse[i] {
-            _ if disable_incr_cache => true,
-            CguReuse::No => true,
-            CguReuse::PreLto | CguReuse::PostLto => false,
-        });
-
-    let concurrency_limiter = IntoDynSyncSend(ConcurrencyLimiter::new(todo_cgus.len()));
-
-    let modules: Vec<_> =
-        tcx.sess.time("codegen mono items", || {
-            let modules: Vec<_> = par_map(todo_cgus, |(_, cgu)| {
-                let dep_node = cgu.codegen_dep_node(tcx);
-                let (module, _) = tcx.dep_graph.with_task(
-                    dep_node,
-                    tcx,
-                    || {
-                        module_codegen(
-                            tcx,
-                            global_asm_config.clone(),
-                            cgu.name(),
-                            concurrency_limiter.acquire(tcx.dcx()),
-                        )
-                    },
-                    Some(rustc_middle::dep_graph::hash_result),
-                );
-                IntoDynSyncSend(module)
-            });
-            modules
-                .into_iter()
-                .map(|module| module.0)
-                .chain(done_cgus.into_iter().map(|(_, cgu)| {
-                    OngoingModuleCodegen::Sync(reuse_workproduct_for_cgu(tcx, cgu))
-                }))
-                .collect()
-        });
-
-    let allocator_module = emit_allocator_module(tcx);
-
-    Box::new(OngoingCodegen {
-        modules,
-        allocator_module,
-        concurrency_limiter: concurrency_limiter.0,
+    prof.generic_activity_with_arg("write object file", &*cgu_name).run(|| {
+        emit_module(
+            output_filenames,
+            prof,
+            aot_module.module,
+            aot_module.debug_context,
+            kind,
+            cgu_name.clone(),
+            global_asm_object_file,
+            &aot_module.producer,
+        )
     })
 }
+
+#[derive(Copy, Clone)]
+pub(crate) struct AotDriver;
+
+impl ExtraBackendMethods for AotDriver {
+    type Module = AotModule;
+
+    fn codegen_allocator<'tcx>(
+        &self,
+        tcx: TyCtxt<'tcx>,
+        module_name: &str,
+        methods: &[AllocatorMethod],
+    ) -> Self::Module {
+        let mut allocator_module = make_module(tcx, module_name);
+        crate::allocator::codegen(tcx, &mut allocator_module.module, methods);
+        allocator_module
+    }
+
+    fn compile_codegen_unit(
+        &self,
+        tcx: TyCtxt<'_>,
+        cgu_name: Symbol,
+    ) -> (ModuleCodegen<Self::Module>, u64) {
+        let start_time = Instant::now();
+
+        let dep_node = tcx.codegen_unit(cgu_name).codegen_dep_node(tcx);
+        let (module, _) = tcx.dep_graph.with_task(
+            dep_node,
+            tcx,
+            || {
+                let aot_module = codegen_cgu(tcx, cgu_name);
+                ModuleCodegen::new_regular(cgu_name.as_str().to_owned(), aot_module)
+            },
+            Some(rustc_middle::dep_graph::hash_result),
+        );
+
+        let time_to_codegen = start_time.elapsed();
+
+        // We assume that the cost to run LLVM on a CGU is proportional to
+        // the time we needed for codegenning it.
+        let cost = time_to_codegen.as_nanos() as u64;
+
+        (module, cost)
+    }
+}
+
+impl WriteBackendMethods for AotDriver {
+    type Module = AotModule;
+
+    type TargetMachine = ();
+
+    type ModuleBuffer = Infallible;
+
+    type ThinData = Infallible;
+
+    fn target_machine_factory(
+        &self,
+        _sess: &Session,
+        _opt_level: OptLevel,
+        _target_features: &[String],
+    ) -> TargetMachineFactoryFn<Self> {
+        Arc::new(|_, _| ())
+    }
+
+    fn optimize_and_codegen_fat_lto(
+        _sess: &Session,
+        _cgcx: &CodegenContext,
+        _shared_emitter: &SharedEmitter,
+        _tm_factory: TargetMachineFactoryFn<Self>,
+        _exported_symbols_for_lto: &[String],
+        _each_linked_rlib_for_lto: &[PathBuf],
+        _modules: Vec<FatLtoInput<Self>>,
+    ) -> CompiledModule {
+        unreachable!()
+    }
+
+    fn run_thin_lto(
+        _cgcx: &CodegenContext,
+        _prof: &SelfProfilerRef,
+        _dcx: rustc_errors::DiagCtxtHandle<'_>,
+        _exported_symbols_for_lto: &[String],
+        _each_linked_rlib_for_lto: &[PathBuf],
+        _modules: Vec<ThinLtoInput<Self>>,
+    ) -> (Vec<ThinModule<Self>>, Vec<WorkProduct>) {
+        unreachable!()
+    }
+
+    fn optimize(
+        _cgcx: &CodegenContext,
+        _prof: &SelfProfilerRef,
+        _shared_emitter: &SharedEmitter,
+        _module: &mut ModuleCodegen<Self::Module>,
+        _config: &ModuleConfig,
+    ) {
+    }
+
+    fn optimize_and_codegen_thin(
+        _cgcx: &CodegenContext,
+        _prof: &SelfProfilerRef,
+        _shared_emitter: &SharedEmitter,
+        _tm_factory: TargetMachineFactoryFn<Self>,
+        _thin: ThinModule<Self>,
+    ) -> CompiledModule {
+        unreachable!()
+    }
+
+    fn codegen(
+        cgcx: &CodegenContext,
+        prof: &SelfProfilerRef,
+        shared_emitter: &SharedEmitter,
+        module: ModuleCodegen<Self::Module>,
+        config: &ModuleConfig,
+    ) -> CompiledModule {
+        compile_cgu(
+            prof,
+            &cgcx.output_filenames,
+            config.emit_ir,
+            module.module_llvm,
+            module.name,
+            module.kind,
+        )
+        .unwrap_or_else(|err| {
+            let dcx = DiagCtxt::new(Box::new(shared_emitter.clone()));
+            dcx.handle().fatal(err)
+        })
+    }
+
+    fn serialize_module(_module: Self::Module, _is_thin: bool) -> Self::ModuleBuffer {
+        unreachable!()
+    }
+}
diff --git a/compiler/rustc_codegen_cranelift/src/driver/jit.rs b/compiler/rustc_codegen_cranelift/src/driver/jit.rs
index 33b88d7..7d6ece0 100644
--- a/compiler/rustc_codegen_cranelift/src/driver/jit.rs
+++ b/compiler/rustc_codegen_cranelift/src/driver/jit.rs
@@ -6,6 +6,7 @@
 
 use cranelift_jit::{JITBuilder, JITModule};
 use rustc_codegen_ssa::CrateInfo;
+use rustc_codegen_ssa::base::{allocator_kind_for_codegen, allocator_shim_contents};
 use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
 use rustc_middle::mono::MonoItem;
 use rustc_session::Session;
@@ -28,7 +29,9 @@ fn create_jit_module(
 
     let cx = DebugContext::new(tcx, jit_module.isa(), false, "dummy_cgu_name");
 
-    crate::allocator::codegen(tcx, &mut jit_module);
+    if let Some(kind) = allocator_kind_for_codegen(tcx) {
+        crate::allocator::codegen(tcx, &mut jit_module, &allocator_shim_contents(tcx, kind));
+    }
 
     (jit_module, cx)
 }
diff --git a/compiler/rustc_codegen_cranelift/src/global_asm.rs b/compiler/rustc_codegen_cranelift/src/global_asm.rs
index ee7e673..769c008 100644
--- a/compiler/rustc_codegen_cranelift/src/global_asm.rs
+++ b/compiler/rustc_codegen_cranelift/src/global_asm.rs
@@ -2,9 +2,8 @@
 //! standalone executable.
 
 use std::io::Write;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
-use std::sync::Arc;
 
 use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
 use rustc_codegen_ssa::traits::{AsmCodegenMethods, GlobalAsmOperandRef};
@@ -12,7 +11,7 @@
 use rustc_middle::ty::layout::{
     FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasTyCtxt, HasTypingEnv, LayoutError, LayoutOfHelpers,
 };
-use rustc_session::config::OutputFilenames;
+use rustc_session::Session;
 use rustc_target::asm::InlineAsmArch;
 
 use crate::prelude::*;
@@ -163,32 +162,28 @@ fn codegen_global_asm_inner<'tcx>(
 pub(crate) struct GlobalAsmConfig {
     assembler: PathBuf,
     target: String,
-    pub(crate) output_filenames: Arc<OutputFilenames>,
 }
 
 impl GlobalAsmConfig {
-    pub(crate) fn new(tcx: TyCtxt<'_>) -> Self {
+    pub(crate) fn new(sess: &Session) -> Self {
         GlobalAsmConfig {
-            assembler: crate::toolchain::get_toolchain_binary(tcx.sess, "as"),
-            target: match &tcx.sess.opts.target_triple {
+            assembler: crate::toolchain::get_toolchain_binary(sess, "as"),
+            target: match &sess.opts.target_triple {
                 rustc_target::spec::TargetTuple::TargetTuple(triple) => triple.clone(),
                 rustc_target::spec::TargetTuple::TargetJson { path_for_rustdoc, .. } => {
                     path_for_rustdoc.to_str().unwrap().to_owned()
                 }
             },
-            output_filenames: tcx.output_filenames(()).clone(),
         }
     }
 }
 
 pub(crate) fn compile_global_asm(
     config: &GlobalAsmConfig,
-    cgu_name: &str,
     global_asm: String,
-) -> Result<Option<PathBuf>, String> {
-    if global_asm.is_empty() {
-        return Ok(None);
-    }
+    global_asm_object_file: &Path,
+) -> Result<(), String> {
+    assert!(!global_asm.is_empty());
 
     // Remove all LLVM style comments
     let mut global_asm = global_asm
@@ -198,8 +193,6 @@ pub(crate) fn compile_global_asm(
         .join("\n");
     global_asm.push('\n');
 
-    let global_asm_object_file = config.output_filenames.temp_path_ext_for_cgu("asm.o", cgu_name);
-
     // Assemble `global_asm`
     if option_env!("CG_CLIF_FORCE_GNU_AS").is_some() {
         let mut child = Command::new(&config.assembler)
@@ -266,5 +259,5 @@ pub(crate) fn compile_global_asm(
         }
     }
 
-    Ok(Some(global_asm_object_file))
+    Ok(())
 }
diff --git a/compiler/rustc_codegen_cranelift/src/inline_asm.rs b/compiler/rustc_codegen_cranelift/src/inline_asm.rs
index 8100d56..f9fc700 100644
--- a/compiler/rustc_codegen_cranelift/src/inline_asm.rs
+++ b/compiler/rustc_codegen_cranelift/src/inline_asm.rs
@@ -424,13 +424,10 @@ fn allocate_stack_slots(&mut self) {
 
         // Allocate stack slots for inout
         for (i, operand) in self.operands.iter().enumerate() {
-            match *operand {
-                CInlineAsmOperand::InOut { reg, out_place: Some(_), .. } => {
-                    let slot = new_slot(reg.reg_class());
-                    slots_input[i] = Some(slot);
-                    slots_output[i] = Some(slot);
-                }
-                _ => (),
+            if let CInlineAsmOperand::InOut { reg, out_place: Some(_), .. } = *operand {
+                let slot = new_slot(reg.reg_class());
+                slots_input[i] = Some(slot);
+                slots_output[i] = Some(slot);
             }
         }
 
@@ -456,11 +453,8 @@ fn allocate_stack_slots(&mut self) {
 
         // Allocate stack slots for output
         for (i, operand) in self.operands.iter().enumerate() {
-            match *operand {
-                CInlineAsmOperand::Out { reg, place: Some(_), .. } => {
-                    slots_output[i] = Some(new_slot(reg.reg_class()));
-                }
-                _ => (),
+            if let CInlineAsmOperand::Out { reg, place: Some(_), .. } = *operand {
+                slots_output[i] = Some(new_slot(reg.reg_class()));
             }
         }
 
diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs
index 3cd7ebb..9da87a5 100644
--- a/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs
+++ b/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs
@@ -494,6 +494,385 @@ pub(super) fn codegen_aarch64_llvm_intrinsic_call<'tcx>(
             });
         }
         */
+        "llvm.aarch64.crc32b"
+        | "llvm.aarch64.crc32h"
+        | "llvm.aarch64.crc32w"
+        | "llvm.aarch64.crc32x"
+        | "llvm.aarch64.crc32cb"
+        | "llvm.aarch64.crc32ch"
+        | "llvm.aarch64.crc32cw"
+        | "llvm.aarch64.crc32cx" => {
+            // ARM ARM v8-A: CRC32{,C}{B,H,W,X}.
+            // Backs core::arch::aarch64::__crc32{,c}{b,h,w,d}.
+            intrinsic_args!(fx, args => (crc, v); intrinsic);
+
+            let crc = crc.load_scalar(fx);
+            let v = v.load_scalar(fx);
+
+            let asm = match intrinsic {
+                "llvm.aarch64.crc32b" => "crc32b  w0, w0, w1",
+                "llvm.aarch64.crc32h" => "crc32h  w0, w0, w1",
+                "llvm.aarch64.crc32w" => "crc32w  w0, w0, w1",
+                "llvm.aarch64.crc32x" => "crc32x  w0, w0, x1",
+                "llvm.aarch64.crc32cb" => "crc32cb w0, w0, w1",
+                "llvm.aarch64.crc32ch" => "crc32ch w0, w0, w1",
+                "llvm.aarch64.crc32cw" => "crc32cw w0, w0, w1",
+                "llvm.aarch64.crc32cx" => "crc32cx w0, w0, x1",
+                _ => unreachable!(),
+            };
+
+            codegen_inline_asm_inner(
+                fx,
+                &[InlineAsmTemplatePiece::String(asm.into())],
+                &[
+                    CInlineAsmOperand::InOut {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::x0,
+                        )),
+                        _late: true,
+                        in_value: crc,
+                        out_place: Some(ret),
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::x1,
+                        )),
+                        value: v,
+                    },
+                ],
+                InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
+            );
+        }
+
+        "llvm.aarch64.crypto.aese" | "llvm.aarch64.crypto.aesd" => {
+            intrinsic_args!(fx, args => (a, b); intrinsic);
+
+            let a = a.load_scalar(fx);
+            let b = b.load_scalar(fx);
+
+            let asm = match intrinsic {
+                "llvm.aarch64.crypto.aese" => "aese v0.16b, v1.16b",
+                "llvm.aarch64.crypto.aesd" => "aesd v0.16b, v1.16b",
+                _ => unreachable!(),
+            };
+
+            codegen_inline_asm_inner(
+                fx,
+                &[InlineAsmTemplatePiece::String(asm.into())],
+                &[
+                    CInlineAsmOperand::InOut {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v0,
+                        )),
+                        _late: true,
+                        in_value: a,
+                        out_place: Some(ret),
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v1,
+                        )),
+                        value: b,
+                    },
+                ],
+                InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
+            );
+        }
+
+        "llvm.aarch64.crypto.aesmc" | "llvm.aarch64.crypto.aesimc" => {
+            intrinsic_args!(fx, args => (a); intrinsic);
+
+            let a = a.load_scalar(fx);
+
+            let asm = match intrinsic {
+                "llvm.aarch64.crypto.aesmc" => "aesmc v0.16b, v0.16b",
+                "llvm.aarch64.crypto.aesimc" => "aesimc v0.16b, v0.16b",
+                _ => unreachable!(),
+            };
+
+            codegen_inline_asm_inner(
+                fx,
+                &[InlineAsmTemplatePiece::String(asm.into())],
+                &[CInlineAsmOperand::InOut {
+                    reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                        AArch64InlineAsmReg::v0,
+                    )),
+                    _late: true,
+                    in_value: a,
+                    out_place: Some(ret),
+                }],
+                InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
+            );
+        }
+
+        "llvm.aarch64.crypto.sha256h" | "llvm.aarch64.crypto.sha256h2" => {
+            intrinsic_args!(fx, args => (a, b, c); intrinsic);
+
+            let a = a.load_scalar(fx);
+            let b = b.load_scalar(fx);
+            let c = c.load_scalar(fx);
+
+            let asm = match intrinsic {
+                "llvm.aarch64.crypto.sha256h" => "sha256h q0, q1, v2.4s",
+                "llvm.aarch64.crypto.sha256h2" => "sha256h2 q0, q1, v2.4s",
+                _ => unreachable!(),
+            };
+
+            codegen_inline_asm_inner(
+                fx,
+                &[InlineAsmTemplatePiece::String(asm.into())],
+                &[
+                    CInlineAsmOperand::InOut {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v0,
+                        )),
+                        _late: true,
+                        in_value: a,
+                        out_place: Some(ret),
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v1,
+                        )),
+                        value: b,
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v2,
+                        )),
+                        value: c,
+                    },
+                ],
+                InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
+            );
+        }
+
+        "llvm.aarch64.crypto.sha256su0" => {
+            intrinsic_args!(fx, args => (a, b); intrinsic);
+
+            let a = a.load_scalar(fx);
+            let b = b.load_scalar(fx);
+
+            codegen_inline_asm_inner(
+                fx,
+                &[InlineAsmTemplatePiece::String("sha256su0 v0.4s, v1.4s".into())],
+                &[
+                    CInlineAsmOperand::InOut {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v0,
+                        )),
+                        _late: true,
+                        in_value: a,
+                        out_place: Some(ret),
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v1,
+                        )),
+                        value: b,
+                    },
+                ],
+                InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
+            );
+        }
+
+        "llvm.aarch64.crypto.sha256su1" => {
+            intrinsic_args!(fx, args => (a, b, c); intrinsic);
+
+            let a = a.load_scalar(fx);
+            let b = b.load_scalar(fx);
+            let c = c.load_scalar(fx);
+
+            codegen_inline_asm_inner(
+                fx,
+                &[InlineAsmTemplatePiece::String("sha256su1 v0.4s, v1.4s, v2.4s".into())],
+                &[
+                    CInlineAsmOperand::InOut {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v0,
+                        )),
+                        _late: true,
+                        in_value: a,
+                        out_place: Some(ret),
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v1,
+                        )),
+                        value: b,
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v2,
+                        )),
+                        value: c,
+                    },
+                ],
+                InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
+            );
+        }
+
+        "llvm.aarch64.neon.pmull64" => {
+            intrinsic_args!(fx, args => (a, b); intrinsic);
+
+            let a = a.load_scalar(fx);
+            let b = b.load_scalar(fx);
+
+            codegen_inline_asm_inner(
+                fx,
+                &[InlineAsmTemplatePiece::String(
+                    "fmov    d0, x0
+                     fmov    d1, x1
+                     pmull   v0.1q, v0.1d, v1.1d"
+                        .into(),
+                )],
+                &[
+                    CInlineAsmOperand::Out {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v0,
+                        )),
+                        late: true,
+                        place: Some(ret),
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::x0,
+                        )),
+                        value: a,
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::x1,
+                        )),
+                        value: b,
+                    },
+                    CInlineAsmOperand::Out {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v1,
+                        )),
+                        late: true,
+                        place: None,
+                    },
+                ],
+                InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
+            );
+        }
+
+        "llvm.aarch64.neon.pmull.v8i16" => {
+            intrinsic_args!(fx, args => (a, b); intrinsic);
+
+            let a = a.load_scalar(fx);
+            let b = b.load_scalar(fx);
+
+            codegen_inline_asm_inner(
+                fx,
+                &[InlineAsmTemplatePiece::String("pmull v0.8h, v0.8b, v1.8b".into())],
+                &[
+                    CInlineAsmOperand::InOut {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v0,
+                        )),
+                        _late: true,
+                        in_value: a,
+                        out_place: Some(ret),
+                    },
+                    CInlineAsmOperand::In {
+                        reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::AArch64(
+                            AArch64InlineAsmReg::v1,
+                        )),
+                        value: b,
+                    },
+                ],
+                InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM,
+            );
+        }
+
+        "llvm.aarch64.neon.sqdmulh.v2i32"
+        | "llvm.aarch64.neon.sqdmulh.v4i16"
+        | "llvm.aarch64.neon.sqdmulh.v4i32"
+        | "llvm.aarch64.neon.sqdmulh.v8i16" => {
+            // https://developer.arm.com/documentation/ddi0602/2026-03/SIMD-FP-Instructions/SQDMULH--vector---Signed-saturating-doubling-multiply-returning-high-half-
+            intrinsic_args!(fx, args => (a, b); intrinsic);
+
+            // Simplify the "double and shift by esize" into "shift by esize - 1".
+            // https://github.com/qemu/qemu/blob/81cc5f39aa3042e9c0b2ea772b42a2c8b1488e76/target/arm/tcg/mve_helper.c#L1267-L1283
+            let (result_ty, product_ty, shift, max) = match intrinsic {
+                "llvm.aarch64.neon.sqdmulh.v4i16" | "llvm.aarch64.neon.sqdmulh.v8i16" => {
+                    (types::I16, types::I32, 15, i64::from(i16::MAX))
+                }
+                "llvm.aarch64.neon.sqdmulh.v2i32" | "llvm.aarch64.neon.sqdmulh.v4i32" => {
+                    (types::I32, types::I64, 31, i64::from(i32::MAX))
+                }
+                _ => unreachable!(),
+            };
+
+            simd_pair_for_each_lane(
+                fx,
+                a,
+                b,
+                ret,
+                &|fx, _lane_ty, _res_lane_ty, a_lane, b_lane| {
+                    let a_lane = fx.bcx.ins().sextend(product_ty, a_lane);
+                    let b_lane = fx.bcx.ins().sextend(product_ty, b_lane);
+                    let product = fx.bcx.ins().imul(a_lane, b_lane);
+                    let product = fx.bcx.ins().sshr_imm(product, shift);
+                    let max = fx.bcx.ins().iconst(product_ty, max);
+                    let result = fx.bcx.ins().smin(product, max);
+                    fx.bcx.ins().ireduce(result_ty, result)
+                },
+            );
+        }
+
+        "llvm.aarch64.neon.saddlp.v1i64.v2i32"
+        | "llvm.aarch64.neon.saddlp.v2i32.v4i16"
+        | "llvm.aarch64.neon.saddlp.v2i64.v4i32"
+        | "llvm.aarch64.neon.saddlp.v4i16.v8i8"
+        | "llvm.aarch64.neon.saddlp.v4i32.v8i16"
+        | "llvm.aarch64.neon.saddlp.v8i16.v16i8" => {
+            // https://developer.arm.com/documentation/ddi0602/2026-03/SIMD-FP-Instructions/SADDLP--Signed-add-long-pairwise-
+            intrinsic_args!(fx, args => (a); intrinsic);
+
+            let (ret_lane_count, ret_lane_ty) = ret.layout().ty.simd_size_and_type(fx.tcx);
+            let ret_lane_layout = fx.layout_of(ret_lane_ty);
+            let wide_ty = fx.clif_type(ret_lane_ty).unwrap();
+
+            for lane_idx in 0..ret_lane_count {
+                let base = lane_idx * 2;
+                let a_lane0 = a.value_lane(fx, base).load_scalar(fx);
+                let a_lane1 = a.value_lane(fx, base + 1).load_scalar(fx);
+                let a_lane0 = fx.bcx.ins().sextend(wide_ty, a_lane0);
+                let a_lane1 = fx.bcx.ins().sextend(wide_ty, a_lane1);
+                let sum = fx.bcx.ins().iadd(a_lane0, a_lane1);
+                let res_lane = CValue::by_val(sum, ret_lane_layout);
+                ret.place_lane(fx, lane_idx).write_cvalue(fx, res_lane);
+            }
+        }
+
+        "llvm.aarch64.neon.uaddlp.v1i64.v2i32"
+        | "llvm.aarch64.neon.uaddlp.v2i32.v4i16"
+        | "llvm.aarch64.neon.uaddlp.v2i64.v4i32"
+        | "llvm.aarch64.neon.uaddlp.v4i16.v8i8"
+        | "llvm.aarch64.neon.uaddlp.v4i32.v8i16"
+        | "llvm.aarch64.neon.uaddlp.v8i16.v16i8" => {
+            // https://developer.arm.com/documentation/ddi0602/2026-03/SIMD-FP-Instructions/UADDLP--Unsigned-add-long-pairwise-
+            intrinsic_args!(fx, args => (a); intrinsic);
+
+            let (ret_lane_count, ret_lane_ty) = ret.layout().ty.simd_size_and_type(fx.tcx);
+            let ret_lane_layout = fx.layout_of(ret_lane_ty);
+            let wide_ty = fx.clif_type(ret_lane_ty).unwrap();
+
+            for lane_idx in 0..ret_lane_count {
+                let base = lane_idx * 2;
+                let a_lane0 = a.value_lane(fx, base).load_scalar(fx);
+                let a_lane1 = a.value_lane(fx, base + 1).load_scalar(fx);
+                let a_lane0 = fx.bcx.ins().uextend(wide_ty, a_lane0);
+                let a_lane1 = fx.bcx.ins().uextend(wide_ty, a_lane1);
+                let sum = fx.bcx.ins().iadd(a_lane0, a_lane1);
+                let res_lane = CValue::by_val(sum, ret_lane_layout);
+                ret.place_lane(fx, lane_idx).write_cvalue(fx, res_lane);
+            }
+        }
+
         _ => {
             fx.tcx.dcx().warn(format!(
                 "unsupported AArch64 llvm intrinsic {}; replacing with trap",
diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs
index b8e1886..5d7e457 100644
--- a/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs
+++ b/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs
@@ -371,7 +371,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
             }
 
             for i in 0..lane_count {
-                let ret_lane = ret.place_lane(fx, i.into());
+                let ret_lane = ret.place_lane(fx, i);
                 ret_lane.write_cvalue(fx, value);
             }
         }
diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs
index 48858e2..af783f3 100644
--- a/compiler/rustc_codegen_cranelift/src/lib.rs
+++ b/compiler/rustc_codegen_cranelift/src/lib.rs
@@ -18,9 +18,7 @@
 extern crate rustc_const_eval;
 extern crate rustc_data_structures;
 extern crate rustc_errors;
-extern crate rustc_fs_util;
 extern crate rustc_hir;
-extern crate rustc_incremental;
 extern crate rustc_index;
 extern crate rustc_log;
 extern crate rustc_session;
@@ -40,9 +38,9 @@
 use cranelift_codegen::isa::TargetIsa;
 use cranelift_codegen::settings::{self, Configurable};
 use rustc_codegen_ssa::traits::CodegenBackend;
-use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig};
+use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig, back};
 use rustc_log::tracing::info;
-use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::WorkProductMap;
 use rustc_session::Session;
 use rustc_session::config::OutputFilenames;
 use rustc_span::{Symbol, sym};
@@ -60,7 +58,6 @@
 mod codegen_i128;
 mod common;
 mod compiler_builtins;
-mod concurrency_limiter;
 mod config;
 mod constant;
 mod debuginfo;
@@ -91,7 +88,7 @@ mod prelude {
     };
     pub(crate) use cranelift_module::{self, DataDescription, FuncId, Linkage, Module};
     pub(crate) use rustc_abi::{BackendRepr, FIRST_VARIANT, FieldIdx, Scalar, Size, VariantIdx};
-    pub(crate) use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
+    pub(crate) use rustc_data_structures::fx::FxHashMap;
     pub(crate) use rustc_hir::def_id::{DefId, LOCAL_CRATE};
     pub(crate) use rustc_index::Idx;
     pub(crate) use rustc_middle::mir::{self, *};
@@ -133,7 +130,7 @@ fn init(&self, sess: &Session) {
         match sess.lto() {
             Lto::No | Lto::ThinLocal => {}
             Lto::Thin | Lto::Fat => {
-                sess.dcx().warn("LTO is not supported. You may get a linker error.")
+                sess.dcx().fatal("LTO is not supported by rustc_codegen_cranelift");
             }
         }
 
@@ -152,6 +149,10 @@ fn init(&self, sess: &Session) {
         }
     }
 
+    fn thin_lto_supported(&self) -> bool {
+        false
+    }
+
     fn target_config(&self, sess: &Session) -> TargetConfig {
         // FIXME return the actually used target features. this is necessary for #[cfg(target_feature)]
         let target_features = match sess.target.arch {
@@ -224,7 +225,7 @@ fn codegen_crate(&self, tcx: TyCtxt<'_>) -> Box<dyn Any> {
             #[cfg(not(feature = "jit"))]
             tcx.dcx().fatal("jit support was disabled when compiling rustc_codegen_cranelift");
         } else {
-            driver::aot::run_aot(tcx)
+            Box::new(rustc_codegen_ssa::base::codegen_crate(driver::aot::AotDriver, tcx))
         }
     }
 
@@ -232,10 +233,13 @@ fn join_codegen(
         &self,
         ongoing_codegen: Box<dyn Any>,
         sess: &Session,
-        outputs: &OutputFilenames,
-        _crate_info: &CrateInfo,
-    ) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
-        ongoing_codegen.downcast::<driver::aot::OngoingCodegen>().unwrap().join(sess, outputs)
+        _outputs: &OutputFilenames,
+        crate_info: &CrateInfo,
+    ) -> (CompiledModules, WorkProductMap) {
+        ongoing_codegen
+            .downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<driver::aot::AotDriver>>()
+            .unwrap()
+            .join(sess, crate_info)
     }
 
     fn fallback_intrinsics(&self) -> Vec<Symbol> {
@@ -254,7 +258,9 @@ fn enable_verifier(sess: &Session) -> bool {
 }
 
 fn target_triple(sess: &Session) -> target_lexicon::Triple {
-    match sess.target.llvm_target.parse() {
+    // Use versioned target triple to make `OperatingSystem::MacOSX(...)`
+    // contain a value, which we use when emitting `LC_BUILD_VERSION`.
+    match back::versioned_llvm_target(sess).parse() {
         Ok(triple) => triple,
         Err(err) => sess.dcx().fatal(format!("target not recognized: {}", err)),
     }
diff --git a/compiler/rustc_codegen_cranelift/src/value_and_place.rs b/compiler/rustc_codegen_cranelift/src/value_and_place.rs
index 1d9dcda..a2a2cac 100644
--- a/compiler/rustc_codegen_cranelift/src/value_and_place.rs
+++ b/compiler/rustc_codegen_cranelift/src/value_and_place.rs
@@ -686,17 +686,14 @@ pub(crate) fn place_field(
     ) -> CPlace<'tcx> {
         let layout = self.layout();
 
-        match self.inner {
-            CPlaceInner::VarPair(local, var1, var2) => {
-                let layout = layout.field(&*fx, field.index());
+        if let CPlaceInner::VarPair(local, var1, var2) = self.inner {
+            let layout = layout.field(&*fx, field.index());
 
-                match field.as_u32() {
-                    0 => return CPlace { inner: CPlaceInner::Var(local, var1), layout },
-                    1 => return CPlace { inner: CPlaceInner::Var(local, var2), layout },
-                    _ => unreachable!("field should be 0 or 1"),
-                }
+            match field.as_u32() {
+                0 => return CPlace { inner: CPlaceInner::Var(local, var1), layout },
+                1 => return CPlace { inner: CPlaceInner::Var(local, var2), layout },
+                _ => unreachable!("field should be 0 or 1"),
             }
-            _ => {}
         }
 
         let (base, extra) = match self.inner {
diff --git a/compiler/rustc_codegen_gcc/src/abi.rs b/compiler/rustc_codegen_gcc/src/abi.rs
index fb243ff..1b7bb8c 100644
--- a/compiler/rustc_codegen_gcc/src/abi.rs
+++ b/compiler/rustc_codegen_gcc/src/abi.rs
@@ -10,7 +10,7 @@
 use rustc_middle::ty::Ty;
 use rustc_middle::ty::layout::LayoutOf;
 #[cfg(feature = "master")]
-use rustc_session::config;
+use rustc_session::{Session, config};
 use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode};
 #[cfg(feature = "master")]
 use rustc_target::spec::Arch;
@@ -230,32 +230,43 @@ fn ptr_to_gcc_type(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Type<'gcc> {
 
     #[cfg(feature = "master")]
     fn gcc_cconv(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Option<FnAttribute<'gcc>> {
-        conv_to_fn_attribute(self.conv, &cx.tcx.sess.target.arch)
+        conv_to_fn_attribute(cx.sess(), self.conv)
     }
 }
 
 #[cfg(feature = "master")]
-pub fn conv_to_fn_attribute<'gcc>(conv: CanonAbi, arch: &Arch) -> Option<FnAttribute<'gcc>> {
+pub fn conv_to_fn_attribute<'gcc>(sess: &Session, conv: CanonAbi) -> Option<FnAttribute<'gcc>> {
     let attribute = match conv {
         CanonAbi::C | CanonAbi::Rust => return None,
-        // gcc/gccjit does not have anything for this.
-        CanonAbi::RustPreserveNone => return None,
+        CanonAbi::RustPreserveNone => {
+            // This calling convention is LLVM-specific and unspecified.
+            sess.dcx()
+                .fatal("gcc/gccjit backend does not support RustPreserveNone calling convention")
+        }
+        CanonAbi::RustTail => {
+            // This calling convention is LLVM-specific and unspecified.
+            sess.dcx().fatal("gcc/gccjit backend does not support RustTail calling convention")
+        }
         CanonAbi::RustCold => FnAttribute::Cold,
         // Functions with this calling convention can only be called from assembly, but it is
         // possible to declare an `extern "custom"` block, so the backend still needs a calling
         // convention for declaring foreign functions.
         CanonAbi::Custom => return None,
-        // gcc/gccjit does not have anything for Swift's calling convention.
-        CanonAbi::Swift => panic!("gcc/gccjit backend does not support Swift calling convention"),
+        CanonAbi::Swift => {
+            // gcc/gccjit does not have anything for Swift's calling convention.
+            sess.dcx().fatal("gcc/gccjit backend does not support Swift calling convention")
+        }
         CanonAbi::Arm(arm_call) => match arm_call {
             ArmCall::CCmseNonSecureCall => FnAttribute::ArmCmseNonsecureCall,
             ArmCall::CCmseNonSecureEntry => FnAttribute::ArmCmseNonsecureEntry,
             ArmCall::Aapcs => FnAttribute::ArmPcs("aapcs"),
         },
-        CanonAbi::GpuKernel => match arch {
+        CanonAbi::GpuKernel => match &sess.target.arch {
             &Arch::AmdGpu => FnAttribute::GcnAmdGpuHsaKernel,
             &Arch::Nvptx64 => FnAttribute::NvptxKernel,
-            arch => panic!("Arch {arch} does not support GpuKernel calling convention"),
+            arch => sess
+                .dcx()
+                .fatal(format!("Arch {arch} does not support GpuKernel calling convention")),
         },
         // FIXME(antoyo): check if those AVR attributes are mapped correctly.
         CanonAbi::Interrupt(interrupt_kind) => match interrupt_kind {
diff --git a/compiler/rustc_codegen_gcc/src/asm.rs b/compiler/rustc_codegen_gcc/src/asm.rs
index 5bb6536..e4b75dc 100644
--- a/compiler/rustc_codegen_gcc/src/asm.rs
+++ b/compiler/rustc_codegen_gcc/src/asm.rs
@@ -751,6 +751,11 @@ fn reg_class_to_gcc(reg_class: InlineAsmRegClass) -> &'static str {
             | X86InlineAsmRegClass::mmx_reg
             | X86InlineAsmRegClass::tmm_reg,
         ) => unreachable!("clobber-only"),
+        InlineAsmRegClass::Xtensa(XtensaInlineAsmRegClass::reg) => "r",
+        InlineAsmRegClass::Xtensa(XtensaInlineAsmRegClass::freg) => "f",
+        InlineAsmRegClass::Xtensa(
+            XtensaInlineAsmRegClass::sreg | XtensaInlineAsmRegClass::breg,
+        ) => unreachable!("clobber-only"),
         InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
             bug!("GCC backend does not support SPIR-V")
         }
@@ -872,6 +877,11 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
         InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
             bug!("GCC backend does not support SPIR-V")
         }
+        InlineAsmRegClass::Xtensa(XtensaInlineAsmRegClass::reg) => cx.type_i32(),
+        InlineAsmRegClass::Xtensa(XtensaInlineAsmRegClass::freg) => cx.type_f32(),
+        InlineAsmRegClass::Xtensa(
+            XtensaInlineAsmRegClass::sreg | XtensaInlineAsmRegClass::breg,
+        ) => unreachable!("clobber-only"),
         InlineAsmRegClass::Err => unreachable!(),
     }
 }
@@ -1070,6 +1080,7 @@ fn modifier_to_gcc(
         InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
             bug!("LLVM backend does not support SPIR-V")
         }
+        InlineAsmRegClass::Xtensa(_) => None,
         InlineAsmRegClass::Err => unreachable!(),
     }
 }
diff --git a/compiler/rustc_codegen_gcc/src/context.rs b/compiler/rustc_codegen_gcc/src/context.rs
index ed31385..ea71546 100644
--- a/compiler/rustc_codegen_gcc/src/context.rs
+++ b/compiler/rustc_codegen_gcc/src/context.rs
@@ -486,10 +486,10 @@ fn apply_target_cpu_attr(&self, _llfn: Function<'gcc>) {
     fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
         let entry_name = self.sess().target.entry_name.as_ref();
         if !self.functions.borrow().contains_key(entry_name) {
-            #[cfg(feature = "master")]
-            let conv = conv_to_fn_attribute(self.sess().target.entry_abi, &self.sess().target.arch);
-            #[cfg(not(feature = "master"))]
-            let conv = None;
+            let conv = cfg_select! {
+                feature = "master" => conv_to_fn_attribute(self.sess(), self.sess().target.entry_abi),
+                _ => None,
+            };
             Some(self.declare_entry_fn(entry_name, fn_type, conv))
         } else {
             // If the symbol already exists, it is an error: for example, the user wrote
diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs
index 9669f40..850b67c 100644
--- a/compiler/rustc_codegen_gcc/src/lib.rs
+++ b/compiler/rustc_codegen_gcc/src/lib.rs
@@ -89,11 +89,10 @@
 use rustc_codegen_ssa::target_features::cfg_target_feature;
 use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, WriteBackendMethods};
 use rustc_codegen_ssa::{CompiledModule, CompiledModules, CrateInfo, ModuleCodegen, TargetConfig};
-use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::profiling::SelfProfilerRef;
 use rustc_data_structures::sync::IntoDynSyncSend;
 use rustc_errors::{DiagCtxt, DiagCtxtHandle};
-use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
 use rustc_middle::ty::TyCtxt;
 use rustc_middle::util::Providers;
 use rustc_session::Session;
@@ -301,7 +300,7 @@ fn join_codegen(
         sess: &Session,
         _outputs: &OutputFilenames,
         crate_info: &CrateInfo,
-    ) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
+    ) -> (CompiledModules, WorkProductMap) {
         ongoing_codegen
             .downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<GccCodegenBackend>>()
             .expect("Expected GccCodegenBackend's OngoingCodegen, found Box<Any>")
diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs
index 3f6010e..4d18818 100644
--- a/compiler/rustc_codegen_llvm/src/abi.rs
+++ b/compiler/rustc_codegen_llvm/src/abi.rs
@@ -723,6 +723,10 @@ pub(crate) fn to_llvm_calling_convention(sess: &Session, abi: CanonAbi) -> llvm:
             Arch::X86_64 | Arch::AArch64 => llvm::PreserveNone,
             _ => llvm::CCallConv,
         },
+        CanonAbi::RustTail => match &sess.target.arch {
+            Arch::X86 | Arch::X86_64 | Arch::AArch64 => llvm::Tail,
+            _ => sess.dcx().fatal("extern \"tail\" is only supported on x86_64 and aarch64"),
+        },
         // Functions with this calling convention can only be called from assembly, but it is
         // possible to declare an `extern "custom"` block, so the backend still needs a calling
         // convention for declaring foreign functions.
diff --git a/compiler/rustc_codegen_llvm/src/asm.rs b/compiler/rustc_codegen_llvm/src/asm.rs
index c5ab9fc..824515c 100644
--- a/compiler/rustc_codegen_llvm/src/asm.rs
+++ b/compiler/rustc_codegen_llvm/src/asm.rs
@@ -278,6 +278,7 @@ fn codegen_inline_asm(
                 }
                 InlineAsmArch::SpirV => {}
                 InlineAsmArch::Wasm32 | InlineAsmArch::Wasm64 => {}
+                InlineAsmArch::Xtensa => {}
                 InlineAsmArch::Bpf => {}
                 InlineAsmArch::Msp430 => {
                     constraints.push("~{sr}".to_string());
@@ -740,6 +741,11 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) ->
                 | X86InlineAsmRegClass::kreg0
                 | X86InlineAsmRegClass::tmm_reg,
             ) => unreachable!("clobber-only"),
+            Xtensa(XtensaInlineAsmRegClass::freg) => "f",
+            Xtensa(XtensaInlineAsmRegClass::reg) => "r",
+            Xtensa(XtensaInlineAsmRegClass::sreg | XtensaInlineAsmRegClass::breg) => {
+                unreachable!("clobber-only")
+            }
             Wasm(WasmInlineAsmRegClass::local) => "r",
             Bpf(BpfInlineAsmRegClass::reg) => "r",
             Bpf(BpfInlineAsmRegClass::wreg) => "w",
@@ -845,6 +851,7 @@ fn modifier_to_llvm(
             | X86InlineAsmRegClass::kreg0
             | X86InlineAsmRegClass::tmm_reg,
         ) => unreachable!("clobber-only"),
+        Xtensa(_) => None,
         Wasm(WasmInlineAsmRegClass::local) => None,
         Bpf(_) => None,
         Avr(AvrInlineAsmRegClass::reg_pair)
@@ -939,6 +946,11 @@ fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &'
             | X86InlineAsmRegClass::kreg0
             | X86InlineAsmRegClass::tmm_reg,
         ) => unreachable!("clobber-only"),
+        Xtensa(XtensaInlineAsmRegClass::reg) => cx.type_i32(),
+        Xtensa(XtensaInlineAsmRegClass::freg) => cx.type_f32(),
+        Xtensa(XtensaInlineAsmRegClass::sreg | XtensaInlineAsmRegClass::breg) => {
+            unreachable!("clobber-only")
+        }
         Wasm(WasmInlineAsmRegClass::local) => cx.type_i32(),
         Bpf(BpfInlineAsmRegClass::reg) => cx.type_i64(),
         Bpf(BpfInlineAsmRegClass::wreg) => cx.type_i32(),
diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs
index 86e20d3..bcbafab 100644
--- a/compiler/rustc_codegen_llvm/src/errors.rs
+++ b/compiler/rustc_codegen_llvm/src/errors.rs
@@ -24,9 +24,12 @@ pub(crate) struct SymbolAlreadyDefined<'a> {
 
 impl<G: EmissionGuarantee> Diagnostic<'_, G> for ParseTargetMachineConfig<'_> {
     fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
-        let diag: Diag<'_, G> = self.0.into_diag(dcx, level);
+        // Reuse the formatted primary message from `LlvmError` without emitting it.
+        let diag: Diag<'_, ()> = self.0.into_diag(dcx, level);
         let (message, _) = diag.messages.first().expect("`LlvmError` with no message");
-        let message = format_diag_message(message, &diag.args);
+        let message = format_diag_message(message, &diag.args).into_owned();
+        diag.cancel();
+
         Diag::new(
             dcx,
             level,
diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs
index 7c05ecb..c0593bb 100644
--- a/compiler/rustc_codegen_llvm/src/lib.rs
+++ b/compiler/rustc_codegen_llvm/src/lib.rs
@@ -32,11 +32,10 @@
 };
 use rustc_codegen_ssa::traits::*;
 use rustc_codegen_ssa::{CompiledModule, CompiledModules, CrateInfo, ModuleCodegen, TargetConfig};
-use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::profiling::SelfProfilerRef;
 use rustc_errors::{DiagCtxt, DiagCtxtHandle};
 use rustc_metadata::EncodedMetadata;
-use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
 use rustc_middle::ty::TyCtxt;
 use rustc_middle::util::Providers;
 use rustc_session::Session;
@@ -358,7 +357,7 @@ fn join_codegen(
         sess: &Session,
         outputs: &OutputFilenames,
         crate_info: &CrateInfo,
-    ) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
+    ) -> (CompiledModules, WorkProductMap) {
         let (compiled_modules, work_products) = ongoing_codegen
             .downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<LlvmCodegenBackend>>()
             .expect("Expected LlvmCodegenBackend's OngoingCodegen, found Box<Any>")
diff --git a/compiler/rustc_codegen_ssa/src/back/archive.rs b/compiler/rustc_codegen_ssa/src/back/archive.rs
index b08693f..66f9c7f 100644
--- a/compiler/rustc_codegen_ssa/src/back/archive.rs
+++ b/compiler/rustc_codegen_ssa/src/back/archive.rs
@@ -1,17 +1,19 @@
-use std::env;
 use std::error::Error;
 use std::ffi::OsString;
 use std::fs::{self, File};
 use std::io::{self, BufWriter, Write};
 use std::path::{Path, PathBuf};
+use std::{env, mem};
 
 use ar_archive_writer::{
     ArchiveKind, COFFShortExport, MachineTypes, NewArchiveMember, write_archive_to_stream,
 };
 pub use ar_archive_writer::{DEFAULT_OBJECT_READER, ObjectReader};
 use object::read::archive::{ArchiveFile, ArchiveKind as ObjectArchiveKind};
-use object::read::macho::FatArch;
-use rustc_data_structures::fx::FxIndexSet;
+use object::read::elf::Sym as _;
+use object::read::macho::{FatArch, Nlist};
+use object::{Endianness, elf, macho};
+use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
 use rustc_data_structures::memmap::Mmap;
 use rustc_fs_util::TempDirBuilder;
 use rustc_metadata::EncodedMetadata;
@@ -318,7 +320,7 @@ pub trait ArchiveBuilder {
 
     fn add_archive(&mut self, archive: &Path, kind: AddArchiveKind<'_>) -> io::Result<()>;
 
-    fn build(self: Box<Self>, output: &Path) -> bool;
+    fn build(self: Box<Self>, output: &Path, exported_symbols: Option<FxHashSet<String>>) -> bool;
 }
 
 fn target_archive_format_to_object_kind(format: &str) -> Option<ObjectArchiveKind> {
@@ -401,7 +403,6 @@ enum ArchiveEntrySource {
 #[derive(Debug)]
 struct ArchiveEntry {
     source: ArchiveEntrySource,
-    #[expect(dead_code)] // used in #155338
     kind: ArchiveEntryKind,
 }
 
@@ -534,9 +535,9 @@ fn add_file(&mut self, file: &Path, kind: ArchiveEntryKind) {
 
     /// Combine the provided files, rlibs, and native libraries into a single
     /// `Archive`.
-    fn build(self: Box<Self>, output: &Path) -> bool {
+    fn build(self: Box<Self>, output: &Path, exported_symbols: Option<FxHashSet<String>>) -> bool {
         let sess = self.sess;
-        match self.build_inner(output) {
+        match self.build_inner(output, exported_symbols) {
             Ok(any_members) => any_members,
             Err(error) => {
                 sess.dcx().emit_fatal(ArchiveBuildFailure { path: output.to_owned(), error })
@@ -546,7 +547,11 @@ fn build(self: Box<Self>, output: &Path) -> bool {
 }
 
 impl<'a> ArArchiveBuilder<'a> {
-    fn build_inner(self, output: &Path) -> io::Result<bool> {
+    fn build_inner(
+        self,
+        output: &Path,
+        exported_symbols: Option<FxHashSet<String>>,
+    ) -> io::Result<bool> {
         let archive_kind = match &*self.sess.target.archive_format {
             "gnu" => ArchiveKind::Gnu,
             "bsd" => ArchiveKind::Bsd,
@@ -561,40 +566,51 @@ fn build_inner(self, output: &Path) -> io::Result<bool> {
         let mut entries = Vec::new();
 
         for (entry_name, entry) in self.entries {
-            let data =
-                match entry.source {
-                    ArchiveEntrySource::Archive { archive_index, file_range } => {
-                        let src_archive = &self.src_archives[archive_index];
-                        let archive_data = &src_archive.1;
-                        let start = file_range.0 as usize;
-                        let end = start + file_range.1 as usize;
-                        let Some(data) = archive_data.get(start..end) else {
-                            return Err(io_error_context(
-                                "invalid archive member",
-                                io::Error::new(
-                                    io::ErrorKind::InvalidData,
-                                    format!(
-                                        "archive member at offset {start} with size {} \
+            let data: Box<dyn AsRef<[u8]>> = match entry.source {
+                ArchiveEntrySource::Archive { archive_index, file_range } => {
+                    let src_archive = &self.src_archives[archive_index];
+                    let archive_data = &src_archive.1;
+                    let start = file_range.0 as usize;
+                    let end = start + file_range.1 as usize;
+                    let Some(data) = archive_data.get(start..end) else {
+                        return Err(io_error_context(
+                            "invalid archive member",
+                            io::Error::new(
+                                io::ErrorKind::InvalidData,
+                                format!(
+                                    "archive member at offset {start} with size {} \
                                          exceeds archive size {} in `{}`",
-                                        file_range.1,
-                                        archive_data.len(),
-                                        src_archive.0.display(),
-                                    ),
+                                    file_range.1,
+                                    archive_data.len(),
+                                    src_archive.0.display(),
                                 ),
-                            ));
-                        };
+                            ),
+                        ));
+                    };
 
-                        Box::new(data) as Box<dyn AsRef<[u8]>>
+                    if entry.kind == ArchiveEntryKind::RustObj
+                        && let Some(exported) = &exported_symbols
+                    {
+                        Box::new(apply_hide(data, exported))
+                    } else {
+                        Box::new(data)
                     }
-                    ArchiveEntrySource::File(file) => unsafe {
-                        Box::new(
-                            Mmap::map(File::open(file).map_err(|err| {
-                                io_error_context("failed to open object file", err)
-                            })?)
-                            .map_err(|err| io_error_context("failed to map object file", err))?,
-                        ) as Box<dyn AsRef<[u8]>>
-                    },
-                };
+                }
+                ArchiveEntrySource::File(file) => unsafe {
+                    let mmap = Mmap::map(
+                        File::open(file)
+                            .map_err(|err| io_error_context("failed to open object file", err))?,
+                    )
+                    .map_err(|err| io_error_context("failed to map object file", err))?;
+                    if entry.kind == ArchiveEntryKind::RustObj
+                        && let Some(exported) = &exported_symbols
+                    {
+                        Box::new(apply_hide(&mmap, exported))
+                    } else {
+                        Box::new(mmap) as Box<dyn AsRef<[u8]>>
+                    }
+                },
+            };
 
             entries.push(NewArchiveMember {
                 buf: data,
@@ -655,3 +671,153 @@ fn build_inner(self, output: &Path) -> io::Result<bool> {
 fn io_error_context(context: &str, err: io::Error) -> io::Error {
     io::Error::new(io::ErrorKind::Other, format!("{context}: {err}"))
 }
+
+// We use the `object` crate for the read-only pass over ELF/Mach-O object files
+// because its `Sym`/`Nlist` traits provide clean access to symbol properties without
+// manual byte parsing. However, `object` does not expose mutable views into the data,
+// so we cannot use it to modify symbol fields in place. Instead, the read-only pass
+// collects byte-level patches (offset + new value), and the write pass
+// (`apply_patches`) applies them to a copy of the byte buffer without any ELF/Mach-O
+// parsing — similar to how linker relocations work.
+
+/// A byte-level patch collected in the read-only pass and applied in the write pass.
+struct Patch {
+    offset: usize,
+    value: u8,
+}
+
+/// Apply a list of byte patches to `data`, returning the (possibly modified) bytes.
+fn apply_patches(data: &[u8], patches: &[Patch]) -> Vec<u8> {
+    let mut buf = data.to_vec();
+    for p in patches {
+        buf[p.offset] = p.value;
+    }
+    buf
+}
+
+// ---------------------------------------------------------------------------
+// ELF hide – read-only pass uses `object` crate, write pass uses `Patch` list
+// ---------------------------------------------------------------------------
+
+fn elf_hide_patches_impl<'data, Elf: object::read::elf::FileHeader<Endian = Endianness>>(
+    data: &'data [u8],
+    st_other_offset: usize,
+    exported: &FxHashSet<String>,
+) -> Option<Vec<Patch>>
+where
+    u64: From<Elf::Word>,
+{
+    let header = Elf::parse(data).ok()?;
+    let endian = header.endian().ok()?;
+    let sections = header.sections(endian, data).ok()?;
+    let symtab = sections.symbols(endian, data, elf::SHT_SYMTAB).ok()?;
+
+    let data_ptr = data.as_ptr() as usize;
+    let strings = symtab.strings();
+    let mut patches = Vec::new();
+
+    for sym in symtab.iter() {
+        let binding = sym.st_bind();
+        if binding != elf::STB_GLOBAL && binding != elf::STB_WEAK {
+            continue;
+        }
+        if sym.is_undefined(endian) {
+            continue;
+        }
+        let Ok(name_bytes) = sym.name(endian, strings) else { continue };
+        let Ok(name) = str::from_utf8(name_bytes) else { continue };
+        if !exported.contains(name) {
+            let sym_addr = sym as *const Elf::Sym as usize;
+            let offset = sym_addr - data_ptr + st_other_offset;
+            let new_vis = (sym.st_other() & !0x03) | elf::STV_HIDDEN;
+            patches.push(Patch { offset, value: new_vis });
+        }
+    }
+
+    Some(patches)
+}
+
+// ---------------------------------------------------------------------------
+// Mach-O hide – same architecture: read-only pass via `object`, write via patches
+// ---------------------------------------------------------------------------
+
+fn macho_hide_patches_impl<'data, Mach: object::read::macho::MachHeader<Endian = Endianness>>(
+    data: &'data [u8],
+    n_type_offset: usize,
+    exported: &FxHashSet<String>,
+) -> Option<Vec<Patch>> {
+    let header = Mach::parse(data, 0).ok()?;
+    let endian = header.endian().ok()?;
+    let mut commands = header.load_commands(endian, data, 0).ok()?;
+
+    let symtab_cmd = loop {
+        let cmd = commands.next().ok()??;
+        if let Some(st) = cmd.symtab().ok().flatten() {
+            break st;
+        }
+    };
+    let symtab: object::read::macho::SymbolTable<'_, Mach, &_> =
+        symtab_cmd.symbols(endian, data).ok()?;
+
+    let data_ptr = data.as_ptr() as usize;
+    let strings = symtab.strings();
+    let mut patches = Vec::new();
+
+    for nlist in symtab.iter() {
+        if nlist.is_stab() {
+            continue;
+        }
+        if nlist.is_undefined() {
+            continue;
+        }
+        if nlist.n_type() & macho::N_EXT == 0 {
+            continue;
+        }
+        let Ok(name_bytes) = nlist.name(endian, strings) else { continue };
+        let Ok(name) = str::from_utf8(name_bytes) else { continue };
+        let name = name.strip_prefix('_').unwrap_or(name);
+        if !exported.contains(name) {
+            let nlist_addr = nlist as *const Mach::Nlist as usize;
+            let offset = nlist_addr - data_ptr + n_type_offset;
+            patches.push(Patch { offset, value: nlist.n_type() | macho::N_PEXT });
+        }
+    }
+
+    Some(patches)
+}
+
+// ---------------------------------------------------------------------------
+// Unified dispatch: top-level detection via `object::File::parse`
+// ---------------------------------------------------------------------------
+
+fn hide_patches(data: &[u8], exported: &FxHashSet<String>) -> Option<Vec<Patch>> {
+    let file = object::File::parse(data).ok()?;
+    match file {
+        object::File::Elf64(_) => elf_hide_patches_impl::<elf::FileHeader64<Endianness>>(
+            data,
+            mem::offset_of!(elf::Sym64<Endianness>, st_other),
+            exported,
+        ),
+        object::File::Elf32(_) => elf_hide_patches_impl::<elf::FileHeader32<Endianness>>(
+            data,
+            mem::offset_of!(elf::Sym32<Endianness>, st_other),
+            exported,
+        ),
+        object::File::MachO64(_) => macho_hide_patches_impl::<macho::MachHeader64<Endianness>>(
+            data,
+            mem::offset_of!(macho::Nlist64<Endianness>, n_type),
+            exported,
+        ),
+        object::File::MachO32(_) => macho_hide_patches_impl::<macho::MachHeader32<Endianness>>(
+            data,
+            mem::offset_of!(macho::Nlist32<Endianness>, n_type),
+            exported,
+        ),
+        _ => None,
+    }
+}
+
+fn apply_hide(data: &[u8], exported: &FxHashSet<String>) -> Vec<u8> {
+    let patches = hide_patches(data, exported).unwrap_or_default();
+    apply_patches(data, &patches)
+}
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index 5680d3e..c68220a 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -131,7 +131,7 @@ pub fn link_binary(
                         RlibFlavor::Normal,
                         &path,
                     )
-                    .build(&out_filename);
+                    .build(&out_filename, None);
                 }
                 CrateType::StaticLib => {
                     link_staticlib(
@@ -566,7 +566,22 @@ fn link_staticlib(
         sess.dcx().emit_fatal(e);
     }
 
-    ab.build(out_filename);
+    let exported_symbols = if sess.opts.unstable_opts.staticlib_hide_internal_symbols {
+        if !matches!(sess.target.binary_format, BinaryFormat::Elf | BinaryFormat::MachO) {
+            sess.dcx().emit_warn(errors::StaticlibHideInternalSymbolsUnsupported {
+                binary_format: sess.target.archive_format.to_string(),
+            });
+            None
+        } else {
+            crate_info
+                .exported_symbols
+                .get(&CrateType::StaticLib)
+                .map(|symbols| symbols.iter().map(|(s, _)| s.clone()).collect())
+        }
+    } else {
+        None
+    };
+    ab.build(out_filename, exported_symbols);
 
     let crates = crate_info.used_crates.iter();
 
@@ -1265,7 +1280,7 @@ fn link_natively(
     if should_archive {
         let mut ab = archive_builder_builder.new_archive_builder(sess);
         ab.add_file(temp_filename, ArchiveEntryKind::Other);
-        ab.build(out_filename);
+        ab.build(out_filename, None);
     }
 }
 
@@ -3265,7 +3280,7 @@ fn add_static_crate(
             sess.dcx()
                 .emit_fatal(errors::RlibArchiveBuildFailure { path: cratepath.clone(), error });
         }
-        if archive.build(&dst) {
+        if archive.build(&dst, None) {
             link_upstream(&dst);
         }
     });
diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs
index f3e2848..55a8554 100644
--- a/compiler/rustc_codegen_ssa/src/back/metadata.rs
+++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs
@@ -36,7 +36,7 @@
 /// <dd>The metadata can be found in the `.rustc` section of the shared library.</dd>
 /// </dl>
 #[derive(Debug)]
-pub(crate) struct DefaultMetadataLoader;
+pub struct DefaultMetadataLoader;
 
 static AIX_METADATA_SYMBOL_NAME: &'static str = "__aix_rust_metadata";
 
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index 1b7817c..112cf45 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -6,7 +6,6 @@
 use std::{assert_matches, fs, io, mem, str, thread};
 
 use rustc_abi::Size;
-use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::jobserver::{self, Acquired};
 use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard};
 use rustc_errors::emitter::Emitter;
@@ -22,7 +21,7 @@
 use rustc_macros::{Decodable, Encodable};
 use rustc_metadata::fs::copy_to_stdout;
 use rustc_middle::bug;
-use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
 use rustc_middle::ty::TyCtxt;
 use rustc_session::Session;
 use rustc_session::config::{
@@ -460,8 +459,8 @@ pub(crate) fn start_async_codegen<B: WriteBackendMethods>(
 fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
     sess: &Session,
     compiled_modules: &CompiledModules,
-) -> FxIndexMap<WorkProductId, WorkProduct> {
-    let mut work_products = FxIndexMap::default();
+) -> WorkProductMap {
+    let mut work_products = WorkProductMap::default();
 
     if sess.opts.incremental.is_none() || sess.opts.unstable_opts.disable_incr_comp_backend_caching
     {
@@ -490,14 +489,13 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
         if let Some(path) = &module.bytecode {
             files.push((OutputType::Bitcode.extension(), path.as_path()));
         }
-        if let Some((id, product)) = copy_cgu_workproduct_to_incr_comp_cache_dir(
+        let (id, product) = copy_cgu_workproduct_to_incr_comp_cache_dir(
             sess,
             &module.name,
             files.as_slice(),
             &module.links_from_incr_cache,
-        ) {
-            work_products.insert(id, product);
-        }
+        );
+        work_products.insert(id, product);
     }
 
     work_products
@@ -2099,11 +2097,7 @@ pub struct OngoingCodegen<B: WriteBackendMethods> {
 }
 
 impl<B: WriteBackendMethods> OngoingCodegen<B> {
-    pub fn join(
-        self,
-        sess: &Session,
-        crate_info: &CrateInfo,
-    ) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
+    pub fn join(self, sess: &Session, crate_info: &CrateInfo) -> (CompiledModules, WorkProductMap) {
         self.shared_emitter_main.check(sess, true);
 
         let maybe_lto_modules = sess.time("join_worker_thread", || match self.coordinator.join() {
diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs
index 97884c2..9326e47 100644
--- a/compiler/rustc_codegen_ssa/src/errors.rs
+++ b/compiler/rustc_codegen_ssa/src/errors.rs
@@ -694,6 +694,14 @@ pub(crate) struct IncompatibleArchiveFormat {
 pub(crate) struct BpfStaticlibNotSupported;
 
 #[derive(Diagnostic)]
+#[diag(
+    "-Zstaticlib-hide-internal-symbols only supports ELF and Mach-O targets, but the target uses `{$binary_format}`"
+)]
+pub(crate) struct StaticlibHideInternalSymbolsUnsupported {
+    pub binary_format: String,
+}
+
+#[derive(Diagnostic)]
 #[diag("entry symbol `main` declared multiple times")]
 #[help(
     "did you use `#[no_mangle]` on `fn main`? Use `#![no_main]` to suppress the usual Rust-generated entry point"
diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
index ac6c6a0..99546be 100644
--- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
@@ -27,7 +27,7 @@ fn copy_intrinsic<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
     let layout = bx.layout_of(ty);
     let size = layout.size;
     let align = layout.align.abi;
-    let size = bx.mul(bx.const_usize(size.bytes()), count);
+    let size = bx.unchecked_sumul(bx.const_usize(size.bytes()), count);
     let flags = if volatile { MemFlags::VOLATILE } else { MemFlags::empty() };
     if allow_overlap {
         bx.memmove(dst, align, src, align, size, flags);
diff --git a/compiler/rustc_codegen_ssa/src/mir/statement.rs b/compiler/rustc_codegen_ssa/src/mir/statement.rs
index 4339642..2549d0a 100644
--- a/compiler/rustc_codegen_ssa/src/mir/statement.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/statement.rs
@@ -105,7 +105,7 @@ pub(crate) fn codegen_statement(&mut self, bx: &mut Bx, statement: &mir::Stateme
                     .layout_of(bx.typing_env().as_query_input(pointee))
                     .expect("expected pointee to have a layout");
                 let elem_size = pointee_layout.layout.size().bytes();
-                let bytes = bx.mul(count, bx.const_usize(elem_size));
+                let bytes = bx.unchecked_sumul(count, bx.const_usize(elem_size));
 
                 let align = pointee_layout.layout.align.abi;
                 let dst = dst_val.immediate();
diff --git a/compiler/rustc_codegen_ssa/src/traits/backend.rs b/compiler/rustc_codegen_ssa/src/traits/backend.rs
index 6bee9f7..6014f1a 100644
--- a/compiler/rustc_codegen_ssa/src/traits/backend.rs
+++ b/compiler/rustc_codegen_ssa/src/traits/backend.rs
@@ -2,11 +2,10 @@
 use std::hash::Hash;
 
 use rustc_ast::expand::allocator::AllocatorMethod;
-use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::sync::{DynSend, DynSync};
 use rustc_metadata::EncodedMetadata;
 use rustc_metadata::creader::MetadataLoaderDyn;
-use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::WorkProductMap;
 use rustc_middle::ty::TyCtxt;
 use rustc_middle::util::Providers;
 use rustc_session::Session;
@@ -130,7 +129,7 @@ fn join_codegen(
         sess: &Session,
         outputs: &OutputFilenames,
         crate_info: &CrateInfo,
-    ) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>);
+    ) -> (CompiledModules, WorkProductMap);
 
     fn print_pass_timings(&self) {}
 
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs
index 283c9af..daf51dd 100644
--- a/compiler/rustc_const_eval/src/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/check_consts/check.rs
@@ -779,7 +779,8 @@ fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location
                     // to do different checks than usual.
 
                     trace!("attempting to call a trait method");
-                    let is_const = tcx.constness(callee) == hir::Constness::Const;
+                    let is_const =
+                        matches!(tcx.constness(callee), hir::Constness::Const { always: false });
 
                     // Only consider a trait to be const if the const conditions hold.
                     // Otherwise, it's really misleading to call something "conditionally"
diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs
index c776fa6..78b2362 100644
--- a/compiler/rustc_const_eval/src/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/check_consts/ops.rs
@@ -423,7 +423,8 @@ macro_rules! error {
                         err.help("const traits are not yet supported on stable Rust");
                     }
                 }
-            } else if ccx.tcx.constness(callee) != hir::Constness::Const {
+            } else if !matches!(ccx.tcx.constness(callee), hir::Constness::Const { always: false })
+            {
                 let name = ccx.tcx.item_name(callee);
                 err.span_note(
                     ccx.tcx.def_span(callee),
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 57fd230..8267cb6 100644
--- a/compiler/rustc_const_eval/src/const_eval/fn_queries.rs
+++ b/compiler/rustc_const_eval/src/const_eval/fn_queries.rs
@@ -11,13 +11,13 @@ fn constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Constness {
     let node = tcx.hir_node_by_def_id(def_id);
 
     match node {
-        Node::Ctor(VariantData::Tuple(..)) => Constness::Const,
+        Node::Ctor(VariantData::Tuple(..)) => Constness::Const { always: false },
         Node::ForeignItem(item) if let ForeignItemKind::Fn(..) = item.kind => {
             // Foreign functions cannot be evaluated at compile-time.
             Constness::NotConst
         }
         Node::Expr(e) if let ExprKind::Closure(c) = e.kind => {
-            if let Constness::Const = c.constness && tcx.hir_body_const_context(tcx.local_parent(def_id)).is_none() {
+            if let Constness::Const { .. } = c.constness && tcx.hir_body_const_context(tcx.local_parent(def_id)).is_none() {
                 tcx.dcx().span_err(tcx.def_span(def_id), "cannot use `const` closures outside of const contexts");
                 return Constness::NotConst;
             }
@@ -37,7 +37,7 @@ fn constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Constness {
             ..
         }) => {
             match sig.header.constness {
-                Constness::Const => Constness::Const,
+                Constness::Const { always } => Constness::Const { always },
                 // inherent impl could be const
                 Constness::NotConst => tcx.constness(tcx.local_parent(def_id)),
             }
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index f086230..7ff9a4a 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -1,5 +1,9 @@
+use std::cell::RefCell;
+use std::collections::hash_map::Entry;
+
 use either::{Left, Right};
 use rustc_abi::{Align, HasDataLayout, Size, TargetDataLayout};
+use rustc_data_structures::fx::FxHashMap;
 use rustc_hir::def_id::DefId;
 use rustc_hir::limit::Limit;
 use rustc_middle::mir::interpret::{ErrorHandled, InvalidMetaKind, ReportedErrorInfo};
@@ -38,6 +42,9 @@ pub struct InterpCx<'tcx, M: Machine<'tcx>> {
     /// polymorphic context. This always uses `ty::TypingMode::PostAnalysis`.
     pub(super) typing_env: ty::TypingEnv<'tcx>,
 
+    /// The query cache is slow so we have our own cache in front of it.
+    pub(super) layout_cache: RefCell<FxHashMap<Ty<'tcx>, rustc_abi::Layout<'tcx>>>,
+
     /// The virtual memory system.
     pub memory: Memory<'tcx, M>,
 
@@ -130,10 +137,19 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
     /// This inherent method takes priority over the trait method with the same name in LayoutOf,
     /// and allows wrapping the actual [LayoutOf::layout_of] with a tracing span.
     /// See [LayoutOf::layout_of] for the original documentation.
-    #[inline(always)]
+    #[inline]
     pub fn layout_of(&self, ty: Ty<'tcx>) -> Result<TyAndLayout<'tcx>, InterpErrorKind<'tcx>> {
-        let _trace = enter_trace_span!(M, layouting::layout_of, ty = ?ty.kind());
-        LayoutOf::layout_of(self, ty)
+        match self.layout_cache.borrow_mut().entry(ty) {
+            Entry::Occupied(occupied_entry) => {
+                Ok(TyAndLayout { ty, layout: *occupied_entry.get() })
+            }
+            Entry::Vacant(vacant_entry) => {
+                let _trace = enter_trace_span!(M, layouting::layout_of, ty = ?ty.kind());
+                let layout = LayoutOf::layout_of(self, ty)?;
+                vacant_entry.insert(layout.layout);
+                Ok(layout)
+            }
+        }
     }
 
     /// This inherent method takes priority over the trait method with the same name in FnAbiOf,
@@ -248,6 +264,7 @@ pub fn new(
             machine,
             tcx: tcx.at(root_span),
             typing_env,
+            layout_cache: RefCell::new(FxHashMap::default()),
             memory: Memory::new(),
             recursion_limit: tcx.recursion_limit(),
         }
diff --git a/compiler/rustc_errors/Cargo.toml b/compiler/rustc_errors/Cargo.toml
index 386467c..b0eed7a 100644
--- a/compiler/rustc_errors/Cargo.toml
+++ b/compiler/rustc_errors/Cargo.toml
@@ -5,7 +5,7 @@
 
 [dependencies]
 # tidy-alphabetical-start
-annotate-snippets = { version = "0.12.15", features = ["simd"] }
+annotate-snippets = { version = "0.12.16", features = ["simd"] }
 anstream = "0.6.20"
 anstyle = "1.0.13"
 derive_setters = "0.1.6"
diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs
index 741c34e..ac16dbc 100644
--- a/compiler/rustc_expand/src/expand.rs
+++ b/compiler/rustc_expand/src/expand.rs
@@ -2066,7 +2066,11 @@ fn build_single_delegations<'a, Node: InvocationCollectorNode>(
                 ident: rename.unwrap_or(ident),
                 rename,
                 body: deleg.body.clone(),
-                from_glob,
+                source: if from_glob {
+                    ast::DelegationSource::Glob
+                } else {
+                    ast::DelegationSource::List
+                },
             })),
             tokens: None,
         }
diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs
index 16b21b0..7abf3ac 100644
--- a/compiler/rustc_expand/src/mbe/diagnostics.rs
+++ b/compiler/rustc_expand/src/mbe/diagnostics.rs
@@ -304,8 +304,10 @@ pub(super) fn emit_frag_parse_err(
     };
 
     if parser.token.kind == token::Dollar {
+        let dollar_span = parser.token.span;
         parser.bump();
         if let token::Ident(name, _) = parser.token.kind {
+            let metavar_span = dollar_span.to(parser.token.span);
             let mut bindings_names = vec![];
             for rule in bindings {
                 let MacroRule::Func { lhs, .. } = rule else { continue };
@@ -321,6 +323,15 @@ pub(super) fn emit_frag_parse_err(
                 matched_rule_bindings_names.push(bind.name);
             }
 
+            // Report the unbound metavariable as the primary error up front, so every
+            // case is consistent regardless of which suggestion (if any) we attach below.
+            e.primary_message(format!("cannot find macro parameter `${name}` in this scope"));
+            e.span(metavar_span);
+            e.span_label(metavar_span, "not found in this scope");
+            if parser.psess.source_map().is_imported(metavar_span) {
+                e.span_label(site_span, "in this macro invocation");
+            }
+
             if let Some(matched_name) = rustc_span::edit_distance::find_best_match_for_name(
                 &matched_rule_bindings_names[..],
                 name,
@@ -346,17 +357,13 @@ pub(super) fn emit_frag_parse_err(
                     matched_name,
                     Applicability::MaybeIncorrect,
                 );
-            } else {
+            } else if !matched_rule_bindings_names.is_empty() {
                 let msg = matched_rule_bindings_names
                     .iter()
                     .map(|sym| format!("${}", sym))
                     .collect::<Vec<_>>()
                     .join(", ");
-
-                e.span_label(parser.token.span, "macro metavariable not found");
-                if !matched_rule_bindings_names.is_empty() {
-                    e.note(format!("available metavariable names are: {msg}"));
-                }
+                e.note(format!("available metavariable names are: {msg}"));
             }
         }
     }
diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs
index f64ff98..d4bda53 100644
--- a/compiler/rustc_expand/src/module.rs
+++ b/compiler/rustc_expand/src/module.rs
@@ -2,9 +2,9 @@
 use std::path::{self, Path, PathBuf};
 
 use rustc_ast::{AttrVec, Attribute, Inline, Item, ModSpans};
+use rustc_attr_parsing::template;
 use rustc_attr_parsing::validate_attr::emit_malformed_attribute;
 use rustc_errors::{Diag, ErrorGuaranteed};
-use rustc_feature::template;
 use rustc_parse::lexer::StripTokens;
 use rustc_parse::{exp, new_parser_from_file, unwrap_or_emit_fatal};
 use rustc_session::Session;
diff --git a/compiler/rustc_expand/src/proc_macro.rs b/compiler/rustc_expand/src/proc_macro.rs
index 8ad502a..2deba79 100644
--- a/compiler/rustc_expand/src/proc_macro.rs
+++ b/compiler/rustc_expand/src/proc_macro.rs
@@ -31,7 +31,7 @@ fn record_expand_proc_macro<'a>(
 }
 
 pub struct BangProcMacro {
-    pub client: pm::bridge::client::Client<pm::TokenStream, pm::TokenStream>,
+    pub client: pm::bridge::client::Client,
 }
 
 impl base::BangProcMacro for BangProcMacro {
@@ -46,7 +46,7 @@ fn expand(
         let proc_macro_backtrace = ecx.ecfg.proc_macro_backtrace;
         let strategy = exec_strategy(ecx.sess);
         let server = proc_macro_server::Rustc::new(ecx);
-        self.client.run(&strategy, server, input, proc_macro_backtrace).map_err(|e| {
+        self.client.run1(&strategy, server, input, proc_macro_backtrace).map_err(|e| {
             ecx.dcx().emit_err(errors::ProcMacroPanicked {
                 span,
                 message: e.into_string().map(|message| errors::ProcMacroPanickedHelp { message }),
@@ -56,7 +56,7 @@ fn expand(
 }
 
 pub struct AttrProcMacro {
-    pub client: pm::bridge::client::Client<(pm::TokenStream, pm::TokenStream), pm::TokenStream>,
+    pub client: pm::bridge::client::Client,
 }
 
 impl base::AttrProcMacro for AttrProcMacro {
@@ -72,7 +72,7 @@ fn expand(
         let proc_macro_backtrace = ecx.ecfg.proc_macro_backtrace;
         let strategy = exec_strategy(ecx.sess);
         let server = proc_macro_server::Rustc::new(ecx);
-        self.client.run(&strategy, server, annotation, annotated, proc_macro_backtrace).map_err(
+        self.client.run2(&strategy, server, annotation, annotated, proc_macro_backtrace).map_err(
             |e| {
                 ecx.dcx().emit_err(errors::CustomAttributePanicked {
                     span,
@@ -176,7 +176,7 @@ pub(super) fn provide_derive_macro_expansion<'tcx>(
     })
 }
 
-type DeriveClient = pm::bridge::client::Client<pm::TokenStream, pm::TokenStream>;
+type DeriveClient = pm::bridge::client::Client;
 
 fn expand_derive_macro(
     invoc_id: LocalExpnId,
@@ -196,7 +196,7 @@ fn expand_derive_macro(
     let strategy = exec_strategy(ecx.sess);
     let server = proc_macro_server::Rustc::new(ecx);
 
-    match client.run(&strategy, server, input, proc_macro_backtrace) {
+    match client.run1(&strategy, server, input, proc_macro_backtrace) {
         Ok(stream) => Ok(stream),
         Err(e) => {
             let invoc_expn_data = invoc_id.expn_data();
diff --git a/compiler/rustc_feature/Cargo.toml b/compiler/rustc_feature/Cargo.toml
index 3cd88cc..454fa20 100644
--- a/compiler/rustc_feature/Cargo.toml
+++ b/compiler/rustc_feature/Cargo.toml
@@ -5,9 +5,7 @@
 
 [dependencies]
 # tidy-alphabetical-start
-rustc_ast = { path = "../rustc_ast" }
 rustc_data_structures = { path = "../rustc_data_structures" }
-rustc_hir = { path = "../rustc_hir" }
 rustc_span = { path = "../rustc_span" }
 serde = { version = "1.0.125", features = ["derive"] }
 serde_json = "1.0.59"
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index 7291902..6f55bec 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -2,9 +2,7 @@
 
 use std::sync::LazyLock;
 
-use rustc_ast::ast::Safety;
 use rustc_data_structures::fx::FxHashSet;
-use rustc_hir::AttrStyle;
 use rustc_span::{Symbol, sym};
 
 use crate::Features;
@@ -75,122 +73,6 @@ pub enum AttributeStability {
     Stable,
 }
 
-// FIXME(jdonszelmann): move to rustc_hir::attrs
-/// A template that the attribute input must match.
-/// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now.
-#[derive(Clone, Copy, Default)]
-pub struct AttributeTemplate {
-    /// If `true`, the attribute is allowed to be a bare word like `#[test]`.
-    pub word: bool,
-    /// If `Some`, the attribute is allowed to take a list of items like `#[allow(..)]`.
-    pub list: Option<&'static [&'static str]>,
-    /// If non-empty, the attribute is allowed to take a list containing exactly
-    /// one of the listed words, like `#[coverage(off)]`.
-    pub one_of: &'static [Symbol],
-    /// If `Some`, the attribute is allowed to be a name/value pair where the
-    /// value is a string, like `#[must_use = "reason"]`.
-    pub name_value_str: Option<&'static [&'static str]>,
-    /// A link to the document for this attribute.
-    pub docs: Option<&'static str>,
-}
-
-pub enum AttrSuggestionStyle {
-    /// The suggestion is styled for a normal attribute.
-    /// The `AttrStyle` determines whether this is an inner or outer attribute.
-    Attribute(AttrStyle),
-    /// The suggestion is styled for an attribute embedded into another attribute.
-    /// For example, attributes inside `#[cfg_attr(true, attr(...)]`.
-    EmbeddedAttribute,
-    /// The suggestion is styled for macros that are parsed with attribute parsers.
-    /// For example, the `cfg!(predicate)` macro.
-    Macro,
-}
-
-impl AttributeTemplate {
-    pub fn suggestions(
-        &self,
-        style: AttrSuggestionStyle,
-        safety: Safety,
-        name: impl std::fmt::Display,
-    ) -> Vec<String> {
-        let (start, macro_call, end) = match style {
-            AttrSuggestionStyle::Attribute(AttrStyle::Outer) => ("#[", "", "]"),
-            AttrSuggestionStyle::Attribute(AttrStyle::Inner) => ("#![", "", "]"),
-            AttrSuggestionStyle::Macro => ("", "!", ""),
-            AttrSuggestionStyle::EmbeddedAttribute => ("", "", ""),
-        };
-
-        let mut suggestions = vec![];
-
-        let (safety_start, safety_end) = match safety {
-            Safety::Unsafe(_) => ("unsafe(", ")"),
-            _ => ("", ""),
-        };
-
-        if self.word {
-            debug_assert!(macro_call.is_empty(), "Macro suggestions use list style");
-            suggestions.push(format!("{start}{safety_start}{name}{safety_end}{end}"));
-        }
-        if let Some(descr) = self.list {
-            for descr in descr {
-                suggestions.push(format!(
-                    "{start}{safety_start}{name}{macro_call}({descr}){safety_end}{end}"
-                ));
-            }
-        }
-        suggestions.extend(
-            self.one_of
-                .iter()
-                .map(|&word| format!("{start}{safety_start}{name}({word}){safety_end}{end}")),
-        );
-        if let Some(descr) = self.name_value_str {
-            debug_assert!(macro_call.is_empty(), "Macro suggestions use list style");
-            for descr in descr {
-                suggestions
-                    .push(format!("{start}{safety_start}{name} = \"{descr}\"{safety_end}{end}"));
-            }
-        }
-        suggestions.sort();
-
-        suggestions
-    }
-}
-
-/// A convenience macro for constructing attribute templates.
-/// E.g., `template!(Word, List: "description")` means that the attribute
-/// supports forms `#[attr]` and `#[attr(description)]`.
-#[macro_export]
-macro_rules! template {
-    (Word) => { $crate::template!(@ true, None, &[], None, None) };
-    (Word, $link: literal) => { $crate::template!(@ true, None, &[], None, Some($link)) };
-    (List: $descr: expr) => { $crate::template!(@ false, Some($descr), &[], None, None) };
-    (List: $descr: expr, $link: literal) => { $crate::template!(@ false, Some($descr), &[], None, Some($link)) };
-    (OneOf: $one_of: expr) => { $crate::template!(@ false, None, $one_of, None, None) };
-    (NameValueStr: [$($descr: literal),* $(,)?]) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), None) };
-    (NameValueStr: [$($descr: literal),* $(,)?], $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), Some($link)) };
-    (NameValueStr: $descr: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), None) };
-    (NameValueStr: $descr: literal, $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), Some($link)) };
-    (Word, List: $descr: expr) => { $crate::template!(@ true, Some($descr), &[], None, None) };
-    (Word, List: $descr: expr, $link: literal) => { $crate::template!(@ true, Some($descr), &[], None, Some($link)) };
-    (Word, NameValueStr: $descr: expr) => { $crate::template!(@ true, None, &[], Some(&[$descr]), None) };
-    (Word, NameValueStr: $descr: expr, $link: literal) => { $crate::template!(@ true, None, &[], Some(&[$descr]), Some($link)) };
-    (List: $descr1: expr, NameValueStr: $descr2: expr) => {
-        $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), None)
-    };
-    (List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
-        $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), Some($link))
-    };
-    (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => {
-        $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), None)
-    };
-    (Word, List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
-        $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), Some($link))
-    };
-    (@ $word: expr, $list: expr, $one_of: expr, $name_value_str: expr, $link: expr) => { $crate::AttributeTemplate {
-        word: $word, list: $list, one_of: $one_of, name_value_str: $name_value_str, docs: $link,
-    } };
-}
-
 /// Attributes that have a special meaning to rustc or rustdoc.
 #[rustfmt::skip]
 pub static BUILTIN_ATTRIBUTES: &[Symbol] = &[
@@ -452,6 +334,7 @@ macro_rules! template {
     sym::rustc_no_implicit_autorefs,
     sym::rustc_coherence_is_core,
     sym::rustc_coinductive,
+    sym::rustc_comptime,
     sym::rustc_allow_incoherent_impl,
     sym::rustc_preserve_ub_checks,
     sym::rustc_deny_explicit_impl,
diff --git a/compiler/rustc_feature/src/lib.rs b/compiler/rustc_feature/src/lib.rs
index eea9474a..859b202 100644
--- a/compiler/rustc_feature/src/lib.rs
+++ b/compiler/rustc_feature/src/lib.rs
@@ -129,8 +129,8 @@ pub fn find_feature_issue(feature: Symbol, issue: GateIssue) -> Option<NonZero<u
 
 pub use accepted::ACCEPTED_LANG_FEATURES;
 pub use builtin_attrs::{
-    AttrSuggestionStyle, AttributeStability, AttributeTemplate, BUILTIN_ATTRIBUTE_MAP,
-    BUILTIN_ATTRIBUTES, GatedCfg, find_gated_cfg, is_builtin_attr_name,
+    AttributeStability, BUILTIN_ATTRIBUTE_MAP, BUILTIN_ATTRIBUTES, GatedCfg, find_gated_cfg,
+    is_builtin_attr_name,
 };
 pub use removed::REMOVED_LANG_FEATURES;
 pub use unstable::{
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index be98544..a8f0b4c 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -709,6 +709,8 @@ pub fn internal(&self, feature: Symbol) -> bool {
     (unstable, rust_cold_cc, "1.63.0", Some(97544)),
     /// Allows `extern "rust-preserve-none"`.
     (unstable, rust_preserve_none_cc, "1.95.0", Some(151401)),
+    /// Allows `extern "tail"`.
+    (unstable, rust_tail_cc, "CURRENT_RUSTC_VERSION", Some(157427)),
     /// Target features on s390x.
     (unstable, s390x_target_feature, "1.82.0", Some(150259)),
     /// Allows the use of the `sanitize` attribute.
@@ -773,6 +775,8 @@ pub fn internal(&self, feature: Symbol) -> bool {
     (unstable, x87_target_feature, "1.85.0", Some(150261)),
     /// Allows use of the `xop` target-feature
     (unstable, xop_target_feature, "1.81.0", Some(127208)),
+    /// Allows use of the Xtensa target-features
+    (unstable, xtensa_target_feature, "CURRENT_RUSTC_VERSION", Some(157063)),
     /// Allows `do yeet` expressions
     (unstable, yeet_expr, "1.62.0", Some(96373)),
     (unstable, yield_expr, "1.87.0", Some(43122)),
diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs
index 4ff56a6..f2b4041 100644
--- a/compiler/rustc_hir/src/attrs/data_structures.rs
+++ b/compiler/rustc_hir/src/attrs/data_structures.rs
@@ -1311,6 +1311,9 @@ pub enum AttributeKind {
     /// Represents `#[rustc_coinductive]`.
     RustcCoinductive,
 
+    /// Represents `#[rustc_comptime]`
+    RustcComptime(Span),
+
     /// Represents `#[rustc_confusables]`.
     RustcConfusables {
         confusables: ThinVec<Symbol>,
diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs
index 7169fa4..80eeb34 100644
--- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs
+++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs
@@ -112,6 +112,7 @@ pub fn encode_cross_crate(&self) -> EncodeCrossCrate {
             RustcClean { .. } => No,
             RustcCoherenceIsCore => No,
             RustcCoinductive => No,
+            RustcComptime(..) => No, // Encoded directly in signature
             RustcConfusables { .. } => Yes,
             RustcConstStability { .. } => Yes,
             RustcConstStableIndirect => No,
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index 256176f..4fe1a45 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -1193,8 +1193,6 @@ pub enum WherePredicateKind<'hir> {
     BoundPredicate(WhereBoundPredicate<'hir>),
     /// A lifetime predicate (e.g., `'a: 'b + 'c`).
     RegionPredicate(WhereRegionPredicate<'hir>),
-    /// An equality predicate (unsupported).
-    EqPredicate(WhereEqPredicate<'hir>),
 }
 
 impl<'hir> WherePredicateKind<'hir> {
@@ -1202,7 +1200,6 @@ pub fn in_where_clause(&self) -> bool {
         match self {
             WherePredicateKind::BoundPredicate(p) => p.origin == PredicateOrigin::WhereClause,
             WherePredicateKind::RegionPredicate(p) => p.in_where_clause,
-            WherePredicateKind::EqPredicate(_) => false,
         }
     }
 
@@ -1210,7 +1207,6 @@ pub fn bounds(&self) -> GenericBounds<'hir> {
         match self {
             WherePredicateKind::BoundPredicate(p) => p.bounds,
             WherePredicateKind::RegionPredicate(p) => p.bounds,
-            WherePredicateKind::EqPredicate(_) => &[],
         }
     }
 }
@@ -2471,10 +2467,12 @@ pub enum ConstContext {
     /// - Array length expressions
     /// - Enum discriminants
     /// - Const generics
-    ///
-    /// For the most part, other contexts are treated just like a regular `const`, so they are
-    /// lumped into the same category.
-    Const { inline: bool },
+    Const {
+        /// For backwards compatibility `const` items allow
+        /// calls to `const fn` to get promoted.
+        /// We forbid that in comptime fns and inline consts.
+        allow_const_fn_promotion: bool,
+    },
 }
 
 impl ConstContext {
@@ -4636,17 +4634,24 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 }
 
 #[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, StableHash)]
-#[derive(Default)]
 pub enum Constness {
-    #[default]
-    Const,
+    Const { always: bool },
     NotConst,
 }
 
+/// This impl exists as an optimization so that metadata deserialization can
+/// store the value directly and not have to encode it wrapped in another `Option`.
+impl Default for Constness {
+    fn default() -> Self {
+        Self::Const { always: false }
+    }
+}
+
 impl fmt::Display for Constness {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.write_str(match *self {
-            Self::Const => "const",
+            Self::Const { always: true } => "comptime",
+            Self::Const { always: false } => "const",
             Self::NotConst => "non-const",
         })
     }
@@ -4700,10 +4705,6 @@ pub fn is_async(&self) -> bool {
         matches!(self.asyncness, IsAsync::Async(_))
     }
 
-    pub fn is_const(&self) -> bool {
-        matches!(self.constness, Constness::Const)
-    }
-
     pub fn is_unsafe(&self) -> bool {
         self.safety().is_unsafe()
     }
@@ -5253,6 +5254,7 @@ pub fn ty(self) -> Option<&'hir Ty<'hir>> {
                 GenericParamKind::Type { default, .. } => default,
                 GenericParamKind::Const { ty, .. } => Some(ty),
             },
+            Node::Field(f) => Some(f.ty),
             _ => None,
         }
     }
diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs
index 85f0e97..b0c6a13 100644
--- a/compiler/rustc_hir/src/intravisit.rs
+++ b/compiler/rustc_hir/src/intravisit.rs
@@ -1200,10 +1200,6 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>(
             try_visit!(visitor.visit_lifetime(lifetime));
             walk_list!(visitor, visit_param_bound, bounds);
         }
-        WherePredicateKind::EqPredicate(WhereEqPredicate { ref lhs_ty, ref rhs_ty }) => {
-            try_visit!(visitor.visit_ty_unambig(lhs_ty));
-            try_visit!(visitor.visit_ty_unambig(rhs_ty));
-        }
     }
     V::Result::output()
 }
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index 14759ad..00bb8fa 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -35,8 +35,8 @@
 use super::compare_impl_item::check_type_bounds;
 use super::*;
 use crate::check::wfcheck::{
-    check_associated_item, check_trait_item, check_variances_for_type_defn, check_where_clauses,
-    enter_wf_checking_ctxt,
+    check_associated_item, check_trait_item, check_type_defn, check_variances_for_type_defn,
+    check_where_clauses, enter_wf_checking_ctxt,
 };
 
 fn add_abi_diag_help<T: EmissionGuarantee>(abi: ExternAbi, diag: &mut Diag<'_, T>) {
@@ -103,7 +103,7 @@ pub fn check_custom_abi(tcx: TyCtxt<'_>, def_id: LocalDefId, fn_sig: FnSig<'_>,
     }
 }
 
-fn check_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) {
+fn check_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
     let def = tcx.adt_def(def_id);
     let span = tcx.def_span(def_id);
     def.destructor(tcx); // force the destructor to be evaluated
@@ -116,15 +116,17 @@ fn check_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) {
 
     check_transparent(tcx, def);
     check_packed(tcx, span, def);
+    check_type_defn(tcx, def_id, false)
 }
 
-fn check_union(tcx: TyCtxt<'_>, def_id: LocalDefId) {
+fn check_union(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
     let def = tcx.adt_def(def_id);
     let span = tcx.def_span(def_id);
     def.destructor(tcx); // force the destructor to be evaluated
     check_transparent(tcx, def);
     check_union_fields(tcx, span, def_id);
     check_packed(tcx, span, def);
+    check_type_defn(tcx, def_id, true)
 }
 
 fn allowed_union_or_unsafe_field<'tcx>(
@@ -775,8 +777,10 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
                 if has_default {
                     // need to store default and type of default
                     let ct = tcx.const_param_default(param.def_id).skip_binder();
-                    if let ty::ConstKind::Unevaluated(uv) = ct.kind() {
-                        tcx.ensure_ok().type_of(uv.kind.def_id());
+                    if let ty::ConstKind::Unevaluated(uv) = ct.kind()
+                        && let Some(def_id) = uv.kind.opt_def_id()
+                    {
+                        tcx.ensure_ok().type_of(def_id);
                     }
                 }
             }
@@ -805,9 +809,12 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
             tcx.ensure_ok().generics_of(def_id);
             tcx.ensure_ok().type_of(def_id);
             tcx.ensure_ok().predicates_of(def_id);
-            crate::collect::lower_enum_variant_types(tcx, def_id);
+            crate::collect::check_enum_variant_types(tcx, def_id);
             check_enum(tcx, def_id);
             check_variances_for_type_defn(tcx, def_id);
+            res = res.and(check_type_defn(tcx, def_id, true));
+            // enums are fully handled by the type based check and have no hir wfcheck logic
+            return res;
         }
         DefKind::Fn => {
             tcx.ensure_ok().generics_of(def_id);
@@ -865,12 +872,19 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
                     _ => {}
                 }
             }
+            res = res.and(wfcheck::check_trait(tcx, def_id));
+            wfcheck::check_gat_where_clauses(tcx, def_id);
+            // Trait aliases do not have hir checks anymore
+            return res;
         }
         DefKind::TraitAlias => {
             tcx.ensure_ok().generics_of(def_id);
             tcx.ensure_ok().explicit_implied_predicates_of(def_id);
             tcx.ensure_ok().explicit_super_predicates_of(def_id);
             tcx.ensure_ok().predicates_of(def_id);
+            res = res.and(wfcheck::check_trait(tcx, def_id));
+            // Trait aliases do not have hir checks anymore
+            return res;
         }
         def_kind @ (DefKind::Struct | DefKind::Union) => {
             tcx.ensure_ok().generics_of(def_id);
@@ -885,14 +899,16 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
             }
 
             if let Some((_, ctor_def_id)) = adt.ctor {
-                crate::collect::lower_variant_ctor(tcx, ctor_def_id.expect_local());
+                crate::collect::check_ctor(tcx, ctor_def_id.expect_local());
             }
-            match def_kind {
+            check_variances_for_type_defn(tcx, def_id);
+            res = res.and(match def_kind {
                 DefKind::Struct => check_struct(tcx, def_id),
                 DefKind::Union => check_union(tcx, def_id),
                 _ => unreachable!(),
-            }
-            check_variances_for_type_defn(tcx, def_id);
+            });
+            // structs and enums are fully handled by the type based check and have no hir wfcheck logic
+            return res;
         }
         DefKind::OpaqueTy => {
             check_opaque_precise_captures(tcx, def_id);
@@ -1073,6 +1089,8 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
                     _ => (),
                 }
             }
+            // Doesn't have any hir based checks
+            return res;
         }
         DefKind::Closure => {
             // This is guaranteed to be called by metadata encoding,
@@ -1152,10 +1170,14 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
             return res;
         }
 
-        // Only `Node::Item` and `Node::ForeignItem` still have HIR based
-        // checks. Returning early here does not miss any checks and
-        // avoids this query from having a direct dependency edge on the HIR
-        DefKind::AnonConst | DefKind::InlineConst => return res,
+        // These have no wf checks
+        DefKind::AnonConst
+        | DefKind::InlineConst
+        | DefKind::ExternCrate
+        | DefKind::Macro(..)
+        | DefKind::Use
+        | DefKind::GlobalAsm
+        | DefKind::Mod => return res,
         _ => {}
     }
     let node = tcx.hir_node_by_def_id(def_id);
@@ -1613,6 +1635,16 @@ fn check_scalable_vector(tcx: TyCtxt<'_>, span: Span, def_id: LocalDefId, scalab
 pub(super) fn check_packed(tcx: TyCtxt<'_>, sp: Span, def: ty::AdtDef<'_>) {
     let repr = def.repr();
     if repr.packed() {
+        // `#[pin_v2]` on a packed type is unsound: drop glue for a packed type moves an
+        // over-aligned field to an aligned location before running its destructor, which would
+        // move a structurally pinned field out from under a `Pin<&mut _>` that was handed out.
+        if def.is_pin_project() {
+            tcx.dcx().emit_err(errors::PinV2OnPacked {
+                span: sp,
+                pin_v2_span: find_attr!(tcx, def.did(), PinV2(span) => *span),
+                adt_name: tcx.item_name(def.did()),
+            });
+        }
         if let Some(reprs) = find_attr!(tcx, def.did(), Repr { reprs, .. } => reprs) {
             for (r, _) in reprs {
                 if let ReprPacked(pack) = r
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
index 234231e..964f801e 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
@@ -1202,7 +1202,6 @@ pub(super) fn check_number_of_early_bound_regions<'tcx>(
                         }
                     }
                 }
-                _ => {}
             }
         }
         if let Some(impl_node) = tcx.hir_get_if_local(impl_def_id.into())
@@ -1225,7 +1224,6 @@ pub(super) fn check_number_of_early_bound_regions<'tcx>(
                             }
                         }
                     }
-                    _ => {}
                 }
             }
             if impl_bounds == bounds_span.len() {
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index f495df3..f5b414d 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -22,9 +22,9 @@
 use rustc_middle::traits::solve::NoSolution;
 use rustc_middle::ty::trait_def::TraitSpecializationKind;
 use rustc_middle::ty::{
-    self, AdtKind, GenericArgKind, GenericArgs, GenericParamDefKind, Ty, TyCtxt, TypeFlags,
-    TypeFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingMode,
-    Unnormalized, Upcast,
+    self, GenericArgKind, GenericArgs, GenericParamDefKind, Ty, TyCtxt, TypeFlags, TypeFoldable,
+    TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingMode, Unnormalized,
+    Upcast,
 };
 use rustc_middle::{bug, span_bug};
 use rustc_session::errors::feature_err;
@@ -324,12 +324,8 @@ pub(super) fn check_item<'tcx>(
             res
         }
         hir::ItemKind::Fn { sig, .. } => check_item_fn(tcx, def_id, sig.decl),
-        hir::ItemKind::Struct(..) => check_type_defn(tcx, item, false),
-        hir::ItemKind::Union(..) => check_type_defn(tcx, item, true),
-        hir::ItemKind::Enum(..) => check_type_defn(tcx, item, true),
-        hir::ItemKind::Trait { .. } => check_trait(tcx, item),
-        hir::ItemKind::TraitAlias(..) => check_trait(tcx, item),
-        _ => Ok(()),
+        // Note: do not add new entries to this match. Instead add all new logic in `check_item_type`
+        _ => span_bug!(item.span, "should have been handled by the type based wf check: {item:?}"),
     }
 }
 
@@ -381,7 +377,7 @@ pub(crate) fn check_trait_item<'tcx>(
 ///     fn into_iter<'a>(&'a self) -> Self::Iter<'a>;
 /// }
 /// ```
-fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
+pub(crate) fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
     // Associates every GAT's def_id to a list of possibly missing bounds detected by this lint.
     let mut required_bounds_by_item = FxIndexMap::default();
     let associated_items = tcx.associated_items(trait_def_id);
@@ -1036,15 +1032,15 @@ pub(crate) fn check_associated_item(
 }
 
 /// In a type definition, we check that to ensure that the types of the fields are well-formed.
-fn check_type_defn<'tcx>(
+pub(crate) fn check_type_defn<'tcx>(
     tcx: TyCtxt<'tcx>,
-    item: &hir::Item<'tcx>,
+    item: LocalDefId,
     all_sized: bool,
 ) -> Result<(), ErrorGuaranteed> {
-    tcx.ensure_ok().check_representability(item.owner_id.def_id);
-    let adt_def = tcx.adt_def(item.owner_id);
+    tcx.ensure_ok().check_representability(item);
+    let adt_def = tcx.adt_def(item);
 
-    enter_wf_checking_ctxt(tcx, item.owner_id.def_id, |wfcx| {
+    enter_wf_checking_ctxt(tcx, item, |wfcx| {
         let variants = adt_def.variants();
         let packed = adt_def.repr().packed();
 
@@ -1057,6 +1053,7 @@ fn check_type_defn<'tcx>(
                     // FIXME(generic_const_exprs, default_field_values): this is a hack and needs to
                     // be refactored to check the instantiate-ability of the code better.
                     if let Some(def_id) = def_id.as_local()
+                        && let DefKind::AnonConst = tcx.def_kind(def_id)
                         && let hir::Node::AnonConst(anon) = tcx.hir_node_by_def_id(def_id)
                         && let expr = &tcx.hir_body(anon.body).value
                         && let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind
@@ -1071,18 +1068,13 @@ fn check_type_defn<'tcx>(
                     }
                 }
                 let field_id = field.did.expect_local();
-                let hir::FieldDef { ty: hir_ty, .. } =
-                    tcx.hir_node_by_def_id(field_id).expect_field();
+                let span = tcx.ty_span(field_id);
                 let ty = wfcx.deeply_normalize(
-                    hir_ty.span,
+                    span,
                     None,
                     tcx.type_of(field.did).instantiate_identity(),
                 );
-                wfcx.register_wf_obligation(
-                    hir_ty.span,
-                    Some(WellFormedLoc::Ty(field_id)),
-                    ty.into(),
-                );
+                wfcx.register_wf_obligation(span, Some(WellFormedLoc::Ty(field_id)), ty.into());
 
                 if matches!(ty.kind(), ty::Adt(def, _) if def.repr().scalable())
                     && !matches!(adt_def.repr().scalable, Some(ScalableElt::Container))
@@ -1090,7 +1082,7 @@ fn check_type_defn<'tcx>(
                     // Scalable vectors can only be fields of structs if the type has a
                     // `rustc_scalable_vector` attribute w/out specifying an element count
                     tcx.dcx().span_err(
-                        hir_ty.span,
+                        span,
                         format!(
                             "scalable vectors cannot be fields of a {}",
                             adt_def.variant_descr()
@@ -1116,35 +1108,21 @@ fn check_type_defn<'tcx>(
                 variant.fields.raw[..variant.fields.len() - unsized_len].iter().enumerate()
             {
                 let last = idx == variant.fields.len() - 1;
-                let field_id = field.did.expect_local();
-                let hir::FieldDef { ty: hir_ty, .. } =
-                    tcx.hir_node_by_def_id(field_id).expect_field();
-                let ty = wfcx.normalize(
-                    hir_ty.span,
-                    None,
-                    tcx.type_of(field.did).instantiate_identity(),
-                );
+                let span = tcx.ty_span(field.did.expect_local());
+                let ty = wfcx.normalize(span, None, tcx.type_of(field.did).instantiate_identity());
                 wfcx.register_bound(
                     traits::ObligationCause::new(
-                        hir_ty.span,
+                        span,
                         wfcx.body_def_id,
                         ObligationCauseCode::FieldSized {
-                            adt_kind: match &item.kind {
-                                ItemKind::Struct(..) => AdtKind::Struct,
-                                ItemKind::Union(..) => AdtKind::Union,
-                                ItemKind::Enum(..) => AdtKind::Enum,
-                                kind => span_bug!(
-                                    item.span,
-                                    "should be wfchecking an ADT, got {kind:?}"
-                                ),
-                            },
-                            span: hir_ty.span,
+                            adt_kind: adt_def.adt_kind(),
+                            span,
                             last,
                         },
                     ),
                     wfcx.param_env,
                     ty,
-                    tcx.require_lang_item(LangItem::Sized, hir_ty.span),
+                    tcx.require_lang_item(LangItem::Sized, span),
                 );
             }
 
@@ -1160,16 +1138,13 @@ fn check_type_defn<'tcx>(
             }
         }
 
-        check_where_clauses(wfcx, item.owner_id.def_id);
+        check_where_clauses(wfcx, item);
         Ok(())
     })
 }
 
-#[instrument(skip(tcx, item))]
-fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) -> Result<(), ErrorGuaranteed> {
-    debug!(?item.owner_id);
-
-    let def_id = item.owner_id.def_id;
+#[instrument(skip(tcx))]
+pub(crate) fn check_trait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
     if tcx.is_lang_item(def_id.into(), LangItem::PointeeSized) {
         // `PointeeSized` is removed during lowering.
         return Ok(());
@@ -1195,10 +1170,6 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) -> Result<(), ErrorGuarant
         Ok(())
     });
 
-    // Only check traits, don't check trait aliases
-    if let hir::ItemKind::Trait { .. } = item.kind {
-        check_gat_where_clauses(tcx, item.owner_id.def_id);
-    }
     res
 }
 
@@ -1535,11 +1506,7 @@ pub(super) fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, def_id:
                     | ty::ConstKind::Bound(_, _) => unreachable!(),
                     ty::ConstKind::Error(_) | ty::ConstKind::Expr(_) => continue,
                     ty::ConstKind::Value(cv) => cv.ty,
-                    ty::ConstKind::Unevaluated(uv) => infcx
-                        .tcx
-                        .type_of(uv.kind.def_id())
-                        .instantiate(infcx.tcx, uv.args)
-                        .skip_norm_wip(),
+                    ty::ConstKind::Unevaluated(uv) => uv.type_of(infcx.tcx).skip_norm_wip(),
                     ty::ConstKind::Param(param_ct) => {
                         param_ct.find_const_ty_from_env(wfcx.param_env)
                     }
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index 46efb6a..8d39934 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -630,13 +630,13 @@ fn get_new_lifetime_name<'tcx>(
     (1..).flat_map(a_to_z_repeat_n).find(|lt| !existing_lifetimes.contains(lt.as_str())).unwrap()
 }
 
-pub(super) fn lower_variant_ctor(tcx: TyCtxt<'_>, def_id: LocalDefId) {
+pub(super) fn check_ctor(tcx: TyCtxt<'_>, def_id: LocalDefId) {
     tcx.ensure_ok().generics_of(def_id);
     tcx.ensure_ok().type_of(def_id);
     tcx.ensure_ok().predicates_of(def_id);
 }
 
-pub(super) fn lower_enum_variant_types(tcx: TyCtxt<'_>, def_id: LocalDefId) {
+pub(super) fn check_enum_variant_types(tcx: TyCtxt<'_>, def_id: LocalDefId) {
     struct ReprCIssue {
         msg: &'static str,
     }
@@ -718,7 +718,7 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
 
         // Lower the ctor, if any. This also registers the variant as an item.
         if let Some(ctor_def_id) = variant.ctor_def_id() {
-            lower_variant_ctor(tcx, ctor_def_id.expect_local());
+            check_ctor(tcx, ctor_def_id.expect_local());
         }
     }
 }
diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs
index cf29a76..db22b57 100644
--- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs
+++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs
@@ -322,10 +322,6 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
                     (pred, span)
                 }))
             }
-
-            hir::WherePredicateKind::EqPredicate(..) => {
-                // FIXME(#20041)
-            }
         }
     }
 
@@ -419,8 +415,11 @@ struct ConstCollector<'tcx> {
         preds: FxIndexSet<(ty::Clause<'tcx>, Span)>,
     }
 
-    fn is_const_param_default(tcx: TyCtxt<'_>, def: LocalDefId) -> bool {
-        let hir_id = tcx.local_def_id_to_hir_id(def);
+    fn is_const_param_default(tcx: TyCtxt<'_>, kind: ty::UnevaluatedConstKind<'_>) -> bool {
+        let ty::UnevaluatedConstKind::Anon { def_id } = kind else { return false };
+        let Some(local) = def_id.as_local() else { return false };
+
+        let hir_id = tcx.local_def_id_to_hir_id(local);
         let (_, parent_node) = tcx
             .hir_parent_iter(hir_id)
             .skip_while(|(_, n)| matches!(n, Node::ConstArg(..)))
@@ -435,9 +434,7 @@ fn is_const_param_default(tcx: TyCtxt<'_>, def: LocalDefId) -> bool {
     impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ConstCollector<'tcx> {
         fn visit_const(&mut self, c: ty::Const<'tcx>) {
             if let ty::ConstKind::Unevaluated(uv) = c.kind() {
-                if let Some(local) = uv.kind.def_id().as_local()
-                    && is_const_param_default(self.tcx, local)
-                {
+                if is_const_param_default(self.tcx, uv.kind) {
                     // Do not look into const param defaults,
                     // these get checked when they are actually instantiated.
                     //
@@ -449,11 +446,11 @@ fn visit_const(&mut self, c: ty::Const<'tcx>) {
                 }
 
                 // Skip type consts as mGCA doesn't support evaluatable clauses.
-                if self.tcx.is_type_const(uv.kind.def_id()) {
+                if uv.kind.is_type_const(self.tcx) {
                     return;
                 }
 
-                let span = self.tcx.def_span(uv.kind.def_id());
+                let span = uv.kind.def_span(self.tcx);
                 self.preds.insert((ty::ClauseKind::ConstEvaluatable(c).upcast(self.tcx), span));
             }
         }
diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
index 3e48bfe..adc8be1 100644
--- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
+++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
@@ -999,12 +999,6 @@ fn visit_where_predicate(&mut self, predicate: &'tcx hir::WherePredicate<'tcx>)
                 self.visit_lifetime(lifetime);
                 walk_list!(self, visit_param_bound, bounds);
             }
-            &hir::WherePredicateKind::EqPredicate(hir::WhereEqPredicate {
-                lhs_ty, rhs_ty, ..
-            }) => {
-                self.visit_ty_unambig(lhs_ty);
-                self.visit_ty_unambig(rhs_ty);
-            }
         }
     }
 
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index b968a62..e7518e4 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -2035,3 +2035,16 @@ pub(crate) struct PinV2WithoutPinDrop {
     pub pin_v2_span: Option<Span>,
     pub adt_name: Symbol,
 }
+
+#[derive(Diagnostic)]
+#[diag("`#[pin_v2]` types may not have `#[repr(packed)]`")]
+#[note(
+    "fields of a `#[repr(packed)]` type can be under-aligned, so a structurally pinned field may be moved to a properly aligned location, which `Pin` does not allow"
+)]
+pub(crate) struct PinV2OnPacked {
+    #[primary_span]
+    pub span: Span,
+    #[note("`{$adt_name}` is marked `#[pin_v2]` here")]
+    pub pin_v2_span: Option<Span>,
+    pub adt_name: Symbol,
+}
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs
index 818c418..fea7b48 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs
@@ -434,36 +434,41 @@ pub(super) fn lower_trait_object_ty(
 
         // N.b. principal, projections, auto traits
         // FIXME: This is actually wrong with multiple principals in regards to symbol mangling
-        let mut v = principal_trait_ref
+        let mut predicates = principal_trait_ref
             .into_iter()
             .chain(existential_projections)
             .chain(auto_trait_predicates)
             .collect::<SmallVec<[_; 8]>>();
-        v.sort_by(|a, b| a.skip_binder().stable_cmp(tcx, &b.skip_binder()));
-        let existential_predicates = tcx.mk_poly_existential_predicates(&v);
+        predicates.sort_by(|a, b| a.skip_binder().stable_cmp(tcx, &b.skip_binder()));
+        let predicates = tcx.mk_poly_existential_predicates(&predicates);
 
-        // Use explicitly-specified region bound, unless the bound is missing.
-        let region_bound = if !lifetime.is_elided() {
-            self.lower_lifetime(lifetime, RegionInferReason::ExplicitObjectLifetime)
+        let region_bound = self.lower_trait_object_lifetime(lifetime, predicates, span);
+
+        Ty::new_dynamic(tcx, predicates, region_bound)
+    }
+
+    fn lower_trait_object_lifetime(
+        &self,
+        lifetime: &hir::Lifetime,
+        predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
+        span: Span,
+    ) -> ty::Region<'tcx> {
+        // Curiously, we also use the *object region bound* for `Infer` (`'_`)
+        // while we obviously don't use the *object lifetime default* for it...
+        if let hir::LifetimeKind::ImplicitObjectLifetimeDefault | hir::LifetimeKind::Infer =
+            lifetime.kind
+            && let Some(region) = self.compute_object_lifetime_bound(span, predicates)
+        {
+            return region;
+        }
+
+        let reason = if let hir::LifetimeKind::ImplicitObjectLifetimeDefault = lifetime.kind {
+            RegionInferReason::ObjectLifetimeDefault(span.shrink_to_hi())
         } else {
-            self.compute_object_lifetime_bound(span, existential_predicates).unwrap_or_else(|| {
-                // Curiously, we prefer object lifetime default for `+ '_`...
-                if tcx.named_bound_var(lifetime.hir_id).is_some() {
-                    self.lower_lifetime(lifetime, RegionInferReason::ExplicitObjectLifetime)
-                } else {
-                    let reason =
-                        if let hir::LifetimeKind::ImplicitObjectLifetimeDefault = lifetime.kind {
-                            RegionInferReason::ObjectLifetimeDefault(span.shrink_to_hi())
-                        } else {
-                            RegionInferReason::ExplicitObjectLifetime
-                        };
-                    self.re_infer(span, reason)
-                }
-            })
+            RegionInferReason::ExplicitObjectLifetime
         };
-        debug!(?region_bound);
 
-        Ty::new_dynamic(tcx, existential_predicates, region_bound)
+        self.lower_lifetime(lifetime, reason)
     }
 
     /// Check that elaborating the principal of a trait ref doesn't lead to projections
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index 637ae11..b01821a 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -716,7 +716,7 @@ fn print_item(&mut self, item: &hir::Item<'_>) {
 
                 match of_trait {
                     None => {
-                        if let hir::Constness::Const = constness {
+                        if let hir::Constness::Const { always: false } = constness {
                             self.word_nbsp("const");
                         }
                         impl_generics(self)
@@ -733,7 +733,7 @@ fn print_item(&mut self, item: &hir::Item<'_>) {
 
                         impl_generics(self);
 
-                        if let hir::Constness::Const = constness {
+                        if let hir::Constness::Const { always: false } = constness {
                             self.word_nbsp("const");
                         }
 
@@ -2530,14 +2530,6 @@ fn print_where_predicate(&mut self, predicate: &hir::WherePredicate<'_>) {
                     }
                 }
             }
-            hir::WherePredicateKind::EqPredicate(hir::WhereEqPredicate {
-                lhs_ty, rhs_ty, ..
-            }) => {
-                self.print_type(lhs_ty);
-                self.space();
-                self.word_space("=");
-                self.print_type(rhs_ty);
-            }
         }
     }
 
@@ -2631,7 +2623,8 @@ fn print_fn_header_info(&mut self, header: hir::FnHeader) {
     fn print_constness(&mut self, s: hir::Constness) {
         match s {
             hir::Constness::NotConst => {}
-            hir::Constness::Const => self.word_nbsp("const"),
+            hir::Constness::Const { always: false } => self.word_nbsp("const"),
+            hir::Constness::Const { always: true } => { /* printed as an attribute */ }
         }
     }
 
diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs
index 7d68709..430e934 100644
--- a/compiler/rustc_hir_typeck/src/callee.rs
+++ b/compiler/rustc_hir_typeck/src/callee.rs
@@ -205,6 +205,7 @@ pub(crate) fn check_call_abi(&self, abi: ExternAbi, span: Span) {
             | CanonAbi::Rust
             | CanonAbi::RustCold
             | CanonAbi::RustPreserveNone
+            | CanonAbi::RustTail
             | CanonAbi::Swift
             | CanonAbi::Arm(_)
             | CanonAbi::X86(_) => {}
@@ -1023,6 +1024,17 @@ pub(super) fn enforce_context_effects(
         callee_did: DefId,
         callee_args: GenericArgsRef<'tcx>,
     ) {
+        let const_context = self.tcx.hir_body_const_context(self.body_id);
+
+        if let hir::Constness::Const { always: true } = self.tcx.constness(callee_did) {
+            match const_context {
+                Some(hir::ConstContext::Const { .. } | hir::ConstContext::Static(_)) => {}
+                Some(hir::ConstContext::ConstFn) | None => {
+                    self.dcx().span_err(span, "comptime fns can only be called at compile time");
+                }
+            }
+        }
+
         // FIXME(const_trait_impl): We should be enforcing these effects unconditionally.
         // This can be done as soon as we convert the standard library back to
         // using const traits, since if we were to enforce these conditions now,
@@ -1036,7 +1048,7 @@ pub(super) fn enforce_context_effects(
             return;
         }
 
-        let host = match self.tcx.hir_body_const_context(self.body_id) {
+        let host = match const_context {
             Some(hir::ConstContext::Const { .. } | hir::ConstContext::Static(_)) => {
                 ty::BoundConstness::Const
             }
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs
index 652f049..1876dd4 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs
@@ -38,10 +38,10 @@ fn predicate_has_self_ty(
     ) -> bool {
         match predicate.kind().skip_binder() {
             ty::PredicateKind::Clause(ty::ClauseKind::Trait(data)) => {
-                self.type_matches_expected_vid(expected_vid, data.self_ty())
+                self.type_matches_expected_vid(data.self_ty(), expected_vid)
             }
             ty::PredicateKind::Clause(ty::ClauseKind::Projection(data)) => {
-                self.type_matches_expected_vid(expected_vid, data.projection_term.self_ty())
+                self.type_matches_expected_vid(data.projection_term.self_ty(), expected_vid)
             }
             ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(..))
             | ty::PredicateKind::Subtype(..)
@@ -61,7 +61,7 @@ fn predicate_has_self_ty(
     }
 
     #[instrument(level = "debug", skip(self), ret)]
-    fn type_matches_expected_vid(&self, expected_vid: ty::TyVid, ty: Ty<'tcx>) -> bool {
+    fn type_matches_expected_vid(&self, ty: Ty<'tcx>, expected_vid: ty::TyVid) -> bool {
         let ty = self.shallow_resolve(ty);
         debug!(?ty);
 
@@ -77,7 +77,18 @@ pub(crate) fn obligations_for_self_ty_next(
         &self,
         self_ty: ty::TyVid,
     ) -> PredicateObligations<'tcx> {
-        let obligations = self.fulfillment_cx.borrow().pending_obligations();
+        // We only look at obligations which may reference the self type.
+        // This lookup uses the `sub_root` instead of the inference variable
+        // itself as that's slightly nicer to implement. It shouldn't really
+        // matter.
+        //
+        // This is really impactful when typechecking functions with a lot of
+        // stalled obligations, e.g. in the `wg-grammar` benchmark.
+        let sub_root_var = self.sub_unification_table_root_var(self_ty);
+        let obligations = self
+            .fulfillment_cx
+            .borrow()
+            .pending_obligations_potentially_referencing_sub_root(&self.infcx, sub_root_var);
         debug!(?obligations);
         let mut obligations_for_self_ty = PredicateObligations::new();
         for obligation in obligations {
@@ -189,6 +200,18 @@ fn visit_goal(&mut self, inspect_goal: &InspectGoal<'_, 'tcx>) {
             return;
         }
 
+        // We don't care about any pending goals which don't actually
+        // use the self type.
+        if !inspect_goal
+            .orig_values()
+            .iter()
+            .filter_map(|arg| arg.as_type())
+            .any(|ty| self.fcx.type_matches_expected_vid(ty, self.self_ty))
+        {
+            debug!(goal = ?inspect_goal.goal(), "goal does not mention self type");
+            return;
+        }
+
         let tcx = self.fcx.tcx;
         let goal = inspect_goal.goal();
         if self.fcx.predicate_has_self_ty(goal.predicate, self.self_ty) {
diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs
index c9ec321..941f62e 100644
--- a/compiler/rustc_hir_typeck/src/method/suggest.rs
+++ b/compiler/rustc_hir_typeck/src/method/suggest.rs
@@ -917,6 +917,30 @@ fn suggest_unsatisfied_ty_or_trait(
                     "`count` is defined on `{iterator_trait}`, which `{rcvr_ty}` does not implement"
                 ));
             }
+        } else if matches!(item_ident.name.as_str(), "cloned" | "copied")
+            && let ty::Adt(adt_def, args) = rcvr_ty.kind()
+            && tcx.is_diagnostic_item(sym::Option, adt_def.did())
+            && let inner_ty = args.type_at(0)
+            // Skip refs (`Option<&T>.into_iter().cloned()` is valid, let the default branch
+            // handle it), and params/infer where we can't statically rule out a reference.
+            && !matches!(inner_ty.kind(), ty::Ref(..) | ty::Param(_) | ty::Infer(_))
+        {
+            // The default branch below would suggest `.into_iter()`, but that still
+            // fails: `Option<T>` yields `T` by value, not `&T`, so `.cloned()`/`.copied()`
+            // can't resolve. Give a targeted diagnostic instead.
+            err.span_label(span, format!("this method is only available on `Option<&_>`"));
+            if let SelfSource::MethodCall(rcvr_expr) = source
+                && !span.in_external_macro(tcx.sess.source_map())
+            {
+                let call_expr = self.tcx.hir_expect_expr(self.tcx.parent_hir_id(rcvr_expr.hir_id));
+                err.span_suggestion(
+                    rcvr_expr.span.shrink_to_hi().to(call_expr.span.shrink_to_hi()),
+                    format!("consider removing the `.{}()` call", item_ident.name),
+                    "",
+                    Applicability::MaybeIncorrect,
+                );
+            }
+            return Err(());
         } else if self.impl_into_iterator_should_be_iterator(rcvr_ty, span, unsatisfied_predicates)
         {
             err.span_label(span, format!("`{rcvr_ty}` is not an iterator"));
@@ -4796,7 +4820,24 @@ fn detect_and_explain_multiple_crate_versions_of_trait_item(
         let hir::Node::Expr(rcvr) = self.tcx.hir_node(hir_id) else {
             return false;
         };
-        let trait_ref = ty::TraitRef::new(self.tcx, trait_def_id, rcvr_ty.into_iter());
+        // The trait may have generic parameters beyond `Self` (e.g. `Borrow<Borrowed>`), and
+        // `rcvr_ty` may even be unknown. We only ever know the receiver type (the `Self` arg),
+        // so fill `Self` from `rcvr_ty` when available and the remaining parameters with fresh
+        // inference variables; building a `TraitRef` with a partial arg list would otherwise trip
+        // `debug_assert_args_compatible` and ICE. See #157189.
+        let trait_ref = ty::TraitRef::new_from_args(
+            self.tcx,
+            trait_def_id,
+            ty::GenericArgs::for_item(self.tcx, trait_def_id, |param, _| {
+                if param.index == 0
+                    && let Some(rcvr_ty) = rcvr_ty
+                {
+                    rcvr_ty.into()
+                } else {
+                    self.var_for_def(rcvr.span, param)
+                }
+            }),
+        );
         let trait_pred = ty::Binder::dummy(ty::TraitPredicate {
             trait_ref,
             polarity: ty::PredicatePolarity::Positive,
diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs
index ab695dd..69705f2 100644
--- a/compiler/rustc_incremental/src/persist/save.rs
+++ b/compiler/rustc_incremental/src/persist/save.rs
@@ -1,8 +1,7 @@
 use std::fs;
 
-use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::sync::par_join;
-use rustc_middle::dep_graph::{DepGraph, WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::{DepGraph, WorkProductMap};
 use rustc_middle::query::on_disk_cache;
 use rustc_middle::ty::TyCtxt;
 use rustc_serialize::Encodable as RustcEncodable;
@@ -93,7 +92,7 @@ pub(crate) fn save_dep_graph(tcx: TyCtxt<'_>) {
 pub fn save_work_product_index(
     sess: &Session,
     dep_graph: &DepGraph,
-    new_work_products: FxIndexMap<WorkProductId, WorkProduct>,
+    new_work_products: WorkProductMap,
 ) {
     if sess.opts.incremental.is_none() {
         return;
@@ -126,18 +125,16 @@ pub fn save_work_product_index(
 
     // Check that we did not delete one of the current work-products:
     debug_assert!({
-        new_work_products.iter().all(|(_, wp)| {
+        new_work_products.items().all(|(_, wp)| {
             wp.saved_files.items().all(|(_, path)| in_incr_comp_dir_sess(sess, path).exists())
         })
     });
 }
 
-fn encode_work_product_index(
-    work_products: &FxIndexMap<WorkProductId, WorkProduct>,
-    encoder: &mut FileEncoder,
-) {
+fn encode_work_product_index(work_products: &WorkProductMap, encoder: &mut FileEncoder) {
     let serialized_products: Vec<_> = work_products
-        .iter()
+        .to_sorted_stable_ord()
+        .into_iter()
         .map(|(id, work_product)| SerializedWorkProduct {
             id: *id,
             work_product: work_product.clone(),
diff --git a/compiler/rustc_incremental/src/persist/work_product.rs b/compiler/rustc_incremental/src/persist/work_product.rs
index 7b1eb0a..64dae5c 100644
--- a/compiler/rustc_incremental/src/persist/work_product.rs
+++ b/compiler/rustc_incremental/src/persist/work_product.rs
@@ -16,14 +16,16 @@
 
 /// Copies a CGU work product to the incremental compilation directory, so next compilation can
 /// find and reuse it.
+///
+/// Panics when incr comp is disabled.
 pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
     sess: &Session,
     cgu_name: &str,
     files: &[(&'static str, &Path)],
     known_links: &[PathBuf],
-) -> Option<(WorkProductId, WorkProduct)> {
+) -> (WorkProductId, WorkProduct) {
     debug!(?cgu_name, ?files);
-    sess.opts.incremental.as_ref()?;
+    assert!(sess.opts.incremental.is_some());
 
     let mut saved_files = UnordMap::default();
     for (ext, path) in files {
@@ -50,7 +52,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
     let work_product = WorkProduct { cgu_name: cgu_name.to_string(), saved_files };
     debug!(?work_product);
     let work_product_id = WorkProductId::from_cgu_name(cgu_name);
-    Some((work_product_id, work_product))
+    (work_product_id, work_product)
 }
 
 /// Removes files for a given work product.
diff --git a/compiler/rustc_infer/src/infer/canonical/query_response.rs b/compiler/rustc_infer/src/infer/canonical/query_response.rs
index 98763ff..5641523 100644
--- a/compiler/rustc_infer/src/infer/canonical/query_response.rs
+++ b/compiler/rustc_infer/src/infer/canonical/query_response.rs
@@ -13,7 +13,7 @@
 use rustc_index::{Idx, IndexVec};
 use rustc_middle::arena::ArenaAllocatable;
 use rustc_middle::bug;
-use rustc_middle::infer::canonical::CanonicalVarKind;
+use rustc_middle::infer::canonical::{CanonicalVarKind, QueryRegionConstraint};
 use rustc_middle::ty::{self, BoundVar, GenericArg, GenericArgKind, Ty, TyCtxt, TypeFoldable};
 use tracing::{debug, instrument};
 
@@ -188,7 +188,9 @@ pub fn instantiate_query_response_and_region_obligations<R>(
         let InferOk { value: result_args, obligations } =
             self.query_response_instantiation(cause, param_env, original_values, query_response)?;
 
-        for (constraint, _category, vis) in &query_response.value.region_constraints.constraints {
+        for QueryRegionConstraint { constraint, visible_for_leak_check: vis, .. } in
+            &query_response.value.region_constraints.constraints
+        {
             let constraint = instantiate_value(self.tcx, &result_args, *constraint);
             match constraint {
                 ty::RegionConstraint::Outlives(predicate) => {
@@ -285,11 +287,12 @@ pub fn instantiate_nll_query_response_and_region_obligations<R>(
 
                 (GenericArgKind::Lifetime(v_o), GenericArgKind::Lifetime(v_r)) => {
                     if v_o != v_r {
-                        output_query_region_constraints.constraints.push((
-                            ty::RegionEqPredicate(v_o, v_r).into(),
-                            constraint_category,
-                            ty::VisibleForLeakCheck::Yes,
-                        ));
+                        let constraint = QueryRegionConstraint {
+                            constraint: ty::RegionEqPredicate(v_o, v_r).into(),
+                            category: constraint_category,
+                            visible_for_leak_check: ty::VisibleForLeakCheck::Yes,
+                        };
+                        output_query_region_constraints.constraints.push(constraint);
                     }
                 }
 
@@ -321,7 +324,7 @@ pub fn instantiate_nll_query_response_and_region_obligations<R>(
                 let r_c = instantiate_value(self.tcx, &result_args, r_c);
 
                 // Screen out `'a: 'a` or `'a == 'a` cases.
-                if r_c.0.is_trivial() { None } else { Some(r_c) }
+                if r_c.constraint.is_trivial() { None } else { Some(r_c) }
             }),
         );
 
@@ -616,7 +619,7 @@ pub fn make_query_region_constraints<'tcx>(
 
     debug!(?constraints);
 
-    let constraints: Vec<_> = constraints
+    let constraints: Vec<QueryRegionConstraint<'tcx>> = constraints
         .iter()
         .map(|(c, origin)| match c.kind {
             ConstraintKind::VarSubVar
@@ -625,22 +628,30 @@ pub fn make_query_region_constraints<'tcx>(
             | ConstraintKind::RegSubReg => {
                 // Swap regions because we are going from sub (<=) to outlives (>=).
                 let constraint = ty::OutlivesPredicate(c.sup.into(), c.sub).into();
-                (constraint, origin.to_constraint_category(), c.visible_for_leak_check)
+                QueryRegionConstraint {
+                    constraint,
+                    category: origin.to_constraint_category(),
+                    visible_for_leak_check: c.visible_for_leak_check,
+                }
             }
 
             ConstraintKind::VarEqVar | ConstraintKind::VarEqReg | ConstraintKind::RegEqReg => {
                 let constraint = ty::RegionEqPredicate(c.sup, c.sub).into();
-                (constraint, origin.to_constraint_category(), c.visible_for_leak_check)
+                QueryRegionConstraint {
+                    constraint,
+                    category: origin.to_constraint_category(),
+                    visible_for_leak_check: c.visible_for_leak_check,
+                }
             }
         })
         .chain(outlives_obligations.into_iter().map(
             |TypeOutlivesConstraint { sub_region, sup_type, origin }| {
-                (
-                    ty::OutlivesPredicate(sup_type.into(), sub_region).into(),
-                    origin.to_constraint_category(),
+                QueryRegionConstraint {
+                    constraint: ty::OutlivesPredicate(sup_type.into(), sub_region).into(),
+                    category: origin.to_constraint_category(),
                     // We don't do leak checks for type outlives
-                    ty::VisibleForLeakCheck::Unreachable,
-                )
+                    visible_for_leak_check: ty::VisibleForLeakCheck::Unreachable,
+                }
             },
         ))
         .collect();
diff --git a/compiler/rustc_infer/src/traits/engine.rs b/compiler/rustc_infer/src/traits/engine.rs
index 39fff48..38fc991 100644
--- a/compiler/rustc_infer/src/traits/engine.rs
+++ b/compiler/rustc_infer/src/traits/engine.rs
@@ -1,7 +1,7 @@
 use std::fmt::Debug;
 
 use rustc_hir::def_id::DefId;
-use rustc_middle::ty::{self, Ty, Upcast};
+use rustc_middle::ty::{self, Ty, TyVid, Upcast};
 
 use super::{ObligationCause, PredicateObligation, PredicateObligations};
 use crate::infer::InferCtxt;
@@ -108,6 +108,18 @@ fn evaluate_obligations_error_on_ambiguity(&mut self, infcx: &InferCtxt<'tcx>) -
 
     fn pending_obligations(&self) -> PredicateObligations<'tcx>;
 
+    /// Pending obligations potentially referencing an inference variable whose
+    /// sub-unification root is `_sub_root`. May be conservative: implementations
+    /// can return obligations that don't actually reference `_sub_root` (the
+    /// default just returns everything).
+    fn pending_obligations_potentially_referencing_sub_root(
+        &self,
+        _infcx: &InferCtxt<'tcx>,
+        _sub_root: TyVid,
+    ) -> PredicateObligations<'tcx> {
+        self.pending_obligations()
+    }
+
     /// Among all pending obligations, collect those are stalled on a inference variable which has
     /// changed since the last call to `try_evaluate_obligations`. Those obligations are marked as
     /// successful and returned.
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs
index 20ac6e2..6026cfd 100644
--- a/compiler/rustc_interface/src/queries.rs
+++ b/compiler/rustc_interface/src/queries.rs
@@ -3,12 +3,11 @@
 
 use rustc_codegen_ssa::traits::CodegenBackend;
 use rustc_codegen_ssa::{CompiledModules, CrateInfo};
-use rustc_data_structures::indexmap::IndexMap;
 use rustc_data_structures::svh::Svh;
 use rustc_errors::timings::TimingSection;
 use rustc_hir::def_id::LOCAL_CRATE;
 use rustc_metadata::EncodedMetadata;
-use rustc_middle::dep_graph::DepGraph;
+use rustc_middle::dep_graph::{DepGraph, WorkProductMap};
 use rustc_middle::ty::TyCtxt;
 use rustc_session::Session;
 use rustc_session::config::{self, OutputFilenames, OutputType};
@@ -51,7 +50,7 @@ pub fn link(self, sess: &Session, codegen_backend: &dyn CodegenBackend) {
         let (compiled_modules, mut work_products) = sess.time("finish_ongoing_codegen", || {
             match self.ongoing_codegen.downcast::<CompiledModules>() {
                 // This was a check only build
-                Ok(compiled_modules) => (*compiled_modules, IndexMap::default()),
+                Ok(compiled_modules) => (*compiled_modules, WorkProductMap::default()),
 
                 Err(ongoing_codegen) => codegen_backend.join_codegen(
                     ongoing_codegen,
@@ -90,14 +89,13 @@ pub fn link(self, sess: &Session, codegen_backend: &dyn CodegenBackend) {
 
         if sess.opts.incremental.is_some()
             && let Some(path) = self.metadata.path()
-            && let Some((id, product)) =
-                rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
-                    sess,
-                    "metadata",
-                    &[("rmeta", path)],
-                    &[],
-                )
         {
+            let (id, product) = rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
+                sess,
+                "metadata",
+                &[("rmeta", path)],
+                &[],
+            );
             work_products.insert(id, product);
         }
 
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs
index b926f10..622077c 100644
--- a/compiler/rustc_interface/src/tests.rs
+++ b/compiler/rustc_interface/src/tests.rs
@@ -866,6 +866,7 @@ macro_rules! tracked {
     tracked!(split_lto_unit, Some(true));
     tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));
     tracked!(stack_protector, StackProtector::All);
+    tracked!(staticlib_hide_internal_symbols, true);
     tracked!(teach, true);
     tracked!(thinlto, Some(true));
     tracked!(tiny_const_eval_limit, true);
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs
index d7d3069..6e74ec6 100644
--- a/compiler/rustc_interface/src/util.rs
+++ b/compiler/rustc_interface/src/util.rs
@@ -14,11 +14,10 @@
 use rustc_codegen_ssa::traits::CodegenBackend;
 use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig};
 use rustc_data_structures::base_n::{CASE_INSENSITIVE, ToBaseN};
-use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::jobserver::Proxy;
 use rustc_data_structures::sync;
 use rustc_metadata::{DylibError, EncodedMetadata, load_symbol_from_dylib};
-use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::WorkProductMap;
 use rustc_middle::ty::{CurrentGcx, TyCtxt};
 use rustc_query_impl::{CollectActiveJobsKind, collect_active_query_jobs};
 use rustc_session::config::{
@@ -418,8 +417,8 @@ fn join_codegen(
         _sess: &Session,
         _outputs: &OutputFilenames,
         _crate_info: &CrateInfo,
-    ) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
-        (*ongoing_codegen.downcast().unwrap(), FxIndexMap::default())
+    ) -> (CompiledModules, WorkProductMap) {
+        (*ongoing_codegen.downcast().unwrap(), WorkProductMap::default())
     }
 
     fn link(
@@ -471,7 +470,7 @@ fn create_dll_import_lib(
         output_path: &Path,
     ) {
         // Build an empty static library to avoid calling an external dlltool on mingw
-        ArArchiveBuilderBuilder.new_archive_builder(sess).build(output_path);
+        ArArchiveBuilderBuilder.new_archive_builder(sess).build(output_path, None);
     }
 }
 
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 2c7ccfb..5e239ad 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -47,7 +47,7 @@
 use rustc_trait_selection::traits::misc::type_allowed_to_implement_copy;
 use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
 
-use crate::errors::BuiltinEllipsisInclusiveRangePatterns;
+use crate::diagnostics::BuiltinEllipsisInclusiveRangePatterns;
 use crate::lints::{
     BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDerefNullptr, BuiltinDoubleNegations,
     BuiltinDoubleNegationsAddParens, BuiltinEllipsisInclusiveRangePatternsLint,
@@ -2141,7 +2141,6 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
                                 }
                             }
                         }
-                        _ => continue,
                     };
                 if relevant_lifetimes.is_empty() {
                     continue;
diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/diagnostics.rs
similarity index 100%
rename from compiler/rustc_lint/src/errors.rs
rename to compiler/rustc_lint/src/diagnostics.rs
diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs
index 00ae385..b7c24b9 100644
--- a/compiler/rustc_lint/src/levels.rs
+++ b/compiler/rustc_lint/src/levels.rs
@@ -31,7 +31,7 @@
 
 use crate::builtin::MISSING_DOCS;
 use crate::context::{CheckLintNameResult, LintStore};
-use crate::errors::{
+use crate::diagnostics::{
     CheckNameUnknownTool, MalformedAttribute, MalformedAttributeSub, OverruledAttribute,
     OverruledAttributeSub, RequestedLevel, UnknownToolInScopedLint, UnsupportedGroup,
 };
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index 1efc8b7..2a2f01a 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -36,11 +36,11 @@
 mod dangling;
 mod default_could_be_derived;
 mod deref_into_dyn_supertrait;
+mod diagnostics;
 mod disallowed_pass_by_ref;
 mod drop_forget_useless;
 mod early;
 mod enum_intrinsics_non_enums;
-mod errors;
 mod expect;
 mod for_loops_over_fallibles;
 mod foreign_modules;
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs
index 227a413..a77ee59 100644
--- a/compiler/rustc_lint/src/lints.rs
+++ b/compiler/rustc_lint/src/lints.rs
@@ -21,7 +21,7 @@
 
 use crate::LateContext;
 use crate::builtin::{InitError, ShorthandAssocTyCollector, TypeAliasBounds};
-use crate::errors::{OverruledAttributeSub, RequestedLevel};
+use crate::diagnostics::{OverruledAttributeSub, RequestedLevel};
 use crate::lifetime_syntax::LifetimeSyntaxCategories;
 
 // array_into_iter.rs
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index 8a6caa9..5dcaa5f 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -49,9 +49,6 @@
 #include "llvm/Transforms/Instrumentation/RealtimeSanitizer.h"
 #include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
 #include "llvm/Transforms/Scalar/AnnotationRemarks.h"
-#if LLVM_VERSION_GE(23, 0)
-#include "llvm/Transforms/Utils/AssignGUID.h"
-#endif
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
 #include "llvm/Transforms/Utils/FunctionImportUtils.h"
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
@@ -918,9 +915,6 @@
   if (NeedThinLTOBufferPasses) {
     MPM.addPass(CanonicalizeAliasesPass());
     MPM.addPass(NameAnonGlobalPass());
-#if LLVM_VERSION_GE(23, 0)
-    MPM.addPass(AssignGUIDPass());
-#endif
   }
   // For `-Copt-level=0`, and the pre-link fat/thin LTO stages.
   if (ThinLTOBufferRef && *ThinLTOBufferRef == nullptr) {
@@ -1460,9 +1454,6 @@
         PB.registerLoopAnalyses(LAM);
         PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
         ModulePassManager MPM;
-#if LLVM_VERSION_GE(23, 0)
-        MPM.addPass(AssignGUIDPass());
-#endif
         MPM.addPass(ThinLTOBitcodeWriterPass(OS, nullptr));
         MPM.run(*unwrap(M), MAM);
       } else {
@@ -1512,12 +1503,19 @@
   DenseSet<GlobalValue::GUID> CfiFunctionDecls;
 
   // Based on the 'InProcessThinBackend' constructor in LLVM
+#if LLVM_VERSION_GE(23, 0)
+  CfiFunctionDefs.insert_range(
+      Data->Index.cfiFunctionDefs().getExportedThinLTOGUIDs());
+  CfiFunctionDecls.insert_range(
+      Data->Index.cfiFunctionDecls().getExportedThinLTOGUIDs());
+#else
   for (auto &Name : Data->Index.cfiFunctionDefs().symbols())
     CfiFunctionDefs.insert(GlobalValue::getGUIDAssumingExternalLinkage(
         GlobalValue::dropLLVMManglingEscape(Name)));
   for (auto &Name : Data->Index.cfiFunctionDecls().symbols())
     CfiFunctionDecls.insert(GlobalValue::getGUIDAssumingExternalLinkage(
         GlobalValue::dropLLVMManglingEscape(Name)));
+#endif
 
   Key = llvm::computeLTOCacheKey(conf, Data->Index, ModId, ImportList,
                                  ExportList, ResolvedODR, DefinedGlobals,
diff --git a/compiler/rustc_log/src/lib.rs b/compiler/rustc_log/src/lib.rs
index 7dafbd8..9976690 100644
--- a/compiler/rustc_log/src/lib.rs
+++ b/compiler/rustc_log/src/lib.rs
@@ -33,6 +33,7 @@
 //! debugging, you can make changes inside those crates and quickly run main.rs
 //! to read the debug logs.
 
+use std::cell::Cell;
 use std::env::{self, VarError};
 use std::fmt::{self, Display};
 use std::fs::File;
@@ -40,12 +41,12 @@
 use std::sync::Mutex;
 
 use tracing::dispatcher::SetGlobalDefaultError;
-use tracing::{Event, Subscriber};
+use tracing::{Event, Subscriber, span};
 use tracing_subscriber::filter::{Directive, EnvFilter, LevelFilter};
 use tracing_subscriber::fmt::FmtContext;
 use tracing_subscriber::fmt::format::{self, FmtSpan, FormatEvent, FormatFields};
 use tracing_subscriber::fmt::writer::BoxMakeWriter;
-use tracing_subscriber::layer::SubscriberExt;
+use tracing_subscriber::layer::{Context, SubscriberExt};
 use tracing_subscriber::{Layer, Registry};
 // Re-export tracing
 pub use {tracing, tracing_core, tracing_subscriber};
@@ -175,6 +176,7 @@ pub fn init_logger_with_additional_layer<F, T>(
             .with_thread_ids(verbose_thread_ids)
             .with_thread_names(verbose_thread_ids)
             .with_span_events(FmtSpan::ACTIVE);
+        let fmt_layer = NonrecursiveLayer { inner: fmt_layer };
         Layer::boxed(fmt_layer)
     } else {
         let mut layer = tracing_tree::HierarchicalLayer::default()
@@ -286,3 +288,105 @@ fn from(tracing_error: SetGlobalDefaultError) -> Self {
         Error::AlreadyInit(tracing_error)
     }
 }
+
+thread_local! {
+    static NONRECURSIVE_GUARD_LOCK: Cell<bool> = const { Cell::new(false) };
+}
+
+struct NonrecursiveGuard;
+
+impl NonrecursiveGuard {
+    fn lock() -> Option<NonrecursiveGuard> {
+        if !NONRECURSIVE_GUARD_LOCK.replace(true) { Some(NonrecursiveGuard) } else { None }
+    }
+}
+
+impl Drop for NonrecursiveGuard {
+    fn drop(&mut self) {
+        NONRECURSIVE_GUARD_LOCK.set(false);
+    }
+}
+
+/// Many debug messages that rustc emits produce additional debug messages when formatting the
+/// arguments to the original debug message. [`tracing_tree::HierarchicalLayer`] (used by the
+/// default output format) filters these out, but [`tracing_subscriber::fmt::format::Json`] (used by
+/// `RUSTC_LOG_FORMAT_JSON`) does not. So, implement a simple recursion check to filter these
+/// messages out.
+struct NonrecursiveLayer<S> {
+    inner: S,
+}
+
+impl<S: Subscriber, L: Layer<S>> Layer<S> for NonrecursiveLayer<L> {
+    fn on_register_dispatch(&self, subscriber: &tracing::Dispatch) {
+        self.inner.on_register_dispatch(subscriber)
+    }
+
+    fn on_layer(&mut self, subscriber: &mut S) {
+        self.inner.on_layer(subscriber)
+    }
+
+    fn register_callsite(
+        &self,
+        metadata: &'static tracing::Metadata<'static>,
+    ) -> tracing_core::Interest {
+        self.inner.register_callsite(metadata)
+    }
+
+    fn enabled(&self, metadata: &tracing::Metadata<'_>, ctx: Context<'_, S>) -> bool {
+        self.inner.enabled(metadata, ctx)
+    }
+
+    fn on_new_span(&self, attrs: &span::Attributes<'_>, id: &span::Id, ctx: Context<'_, S>) {
+        if let Some(_) = NonrecursiveGuard::lock() {
+            self.inner.on_new_span(attrs, id, ctx)
+        }
+    }
+
+    fn on_record(&self, span: &span::Id, values: &span::Record<'_>, ctx: Context<'_, S>) {
+        if let Some(_) = NonrecursiveGuard::lock() {
+            self.inner.on_record(span, values, ctx)
+        }
+    }
+
+    fn on_follows_from(&self, span: &span::Id, follows: &span::Id, ctx: Context<'_, S>) {
+        if let Some(_) = NonrecursiveGuard::lock() {
+            self.inner.on_follows_from(span, follows, ctx)
+        }
+    }
+
+    fn event_enabled(&self, event: &Event<'_>, ctx: Context<'_, S>) -> bool {
+        if let Some(_) = NonrecursiveGuard::lock() {
+            self.inner.event_enabled(event, ctx)
+        } else {
+            false
+        }
+    }
+
+    fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>) {
+        if let Some(_) = NonrecursiveGuard::lock() {
+            self.inner.on_event(event, ctx)
+        }
+    }
+
+    fn on_enter(&self, id: &span::Id, ctx: Context<'_, S>) {
+        if let Some(_) = NonrecursiveGuard::lock() {
+            self.inner.on_enter(id, ctx)
+        }
+    }
+
+    fn on_exit(&self, id: &span::Id, ctx: Context<'_, S>) {
+        if let Some(_) = NonrecursiveGuard::lock() {
+            self.inner.on_exit(id, ctx)
+        }
+    }
+
+    fn on_close(&self, id: span::Id, ctx: Context<'_, S>) {
+        if let Some(_) = NonrecursiveGuard::lock() {
+            self.inner.on_close(id, ctx)
+        }
+    }
+
+    fn on_id_change(&self, old: &span::Id, new: &span::Id, ctx: Context<'_, S>) {
+        self.inner.on_id_change(old, new, ctx)
+    }
+}
diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs
index 3082af3..d18764b 100644
--- a/compiler/rustc_metadata/src/creader.rs
+++ b/compiler/rustc_metadata/src/creader.rs
@@ -23,7 +23,7 @@
 use rustc_middle::bug;
 use rustc_middle::ty::data_structures::IndexSet;
 use rustc_middle::ty::{TyCtxt, TyCtxtFeed};
-use rustc_proc_macro::bridge::client::ProcMacro;
+use rustc_proc_macro::bridge::client::Client as ProcMacroClient;
 use rustc_session::config::mitigation_coverage::DeniedPartialMitigationLevel;
 use rustc_session::config::{
     CrateType, ExtendedTargetModifierInfo, ExternLocation, Externs, OptionsTargetModifiers,
@@ -951,12 +951,13 @@ fn dlsym_proc_macros(
         sess: &Session,
         path: &Path,
         stable_crate_id: StableCrateId,
-    ) -> Result<&'static [ProcMacro], CrateError> {
+    ) -> Result<&'static [ProcMacroClient], CrateError> {
         let sym_name = sess.generate_proc_macro_decls_symbol(stable_crate_id);
         debug!("trying to dlsym proc_macros {} for symbol `{}`", path.display(), sym_name);
 
         unsafe {
-            let result = load_symbol_from_dylib::<*const &[ProcMacro]>(path, &sym_name);
+            // FIXME(bjorn3) this depends on the unstable slice memory layout
+            let result = load_symbol_from_dylib::<*const &[ProcMacroClient]>(path, &sym_name);
             match result {
                 Ok(result) => {
                     debug!("loaded dlsym proc_macros {} for symbol `{}`", path.display(), sym_name);
diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs
index 1dff574..ebaff2a 100644
--- a/compiler/rustc_metadata/src/lib.rs
+++ b/compiler/rustc_metadata/src/lib.rs
@@ -1,5 +1,6 @@
 // tidy-alphabetical-start
 #![allow(internal_features)]
+#![cfg_attr(bootstrap, feature(result_option_map_or_default))]
 #![feature(error_iter)]
 #![feature(file_buffered)]
 #![feature(gen_blocks)]
@@ -7,7 +8,6 @@
 #![feature(min_specialization)]
 #![feature(never_type)]
 #![feature(proc_macro_internals)]
-#![feature(result_option_map_or_default)]
 #![feature(strip_circumfix)]
 #![feature(trusted_len)]
 // tidy-alphabetical-end
@@ -31,4 +31,4 @@
     NativeLibSearchFallback, find_native_static_library, try_find_native_dynamic_library,
     try_find_native_static_library, walk_native_lib_search_dirs,
 };
-pub use rmeta::{EncodedMetadata, METADATA_HEADER, encode_metadata, rendered_const};
+pub use rmeta::{EncodedMetadata, METADATA_HEADER, ProcMacroKind, encode_metadata, rendered_const};
diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs
index 5af60e9..e8b78fd 100644
--- a/compiler/rustc_metadata/src/locator.rs
+++ b/compiler/rustc_metadata/src/locator.rs
@@ -236,7 +236,7 @@
 
 use crate::creader::{Library, MetadataLoader};
 use crate::errors;
-use crate::rmeta::{METADATA_HEADER, MetadataBlob, rustc_version};
+use crate::rmeta::{METADATA_HEADER, MetadataBlob, ProcMacroKind, rustc_version};
 
 #[derive(Clone)]
 pub(crate) struct CrateLocator<'a> {
@@ -821,7 +821,7 @@ fn get_metadata_section<'p>(
     crate_name: Option<Symbol>,
 ) -> Result<MetadataBlob, MetadataError<'p>> {
     if !filename.exists() {
-        return Err(MetadataError::NotPresent(filename));
+        return Err(MetadataError::NotPresent(filename.into()));
     }
     let raw_bytes = match flavor {
         CrateFlavor::Rlib => {
@@ -978,6 +978,20 @@ fn get_flavor_from_path(path: &Path) -> CrateFlavor {
     }
 }
 
+/// A function to get information about all macros inside a proc-macro crate.
+///
+/// Used by rust-analyzer-proc-macro-srv.
+pub fn get_proc_macro_info<'p>(
+    target: &Target,
+    path: &'p Path,
+    metadata_loader: &dyn MetadataLoader,
+    cfg_version: &'static str,
+) -> Result<Vec<ProcMacroKind>, MetadataError<'p>> {
+    let metadata =
+        get_metadata_section(target, CrateFlavor::Dylib, path, metadata_loader, cfg_version, None)?;
+    Ok(metadata.get_proc_macro_info())
+}
+
 // ------------------------------------------ Error reporting -------------------------------------
 
 #[derive(Clone, Debug)]
@@ -1024,9 +1038,10 @@ pub(crate) enum CrateError {
     NotFound(Symbol),
 }
 
-enum MetadataError<'a> {
+#[derive(Debug)]
+pub enum MetadataError<'a> {
     /// The file was missing.
-    NotPresent(&'a Path),
+    NotPresent(Cow<'a, Path>),
     /// The file was present and invalid.
     LoadFailure(String),
     /// The file was present, but compiled with a different rustc version.
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs
index 230ce56..1cc789f 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs
@@ -26,7 +26,7 @@
 use rustc_middle::ty::Visibility;
 use rustc_middle::ty::codec::TyDecoder;
 use rustc_middle::{bug, implement_ty_decoder};
-use rustc_proc_macro::bridge::client::ProcMacro;
+use rustc_proc_macro::bridge::client::Client as ProcMacroClient;
 use rustc_serialize::opaque::MemDecoder;
 use rustc_serialize::{Decodable, Decoder};
 use rustc_session::config::TargetModifier;
@@ -104,8 +104,8 @@ pub(crate) struct CrateMetadata {
     /// These can be introduced using either `#![rustc_coherence_is_core]`
     /// or `#[rustc_allow_incoherent_impl]`.
     incoherent_impls: FxIndexMap<SimplifiedType, LazyArray<DefIndex>>,
-    /// Proc macro descriptions for this crate, if it's a proc macro crate.
-    raw_proc_macros: Option<&'static [ProcMacro]>,
+    /// Proc macro function pointers for this crate, if it's a proc macro crate.
+    raw_proc_macros: Option<&'static [ProcMacroClient]>,
     /// Source maps for code from the crate.
     source_map_import_info: Lock<Vec<Option<ImportedSourceFile>>>,
     /// For every definition in this crate, maps its `DefPathHash` to its `DefIndex`.
@@ -930,6 +930,16 @@ fn print_item(
 
         Ok(())
     }
+
+    pub(crate) fn get_proc_macro_info(&self) -> Vec<ProcMacroKind> {
+        self.get_root()
+            .proc_macro_data
+            .unwrap()
+            .macros
+            .decode(self)
+            .map(|(_id, kind)| kind.decode(self))
+            .collect::<Vec<_>>()
+    }
 }
 
 impl CrateRoot {
@@ -976,19 +986,20 @@ fn missing(&self, descr: &str, id: DefIndex) -> ! {
         bug!("missing `{descr}` for {:?}", self.local_def_id(id))
     }
 
-    fn raw_proc_macro(&self, tcx: TyCtxt<'_>, id: DefIndex) -> &ProcMacro {
+    fn raw_proc_macro(&self, tcx: TyCtxt<'_>, id: DefIndex) -> (ProcMacroClient, ProcMacroKind) {
         // DefIndex's in root.proc_macro_data have a one-to-one correspondence
         // with items in 'raw_proc_macros'.
-        let pos = self
+        let (pos, (_id, kind)) = self
             .root
             .proc_macro_data
             .as_ref()
             .unwrap()
             .macros
             .decode((self, tcx))
-            .position(|i| i == id)
+            .enumerate()
+            .find(|(_pos, (i, _))| *i == id)
             .unwrap();
-        &self.raw_proc_macros.unwrap()[pos]
+        (self.raw_proc_macros.unwrap()[pos], kind.decode((self, tcx)))
     }
 
     fn opt_item_name(&self, item_index: DefIndex) -> Option<Symbol> {
@@ -1046,20 +1057,20 @@ fn get_span(&self, tcx: TyCtxt<'_>, index: DefIndex) -> Span {
     }
 
     fn load_proc_macro<'tcx>(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> SyntaxExtension {
-        let (name, kind, helper_attrs) = match *self.raw_proc_macro(tcx, id) {
-            ProcMacro::CustomDerive { trait_name, attributes, client } => {
+        let (name, kind, helper_attrs) = match self.raw_proc_macro(tcx, id) {
+            (client, ProcMacroKind::CustomDerive { trait_name, attributes }) => {
                 let helper_attrs =
-                    attributes.iter().cloned().map(Symbol::intern).collect::<Vec<_>>();
+                    attributes.into_iter().map(|attr| Symbol::intern(&attr)).collect();
                 (
                     trait_name,
                     SyntaxExtensionKind::Derive(Arc::new(DeriveProcMacro { client })),
                     helper_attrs,
                 )
             }
-            ProcMacro::Attr { name, client } => {
+            (client, ProcMacroKind::Attr { name }) => {
                 (name, SyntaxExtensionKind::Attr(Arc::new(AttrProcMacro { client })), Vec::new())
             }
-            ProcMacro::Bang { name, client } => {
+            (client, ProcMacroKind::Bang { name }) => {
                 (name, SyntaxExtensionKind::Bang(Arc::new(BangProcMacro { client })), Vec::new())
             }
         };
@@ -1072,7 +1083,7 @@ fn load_proc_macro<'tcx>(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> SyntaxExtens
             self.get_span(tcx, id),
             helper_attrs,
             self.root.edition,
-            Symbol::intern(name),
+            Symbol::intern(&name),
             &attrs,
             false,
         )
@@ -1269,7 +1280,7 @@ fn get_module_children(&self, tcx: TyCtxt<'_>, id: DefIndex) -> impl Iterator<It
                 // If we are loading as a proc macro, we want to return
                 // the view of this crate as a proc macro crate.
                 if id == CRATE_DEF_INDEX {
-                    for child_index in data.macros.decode((self, tcx)) {
+                    for (child_index, _) in data.macros.decode((self, tcx)) {
                         yield self.get_mod_child(tcx, child_index);
                     }
                 }
@@ -1872,7 +1883,7 @@ pub(crate) fn new(
         tcx: TyCtxt<'_>,
         blob: MetadataBlob,
         root: CrateRoot,
-        raw_proc_macros: Option<&'static [ProcMacro]>,
+        raw_proc_macros: Option<&'static [ProcMacroClient]>,
         cnum: CrateNum,
         cnum_map: CrateNumMap,
         dep_kind: CrateDepKind,
@@ -2022,7 +2033,7 @@ pub(crate) fn proc_macros_for_crate(
     ) -> impl Iterator<Item = DefId> {
         gen move {
             for def_id in self.root.proc_macro_data.as_ref().into_iter().flat_map(move |data| {
-                data.macros.decode((self, tcx)).map(move |index| DefId { index, krate })
+                data.macros.decode((self, tcx)).map(move |(index, _)| DefId { index, krate })
             }) {
                 yield def_id;
             }
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs
index 1483de5..7a6c94e 100644
--- a/compiler/rustc_metadata/src/rmeta/encoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/encoder.rs
@@ -1984,8 +1984,6 @@ fn encode_proc_macros(&mut self) -> Option<ProcMacroData> {
             let tcx = self.tcx;
             let proc_macro_decls_static = tcx.proc_macro_decls_static(()).unwrap().local_def_index;
             let stability = tcx.lookup_stability(CRATE_DEF_ID);
-            let macros =
-                self.lazy_array(tcx.resolutions(()).proc_macros.iter().map(|p| p.local_def_index));
             for (i, span) in self.tcx.sess.proc_macro_quoted_spans() {
                 let span = self.lazy(span);
                 self.tables.proc_macro_quoted_spans.set_some(i, span);
@@ -2007,6 +2005,8 @@ fn encode_proc_macros(&mut self) -> Option<ProcMacroData> {
                 record_array!(self.tables.doc_link_traits_in_scope[LOCAL_CRATE.as_def_id()] <- traits);
             }
 
+            let mut macros = vec![];
+
             // Normally, this information is encoded when we walk the items
             // defined in this crate. However, we skip doing that for proc-macro crates,
             // so we manually encode just the information that we need
@@ -2018,19 +2018,30 @@ fn encode_proc_macros(&mut self) -> Option<ProcMacroData> {
                 // Proc-macros may have attributes like `#[allow_internal_unstable]`,
                 // so downstream crates need access to them.
                 let attrs = tcx.hir_attrs(proc_macro);
-                let macro_kind = if find_attr!(attrs, ProcMacro) {
-                    MacroKind::Bang
+                let (macro_kind, kind) = if find_attr!(attrs, ProcMacro) {
+                    (MacroKind::Bang, ProcMacroKind::Bang { name: name.as_str().to_owned() })
                 } else if find_attr!(attrs, ProcMacroAttribute) {
-                    MacroKind::Attr
-                } else if let Some(trait_name) =
-                    find_attr!(attrs, ProcMacroDerive { trait_name, ..} => trait_name)
+                    (MacroKind::Attr, ProcMacroKind::Attr { name: name.as_str().to_owned() })
+                } else if let Some((trait_name, helper_attrs)) = find_attr!(attrs,
+                    ProcMacroDerive { trait_name, helper_attrs } => (trait_name, helper_attrs))
                 {
                     name = *trait_name;
-                    MacroKind::Derive
+                    (
+                        MacroKind::Derive,
+                        ProcMacroKind::CustomDerive {
+                            trait_name: name.as_str().to_owned(),
+                            attributes: helper_attrs
+                                .iter()
+                                .map(|attr| attr.as_str().to_owned())
+                                .collect(),
+                        },
+                    )
                 } else {
                     bug!("Unknown proc-macro type for item {:?}", id);
                 };
 
+                macros.push((id.local_def_index, self.lazy(kind)));
+
                 let mut def_key = self.tcx.hir_def_key(id);
                 def_key.disambiguated_data.data = DefPathData::MacroNs(name);
 
@@ -2046,6 +2057,8 @@ fn encode_proc_macros(&mut self) -> Option<ProcMacroData> {
                 }
             }
 
+            let macros = self.lazy_array(macros);
+
             Some(ProcMacroData { proc_macro_decls_static, stability, macros })
         } else {
             None
diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs
index 6a396fa..5fb034d 100644
--- a/compiler/rustc_metadata/src/rmeta/mod.rs
+++ b/compiler/rustc_metadata/src/rmeta/mod.rs
@@ -193,7 +193,14 @@ enum LazyState {
 pub(crate) struct ProcMacroData {
     proc_macro_decls_static: DefIndex,
     stability: Option<hir::Stability>,
-    macros: LazyArray<DefIndex>,
+    macros: LazyArray<(DefIndex, LazyValue<ProcMacroKind>)>,
+}
+
+#[derive(MetadataEncodable, LazyDecodable)]
+pub enum ProcMacroKind {
+    CustomDerive { trait_name: String, attributes: Vec<String> },
+    Attr { name: String },
+    Bang { name: String },
 }
 
 /// Serialized crate metadata.
diff --git a/compiler/rustc_metadata/src/rmeta/parameterized.rs b/compiler/rustc_metadata/src/rmeta/parameterized.rs
index 1531584..40f1c85 100644
--- a/compiler/rustc_metadata/src/rmeta/parameterized.rs
+++ b/compiler/rustc_metadata/src/rmeta/parameterized.rs
@@ -70,6 +70,7 @@ impl ParameterizedOverTcx for $ty {
     crate::rmeta::CrateHeader,
     crate::rmeta::CrateRoot,
     crate::rmeta::IncoherentImpls,
+    crate::rmeta::ProcMacroKind,
     crate::rmeta::RawDefId,
     crate::rmeta::TraitImpls,
     crate::rmeta::VariantData,
diff --git a/compiler/rustc_metadata/src/rmeta/table.rs b/compiler/rustc_metadata/src/rmeta/table.rs
index 26c5908..e3f40e5 100644
--- a/compiler/rustc_metadata/src/rmeta/table.rs
+++ b/compiler/rustc_metadata/src/rmeta/table.rs
@@ -225,8 +225,9 @@ macro_rules! const_macro_kinds {
 
 defaulted_enum! {
     hir::Constness {
-        ( Const    )
+        ( Const { always: false } )
         ( NotConst )
+        ( Const { always: true } )
     }
 }
 
diff --git a/compiler/rustc_middle/src/hir/map.rs b/compiler/rustc_middle/src/hir/map.rs
index 232a4e6..81eae1c 100644
--- a/compiler/rustc_middle/src/hir/map.rs
+++ b/compiler/rustc_middle/src/hir/map.rs
@@ -346,12 +346,18 @@ pub fn hir_body_owner_kind(self, def_id: impl Into<DefId>) -> BodyOwnerKind {
     pub fn hir_body_const_context(self, local_def_id: LocalDefId) -> Option<ConstContext> {
         let def_id = local_def_id.into();
         let ccx = match self.hir_body_owner_kind(def_id) {
-            BodyOwnerKind::Const { inline } => ConstContext::Const { inline },
+            BodyOwnerKind::Const { inline } => {
+                ConstContext::Const { allow_const_fn_promotion: !inline }
+            }
             BodyOwnerKind::Static(mutability) => ConstContext::Static(mutability),
 
             BodyOwnerKind::Fn if self.is_constructor(def_id) => return None,
             BodyOwnerKind::Fn | BodyOwnerKind::Closure if self.is_const_fn(def_id) => {
-                ConstContext::ConstFn
+                if matches!(self.constness(def_id), rustc_hir::Constness::Const { always: true }) {
+                    ConstContext::Const { allow_const_fn_promotion: false }
+                } else {
+                    ConstContext::ConstFn
+                }
             }
             BodyOwnerKind::Fn | BodyOwnerKind::Closure | BodyOwnerKind::GlobalAsm => return None,
         };
diff --git a/compiler/rustc_middle/src/infer/canonical.rs b/compiler/rustc_middle/src/infer/canonical.rs
index ee8ab8a..8f182d0 100644
--- a/compiler/rustc_middle/src/infer/canonical.rs
+++ b/compiler/rustc_middle/src/infer/canonical.rs
@@ -135,9 +135,12 @@ pub fn is_proven(&self) -> bool {
     }
 }
 
-// FIXME: Convert this into a struct
-pub type QueryRegionConstraint<'tcx> =
-    (ty::RegionConstraint<'tcx>, ConstraintCategory<'tcx>, ty::VisibleForLeakCheck);
+#[derive(Debug, StableHash, Hash, Eq, PartialEq, TypeVisitable, Clone, TypeFoldable, Copy)]
+pub struct QueryRegionConstraint<'tcx> {
+    pub constraint: ty::RegionConstraint<'tcx>,
+    pub category: ConstraintCategory<'tcx>,
+    pub visible_for_leak_check: ty::VisibleForLeakCheck,
+}
 
 #[derive(Default)]
 pub struct CanonicalParamEnvCache<'tcx> {
diff --git a/compiler/rustc_middle/src/mir/interpret/queries.rs b/compiler/rustc_middle/src/mir/interpret/queries.rs
index 80275b5..51cf856 100644
--- a/compiler/rustc_middle/src/mir/interpret/queries.rs
+++ b/compiler/rustc_middle/src/mir/interpret/queries.rs
@@ -103,7 +103,14 @@ pub fn const_eval_resolve_for_typeck(
             bug!("did not expect inference variables here");
         }
 
-        let cid = match ty::Instance::try_resolve(self, typing_env, ct.kind.def_id(), ct.args) {
+        let def_id = match ct.kind {
+            ty::UnevaluatedConstKind::Projection { def_id }
+            | ty::UnevaluatedConstKind::Inherent { def_id }
+            | ty::UnevaluatedConstKind::Free { def_id }
+            | ty::UnevaluatedConstKind::Anon { def_id } => def_id,
+        };
+
+        let cid = match ty::Instance::try_resolve(self, typing_env, def_id, ct.args) {
             Ok(Some(instance)) => GlobalId { instance, promoted: None },
             // For errors during resolution, we deliberately do not point at the usage site of the constant,
             // since for these errors the place the constant is used shouldn't matter.
@@ -124,6 +131,7 @@ pub fn const_eval_resolve_for_typeck(
             // @lcnr believes that successfully evaluating even though there are
             // used generic parameters is a bug of evaluation, so checking for it
             // here does feel somewhat sensible.
+            let def_id = cid.instance.def_id();
             if !self.features().generic_const_exprs()
                 && ct.args.has_non_region_param()
                 // We only FCW for anon consts as repeat expr counts with anon consts are the only place
@@ -132,16 +140,16 @@ pub fn const_eval_resolve_for_typeck(
                 //
                 // If we don't *only* FCW anon consts we can wind up incorrectly FCW'ing uses of assoc
                 // consts in pattern positions. #140447
-                && self.def_kind(cid.instance.def_id()) == DefKind::AnonConst
-                && !self.is_trivial_const(cid.instance.def_id())
+                && self.def_kind(def_id) == DefKind::AnonConst
+                && !self.is_trivial_const(def_id)
+                && let Some(local_def_id) = def_id.as_local()
             {
-                let mir_body = self.mir_for_ctfe(cid.instance.def_id());
+                let mir_body = self.mir_for_ctfe(def_id);
                 if mir_body.is_polymorphic {
-                    let Some(local_def_id) = ct.kind.def_id().as_local() else { return };
                     self.emit_node_span_lint(
                         lint::builtin::CONST_EVALUATABLE_UNCHECKED,
                         self.local_def_id_to_hir_id(local_def_id),
-                        self.def_span(ct.kind.def_id()),
+                        self.def_span(def_id),
                         rustc_errors::DiagDecorator(|lint| {
                             lint.primary_message(
                                 "cannot use constants which depend on generic parameters in types",
diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs
index 7f8f729..942c36f 100644
--- a/compiler/rustc_middle/src/mir/pretty.rs
+++ b/compiler/rustc_middle/src/mir/pretty.rs
@@ -1492,11 +1492,15 @@ fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, _location: Loca
                 Const::Ty(_, ct) => match ct.kind() {
                     ty::ConstKind::Param(p) => format!("ty::Param({p})"),
                     ty::ConstKind::Unevaluated(uv) => {
-                        format!(
-                            "ty::Unevaluated({}, {:?})",
-                            self.tcx.def_path_str(uv.kind.def_id()),
-                            uv.args,
-                        )
+                        let kind = match uv.kind {
+                            ty::UnevaluatedConstKind::Projection { def_id }
+                            | ty::UnevaluatedConstKind::Inherent { def_id }
+                            | ty::UnevaluatedConstKind::Free { def_id }
+                            | ty::UnevaluatedConstKind::Anon { def_id } => {
+                                self.tcx.def_path_str(def_id)
+                            }
+                        };
+                        format!("ty::Unevaluated({}, {:?})", kind, uv.args)
                     }
                     ty::ConstKind::Value(cv) => {
                         format!("ty::Valtree({})", fmt_valtree(&cv))
diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs
index 0cc57e5..838dbdc 100644
--- a/compiler/rustc_middle/src/thir.rs
+++ b/compiler/rustc_middle/src/thir.rs
@@ -729,23 +729,6 @@ pub fn walk_always(&self, mut it: impl FnMut(&Pat<'tcx>)) {
             true
         })
     }
-
-    /// Whether this a never pattern.
-    pub fn is_never_pattern(&self) -> bool {
-        let mut is_never_pattern = false;
-        self.walk(|pat| match &pat.kind {
-            PatKind::Never => {
-                is_never_pattern = true;
-                false
-            }
-            PatKind::Or { pats } => {
-                is_never_pattern = pats.iter().all(|p| p.is_never_pattern());
-                false
-            }
-            _ => true,
-        });
-        is_never_pattern
-    }
 }
 
 #[derive(Clone, Debug, StableHash, TypeVisitable)]
diff --git a/compiler/rustc_middle/src/ty/abstract_const.rs b/compiler/rustc_middle/src/ty/abstract_const.rs
index 984c9ec..ac38053 100644
--- a/compiler/rustc_middle/src/ty/abstract_const.rs
+++ b/compiler/rustc_middle/src/ty/abstract_const.rs
@@ -52,8 +52,8 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
             }
             fn fold_const(&mut self, c: Const<'tcx>) -> Const<'tcx> {
                 let ct = match c.kind() {
-                    ty::ConstKind::Unevaluated(uv) => {
-                        match self.tcx.thir_abstract_const(uv.kind.def_id()) {
+                    ty::ConstKind::Unevaluated(uv) if let Some(def_id) = uv.kind.opt_def_id() => {
+                        match self.tcx.thir_abstract_const(def_id) {
                             Err(e) => ty::Const::new_error(self.tcx, e),
                             Ok(Some(bac)) => {
                                 let args = self.tcx.erase_and_anonymize_regions(uv.args);
diff --git a/compiler/rustc_middle/src/ty/adt.rs b/compiler/rustc_middle/src/ty/adt.rs
index f890c7a..e26dac9 100644
--- a/compiler/rustc_middle/src/ty/adt.rs
+++ b/compiler/rustc_middle/src/ty/adt.rs
@@ -311,7 +311,8 @@ fn is_fundamental(self) -> bool {
 
     fn destructor(self, tcx: TyCtxt<'tcx>) -> Option<AdtDestructorKind> {
         Some(match tcx.constness(self.destructor(tcx)?.did) {
-            hir::Constness::Const => AdtDestructorKind::Const,
+            hir::Constness::Const { always: true } => todo!("FIXME(comptime)"),
+            hir::Constness::Const { always: false } => AdtDestructorKind::Const,
             hir::Constness::NotConst => AdtDestructorKind::NotConst,
         })
     }
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 9dcf76e..b708b66 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -2666,7 +2666,10 @@ pub fn is_stable_const_fn(self, def_id: DefId) -> bool {
     /// Whether the trait impl is marked const. This does not consider stability or feature gates.
     pub fn is_const_trait_impl(self, def_id: DefId) -> bool {
         self.def_kind(def_id) == DefKind::Impl { of_trait: true }
-            && self.impl_trait_header(def_id).constness == hir::Constness::Const
+            && matches!(
+                self.impl_trait_header(def_id).constness,
+                hir::Constness::Const { always: false }
+            )
     }
 
     pub fn is_sdylib_interface_build(self) -> bool {
diff --git a/compiler/rustc_middle/src/ty/context/impl_interner.rs b/compiler/rustc_middle/src/ty/context/impl_interner.rs
index bc8b83e..e9eef93 100644
--- a/compiler/rustc_middle/src/ty/context/impl_interner.rs
+++ b/compiler/rustc_middle/src/ty/context/impl_interner.rs
@@ -199,6 +199,10 @@ fn anon_const_kind(self, def_id: DefId) -> ty::AnonConstKind {
         self.anon_const_kind(def_id)
     }
 
+    fn def_span(self, def_id: DefId) -> Span {
+        self.def_span(def_id)
+    }
+
     type AdtDef = ty::AdtDef<'tcx>;
     fn adt_def(self, adt_def_id: DefId) -> Self::AdtDef {
         self.adt_def(adt_def_id)
@@ -455,7 +459,7 @@ fn fn_is_const(self, def_id: DefId) -> bool {
 
     fn closure_is_const(self, def_id: DefId) -> bool {
         debug_assert_matches!(self.def_kind(def_id), DefKind::Closure);
-        self.constness(def_id) == hir::Constness::Const
+        matches!(self.constness(def_id), hir::Constness::Const { always: false })
     }
 
     fn alias_has_const_conditions(self, def_id: DefId) -> bool {
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index 682bec5..a0dd7b5 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -1305,7 +1305,9 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: ExternAbi)
         | RustInvalid
         | Swift
         | Unadjusted => false,
-        Rust | RustCall | RustCold | RustPreserveNone => tcx.sess.panic_strategy().unwinds(),
+        Rust | RustCall | RustCold | RustPreserveNone | RustTail => {
+            tcx.sess.panic_strategy().unwinds()
+        }
     }
 }
 
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 8ea14b0..ac82cf1 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -2141,7 +2141,7 @@ pub fn is_const_fn(self, def_id: impl IntoQueryKey<DefId>) -> bool {
         matches!(
             self.def_kind(def_id),
             DefKind::Fn | DefKind::AssocFn | DefKind::Ctor(_, CtorKind::Fn) | DefKind::Closure
-        ) && self.constness(def_id) == hir::Constness::Const
+        ) && matches!(self.constness(def_id), hir::Constness::Const { .. })
     }
 
     /// Whether this item is conditionally constant for the purposes of the
@@ -2155,12 +2155,14 @@ pub fn is_conditionally_const(self, def_id: impl Into<DefId>) -> bool {
         match self.def_kind(def_id) {
             DefKind::Impl { of_trait: true } => {
                 let header = self.impl_trait_header(def_id);
-                header.constness == hir::Constness::Const
+                matches!(header.constness, hir::Constness::Const { always: false })
                     && self.is_const_trait(header.trait_ref.skip_binder().def_id)
             }
-            DefKind::Impl { of_trait: false } => self.constness(def_id) == hir::Constness::Const,
+            DefKind::Impl { of_trait: false } => {
+                matches!(self.constness(def_id), hir::Constness::Const { always: false })
+            }
             DefKind::Fn | DefKind::Ctor(_, CtorKind::Fn) => {
-                self.constness(def_id) == hir::Constness::Const
+                matches!(self.constness(def_id), hir::Constness::Const { always: false })
             }
             DefKind::TraitAlias | DefKind::Trait => self.is_const_trait(def_id),
             DefKind::AssocTy => {
@@ -2177,17 +2179,19 @@ pub fn is_conditionally_const(self, def_id: impl Into<DefId>) -> bool {
                 let parent_def_id = self.parent(def_id);
                 match self.def_kind(parent_def_id) {
                     DefKind::Impl { of_trait: false } => {
-                        self.constness(def_id) == hir::Constness::Const
+                        matches!(self.constness(def_id), hir::Constness::Const { always: false })
                     }
                     DefKind::Impl { of_trait: true } => {
                         let Some(trait_method_did) = self.trait_item_of(def_id) else {
                             return false;
                         };
-                        self.constness(trait_method_did) == hir::Constness::Const
-                            && self.is_conditionally_const(parent_def_id)
+                        matches!(
+                            self.constness(trait_method_did),
+                            hir::Constness::Const { always: false }
+                        ) && self.is_conditionally_const(parent_def_id)
                     }
                     DefKind::Trait => {
-                        self.constness(def_id) == hir::Constness::Const
+                        matches!(self.constness(def_id), hir::Constness::Const { always: false })
                             && self.is_conditionally_const(parent_def_id)
                     }
                     _ => bug!("unexpected parent item of associated fn: {parent_def_id:?}"),
@@ -2199,7 +2203,9 @@ pub fn is_conditionally_const(self, def_id: impl Into<DefId>) -> bool {
                 // FIXME(const_trait_impl): ATPITs could be conditionally const?
                 hir::OpaqueTyOrigin::TyAlias { .. } => false,
             },
-            DefKind::Closure => self.constness(def_id) == hir::Constness::Const,
+            DefKind::Closure => {
+                matches!(self.constness(def_id), hir::Constness::Const { always: false })
+            }
             DefKind::Ctor(_, CtorKind::Const)
             | DefKind::Mod
             | DefKind::Struct
@@ -2228,7 +2234,7 @@ pub fn is_conditionally_const(self, def_id: impl Into<DefId>) -> bool {
 
     #[inline]
     pub fn is_const_trait(self, def_id: DefId) -> bool {
-        self.trait_def(def_id).constness == hir::Constness::Const
+        matches!(self.trait_def(def_id).constness, hir::Constness::Const { .. })
     }
 
     pub fn impl_method_has_trait_impl_trait_tys(self, def_id: DefId) -> bool {
diff --git a/compiler/rustc_mir_build/src/builder/matches/match_pair.rs b/compiler/rustc_mir_build/src/builder/matches/match_pair.rs
index e2d0023..b4ce814 100644
--- a/compiler/rustc_mir_build/src/builder/matches/match_pair.rs
+++ b/compiler/rustc_mir_build/src/builder/matches/match_pair.rs
@@ -1,10 +1,11 @@
 use std::sync::Arc;
 
 use rustc_abi::FieldIdx;
-use rustc_middle::mir::*;
+use rustc_middle::mir::{Pinnedness, Place, PlaceElem, ProjectionElem};
 use rustc_middle::span_bug;
-use rustc_middle::thir::*;
+use rustc_middle::thir::{Ascription, DerefPatBorrowMode, FieldPat, Pat, PatKind};
 use rustc_middle::ty::{self, Ty, TypeVisitableExt};
+use rustc_span::Span;
 
 use crate::builder::Builder;
 use crate::builder::expr::as_place::{PlaceBase, PlaceBuilder};
@@ -66,16 +67,166 @@ fn prefix_slice_suffix<'a, 'tcx>(
     output_pairs
 }
 
-impl<'tcx> MatchPairTree<'tcx> {
-    /// Recursively builds a match pair tree for the given pattern and its
-    /// subpatterns.
-    pub(super) fn for_pattern(
-        mut place_builder: PlaceBuilder<'tcx>,
+impl<'tcx> FlatPat<'tcx> {
+    /// Creates a `FlatPat` containing a simplified [`MatchPairTree`] list/forest
+    /// for the given pattern.
+    pub(crate) fn new(
+        place: PlaceBuilder<'tcx>,
         pattern: &Pat<'tcx>,
         cx: &mut Builder<'_, 'tcx>,
-        match_pairs: &mut Vec<Self>, // Newly-created nodes are added to this vector
-        extra_data: &mut PatternExtraData<'tcx>, // Bindings/ascriptions are added here
-    ) {
+    ) -> Self {
+        // Recursively lower the THIR pattern into an intermediate form,
+        // then flatten into a `FlatPat`.
+        let inter_pat = InterPat::lower_thir_pat(cx, place, pattern);
+        FlatPat::from_inter_pat(inter_pat)
+    }
+
+    /// Squashes an [`InterPat`] into a [`FlatPat`].
+    ///
+    /// This is a separate function because it also needs to be called recursively
+    /// when squashing any or-patterns.
+    fn from_inter_pat(inter_pat: InterPat<'tcx>) -> Self {
+        let mut match_pairs = vec![];
+        let mut extra_data = PatternExtraData {
+            span: inter_pat.pattern_span,
+            bindings: vec![],
+            ascriptions: vec![],
+            is_never: inter_pat.is_never,
+        };
+        squash_inter_pat(inter_pat, &mut match_pairs, &mut extra_data);
+
+        FlatPat { match_pairs, extra_data }
+    }
+}
+
+/// Recursively squashes an [`InterPat`] into a forest of refutable [`MatchPairTree`]
+/// nodes, while accumulating ascriptions and bindings.
+fn squash_inter_pat<'tcx>(
+    inter_pat: InterPat<'tcx>,
+    match_pairs: &mut Vec<MatchPairTree<'tcx>>, // Newly-created nodes are added to this vector
+    extra_data: &mut PatternExtraData<'tcx>,    // Bindings/ascriptions are added here
+) {
+    // Destructure exhaustively to make sure we don't miss any fields.
+    let InterPat {
+        place,
+        testable_case,
+        subpats,
+        or_subpats,
+        ascriptions,
+        binding,
+        pattern_span,
+        is_never: _, // Not needed by `MatchPairTree` forests.
+    } = inter_pat;
+
+    // Type ascriptions can appear regardless of whether the node is an or-pattern.
+    extra_data.ascriptions.extend(ascriptions);
+
+    // Or and non-or patterns have very different handling.
+    if let Some(or_subpats) = or_subpats {
+        // We're dealing with an or-pattern node.
+        assert!(testable_case.is_none());
+        assert!(subpats.is_empty());
+        assert!(binding.is_none());
+
+        let or_subpats = or_subpats
+            .into_iter()
+            .map(|subpat| FlatPat::from_inter_pat(subpat))
+            .collect::<Box<[_]>>();
+
+        if !or_subpats[0].extra_data.bindings.is_empty() {
+            // Hold a place for any bindings established in (possibly-nested) or-patterns.
+            // By only holding a place when bindings are present, we skip over any
+            // or-patterns that will be simplified by `merge_trivial_subcandidates`. In
+            // other words, we can assume this expands into subcandidates.
+            // FIXME(@dianne): this needs updating/removing if we always merge or-patterns
+            extra_data.bindings.push(super::SubpatternBindings::FromOrPattern);
+        }
+
+        match_pairs.push(MatchPairTree {
+            // Or-patterns never need a place during MIR building.
+            place: None,
+            testable_case: TestableCase::Or { pats: or_subpats },
+            subpairs: vec![],
+            pattern_span,
+        });
+    } else {
+        // We're dealing with a node that isn't an or-pattern.
+
+        // Recursively squash any subpatterns into refutable `MatchPairTree` forests.
+        // This must happen _before_ pushing the binding, as described by the binding step.
+        let mut subpairs = vec![];
+        for subpat in subpats {
+            squash_inter_pat(subpat, &mut subpairs, extra_data);
+        }
+
+        if let Some(testable_case) = testable_case {
+            // This pattern is refutable, so push a new match-pair node.
+            //
+            // If this match is inside a closure, it's essential that the place
+            // we're testing was actually captured! Be sure to keep `ExprUseVisitor`
+            // in sync with the refutability checks in this module.
+            assert!(place.is_some());
+            assert!(!matches!(testable_case, TestableCase::Or { .. }));
+            match_pairs.push(MatchPairTree { place, testable_case, subpairs, pattern_span });
+        } else {
+            // This pattern is irrefutable, so it doesn't need its own match-pair node.
+            // Just push its refutable subpatterns instead, if any.
+            match_pairs.extend(subpairs);
+        }
+
+        // If present, the binding must be pushed _after_ traversing subpatterns.
+        // This is so that when lowering something like `x @ NonCopy { copy_field }`,
+        // the binding to `copy_field` will occur before the binding for `x`.
+        // See <https://github.com/rust-lang/rust/issues/69971> for more background.
+        if let Some(binding) = binding {
+            extra_data.bindings.push(super::SubpatternBindings::One(binding));
+        }
+    }
+}
+
+/// "Intermediate pattern", a partly-lowered THIR [`Pat`] that has not yet been
+/// squashed into a forest of refutable [`MatchPairTree`] nodes.
+///
+/// FIXME(Zalathar): This could potentially be split into different enum variants
+/// for or-patterns and non-or patterns, but for now the flat structure makes
+/// construction a bit easier, at the cost of more complicated invariants.
+struct InterPat<'tcx> {
+    /// Place that this pattern node will test.
+    ///
+    /// If `None`, we're in a closure that didn't capture the relevant place,
+    /// because it won't actually be tested.
+    place: Option<Place<'tcx>>,
+    /// Testable condition to compare the place to (e.g. "is 3" or "is Some").
+    ///
+    /// If `None`, this pattern node is irrefutable or an or-pattern,
+    /// though it might have refutable descendants.
+    testable_case: Option<TestableCase<'tcx>>,
+
+    /// Immediate subpatterns of a node that is *not* an or-pattern.
+    subpats: Vec<InterPat<'tcx>>,
+    /// Immediate subpatterns of an or-pattern node.
+    ///
+    /// Invariant: If this is Some, then fields `subpats`, `testable_case`,
+    /// and `binding` must all be empty.
+    or_subpats: Option<Box<[InterPat<'tcx>]>>,
+
+    ascriptions: Vec<super::Ascription<'tcx>>,
+    /// Binding to establish for a [`PatKind::Binding`] node.
+    binding: Option<super::Binding<'tcx>>,
+
+    /// Span field of the THIR pattern this node was created from.
+    pattern_span: Span,
+    /// True if this pattern can never match, because all of its alternatives
+    /// contain a `!` pattern.
+    is_never: bool,
+}
+
+impl<'tcx> InterPat<'tcx> {
+    fn lower_thir_pat(
+        cx: &mut Builder<'_, 'tcx>,
+        mut place_builder: PlaceBuilder<'tcx>,
+        pattern: &Pat<'tcx>,
+    ) -> Self {
         // Force the place type to the pattern's type.
         // FIXME(oli-obk): can we use this to simplify slice/array pattern hacks?
         if let Some(resolved) = place_builder.resolve_upvar(cx) {
@@ -99,14 +250,19 @@ pub(super) fn for_pattern(
             }
         }
 
+        // Variables that will become `InterPat` fields:
         let place = place_builder.try_to_place(cx);
+        let mut subpats = vec![];
+        let mut or_subpats = None;
+        let mut ascriptions = vec![];
+        let mut binding = None;
 
         // Apply any type ascriptions to the value at `match_pair.place`.
         if let Some(place) = place
             && let Some(extra) = &pattern.extra
         {
             for &Ascription { ref annotation, variance } in &extra.ascriptions {
-                extra_data.ascriptions.push(super::Ascription {
+                ascriptions.push(super::Ascription {
                     source: place,
                     annotation: annotation.clone(),
                     variance,
@@ -114,22 +270,16 @@ pub(super) fn for_pattern(
             }
         }
 
-        let mut subpairs = Vec::new();
         let testable_case = match pattern.kind {
             PatKind::Missing | PatKind::Wild | PatKind::Error(_) => None,
 
             PatKind::Or { ref pats } => {
-                let pats: Box<[FlatPat<'tcx>]> =
-                    pats.iter().map(|pat| FlatPat::new(place_builder.clone(), pat, cx)).collect();
-                if !pats[0].extra_data.bindings.is_empty() {
-                    // Hold a place for any bindings established in (possibly-nested) or-patterns.
-                    // By only holding a place when bindings are present, we skip over any
-                    // or-patterns that will be simplified by `merge_trivial_subcandidates`. In
-                    // other words, we can assume this expands into subcandidates.
-                    // FIXME(@dianne): this needs updating/removing if we always merge or-patterns
-                    extra_data.bindings.push(super::SubpatternBindings::FromOrPattern);
-                }
-                Some(TestableCase::Or { pats })
+                or_subpats = Some(
+                    pats.iter()
+                        .map(|subpat| InterPat::lower_thir_pat(cx, place_builder.clone(), subpat))
+                        .collect::<Box<[_]>>(),
+                );
+                None
             }
 
             PatKind::Range(ref range) => {
@@ -165,48 +315,22 @@ pub(super) fn for_pattern(
             }
 
             PatKind::Binding { mode, var, is_shorthand, ref subpattern, .. } => {
-                // In order to please the borrow checker, when lowering a pattern
-                // like `x @ subpat` we must establish any bindings in `subpat`
-                // before establishing the binding for `x`.
-                //
-                // For example (from #69971):
-                //
-                // ```ignore (illustrative)
-                // struct NonCopyStruct {
-                //     copy_field: u32,
-                // }
-                //
-                // fn foo1(x: NonCopyStruct) {
-                //     let y @ NonCopyStruct { copy_field: z } = x;
-                //     // the above should turn into
-                //     let z = x.copy_field;
-                //     let y = x;
-                // }
-                // ```
-
                 // First, recurse into the subpattern, if any.
                 if let Some(subpattern) = subpattern.as_ref() {
                     // this is the `x @ P` case; have to keep matching against `P` now
-                    MatchPairTree::for_pattern(
-                        place_builder,
-                        subpattern,
-                        cx,
-                        &mut subpairs,
-                        extra_data,
-                    );
+                    subpats.push(InterPat::lower_thir_pat(cx, place_builder, subpattern));
                 }
 
                 // Then push this binding, after any bindings in the subpattern.
-                if let Some(source) = place {
-                    extra_data.bindings.push(super::SubpatternBindings::One(super::Binding {
+                if let Some(place) = place {
+                    binding = Some(super::Binding {
                         span: pattern.span,
-                        source,
+                        source: place,
                         var_id: var,
                         binding_mode: mode,
                         is_shorthand,
-                    }));
+                    });
                 }
-
                 None
             }
 
@@ -223,7 +347,7 @@ pub(super) fn for_pattern(
                     for (subplace, subpat) in
                         prefix_slice_suffix(&place_builder, Some(array_len), prefix, slice, suffix)
                     {
-                        MatchPairTree::for_pattern(subplace, subpat, cx, &mut subpairs, extra_data);
+                        subpats.push(InterPat::lower_thir_pat(cx, subplace, subpat));
                     }
                 } else {
                     // If the array length couldn't be determined, ignore the
@@ -243,12 +367,12 @@ pub(super) fn for_pattern(
                 for (subplace, subpat) in
                     prefix_slice_suffix(&place_builder, None, prefix, slice, suffix)
                 {
-                    MatchPairTree::for_pattern(subplace, subpat, cx, &mut subpairs, extra_data);
+                    subpats.push(InterPat::lower_thir_pat(cx, subplace, subpat));
                 }
 
                 if prefix.is_empty() && slice.is_some() && suffix.is_empty() {
-                    // This pattern is shaped like `[..]`. It can match a slice
-                    // of any length, so no length test is needed.
+                    // A slice pattern shaped like `[..]` is irrefutable.
+                    // It can match a slice of any length, so no length test is needed.
                     None
                 } else {
                     // Any other shape of slice pattern requires a length test.
@@ -269,7 +393,7 @@ pub(super) fn for_pattern(
                 let downcast_place = place_builder.downcast(adt_def, variant_index); // `(x as Variant)`
                 for &FieldPat { field, pattern: ref subpat } in subpatterns {
                     let subplace = downcast_place.clone_project(PlaceElem::Field(field, subpat.ty));
-                    MatchPairTree::for_pattern(subplace, subpat, cx, &mut subpairs, extra_data);
+                    subpats.push(InterPat::lower_thir_pat(cx, subplace, subpat));
                 }
 
                 // We treat non-exhaustive enums the same independent of the crate they are
@@ -286,7 +410,7 @@ pub(super) fn for_pattern(
             PatKind::Leaf { ref subpatterns } => {
                 for &FieldPat { field, pattern: ref subpat } in subpatterns {
                     let subplace = place_builder.clone_project(PlaceElem::Field(field, subpat.ty));
-                    MatchPairTree::for_pattern(subplace, subpat, cx, &mut subpairs, extra_data);
+                    subpats.push(InterPat::lower_thir_pat(cx, subplace, subpat));
                 }
                 None
             }
@@ -296,27 +420,19 @@ pub(super) fn for_pattern(
                     Some(p_ty) if p_ty.is_ref() => p_ty,
                     _ => span_bug!(pattern.span, "bad type for pinned deref: {:?}", pattern.ty),
                 };
-                MatchPairTree::for_pattern(
+                subpats.push(InterPat::lower_thir_pat(
+                    cx,
                     // Project into the `Pin(_)` struct, then deref the inner `&` or `&mut`.
                     place_builder.field(FieldIdx::ZERO, pinned_ref_ty).deref(),
                     subpattern,
-                    cx,
-                    &mut subpairs,
-                    extra_data,
-                );
+                ));
 
                 None
             }
 
             PatKind::Deref { pin: Pinnedness::Not, ref subpattern }
             | PatKind::DerefPattern { ref subpattern, borrow: DerefPatBorrowMode::Box } => {
-                MatchPairTree::for_pattern(
-                    place_builder.deref(),
-                    subpattern,
-                    cx,
-                    &mut subpairs,
-                    extra_data,
-                );
+                subpats.push(InterPat::lower_thir_pat(cx, place_builder.deref(), subpattern));
                 None
             }
 
@@ -330,13 +446,11 @@ pub(super) fn for_pattern(
                     Ty::new_ref(cx.tcx, cx.tcx.lifetimes.re_erased, subpattern.ty, mutability),
                     pattern.span,
                 );
-                MatchPairTree::for_pattern(
+                subpats.push(InterPat::lower_thir_pat(
+                    cx,
                     PlaceBuilder::from(temp).deref(),
                     subpattern,
-                    cx,
-                    &mut subpairs,
-                    extra_data,
-                );
+                ));
                 Some(TestableCase::Deref { temp, mutability })
             }
 
@@ -348,24 +462,25 @@ pub(super) fn for_pattern(
             PatKind::Never => Some(TestableCase::Never),
         };
 
-        if let Some(testable_case) = testable_case {
-            // This pattern is refutable, so push a new match-pair node.
-            //
-            // Note: unless test_case is TestCase::Or, place must not be None.
-            // This means that the closure capture analysis in
-            // rustc_hir_typeck::upvar, and in particular the pattern handling
-            // code of ExprUseVisitor, must capture all of the places we'll use.
-            // Make sure to keep these two parts in sync!
-            match_pairs.push(MatchPairTree {
-                place,
-                testable_case,
-                subpairs,
-                pattern_span: pattern.span,
-            })
-        } else {
-            // This pattern is irrefutable, so it doesn't need its own match-pair node.
-            // Just push its refutable subpatterns instead, if any.
-            match_pairs.extend(subpairs);
+        // A pattern node is guaranteed to never match if one of these is true:
+        // - The node itself is a never pattern (`!`).
+        // - It is not an or-pattern, and one of its subpatterns will never match.
+        // - It is an or-pattern, and _all_ of its or-subpatterns will never match.
+        let is_never = matches!(pattern.kind, PatKind::Never)
+            || subpats.iter().any(|subpat| subpat.is_never)
+            || or_subpats
+                .as_ref()
+                .is_some_and(|or_subpats| or_subpats.iter().all(|subpat| subpat.is_never));
+
+        InterPat {
+            place,
+            testable_case,
+            subpats,
+            or_subpats,
+            ascriptions,
+            binding,
+            pattern_span: pattern.span,
+            is_never,
         }
     }
 }
diff --git a/compiler/rustc_mir_build/src/builder/matches/mod.rs b/compiler/rustc_mir_build/src/builder/matches/mod.rs
index 2fbf772..8352ec9 100644
--- a/compiler/rustc_mir_build/src/builder/matches/mod.rs
+++ b/compiler/rustc_mir_build/src/builder/matches/mod.rs
@@ -999,24 +999,6 @@ struct FlatPat<'tcx> {
     extra_data: PatternExtraData<'tcx>,
 }
 
-impl<'tcx> FlatPat<'tcx> {
-    /// Creates a `FlatPat` containing a simplified [`MatchPairTree`] list/forest
-    /// for the given pattern.
-    fn new(place: PlaceBuilder<'tcx>, pattern: &Pat<'tcx>, cx: &mut Builder<'_, 'tcx>) -> Self {
-        // Recursively build a tree of match pairs for the given pattern.
-        let mut match_pairs = vec![];
-        let mut extra_data = PatternExtraData {
-            span: pattern.span,
-            bindings: Vec::new(),
-            ascriptions: Vec::new(),
-            is_never: pattern.is_never_pattern(),
-        };
-        MatchPairTree::for_pattern(place, pattern, cx, &mut match_pairs, &mut extra_data);
-
-        Self { match_pairs, extra_data }
-    }
-}
-
 /// Candidates are a generalization of (a) top-level match arms, and
 /// (b) sub-branches of or-patterns, allowing the match-lowering process to handle
 /// them both in a mostly-uniform way. For example, the list of candidates passed
@@ -1226,7 +1208,7 @@ struct Ascription<'tcx> {
 /// and helps [`TestKind::Switch`] and [`TestKind::SwitchInt`] know what target
 /// values to use.
 ///
-/// Created by [`MatchPairTree::for_pattern`], and then inspected primarily by:
+/// Created by [`MatchPairTree`], and then inspected primarily by:
 /// - [`Builder::pick_test_for_match_pair`] (to choose a test)
 /// - [`Builder::choose_bucket_for_candidate`] (to see how the test interacts with a match pair)
 ///
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs
index b4dac5b..3752fc3 100644
--- a/compiler/rustc_mir_build/src/errors.rs
+++ b/compiler/rustc_mir_build/src/errors.rs
@@ -1241,12 +1241,14 @@ pub(crate) struct PatternNotCovered<'s, 'tcx> {
     pub(crate) misc_suggestion: Option<MiscPatternSuggestion>,
 }
 
-#[derive(Subdiagnostic)]
+#[derive(Subdiagnostic, Debug)]
 #[note(
-    "`let` bindings require an \"irrefutable pattern\", like a `struct` or an `enum` with only one variant"
+    "{$descr} require an \"irrefutable pattern\", like a `struct` or an `enum` with only one variant"
 )]
 #[note("for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html")]
-pub(crate) struct Inform;
+pub(crate) struct Inform {
+    pub(crate) descr: &'static str,
+}
 
 #[derive(Subdiagnostic)]
 #[label(
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
index b4c340c..8e147a4 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
@@ -60,7 +60,7 @@ pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), Err
 
     for param in thir.params.iter() {
         if let Some(ref pattern) = param.pat {
-            visitor.check_binding_is_irrefutable(pattern, origin, None, None);
+            visitor.check_binding_is_irrefutable(pattern, origin, None, None, None);
         }
     }
     visitor.error
@@ -436,7 +436,29 @@ fn check_let(
         assert!(self.let_source != LetSource::None);
         let scrut = scrutinee.map(|id| &self.thir[id]);
         if let LetSource::PlainLet = self.let_source {
-            self.check_binding_is_irrefutable(pat, "local binding", scrut, Some(span));
+            // `lhs = rhs` destructuring assignments are lowered to a `let` tagged
+            // `AssignDesugar`; report them as assignments, not `let` bindings (#157553).
+            if let hir::Node::LetStmt(&hir::LetStmt {
+                source: hir::LocalSource::AssignDesugar,
+                ..
+            }) = self.tcx.hir_node(self.hir_source)
+            {
+                self.check_binding_is_irrefutable(
+                    pat,
+                    "assignment",
+                    Some(Inform { descr: "destructuring assignments" }),
+                    scrut,
+                    None,
+                );
+            } else {
+                self.check_binding_is_irrefutable(
+                    pat,
+                    "local binding",
+                    Some(Inform { descr: "`let` bindings" }),
+                    scrut,
+                    Some(span),
+                );
+            }
         } else if let Ok(Irrefutable) = self.is_let_irrefutable(pat, scrut) {
             if span.from_expansion() {
                 self.lint_single_let(span, None, None);
@@ -541,6 +563,7 @@ fn check_match(
                     "`for` loop binding",
                     None,
                     None,
+                    None,
                 );
             } else {
                 // span after scrutinee, or after `.match`. That is, the braces, arms,
@@ -645,6 +668,7 @@ fn check_binding_is_irrefutable(
         &mut self,
         pat: &'p Pat<'tcx>,
         origin: &str,
+        inform: Option<Inform>,
         scrut: Option<&Expr<'tcx>>,
         sp: Option<Span>,
     ) {
@@ -657,7 +681,6 @@ fn check_binding_is_irrefutable(
             return;
         }
 
-        let inform = sp.is_some().then_some(Inform);
         let mut let_suggestion = None;
         let mut misc_suggestion = None;
         let mut interpreted_as_const = None;
diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
index 1c250c5..56aeabe 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
@@ -184,7 +184,7 @@ fn unevaluated_to_pat(
 
         // Mark the pattern to indicate that it is the result of lowering a named
         // constant. This is used for diagnostics.
-        thir_pat.extra.get_or_insert_default().expanded_const = Some(uv.kind.def_id());
+        thir_pat.extra.get_or_insert_default().expanded_const = uv.kind.opt_def_id();
         thir_pat
     }
 
diff --git a/compiler/rustc_mir_transform/src/coroutine/drop.rs b/compiler/rustc_mir_transform/src/coroutine/drop.rs
index dc58bc1..5a5dd93 100644
--- a/compiler/rustc_mir_transform/src/coroutine/drop.rs
+++ b/compiler/rustc_mir_transform/src/coroutine/drop.rs
@@ -308,6 +308,10 @@ pub(super) fn create_coroutine_drop_shim_async<'tcx>(
     // Run derefer to fix Derefs that are not in the first place
     deref_finder(tcx, &mut body, false);
 
+    if transform.coroutine_kind.is_async_desugaring() {
+        transform_async_context(tcx, &mut body);
+    }
+
     if let Some(dumper) = MirDumper::new(tcx, "coroutine_drop_async", &body) {
         dumper.dump_mir(&body);
     }
@@ -320,6 +324,7 @@ pub(super) fn create_coroutine_drop_shim_async<'tcx>(
 pub(super) fn create_coroutine_drop_shim_proxy_async<'tcx>(
     tcx: TyCtxt<'tcx>,
     body: &Body<'tcx>,
+    coroutine_kind: CoroutineKind,
 ) -> Body<'tcx> {
     let mut body = body.clone();
     // Take the coroutine info out of the body, since the drop shim is
@@ -357,6 +362,10 @@ pub(super) fn create_coroutine_drop_shim_proxy_async<'tcx>(
     // Run derefer to fix Derefs that are not in the first place
     deref_finder(tcx, &mut body, false);
 
+    if coroutine_kind.is_async_desugaring() {
+        transform_async_context(tcx, &mut body);
+    }
+
     if let Some(dumper) = MirDumper::new(tcx, "coroutine_drop_proxy_async", &body) {
         dumper.dump_mir(&body);
     }
diff --git a/compiler/rustc_mir_transform/src/coroutine/mod.rs b/compiler/rustc_mir_transform/src/coroutine/mod.rs
index 235654f..4acf116 100644
--- a/compiler/rustc_mir_transform/src/coroutine/mod.rs
+++ b/compiler/rustc_mir_transform/src/coroutine/mod.rs
@@ -551,19 +551,15 @@ fn make_coroutine_state_argument_pinned<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body
     );
 }
 
-/// Transforms the `body` of the coroutine applying the following transforms:
-///
-/// - Eliminates all the `get_context` calls that async lowering created.
-/// - Replace all `Local` `ResumeTy` types with `&mut Context<'_>` (`context_mut_ref`).
-///
-/// The `Local`s that have their types replaced are:
-/// - The `resume` argument itself.
-/// - The argument to `get_context`.
-/// - The yielded value of a `yield`.
-///
+/// Async desugaring uses an unsafe binder type `ResumeTy` to circumvert borrow-checking.
 /// The `ResumeTy` hides a `&mut Context<'_>` behind an unsafe raw pointer, and the
 /// `get_context` function is being used to convert that back to a `&mut Context<'_>`.
 ///
+/// The actual should be `&mut Context<'_>`. This performs the substitution:
+/// - create a new local `_r` of type `ResumeTy`;
+/// - assign `ResumeTy(transmute::<&mut Context<'_>, NonNull<Context<'_>>>(_2))` to that local;
+/// - let all the code use `_r` instead of `_2`.
+///
 /// Ideally the async lowering would not use the `ResumeTy`/`get_context` indirection,
 /// but rather directly use `&mut Context<'_>`, however that would currently
 /// lead to higher-kinded lifetime errors.
@@ -575,93 +571,90 @@ fn make_coroutine_state_argument_pinned<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body
 #[tracing::instrument(level = "trace", skip(tcx, body), ret)]
 fn transform_async_context<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
     let context_mut_ref = Ty::new_task_context(tcx);
+    let resume_ty_def_id = tcx.require_lang_item(LangItem::ResumeTy, body.span);
+    let resume_nonnull_ty = tcx.instantiate_and_normalize_erasing_regions(
+        ty::GenericArgs::empty(),
+        body.typing_env(tcx),
+        tcx.type_of(tcx.adt_def(resume_ty_def_id).non_enum_variant().fields[FieldIdx::ZERO].did),
+    );
 
-    // replace the type of the `resume` argument
-    replace_resume_ty_local(tcx, body, CTX_ARG, context_mut_ref);
+    // Replace all occurrences of `CTX_ARG` with `resume_local: ResumeTy`,
+    // and set `CTX_ARG: &mut Context<'_>`.
+    let resume_local = body.local_decls.push(LocalDecl::new(context_mut_ref, body.span));
+    body.local_decls.swap(CTX_ARG, resume_local);
+    RenameLocalVisitor { from: CTX_ARG, to: resume_local, tcx }.visit_body(body);
+
+    // Now `CTX_ARG` is `&mut Context` and `resume_local` is a `ResumeTy`.
+    // Insert a `resume_local = ResumeTy(CTX_ARG as *mut Context<'static>)`
+    // at the function entry to make the bridge.
+    let source_info = SourceInfo::outermost(body.span);
+    let nonnull_local = body.local_decls.push(LocalDecl::new(resume_nonnull_ty, body.span));
+    let nonnull_rhs =
+        Rvalue::Cast(CastKind::Transmute, Operand::Move(CTX_ARG.into()), resume_nonnull_ty);
+    let nonnull_assign = StatementKind::Assign(Box::new((nonnull_local.into(), nonnull_rhs)));
+    let resume_rhs = Rvalue::Aggregate(
+        Box::new(AggregateKind::Adt(
+            resume_ty_def_id,
+            VariantIdx::ZERO,
+            ty::GenericArgs::empty(),
+            None,
+            None,
+        )),
+        indexvec![Operand::Move(nonnull_local.into())],
+    );
+    let resume_assign = StatementKind::Assign(Box::new((resume_local.into(), resume_rhs)));
+    body.basic_blocks.as_mut_preserves_cfg()[START_BLOCK].statements.splice(
+        0..0,
+        [Statement::new(source_info, nonnull_assign), Statement::new(source_info, resume_assign)],
+    );
+}
+
+/// HIR uses `get_context` to unwrap a `&mut Context<'_>` from a `ResumeTy`.
+/// Both types are just a single pointer, but liveness analysis does not know that and
+/// supposes that the operand and the destination are live at the same time.
+/// Forcibly inline those calls to avoid this.
+fn eliminate_get_context_calls<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
+    let context_mut_ref = Ty::new_task_context(tcx);
+    let resume_ty_def_id = tcx.require_lang_item(LangItem::ResumeTy, body.span);
+    let resume_nonnull_ty = tcx.instantiate_and_normalize_erasing_regions(
+        ty::GenericArgs::empty(),
+        body.typing_env(tcx),
+        tcx.type_of(tcx.adt_def(resume_ty_def_id).non_enum_variant().fields[FieldIdx::ZERO].did),
+    );
 
     let get_context_def_id = tcx.require_lang_item(LangItem::GetContext, body.span);
-
-    for bb in body.basic_blocks.indices() {
-        let bb_data = &body[bb];
+    for bb_data in body.basic_blocks.as_mut().iter_mut() {
         if bb_data.is_cleanup {
             continue;
         }
 
-        match &bb_data.terminator().kind {
-            TerminatorKind::Call { func, .. } => {
-                let func_ty = func.ty(body, tcx);
-                if let ty::FnDef(def_id, _) = *func_ty.kind()
-                    && def_id == get_context_def_id
-                {
-                    let local = eliminate_get_context_call(&mut body[bb]);
-                    replace_resume_ty_local(tcx, body, local, context_mut_ref);
-                }
-            }
-            TerminatorKind::Yield { resume_arg, .. } => {
-                replace_resume_ty_local(tcx, body, resume_arg.local, context_mut_ref);
-            }
-            _ => {}
+        let terminator = bb_data.terminator_mut();
+        if let TerminatorKind::Call { func, args, destination, target, .. } = &terminator.kind
+            && let func_ty = func.ty(&body.local_decls, tcx)
+            && let ty::FnDef(def_id, _) = *func_ty.kind()
+            && def_id == get_context_def_id
+            && let [arg] = &**args
+            && let Some(place) = arg.node.place()
+        {
+            let arg =
+                Rvalue::Cast(
+                    CastKind::Transmute,
+                    Operand::Copy(place.project_deeper(
+                        &[PlaceElem::Field(FieldIdx::ZERO, resume_nonnull_ty)],
+                        tcx,
+                    )),
+                    context_mut_ref,
+                );
+            let assign = Statement::new(
+                terminator.source_info,
+                StatementKind::Assign(Box::new((*destination, arg))),
+            );
+            terminator.kind = TerminatorKind::Goto { target: target.unwrap() };
+            bb_data.statements.push(assign);
         }
     }
 }
 
-fn eliminate_get_context_call<'tcx>(bb_data: &mut BasicBlockData<'tcx>) -> Local {
-    let terminator = bb_data.terminator.take().unwrap();
-    let TerminatorKind::Call { args, destination, target, .. } = terminator.kind else {
-        bug!();
-    };
-    let [arg] = *Box::try_from(args).unwrap();
-    let local = arg.node.place().unwrap().local;
-
-    let arg = Rvalue::Use(arg.node, WithRetag::Yes);
-    let assign =
-        Statement::new(terminator.source_info, StatementKind::Assign(Box::new((destination, arg))));
-    bb_data.statements.push(assign);
-    bb_data.terminator = Some(Terminator {
-        source_info: terminator.source_info,
-        kind: TerminatorKind::Goto { target: target.unwrap() },
-    });
-    local
-}
-
-#[cfg_attr(not(debug_assertions), allow(unused))]
-#[tracing::instrument(level = "trace", skip(tcx, body), ret)]
-fn replace_resume_ty_local<'tcx>(
-    tcx: TyCtxt<'tcx>,
-    body: &mut Body<'tcx>,
-    local: Local,
-    context_mut_ref: Ty<'tcx>,
-) {
-    let local_ty = std::mem::replace(&mut body.local_decls[local].ty, context_mut_ref);
-    // We have to replace the `ResumeTy` that is used for type and borrow checking
-    // with `&mut Context<'_>` in MIR.
-    #[cfg(debug_assertions)]
-    {
-        if let ty::Adt(resume_ty_adt, _) = local_ty.kind() {
-            let expected_adt = tcx.adt_def(tcx.require_lang_item(LangItem::ResumeTy, body.span));
-            assert_eq!(*resume_ty_adt, expected_adt);
-        } else {
-            panic!("expected `ResumeTy`, found `{:?}`", local_ty);
-        };
-    }
-}
-
-/// Transforms the `body` of the coroutine applying the following transform:
-///
-/// - Remove the `resume` argument.
-///
-/// Ideally the async lowering would not add the `resume` argument.
-///
-/// The async lowering step and the type / lifetime inference / checking are
-/// still using the `resume` argument for the time being. After this transform,
-/// the coroutine body doesn't have the `resume` argument.
-fn transform_gen_context<'tcx>(body: &mut Body<'tcx>) {
-    // This leaves the local representing the `resume` argument in place,
-    // but turns it into a regular local variable. This is cheaper than
-    // adjusting all local references in the body after removing it.
-    body.arg_count = 1;
-}
-
 /// Replaces the entry point of `body` with a block that switches on the coroutine discriminant and
 /// dispatches to blocks according to `cases`.
 ///
@@ -883,6 +876,10 @@ fn create_coroutine_resume_function<'tcx>(
     // Run derefer to fix Derefs that are not in the first place
     deref_finder(tcx, body, false);
 
+    if transform.coroutine_kind.is_async_desugaring() {
+        transform_async_context(tcx, body);
+    }
+
     if let Some(dumper) = MirDumper::new(tcx, "coroutine_resume", body) {
         dumper.dump_mir(body);
     }
@@ -1025,12 +1022,10 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
         // (finally in open_drop_for_tuple) before async drop expansion.
         // Async drops, produced by this drop elaboration, will be expanded,
         // and corresponding futures kept in layout.
-        let coroutine_is_async = coroutine_kind.is_async_desugaring();
         let has_async_drops = has_async_drops(body);
 
-        // Replace all occurrences of `ResumeTy` with `&mut Context<'_>` within async bodies.
-        if coroutine_is_async {
-            transform_async_context(tcx, body);
+        if coroutine_kind.is_async_desugaring() {
+            eliminate_get_context_calls(tcx, body);
         }
 
         let always_live_locals = always_storage_live_locals(body);
@@ -1097,13 +1092,9 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
             }),
         );
 
-        // Update our MIR struct to reflect the changes we've made
-        body.arg_count = 2; // self, resume arg
-        body.spread_arg = None;
-
         // Remove the context argument within generator bodies.
         if matches!(coroutine_kind, CoroutineKind::Desugared(CoroutineDesugaring::Gen, _)) {
-            transform_gen_context(body);
+            body.arg_count = 1;
         }
 
         // The original arguments to the function are no longer arguments, mark them as such.
@@ -1150,7 +1141,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
             body.coroutine.as_mut().unwrap().coroutine_drop = Some(drop_shim);
 
             // For coroutine with sync drop, generating async proxy for `future_drop_poll` call
-            let proxy_shim = create_coroutine_drop_shim_proxy_async(tcx, body);
+            let proxy_shim = create_coroutine_drop_shim_proxy_async(tcx, body, coroutine_kind);
             body.coroutine.as_mut().unwrap().coroutine_drop_proxy_async = Some(proxy_shim);
         }
 
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index 063f0f3..bbf190c 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -259,8 +259,12 @@ fn remap_mir_for_const_eval_select<'tcx>(
                 let ty = tupled_args.node.ty(&body.local_decls, tcx);
                 let fields = ty.tuple_fields();
                 let num_args = fields.len();
-                let func =
-                    if context == hir::Constness::Const { called_in_const } else { called_at_rt };
+                let func = match context {
+                    // Using `const_eval_select` in always-const code is useful when used in macros
+                    // that you don't know whether they are going to be used in `const fn` or in `const` items.
+                    hir::Constness::Const { .. } => called_in_const,
+                    hir::Constness::NotConst => called_at_rt,
+                };
                 let (method, place): (fn(Place<'tcx>) -> Operand<'tcx>, Place<'tcx>) =
                     match tupled_args.node {
                         Operand::Constant(_) | Operand::RuntimeChecks(_) => {
@@ -432,7 +436,7 @@ fn mir_promoted(
 
     let const_qualifs = match tcx.def_kind(def) {
         DefKind::Fn | DefKind::AssocFn | DefKind::Closure
-            if tcx.constness(def) == hir::Constness::Const =>
+            if matches!(tcx.constness(def), hir::Constness::Const { .. }) =>
         {
             tcx.mir_const_qualif(def)
         }
@@ -496,15 +500,17 @@ fn inner_mir_for_ctfe(tcx: TyCtxt<'_>, def: LocalDefId) -> Body<'_> {
     }
 
     let body = tcx.mir_drops_elaborated_and_const_checked(def);
-    let body = match tcx.hir_body_const_context(def) {
+    let (body, always) = match tcx.hir_body_const_context(def) {
         // consts and statics do not have `optimized_mir`, so we can steal the body instead of
         // cloning it.
-        Some(hir::ConstContext::Const { .. } | hir::ConstContext::Static(_)) => body.steal(),
-        Some(hir::ConstContext::ConstFn) => body.borrow().clone(),
+        Some(hir::ConstContext::Const { .. } | hir::ConstContext::Static(_)) => {
+            (body.steal(), true)
+        }
+        Some(hir::ConstContext::ConstFn) => (body.borrow().clone(), false),
         None => bug!("`mir_for_ctfe` called on non-const {def:?}"),
     };
 
-    let mut body = remap_mir_for_const_eval_select(tcx, body, hir::Constness::Const);
+    let mut body = remap_mir_for_const_eval_select(tcx, body, hir::Constness::Const { always });
     pm::run_passes(tcx, &mut body, &[&ctfe_limit::CtfeLimit], None, pm::Optimizations::Allowed);
 
     body
diff --git a/compiler/rustc_mir_transform/src/promote_consts.rs b/compiler/rustc_mir_transform/src/promote_consts.rs
index 3694a06..8472562 100644
--- a/compiler/rustc_mir_transform/src/promote_consts.rs
+++ b/compiler/rustc_mir_transform/src/promote_consts.rs
@@ -659,7 +659,10 @@ fn validate_call(
         // backwards compatibility reason to allow more promotion inside of them.
         let promote_all_fn = matches!(
             self.const_kind,
-            Some(hir::ConstContext::Static(_) | hir::ConstContext::Const { inline: false })
+            Some(
+                hir::ConstContext::Static(_)
+                    | hir::ConstContext::Const { allow_const_fn_promotion: true }
+            )
         );
         if !promote_all_fn {
             return Err(Unpromotable);
diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
index 16f2134..1c7d03f 100644
--- a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
@@ -224,6 +224,7 @@ fn consider_impl_candidate(
     /// but prevents incorrect normalization while hiding any trait errors.
     fn consider_error_guaranteed_candidate(
         ecx: &mut EvalCtxt<'_, D>,
+        goal: Goal<I, Self>,
         guar: I::ErrorGuaranteed,
     ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased>;
 
@@ -578,8 +579,8 @@ fn assemble_builtin_impl_candidates<G: GoalKind<D>>(
         // Instead of adding the logic here, it's a better idea to add it in
         // `EvalCtxt::disqualify_auto_trait_candidate_due_to_possible_impl` in
         // `solve::trait_goals` instead.
-        let result = if let Err(guar) = goal.predicate.error_reported() {
-            G::consider_error_guaranteed_candidate(self, guar)
+        let result = if let ty::Error(guar) = goal.predicate.self_ty().kind() {
+            G::consider_error_guaranteed_candidate(self, goal, guar)
         } else if cx.trait_is_auto(trait_def_id) {
             G::consider_auto_trait_candidate(self, goal)
         } else if cx.trait_is_alias(trait_def_id) {
diff --git a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
index d6ddd9f..75ba328 100644
--- a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
@@ -191,6 +191,7 @@ fn consider_impl_candidate(
 
     fn consider_error_guaranteed_candidate(
         ecx: &mut EvalCtxt<'_, D>,
+        _goal: Goal<I, Self>,
         _guar: I::ErrorGuaranteed,
     ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
         ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc)
diff --git a/compiler/rustc_next_trait_solver/src/solve/mod.rs b/compiler/rustc_next_trait_solver/src/solve/mod.rs
index c27597c..02a90f2 100644
--- a/compiler/rustc_next_trait_solver/src/solve/mod.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/mod.rs
@@ -246,9 +246,7 @@ fn compute_const_arg_has_type_goal(
                     .evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
                     .map_err(Into::into);
             }
-            ty::ConstKind::Unevaluated(uv) => {
-                self.cx().type_of(uv.kind.def_id()).instantiate(self.cx(), uv.args).skip_norm_wip()
-            }
+            ty::ConstKind::Unevaluated(uv) => uv.type_of(self.cx()).skip_norm_wip(),
             ty::ConstKind::Expr(_) => unimplemented!(
                 "`feature(generic_const_exprs)` is not supported in the new trait solver"
             ),
diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs
index d35e05a..e4c3cc1 100644
--- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs
@@ -436,10 +436,21 @@ fn consider_impl_candidate(
     /// Fail to normalize if the predicate contains an error, alternatively, we could normalize to `ty::Error`
     /// and succeed. Can experiment with this to figure out what results in better error messages.
     fn consider_error_guaranteed_candidate(
-        _ecx: &mut EvalCtxt<'_, D>,
-        _guar: I::ErrorGuaranteed,
+        ecx: &mut EvalCtxt<'_, D>,
+        goal: Goal<I, Self>,
+        guar: I::ErrorGuaranteed,
     ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
-        Err(NoSolution.into())
+        let cx = ecx.cx();
+        let error_term = match goal.predicate.alias.kind {
+            ty::AliasTermKind::ProjectionTy { .. } => Ty::new_error(cx, guar).into(),
+            ty::AliasTermKind::ProjectionConst { .. } => Const::new_error(cx, guar).into(),
+            kind => panic!("expected projection, found {kind:?}"),
+        };
+
+        ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {
+            ecx.instantiate_normalizes_to_term(goal, error_term);
+            ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
+        })
     }
 
     fn consider_auto_trait_candidate(
diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
index 5e66225..37fc528 100644
--- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
@@ -125,6 +125,7 @@ fn consider_impl_candidate(
 
     fn consider_error_guaranteed_candidate(
         ecx: &mut EvalCtxt<'_, D>,
+        _goal: Goal<I, Self>,
         _guar: I::ErrorGuaranteed,
     ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
         ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc)
diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs
index 969c854..e2df607 100644
--- a/compiler/rustc_parse/src/parser/generics.rs
+++ b/compiler/rustc_parse/src/parser/generics.rs
@@ -2,7 +2,7 @@
     self as ast, AttrVec, DUMMY_NODE_ID, GenericBounds, GenericParam, GenericParamKind, TyKind,
     WhereClause, token,
 };
-use rustc_errors::{Applicability, PResult};
+use rustc_errors::{Applicability, Diag, PResult};
 use rustc_span::{Ident, Span, kw, sym};
 use thin_vec::ThinVec;
 
@@ -592,25 +592,47 @@ fn parse_ty_where_predicate_kind(&mut self) -> PResult<'a, ast::WherePredicateKi
         // * `for<'a> for<'b> Trait1<'a, 'b>: Trait2<'a /* ok */, 'b /* not ok */>`
         let (bound_vars, _) = self.parse_higher_ranked_binder()?;
 
-        // Parse type with mandatory colon and (possibly empty) bounds,
-        // or with mandatory equality sign and the second type.
         let ty = self.parse_ty_for_where_clause()?;
+
         if self.eat(exp!(Colon)) {
+            // The bounds may be empty; we intentionally accept predicates like  `Ty:`.
             let bounds = self.parse_generic_bounds()?;
-            Ok(ast::WherePredicateKind::BoundPredicate(ast::WhereBoundPredicate {
+
+            return Ok(ast::WherePredicateKind::BoundPredicate(ast::WhereBoundPredicate {
                 bound_generic_params: bound_vars,
                 bounded_ty: ty,
                 bounds,
-            }))
-        // FIXME: Decide what should be used here, `=` or `==`.
-        // FIXME: We are just dropping the binders in lifetime_defs on the floor here.
-        } else if self.eat(exp!(Eq)) || self.eat(exp!(EqEq)) {
-            let rhs_ty = self.parse_ty()?;
-            Ok(ast::WherePredicateKind::EqPredicate(ast::WhereEqPredicate { lhs_ty: ty, rhs_ty }))
-        } else {
-            self.maybe_recover_bounds_doubled_colon(&ty)?;
-            self.unexpected_any()
+            }));
         }
+
+        // NOTE: If we ever end up impl'ing and stabilizing equality predicates (#20041),
+        //       we need to pick between `=` and `==`, both is not an option!
+        if self.eat(exp!(Eq)) || self.eat(exp!(EqEq)) {
+            let lhs_ty = ty;
+            let rhs_ty = self.parse_ty()?;
+
+            // NOTE: If we ever end up impl'ing equality predicates,
+            //       we ought to track the binder in the AST node!
+            let _ = bound_vars;
+
+            let mut diag = self.dcx().struct_span_err(
+                lhs_ty.span.to(rhs_ty.span),
+                "general type equality constraints are not supported",
+            );
+            diag.note(
+                "see issue #20041 <https://github.com/rust-lang/rust/issues/20041> \
+                 for more information",
+            );
+            diag.span(lhs_ty.span.to(rhs_ty.span));
+            diag.span_label(lhs_ty.span.to(rhs_ty.span), "not supported");
+
+            suggest_replacing_equality_pred_with_assoc_item_constraint(&mut diag, *lhs_ty, *rhs_ty);
+
+            return Err(diag);
+        }
+
+        self.maybe_recover_bounds_doubled_colon(&ty)?;
+        self.unexpected_any()
     }
 
     pub(super) fn choose_generics_over_qpath(&self, start: usize) -> bool {
@@ -644,3 +666,61 @@ pub(super) fn choose_generics_over_qpath(&self, start: usize) -> bool {
                 || self.is_keyword_ahead(start + 1, &[kw::Const]))
     }
 }
+
+fn suggest_replacing_equality_pred_with_assoc_item_constraint(
+    diag: &mut Diag<'_>,
+    lhs_ty: ast::Ty,
+    rhs_ty: ast::Ty,
+) {
+    let TyKind::Path(qself, ast::Path { segments, .. }) = lhs_ty.kind else { return };
+
+    let mut parts = Vec::new();
+    let applicability = match qself {
+        // We have something like `Ty::Item<i32> = Rhs`.
+        None if let [self_ty_seg, assoc_item_seg] = &segments[..]
+            && self_ty_seg.ident.name != kw::PathRoot =>
+        {
+            parts.push((
+                self_ty_seg.span().between(assoc_item_seg.span()),
+                ": /* Trait */</* ... */".into(),
+            ));
+            Applicability::HasPlaceholders
+        }
+        Some(qself) if let [assoc_item_seg] = &segments[qself.position..] => {
+            parts.push((lhs_ty.span.until(qself.ty.span), String::new()));
+
+            // We have something like `<Option<usize> as self::Trait<i32>>::Item = Rhs`.
+            if let trait_segs @ [.., final_trait_seg] = &segments[..qself.position] {
+                parts.push((qself.ty.span.between(trait_segs[0].span()), ": ".into()));
+                let (span, snippet) = match &final_trait_seg.args {
+                    Some(args) => {
+                        let ast::GenericArgs::AngleBracketed(args) = args else { return };
+                        let Some(args) = args.args.last() else { return };
+                        (args.span(), ", ")
+                    }
+                    None => (final_trait_seg.span(), "<"),
+                };
+                parts.push((span.between(assoc_item_seg.span()), snippet.into()));
+                Applicability::MaybeIncorrect
+            }
+            // We have something like `<[u8]>::Item == Rhs`.
+            else {
+                parts.push((
+                    qself.ty.span.between(assoc_item_seg.span()),
+                    ": /* Trait */</* ... */".into(),
+                ));
+                Applicability::HasPlaceholders
+            }
+        }
+        _ => return,
+    };
+
+    parts.push((lhs_ty.span.between(rhs_ty.span), " = ".into()));
+    parts.push((rhs_ty.span.shrink_to_hi(), ">".into()));
+
+    diag.multipart_suggestion(
+        "replace it with an associated item constraint if possible",
+        parts,
+        applicability,
+    );
+}
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index fbd8a3f..d6104c7 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -909,7 +909,7 @@ fn parse_path_like_delegation(&mut self) -> PResult<'a, ItemKind> {
                 ident,
                 rename,
                 body: self.parse_delegation_body()?,
-                from_glob: false,
+                source: DelegationSource::Single,
             }))
         })
     }
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 1b16215..5d12e76 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -18,7 +18,7 @@
 use rustc_hir::attrs::diagnostic::Directive;
 use rustc_hir::attrs::{
     AttributeKind, DocAttribute, DocInline, EiiDecl, EiiImpl, EiiImplResolution, InlineAttr,
-    ReprAttr,
+    OptimizeAttr, ReprAttr,
 };
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::LocalModDefId;
@@ -163,6 +163,7 @@ fn check_attributes(
         self.check_repr(attrs, span, target, item, hir_id);
         self.check_rustc_force_inline(hir_id, attrs, target);
         self.check_mix_no_mangle_export(hir_id, attrs);
+        self.check_optimize_and_inline(attrs);
     }
 
     /// Called by [`Self::check_attributes()`] to check a single attribute which is
@@ -325,6 +326,7 @@ fn check_one_parsed_attribute(
             AttributeKind::RustcClean(..) => (),
             AttributeKind::RustcCoherenceIsCore => (),
             AttributeKind::RustcCoinductive => (),
+            AttributeKind::RustcComptime(_) => (),
             AttributeKind::RustcConfusables { .. } => (),
             AttributeKind::RustcConstStability { .. } => (),
             AttributeKind::RustcConstStableIndirect => (),
@@ -543,7 +545,7 @@ fn check_diagnostic_on_const(
         if target == (Target::Impl { of_trait: true }) {
             match item.unwrap() {
                 ItemLike::Item(it) => match it.expect_impl().constness {
-                    Constness::Const => {
+                    Constness::Const { .. } => {
                         let item_span = self.tcx.hir_span(hir_id);
                         self.tcx.emit_node_span_lint(
                             MISPLACED_DIAGNOSTIC_ATTRIBUTES,
@@ -1582,6 +1584,17 @@ fn check_mix_no_mangle_export(&self, hir_id: HirId, attrs: &[Attribute]) {
         }
     }
 
+    fn check_optimize_and_inline(&self, attrs: &[Attribute]) {
+        if let Some(optimize_span) =
+            find_attr!(attrs, Optimize(OptimizeAttr::DoNotOptimize, span) => *span)
+            && let Some((inline_attr, inline_span)) =
+                find_attr!(attrs, Inline(inline_attr, span) => (inline_attr, *span))
+            && inline_attr != &InlineAttr::Never
+        {
+            self.dcx().emit_err(errors::BothOptimizeNoneAndInline { optimize_span, inline_span });
+        }
+    }
+
     fn check_loop_match(&self, hir_id: HirId, attr_span: Span, target: Target) {
         let node_span = self.tcx.hir_span(hir_id);
 
diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs
index f8b8d22..599c875 100644
--- a/compiler/rustc_passes/src/errors.rs
+++ b/compiler/rustc_passes/src/errors.rs
@@ -179,6 +179,16 @@ pub(crate) struct BothFfiConstAndPure {
 }
 
 #[derive(Diagnostic)]
+#[diag("`#[optimize(none)]` cannot be used with `#[inline]` attributes")]
+pub(crate) struct BothOptimizeNoneAndInline {
+    #[primary_span]
+    #[label("`#[optimize(none)]` here")]
+    pub optimize_span: Span,
+    #[label("`#[inline]` here")]
+    pub inline_span: Span,
+}
+
+#[derive(Diagnostic)]
 #[diag("attribute should be applied to an `extern` block with non-Rust ABI")]
 #[warning(
     "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
diff --git a/compiler/rustc_passes/src/input_stats.rs b/compiler/rustc_passes/src/input_stats.rs
index 9127e49..2f3fbc2 100644
--- a/compiler/rustc_passes/src/input_stats.rs
+++ b/compiler/rustc_passes/src/input_stats.rs
@@ -430,7 +430,7 @@ fn visit_generics(&mut self, g: &'v hir::Generics<'v>) {
     fn visit_where_predicate(&mut self, p: &'v hir::WherePredicate<'v>) {
         record_variants!(
             (self, p, p.kind, Some(p.hir_id), hir, WherePredicate, WherePredicateKind),
-            [BoundPredicate, RegionPredicate, EqPredicate]
+            [BoundPredicate, RegionPredicate]
         );
         hir_visit::walk_where_predicate(self, p)
     }
@@ -705,7 +705,7 @@ fn visit_generic_param(&mut self, g: &'v ast::GenericParam) {
     fn visit_where_predicate(&mut self, p: &'v ast::WherePredicate) {
         record_variants!(
             (self, p, &p.kind, None, ast, WherePredicate, WherePredicateKind),
-            [BoundPredicate, RegionPredicate, EqPredicate]
+            [BoundPredicate, RegionPredicate]
         );
         ast_visit::walk_where_predicate(self, p)
     }
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index 84eba2ac..e2c32e0 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -12,9 +12,9 @@
 use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId, LocalModDefId};
 use rustc_hir::intravisit::{self, Visitor, VisitorExt};
 use rustc_hir::{
-    self as hir, AmbigArg, ConstStability, DefaultBodyStability, FieldDef, HirId, Item, ItemKind,
-    Path, Stability, StabilityLevel, StableSince, TraitRef, Ty, TyKind, UnstableReason, UsePath,
-    VERSION_PLACEHOLDER, Variant, find_attr,
+    self as hir, AmbigArg, ConstStability, Constness, DefaultBodyStability, FieldDef, HirId, Item,
+    ItemKind, Path, Stability, StabilityLevel, StableSince, TraitRef, Ty, TyKind, UnstableReason,
+    UsePath, VERSION_PLACEHOLDER, Variant, find_attr,
 };
 use rustc_middle::hir::nested_filter;
 use rustc_middle::middle::lib_features::{FeatureStability, LibFeatures};
@@ -207,7 +207,7 @@ fn lookup_const_stability(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ConstSt
             let parent_stab = tcx.lookup_stability(parent)?;
             if parent_stab.is_unstable()
                 && let Some(fn_sig) = tcx.hir_node_by_def_id(def_id).fn_sig()
-                && fn_sig.header.is_const()
+                && matches!(fn_sig.header.constness, Constness::Const { .. })
             {
                 let const_stable_indirect = find_attr!(tcx, def_id, RustcConstStableIndirect);
                 return Some(ConstStability::unmarked(const_stable_indirect, parent_stab));
@@ -229,7 +229,7 @@ fn lookup_const_stability(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ConstSt
     // If this is a const fn but not annotated with stability markers, see if we can inherit
     // regular stability.
     if let Some(fn_sig) = tcx.hir_node_by_def_id(def_id).fn_sig()
-        && fn_sig.header.is_const()
+        && matches!(fn_sig.header.constness, Constness::Const { .. })
         && const_stab.is_none()
         // We only ever inherit unstable features.
         && let Some(inherit_regular_stab) = tcx.lookup_stability(def_id)
@@ -385,7 +385,7 @@ macro_rules! find_attr_span {
         // implied), check if the function/method is const or the parent impl block is const.
         let fn_sig = self.tcx.hir_node_by_def_id(def_id).fn_sig();
         if let Some(fn_sig) = fn_sig
-            && !fn_sig.header.is_const()
+            && !matches!(fn_sig.header.constness, Constness::Const { .. })
             && const_stab.is_some()
             && find_attr_span!(RustcConstStability).is_some()
         {
@@ -652,7 +652,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
                     }
 
                     if features.const_trait_impl()
-                        && let hir::Constness::Const = constness
+                        && let hir::Constness::Const { .. } = constness
                     {
                         let stable_or_implied_stable = match const_stab {
                             None => true,
@@ -696,7 +696,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
                     }
                 }
 
-                if let hir::Constness::Const = constness
+                if let hir::Constness::Const { .. } = constness
                     && let Some(def_id) = of_trait.trait_ref.trait_def_id()
                 {
                     // FIXME(const_trait_impl): Improve the span here.
diff --git a/compiler/rustc_privacy/src/errors.rs b/compiler/rustc_privacy/src/diagnostics.rs
similarity index 100%
rename from compiler/rustc_privacy/src/errors.rs
rename to compiler/rustc_privacy/src/diagnostics.rs
diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs
index 9cf0576..1cd1101 100644
--- a/compiler/rustc_privacy/src/lib.rs
+++ b/compiler/rustc_privacy/src/lib.rs
@@ -4,13 +4,13 @@
 #![feature(try_blocks)]
 // tidy-alphabetical-end
 
-mod errors;
+mod diagnostics;
 
 use std::marker::PhantomData;
 use std::ops::ControlFlow;
 use std::{debug_assert_matches, fmt};
 
-use errors::{
+use diagnostics::{
     FieldIsPrivate, FieldIsPrivateLabel, FromPrivateDependencyInPublicInterface, InPublicInterface,
     ItemIsPrivate, PrivateInterfacesOrBoundsLint, ReportEffectiveVisibility, UnnameableTypesLint,
     UnnamedItemIsPrivate,
diff --git a/compiler/rustc_public/src/abi.rs b/compiler/rustc_public/src/abi.rs
index 1227fe2..cde885d 100644
--- a/compiler/rustc_public/src/abi.rs
+++ b/compiler/rustc_public/src/abi.rs
@@ -455,6 +455,7 @@ pub enum CallConvention {
     PreserveMost,
     PreserveAll,
     PreserveNone,
+    Tail,
 
     Custom,
 
diff --git a/compiler/rustc_public/src/ty.rs b/compiler/rustc_public/src/ty.rs
index f71ca72..642e616 100644
--- a/compiler/rustc_public/src/ty.rs
+++ b/compiler/rustc_public/src/ty.rs
@@ -1117,13 +1117,13 @@ pub fn inputs(&self) -> &[Ty] {
 
 #[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
 pub enum Constness {
-    Const,
+    Const { always: bool },
     NotConst,
 }
 
 impl Constness {
     pub fn is_const(self) -> bool {
-        matches!(self, Constness::Const)
+        matches!(self, Constness::Const { always: false })
     }
 }
 
@@ -1167,6 +1167,7 @@ pub enum Abi {
     RiscvInterruptM,
     RiscvInterruptS,
     RustPreserveNone,
+    RustTail,
     RustInvalid,
     Custom,
     Swift,
diff --git a/compiler/rustc_public/src/unstable/convert/internal.rs b/compiler/rustc_public/src/unstable/convert/internal.rs
index 37f00da..81b32f4d 100644
--- a/compiler/rustc_public/src/unstable/convert/internal.rs
+++ b/compiler/rustc_public/src/unstable/convert/internal.rs
@@ -618,6 +618,7 @@ fn internal<'tcx>(
             Abi::RiscvInterruptM => rustc_abi::ExternAbi::RiscvInterruptM,
             Abi::RiscvInterruptS => rustc_abi::ExternAbi::RiscvInterruptS,
             Abi::RustPreserveNone => rustc_abi::ExternAbi::RustPreserveNone,
+            Abi::RustTail => rustc_abi::ExternAbi::RustTail,
             Abi::Custom => rustc_abi::ExternAbi::Custom,
             Abi::Swift => rustc_abi::ExternAbi::Swift,
         }
@@ -647,8 +648,8 @@ fn internal<'tcx>(
         _tables: &mut Tables<'_, BridgeTys>,
         _tcx: impl InternalCx<'tcx>,
     ) -> Self::T<'tcx> {
-        match self {
-            Constness::Const => rustc_hir::Constness::Const,
+        match *self {
+            Constness::Const { always } => rustc_hir::Constness::Const { always },
             Constness::NotConst => rustc_hir::Constness::NotConst,
         }
     }
diff --git a/compiler/rustc_public/src/unstable/convert/stable/abi.rs b/compiler/rustc_public/src/unstable/convert/stable/abi.rs
index f423992..7e0b04f 100644
--- a/compiler/rustc_public/src/unstable/convert/stable/abi.rs
+++ b/compiler/rustc_public/src/unstable/convert/stable/abi.rs
@@ -125,6 +125,7 @@ fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>)
             CanonAbi::Rust => CallConvention::Rust,
             CanonAbi::RustCold => CallConvention::Cold,
             CanonAbi::RustPreserveNone => CallConvention::PreserveNone,
+            CanonAbi::RustTail => CallConvention::Tail,
             CanonAbi::Custom => CallConvention::Custom,
             CanonAbi::Swift => CallConvention::Swift,
             CanonAbi::Arm(arm_call) => match arm_call {
diff --git a/compiler/rustc_public/src/unstable/convert/stable/mod.rs b/compiler/rustc_public/src/unstable/convert/stable/mod.rs
index ce55e898..083a30a 100644
--- a/compiler/rustc_public/src/unstable/convert/stable/mod.rs
+++ b/compiler/rustc_public/src/unstable/convert/stable/mod.rs
@@ -24,8 +24,8 @@ fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>)
 impl<'tcx> Stable<'tcx> for rustc_hir::Constness {
     type T = crate::ty::Constness;
     fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
-        match self {
-            rustc_hir::Constness::Const => crate::ty::Constness::Const,
+        match *self {
+            rustc_hir::Constness::Const { always } => crate::ty::Constness::Const { always },
             rustc_hir::Constness::NotConst => crate::ty::Constness::NotConst,
         }
     }
diff --git a/compiler/rustc_public/src/unstable/convert/stable/ty.rs b/compiler/rustc_public/src/unstable/convert/stable/ty.rs
index 925d4a5..7c9e7c5 100644
--- a/compiler/rustc_public/src/unstable/convert/stable/ty.rs
+++ b/compiler/rustc_public/src/unstable/convert/stable/ty.rs
@@ -540,10 +540,18 @@ fn stable<'cx>(
                 }
             }
             ty::ConstKind::Param(param) => crate::ty::TyConstKind::Param(param.stable(tables, cx)),
-            ty::ConstKind::Unevaluated(uv) => crate::ty::TyConstKind::Unevaluated(
-                tables.const_def(uv.kind.def_id()),
-                uv.args.stable(tables, cx),
-            ),
+            ty::ConstKind::Unevaluated(uv) => {
+                let Some(def_id) = uv.kind.opt_def_id() else {
+                    // FIXME: implement (both AliasTy and UnevaluatedConst will be needing this soon)
+                    panic!(
+                        "non-defid unevaluated constants are not supported by rustc_public at the moment"
+                    )
+                };
+                crate::ty::TyConstKind::Unevaluated(
+                    tables.const_def(def_id),
+                    uv.args.stable(tables, cx),
+                )
+            }
             ty::ConstKind::Error(_) => unreachable!(),
             ty::ConstKind::Infer(_) => unreachable!(),
             ty::ConstKind::Bound(_, _) => unimplemented!(),
@@ -1046,6 +1054,7 @@ fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>)
             ExternAbi::Unadjusted => Abi::Unadjusted,
             ExternAbi::RustCold => Abi::RustCold,
             ExternAbi::RustPreserveNone => Abi::RustPreserveNone,
+            ExternAbi::RustTail => Abi::RustTail,
             ExternAbi::RustInvalid => Abi::RustInvalid,
             ExternAbi::RiscvInterruptM => Abi::RiscvInterruptM,
             ExternAbi::RiscvInterruptS => Abi::RiscvInterruptS,
diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs
index 4fd9894..3e527b6 100644
--- a/compiler/rustc_resolve/src/build_reduced_graph.rs
+++ b/compiler/rustc_resolve/src/build_reduced_graph.rs
@@ -9,9 +9,9 @@
 
 use rustc_ast::visit::{self, AssocCtxt, Visitor, WalkItemKind};
 use rustc_ast::{
-    self as ast, AssocItem, AssocItemKind, Block, ConstItem, DUMMY_NODE_ID, Delegation, Fn,
-    ForeignItem, ForeignItemKind, Inline, Item, ItemKind, NodeId, StaticItem, StmtKind, TraitAlias,
-    TyAlias,
+    self as ast, AssocItem, AssocItemKind, Block, ConstItem, DUMMY_NODE_ID, Delegation,
+    DelegationSource, Fn, ForeignItem, ForeignItemKind, Inline, Item, ItemKind, NodeId, StaticItem,
+    StmtKind, TraitAlias, TyAlias,
 };
 use rustc_attr_parsing::AttributeParser;
 use rustc_expand::base::{ResolverExpand, SyntaxExtension, SyntaxExtensionKind};
@@ -332,15 +332,15 @@ pub(crate) fn try_resolve_visibility(
                     PathResult::NonModule(partial_res) => {
                         expected_found_error(partial_res.expect_full_res())
                     }
-                    PathResult::Failed {
-                        span, label, suggestion, message, segment_name, ..
-                    } => Err(VisResolutionError::FailedToResolve(
-                        span,
-                        segment_name,
-                        label,
-                        suggestion,
-                        message,
-                    )),
+                    PathResult::Failed { label, suggestion, message, segment, .. } => {
+                        Err(VisResolutionError::FailedToResolve(
+                            segment.span,
+                            segment.name,
+                            label,
+                            suggestion,
+                            message,
+                        ))
+                    }
                     PathResult::Indeterminate => Err(VisResolutionError::Indeterminate(path.span)),
                 }
             }
@@ -1461,7 +1461,7 @@ pub(crate) fn brg_visit_assoc_item(
             let parent = self.parent_scope.module.expect_local();
             let expansion = self.parent_scope.expansion;
             self.r.define_local(parent, ident, ns, self.res(def_id), vis, item.span, expansion);
-        } else if !matches!(&item.kind, AssocItemKind::Delegation(deleg) if deleg.from_glob)
+        } else if !matches!(&item.kind, AssocItemKind::Delegation(d) if d.source == DelegationSource::Glob)
             && ident.name != kw::Underscore
         {
             // Don't add underscore names, they cannot be looked up anyway.
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 813f466..aef8d7e 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -2307,7 +2307,7 @@ fn report_privacy_error(&mut self, privacy_error: &PrivacyError<'ra>) {
 
         self.mention_default_field_values(source, ident, &mut err);
 
-        if let Some((this_res, outer_ident)) = outermost_res {
+        let shown_candidates = if let Some((this_res, outer_ident)) = outermost_res {
             let mut import_suggestions = self.lookup_import_candidates(
                 outer_ident,
                 this_res.ns().unwrap_or(Namespace::TypeNS),
@@ -2338,7 +2338,10 @@ fn report_privacy_error(&mut self, privacy_error: &PrivacyError<'ra>) {
                 };
                 err.subdiagnostic(label);
             }
-        }
+            !point_to_def
+        } else {
+            false
+        };
 
         let mut non_exhaustive = None;
         // If an ADT is foreign and marked as `non_exhaustive`, then that's
@@ -2476,8 +2479,9 @@ fn report_privacy_error(&mut self, privacy_error: &PrivacyError<'ra>) {
         // 2) the use isn't nested, otherwise `dedup_span` is one ident in `{...}`.
         //
         // See issue #156060.
-        let can_replace_use =
-            !single_nested && !outermost_res.is_some_and(|(_, outer)| outer.span != ident.span);
+        let can_replace_use = !shown_candidates
+            && !single_nested
+            && !outermost_res.is_some_and(|(_, outer)| outer.span != ident.span);
         if can_replace_use {
             // We prioritize shorter paths, non-core imports and direct imports over the
             // alternatives.
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs
index 46cc163..4f55c16 100644
--- a/compiler/rustc_resolve/src/imports.rs
+++ b/compiler/rustc_resolve/src/imports.rs
@@ -57,6 +57,16 @@ pub(crate) enum PendingDecl<'ra> {
     Pending,
 }
 
+enum ImportResolutionKind<'ra> {
+    Single(PerNS<PendingDecl<'ra>>),
+    Glob(Vec<(Decl<'ra>, BindingKey, Span /* orig_ident_span */)>),
+}
+
+struct ImportResolution<'ra> {
+    kind: ImportResolutionKind<'ra>,
+    imported_module: ModuleOrUniformRoot<'ra>,
+}
+
 impl<'ra> PendingDecl<'ra> {
     pub(crate) fn decl(self) -> Option<Decl<'ra>> {
         match self {
@@ -349,7 +359,7 @@ struct UnresolvedImportError {
     note: Option<String>,
     suggestion: Option<Suggestion>,
     candidates: Option<Vec<ImportSuggestion>>,
-    segment: Option<Symbol>,
+    segment: Option<Ident>,
     /// comes from `PathRes::Failed { module }`
     module: Option<DefId>,
     on_unknown_attr: Option<OnUnknownData>,
@@ -442,7 +452,8 @@ pub(crate) fn new_import_decl(&self, decl: Decl<'ra>, import: Import<'ra>) -> De
             && (vis == import.vis
                 || max_vis.get().is_none_or(|max_vis| vis.greater_than(max_vis, self.tcx)))
         {
-            max_vis.set_unchecked(Some(vis))
+            // `set` can't fail because this can only happen during "write_import_resolutions"
+            max_vis.set(Some(vis), self)
         }
 
         self.arenas.alloc_decl(DeclData {
@@ -559,7 +570,7 @@ fn select_glob_decl(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> De
                 && glob_decl.ambiguity.get().is_none()
             {
                 // Do not lose glob ambiguities when re-fetching the glob.
-                glob_decl.ambiguity.set_unchecked(Some((old_ambig, true)));
+                glob_decl.ambiguity.set(Some((old_ambig, true)), self);
             }
             glob_decl
         } else if glob_decl.res() != old_glob_decl.res() {
@@ -567,7 +578,7 @@ fn select_glob_decl(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> De
                 || self.is_rustybuzz_0_4_0(old_glob_decl, glob_decl)
                 || self.is_pdf_0_9_0(old_glob_decl, glob_decl)
                 || self.is_net2_0_2_39(old_glob_decl, glob_decl);
-            old_glob_decl.ambiguity.set_unchecked(Some((glob_decl, warning)));
+            old_glob_decl.ambiguity.set(Some((glob_decl, warning)), self);
             old_glob_decl
         } else if let old_vis = old_glob_decl.vis()
             && let vis = glob_decl.vis()
@@ -576,17 +587,17 @@ fn select_glob_decl(&self, old_glob_decl: Decl<'ra>, glob_decl: Decl<'ra>) -> De
             // We are glob-importing the same item but with a different visibility.
             // All visibilities here are ordered because all of them are ancestors of `module`.
             if vis.greater_than(old_vis, self.tcx) {
-                old_glob_decl.ambiguity_vis_max.set_unchecked(Some(glob_decl));
+                old_glob_decl.ambiguity_vis_max.set(Some(glob_decl), self);
             } else if let old_min_vis = old_glob_decl.min_vis()
                 && old_min_vis != vis
                 && old_min_vis.greater_than(vis, self.tcx)
             {
-                old_glob_decl.ambiguity_vis_min.set_unchecked(Some(glob_decl));
+                old_glob_decl.ambiguity_vis_min.set(Some(glob_decl), self);
             }
             old_glob_decl
         } else if glob_decl.is_ambiguity_recursive() && !old_glob_decl.is_ambiguity_recursive() {
             // Overwriting a non-ambiguous glob import with an ambiguous glob import.
-            old_glob_decl.ambiguity.set_unchecked(Some((glob_decl, true)));
+            old_glob_decl.ambiguity.set(Some((glob_decl, true)), self);
             old_glob_decl
         } else {
             old_glob_decl
@@ -613,7 +624,7 @@ pub(crate) fn try_plant_decl_into_local_module(
         // because they can be fetched by glob imports from those modules, and bring traits
         // into scope both directly and through glob imports.
         let key = BindingKey::new_disambiguated(ident, ns, || {
-            module.underscore_disambiguator.update_unchecked(|d| d + 1);
+            module.underscore_disambiguator.update(self, |d| d + 1);
             module.underscore_disambiguator.get()
         });
         self.update_local_resolution(module, key, orig_ident_span, |this, resolution| {
@@ -650,7 +661,7 @@ fn update_local_resolution<T, F>(
         let (binding, t) = {
             let resolution = &mut *self
                 .resolution_or_default(module.to_module(), key, orig_ident_span)
-                .borrow_mut_unchecked();
+                .borrow_mut(self);
             let old_decl = resolution.determined_decl();
             let old_vis = old_decl.map(|d| d.vis());
 
@@ -665,7 +676,7 @@ fn update_local_resolution<T, F>(
             }
         };
 
-        let Ok(glob_importers) = module.glob_importers.try_borrow_mut_unchecked() else {
+        let Ok(glob_importers) = module.glob_importers.try_borrow_mut(self) else {
             return t;
         };
 
@@ -727,11 +738,12 @@ fn import_dummy_binding(&mut self, import: Import<'ra>, is_indeterminate: bool)
 
     // Import resolution
     //
-    // This is a fixed-point algorithm. We resolve imports until our efforts
-    // are stymied by an unresolved import; then we bail out of the current
-    // module and continue. We terminate successfully once no more imports
-    // remain or unsuccessfully when no forward progress in resolving imports
-    // is made.
+    // This is a batched fixed-point algorithm. Each import is resolved in
+    // isolation, with any resolutions collected for later.
+    // After a full pass over the current set of `indeterminate_imports`,
+    // the collected resolutions are committed together. The process
+    // repeats until either no imports remain or no further progress can
+    // be made.
 
     /// Resolves all imports for the crate. This method performs the fixed-
     /// point iteration.
@@ -741,16 +753,125 @@ pub(crate) fn resolve_imports(&mut self) {
         while indeterminate_count < prev_indeterminate_count {
             prev_indeterminate_count = indeterminate_count;
             indeterminate_count = 0;
+            let mut resolutions = Vec::new();
             self.assert_speculative = true;
             for import in mem::take(&mut self.indeterminate_imports) {
-                let import_indeterminate_count = self.cm().resolve_import(import);
+                let (resolution, import_indeterminate_count) = self.cm().resolve_import(import);
                 indeterminate_count += import_indeterminate_count;
                 match import_indeterminate_count {
                     0 => self.determined_imports.push(import),
                     _ => self.indeterminate_imports.push(import),
                 }
+                if let Some(resolution) = resolution {
+                    resolutions.push((import, resolution));
+                }
             }
             self.assert_speculative = false;
+            self.write_import_resolutions(resolutions);
+        }
+    }
+
+    fn write_import_resolutions(
+        &mut self,
+        import_resolutions: Vec<(Import<'ra>, ImportResolution<'ra>)>,
+    ) {
+        for (import, resolution) in &import_resolutions {
+            let ImportResolution { imported_module, .. } = resolution;
+            import.imported_module.set(Some(*imported_module), self);
+
+            if import.is_glob()
+                && let ModuleOrUniformRoot::Module(module) = imported_module
+                && import.parent_scope.module != *module
+                && module.is_local()
+            {
+                module.glob_importers.borrow_mut(self).push(*import);
+            }
+        }
+
+        for (import, resolution) in import_resolutions {
+            let ImportResolution { imported_module, kind: resolution_kind } = resolution;
+
+            match (&import.kind, resolution_kind) {
+                (
+                    ImportKind::Single { target, decls, .. },
+                    ImportResolutionKind::Single(import_decls),
+                ) => {
+                    self.per_ns(|this, ns| {
+                        match import_decls[ns] {
+                            PendingDecl::Ready(Some(import_decl)) => {
+                                if import_decl.is_assoc_item()
+                                    && !this.tcx.features().import_trait_associated_functions()
+                                {
+                                    feature_err(
+                                        this.tcx.sess,
+                                        sym::import_trait_associated_functions,
+                                        import.span,
+                                        "`use` associated items of traits is unstable",
+                                    )
+                                    .emit();
+                                }
+                                this.plant_decl_into_local_module(
+                                    IdentKey::new(*target),
+                                    target.span,
+                                    ns,
+                                    import_decl,
+                                );
+                                decls[ns].set(PendingDecl::Ready(Some(import_decl)), this);
+                            }
+                            PendingDecl::Ready(None) => {
+                                // Don't remove underscores from `single_imports`, they were never added.
+                                if target.name != kw::Underscore {
+                                    let key = BindingKey::new(IdentKey::new(*target), ns);
+                                    this.update_local_resolution(
+                                        import.parent_scope.module.expect_local(),
+                                        key,
+                                        target.span,
+                                        |_, resolution| {
+                                            resolution.single_imports.swap_remove(&import);
+                                        },
+                                    );
+                                }
+                                decls[ns].set(PendingDecl::Ready(None), this);
+                            }
+                            PendingDecl::Pending => {}
+                        }
+                    });
+                }
+                (ImportKind::Glob { id, .. }, ImportResolutionKind::Glob(imported_decls)) => {
+                    let ModuleOrUniformRoot::Module(module) = imported_module else {
+                        self.dcx().emit_err(CannotGlobImportAllCrates { span: import.span });
+                        continue;
+                    };
+
+                    if module.is_trait() && !self.tcx.features().import_trait_associated_functions()
+                    {
+                        feature_err(
+                            self.tcx.sess,
+                            sym::import_trait_associated_functions,
+                            import.span,
+                            "`use` associated items of traits is unstable",
+                        )
+                        .emit();
+                    }
+
+                    for (binding, key, orig_ident_span) in imported_decls {
+                        let import_decl = self.new_import_decl(binding, import);
+                        let _ = self
+                            .try_plant_decl_into_local_module(
+                                key.ident,
+                                orig_ident_span,
+                                key.ns,
+                                import_decl,
+                            )
+                            .expect("planting a glob cannot fail");
+                    }
+
+                    self.record_partial_res(*id, PartialRes::new(module.res().unwrap()));
+                }
+
+                // Something weird happened, which shouldn't have happened.
+                _ => unreachable!("mismatched import and resolution kind"),
+            }
         }
     }
 
@@ -960,7 +1081,7 @@ fn throw_unresolved_import_error(
             Some(def_id) if self.mods_with_parse_errors.contains(&def_id) => false,
             // If we've encountered something like `use _;`, we've already emitted an error stating
             // that `_` is not a valid identifier, so we ignore that resolve error.
-            _ => err.segment != Some(kw::Underscore),
+            _ => err.segment.map(|s| s.name) != Some(kw::Underscore),
         });
         if errors.is_empty() {
             self.tcx.dcx().delayed_bug("expected a parse or \"`_` can't be an identifier\" error");
@@ -988,7 +1109,7 @@ fn throw_unresolved_import_error(
                 let this = errors.iter().map(|(_import, err)| {
 
                     // Is this unwrap_or reachable?
-                    err.segment.unwrap_or(kw::Underscore)
+                    err.segment.map(|s|s.name).unwrap_or(kw::Underscore)
                 }).join(", ");
 
                 let args = FormatArgs {
@@ -1023,10 +1144,14 @@ fn throw_unresolved_import_error(
         const MAX_LABEL_COUNT: usize = 10;
 
         for (import, err) in errors.into_iter().take(MAX_LABEL_COUNT) {
+            let label_span = match err.segment {
+                Some(segment) => segment.span,
+                None => err.span,
+            };
             if let Some(label) = &label {
-                diag.span_label(err.span, label.clone());
+                diag.span_label(label_span, label.clone());
             } else if let Some(label) = &err.label {
-                diag.span_label(err.span, label.clone());
+                diag.span_label(label_span, label.clone());
             }
 
             if let Some((suggestions, msg, applicability)) = err.suggestion {
@@ -1071,7 +1196,7 @@ fn throw_unresolved_import_error(
                 && let Some(segment) = err.segment
                 && let Some(module) = err.module
             {
-                self.find_cfg_stripped(&mut diag, &segment, module)
+                self.find_cfg_stripped(&mut diag, &segment.name, module)
             }
         }
 
@@ -1085,12 +1210,15 @@ fn throw_unresolved_import_error(
     /// - `0` means its resolution is determined.
     /// - Other values mean that indeterminate exists under certain namespaces.
     ///
-    /// Meanwhile, if resolve successful, the resolved bindings are written
-    /// into the module.
-    fn resolve_import<'r>(mut self: CmResolver<'r, 'ra, 'tcx>, import: Import<'ra>) -> usize {
+    /// Meanwhile, if resolution is successful, its result is returned.
+    fn resolve_import<'r>(
+        mut self: CmResolver<'r, 'ra, 'tcx>,
+        import: Import<'ra>,
+    ) -> (Option<ImportResolution<'ra>>, usize) {
         debug!(
-            "(resolving import for module) resolving import `{}::...` in `{}`",
+            "(resolving import for module) resolving import `{}::{}` in `{}`",
             Segment::names_to_string(&import.module_path),
+            import_kind_to_string(&import.kind),
             module_to_string(import.parent_scope.module).unwrap_or_else(|| "???".to_string()),
         );
         let module = if let Some(module) = import.imported_module.get() {
@@ -1105,21 +1233,24 @@ fn resolve_import<'r>(mut self: CmResolver<'r, 'ra, 'tcx>, import: Import<'ra>)
 
             match path_res {
                 PathResult::Module(module) => module,
-                PathResult::Indeterminate => return 3,
-                PathResult::NonModule(..) | PathResult::Failed { .. } => return 0,
+                PathResult::Indeterminate => return (None, 3),
+                PathResult::NonModule(..) | PathResult::Failed { .. } => return (None, 0),
             }
         };
 
-        import.imported_module.set_unchecked(Some(module));
-        let (source, target, bindings) = match import.kind {
-            ImportKind::Single { source, target, ref decls, .. } => (source, target, decls),
+        let (source, bindings) = match import.kind {
+            ImportKind::Single { source, ref decls, .. } => (source, decls),
             ImportKind::Glob { .. } => {
-                self.get_mut_unchecked().resolve_glob_import(import);
-                return 0;
+                let import_resolution = ImportResolution {
+                    imported_module: module,
+                    kind: self.resolve_glob_import(import, module),
+                };
+                return (Some(import_resolution), 0);
             }
             _ => unreachable!(),
         };
 
+        let mut import_decls = PerNS::default();
         let mut indeterminate_count = 0;
         self.per_ns_cm(|mut this, ns| {
             if bindings[ns].get() != PendingDecl::Pending {
@@ -1132,54 +1263,26 @@ fn resolve_import<'r>(mut self: CmResolver<'r, 'ra, 'tcx>, import: Import<'ra>)
                 &import.parent_scope,
                 Some(import),
             );
-            let parent = import.parent_scope.module;
-            let binding = match binding_result {
+            let pending_decl = match binding_result {
                 Ok(binding) => {
-                    if binding.is_assoc_item()
-                        && !this.tcx.features().import_trait_associated_functions()
-                    {
-                        feature_err(
-                            this.tcx.sess,
-                            sym::import_trait_associated_functions,
-                            import.span,
-                            "`use` associated items of traits is unstable",
-                        )
-                        .emit();
-                    }
                     // We need the `target`, `source` can be extracted.
                     let import_decl = this.new_import_decl(binding, import);
-                    this.get_mut_unchecked().plant_decl_into_local_module(
-                        IdentKey::new(target),
-                        target.span,
-                        ns,
-                        import_decl,
-                    );
                     PendingDecl::Ready(Some(import_decl))
                 }
-                Err(Determinacy::Determined) => {
-                    // Don't remove underscores from `single_imports`, they were never added.
-                    if target.name != kw::Underscore {
-                        let key = BindingKey::new(IdentKey::new(target), ns);
-                        this.get_mut_unchecked().update_local_resolution(
-                            parent.expect_local(),
-                            key,
-                            target.span,
-                            |_, resolution| {
-                                resolution.single_imports.swap_remove(&import);
-                            },
-                        );
-                    }
-                    PendingDecl::Ready(None)
-                }
+                Err(Determinacy::Determined) => PendingDecl::Ready(None),
                 Err(Determinacy::Undetermined) => {
                     indeterminate_count += 1;
                     PendingDecl::Pending
                 }
             };
-            bindings[ns].set_unchecked(binding);
+            import_decls[ns] = pending_decl;
         });
+        let import_resolution = ImportResolution {
+            imported_module: module,
+            kind: ImportResolutionKind::Single(import_decls),
+        };
 
-        indeterminate_count
+        (Some(import_resolution), indeterminate_count)
     }
 
     /// Performs final import resolution, consistency checks and error reporting.
@@ -1230,7 +1333,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option<UnresolvedImportErr
             PathResult::Failed {
                 is_error_from_last_segment: false,
                 span,
-                segment_name,
+                segment,
                 label,
                 suggestion,
                 module,
@@ -1245,7 +1348,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option<UnresolvedImportErr
                     self.report_error(
                         span,
                         ResolutionError::FailedToResolve {
-                            segment: segment_name,
+                            segment: segment.name,
                             label,
                             suggestion,
                             module,
@@ -1261,7 +1364,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option<UnresolvedImportErr
                 label,
                 suggestion,
                 module,
-                segment_name,
+                segment,
                 note,
                 ..
             } => {
@@ -1287,7 +1390,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option<UnresolvedImportErr
                                 Applicability::MaybeIncorrect,
                             )),
                             candidates: None,
-                            segment: Some(segment_name),
+                            segment: Some(segment),
                             module,
                             on_unknown_attr: import.on_unknown_attr.clone(),
                         },
@@ -1297,7 +1400,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option<UnresolvedImportErr
                             note,
                             suggestion,
                             candidates: None,
-                            segment: Some(segment_name),
+                            segment: Some(segment),
                             module,
                             on_unknown_attr: import.on_unknown_attr.clone(),
                         },
@@ -1592,7 +1695,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option<UnresolvedImportErr
                             None
                         }
                     }),
-                    segment: Some(ident.name),
+                    segment: Some(ident),
                     on_unknown_attr: import.on_unknown_attr.clone(),
                 })
             } else {
@@ -1799,68 +1902,72 @@ pub(crate) fn check_for_redundant_imports(&mut self, import: Import<'ra>) -> boo
         false
     }
 
-    fn resolve_glob_import(&mut self, import: Import<'ra>) {
-        // This function is only called for glob imports.
-        let ImportKind::Glob { id, .. } = import.kind else { unreachable!() };
+    fn resolve_glob_import(
+        &self,
+        import: Import<'ra>,
+        imported_module: ModuleOrUniformRoot<'ra>,
+    ) -> ImportResolutionKind<'ra> {
+        let import_bindings = match imported_module {
+            ModuleOrUniformRoot::Module(module) if module != import.parent_scope.module => self
+                .resolutions(module)
+                .borrow()
+                .iter()
+                .filter_map(|(key, resolution)| {
+                    let res = resolution.borrow();
+                    let decl = res.determined_decl()?;
+                    let mut key = *key;
+                    let scope = match key.ident.ctxt.update_unchecked(|ctxt| {
+                        ctxt.reverse_glob_adjust(module.expansion, import.span)
+                    }) {
+                        Some(Some(def)) => self.expn_def_scope(def),
+                        Some(None) => import.parent_scope.module,
+                        None => return None,
+                    };
+                    self.is_accessible_from(decl.vis(), scope).then_some((
+                        decl,
+                        key,
+                        res.orig_ident_span,
+                    ))
+                })
+                .collect::<Vec<_>>(),
 
-        let ModuleOrUniformRoot::Module(module) = import.imported_module.get().unwrap() else {
-            self.dcx().emit_err(CannotGlobImportAllCrates { span: import.span });
-            return;
+            // Errors are reported in `write_imports_resolutions`
+            _ => vec![],
         };
 
-        if module.is_trait() && !self.tcx.features().import_trait_associated_functions() {
-            feature_err(
-                self.tcx.sess,
-                sym::import_trait_associated_functions,
-                import.span,
-                "`use` associated items of traits is unstable",
-            )
-            .emit();
+        ImportResolutionKind::Glob(import_bindings)
+    }
+
+    // Hack for the `rust_embed` regression observed in the crater run of #145108.
+    fn rust_embed_hack(&self, module: LocalModule<'ra>, decl: Decl<'ra>) -> bool {
+        // We are looking for this pattern:
+        // ```rust
+        // #[macro_use]
+        // extern crate rust_embed_impl;
+        // pub use rust_embed_impl::*;
+        //
+        // pub use RustEmbed as Embed;
+        // ```
+        if let DeclKind::Import { source_decl, import } = decl.kind
+            // Check that `decl` is the re-export: "pub use RustEmbed as Embed;"
+            && let ImportKind::Single { source, .. } = import.kind
+            && source.name == sym::RustEmbed
+            // make sure that the import points to the #[macro_use] import
+            && let DeclKind::Import { import, .. } = source_decl.kind
+            && matches!(import.kind, ImportKind::MacroUse { .. })
+            && self.macro_use_prelude.contains_key(&source.name) // and that the name actually exists in the macro_use_prelude
+            // Then check that `RustEmbed` exists in the modules Macro namespace.
+            && let Some(y_decl) = self
+                .resolution(module.to_module(), BindingKey::new(IdentKey::new(source), MacroNS))
+                .and_then(|res| res.best_decl())
+            // which comes from "pub use rust_embed_impl::*"
+            && y_decl.is_glob_import()
+            && y_decl.vis().is_public()
+        {
+            return true;
         }
 
-        if module == import.parent_scope.module {
-            return;
-        }
-
-        // Add to module's glob_importers
-        if module.is_local() {
-            module.glob_importers.borrow_mut_unchecked().push(import);
-        }
-
-        // Ensure that `resolutions` isn't borrowed during `try_define`,
-        // since it might get updated via a glob cycle.
-        let bindings = self
-            .resolutions(module)
-            .borrow()
-            .iter()
-            .filter_map(|(key, resolution)| {
-                let resolution = resolution.borrow();
-                resolution.determined_decl().map(|decl| (*key, decl, resolution.orig_ident_span))
-            })
-            .collect::<Vec<_>>();
-        for (mut key, binding, orig_ident_span) in bindings {
-            let scope =
-                match key.ident.ctxt.update_unchecked(|ctxt| {
-                    ctxt.reverse_glob_adjust(module.expansion, import.span)
-                }) {
-                    Some(Some(def)) => self.expn_def_scope(def),
-                    Some(None) => import.parent_scope.module,
-                    None => continue,
-                };
-            if self.is_accessible_from(binding.vis(), scope) {
-                let import_decl = self.new_import_decl(binding, import);
-                self.try_plant_decl_into_local_module(
-                    key.ident,
-                    orig_ident_span,
-                    key.ns,
-                    import_decl,
-                )
-                .expect("planting a glob cannot fail");
-            }
-        }
-
-        // Record the destination of this import
-        self.record_partial_res(id, PartialRes::new(module.res().unwrap()));
+        false
     }
 
     // Miscellaneous post-processing, including recording re-exports,
@@ -1879,13 +1986,17 @@ fn finalize_resolutions_in(
         let mut children = Vec::new();
         let mut ambig_children = Vec::new();
 
-        module.to_module().for_each_child(self, |_this, ident, orig_ident_span, _, binding| {
-            let res = binding.res().expect_non_local();
+        module.to_module().for_each_child(self, |this, ident, orig_ident_span, _, decl| {
+            let res = decl.res().expect_non_local();
             if res != def::Res::Err {
+                let vis = if this.rust_embed_hack(module, decl) {
+                    Visibility::Public
+                } else {
+                    decl.vis()
+                };
                 let ident = ident.orig(orig_ident_span);
-                let child =
-                    |reexport_chain| ModChild { ident, res, vis: binding.vis(), reexport_chain };
-                if let Some((ambig_binding1, ambig_binding2)) = binding.descent_to_ambiguity() {
+                let child = |reexport_chain| ModChild { ident, res, vis, reexport_chain };
+                if let Some((ambig_binding1, ambig_binding2)) = decl.descent_to_ambiguity() {
                     let main = child(ambig_binding1.reexport_chain());
                     let second = ModChild {
                         ident,
@@ -1895,7 +2006,7 @@ fn finalize_resolutions_in(
                     };
                     ambig_children.push(AmbigModChild { main, second })
                 } else {
-                    children.push(child(binding.reexport_chain()));
+                    children.push(child(decl.reexport_chain()));
                 }
             }
         });
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index 06e5d83..0c337bf 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -5015,7 +5015,7 @@ fn resolve_qpath(
                 label,
                 suggestion,
                 module,
-                segment_name,
+                segment,
                 error_implied_by_parse_error: _,
                 message,
                 note: _,
@@ -5023,7 +5023,7 @@ fn resolve_qpath(
                 return Err(respan(
                     span,
                     ResolutionError::FailedToResolve {
-                        segment: segment_name,
+                        segment: segment.name,
                         label,
                         suggestion,
                         module,
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs
index 9af5556..4216d7b 100644
--- a/compiler/rustc_resolve/src/lib.rs
+++ b/compiler/rustc_resolve/src/lib.rs
@@ -477,8 +477,8 @@ enum PathResult<'ra> {
         ///
         /// In this case, `module` will point to `a`.
         module: Option<ModuleOrUniformRoot<'ra>>,
-        /// The segment name of target
-        segment_name: Symbol,
+        /// The segment of target
+        segment: Ident,
         error_implied_by_parse_error: bool,
         message: String,
         note: Option<String>,
@@ -507,7 +507,7 @@ fn failed(
         };
         PathResult::Failed {
             span: ident.span,
-            segment_name: ident.name,
+            segment: ident,
             label,
             suggestion,
             is_error_from_last_segment,
@@ -2868,16 +2868,10 @@ pub(crate) fn reborrow(&mut self) -> RefOrMut<'_, T> {
         #[track_caller]
         pub(crate) fn get_mut(&mut self) -> &mut T {
             match self.mutable {
-                false => panic!("Can't mutably borrow speculative resolver"),
+                false => panic!("can't mutably borrow speculative resolver"),
                 true => self.p,
             }
         }
-
-        /// Returns a mutable reference to the inner value without checking if
-        /// it's in a mutable state.
-        pub(crate) fn get_mut_unchecked(&mut self) -> &mut T {
-            self.p
-        }
     }
 
     /// A wrapper around a [`Cell`] that only allows mutation based on a condition in the resolver.
@@ -2901,12 +2895,12 @@ pub(crate) const fn get(&self) -> T {
             self.0.get()
         }
 
-        pub(crate) fn update_unchecked(&self, f: impl FnOnce(T) -> T)
+        pub(crate) fn update<'ra, 'tcx>(&self, r: &Resolver<'ra, 'tcx>, f: impl FnOnce(T) -> T)
         where
             T: Copy,
         {
             let old = self.get();
-            self.set_unchecked(f(old));
+            self.set(f(old), r);
         }
     }
 
@@ -2915,7 +2909,10 @@ pub(crate) const fn new(value: T) -> CmCell<T> {
             CmCell(Cell::new(value))
         }
 
-        pub(crate) fn set_unchecked(&self, val: T) {
+        pub(crate) fn set<'ra, 'tcx>(&self, val: T, r: &Resolver<'ra, 'tcx>) {
+            if r.assert_speculative {
+                panic!("not allowed to mutate a `CmCell` during speculative resolution")
+            }
             self.0.set(val);
         }
 
@@ -2941,13 +2938,23 @@ pub(crate) fn borrow_mut_unchecked(&self) -> RefMut<'_, T> {
         #[track_caller]
         pub(crate) fn borrow_mut<'ra, 'tcx>(&self, r: &Resolver<'ra, 'tcx>) -> RefMut<'_, T> {
             if r.assert_speculative {
-                panic!("Not allowed to mutably borrow a CmRefCell during speculative resolution");
+                panic!("not allowed to mutably borrow a `CmRefCell` during speculative resolution");
             }
-            self.borrow_mut_unchecked()
+            self.0.borrow_mut()
+        }
+
+        pub(crate) fn try_borrow_mut_unchecked(&self) -> Result<RefMut<'_, T>, BorrowMutError> {
+            self.0.try_borrow_mut()
         }
 
         #[track_caller]
-        pub(crate) fn try_borrow_mut_unchecked(&self) -> Result<RefMut<'_, T>, BorrowMutError> {
+        pub(crate) fn try_borrow_mut<'ra, 'tcx>(
+            &self,
+            r: &Resolver<'ra, 'tcx>,
+        ) -> Result<RefMut<'_, T>, BorrowMutError> {
+            if r.assert_speculative {
+                panic!("not allowed to mutably borrow a `CmRefCell` during speculative resolution");
+            }
             self.0.try_borrow_mut()
         }
 
@@ -2960,7 +2967,7 @@ pub(crate) fn borrow(&self) -> Ref<'_, T> {
     impl<T: Default> CmRefCell<T> {
         pub(crate) fn take<'ra, 'tcx>(&self, r: &Resolver<'ra, 'tcx>) -> T {
             if r.assert_speculative {
-                panic!("Not allowed to mutate a CmRefCell during speculative resolution");
+                panic!("not allowed to mutate a CmRefCell during speculative resolution");
             }
             self.0.take()
         }
diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs
index 2da26e0..4dec7f5 100644
--- a/compiler/rustc_resolve/src/macros.rs
+++ b/compiler/rustc_resolve/src/macros.rs
@@ -959,9 +959,7 @@ pub(crate) fn finalize_macro_resolutions(&mut self, krate: &Crate) {
                 path_res @ (PathResult::NonModule(..) | PathResult::Failed { .. }) => {
                     let mut suggestion = None;
                     let (span, message, label, module, segment) = match path_res {
-                        PathResult::Failed {
-                            span, label, module, segment_name, message, ..
-                        } => {
+                        PathResult::Failed { span, label, module, segment, message, .. } => {
                             // try to suggest if it's not a macro, maybe a function
                             if let PathResult::NonModule(partial_res) = self
                                 .cm()
@@ -980,7 +978,7 @@ pub(crate) fn finalize_macro_resolutions(&mut self, krate: &Crate) {
                                     Applicability::MaybeIncorrect,
                                 ));
                             }
-                            (span, message, label, module, segment_name)
+                            (span, message, label, module, segment.name)
                         }
                         PathResult::NonModule(partial_res) => {
                             let found_an = partial_res.base_res().article();
diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs
index f26405c..92bc577 100644
--- a/compiler/rustc_resolve/src/rustdoc.rs
+++ b/compiler/rustc_resolve/src/rustdoc.rs
@@ -412,17 +412,16 @@ pub fn may_be_doc_link(link_type: LinkType) -> bool {
 pub(crate) fn attrs_to_preprocessed_links(attrs: &[ast::Attribute]) -> Vec<Box<str>> {
     let (doc_fragments, other_attrs) =
         attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), false);
-    let mut doc =
-        prepare_to_doc_link_resolution(&doc_fragments).into_values().next().unwrap_or_default();
+    let doc = prepare_to_doc_link_resolution(&doc_fragments).into_values().next();
+    let mut links = doc.as_deref().map(parse_links).unwrap_or_default();
 
     for attr in other_attrs {
         if let Some(note) = attr.deprecation_note() {
-            doc += note.as_str();
-            doc += "\n";
+            links.extend(parse_links(note.as_str()));
         }
     }
 
-    parse_links(&doc)
+    links
 }
 
 /// Similar version of `markdown_links` from rustdoc.
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index d1ffdd1..1b3217e 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -2465,6 +2465,14 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
     let mut collected_options = Default::default();
 
     let mut unstable_opts = UnstableOptions::build(early_dcx, matches, &mut collected_options);
+
+    if unstable_opts.staticlib_hide_internal_symbols && !crate_types.contains(&CrateType::StaticLib)
+    {
+        early_dcx.early_warn(
+            "-Zstaticlib-hide-internal-symbols has no effect without `--crate-type staticlib`",
+        );
+    }
+
     let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(early_dcx, matches);
 
     if !unstable_opts.unstable_options && json_timings {
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index e6b7d2e..6ae0d97 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -2688,6 +2688,8 @@ pub(crate) fn parse_assert_incr_state(
         "control stack smash protection strategy (`rustc --print stack-protector-strategies` for details)"),
     staticlib_allow_rdylib_deps: bool = (false, parse_bool, [TRACKED],
         "allow staticlibs to have rust dylib dependencies"),
+    staticlib_hide_internal_symbols: bool = (false, parse_bool, [TRACKED],
+        "hide non-exported symbols in ELF static libraries by setting STV_HIDDEN"),
     staticlib_prefer_dynamic: bool = (false, parse_bool, [TRACKED],
         "prefer dynamic linking to static linking for staticlibs (default: no)"),
     strict_init_checks: bool = (false, parse_bool, [TRACKED],
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index fb433ae..4e93acf 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -2,11 +2,12 @@
 //! allows bidirectional lookup; i.e., given a value, one can easily find the
 //! type, and vice versa.
 
-use std::hash::{Hash, Hasher};
+use std::hash::{BuildHasher, Hash, Hasher};
 use std::{fmt, str};
 
 use rustc_arena::DroplessArena;
-use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
+use rustc_data_structures::fx::FxBuildHasher;
+use rustc_data_structures::hash_table::{Entry, HashTable};
 use rustc_data_structures::stable_hash::{StableCompare, StableHash, StableHashCtxt, StableHasher};
 use rustc_data_structures::sync::Lock;
 use rustc_macros::{Decodable, Encodable, StableHash, symbols};
@@ -183,6 +184,7 @@
         Cell,
         Char,
         Cleanup,
+        Client,
         Clone,
         CoercePointee,
         CoercePointeeValidated,
@@ -268,7 +270,6 @@
         PinDerefMutHelper,
         Pointer,
         Poll,
-        ProcMacro,
         Range,
         RangeCopy,
         RangeFrom,
@@ -294,6 +295,8 @@
         ResumeTy,
         Reverse,
         Rust,
+        // Temporary name for the rust_embed hack introduced in #145108
+        RustEmbed,
         RustaceansAreAwesome,
         RwLock,
         RwLockReadGuard,
@@ -466,6 +469,7 @@
         async_iterator,
         async_iterator_poll_next,
         async_trait_bounds,
+        atomic,
         atomic_and,
         atomic_cxchg,
         atomic_cxchgweak,
@@ -508,7 +512,6 @@
         await_macro,
         backchain,
         backend_repr,
-        bang,
         begin_panic,
         bench,
         bevy_ecs,
@@ -540,6 +543,7 @@
         braced_empty_structs,
         branch,
         breakpoint,
+        breg,
         bridge,
         bswap,
         built,
@@ -704,6 +708,7 @@
         contracts_internals,
         contracts_requires,
         convert,
+        coprocessor,
         copy,
         copy_closures,
         copy_nonoverlapping,
@@ -879,6 +884,7 @@
         ermsb_target_feature,
         exact_div,
         except,
+        exception,
         exception_handling: "exception-handling",
         exclusive_range_pattern,
         exhaustive_integer_patterns,
@@ -888,6 +894,8 @@
         exp2f32,
         exp2f64,
         exp2f128,
+        expand1,
+        expand2,
         expect,
         expected,
         expf16,
@@ -905,6 +913,7 @@
         expr_fragment_specifier_2024,
         extended_key_value_attributes,
         extended_varargs_abi_support,
+        extendedl32r,
         extern_absolute_paths,
         extern_crate_item_prelude,
         extern_crate_self,
@@ -988,6 +997,9 @@
         format_argument,
         format_arguments,
         format_macro,
+        format_placeholder,
+        format_unsafe_arg,
+        fp,
         framework,
         freeze,
         freeze_impls,
@@ -1049,6 +1061,8 @@
         hexagon_target_feature,
         hidden,
         hide,
+        highpriinterrupts,
+        hint,
         homogeneous_aggregate,
         html_favicon_url,
         html_logo_url,
@@ -1109,6 +1123,7 @@
         internal,
         internal_eq_trait_method_impls,
         internal_features,
+        interrupt,
         into_async_iter_into_iter,
         into_future,
         into_iter,
@@ -1204,6 +1219,7 @@
         lt,
         m68k,
         m68k_target_feature,
+        mac16,
         macho: "mach-o",
         macro_at_most_once_rep,
         macro_attr,
@@ -1316,6 +1332,8 @@
         mir_unwind_unreachable,
         mir_variant,
         miri,
+        misc,
+        miscsr,
         mmx_reg,
         modifiers,
         module,
@@ -1564,6 +1582,8 @@
         prelude_import,
         preserves_flags,
         prfchw_target_feature,
+        prid,
+        primitive,
         proc_dash_macro: "proc-macro",
         proc_macro,
         proc_macro_attribute,
@@ -1703,6 +1723,7 @@
         rust_logo,
         rust_out,
         rust_preserve_none_cc,
+        rust_tail_cc,
         rustc,
         rustc_abi,
         // FIXME(#82232, #143834): temporary name to mitigate `#[align]` nameres ambiguity
@@ -1722,6 +1743,7 @@
         rustc_clean,
         rustc_coherence_is_core,
         rustc_coinductive,
+        rustc_comptime,
         rustc_confusables,
         rustc_const_stable,
         rustc_const_stable_indirect,
@@ -1819,7 +1841,9 @@
         rustdoc_missing_doc_code_examples,
         rustfmt,
         rvalue_static_promotion,
+        rvector,
         rwpi,
+        s32c1i,
         s390x,
         s390x_target_feature,
         s390x_target_feature_vector,
@@ -2049,9 +2073,11 @@
         test_unstable_lint,
         thread,
         thread_local,
+        threadptr,
         three_way_compare,
         thumb2,
         thumb_mode: "thumb-mode",
+        time,
         tmm_reg,
         to_owned_method,
         to_string,
@@ -2275,6 +2301,7 @@
         while_let,
         whole_dash_archive: "whole-archive",
         width,
+        windowed,
         windows,
         windows_subsystem,
         with_negative_coherence,
@@ -2300,9 +2327,11 @@
         x87_target_feature,
         xcoff,
         xer,
+        xloop,
         xmm_reg,
         xop_target_feature,
         xtensa,
+        xtensa_target_feature,
         yeet_desugar_details,
         yeet_expr,
         yes,
@@ -2717,7 +2746,8 @@ fn stable_hash<Hcx: StableHashCtxt>(&self, hcx: &mut Hcx, hasher: &mut StableHas
 // between `Interner`s.
 struct InternerInner {
     arena: DroplessArena,
-    byte_strs: FxIndexSet<&'static [u8]>,
+    indices: HashTable<(&'static [u8], u32)>,
+    byte_strs: Vec<&'static [u8]>,
 }
 
 impl Interner {
@@ -2725,24 +2755,34 @@ impl Interner {
     // effectively pre-interning all these strings for both `Symbol` and
     // `ByteSymbol`.
     fn prefill(init: &[&'static str], extra: &[&'static str]) -> Self {
-        let byte_strs = FxIndexSet::from_iter(
-            init.iter().copied().chain(extra.iter().copied()).map(|str| str.as_bytes()),
-        );
+        let values = init.iter().copied().chain(extra.iter().copied()).map(|str| str.as_bytes());
+        let (size_hint, _) = values.size_hint();
+        let mut conflicting_values: Vec<&[u8]> = Vec::new();
 
-        // The order in which duplicates are reported is irrelevant.
-        #[expect(rustc::potential_query_instability)]
-        if byte_strs.len() != init.len() + extra.len() {
+        let mut indices: HashTable<(&'static [u8], u32)> = HashTable::with_capacity(size_hint);
+        let hasher = FxBuildHasher::default();
+
+        let mut byte_strs: Vec<&'static [u8]> = Vec::with_capacity(size_hint);
+
+        for v in values {
+            match indices.entry(hasher.hash_one(&v), |&(s, _)| s == v, |&(s, _)| hasher.hash_one(s))
+            {
+                Entry::Occupied(v) => conflicting_values.push(v.get().0),
+                Entry::Vacant(view) => {
+                    view.insert((v, byte_strs.len() as u32));
+                    byte_strs.push(v);
+                }
+            }
+        }
+
+        if conflicting_values.len() != 0 {
             panic!(
                 "duplicate symbols in the rustc symbol list and the extra symbols added by the driver: {:?}",
-                FxHashSet::intersection(
-                    &init.iter().copied().collect(),
-                    &extra.iter().copied().collect(),
-                )
-                .collect::<Vec<_>>()
+                conflicting_values
             )
         }
 
-        Interner(Lock::new(InternerInner { arena: Default::default(), byte_strs }))
+        Interner(Lock::new(InternerInner { arena: Default::default(), indices, byte_strs }))
     }
 
     fn intern_str(&self, str: &str) -> Symbol {
@@ -2755,24 +2795,29 @@ fn intern_byte_str(&self, byte_str: &[u8]) -> ByteSymbol {
 
     #[inline]
     fn intern_inner(&self, byte_str: &[u8]) -> u32 {
-        let mut inner = self.0.lock();
-        if let Some(idx) = inner.byte_strs.get_index_of(byte_str) {
-            return idx as u32;
-        }
+        let hasher = FxBuildHasher::default();
+        let hash_of_byte_str = hasher.hash_one(byte_str);
 
-        let byte_str: &[u8] = inner.arena.alloc_slice(byte_str);
+        self.0.with_lock(|inner| {
+            match inner.indices.entry(
+                hash_of_byte_str,
+                |&(s, _)| s == byte_str,
+                |&(s, _)| hasher.hash_one(s),
+            ) {
+                Entry::Occupied(v) => v.get().1,
+                Entry::Vacant(view) => {
+                    let byte_str: &[u8] = inner.arena.alloc_slice(byte_str);
 
-        // SAFETY: we can extend the arena allocation to `'static` because we
-        // only access these while the arena is still alive.
-        let byte_str: &'static [u8] = unsafe { &*(byte_str as *const [u8]) };
-
-        // This second hash table lookup can be avoided by using `RawEntryMut`,
-        // but this code path isn't hot enough for it to be worth it. See
-        // #91445 for details.
-        let (idx, is_new) = inner.byte_strs.insert_full(byte_str);
-        debug_assert!(is_new); // due to the get_index_of check above
-
-        idx as u32
+                    // SAFETY: we can extend the arena allocation to `'static` because we
+                    // only access these while the arena is still alive.
+                    let byte_str: &'static [u8] = unsafe { &*(byte_str as *const [u8]) };
+                    let idx = inner.byte_strs.len() as u32;
+                    view.insert((byte_str, idx));
+                    inner.byte_strs.push(byte_str);
+                    idx
+                }
+            }
+        })
     }
 
     /// Get the symbol as a string.
@@ -2792,7 +2837,7 @@ fn get_byte_str(&self, symbol: ByteSymbol) -> &[u8] {
     }
 
     fn get_inner(&self, index: usize) -> &[u8] {
-        self.0.lock().byte_strs.get_index(index).unwrap()
+        self.0.with_lock(|inner| inner.byte_strs[index])
     }
 }
 
diff --git a/compiler/rustc_span/src/symbol/tests.rs b/compiler/rustc_span/src/symbol/tests.rs
index bf0660a..4060282 100644
--- a/compiler/rustc_span/src/symbol/tests.rs
+++ b/compiler/rustc_span/src/symbol/tests.rs
@@ -16,6 +16,17 @@ fn interner_tests() {
 }
 
 #[test]
+fn interner_get() {
+    let i = Interner::prefill(&["chicken"], &["cow"]);
+    let dog_idx = i.intern_str("dog"); // 2
+    let cat_idx = i.intern_str("cat"); // 3
+    assert_eq!(i.get_str(Symbol::new(0)), "chicken");
+    assert_eq!(i.get_str(Symbol::new(1)), "cow");
+    assert_eq!(i.get_str(cat_idx), "cat");
+    assert_eq!(i.get_str(dog_idx), "dog");
+}
+
+#[test]
 fn without_first_quote_test() {
     create_default_session_globals_then(|| {
         let i = Ident::from_str("'break");
diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs
index e68e76d..c6624a7 100644
--- a/compiler/rustc_symbol_mangling/src/v0.rs
+++ b/compiler/rustc_symbol_mangling/src/v0.rs
@@ -692,9 +692,14 @@ fn print_const(&mut self, ct: ty::Const<'tcx>) -> Result<(), PrintError> {
 
             // We may still encounter unevaluated consts due to the printing
             // logic sometimes passing identity-substituted impl headers.
-            ty::ConstKind::Unevaluated(ty::UnevaluatedConst { kind, args, .. }) => {
-                return self.print_def_path(kind.def_id(), args);
-            }
+            ty::ConstKind::Unevaluated(ty::UnevaluatedConst { kind, args, .. }) => match kind {
+                ty::UnevaluatedConstKind::Projection { def_id }
+                | ty::UnevaluatedConstKind::Inherent { def_id }
+                | ty::UnevaluatedConstKind::Free { def_id }
+                | ty::UnevaluatedConstKind::Anon { def_id } => {
+                    return self.print_def_path(def_id, args);
+                }
+            },
 
             ty::ConstKind::Expr(_)
             | ty::ConstKind::Infer(_)
diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs
index 44e52c9..52fe60b 100644
--- a/compiler/rustc_target/src/asm/mod.rs
+++ b/compiler/rustc_target/src/asm/mod.rs
@@ -194,6 +194,7 @@ macro_rules! types {
 mod spirv;
 mod wasm;
 mod x86;
+mod xtensa;
 
 pub use aarch64::{AArch64InlineAsmReg, AArch64InlineAsmRegClass};
 pub use arm::{ArmInlineAsmReg, ArmInlineAsmRegClass};
@@ -213,6 +214,7 @@ macro_rules! types {
 pub use spirv::{SpirVInlineAsmReg, SpirVInlineAsmRegClass};
 pub use wasm::{WasmInlineAsmReg, WasmInlineAsmRegClass};
 pub use x86::{X86InlineAsmReg, X86InlineAsmRegClass};
+pub use xtensa::{XtensaInlineAsmReg, XtensaInlineAsmRegClass};
 
 #[derive(Copy, Clone, Encodable, Decodable, Debug, Eq, PartialEq, Hash)]
 pub enum InlineAsmArch {
@@ -237,6 +239,7 @@ pub enum InlineAsmArch {
     SpirV,
     Wasm32,
     Wasm64,
+    Xtensa,
     Bpf,
     Avr,
     Msp430,
@@ -273,7 +276,8 @@ pub fn from_arch(arch: &Arch) -> Option<Self> {
             Arch::Msp430 => Some(Self::Msp430),
             Arch::M68k => Some(Self::M68k),
             Arch::CSky => Some(Self::CSKY),
-            Arch::AmdGpu | Arch::Xtensa | Arch::Other(_) => None,
+            Arch::Xtensa => Some(Self::Xtensa),
+            Arch::AmdGpu | Arch::Other(_) => None,
         }
     }
 }
@@ -294,6 +298,7 @@ pub enum InlineAsmReg {
     Sparc(SparcInlineAsmReg),
     SpirV(SpirVInlineAsmReg),
     Wasm(WasmInlineAsmReg),
+    Xtensa(XtensaInlineAsmReg),
     Bpf(BpfInlineAsmReg),
     Avr(AvrInlineAsmReg),
     Msp430(Msp430InlineAsmReg),
@@ -316,6 +321,7 @@ pub fn name(self) -> &'static str {
             Self::Mips(r) => r.name(),
             Self::S390x(r) => r.name(),
             Self::Sparc(r) => r.name(),
+            Self::Xtensa(r) => r.name(),
             Self::Bpf(r) => r.name(),
             Self::Avr(r) => r.name(),
             Self::Msp430(r) => r.name(),
@@ -337,6 +343,7 @@ pub fn reg_class(self) -> InlineAsmRegClass {
             Self::Mips(r) => InlineAsmRegClass::Mips(r.reg_class()),
             Self::S390x(r) => InlineAsmRegClass::S390x(r.reg_class()),
             Self::Sparc(r) => InlineAsmRegClass::Sparc(r.reg_class()),
+            Self::Xtensa(r) => InlineAsmRegClass::Xtensa(r.reg_class()),
             Self::Bpf(r) => InlineAsmRegClass::Bpf(r.reg_class()),
             Self::Avr(r) => InlineAsmRegClass::Avr(r.reg_class()),
             Self::Msp430(r) => InlineAsmRegClass::Msp430(r.reg_class()),
@@ -370,6 +377,7 @@ pub fn parse(arch: InlineAsmArch, name: Symbol) -> Result<Self, &'static str> {
             InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
                 Self::Mips(MipsInlineAsmReg::parse(name)?)
             }
+            InlineAsmArch::Xtensa => Self::Xtensa(XtensaInlineAsmReg::parse(name)?),
             InlineAsmArch::S390x => Self::S390x(S390xInlineAsmReg::parse(name)?),
             InlineAsmArch::Sparc | InlineAsmArch::Sparc64 => {
                 Self::Sparc(SparcInlineAsmReg::parse(name)?)
@@ -409,6 +417,7 @@ pub fn validate(
             Self::Sparc(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
             Self::Bpf(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
             Self::Avr(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
+            Self::Xtensa(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
             Self::Msp430(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
             Self::M68k(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
             Self::CSKY(r) => r.validate(arch, reloc_model, target_features, target, is_clobber),
@@ -435,6 +444,7 @@ pub fn emit(
             Self::Mips(r) => r.emit(out, arch, modifier),
             Self::S390x(r) => r.emit(out, arch, modifier),
             Self::Sparc(r) => r.emit(out, arch, modifier),
+            Self::Xtensa(r) => r.emit(out, arch, modifier),
             Self::Bpf(r) => r.emit(out, arch, modifier),
             Self::Avr(r) => r.emit(out, arch, modifier),
             Self::Msp430(r) => r.emit(out, arch, modifier),
@@ -456,6 +466,7 @@ pub fn overlapping_regs(self, mut cb: impl FnMut(InlineAsmReg)) {
             Self::Mips(_) => cb(self),
             Self::S390x(r) => r.overlapping_regs(|r| cb(Self::S390x(r))),
             Self::Sparc(_) => cb(self),
+            Self::Xtensa(_) => cb(self),
             Self::Bpf(r) => r.overlapping_regs(|r| cb(Self::Bpf(r))),
             Self::Avr(r) => r.overlapping_regs(|r| cb(Self::Avr(r))),
             Self::Msp430(_) => cb(self),
@@ -482,6 +493,7 @@ pub enum InlineAsmRegClass {
     Sparc(SparcInlineAsmRegClass),
     SpirV(SpirVInlineAsmRegClass),
     Wasm(WasmInlineAsmRegClass),
+    Xtensa(XtensaInlineAsmRegClass),
     Bpf(BpfInlineAsmRegClass),
     Avr(AvrInlineAsmRegClass),
     Msp430(Msp430InlineAsmRegClass),
@@ -507,6 +519,7 @@ pub fn name(self) -> Symbol {
             Self::Sparc(r) => r.name(),
             Self::SpirV(r) => r.name(),
             Self::Wasm(r) => r.name(),
+            Self::Xtensa(r) => r.name(),
             Self::Bpf(r) => r.name(),
             Self::Avr(r) => r.name(),
             Self::Msp430(r) => r.name(),
@@ -534,6 +547,7 @@ pub fn suggest_class(self, arch: InlineAsmArch, ty: InlineAsmType) -> Option<Sel
             Self::Sparc(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Sparc),
             Self::SpirV(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::SpirV),
             Self::Wasm(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Wasm),
+            Self::Xtensa(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Xtensa),
             Self::Bpf(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Bpf),
             Self::Avr(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Avr),
             Self::Msp430(r) => r.suggest_class(arch, ty).map(InlineAsmRegClass::Msp430),
@@ -564,6 +578,7 @@ pub fn suggest_modifier(self, arch: InlineAsmArch, ty: InlineAsmType) -> Option<
             Self::Sparc(r) => r.suggest_modifier(arch, ty),
             Self::SpirV(r) => r.suggest_modifier(arch, ty),
             Self::Wasm(r) => r.suggest_modifier(arch, ty),
+            Self::Xtensa(r) => r.suggest_modifier(arch, ty),
             Self::Bpf(r) => r.suggest_modifier(arch, ty),
             Self::Avr(r) => r.suggest_modifier(arch, ty),
             Self::Msp430(r) => r.suggest_modifier(arch, ty),
@@ -594,6 +609,7 @@ pub fn default_modifier(self, arch: InlineAsmArch) -> Option<ModifierInfo> {
             Self::Sparc(r) => r.default_modifier(arch),
             Self::SpirV(r) => r.default_modifier(arch),
             Self::Wasm(r) => r.default_modifier(arch),
+            Self::Xtensa(r) => r.default_modifier(arch),
             Self::Bpf(r) => r.default_modifier(arch),
             Self::Avr(r) => r.default_modifier(arch),
             Self::Msp430(r) => r.default_modifier(arch),
@@ -627,6 +643,7 @@ pub fn supported_types(
             Self::Sparc(r) => r.supported_types(arch),
             Self::SpirV(r) => r.supported_types(arch),
             Self::Wasm(r) => r.supported_types(arch),
+            Self::Xtensa(r) => r.supported_types(arch),
             Self::Bpf(r) => r.supported_types(arch),
             Self::Avr(r) => r.supported_types(arch),
             Self::Msp430(r) => r.supported_types(arch),
@@ -669,6 +686,7 @@ pub fn parse(arch: InlineAsmArch, name: Symbol) -> Result<Self, &'static [rustc_
             }
             InlineAsmArch::Bpf => Self::Bpf(BpfInlineAsmRegClass::parse(name)?),
             InlineAsmArch::Avr => Self::Avr(AvrInlineAsmRegClass::parse(name)?),
+            InlineAsmArch::Xtensa => Self::Xtensa(XtensaInlineAsmRegClass::parse(name)?),
             InlineAsmArch::Msp430 => Self::Msp430(Msp430InlineAsmRegClass::parse(name)?),
             InlineAsmArch::M68k => Self::M68k(M68kInlineAsmRegClass::parse(name)?),
             InlineAsmArch::CSKY => Self::CSKY(CSKYInlineAsmRegClass::parse(name)?),
@@ -692,6 +710,7 @@ pub fn valid_modifiers(self, arch: InlineAsmArch) -> &'static [char] {
             Self::Sparc(r) => r.valid_modifiers(arch),
             Self::SpirV(r) => r.valid_modifiers(arch),
             Self::Wasm(r) => r.valid_modifiers(arch),
+            Self::Xtensa(r) => r.valid_modifiers(arch),
             Self::Bpf(r) => r.valid_modifiers(arch),
             Self::Avr(r) => r.valid_modifiers(arch),
             Self::Msp430(r) => r.valid_modifiers(arch),
@@ -893,6 +912,11 @@ pub fn allocatable_registers(
             wasm::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
             map
         }
+        InlineAsmArch::Xtensa => {
+            let mut map = xtensa::regclass_map();
+            xtensa::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
+            map
+        }
         InlineAsmArch::Bpf => {
             let mut map = bpf::regclass_map();
             bpf::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
@@ -940,6 +964,7 @@ pub enum InlineAsmClobberAbi {
     S390x,
     Bpf,
     Msp430,
+    Xtensa,
 }
 
 impl InlineAsmClobberAbi {
@@ -1020,6 +1045,10 @@ pub fn parse(
                 "C" | "system" => Ok(InlineAsmClobberAbi::Msp430),
                 _ => Err(&["C", "system"]),
             },
+            InlineAsmArch::Xtensa => match name {
+                "C" | "system" => Ok(InlineAsmClobberAbi::Xtensa),
+                _ => Err(&["C", "system"]),
+            },
             _ => Err(&[]),
         }
     }
@@ -1329,6 +1358,42 @@ macro_rules! clobbered_regs {
                     r11, r12, r13, r14, r15,
                 }
             },
+            InlineAsmClobberAbi::Xtensa => clobbered_regs! {
+                Xtensa XtensaInlineAsmReg {
+                    // Refs:
+                    // - Xtensa ISA Reference Manual, Section 8.1.4 & 8.1.6
+                    // - "Except for LITBASE, all non-privileged special registers are
+                    //   caller-saved."
+
+                    // Caller-saved general-purpose registers (a2-a11).
+                    // a0 is the return address (reserved by LLVM).
+                    // a1/sp is the stack pointer (reserved by LLVM).
+                    // a12-a15 are callee-saved.
+                    a2, a3, a4, a5, a6, a7,
+                    a8, a9, a10, a11,
+
+                    // All floating-point registers are caller-saved.
+                    f0, f1, f2, f3, f4, f5, f6, f7,
+                    f8, f9, f10, f11, f12, f13, f14, f15,
+
+                    // SAR (Shift Amount Register) - caller-saved, always present.
+                    sar,
+
+                    // SCOMPARE1 - caller-saved (s32c1i option).
+                    scompare1,
+
+                    // Loop registers - caller-saved (loop option).
+                    lbeg, lend, lcount,
+
+                    // MAC16 registers - caller-saved (mac16 option).
+                    acclo, acchi,
+                    m0, m1, m2, m3,
+
+                    // Boolean registers - caller-saved (boolean option).
+                    b0, b1, b2, b3, b4, b5, b6, b7,
+                    b8, b9, b10, b11, b12, b13, b14, b15,
+                }
+            },
         }
     }
 }
diff --git a/compiler/rustc_target/src/asm/xtensa.rs b/compiler/rustc_target/src/asm/xtensa.rs
new file mode 100644
index 0000000..6227502
--- /dev/null
+++ b/compiler/rustc_target/src/asm/xtensa.rs
@@ -0,0 +1,229 @@
+use std::fmt;
+
+use rustc_data_structures::fx::FxIndexSet;
+use rustc_span::{Symbol, kw, sym};
+
+use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
+use crate::spec::{RelocModel, Target};
+
+def_reg_class! {
+    Xtensa XtensaInlineAsmRegClass {
+        reg,
+        freg,
+        sreg,
+        breg,
+    }
+}
+
+impl XtensaInlineAsmRegClass {
+    pub fn valid_modifiers(self, _arch: super::InlineAsmArch) -> &'static [char] {
+        &[]
+    }
+
+    pub fn suggest_class(self, _arch: InlineAsmArch, _ty: InlineAsmType) -> Option<Self> {
+        None
+    }
+
+    pub fn suggest_modifier(
+        self,
+        _arch: InlineAsmArch,
+        _ty: InlineAsmType,
+    ) -> Option<ModifierInfo> {
+        None
+    }
+
+    pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<ModifierInfo> {
+        None
+    }
+
+    pub fn supported_types(
+        self,
+        _arch: InlineAsmArch,
+    ) -> &'static [(InlineAsmType, Option<Symbol>)] {
+        match self {
+            Self::reg => types! { _: I8, I16, I32; },
+            Self::freg => types! { fp: F32; },
+            Self::sreg | Self::breg => &[],
+        }
+    }
+}
+
+fn has_fp(
+    _arch: InlineAsmArch,
+    _reloc_model: RelocModel,
+    target_features: &FxIndexSet<Symbol>,
+    _target: &Target,
+    _is_clobber: bool,
+) -> Result<(), &'static str> {
+    if target_features.contains(&sym::fp) {
+        Ok(())
+    } else {
+        Err("target does not support floating point registers")
+    }
+}
+
+// The frame pointer is a7 under the windowed ABI and a15 otherwise. Always
+// reject it as an inline asm operand: LLVM can force its use for variable-
+// sized stack frames (e.g. via cross-language LTO with C).
+fn frame_pointer_a7(
+    _arch: InlineAsmArch,
+    _reloc_model: RelocModel,
+    target_features: &FxIndexSet<Symbol>,
+    _target: &Target,
+    _is_clobber: bool,
+) -> Result<(), &'static str> {
+    if target_features.contains(&sym::windowed) {
+        Err("the frame pointer (a7) cannot be used as an operand for inline asm")
+    } else {
+        Ok(())
+    }
+}
+
+fn frame_pointer_a15(
+    _arch: InlineAsmArch,
+    _reloc_model: RelocModel,
+    target_features: &FxIndexSet<Symbol>,
+    _target: &Target,
+    _is_clobber: bool,
+) -> Result<(), &'static str> {
+    if !target_features.contains(&sym::windowed) {
+        Err("the frame pointer (a15) cannot be used as an operand for inline asm")
+    } else {
+        Ok(())
+    }
+}
+
+fn has_bool(
+    _arch: InlineAsmArch,
+    _reloc_model: RelocModel,
+    target_features: &FxIndexSet<Symbol>,
+    _target: &Target,
+    _is_clobber: bool,
+) -> Result<(), &'static str> {
+    if target_features.contains(&sym::bool) {
+        Ok(())
+    } else {
+        Err("target does not support boolean registers")
+    }
+}
+
+fn has_loop(
+    _arch: InlineAsmArch,
+    _reloc_model: RelocModel,
+    target_features: &FxIndexSet<Symbol>,
+    _target: &Target,
+    _is_clobber: bool,
+) -> Result<(), &'static str> {
+    if target_features.contains(&kw::Loop) {
+        Ok(())
+    } else {
+        Err("target does not support loop registers")
+    }
+}
+
+fn has_mac16(
+    _arch: InlineAsmArch,
+    _reloc_model: RelocModel,
+    target_features: &FxIndexSet<Symbol>,
+    _target: &Target,
+    _is_clobber: bool,
+) -> Result<(), &'static str> {
+    if target_features.contains(&sym::mac16) {
+        Ok(())
+    } else {
+        Err("target does not support MAC16 registers")
+    }
+}
+
+fn has_s32c1i(
+    _arch: InlineAsmArch,
+    _reloc_model: RelocModel,
+    target_features: &FxIndexSet<Symbol>,
+    _target: &Target,
+    _is_clobber: bool,
+) -> Result<(), &'static str> {
+    if target_features.contains(&sym::s32c1i) {
+        Ok(())
+    } else {
+        Err("target does not support the s32c1i instruction")
+    }
+}
+
+def_regs! {
+    Xtensa XtensaInlineAsmReg XtensaInlineAsmRegClass {
+        a2: reg = ["a2"],
+        a3: reg = ["a3"],
+        a4: reg = ["a4"],
+        a5: reg = ["a5"],
+        a6: reg = ["a6"],
+        a7: reg = ["a7"] % frame_pointer_a7,
+        a8: reg = ["a8"],
+        a9: reg = ["a9"],
+        a10: reg = ["a10"],
+        a11: reg = ["a11"],
+        a12: reg = ["a12"],
+        a13: reg = ["a13"],
+        a14: reg = ["a14"],
+        a15: reg = ["a15"] % frame_pointer_a15,
+        f0: freg = ["f0"] % has_fp,
+        f1: freg = ["f1"] % has_fp,
+        f2: freg = ["f2"] % has_fp,
+        f3: freg = ["f3"] % has_fp,
+        f4: freg = ["f4"] % has_fp,
+        f5: freg = ["f5"] % has_fp,
+        f6: freg = ["f6"] % has_fp,
+        f7: freg = ["f7"] % has_fp,
+        f8: freg = ["f8"] % has_fp,
+        f9: freg = ["f9"] % has_fp,
+        f10: freg = ["f10"] % has_fp,
+        f11: freg = ["f11"] % has_fp,
+        f12: freg = ["f12"] % has_fp,
+        f13: freg = ["f13"] % has_fp,
+        f14: freg = ["f14"] % has_fp,
+        f15: freg = ["f15"] % has_fp,
+        // Clobber-only special registers (caller-saved per ISA §8.1.7, except
+        // LITBASE); needed for `clobber_abi`.
+        sar: sreg = ["sar"],
+        scompare1: sreg = ["scompare1"] % has_s32c1i,
+        lbeg: sreg = ["lbeg"] % has_loop,
+        lend: sreg = ["lend"] % has_loop,
+        lcount: sreg = ["lcount"] % has_loop,
+        acclo: sreg = ["acclo"] % has_mac16,
+        acchi: sreg = ["acchi"] % has_mac16,
+        m0: sreg = ["m0"] % has_mac16,
+        m1: sreg = ["m1"] % has_mac16,
+        m2: sreg = ["m2"] % has_mac16,
+        m3: sreg = ["m3"] % has_mac16,
+        // Clobber-only boolean registers.
+        b0: breg = ["b0"] % has_bool,
+        b1: breg = ["b1"] % has_bool,
+        b2: breg = ["b2"] % has_bool,
+        b3: breg = ["b3"] % has_bool,
+        b4: breg = ["b4"] % has_bool,
+        b5: breg = ["b5"] % has_bool,
+        b6: breg = ["b6"] % has_bool,
+        b7: breg = ["b7"] % has_bool,
+        b8: breg = ["b8"] % has_bool,
+        b9: breg = ["b9"] % has_bool,
+        b10: breg = ["b10"] % has_bool,
+        b11: breg = ["b11"] % has_bool,
+        b12: breg = ["b12"] % has_bool,
+        b13: breg = ["b13"] % has_bool,
+        b14: breg = ["b14"] % has_bool,
+        b15: breg = ["b15"] % has_bool,
+
+        #error = ["a0"] => "a0 is used internally by LLVM and cannot be used as an operand for inline asm",
+        #error = ["sp", "a1"] => "sp is used internally by LLVM and cannot be used as an operand for inline asm",
+    }
+}
+
+impl XtensaInlineAsmReg {
+    pub fn emit(
+        self,
+        out: &mut dyn fmt::Write,
+        _arch: InlineAsmArch,
+        _modifier: Option<char>,
+    ) -> fmt::Result {
+        out.write_str(self.name())
+    }
+}
diff --git a/compiler/rustc_target/src/spec/abi_map.rs b/compiler/rustc_target/src/spec/abi_map.rs
index 8c56dcb..f7a7ae1 100644
--- a/compiler/rustc_target/src/spec/abi_map.rs
+++ b/compiler/rustc_target/src/spec/abi_map.rs
@@ -100,6 +100,7 @@ pub fn canonize_abi(&self, extern_abi: ExternAbi, has_c_varargs: bool) -> AbiMap
             (ExternAbi::RustCold, _) if self.os == OsKind::Windows => CanonAbi::Rust,
             (ExternAbi::RustCold, _) => CanonAbi::RustCold,
             (ExternAbi::RustPreserveNone, _) => CanonAbi::RustPreserveNone,
+            (ExternAbi::RustTail, _) => CanonAbi::RustTail,
 
             (ExternAbi::Custom, _) => CanonAbi::Custom,
 
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
index f7e1cbf..a4a5ee6 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
@@ -1,5 +1,6 @@
 use crate::spec::{
-    Arch, FramePointer, SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base,
+    Arch, Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target,
+    TargetMetadata, TargetOptions, base,
 };
 
 pub(crate) fn target() -> Target {
@@ -15,6 +16,11 @@ pub(crate) fn target() -> Target {
         data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
         arch: Arch::AArch64,
         options: TargetOptions {
+            // Enable the Cortex-A53 errata 843419 mitigation by default
+            pre_link_args: TargetOptions::link_args(
+                LinkerFlavor::Gnu(Cc::Yes, Lld::No),
+                &["-Wl,--fix-cortex-a53-843419"],
+            ),
             features: "+v8a,+outline-atomics".into(),
             // the AAPCS64 expects use of non-leaf frame pointers per
             // https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
index 6ba5112..93319d2 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
@@ -1,5 +1,6 @@
 use crate::spec::{
-    Arch, FramePointer, SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base,
+    Arch, Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target,
+    TargetMetadata, TargetOptions, base,
 };
 
 pub(crate) fn target() -> Target {
@@ -29,6 +30,11 @@ pub(crate) fn target() -> Target {
         data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
         arch: Arch::AArch64,
         options: TargetOptions {
+            // Enable the Cortex-A53 errata 843419 mitigation by default
+            pre_link_args: TargetOptions::link_args(
+                LinkerFlavor::Gnu(Cc::Yes, Lld::No),
+                &["-Wl,--fix-cortex-a53-843419"],
+            ),
             // the AAPCS64 expects use of non-leaf frame pointers per
             // https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
             // and we tend to encounter interesting bugs in AArch64 unwinding code if we do not
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
index f67b3b8..0983327 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -4,7 +4,7 @@
 //! "preview2". This target in rustc uses the previous version of the proposal.
 //!
 //! This target uses the syscalls defined at
-//! <https://github.com/WebAssembly/WASI/tree/main/legacy/preview1>.
+//! <https://github.com/WebAssembly/WASI/tree/wasi-0.1/preview1>.
 //!
 //! Note that this target was historically called `wasm32-wasi` originally and
 //! was since renamed to `wasm32-wasip1` after the preview2 target was
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index 358374f..d7fb954 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -650,9 +650,9 @@ pub fn toggle_allowed(&self) -> Result<(), &'static str> {
     ("a", Stable, &["zaamo", "zalrsc"]),
     ("b", Stable, &["zba", "zbb", "zbs"]),
     ("c", Stable, &["zca"]),
-    ("d", Unstable(sym::riscv_target_feature), &["f"]),
-    ("e", Unstable(sym::riscv_target_feature), &[]),
-    ("f", Unstable(sym::riscv_target_feature), &["zicsr"]),
+    ("d", CfgStableToggleUnstable(sym::riscv_target_feature), &["f"]),
+    ("e", CfgStableToggleUnstable(sym::riscv_target_feature), &[]),
+    ("f", CfgStableToggleUnstable(sym::riscv_target_feature), &["zicsr"]),
     (
         "forced-atomics",
         Stability::Forbidden {
@@ -976,6 +976,35 @@ pub fn toggle_allowed(&self) -> Result<(), &'static str> {
     // tidy-alphabetical-end
 ];
 
+const XTENSA_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
+    ("bool", Unstable(sym::xtensa_target_feature), &[]),
+    ("fp", Unstable(sym::xtensa_target_feature), &["bool", "coprocessor"]),
+    ("coprocessor", Unstable(sym::xtensa_target_feature), &[]),
+    ("highpriinterrupts", Unstable(sym::xtensa_target_feature), &["interrupt"]),
+    ("interrupt", Unstable(sym::xtensa_target_feature), &["exception"]),
+    (
+        "windowed",
+        Forbidden { reason: "windowed changes the Xtensa calling convention", hard_error: false },
+        &["exception"],
+    ),
+    ("loop", Unstable(sym::xtensa_target_feature), &[]),
+    ("sext", Unstable(sym::xtensa_target_feature), &[]),
+    ("nsa", Unstable(sym::xtensa_target_feature), &[]),
+    ("mul32", Unstable(sym::xtensa_target_feature), &[]),
+    ("mul32high", Unstable(sym::xtensa_target_feature), &["mul32"]),
+    ("div32", Unstable(sym::xtensa_target_feature), &[]),
+    ("mac16", Unstable(sym::xtensa_target_feature), &[]),
+    ("s32c1i", Unstable(sym::xtensa_target_feature), &[]),
+    ("threadptr", Unstable(sym::xtensa_target_feature), &[]),
+    ("extendedl32r", Unstable(sym::xtensa_target_feature), &[]),
+    ("debug", Unstable(sym::xtensa_target_feature), &["exception"]),
+    ("exception", Unstable(sym::xtensa_target_feature), &[]),
+    ("rvector", Unstable(sym::xtensa_target_feature), &["exception"]),
+    ("prid", Unstable(sym::xtensa_target_feature), &[]),
+    ("regprotect", Unstable(sym::xtensa_target_feature), &[]),
+    ("miscsr", Unstable(sym::xtensa_target_feature), &[]),
+];
+
 /// When rustdoc is running, provide a list of all known features so that all their respective
 /// primitives may be documented.
 ///
@@ -992,6 +1021,7 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
         .chain(RISCV_FEATURES.iter())
         .chain(WASM_FEATURES.iter())
         .chain(BPF_FEATURES.iter())
+        .chain(XTENSA_FEATURES.iter())
         .chain(CSKY_FEATURES)
         .chain(LOONGARCH_FEATURES)
         .chain(IBMZ_FEATURES)
@@ -1079,7 +1109,8 @@ pub fn rust_target_features(&self) -> &'static [(&'static str, Stability, Implie
             Arch::Sparc | Arch::Sparc64 => SPARC_FEATURES,
             Arch::M68k => M68K_FEATURES,
             Arch::Avr => AVR_FEATURES,
-            Arch::AmdGpu | Arch::Msp430 | Arch::SpirV | Arch::Xtensa | Arch::Other(_) => &[],
+            Arch::Xtensa => XTENSA_FEATURES,
+            Arch::AmdGpu | Arch::Msp430 | Arch::SpirV | Arch::Other(_) => &[],
         }
     }
 
diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs
index 73a04d7..ad8cc5d 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs
@@ -2,6 +2,7 @@
 //! where one region is named and the other is anonymous.
 
 use rustc_errors::Diag;
+use rustc_middle::ty;
 use tracing::debug;
 
 use crate::error_reporting::infer::nice_region_error::NiceRegionError;
@@ -72,7 +73,18 @@ pub(super) fn try_report_named_anon_conflict(&self) -> Option<Diag<'tcx>> {
         {
             return None;
         }
+        let orig_ty = anon_param_info.orig_param_ty;
+        // Don't suggest naming the outer lifetime when it already appears in the pointee
+        // (e.g. `&'a mut Buffer<'a>`); point at borrow splitting instead.
+        let suggestion_would_alias_lifetime =
+            if let ty::Ref(_, orig_inner_ty, ty::Mutability::Mut) = orig_ty.kind() {
+                self.tcx().any_free_region_meets(orig_inner_ty, |r| r == named)
+            } else {
+                false
+            };
+
         let named = named.to_string();
+        let new_ty_span = if suggestion_would_alias_lifetime { None } else { Some(new_ty_span) };
         let err = match param.pat.simple_ident() {
             Some(simple_ident) => ExplicitLifetimeRequired::WithIdent {
                 span,
@@ -80,8 +92,15 @@ pub(super) fn try_report_named_anon_conflict(&self) -> Option<Diag<'tcx>> {
                 named,
                 new_ty_span,
                 new_ty,
+                link_nomicon: suggestion_would_alias_lifetime,
             },
-            None => ExplicitLifetimeRequired::WithParamType { span, named, new_ty_span, new_ty },
+            None => ExplicitLifetimeRequired::WithParamType {
+                span,
+                named,
+                new_ty_span,
+                new_ty,
+                link_nomicon: suggestion_would_alias_lifetime,
+            },
         };
         Some(self.tcx().sess.dcx().create_err(err))
     }
diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/util.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/util.rs
index 3ec97ce..50eeb3a 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/util.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/util.rs
@@ -16,6 +16,8 @@ pub struct AnonymousParamInfo<'tcx> {
     pub param: &'tcx hir::Param<'tcx>,
     /// The type corresponding to the anonymous region parameter.
     pub param_ty: Ty<'tcx>,
+    /// The original type before region replacement.
+    pub orig_param_ty: Ty<'tcx>,
     /// The `ty::LateParamRegionKind` corresponding to the anonymous region.
     pub kind: ty::LateParamRegionKind,
     /// The `Span` of the parameter type.
@@ -94,7 +96,14 @@ pub fn find_param_with_region<'tcx>(
                 let ty_hir_id = fn_decl.inputs[index].hir_id;
                 let param_ty_span = tcx.hir_span(ty_hir_id);
                 let is_first = index == 0;
-                AnonymousParamInfo { param, param_ty: new_param_ty, param_ty_span, kind, is_first }
+                AnonymousParamInfo {
+                    param,
+                    param_ty: new_param_ty,
+                    orig_param_ty: ty,
+                    param_ty_span,
+                    kind,
+                    is_first,
+                }
             })
         })
 }
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 f78bc3e..32b4d49 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
@@ -3745,44 +3745,39 @@ fn report_not_const_evaluatable_error(
                 ty::ConstKind::Unevaluated(uv) => {
                     let mut err =
                         self.dcx().struct_span_err(span, "unconstrained generic constant");
-                    let const_span = self.tcx.def_span(uv.kind.def_id());
 
-                    let const_ty = self
-                        .tcx
-                        .type_of(uv.kind.def_id())
-                        .instantiate(self.tcx, uv.args)
-                        .skip_norm_wip();
+                    let const_ty = uv.type_of(self.tcx).skip_norm_wip();
                     let cast = if const_ty != self.tcx.types.usize { " as usize" } else { "" };
                     let msg = "try adding a `where` bound";
-                    match self.tcx.sess.source_map().span_to_snippet(const_span) {
-                        Ok(snippet) => {
-                            let code = format!("[(); {snippet}{cast}]:");
-                            let def_id = if let ObligationCauseCode::CompareImplItem {
-                                trait_item_def_id,
-                                ..
-                            } = obligation.cause.code()
-                            {
-                                trait_item_def_id.as_local()
-                            } else {
-                                Some(obligation.cause.body_id)
-                            };
-                            if let Some(def_id) = def_id
-                                && let Some(generics) = self.tcx.hir_get_generics(def_id)
-                            {
-                                err.span_suggestion_verbose(
-                                    generics.tail_span_for_predicate_suggestion(),
-                                    msg,
-                                    format!("{} {code}", generics.add_where_or_trailing_comma()),
-                                    Applicability::MaybeIncorrect,
-                                );
-                            } else {
-                                err.help(format!("{msg}: where {code}"));
-                            };
-                        }
-                        _ => {
-                            err.help(msg);
-                        }
-                    };
+                    if let Some(def_id) = uv.kind.opt_def_id()
+                        && let const_span = self.tcx.def_span(def_id)
+                        && let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(const_span)
+                    {
+                        let code = format!("[(); {snippet}{cast}]:");
+                        let suggestion_def_id = if let ObligationCauseCode::CompareImplItem {
+                            trait_item_def_id,
+                            ..
+                        } = obligation.cause.code()
+                        {
+                            trait_item_def_id.as_local()
+                        } else {
+                            Some(obligation.cause.body_id)
+                        };
+                        if let Some(suggestion_def_id) = suggestion_def_id
+                            && let Some(generics) = self.tcx.hir_get_generics(suggestion_def_id)
+                        {
+                            err.span_suggestion_verbose(
+                                generics.tail_span_for_predicate_suggestion(),
+                                msg,
+                                format!("{} {code}", generics.add_where_or_trailing_comma()),
+                                Applicability::MaybeIncorrect,
+                            );
+                        } else {
+                            err.help(format!("{msg}: where {code}"));
+                        };
+                    } else {
+                        err.help(msg);
+                    }
                     Ok(err)
                 }
                 ty::ConstKind::Expr(_) => {
diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs
index 5a926dc..6624805 100644
--- a/compiler/rustc_trait_selection/src/errors.rs
+++ b/compiler/rustc_trait_selection/src/errors.rs
@@ -868,8 +868,13 @@ pub(crate) enum ExplicitLifetimeRequired<'a> {
             applicability = "unspecified",
             style = "verbose"
         )]
-        new_ty_span: Span,
+        new_ty_span: Option<Span>,
         new_ty: Ty<'a>,
+        #[help(
+            "see <https://doc.rust-lang.org/nomicon/borrow-splitting.html> \
+             for more information about lifetime errors related to mutable references"
+        )]
+        link_nomicon: bool,
     },
     #[diag("explicit lifetime required in parameter type", code = E0621)]
     WithParamType {
@@ -883,8 +888,13 @@ pub(crate) enum ExplicitLifetimeRequired<'a> {
             applicability = "unspecified",
             style = "verbose"
         )]
-        new_ty_span: Span,
+        new_ty_span: Option<Span>,
         new_ty: Ty<'a>,
+        #[help(
+            "see <https://doc.rust-lang.org/nomicon/borrow-splitting.html> \
+             for more information about lifetime errors related to mutable references"
+        )]
+        link_nomicon: bool,
     },
 }
 
diff --git a/compiler/rustc_trait_selection/src/solve/delegate.rs b/compiler/rustc_trait_selection/src/solve/delegate.rs
index bd22ba6..7c2f5c7 100644
--- a/compiler/rustc_trait_selection/src/solve/delegate.rs
+++ b/compiler/rustc_trait_selection/src/solve/delegate.rs
@@ -7,6 +7,7 @@
 use rustc_infer::infer::canonical::query_response::make_query_region_constraints;
 use rustc_infer::infer::canonical::{
     Canonical, CanonicalExt as _, CanonicalQueryInput, CanonicalVarKind, CanonicalVarValues,
+    QueryRegionConstraint,
 };
 use rustc_infer::infer::{InferCtxt, RegionVariableOrigin, SubregionOrigin, TyCtxtInferExt};
 use rustc_infer::traits::solve::{FetchEligibleAssocItemResponse, Goal};
@@ -262,7 +263,9 @@ fn make_deduplicated_region_constraints(
 
         let mut seen = FxHashMap::default();
         let mut constraints = vec![];
-        for (outlives, _, vis) in region_constraints.constraints {
+        for QueryRegionConstraint { constraint: outlives, visible_for_leak_check: vis, .. } in
+            region_constraints.constraints
+        {
             match seen.entry(outlives) {
                 Entry::Occupied(occupied) => {
                     let idx = occupied.get();
diff --git a/compiler/rustc_trait_selection/src/solve/fulfill.rs b/compiler/rustc_trait_selection/src/solve/fulfill.rs
index 78220d4..e933932 100644
--- a/compiler/rustc_trait_selection/src/solve/fulfill.rs
+++ b/compiler/rustc_trait_selection/src/solve/fulfill.rs
@@ -6,7 +6,7 @@
 use rustc_infer::traits::{
     FromSolverError, PredicateObligation, PredicateObligations, TraitEngine,
 };
-use rustc_middle::ty::{TyCtxt, TypeVisitableExt, TypingMode};
+use rustc_middle::ty::{self, TyCtxt, TyVid, TypeVisitableExt, TypingMode};
 use rustc_next_trait_solver::delegate::SolverDelegate as _;
 use rustc_next_trait_solver::solve::{
     GoalEvaluation, GoalStalledOn, HasChanged, MaybeInfo, SolverDelegateEvalExt as _,
@@ -79,6 +79,37 @@ fn clone_pending(&self) -> PredicateObligations<'tcx> {
         obligations
     }
 
+    fn clone_pending_potentially_referencing_sub_root(
+        &self,
+        infcx: &InferCtxt<'tcx>,
+        vid: TyVid,
+    ) -> PredicateObligations<'tcx> {
+        let mut obligations: PredicateObligations<'tcx> = self
+            .pending
+            .iter()
+            .filter(|(_, stalled_on)| {
+                let Some(stalled_on) = stalled_on else { return true };
+                // Don't reuse the sub-unification roots cached on `stalled_on`:
+                // a later sub-unification merge can have changed which root
+                // each stalled var belongs to, so the cached info can be stale.
+                // Walk `stalled_vars` and recompute the current root instead.
+                //
+                // Conservative here: if a stalled var no longer resolves to an
+                // infer var, some unification happened, so the goal is no longer
+                // stalled. Include it to be re-evaluated downstream.
+                stalled_on.stalled_vars.iter().filter_map(|arg| arg.as_type()).any(
+                    |ty| match *infcx.shallow_resolve(ty).kind() {
+                        ty::Infer(ty::TyVar(tv)) => infcx.sub_unification_table_root_var(tv) == vid,
+                        _ => true,
+                    },
+                )
+            })
+            .map(|(o, _)| o.clone())
+            .collect();
+        obligations.extend(self.overflowed.iter().cloned());
+        obligations
+    }
+
     fn drain_pending(
         &mut self,
         cond: impl Fn(&PredicateObligation<'tcx>, &Option<GoalStalledOn<TyCtxt<'tcx>>>) -> bool,
@@ -272,6 +303,18 @@ fn pending_obligations(&self) -> PredicateObligations<'tcx> {
         self.obligations.clone_pending()
     }
 
+    fn pending_obligations_potentially_referencing_sub_root(
+        &self,
+        infcx: &InferCtxt<'tcx>,
+        vid: ty::TyVid,
+    ) -> PredicateObligations<'tcx> {
+        // `-Zdisable-fast-paths`: same gate as the other new-solver fast paths.
+        if infcx.tcx.disable_trait_solver_fast_paths() {
+            return self.obligations.clone_pending();
+        }
+        self.obligations.clone_pending_potentially_referencing_sub_root(infcx, vid)
+    }
+
     fn drain_stalled_obligations_for_coroutines(
         &mut self,
         infcx: &InferCtxt<'tcx>,
diff --git a/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs b/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs
index 1ba0bb5..0ce4e9e 100644
--- a/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs
+++ b/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs
@@ -34,11 +34,7 @@ pub(super) fn fulfillment_error_for_no_solution<'tcx>(
         }
         ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, expected_ty)) => {
             let ct_ty = match ct.kind() {
-                ty::ConstKind::Unevaluated(uv) => infcx
-                    .tcx
-                    .type_of(uv.kind.def_id())
-                    .instantiate(infcx.tcx, uv.args)
-                    .skip_norm_wip(),
+                ty::ConstKind::Unevaluated(uv) => uv.type_of(infcx.tcx).skip_norm_wip(),
                 ty::ConstKind::Param(param_ct) => {
                     param_ct.find_const_ty_from_env(obligation.param_env)
                 }
diff --git a/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs b/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs
index ad66078..eeb41f3 100644
--- a/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs
+++ b/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs
@@ -317,6 +317,10 @@ pub fn depth(&self) -> usize {
         self.depth
     }
 
+    pub fn orig_values(&self) -> &[ty::GenericArg<'tcx>] {
+        &self.orig_values
+    }
+
     fn candidates_recur(
         &'a self,
         candidates: &mut Vec<InspectCandidate<'a, 'tcx>>,
diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs
index e080687..3a58dba 100644
--- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs
+++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs
@@ -773,10 +773,10 @@ fn evaluate_nested_obligations(
                                 super::try_evaluate_const(selcx.infcx, c, obligation.param_env);
 
                             if let Err(EvaluateConstErr::InvalidConstParamTy(_)) = ct {
-                                self.tcx.dcx().emit_err(UnableToConstructConstantValue {
-                                    span: self.tcx.def_span(unevaluated.kind.def_id()),
-                                    unevaluated,
-                                });
+                                let span = unevaluated.kind.def_span(self.tcx);
+                                self.tcx
+                                    .dcx()
+                                    .emit_err(UnableToConstructConstantValue { span, unevaluated });
                             }
 
                             ct
diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
index 90e795f..cd9acde 100644
--- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
+++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
@@ -117,7 +117,7 @@ pub fn is_const_evaluatable<'tcx>(
                 tcx.dcx()
                     .struct_span_fatal(
                         // Slightly better span than just using `span` alone
-                        if span == DUMMY_SP { tcx.def_span(uv.kind.def_id()) } else { span },
+                        if span == DUMMY_SP { uv.kind.def_span(tcx) } else { span },
                         "failed to evaluate generic const expression",
                     )
                     .with_note("the crate this constant originates from uses `#![feature(generic_const_exprs)]`")
diff --git a/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs b/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs
index 1d3c9be..f20c97e 100644
--- a/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs
+++ b/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs
@@ -886,16 +886,15 @@ fn visit_const(&mut self, ct: ty::Const<'tcx>) -> Self::Result {
         let ct = self.tcx.expand_abstract_consts(ct);
 
         match ct.kind() {
-            ty::ConstKind::Unevaluated(
-                proj @ ty::UnevaluatedConst {
-                    kind: ty::UnevaluatedConstKind::Projection { .. },
-                    ..
-                },
-            ) if self.tcx.features().min_generic_const_args() => {
+            ty::ConstKind::Unevaluated(ty::UnevaluatedConst {
+                kind: ty::UnevaluatedConstKind::Projection { def_id },
+                args,
+                ..
+            }) if self.tcx.features().min_generic_const_args() => {
                 match self.allow_self_projections {
                     AllowSelfProjections::Yes => {
-                        let trait_def_id = self.tcx.parent(proj.kind.def_id());
-                        let trait_ref = ty::TraitRef::from_assoc(self.tcx, trait_def_id, proj.args);
+                        let trait_def_id = self.tcx.parent(def_id);
+                        let trait_ref = ty::TraitRef::from_assoc(self.tcx, trait_def_id, args);
 
                         // Only walk contained consts if the parent trait is not a supertrait.
                         if self.is_supertrait_of_current_trait(trait_ref) {
diff --git a/compiler/rustc_trait_selection/src/traits/effects.rs b/compiler/rustc_trait_selection/src/traits/effects.rs
index 8681a92..b657992 100644
--- a/compiler/rustc_trait_selection/src/traits/effects.rs
+++ b/compiler/rustc_trait_selection/src/traits/effects.rs
@@ -463,10 +463,11 @@ fn evaluate_host_effect_for_destruct_goal<'tcx>(
                 })
                 .collect();
             match adt_def.destructor(tcx).map(|dtor| tcx.constness(dtor.did)) {
+                Some(hir::Constness::Const { always: true }) => todo!("FIXME(comptime)"),
                 // `Drop` impl exists, but it's not const. Type cannot be `[const] Destruct`.
                 Some(hir::Constness::NotConst) => return Err(EvaluationFailure::NoSolution),
                 // `Drop` impl exists, and it's const. Require `Ty: [const] Drop` to hold.
-                Some(hir::Constness::Const) => {
+                Some(hir::Constness::Const { always: false }) => {
                     let drop_def_id = tcx.require_lang_item(LangItem::Drop, obligation.cause.span);
                     let drop_trait_ref = ty::TraitRef::new(tcx, drop_def_id, [self_ty]);
                     const_conditions.push(drop_trait_ref);
@@ -563,7 +564,9 @@ fn evaluate_host_effect_for_fn_goal<'tcx>(
     };
 
     match tcx.constness(def) {
-        hir::Constness::Const => Ok(tcx
+        // FIXME(comptime)
+        hir::Constness::Const { always: true } => Err(EvaluationFailure::NoSolution),
+        hir::Constness::Const { always: false } => Ok(tcx
             .const_conditions(def)
             .instantiate(tcx, args)
             .into_iter()
@@ -594,8 +597,15 @@ fn evaluate_host_effect_from_selection_candidate<'tcx>(
             Err(_) => Err(EvaluationFailure::NoSolution),
             Ok(Some(source)) => match source {
                 ImplSource::UserDefined(impl_) => {
-                    if tcx.impl_trait_header(impl_.impl_def_id).constness != hir::Constness::Const {
-                        return Err(EvaluationFailure::NoSolution);
+                    match tcx.impl_trait_header(impl_.impl_def_id).constness {
+                        rustc_hir::Constness::Const { always } => {
+                            if always {
+                                todo!()
+                            }
+                        }
+                        rustc_hir::Constness::NotConst => {
+                            return Err(EvaluationFailure::NoSolution);
+                        }
                     }
 
                     let mut nested = impl_.nested;
diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs
index 11d743c..24e3eb7 100644
--- a/compiler/rustc_trait_selection/src/traits/fulfill.rs
+++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs
@@ -559,11 +559,7 @@ fn process_obligation(
                             return ProcessResult::Changed(PendingPredicateObligations::new());
                         }
                         ty::ConstKind::Value(cv) => cv.ty,
-                        ty::ConstKind::Unevaluated(uv) => infcx
-                            .tcx
-                            .type_of(uv.kind.def_id())
-                            .instantiate(infcx.tcx, uv.args)
-                            .skip_norm_wip(),
+                        ty::ConstKind::Unevaluated(uv) => uv.type_of(infcx.tcx).skip_norm_wip(),
                         // FIXME(generic_const_exprs): we should construct an alias like
                         // `<lhs_ty as Add<rhs_ty>>::Output` when this is an `Expr` representing
                         // `lhs + rhs`.
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs
index c37b50e..678f1ee 100644
--- a/compiler/rustc_trait_selection/src/traits/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/mod.rs
@@ -606,8 +606,12 @@ pub fn try_evaluate_const<'tcx>(
         | ty::ConstKind::Placeholder(_)
         | ty::ConstKind::Expr(_) => Err(EvaluateConstErr::HasGenericsOrInfers),
         ty::ConstKind::Unevaluated(uv) => {
-            let opt_anon_const_kind = matches!(uv.kind, ty::UnevaluatedConstKind::Anon { .. })
-                .then(|| tcx.anon_const_kind(uv.kind.def_id()));
+            let opt_anon_const_kind = match uv.kind {
+                ty::UnevaluatedConstKind::Anon { def_id } => {
+                    Some((def_id, tcx.anon_const_kind(def_id)))
+                }
+                _ => None,
+            };
 
             // Postpone evaluation of constants that depend on generic parameters or
             // inference variables.
@@ -624,12 +628,12 @@ pub fn try_evaluate_const<'tcx>(
                 // We handle `generic_const_exprs` separately as reasonable ways of handling constants in the type system
                 // completely fall apart under `generic_const_exprs` and makes this whole function Really hard to reason
                 // about if you have to consider gce whatsoever.
-                Some(ty::AnonConstKind::GCE) => {
+                Some((def_id, ty::AnonConstKind::GCE)) => {
                     if uv.has_non_region_infer() || uv.has_non_region_param() {
                         // `feature(generic_const_exprs)` causes anon consts to inherit all parent generics. This can cause
                         // inference variables and generic parameters to show up in `ty::Const` even though the anon const
                         // does not actually make use of them. We handle this case specially and attempt to evaluate anyway.
-                        match tcx.thir_abstract_const(uv.kind.def_id()) {
+                        match tcx.thir_abstract_const(def_id) {
                             Ok(Some(ct)) => {
                                 let ct = tcx.expand_abstract_consts(
                                     ct.instantiate(tcx, uv.args).skip_norm_wip(),
@@ -650,9 +654,8 @@ pub fn try_evaluate_const<'tcx>(
                                 }
                             }
                             Err(_) | Ok(None) => {
-                                let args = GenericArgs::identity_for_item(tcx, uv.kind.def_id());
-                                let typing_env =
-                                    ty::TypingEnv::post_analysis(tcx, uv.kind.def_id());
+                                let args = GenericArgs::identity_for_item(tcx, def_id);
+                                let typing_env = ty::TypingEnv::post_analysis(tcx, def_id);
                                 (args, typing_env)
                             }
                         }
@@ -663,7 +666,7 @@ pub fn try_evaluate_const<'tcx>(
                         (uv.args, typing_env)
                     }
                 }
-                Some(ty::AnonConstKind::RepeatExprCount) => {
+                Some((def_id, ty::AnonConstKind::RepeatExprCount)) => {
                     if uv.has_non_region_infer() {
                         // Diagnostics will sometimes replace the identity args of anon consts in
                         // array repeat expr counts with inference variables so we have to handle this
@@ -680,14 +683,14 @@ pub fn try_evaluate_const<'tcx>(
                     // affect evaluation of the constant as this would make it a "truly" generic const arg.
                     // To prevent this we discard all the generic arguments and evalaute with identity args
                     // and in its own environment instead of the current environment we are normalizing in.
-                    let args = GenericArgs::identity_for_item(tcx, uv.kind.def_id());
-                    let typing_env = ty::TypingEnv::post_analysis(tcx, uv.kind.def_id());
+                    let args = GenericArgs::identity_for_item(tcx, def_id);
+                    let typing_env = ty::TypingEnv::post_analysis(tcx, def_id);
 
                     (args, typing_env)
                 }
-                Some(ty::AnonConstKind::GCA)
-                | Some(ty::AnonConstKind::MCG)
-                | Some(ty::AnonConstKind::NonTypeSystem)
+                Some((_, ty::AnonConstKind::GCA))
+                | Some((_, ty::AnonConstKind::MCG))
+                | Some((_, ty::AnonConstKind::NonTypeSystem))
                 | None => {
                     // We are only dealing with "truly" generic/uninferred constants here:
                     // - GCEConsts have been handled separately
@@ -722,16 +725,9 @@ pub fn try_evaluate_const<'tcx>(
             use rustc_middle::mir::interpret::ErrorHandled;
             // FIXME: `def_span` will point at the definition of this const; ideally, we'd point at
             // where it gets used as a const generic.
-            match tcx.const_eval_resolve_for_typeck(
-                typing_env,
-                erased_uv,
-                tcx.def_span(uv.kind.def_id()),
-            ) {
-                Ok(Ok(val)) => Ok(ty::Const::new_value(
-                    tcx,
-                    val,
-                    tcx.type_of(uv.kind.def_id()).instantiate(tcx, uv.args).skip_norm_wip(),
-                )),
+            let span = uv.kind.def_span(tcx);
+            match tcx.const_eval_resolve_for_typeck(typing_env, erased_uv, span) {
+                Ok(Ok(val)) => Ok(ty::Const::new_value(tcx, val, uv.type_of(tcx).skip_norm_wip())),
                 Ok(Err(_)) => {
                     let e = tcx.dcx().delayed_bug(
                         "Type system constant with non valtree'able type evaluated but no error emitted",
diff --git a/compiler/rustc_trait_selection/src/traits/normalize.rs b/compiler/rustc_trait_selection/src/traits/normalize.rs
index d3bad27..6346068 100644
--- a/compiler/rustc_trait_selection/src/traits/normalize.rs
+++ b/compiler/rustc_trait_selection/src/traits/normalize.rs
@@ -449,7 +449,7 @@ fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
 
         if tcx.features().generic_const_exprs()
             // Normalize type_const items even with feature `generic_const_exprs`.
-            && !matches!(ct.kind(), ty::ConstKind::Unevaluated(uv) if tcx.is_type_const(uv.kind.def_id()))
+            && !matches!(ct.kind(), ty::ConstKind::Unevaluated(uv) if uv.kind.is_type_const(tcx))
             || !needs_normalization(self.selcx.infcx, &ct)
         {
             return ct;
diff --git a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
index 8be26fe..a171a0d 100644
--- a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
+++ b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
@@ -1,4 +1,5 @@
 use rustc_infer::infer::InferOk;
+use rustc_infer::infer::canonical::QueryRegionConstraint;
 use rustc_infer::infer::resolve::OpportunisticRegionResolver;
 use rustc_infer::traits::query::type_op::ImpliedOutlivesBounds;
 use rustc_macros::extension;
@@ -83,7 +84,7 @@ fn implied_outlives_bounds<'a, 'tcx>(
         // outlives bound required proving some higher-ranked coroutine obl.
         let QueryRegionConstraints { constraints, assumptions: _ } = constraints;
         let cause = ObligationCause::misc(span, body_id);
-        for &(constraint, _, vis) in &constraints {
+        for &QueryRegionConstraint { constraint, visible_for_leak_check: vis, .. } in &constraints {
             match constraint {
                 ty::RegionConstraint::Outlives(predicate) => {
                     infcx.register_outlives_constraint(predicate, vis, &cause)
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index d3fc3c3..8a50921 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -758,7 +758,7 @@ fn evaluate_predicate_recursively<'o>(
                     if pred.0.has_free_regions()
                         || pred.0.has_bound_regions()
                         || pred.0.has_non_region_infer()
-                        || pred.0.has_non_region_infer()
+                        || pred.0.has_non_region_param()
                     {
                         Ok(EvaluatedToOkModuloRegions)
                     } else {
@@ -987,11 +987,7 @@ fn evaluate_predicate_recursively<'o>(
                         }
                         ty::ConstKind::Error(_) => return Ok(EvaluatedToOk),
                         ty::ConstKind::Value(cv) => cv.ty,
-                        ty::ConstKind::Unevaluated(uv) => self
-                            .tcx()
-                            .type_of(uv.kind.def_id())
-                            .instantiate(self.tcx(), uv.args)
-                            .skip_norm_wip(),
+                        ty::ConstKind::Unevaluated(uv) => uv.type_of(self.tcx()).skip_norm_wip(),
                         // FIXME(generic_const_exprs): See comment in `fulfill.rs`
                         ty::ConstKind::Expr(_) => return Ok(EvaluatedToOk),
                         ty::ConstKind::Placeholder(_) => {
diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs
index 932f9c7..c458a1c 100644
--- a/compiler/rustc_trait_selection/src/traits/wf.rs
+++ b/compiler/rustc_trait_selection/src/traits/wf.rs
@@ -1064,8 +1064,7 @@ fn visit_const(&mut self, c: ty::Const<'tcx>) -> Self::Result {
             ty::ConstKind::Unevaluated(uv) => {
                 if !c.has_escaping_bound_vars() {
                     // Skip type consts as mGCA doesn't support evaluatable clauses
-                    if !tcx.is_type_const(uv.kind.def_id()) && !tcx.features().generic_const_args()
-                    {
+                    if !uv.kind.is_type_const(tcx) && !tcx.features().generic_const_args() {
                         let predicate = ty::Binder::dummy(ty::PredicateKind::Clause(
                             ty::ClauseKind::ConstEvaluatable(c),
                         ));
@@ -1079,12 +1078,17 @@ fn visit_const(&mut self, c: ty::Const<'tcx>) -> Self::Result {
                         ));
                     }
 
-                    if matches!(uv.kind, ty::UnevaluatedConstKind::Inherent { .. }) {
-                        self.add_wf_preds_for_inherent_projection(uv.into());
-                        return; // Subtree is handled by above function
-                    } else {
-                        let obligations = self.nominal_obligations(uv.kind.def_id(), uv.args);
-                        self.out.extend(obligations);
+                    match uv.kind {
+                        ty::UnevaluatedConstKind::Inherent { .. } => {
+                            self.add_wf_preds_for_inherent_projection(uv.into());
+                            return; // Subtree is handled by above function
+                        }
+                        ty::UnevaluatedConstKind::Projection { def_id }
+                        | ty::UnevaluatedConstKind::Free { def_id }
+                        | ty::UnevaluatedConstKind::Anon { def_id } => {
+                            let obligations = self.nominal_obligations(def_id, uv.args);
+                            self.out.extend(obligations);
+                        }
                     }
                 }
             }
diff --git a/compiler/rustc_traits/src/coroutine_witnesses.rs b/compiler/rustc_traits/src/coroutine_witnesses.rs
index 83a77f1..7fe8303 100644
--- a/compiler/rustc_traits/src/coroutine_witnesses.rs
+++ b/compiler/rustc_traits/src/coroutine_witnesses.rs
@@ -1,4 +1,5 @@
 use rustc_infer::infer::TyCtxtInferExt;
+use rustc_infer::infer::canonical::QueryRegionConstraint;
 use rustc_infer::infer::canonical::query_response::make_query_region_constraints;
 use rustc_infer::infer::resolve::OpportunisticRegionResolver;
 use rustc_infer::traits::{Obligation, ObligationCause};
@@ -80,7 +81,7 @@ fn compute_assumptions<'tcx>(
         tcx.mk_outlives_from_iter(
             constraints
                 .into_iter()
-                .flat_map(|(constraint, _, _)| constraint.iter_outlives())
+                .flat_map(|QueryRegionConstraint { constraint, .. }| constraint.iter_outlives())
                 // FIXME(higher_ranked_auto): We probably should deeply resolve these before
                 // filtering out infers which only correspond to unconstrained infer regions
                 // which we can sometimes get.
diff --git a/compiler/rustc_ty_utils/src/consts.rs b/compiler/rustc_ty_utils/src/consts.rs
index b459582..85bc9b9 100644
--- a/compiler/rustc_ty_utils/src/consts.rs
+++ b/compiler/rustc_ty_utils/src/consts.rs
@@ -10,7 +10,7 @@
 use rustc_span::Span;
 use tracing::instrument;
 
-use crate::errors::{GenericConstantTooComplex, GenericConstantTooComplexSub};
+use crate::diagnostics::{GenericConstantTooComplex, GenericConstantTooComplexSub};
 
 /// We do not allow all binary operations in abstract consts, so filter disallowed ones.
 fn check_binop(op: mir::BinOp) -> bool {
diff --git a/compiler/rustc_ty_utils/src/errors.rs b/compiler/rustc_ty_utils/src/diagnostics.rs
similarity index 100%
rename from compiler/rustc_ty_utils/src/errors.rs
rename to compiler/rustc_ty_utils/src/diagnostics.rs
diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs
index 3aaa3fe..1e197a3 100644
--- a/compiler/rustc_ty_utils/src/instance.rs
+++ b/compiler/rustc_ty_utils/src/instance.rs
@@ -14,7 +14,7 @@
 use tracing::debug;
 use traits::translate_args;
 
-use crate::errors::UnexpectedFnPtrAssociatedItem;
+use crate::diagnostics::UnexpectedFnPtrAssociatedItem;
 
 fn resolve_instance_raw<'tcx>(
     tcx: TyCtxt<'tcx>,
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs
index ee6afdf..60e3df6 100644
--- a/compiler/rustc_ty_utils/src/layout.rs
+++ b/compiler/rustc_ty_utils/src/layout.rs
@@ -26,7 +26,7 @@
 use rustc_span::{Symbol, sym};
 use tracing::{debug, instrument};
 
-use crate::errors::NonPrimitiveSimdType;
+use crate::diagnostics::NonPrimitiveSimdType;
 
 mod invariant;
 
diff --git a/compiler/rustc_ty_utils/src/lib.rs b/compiler/rustc_ty_utils/src/lib.rs
index 7cc68cc..6d7afba7 100644
--- a/compiler/rustc_ty_utils/src/lib.rs
+++ b/compiler/rustc_ty_utils/src/lib.rs
@@ -17,7 +17,7 @@
 mod assoc;
 mod common_traits;
 mod consts;
-mod errors;
+mod diagnostics;
 mod implied_bounds;
 mod instance;
 mod layout;
diff --git a/compiler/rustc_ty_utils/src/needs_drop.rs b/compiler/rustc_ty_utils/src/needs_drop.rs
index 89c526b..e2529e7 100644
--- a/compiler/rustc_ty_utils/src/needs_drop.rs
+++ b/compiler/rustc_ty_utils/src/needs_drop.rs
@@ -10,7 +10,7 @@
 use rustc_middle::ty::{self, EarlyBinder, GenericArgsRef, Ty, TyCtxt, Unnormalized};
 use tracing::{debug, instrument};
 
-use crate::errors::NeedsDropOverflow;
+use crate::diagnostics::NeedsDropOverflow;
 
 type NeedsDropResult<T> = Result<T, AlwaysRequiresDrop>;
 
@@ -23,10 +23,16 @@ fn needs_drop_raw<'tcx>(
     // needs drop.
     let adt_has_dtor =
         |adt_def: ty::AdtDef<'tcx>| adt_def.destructor(tcx).map(|_| DtorType::Significant);
-    let res = drop_tys_helper(tcx, query.value, query.typing_env, adt_has_dtor, false, false)
-        .filter(filter_array_elements(tcx, query.typing_env))
-        .next()
-        .is_some();
+    let res = drop_tys_helper(
+        tcx,
+        query.value,
+        query.typing_env,
+        adt_has_dtor,
+        DropTysOptions::default(),
+    )
+    .filter(filter_array_elements(tcx, query.typing_env))
+    .next()
+    .is_some();
 
     debug!("needs_drop_raw({:?}) = {:?}", query, res);
     res
@@ -41,10 +47,16 @@ fn needs_async_drop_raw<'tcx>(
     // it needs async drop.
     let adt_has_async_dtor =
         |adt_def: ty::AdtDef<'tcx>| adt_def.async_destructor(tcx).map(|_| DtorType::Significant);
-    let res = drop_tys_helper(tcx, query.value, query.typing_env, adt_has_async_dtor, false, false)
-        .filter(filter_array_elements_async(tcx, query.typing_env))
-        .next()
-        .is_some();
+    let res = drop_tys_helper(
+        tcx,
+        query.value,
+        query.typing_env,
+        adt_has_async_dtor,
+        DropTysOptions::default().recurse_into_box_for_async_drop(),
+    )
+    .filter(filter_array_elements_async(tcx, query.typing_env))
+    .next()
+    .is_some();
 
     debug!("needs_async_drop_raw({:?}) = {:?}", query, res);
     res
@@ -88,8 +100,7 @@ fn has_significant_drop_raw<'tcx>(
         query.value,
         query.typing_env,
         adt_consider_insignificant_dtor(tcx),
-        true,
-        false,
+        DropTysOptions::default().only_significant(),
     )
     .filter(filter_array_elements(tcx, query.typing_env))
     .next()
@@ -320,6 +331,30 @@ enum DtorType {
     Significant,
 }
 
+#[derive(Copy, Clone, Default)]
+struct DropTysOptions {
+    only_significant: bool,
+    exhaustive: bool,
+    async_drop_recurses_into_box: bool,
+}
+
+impl DropTysOptions {
+    fn only_significant(mut self) -> Self {
+        self.only_significant = true;
+        self
+    }
+
+    fn exhaustive(mut self) -> Self {
+        self.exhaustive = true;
+        self
+    }
+
+    fn recurse_into_box_for_async_drop(mut self) -> Self {
+        self.async_drop_recurses_into_box = true;
+        self
+    }
+}
+
 // This is a helper function for `adt_drop_tys` and `adt_significant_drop_tys`.
 // Depending on the implantation of `adt_has_dtor`, it is used to check if the
 // ADT has a destructor or if the ADT only has a significant destructor. For
@@ -329,8 +364,7 @@ fn drop_tys_helper<'tcx>(
     ty: Ty<'tcx>,
     typing_env: ty::TypingEnv<'tcx>,
     adt_has_dtor: impl Fn(ty::AdtDef<'tcx>) -> Option<DtorType>,
-    only_significant: bool,
-    exhaustive: bool,
+    options: DropTysOptions,
 ) -> impl Iterator<Item = NeedsDropResult<Ty<'tcx>>> {
     fn with_query_cache<'tcx>(
         tcx: TyCtxt<'tcx>,
@@ -353,6 +387,24 @@ fn with_query_cache<'tcx>(
         if adt_def.is_manually_drop() {
             debug!("drop_tys_helper: `{:?}` is manually drop", adt_def);
             Ok(Vec::new())
+        } else if options.async_drop_recurses_into_box && adt_def.is_box() {
+            let box_components = match args.as_slice() {
+                [boxed_ty, allocator_ty] => {
+                    let boxed_ty = boxed_ty.expect_ty();
+                    let allocator_ty = allocator_ty.expect_ty();
+                    match boxed_ty.kind() {
+                        // FIXME(async_drop): boxed dyn pointees are deliberately skipped here
+                        // because async drop glue does not yet dispatch through dyn metadata.
+                        // Once that is supported, this should include the boxed pointee too.
+                        ty::Dynamic(..) | ty::Error(_) => vec![allocator_ty],
+                        _ => vec![boxed_ty, allocator_ty],
+                    }
+                }
+                _ => {
+                    bug!("drop_tys_helper: `Box` has unexpected generic args: {args:?}");
+                }
+            };
+            Ok(box_components)
         } else if let Some(dtor_info) = adt_has_dtor(adt_def) {
             match dtor_info {
                 DtorType::Significant => {
@@ -380,7 +432,7 @@ fn with_query_cache<'tcx>(
                 );
                 r
             });
-            if only_significant {
+            if options.only_significant {
                 // We can't recurse through the query system here because we might induce a cycle
                 Ok(field_tys.collect())
             } else {
@@ -394,7 +446,7 @@ fn with_query_cache<'tcx>(
         .map(|v| v.into_iter())
     };
 
-    NeedsDropTypes::new(tcx, typing_env, ty, exhaustive, adt_components)
+    NeedsDropTypes::new(tcx, typing_env, ty, options.exhaustive, adt_components)
 }
 
 fn adt_consider_insignificant_dtor<'tcx>(
@@ -433,8 +485,7 @@ fn adt_drop_tys<'tcx>(
         tcx.type_of(def_id).instantiate_identity().skip_norm_wip(),
         ty::TypingEnv::non_body_analysis(tcx, def_id),
         adt_has_dtor,
-        false,
-        false,
+        DropTysOptions::default(),
     )
     .collect::<Result<Vec<_>, _>>()
     .map(|components| tcx.mk_type_list(&components))
@@ -453,8 +504,7 @@ fn adt_async_drop_tys<'tcx>(
         tcx.type_of(def_id).instantiate_identity().skip_norm_wip(),
         ty::TypingEnv::non_body_analysis(tcx, def_id),
         adt_has_dtor,
-        false,
-        false,
+        DropTysOptions::default().recurse_into_box_for_async_drop(),
     )
     .collect::<Result<Vec<_>, _>>()
     .map(|components| tcx.mk_type_list(&components))
@@ -472,8 +522,7 @@ fn adt_significant_drop_tys(
         tcx.type_of(def_id).instantiate_identity().skip_norm_wip(), // identical to `tcx.make_adt(def, identity_args)`
         ty::TypingEnv::non_body_analysis(tcx, def_id),
         adt_consider_insignificant_dtor(tcx),
-        true,
-        false,
+        DropTysOptions::default().only_significant(),
     )
     .collect::<Result<Vec<_>, _>>()
     .map(|components| tcx.mk_type_list(&components))
@@ -490,8 +539,7 @@ fn list_significant_drop_tys<'tcx>(
             key.value,
             key.typing_env,
             adt_consider_insignificant_dtor(tcx),
-            true,
-            true,
+            DropTysOptions::default().only_significant().exhaustive(),
         )
         .filter_map(|res| res.ok())
         .collect::<Vec<_>>(),
diff --git a/compiler/rustc_ty_utils/src/opaque_types.rs b/compiler/rustc_ty_utils/src/opaque_types.rs
index e5de396..d95624b 100644
--- a/compiler/rustc_ty_utils/src/opaque_types.rs
+++ b/compiler/rustc_ty_utils/src/opaque_types.rs
@@ -12,7 +12,7 @@
 use rustc_span::Span;
 use tracing::{instrument, trace};
 
-use crate::errors::{DuplicateArg, NotParam};
+use crate::diagnostics::{DuplicateArg, NotParam};
 
 struct OpaqueTypeCollector<'tcx> {
     tcx: TyCtxt<'tcx>,
diff --git a/compiler/rustc_type_ir/src/const_kind.rs b/compiler/rustc_type_ir/src/const_kind.rs
index 3782444..ddcdca9 100644
--- a/compiler/rustc_type_ir/src/const_kind.rs
+++ b/compiler/rustc_type_ir/src/const_kind.rs
@@ -94,9 +94,27 @@ pub fn new(
         kind: UnevaluatedConstKind<I>,
         args: I::GenericArgs,
     ) -> UnevaluatedConst<I> {
-        interner.debug_assert_args_compatible(kind.def_id(), args);
+        if cfg!(debug_assertions) {
+            let def_id = match kind {
+                ty::UnevaluatedConstKind::Projection { def_id } => def_id.into(),
+                ty::UnevaluatedConstKind::Inherent { def_id } => def_id.into(),
+                ty::UnevaluatedConstKind::Free { def_id } => def_id.into(),
+                ty::UnevaluatedConstKind::Anon { def_id } => def_id.into(),
+            };
+            interner.debug_assert_args_compatible(def_id, args);
+        }
         UnevaluatedConst { kind, args, _use_unevaluated_const_new_instead: () }
     }
+
+    pub fn type_of(self, interner: I) -> ty::Unnormalized<I, I::Ty> {
+        let def_id = match self.kind {
+            ty::UnevaluatedConstKind::Projection { def_id } => def_id.into(),
+            ty::UnevaluatedConstKind::Inherent { def_id } => def_id.into(),
+            ty::UnevaluatedConstKind::Free { def_id } => def_id.into(),
+            ty::UnevaluatedConstKind::Anon { def_id } => def_id.into(),
+        };
+        interner.type_of(def_id).instantiate(interner, self.args)
+    }
 }
 
 /// UnevaluatedConstKind is extremely similar to AliasTyKind, and likely should be reasoned about
@@ -124,12 +142,30 @@ pub fn new_from_def_id(interner: I, def_id: I::DefId) -> Self {
         interner.unevaluated_const_kind_from_def_id(def_id)
     }
 
-    pub fn def_id(self) -> I::DefId {
+    pub fn is_type_const(self, interner: I) -> bool {
         match self {
-            UnevaluatedConstKind::Projection { def_id } => def_id.into(),
-            UnevaluatedConstKind::Inherent { def_id } => def_id.into(),
-            UnevaluatedConstKind::Free { def_id } => def_id.into(),
-            UnevaluatedConstKind::Anon { def_id } => def_id.into(),
+            UnevaluatedConstKind::Projection { def_id } => interner.is_type_const(def_id.into()),
+            UnevaluatedConstKind::Inherent { def_id } => interner.is_type_const(def_id.into()),
+            UnevaluatedConstKind::Free { def_id } => interner.is_type_const(def_id.into()),
+            UnevaluatedConstKind::Anon { def_id } => interner.is_type_const(def_id.into()),
+        }
+    }
+
+    pub fn def_span(self, interner: I) -> I::Span {
+        match self {
+            UnevaluatedConstKind::Projection { def_id } => interner.def_span(def_id.into()),
+            UnevaluatedConstKind::Inherent { def_id } => interner.def_span(def_id.into()),
+            UnevaluatedConstKind::Free { def_id } => interner.def_span(def_id.into()),
+            UnevaluatedConstKind::Anon { def_id } => interner.def_span(def_id.into()),
+        }
+    }
+
+    pub fn opt_def_id(self) -> Option<I::DefId> {
+        match self {
+            UnevaluatedConstKind::Projection { def_id } => Some(def_id.into()),
+            UnevaluatedConstKind::Inherent { def_id } => Some(def_id.into()),
+            UnevaluatedConstKind::Free { def_id } => Some(def_id.into()),
+            UnevaluatedConstKind::Anon { def_id } => Some(def_id.into()),
         }
     }
 }
diff --git a/compiler/rustc_type_ir/src/interner.rs b/compiler/rustc_type_ir/src/interner.rs
index f0bb4e7..1e5ad0b 100644
--- a/compiler/rustc_type_ir/src/interner.rs
+++ b/compiler/rustc_type_ir/src/interner.rs
@@ -239,6 +239,8 @@ fn type_of_opaque_hir_typeck(
     fn const_of_item(self, def_id: Self::DefId) -> ty::EarlyBinder<Self, Self::Const>;
     fn anon_const_kind(self, def_id: Self::DefId) -> ty::AnonConstKind;
 
+    fn def_span(self, def_id: Self::DefId) -> Self::Span;
+
     type AdtDef: AdtDef<Self>;
     fn adt_def(self, adt_def_id: Self::AdtId) -> Self::AdtDef;
 
diff --git a/compiler/rustc_type_ir/src/relate.rs b/compiler/rustc_type_ir/src/relate.rs
index e1df344..7387037 100644
--- a/compiler/rustc_type_ir/src/relate.rs
+++ b/compiler/rustc_type_ir/src/relate.rs
@@ -225,7 +225,30 @@ fn relate<R: TypeRelation<I>>(
             } else {
                 relate_args_invariantly(relation, a.args, b.args)?
             };
-            Ok(ty::AliasTy::new_from_args(relation.cx(), a.kind, args))
+            Ok(ty::AliasTy::new_from_args(cx, a.kind, args))
+        }
+    }
+}
+
+impl<I: Interner> Relate<I> for ty::UnevaluatedConst<I> {
+    fn relate<R: TypeRelation<I>>(
+        relation: &mut R,
+        a: ty::UnevaluatedConst<I>,
+        b: ty::UnevaluatedConst<I>,
+    ) -> RelateResult<I, ty::UnevaluatedConst<I>> {
+        let cx = relation.cx();
+        if a.kind != b.kind {
+            Err(TypeError::ConstMismatch(ExpectedFound::new(
+                Const::new_unevaluated(cx, a),
+                Const::new_unevaluated(cx, b),
+            )))
+        } else {
+            // FIXME(mgca): remove this
+            debug_assert_eq!(a.type_of(cx).skip_norm_wip(), b.type_of(cx).skip_norm_wip());
+
+            let args = relate_args_invariantly(relation, a.args, b.args)?;
+
+            Ok(ty::UnevaluatedConst::new(cx, a.kind, args))
         }
     }
 }
@@ -591,21 +614,8 @@ pub fn structurally_relate_consts<I: Interner, R: TypeRelation<I>>(
         // While this is slightly incorrect, it shouldn't matter for `min_const_generics`
         // and is the better alternative to waiting until `generic_const_exprs` can
         // be stabilized.
-        (ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu)) if au.kind == bu.kind => {
-            // FIXME(mgca): remove this
-            if cfg!(debug_assertions) {
-                let a_ty = cx.type_of(au.kind.def_id()).instantiate(cx, au.args).skip_norm_wip();
-                let b_ty = cx.type_of(bu.kind.def_id()).instantiate(cx, bu.args).skip_norm_wip();
-                assert_eq!(a_ty, b_ty);
-            }
-
-            let args = relation.relate_with_variance(
-                ty::Invariant,
-                VarianceDiagInfo::default(),
-                au.args,
-                bu.args,
-            )?;
-            return Ok(Const::new_unevaluated(cx, ty::UnevaluatedConst::new(cx, au.kind, args)));
+        (ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu)) => {
+            return Ok(Const::new_unevaluated(cx, relation.relate(au, bu)?));
         }
         (ty::ConstKind::Expr(ae), ty::ConstKind::Expr(be)) => {
             let expr = relation.relate(ae, be)?;
diff --git a/compiler/rustc_type_ir/src/ty_kind/closure.rs b/compiler/rustc_type_ir/src/ty_kind/closure.rs
index 3b8ed0a..b688a00 100644
--- a/compiler/rustc_type_ir/src/ty_kind/closure.rs
+++ b/compiler/rustc_type_ir/src/ty_kind/closure.rs
@@ -454,6 +454,15 @@ pub fn tupled_upvars_by_closure_kind(
         coroutine_captures_by_ref_ty: I::Ty,
         env_region: I::Region,
     ) -> I::Ty {
+        // If either of the tupled capture types are constrained to error
+        // (e.g. during typeck when the infcx is tainted), then just return
+        // the error type directly.
+        if let ty::Error(_) = tupled_inputs_ty.kind() {
+            return tupled_inputs_ty;
+        } else if let ty::Error(_) = coroutine_captures_by_ref_ty.kind() {
+            return coroutine_captures_by_ref_ty;
+        }
+
         match kind {
             ty::ClosureKind::Fn | ty::ClosureKind::FnMut => {
                 let ty::FnPtr(sig_tys, _) = coroutine_captures_by_ref_ty.kind() else {
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs
index 523c9b8..785c1c8 100644
--- a/library/alloc/src/rc.rs
+++ b/library/alloc/src/rc.rs
@@ -1541,14 +1541,12 @@ pub fn into_raw(this: Self) -> *const T {
     ///
     /// # Safety
     ///
-    /// The pointer must have been obtained through `Rc::into_raw` and must satisfy the
-    /// same layout requirements specified in [`Rc::from_raw_in`][from_raw_in].
+    /// The pointer must have been obtained through [`Rc::into_raw`] and must satisfy the
+    /// same layout requirements specified in [`Rc::from_raw_in`].
     /// The associated `Rc` instance must be valid (i.e. the strong count must be at
     /// least 1) for the duration of this method, and `ptr` must point to a block of memory
     /// allocated by the global allocator.
     ///
-    /// [from_raw_in]: Rc::from_raw_in
-    ///
     /// # Examples
     ///
     /// ```
diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs
index cf04402..2300397 100644
--- a/library/alloc/src/str.rs
+++ b/library/alloc/src/str.rs
@@ -659,6 +659,108 @@ pub fn to_uppercase(&self) -> String {
         s
     }
 
+    /// Returns the case-folded equivalent of this string slice, as a new [`String`].
+    ///
+    /// Case folding is a transformation, mostly matching lowercase, that is meant to be used
+    /// for case-insensitive string comparisons. Case-folded strings should not usually
+    /// be exposed directly to users.
+    ///
+    /// For the precise specification of case folding, see
+    /// [Chapter 3 (Conformance)](https://www.unicode.org/versions/latest/core-spec/chapter-3/#G63737)
+    /// of the Unicode standard.
+    ///
+    /// Since some characters can expand into multiple characters when case folding,
+    /// this function returns a [`String`] instead of modifying the parameter in-place.
+    ///
+    /// No [normalization] (e.g. NFC) is performed, so visually and semantically identical strings
+    /// might still casefold differently. For example, `"Å"` (U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE)
+    /// is considered distinct from `"Å"` (A followed by U+030A COMBINING RING ABOVE),
+    /// even though Unicode considers them canonically equivalent.
+    ///
+    /// Like [`char::to_casefold_unnormalized()`] this method does not handle language-specific
+    /// casing, like Turkish and Azeri I/ı/İ/i. See that method's documentation
+    /// for more information.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// #![feature(casefold)]
+    /// let s0 = "HELLO";
+    /// let s1 = "Hello";
+    ///
+    /// assert_eq!(s0.to_casefold_unnormalized(), s1.to_casefold_unnormalized());
+    /// assert_eq!(s0.to_casefold_unnormalized(), "hello")
+    /// ```
+    ///
+    /// Scripts without case are not changed:
+    ///
+    /// ```
+    /// #![feature(casefold)]
+    /// let new_year = "农历新年";
+    ///
+    /// assert_eq!(new_year, new_year.to_casefold_unnormalized());
+    /// ```
+    ///
+    /// One character can become multiple:
+    ///
+    /// ```
+    /// #![feature(casefold)]
+    /// let s0 = "TSCHÜẞ";
+    /// let s1 = "TSCHÜSS";
+    /// let s2 = "tschüß";
+    ///
+    /// assert_eq!(s0.to_casefold_unnormalized(), s1.to_casefold_unnormalized());
+    /// assert_eq!(s0.to_casefold_unnormalized(), s2.to_casefold_unnormalized());
+    /// assert_eq!(s0.to_casefold_unnormalized(), "tschüss");
+    /// ```
+    ///
+    /// No NFC [normalization] is performed:
+    ///
+    /// ```rust
+    /// #![feature(casefold)]
+    /// // These two strings are visually and semantically identical...
+    /// let comp = "Å";
+    /// let decomp = "Å";
+    ///
+    /// // ... but not codepoint-for-codepoint equal.
+    /// assert_eq!(comp, "\u{C5}");
+    /// assert_eq!(decomp, "A\u{030A}");
+    ///
+    /// // Their case-foldings are likewise unequal:
+    /// assert_eq!(comp.to_casefold_unnormalized(), "\u{E5}");
+    /// assert_eq!(decomp.to_casefold_unnormalized(), "a\u{030A}");
+    /// ```
+    ///
+    /// [normalization]: https://www.unicode.org/faq/normalization
+    #[cfg(not(no_global_oom_handling))]
+    #[rustc_allow_incoherent_impl]
+    #[must_use = "this returns the case-folded string as a new String, \
+                  without modifying the original"]
+    #[unstable(feature = "casefold", issue = "154742")]
+    pub fn to_casefold_unnormalized(&self) -> String {
+        // SAFETY: `to_ascii_lowercase` preserves ASCII bytes, so the converted
+        // prefix remains valid UTF-8.
+        let (mut s, rest) = unsafe { convert_while_ascii(self, u8::to_ascii_lowercase) };
+
+        for c in rest.chars() {
+            match conversions::to_casefold(c) {
+                [a, '\0', _] => s.push(a),
+                [a, b, '\0'] => {
+                    s.push(a);
+                    s.push(b);
+                }
+                [a, b, c] => {
+                    s.push(a);
+                    s.push(b);
+                    s.push(c);
+                }
+            }
+        }
+        s
+    }
+
     /// Converts a [`Box<str>`] into a [`String`] without copying or allocating.
     ///
     /// # Examples
diff --git a/library/alloctests/tests/lib.rs b/library/alloctests/tests/lib.rs
index b7c3e39..f7573c7 100644
--- a/library/alloctests/tests/lib.rs
+++ b/library/alloctests/tests/lib.rs
@@ -3,6 +3,7 @@
 #![feature(const_heap)]
 #![feature(deque_extend_front)]
 #![feature(iter_array_chunks)]
+#![feature(casefold)]
 #![feature(cow_is_borrowed)]
 #![feature(core_intrinsics)]
 #![feature(downcast_unchecked)]
diff --git a/library/alloctests/tests/str.rs b/library/alloctests/tests/str.rs
index dca2c49..af4930a 100644
--- a/library/alloctests/tests/str.rs
+++ b/library/alloctests/tests/str.rs
@@ -1886,7 +1886,13 @@ fn to_lowercase() {
 #[test]
 fn to_uppercase() {
     assert_eq!("".to_uppercase(), "");
-    assert_eq!("aéDžßfiᾀ".to_uppercase(), "AÉDŽSSFIἈΙ");
+    assert_eq!("aéDžßẞfiᾀ".to_uppercase(), "AÉDŽSSẞFIἈΙ");
+}
+
+#[test]
+fn to_casefold_unnormalized() {
+    assert_eq!("".to_casefold_unnormalized(), "");
+    assert_eq!("ꮿfiῲὼ\u{0345}ßẞΣς".to_casefold_unnormalized(), "Ꮿfiὼιὼιssssσσ");
 }
 
 #[test]
@@ -2425,6 +2431,16 @@ fn check_many(s: &str, arg: impl IntoIterator<Item = usize>, ret: usize) {
     check_many("🇯🇵", 0..4, 0);
     check_many("🇯🇵", 4..8, 4);
     check_many("🇯🇵", 8..10, 8);
+
+    // anticipate length- and index-based specializations
+    let s = "jpĵƥ日本🇯🇵jpĵƥ日本🇯🇵";
+    let expected = [
+        0, 1, 2, 2, 4, 4, 6, 6, 6, 9, 9, 9, 12, 12, 12, 12, 16, 16, 16, 16, 20, 21, 22, 22, 24, 24,
+        26, 26, 26, 29, 29, 29, 32, 32, 32, 32, 36, 36, 36, 36, 40, 40, 40, 40,
+    ];
+    for (idx, &ret) in expected.iter().enumerate() {
+        check_many(s, [idx], ret);
+    }
 }
 
 #[test]
@@ -2471,4 +2487,14 @@ fn check_many(s: &str, arg: impl IntoIterator<Item = usize>, ret: usize) {
 
     // above len
     check_many("hello", 5..=10, 5);
+
+    // anticipate length- and index-based specializations
+    let s = "jpĵƥ日本🇯🇵jpĵƥ日本🇯🇵";
+    let expected = [
+        0, 1, 2, 4, 4, 6, 6, 9, 9, 9, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 20, 21, 22, 24, 24,
+        26, 26, 29, 29, 29, 32, 32, 32, 36, 36, 36, 36, 40, 40, 40, 40, 40, 40, 40,
+    ];
+    for (idx, &ret) in expected.iter().enumerate() {
+        check_many(s, [idx], ret);
+    }
 }
diff --git a/library/core/src/ascii/ascii_char.rs b/library/core/src/ascii/ascii_char.rs
index a957005..c8c05ee 100644
--- a/library/core/src/ascii/ascii_char.rs
+++ b/library/core/src/ascii/ascii_char.rs
@@ -476,6 +476,11 @@ pub const fn from_u8(b: u8) -> Option<Self> {
     #[unstable(feature = "ascii_char", issue = "110998")]
     #[inline]
     pub const unsafe fn from_u8_unchecked(b: u8) -> Self {
+        assert_unsafe_precondition!(
+            check_library_ub,
+            "`ascii::Char::from_u8_unchecked` input cannot exceed 127.",
+            (b: u8 = b) => b <= 127,
+        );
         // SAFETY: Our safety precondition is that `b` is in-range.
         unsafe { transmute(b) }
     }
diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs
index d8b7fe4..a397dd8 100644
--- a/library/core/src/char/methods.rs
+++ b/library/core/src/char/methods.rs
@@ -1076,16 +1076,17 @@ pub(crate) fn is_grapheme_extended(self) -> bool {
     }
 
     /// Returns `true` if this `char` has the `Case_Ignorable` property. This narrow-use property
-    /// is used to implement context-dependent casing for the Greek letter sigma (uppercase Σ),
+    /// is used to implement context-dependent casing for the Greek letter sigma (uppercase 'Σ'),
     /// which has two lowercase forms.
     ///
     /// `Case_Ignorable` is [described][D136] in Chapter 3 (Conformance) of the Unicode Core Specification,
-    /// and specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`];
-    /// see those resources for more information.
+    /// and specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`].
+    /// See those resources, as well as [`to_lowercase()`]'s documentation, for more information.
     ///
     /// [D136]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G63116
     /// [ucd]: https://www.unicode.org/reports/tr44/
     /// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
+    /// [`to_lowercase()`]: Self::to_lowercase()
     #[must_use]
     #[inline]
     #[unstable(feature = "case_ignorable", issue = "154848")]
@@ -1155,8 +1156,6 @@ pub fn is_numeric(self) -> bool {
     /// If this `char` expands to multiple `char`s, the iterator yields the `char`s given by
     /// [`SpecialCasing.txt`]. The maximum number of `char`s in a case mapping is 3.
     ///
-    /// [`SpecialCasing.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
-    ///
     /// This operation performs an unconditional mapping without tailoring. That is, the conversion
     /// is independent of context and language. See [below](#notes-on-context-and-locale)
     /// for more information.
@@ -1211,14 +1210,25 @@ pub fn is_numeric(self) -> bool {
     ///
     /// ## Greek sigma
     ///
-    /// In Greek, the letter simga (uppercase Σ) has two lowercase forms:
-    /// ς which is used only at the end of a word, and σ which is used everywhere else.
-    /// `to_lowercase()` always uses the second form:
+    /// In Greek, the letter simga (uppercase 'Σ') has two lowercase forms:
+    /// 'σ' which is used in most situations, and 'ς' which appears only
+    /// at the end of a word. [`char::to_lowercase()`] always uses the first form:
     ///
     /// ```
     /// assert_eq!('Σ'.to_lowercase().to_string(), "σ");
     /// ```
     ///
+    /// `str::to_lowercase()` (only available with the `alloc` crate)
+    /// *does* properly handle this contextual mapping,
+    /// so prefer using that method if you can. Alternatively, you can use
+    /// [`is_cased()`] and [`is_case_ignorable()`] to implement it yourself.
+    /// See `Final_Sigma` in [Table 3.17] of the Unicode Standard,
+    /// along with [`SpecialCasing.txt`], for more details.
+    ///
+    /// [`is_cased()`]: Self::is_cased()
+    /// [`is_case_ignorable()`]: Self::is_case_ignorable()
+    /// [Table 3.17]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G54277
+    ///
     /// ## Turkish and Azeri I/ı/İ/i
     ///
     /// In Turkish and Azeri, the equivalent of 'i' in Latin has five forms instead of two:
@@ -1226,13 +1236,13 @@ pub fn is_numeric(self) -> bool {
     /// * 'Dotless': I / ı, sometimes written ï
     /// * 'Dotted': İ / i
     ///
-    /// Note that the uppercase undotted 'I' is the same as the Latin. Therefore:
+    /// Note that the uppercase undotted 'I' is the same codepoint as the Latin. Therefore:
     ///
     /// ```
     /// let lower_i = 'I'.to_lowercase().to_string();
     /// ```
     ///
-    /// The value of `lower_i` here relies on the language of the text: if we're
+    /// `'I'`'s correct lowercase relies on the language of the text: if we're
     /// in `en-US`, it should be `"i"`, but if we're in `tr-TR` or `az-AZ`, it should
     /// be `"ı"`. `to_lowercase()` does not take this into account, and so:
     ///
@@ -1243,6 +1253,8 @@ pub fn is_numeric(self) -> bool {
     /// ```
     ///
     /// holds across languages.
+    ///
+    /// [`SpecialCasing.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
     #[must_use = "this returns the lowercased character as a new iterator, \
                   without modifying the original"]
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -1393,22 +1405,22 @@ pub fn to_lowercase(self) -> ToLowercase {
     /// As stated above, this method is locale-insensitive.
     /// If you need locale support, consider using an external crate,
     /// like [`icu_casemap`](https://crates.io/crates/icu_casemap)
-    /// which is developed by Unicode. A description of a common
-    /// locale-dependent casing issue follows:
+    /// which is developed by Unicode. A description of one common
+    /// locale-dependent casing issue follows (there are others):
     ///
     /// In Turkish and Azeri, the equivalent of 'i' in Latin has five forms instead of two:
     ///
     /// * 'Dotless': I / ı, sometimes written ï
     /// * 'Dotted': İ / i
     ///
-    /// Note that the lowercase dotted 'i' is the same as the Latin. Therefore:
+    /// Note that the lowercase dotted 'i' is the same codepoint as the Latin. Therefore:
     ///
     /// ```
     /// #![feature(titlecase)]
     /// let upper_i = 'i'.to_titlecase().to_string();
     /// ```
     ///
-    /// The value of `upper_i` here relies on the language of the text: if we're
+    /// `'i'`'s correct titlecase relies on the language of the text: if we're
     /// in `en-US`, it should be `"I"`, but if we're in `tr-TR` or `az-AZ`, it should
     /// be `"İ"`. `to_titlecase()` does not take this into account, and so:
     ///
@@ -1505,21 +1517,21 @@ pub fn to_titlecase(self) -> ToTitlecase {
     /// As stated above, this method is locale-insensitive.
     /// If you need locale support, consider using an external crate,
     /// like [`icu_casemap`](https://crates.io/crates/icu_casemap)
-    /// which is developed by Unicode. A description of a common
-    /// locale-dependent casing issue follows:
+    /// which is developed by Unicode. A description of one common
+    /// locale-dependent casing issue follows (there are others):
     ///
     /// In Turkish and Azeri, the equivalent of 'i' in Latin has five forms instead of two:
     ///
     /// * 'Dotless': I / ı, sometimes written ï
     /// * 'Dotted': İ / i
     ///
-    /// Note that the lowercase dotted 'i' is the same as the Latin. Therefore:
+    /// Note that the lowercase dotted 'i' is the same codepoint as the Latin. Therefore:
     ///
     /// ```
     /// let upper_i = 'i'.to_uppercase().to_string();
     /// ```
     ///
-    /// The value of `upper_i` here relies on the language of the text: if we're
+    /// `'i'`'s correct uppercase relies on the language of the text: if we're
     /// in `en-US`, it should be `"I"`, but if we're in `tr-TR` or `az-AZ`, it should
     /// be `"İ"`. `to_uppercase()` does not take this into account, and so:
     ///
@@ -1540,6 +1552,110 @@ pub fn to_uppercase(self) -> ToUppercase {
         ToUppercase(CaseMappingIter::new(conversions::to_upper(self)))
     }
 
+    /// Returns an iterator that yields the case folding of this `char` as one or more
+    /// `char`s.
+    ///
+    /// Case folding is meant to be used when performing case-insensitive string comparisons.
+    /// Case-folded strings should not usually be exposed directly to users. For most,
+    /// but not all, characters, the casefold mapping is identical to the lowercase one.
+    ///
+    /// This iterator yields the `char`(s) in the common or full case folding for this `char`,
+    /// as given by the [Unicode Character Database][ucd] [`CaseFolding.txt`].
+    /// The maximum number of `char`s in a case folding is 3.
+    ///
+    /// [ucd]: https://www.unicode.org/reports/tr44/
+    /// [`CaseFolding.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/CaseFolding.txt
+    ///
+    ///
+    /// No [normalization] (e.g. NFC) is performed, so visually and semantically identical characters
+    /// might still casefold differently. For example, `'ά'` (U+03AC GREEK SMALL LETTER ALPHA WITH TONOS)
+    /// is considered distinct from `'ά'` (U+1F71 GREEK SMALL LETTER ALPHA WITH OXIA),
+    /// even though Unicode considers them canonically equivalent.
+    ///
+    /// In addition, this method is independent of language/locale,
+    /// so the special behavior of I/ı/İ/i in Turkish and Azeri is not handled.
+    ///
+    /// In the [Unicode Standard], Chapter 4 (Character Properties) discusses case folding in
+    /// general and Chapter 3 (Conformance) discusses the default algorithm for case folding.
+    ///
+    /// [Unicode Standard]: https://www.unicode.org/versions/latest/
+    ///
+    /// # Examples
+    ///
+    /// The German sharp S `'ß'` (U+DF) is a single Unicode code point
+    /// that casefolds to `"ss"`. Its uppercase variant '`ẞ`' (U+1E9E)
+    /// has the same case-folding.
+    ///
+    /// As an iterator:
+    ///
+    /// ```
+    /// #![feature(casefold)]
+    /// assert!('ß'.to_casefold_unnormalized().eq(['s', 's']));
+    /// assert!('ẞ'.to_casefold_unnormalized().eq(['s', 's']));
+    /// ```
+    ///
+    /// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
+    ///
+    /// ```
+    /// #![feature(casefold)]
+    /// assert_eq!('ß'.to_casefold_unnormalized().to_string(), "ss");
+    /// assert_eq!('ẞ'.to_casefold_unnormalized().to_string(), "ss");
+    /// ```
+    ///
+    /// No [normalization] is performed:
+    ///
+    /// ```rust
+    /// #![feature(casefold)]
+    /// // These two characters are visually and semantically identical;
+    /// // Unicode considers them to be canonically equivalent.
+    /// let alpha_tonos = 'ά';
+    /// let alpha_oxia = 'ά';
+    ///
+    /// // However, they are different codepoints:
+    /// assert_eq!(alpha_tonos, '\u{03AC}');
+    /// assert_eq!(alpha_oxia, '\u{1F71}');
+    ///
+    /// // Their case-foldings are likewise unequal:
+    /// assert!(alpha_tonos.to_casefold_unnormalized().eq(['\u{03AC}']));
+    /// assert!(alpha_oxia.to_casefold_unnormalized().eq(['\u{1F71}']));
+    /// ```
+    ///
+    /// # Note on locale
+    ///
+    /// In Turkish and Azeri, the equivalent of 'i' in Latin has five forms instead of two:
+    ///
+    /// * 'Dotless': I / ı, sometimes written ï
+    /// * 'Dotted': İ / i
+    ///
+    /// Note that the uppercase undotted 'I' is the same codepoint as the Latin. Therefore:
+    ///
+    /// ```
+    /// #![feature(casefold)]
+    /// let casefold_i = 'I'.to_casefold_unnormalized().to_string();
+    /// ```
+    ///
+    /// `'I'`'s correct case folding relies on the language of the text: if we're
+    /// in `en-US`, it should be `"i"`, but if we're in `tr-TR` or `az-AZ`, it should
+    /// be `"ı"`. `to_casefold_unnormalized()` does not take this into account, and so:
+    ///
+    /// ```
+    /// #![feature(casefold)]
+    /// let casefold_i = 'I'.to_casefold_unnormalized().to_string();
+    ///
+    /// assert_eq!(casefold_i, "i");
+    /// ```
+    ///
+    /// holds across languages.
+    ///
+    /// [normalization]: https://www.unicode.org/faq/normalization
+    #[must_use = "this returns the case-folded character as a new iterator, \
+                  without modifying the original"]
+    #[unstable(feature = "casefold", issue = "154742")]
+    #[inline]
+    pub fn to_casefold_unnormalized(self) -> ToCasefold {
+        ToCasefold(CaseMappingIter::new(conversions::to_casefold(self)))
+    }
+
     /// Checks if the value is within the ASCII range.
     ///
     /// # Examples
diff --git a/library/core/src/char/mod.rs b/library/core/src/char/mod.rs
index 2416406..eab7076 100644
--- a/library/core/src/char/mod.rs
+++ b/library/core/src/char/mod.rs
@@ -519,6 +519,21 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     ToLowercase
 }
 
+casemappingiter_impls! {
+    #[unstable(feature = "casefold", issue = "154742")]
+    #[unstable(feature = "casefold", issue = "154742")]
+    #[unstable(feature = "casefold", issue = "154742")]
+    #[unstable(feature = "casefold", issue = "154742")]
+    #[unstable(feature = "casefold", issue = "154742")]
+    /// Returns an iterator that yields the case-folded equivalent of a `char`.
+    ///
+    /// This `struct` is created by the [`to_casefold_unnormalized`] method on [`char`]. See
+    /// its documentation for more.
+    ///
+    /// [`to_casefold_unnormalized`]: char::to_casefold_unnormalized
+    ToCasefold
+}
+
 #[derive(Debug, Clone)]
 struct CaseMappingIter(core::array::IntoIter<char, 3>);
 
diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs
index 34cf9c5..ae8458c 100644
--- a/library/core/src/convert/mod.rs
+++ b/library/core/src/convert/mod.rs
@@ -43,6 +43,8 @@
 
 #[unstable(feature = "convert_float_to_int", issue = "67057")]
 pub use num::FloatToInt;
+#[unstable(feature = "integer_casts", issue = "157388")]
+pub use num::{BoundedCastFromInt, CheckedCastFromInt};
 
 /// The identity function.
 ///
diff --git a/library/core/src/convert/num.rs b/library/core/src/convert/num.rs
index 7179512..19398b4 100644
--- a/library/core/src/convert/num.rs
+++ b/library/core/src/convert/num.rs
@@ -630,3 +630,98 @@ fn try_from(value: NonZero<$source>) -> Result<Self, Self::Error> {
 impl_nonzero_int_try_from_nonzero_int!(i64 => u8, u16, u32, u64, u128, usize);
 impl_nonzero_int_try_from_nonzero_int!(i128 => u8, u16, u32, u64, u128, usize);
 impl_nonzero_int_try_from_nonzero_int!(isize => u8, u16, u32, u64, u128, usize);
+
+/// Conversion between integers, wrapping around or saturating at the target type's boundaries.
+#[unstable(feature = "integer_casts", issue = "157388")]
+#[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+pub impl(self) const trait BoundedCastFromInt<T>: Sized {
+    /// Converts `value` to this type, wrapping around at the boundary of the type.
+    #[unstable(feature = "integer_casts", issue = "157388")]
+    fn wrapping_cast_from(value: T) -> Self;
+
+    /// Converts `value` to this type, saturating at the numeric bounds instead of overflowing.
+    #[unstable(feature = "integer_casts", issue = "157388")]
+    fn saturating_cast_from(value: T) -> Self;
+}
+
+/// Fallible conversion between integers.
+#[unstable(feature = "integer_casts", issue = "157388")]
+#[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+pub impl(self) const trait CheckedCastFromInt<T>: Sized {
+    /// Converts `value` to this type, returning `None` if overflow would have occurred.
+    #[unstable(feature = "integer_casts", issue = "157388")]
+    fn checked_cast_from(value: T) -> Option<Self>;
+
+    /// Converts `value` to this type, assuming overflow cannot occur.
+    ///
+    /// # Safety
+    ///
+    /// This results in undefined behavior when `value` will overflow when
+    /// converted to this type.
+    #[unstable(feature = "integer_casts", issue = "157388")]
+    unsafe fn unchecked_cast_from(value: T) -> Self;
+
+    /// Converts `value` to this type, panicking on overflow.
+    ///
+    /// # Panics
+    ///
+    /// This function will always panic on overflow, regardless of whether overflow checks are enabled.
+    #[unstable(feature = "integer_casts", issue = "157388")]
+    fn strict_cast_from(value: T) -> Self;
+}
+
+macro_rules! impl_int_cast {
+    ($Src:ty as [$($Dst:ty),*]) => {$(
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        impl const CheckedCastFromInt<$Src> for $Dst {
+            #[inline]
+            fn checked_cast_from(value: $Src) -> Option<Self> {
+                value.try_into().ok()
+            }
+
+            #[inline(always)]
+            unsafe fn unchecked_cast_from(value: $Src) -> Self {
+                // SAFETY: the safety contract must be upheld by the caller.
+                unsafe { value.try_into().unwrap_unchecked() }
+            }
+
+            #[inline]
+            #[track_caller]
+            fn strict_cast_from(value: $Src) -> Self {
+                match value.try_into() {
+                    Ok(x) => x,
+                    Err(_) => core::num::imp::overflow_panic::cast_integer()
+                }
+            }
+        }
+
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        impl const BoundedCastFromInt<$Src> for $Dst {
+            #[inline(always)]
+            fn wrapping_cast_from(value: $Src) -> Self {
+                value as Self
+            }
+
+            #[inline]
+            #[allow(unused_comparisons)]
+            #[allow(irrefutable_let_patterns)]
+            fn saturating_cast_from(value: $Src) -> Self {
+                if let Ok(x) = value.try_into() {
+                    return x;
+                }
+
+                if value < 0 { <$Dst>::MIN } else { <$Dst>::MAX }
+            }
+        }
+    )*};
+}
+
+macro_rules! impl_all_int_casts {
+    ([$($Src:ty),*]) => {$(
+        impl_int_cast!($Src as [u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize]);
+    )*};
+}
+
+impl_all_int_casts!([u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize]);
diff --git a/library/core/src/iter/sources/repeat.rs b/library/core/src/iter/sources/repeat.rs
index f578ae8..bdad4ad 100644
--- a/library/core/src/iter/sources/repeat.rs
+++ b/library/core/src/iter/sources/repeat.rs
@@ -101,11 +101,21 @@ fn nth(&mut self, n: usize) -> Option<A> {
         Some(self.element.clone())
     }
 
+    /// Consumes the iterator and panics.
+    ///
+    /// # Panics
+    ///
+    /// This method always panics because `Repeat` is infinite.
     #[track_caller]
     fn last(self) -> Option<A> {
         panic!("iterator is infinite");
     }
 
+    /// Consumes the iterator and panics.
+    ///
+    /// # Panics
+    ///
+    /// This method always panics because `Repeat` is infinite.
     #[track_caller]
     fn count(self) -> usize {
         panic!("iterator is infinite");
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 6bc184f..b2ccb69 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -181,6 +181,7 @@
 #![feature(aarch64_unstable_target_feature)]
 #![feature(arm_target_feature)]
 #![feature(avx10_target_feature)]
+#![feature(clflushopt_target_feature)]
 #![feature(hexagon_target_feature)]
 #![feature(loongarch_target_feature)]
 #![feature(mips_target_feature)]
diff --git a/library/core/src/mem/alignment.rs b/library/core/src/mem/alignment.rs
index 08ce7fc..8f45368 100644
--- a/library/core/src/mem/alignment.rs
+++ b/library/core/src/mem/alignment.rs
@@ -58,7 +58,13 @@ pub const fn of<T>() -> Self {
 
     /// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
     ///
-    /// Every reference to a value of the type `T` must be a multiple of this number.
+    /// This function is identical to [`Alignment::of::<T>()`][Self::of] whenever
+    /// <code>T: [Sized]</code>,
+    /// but also supports determining the alignment required by a `dyn Trait` value, which is the
+    /// alignment of the underlying concrete type.
+    ///
+    /// This provides the same numerical value as [`align_of_val`],
+    /// but in an `Alignment` instead of a `usize`.
     ///
     /// [ABI]: https://en.wikipedia.org/wiki/Application_binary_interface
     ///
@@ -70,6 +76,25 @@ pub const fn of<T>() -> Self {
     ///
     /// assert_eq!(Alignment::of_val(&5i32).as_usize(), 4);
     /// ```
+    ///
+    /// (Caution: [it is not guaranteed][type-layout] that the alignment of `i32` is `4`;
+    /// that is, the above assertion does not pass on all platforms.)
+    ///
+    /// `dyn` types may have different alignments for different values;
+    /// `Alignment::of_val()` can be used to learn those alignments:
+    ///
+    /// ```
+    /// #![feature(ptr_alignment_type)]
+    /// use std::mem::Alignment;
+    ///
+    /// let a: &dyn ToString = &1234u16;
+    /// let b: &dyn ToString = &String::from("abcd");
+    ///
+    /// assert_eq!(Alignment::of_val(a), Alignment::of::<u16>());
+    /// assert_eq!(Alignment::of_val(b), Alignment::of::<String>());
+    /// ```
+    ///
+    /// [type-layout]: ../../reference/type-layout.html#r-layout.primitive
     #[inline]
     #[must_use]
     #[unstable(feature = "ptr_alignment_type", issue = "102070")]
@@ -81,7 +106,9 @@ pub const fn of_val<T: MetaSized>(val: &T) -> Self {
 
     /// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
     ///
-    /// Every reference to a value of the type `T` must be a multiple of this number.
+    /// This function is identical to [`Alignment::of_val()`], except that it can be used with raw
+    /// pointers in situations where it would be unsound or undesirable to convert them to
+    /// [`&` references][primitive@reference] and impose the aliasing rules that come with that.
     ///
     /// [ABI]: https://en.wikipedia.org/wiki/Application_binary_interface
     ///
@@ -117,6 +144,11 @@ pub const fn of_val<T: MetaSized>(val: &T) -> Self {
     ///
     /// assert_eq!(unsafe { Alignment::of_val_raw(&5i32) }.as_usize(), 4);
     /// ```
+    ///
+    /// (Caution: [it is not guaranteed][type-layout] that the alignment of `i32` is `4`;
+    /// that is, the above assertion does not pass on all platforms.)
+    ///
+    /// [type-layout]: ../../reference/type-layout.html#r-layout.primitive
     #[inline]
     #[must_use]
     #[unstable(feature = "ptr_alignment_type", issue = "102070")]
diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs
index 7e2c6b9..9889f32 100644
--- a/library/core/src/mem/maybe_uninit.rs
+++ b/library/core/src/mem/maybe_uninit.rs
@@ -437,7 +437,8 @@ pub const fn uninit() -> MaybeUninit<T> {
     /// be null.
     ///
     /// Note that if `T` has padding bytes, those bytes are *not* preserved when the
-    /// `MaybeUninit<T>` value is returned from this function, so those bytes will *not* be zeroed.
+    /// `MaybeUninit<T>` value is returned from this function, so those bytes are not
+    /// guaranteed to be zeroed.
     ///
     /// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
     /// It is your responsibility to make sure `T` gets dropped if it got initialized.
diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs
index 62c612e..565c23e 100644
--- a/library/core/src/mem/mod.rs
+++ b/library/core/src/mem/mod.rs
@@ -371,6 +371,13 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
 #[rustc_const_stable(feature = "const_mem_size_of", since = "1.24.0")]
 #[rustc_diagnostic_item = "mem_size_of"]
 pub const fn size_of<T>() -> usize {
+    // By making this a constant, we also guarantee that the constant can be successfully evaluated
+    // in any program execution that actually executes `size_of`. Which is relevant because the
+    // constant can fail to evaluate if the type is too big. Someone might do something cursed where
+    // soundness relies on a certain type not being too big, and they check that by just invoking
+    // size_of on the type to ensure it exists, so if we fully DCE'd size_of calls that would be
+    // considered unsound... but by making this a constant, it participates in the usual "required
+    // consts" system, and we are safe.
     <T as SizedTypeProperties>::SIZE
 }
 
@@ -506,7 +513,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
     unsafe { intrinsics::align_of_val(val) }
 }
 
-/// Returns the [ABI]-required minimum alignment of a type in bytes.
+/// Returns the [ABI]-required minimum alignment of a type, in bytes.
 ///
 /// Every reference to a value of the type `T` must be a multiple of this number.
 ///
@@ -519,6 +526,11 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
 /// ```
 /// assert_eq!(4, align_of::<i32>());
 /// ```
+///
+/// (Caution: [it is not guaranteed][type-layout] that the alignment of `i32` is `4`;
+/// that is, the above assertion does not pass on all platforms.)
+///
+/// [type-layout]: ../../reference/type-layout.html#r-layout.primitive
 #[inline(always)]
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -529,10 +541,12 @@ pub const fn align_of<T>() -> usize {
     <T as SizedTypeProperties>::ALIGN
 }
 
-/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
+/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to, in
 /// bytes.
 ///
-/// Every reference to a value of the type `T` must be a multiple of this number.
+/// This function is identical to [`align_of::<T>()`][align_of] whenever <code>T: [Sized]</code>,
+/// but also supports determining the alignment required by a `dyn Trait` value, which is the
+/// alignment of the underlying concrete type.
 ///
 /// [ABI]: https://en.wikipedia.org/wiki/Application_binary_interface
 ///
@@ -541,6 +555,22 @@ pub const fn align_of<T>() -> usize {
 /// ```
 /// assert_eq!(4, align_of_val(&5i32));
 /// ```
+///
+/// (Caution: [it is not guaranteed][type-layout] that the alignment of `i32` is `4`;
+/// that is, this example assertion does not pass on all platforms.)
+///
+/// `dyn` types may have different alignments for different values;
+/// `align_of_val` can be used to learn those alignments:
+///
+/// ```
+/// let a: &dyn ToString = &1234u16;
+/// let b: &dyn ToString = &String::from("abcd");
+///
+/// assert_eq!(align_of_val(a), align_of::<u16>());
+/// assert_eq!(align_of_val(b), align_of::<String>());
+/// ```
+///
+/// [type-layout]: ../../reference/type-layout.html#r-layout.primitive
 #[inline]
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -550,10 +580,12 @@ pub const fn align_of_val<T: ?Sized>(val: &T) -> usize {
     unsafe { intrinsics::align_of_val(val) }
 }
 
-/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
+/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to, in
 /// bytes.
 ///
-/// Every reference to a value of the type `T` must be a multiple of this number.
+/// This function is identical to [`align_of_val()`], except that it can be used with raw pointers
+/// in situations where it would be unsound or undesirable to convert them to
+/// [`&` references][primitive@reference] and impose the aliasing rules that come with that.
 ///
 /// [ABI]: https://en.wikipedia.org/wiki/Application_binary_interface
 ///
@@ -589,6 +621,11 @@ pub const fn align_of_val<T: ?Sized>(val: &T) -> usize {
 ///
 /// assert_eq!(4, unsafe { mem::align_of_val_raw(&5i32) });
 /// ```
+///
+/// (Caution: [it is not guaranteed][type-layout] that the alignment of `i32` is `4`;
+/// that is, the above assertion does not pass on all platforms.)
+///
+/// [type-layout]: ../../reference/type-layout.html#r-layout.primitive
 #[inline]
 #[must_use]
 #[unstable(feature = "layout_for_ptr", issue = "69835")]
diff --git a/library/core/src/num/imp/overflow_panic.rs b/library/core/src/num/imp/overflow_panic.rs
index 2b699fa..f62d09e 100644
--- a/library/core/src/num/imp/overflow_panic.rs
+++ b/library/core/src/num/imp/overflow_panic.rs
@@ -52,6 +52,12 @@ pub(in crate::num) const fn shl() -> ! {
 
 #[cold]
 #[track_caller]
-pub(in crate::num) const fn cast_integer() -> ! {
+pub(in crate::num) const fn pow() -> ! {
+    panic!("attempt to exponentiate with overflow")
+}
+
+#[cold]
+#[track_caller]
+pub(crate) const fn cast_integer() -> ! {
     panic!("attempt to cast integer with overflow")
 }
diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs
index 01b8465..34f1618 100644
--- a/library/core/src/num/int_macros.rs
+++ b/library/core/src/num/int_macros.rs
@@ -210,6 +210,9 @@ pub const fn isolate_lowest_one(self) -> Self {
         /// Returns the index of the highest bit set to one in `self`, or `None`
         /// if `self` is `0`.
         ///
+        /// Note that for non-negative numbers, this is equivalent to
+        /// [`checked_ilog2`](Self::checked_ilog2).
+        ///
         /// # Examples
         ///
         /// ```
@@ -1829,11 +1832,38 @@ pub const fn strict_abs(self) -> Self {
                       without modifying the original"]
         #[inline]
         pub const fn checked_pow(self, mut exp: u32) -> Option<Self> {
+            let mut base = self;
+            let mut acc: Self = 1;
+
+            if intrinsics::is_val_statically_known(base) && base.unsigned_abs().is_power_of_two() {
+                let k = base.unsigned_abs().ilog2();
+                let shift = try_opt!(k.checked_mul(exp));
+                return if base < 0 && (exp % 2) == 1 {
+                    (-1 as Self).shl_exact(shift)
+                } else {
+                    (1 as Self).shl_exact(shift)
+                }
+            }
+
             if exp == 0 {
                 return Some(1);
             }
-            let mut base = self;
-            let mut acc: Self = 1;
+
+            if intrinsics::is_val_statically_known(exp) {
+                while exp > 1 {
+                    if (exp & 1) == 1 {
+                        acc = try_opt!(acc.checked_mul(base));
+                    }
+                    exp /= 2;
+                    base = try_opt!(base.checked_mul(base));
+                }
+
+                // since exp!=0, finally the exp must be 1.
+                // Deal with the final bit of the exponent separately, since
+                // squaring the base afterwards is not necessary and may cause a
+                // needless overflow.
+                return acc.checked_mul(base);
+            }
 
             loop {
                 if (exp & 1) == 1 {
@@ -1875,23 +1905,10 @@ pub const fn checked_pow(self, mut exp: u32) -> Option<Self> {
                       without modifying the original"]
         #[inline]
         #[track_caller]
-        pub const fn strict_pow(self, mut exp: u32) -> Self {
-            if exp == 0 {
-                return 1;
-            }
-            let mut base = self;
-            let mut acc: Self = 1;
-
-            loop {
-                if (exp & 1) == 1 {
-                    acc = acc.strict_mul(base);
-                    // since exp!=0, finally the exp must be 1.
-                    if exp == 1 {
-                        return acc;
-                    }
-                }
-                exp /= 2;
-                base = base.strict_mul(base);
+        pub const fn strict_pow(self, exp: u32) -> Self {
+            match self.checked_pow(exp) {
+                Some(x) => x,
+                None => imp::overflow_panic::pow(),
             }
         }
 
@@ -2503,43 +2520,9 @@ pub const fn unsigned_abs(self) -> $UnsignedT {
         #[must_use = "this returns the result of the operation, \
                       without modifying the original"]
         #[inline]
-        pub const fn wrapping_pow(self, mut exp: u32) -> Self {
-            if exp == 0 {
-                return 1;
-            }
-            let mut base = self;
-            let mut acc: Self = 1;
-
-            if intrinsics::is_val_statically_known(exp) {
-                while exp > 1 {
-                    if (exp & 1) == 1 {
-                        acc = acc.wrapping_mul(base);
-                    }
-                    exp /= 2;
-                    base = base.wrapping_mul(base);
-                }
-
-                // since exp!=0, finally the exp must be 1.
-                // Deal with the final bit of the exponent separately, since
-                // squaring the base afterwards is not necessary.
-                acc.wrapping_mul(base)
-            } else {
-                // This is faster than the above when the exponent is not known
-                // at compile time. We can't use the same code for the constant
-                // exponent case because LLVM is currently unable to unroll
-                // this loop.
-                loop {
-                    if (exp & 1) == 1 {
-                        acc = acc.wrapping_mul(base);
-                        // since exp!=0, finally the exp must be 1.
-                        if exp == 1 {
-                            return acc;
-                        }
-                    }
-                    exp /= 2;
-                    base = base.wrapping_mul(base);
-                }
-            }
+        pub const fn wrapping_pow(self, exp: u32) -> Self {
+            let (a, _) = self.overflowing_pow(exp);
+            a
         }
 
         /// Calculates `self` + `rhs`.
@@ -3075,30 +3058,56 @@ pub const fn overflowing_abs(self) -> (Self, bool) {
                       without modifying the original"]
         #[inline]
         pub const fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
-            if exp == 0 {
-                return (1,false);
-            }
             let mut base = self;
             let mut acc: Self = 1;
-            let mut overflown = false;
-            // Scratch space for storing results of overflowing_mul.
-            let mut r;
+            let mut overflow = false;
+            let mut tmp_overflow;
+
+            if intrinsics::is_val_statically_known(base) && base.unsigned_abs().is_power_of_two() {
+                let k = base.unsigned_abs().ilog2();
+                let Some(shift) = k.checked_mul(exp) else {
+                    return (0, true)
+                };
+                let base: Self = if base < 0 && (exp % 2) != 0 { -1 } else { 1 };
+                return (base.unbounded_shl(shift), base.shl_exact(shift).is_none());
+            }
+
+            if exp == 0 {
+                return (1, false);
+            }
+
+            if intrinsics::is_val_statically_known(exp) {
+                while exp > 1 {
+                    if (exp & 1) == 1 {
+                        (acc, tmp_overflow) = acc.overflowing_mul(base);
+                        overflow |= tmp_overflow;
+                    }
+                    exp /= 2;
+                    (base, tmp_overflow) = base.overflowing_mul(base);
+                    overflow |= tmp_overflow;
+                }
+
+                // since exp!=0, finally the exp must be 1.
+                // Deal with the final bit of the exponent separately, since
+                // squaring the base afterwards is not necessary and may cause a
+                // needless overflow.
+                (acc, tmp_overflow) = acc.overflowing_mul(base);
+                overflow |= tmp_overflow;
+                return (acc, overflow);
+            }
 
             loop {
                 if (exp & 1) == 1 {
-                    r = acc.overflowing_mul(base);
+                    (acc, tmp_overflow) = acc.overflowing_mul(base);
+                    overflow |= tmp_overflow;
                     // since exp!=0, finally the exp must be 1.
                     if exp == 1 {
-                        r.1 |= overflown;
-                        return r;
+                        return (acc, overflow);
                     }
-                    acc = r.0;
-                    overflown |= r.1;
                 }
                 exp /= 2;
-                r = base.overflowing_mul(base);
-                base = r.0;
-                overflown |= r.1;
+                (base, tmp_overflow) = base.overflowing_mul(base);
+                overflow |= tmp_overflow;
             }
         }
 
@@ -3118,43 +3127,11 @@ pub const fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
                       without modifying the original"]
         #[inline]
         #[rustc_inherit_overflow_checks]
-        pub const fn pow(self, mut exp: u32) -> Self {
-            if exp == 0 {
-                return 1;
-            }
-            let mut base = self;
-            let mut acc = 1;
-
-            if intrinsics::is_val_statically_known(exp) {
-                while exp > 1 {
-                    if (exp & 1) == 1 {
-                        acc = acc * base;
-                    }
-                    exp /= 2;
-                    base = base * base;
-                }
-
-                // since exp!=0, finally the exp must be 1.
-                // Deal with the final bit of the exponent separately, since
-                // squaring the base afterwards is not necessary and may cause a
-                // needless overflow.
-                acc * base
+        pub const fn pow(self, exp: u32) -> Self {
+            if intrinsics::overflow_checks() {
+                self.strict_pow(exp)
             } else {
-                // This is faster than the above when the exponent is not known
-                // at compile time. We can't use the same code for the constant
-                // exponent case because LLVM is currently unable to unroll
-                // this loop.
-                loop {
-                    if (exp & 1) == 1 {
-                        acc = acc * base;
-                        // since exp!=0, finally the exp must be 1.
-                        if exp == 1 {
-                            return acc;
-                        }
-                    }
-                    exp /= 2;
-                    base = base * base;
-                }
+                self.wrapping_pow(exp)
             }
         }
 
@@ -3575,6 +3552,9 @@ pub const fn checked_ilog(self, base: Self) -> Option<u32> {
         ///
         /// Returns `None` if the number is negative or zero.
         ///
+        /// Note that for non-negative numbers, this is equivalent to
+        /// [`highest_one`](Self::highest_one).
+        ///
         /// # Examples
         ///
         /// ```
@@ -4068,5 +4048,123 @@ pub const fn widen<Target>(self) -> Target
         {
             traits::WidenTarget::internal_widen(self)
         }
+
+
+        /// Converts `self` to the target integer type, saturating at the numeric
+        /// bounds instead of overflowing.
+        ///
+        /// # Examples
+        ///
+        /// ```
+        /// #![feature(integer_casts)]
+        #[doc = concat!("assert_eq!(i8::MAX, ", stringify!($SelfT), "::MAX.saturating_cast());")]
+        #[doc = concat!("assert_eq!(i8::MIN, ", stringify!($SelfT), "::MIN.saturating_cast());")]
+        #[doc = concat!("assert_eq!(42u8, 42", stringify!($SelfT), ".saturating_cast());")]
+        #[doc = concat!("assert_eq!(0u8, (-42", stringify!($SelfT), ").saturating_cast());")]
+        /// ```
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        pub const fn saturating_cast<T: [const] BoundedCastFromInt<Self>>(self) -> T {
+            T::saturating_cast_from(self)
+        }
+
+        /// Converts `self` to the target integer type, wrapping around at the
+        /// boundary of the target type.
+        ///
+        /// # Examples
+        ///
+        /// ```
+        /// #![feature(integer_casts)]
+        #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX as i8, ", stringify!($SelfT), "::MAX.wrapping_cast());")]
+        #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN as i8, ", stringify!($SelfT), "::MIN.wrapping_cast());")]
+        #[doc = concat!("assert_eq!(42u8, 42", stringify!($SelfT), ".wrapping_cast());")]
+        #[doc = concat!("assert_eq!(u8::MAX - 41, (-42", stringify!($SelfT), ").wrapping_cast());")]
+        /// ```
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        pub const fn wrapping_cast<T: [const] BoundedCastFromInt<Self>>(self) -> T {
+            T::wrapping_cast_from(self)
+        }
+
+        /// Converts `self` to the target integer type, returning `None` if the value
+        /// is not representable by the target type.
+        ///
+        /// # Examples
+        ///
+        /// ```
+        /// #![feature(integer_casts)]
+        #[doc = concat!("assert_eq!(Some(42u8), 42", stringify!($SelfT), ".checked_cast());")]
+        #[doc = concat!("assert_eq!((-42", stringify!($SelfT), ").checked_cast::<u8>(), None);")]
+        /// ```
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        pub const fn checked_cast<T: [const] CheckedCastFromInt<Self>>(self) -> Option<T> {
+            T::checked_cast_from(self)
+        }
+
+        /// Converts `self` to the target integer type, panicking if the value
+        /// is not representable by the target type.
+        ///
+        /// # Panics
+        ///
+        /// This function will panic if the value is not representable by the target type.
+        ///
+        /// # Examples
+        ///
+        /// ```
+        /// #![feature(integer_casts)]
+        #[doc = concat!("assert_eq!(42u8, 42", stringify!($SelfT), ".strict_cast());")]
+        /// ```
+        ///
+        /// The following will panic:
+        ///
+        /// ```should_panic
+        /// #![feature(integer_casts)]
+        #[doc = concat!("let _ = (-42", stringify!($SelfT), ").strict_cast::<u8>();")]
+        /// ```
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        #[track_caller]
+        pub const fn strict_cast<T: [const] CheckedCastFromInt<Self>>(self) -> T {
+            T::strict_cast_from(self)
+        }
+
+        /// Converts `self` to the target integer type, assuming the value is
+        /// representable by the target type.
+        ///
+        /// # Safety
+        ///
+        /// This results in undefined behavior if the integer value of `self` is bigger than `T::MAX`,
+        /// or smaller than `T::MIN`, where `T` is the target type.
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        pub const unsafe fn unchecked_cast<T: [const] CheckedCastFromInt<Self>>(self) -> T {
+            assert_unsafe_precondition!(
+                check_language_ub,
+                concat!(stringify!($SelfT), "::unchecked_cast must fit in the target type"),
+                (
+                    // Check has to be performed up-front because it depends on generic T.
+                    in_bounds: bool = {
+                        let cast_val = self.checked_cast::<T>();
+                        let ret = cast_val.is_some();
+                        core::mem::forget(cast_val); // We don't have const Drop, but we know it's an int.
+                        ret
+                    },
+                ) => in_bounds,
+            );
+
+            // SAFETY: this is guaranteed to be safe by the caller.
+            unsafe { T::unchecked_cast_from(self) }
+        }
     }
 }
diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs
index ed91c1e..59c2b11 100644
--- a/library/core/src/num/mod.rs
+++ b/library/core/src/num/mod.rs
@@ -2,6 +2,7 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
+use crate::convert::{BoundedCastFromInt, CheckedCastFromInt};
 use crate::panic::const_panic;
 use crate::str::FromStr;
 use crate::ub_checks::assert_unsafe_precondition;
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs
index fdff6ce..7362bb7 100644
--- a/library/core/src/num/nonzero.rs
+++ b/library/core/src/num/nonzero.rs
@@ -692,6 +692,16 @@ pub const fn isolate_lowest_one(self) -> Self {
 
             /// Returns the index of the highest bit set to one in `self`.
             ///
+            #[doc = sign_dependent_expr!{
+                $signedness ?
+                if signed {
+                    ""
+                }
+                if unsigned {
+                    "Note that this is equivalent to [`ilog2`](Self::ilog2)."
+                }
+            }]
+            ///
             /// # Examples
             ///
             /// ```
@@ -1758,6 +1768,8 @@ pub const fn checked_next_power_of_two(self) -> Option<Self> {
         /// except that it has no failure cases to worry about
         /// since this value can never be zero.
         ///
+        /// Note that this is equivalent to [`highest_one`](Self::highest_one).
+        ///
         /// # Examples
         ///
         /// ```
diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs
index 3170143..4053134 100644
--- a/library/core/src/num/uint_macros.rs
+++ b/library/core/src/num/uint_macros.rs
@@ -289,6 +289,8 @@ pub const fn isolate_lowest_one(self) -> Self {
         /// Returns the index of the highest bit set to one in `self`, or `None`
         /// if `self` is `0`.
         ///
+        /// Note that this is equivalent to [`checked_ilog2`](Self::checked_ilog2).
+        ///
         /// # Examples
         ///
         /// ```
@@ -1809,6 +1811,10 @@ pub const fn ilog10(self) -> u32 {
         ///
         /// ```
         #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_ilog(5), Some(1));")]
+        #[doc = concat!("assert_eq!(4", stringify!($SelfT), ".checked_ilog(5), Some(0));")]
+        #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_ilog(0), None);")]
+        #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_ilog(1), None);")]
+        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".checked_ilog(1), None);")]
         /// ```
         #[stable(feature = "int_log", since = "1.67.0")]
         #[rustc_const_stable(feature = "int_log", since = "1.67.0")]
@@ -1823,9 +1829,14 @@ pub const fn checked_ilog(self, base: Self) -> Option<u32> {
             // applied by the compiler. If you want those specific bases,
             // use `.checked_ilog2()` or `.checked_ilog10()` directly.
             if core::intrinsics::is_val_statically_known(base) {
-                if base == 2 {
-                    return self.checked_ilog2();
-                } else if base == 10 {
+                // change of base:
+                // if base == 2 ** k, then
+                // log(base, n) == log(2, n) / k
+                if base.is_power_of_two() && base > 1 {
+                    let k = base.ilog2();
+                    return Some(try_opt!(self.checked_ilog2()) / k);
+                }
+                if base == 10 {
                     return self.checked_ilog10();
                 }
             }
@@ -1865,6 +1876,8 @@ pub const fn checked_ilog(self, base: Self) -> Option<u32> {
         ///
         /// Returns `None` if the number is zero.
         ///
+        /// Note that this is equivalent to [`highest_one`](Self::highest_one).
+        ///
         /// # Examples
         ///
         /// ```
@@ -2344,11 +2357,39 @@ pub const fn shr_exact(self, rhs: u32) -> Option<$SelfT> {
                       without modifying the original"]
         #[inline]
         pub const fn checked_pow(self, mut exp: u32) -> Option<Self> {
+            let mut base = self;
+            let mut acc: Self = 1;
+
+            if intrinsics::is_val_statically_known(base) && base.is_power_of_two() {
+                // change of base:
+                // if base == 2 ** k, then
+                //    (2 ** k) ** n
+                // == 2 ** (k * n)
+                // == 1 << (k * n)
+                let k = base.ilog2();
+                let shift = try_opt!(k.checked_mul(exp));
+                return (1 as Self).checked_shl(shift);
+            }
+
             if exp == 0 {
                 return Some(1);
             }
-            let mut base = self;
-            let mut acc: Self = 1;
+
+            if intrinsics::is_val_statically_known(exp) {
+                while exp > 1 {
+                    if (exp & 1) == 1 {
+                        acc = try_opt!(acc.checked_mul(base));
+                    }
+                    exp /= 2;
+                    base = try_opt!(base.checked_mul(base));
+                }
+
+                // since exp!=0, finally the exp must be 1.
+                // Deal with the final bit of the exponent separately, since
+                // squaring the base afterwards is not necessary and may cause a
+                // needless overflow.
+                return acc.checked_mul(base);
+            }
 
             loop {
                 if (exp & 1) == 1 {
@@ -2390,23 +2431,10 @@ pub const fn checked_pow(self, mut exp: u32) -> Option<Self> {
                       without modifying the original"]
         #[inline]
         #[track_caller]
-        pub const fn strict_pow(self, mut exp: u32) -> Self {
-            if exp == 0 {
-                return 1;
-            }
-            let mut base = self;
-            let mut acc: Self = 1;
-
-            loop {
-                if (exp & 1) == 1 {
-                    acc = acc.strict_mul(base);
-                    // since exp!=0, finally the exp must be 1.
-                    if exp == 1 {
-                        return acc;
-                    }
-                }
-                exp /= 2;
-                base = base.strict_mul(base);
+        pub const fn strict_pow(self, exp: u32) -> Self {
+            match self.checked_pow(exp) {
+                None => imp::overflow_panic::pow(),
+                Some(a) => a,
             }
         }
 
@@ -2896,43 +2924,9 @@ pub const fn wrapping_shr(self, rhs: u32) -> Self {
         #[must_use = "this returns the result of the operation, \
                       without modifying the original"]
         #[inline]
-        pub const fn wrapping_pow(self, mut exp: u32) -> Self {
-            if exp == 0 {
-                return 1;
-            }
-            let mut base = self;
-            let mut acc: Self = 1;
-
-            if intrinsics::is_val_statically_known(exp) {
-                while exp > 1 {
-                    if (exp & 1) == 1 {
-                        acc = acc.wrapping_mul(base);
-                    }
-                    exp /= 2;
-                    base = base.wrapping_mul(base);
-                }
-
-                // since exp!=0, finally the exp must be 1.
-                // Deal with the final bit of the exponent separately, since
-                // squaring the base afterwards is not necessary.
-                acc.wrapping_mul(base)
-            } else {
-                // This is faster than the above when the exponent is not known
-                // at compile time. We can't use the same code for the constant
-                // exponent case because LLVM is currently unable to unroll
-                // this loop.
-                loop {
-                    if (exp & 1) == 1 {
-                        acc = acc.wrapping_mul(base);
-                        // since exp!=0, finally the exp must be 1.
-                        if exp == 1 {
-                            return acc;
-                        }
-                    }
-                    exp /= 2;
-                    base = base.wrapping_mul(base);
-                }
-            }
+        pub const fn wrapping_pow(self, exp: u32) -> Self {
+            let (a, _) = self.overflowing_pow(exp);
+            a
         }
 
         /// Calculates `self` + `rhs`.
@@ -3526,30 +3520,60 @@ pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
                       without modifying the original"]
         #[inline]
         pub const fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
-            if exp == 0{
-                return (1,false);
-            }
             let mut base = self;
             let mut acc: Self = 1;
-            let mut overflown = false;
-            // Scratch space for storing results of overflowing_mul.
-            let mut r;
+            let mut overflow = false;
+            let mut tmp_overflow;
+
+            if intrinsics::is_val_statically_known(base) && base.is_power_of_two() {
+                // change of base:
+                // if base == 2 ** k, then
+                //    (2 ** k) ** n
+                // == 2 ** (k * n)
+                // == 1 << (k * n)
+                let k = base.ilog2();
+                let Some(shift) = k.checked_mul(exp) else {
+                    return (0, true)
+                };
+                return ((1 as Self).unbounded_shl(shift), shift >= Self::BITS)
+            }
+
+            if exp == 0 {
+                return (1, false);
+            }
+
+            if intrinsics::is_val_statically_known(exp) {
+                while exp > 1 {
+                    if (exp & 1) == 1 {
+                        (acc, tmp_overflow) = acc.overflowing_mul(base);
+                        overflow |= tmp_overflow;
+                    }
+                    exp /= 2;
+                    (base, tmp_overflow) = base.overflowing_mul(base);
+                    overflow |= tmp_overflow;
+                }
+
+                // since exp!=0, finally the exp must be 1.
+                // Deal with the final bit of the exponent separately, since
+                // squaring the base afterwards is not necessary and may cause a
+                // needless overflow.
+                (acc, tmp_overflow) = acc.overflowing_mul(base);
+                overflow |= tmp_overflow;
+                return (acc, overflow);
+            }
 
             loop {
                 if (exp & 1) == 1 {
-                    r = acc.overflowing_mul(base);
+                    (acc, tmp_overflow) = acc.overflowing_mul(base);
+                    overflow |= tmp_overflow;
                     // since exp!=0, finally the exp must be 1.
                     if exp == 1 {
-                        r.1 |= overflown;
-                        return r;
+                        return (acc, overflow);
                     }
-                    acc = r.0;
-                    overflown |= r.1;
                 }
                 exp /= 2;
-                r = base.overflowing_mul(base);
-                base = r.0;
-                overflown |= r.1;
+                (base, tmp_overflow) = base.overflowing_mul(base);
+                overflow |= tmp_overflow;
             }
         }
 
@@ -3567,43 +3591,11 @@ pub const fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
                       without modifying the original"]
         #[inline]
         #[rustc_inherit_overflow_checks]
-        pub const fn pow(self, mut exp: u32) -> Self {
-            if exp == 0 {
-                return 1;
-            }
-            let mut base = self;
-            let mut acc = 1;
-
-            if intrinsics::is_val_statically_known(exp) {
-                while exp > 1 {
-                    if (exp & 1) == 1 {
-                        acc = acc * base;
-                    }
-                    exp /= 2;
-                    base = base * base;
-                }
-
-                // since exp!=0, finally the exp must be 1.
-                // Deal with the final bit of the exponent separately, since
-                // squaring the base afterwards is not necessary and may cause a
-                // needless overflow.
-                acc * base
+        pub const fn pow(self, exp: u32) -> Self {
+            if intrinsics::overflow_checks() {
+                self.strict_pow(exp)
             } else {
-                // This is faster than the above when the exponent is not known
-                // at compile time. We can't use the same code for the constant
-                // exponent case because LLVM is currently unable to unroll
-                // this loop.
-                loop {
-                    if (exp & 1) == 1 {
-                        acc = acc * base;
-                        // since exp!=0, finally the exp must be 1.
-                        if exp == 1 {
-                            return acc;
-                        }
-                    }
-                    exp /= 2;
-                    base = base * base;
-                }
+                self.wrapping_pow(exp)
             }
         }
 
@@ -4229,5 +4221,120 @@ pub const fn widen<Target>(self) -> Target
         {
             traits::WidenTarget::internal_widen(self)
         }
+
+        /// Converts `self` to the target integer type, saturating at the numeric
+        /// bounds instead of overflowing.
+        ///
+        /// # Examples
+        ///
+        /// ```
+        /// #![feature(integer_casts)]
+        #[doc = concat!("assert_eq!(255u8, ", stringify!($SelfT), "::MAX.saturating_cast());")]
+        #[doc = concat!("assert_eq!(127i8, ", stringify!($SelfT), "::MAX.saturating_cast());")]
+        #[doc = concat!("assert_eq!(42i8, 42", stringify!($SelfT), ".saturating_cast());")]
+        /// ```
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        pub const fn saturating_cast<T: [const] BoundedCastFromInt<Self>>(self) -> T {
+            T::saturating_cast_from(self)
+        }
+
+        /// Converts `self` to the target integer type, wrapping around at the
+        /// boundary of the target type.
+        ///
+        /// # Examples
+        ///
+        /// ```
+        /// #![feature(integer_casts)]
+        #[doc = concat!("assert_eq!(255u8, ", stringify!($SelfT), "::MAX.wrapping_cast());")]
+        #[doc = concat!("assert_eq!(42i8, 42", stringify!($SelfT), ".wrapping_cast());")]
+        #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX as i8, ", stringify!($SelfT), "::MAX.wrapping_cast());")]
+        /// ```
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        pub const fn wrapping_cast<T: [const] BoundedCastFromInt<Self>>(self) -> T {
+            T::wrapping_cast_from(self)
+        }
+
+        /// Converts `self` to the target integer type, returning `None` if the value
+        /// is not representable by the target type.
+        ///
+        /// # Examples
+        ///
+        /// ```
+        /// #![feature(integer_casts)]
+        #[doc = concat!("assert_eq!(Some(42u8), 42", stringify!($SelfT), ".checked_cast());")]
+        #[doc = concat!("assert_eq!(128", stringify!($SelfT), ".checked_cast::<i8>(), None);")]
+        /// ```
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        pub const fn checked_cast<T: [const] CheckedCastFromInt<Self>>(self) -> Option<T> {
+            T::checked_cast_from(self)
+        }
+
+        /// Converts `self` to the target integer type, panicking if the value
+        /// is not representable by the target type.
+        ///
+        /// # Panics
+        ///
+        /// This function will panic if the value is not representable by the target type.
+        ///
+        /// # Examples
+        ///
+        /// ```
+        /// #![feature(integer_casts)]
+        #[doc = concat!("assert_eq!(42u8, 42", stringify!($SelfT), ".strict_cast());")]
+        /// ```
+        ///
+        /// The following will panic:
+        ///
+        /// ```should_panic
+        /// #![feature(integer_casts)]
+        #[doc = concat!("let _ = 128", stringify!($SelfT), ".strict_cast::<i8>();")]
+        /// ```
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        #[track_caller]
+        pub const fn strict_cast<T: [const] CheckedCastFromInt<Self>>(self) -> T {
+            T::strict_cast_from(self)
+        }
+
+        /// Converts `self` to the target integer type, assuming the value is
+        /// representable by the target type.
+        ///
+        /// # Safety
+        ///
+        /// This results in undefined behavior if the integer value of `self` is bigger than `T::MAX`,
+        /// or smaller than `T::MIN`, where `T` is the target type.
+        #[must_use = "this returns the cast result and does not modify the original"]
+        #[unstable(feature = "integer_casts", issue = "157388")]
+        #[rustc_const_unstable(feature = "integer_casts", issue = "157388")]
+        #[inline(always)]
+        pub const unsafe fn unchecked_cast<T: [const] CheckedCastFromInt<Self>>(self) -> T {
+            assert_unsafe_precondition!(
+                check_language_ub,
+                concat!(stringify!($SelfT), "::unchecked_cast must fit in the target type"),
+                (
+                    // Check has to be performed up-front because it depends on generic T.
+                    in_bounds: bool = {
+                        let cast_val = self.checked_cast::<T>();
+                        let ret = cast_val.is_some();
+                        core::mem::forget(cast_val); // We don't have const Drop, but we know it's an int.
+                        ret
+                    },
+                ) => in_bounds,
+            );
+
+            // SAFETY: this is guaranteed to be safe by the caller.
+            unsafe { T::unchecked_cast_from(self) }
+        }
     }
 }
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index a490a26..c11b235 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -1283,8 +1283,6 @@ pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
     /// # Examples
     ///
     /// ```
-    /// #![feature(result_option_map_or_default)]
-    ///
     /// let x: Option<&str> = Some("hi");
     /// let y: Option<&str> = None;
     ///
@@ -1294,7 +1292,7 @@ pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
     ///
     /// [default value]: Default::default
     #[inline]
-    #[unstable(feature = "result_option_map_or_default", issue = "138099")]
+    #[stable(feature = "result_option_map_or_default", since = "CURRENT_RUSTC_VERSION")]
     #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")]
     pub const fn map_or_default<U, F>(self, f: F) -> U
     where
diff --git a/library/core/src/pin/unsafe_pinned.rs b/library/core/src/pin/unsafe_pinned.rs
index 483cf52..83d9e9a 100644
--- a/library/core/src/pin/unsafe_pinned.rs
+++ b/library/core/src/pin/unsafe_pinned.rs
@@ -178,5 +178,3 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<UnsafePinned<U>> for UnsafePinned<T>
 #[unstable(feature = "dispatch_from_dyn", issue = "none")]
 // #[unstable(feature = "unsafe_pinned", issue = "125735")]
 impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<UnsafePinned<U>> for UnsafePinned<T> {}
-
-// FIXME(unsafe_pinned): impl PinCoerceUnsized for UnsafePinned<T>?
diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs
index 0a7f9b9..b7fcd6a 100644
--- a/library/core/src/ptr/const_ptr.rs
+++ b/library/core/src/ptr/const_ptr.rs
@@ -331,6 +331,10 @@ pub const fn to_raw_parts(self) -> (*const (), <T as super::Pointee>::Metadata)
 
     #[doc = include_str!("./docs/offset.md")]
     ///
+    /// Consider using [`wrapping_offset`](#method.wrapping_offset) instead if these constraints are
+    /// difficult to satisfy. The only advantage of this method is that it
+    /// enables more aggressive compiler optimizations.
+    ///
     /// # Examples
     ///
     /// ```
@@ -811,6 +815,10 @@ pub const fn guaranteed_ne(self, other: *const T) -> Option<bool>
 
     #[doc = include_str!("./docs/add.md")]
     ///
+    /// Consider using [`wrapping_add`](#method.wrapping_add) instead if these constraints are
+    /// difficult to satisfy. The only advantage of this method is that it
+    /// enables more aggressive compiler optimizations.
+    ///
     /// # Examples
     ///
     /// ```
@@ -884,39 +892,12 @@ const fn runtime_add_nowrap(this: *const (), count: usize, size: usize) -> bool
         unsafe { self.cast::<u8>().add(count).with_metadata_of(self) }
     }
 
-    /// Subtracts an unsigned offset from a pointer.
+    #[doc = include_str!("./docs/sub.md")]
     ///
-    /// This can only move the pointer backward (or not move it). If you need to move forward or
-    /// backward depending on the value, then you might want [`offset`](#method.offset) instead
-    /// which takes a signed offset.
-    ///
-    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
-    /// offset of `3 * size_of::<T>()` bytes.
-    ///
-    /// # Safety
-    ///
-    /// If any of the following conditions are violated, the result is Undefined Behavior:
-    ///
-    /// * The offset in bytes, `count * size_of::<T>()`, computed on mathematical integers (without
-    ///   "wrapping around"), must fit in an `isize`.
-    ///
-    /// * If the computed offset is non-zero, then `self` must be [derived from][crate::ptr#provenance] a pointer to some
-    ///   [allocation], and the entire memory range between `self` and the result must be in
-    ///   bounds of that allocation. In particular, this range must not "wrap around" the edge
-    ///   of the address space.
-    ///
-    /// Allocations can never be larger than `isize::MAX` bytes, so if the computed offset
-    /// stays in bounds of the allocation, it is guaranteed to satisfy the first requirement.
-    /// This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
-    /// safe.
-    ///
-    /// Consider using [`wrapping_sub`] instead if these constraints are
+    /// Consider using [`wrapping_sub`](#method.wrapping_sub) instead if these constraints are
     /// difficult to satisfy. The only advantage of this method is that it
     /// enables more aggressive compiler optimizations.
     ///
-    /// [`wrapping_sub`]: #method.wrapping_sub
-    /// [allocation]: crate::ptr#allocation
-    ///
     /// # Examples
     ///
     /// ```
diff --git a/library/core/src/ptr/docs/add.md b/library/core/src/ptr/docs/add.md
index 6e2e87f..807ebee 100644
--- a/library/core/src/ptr/docs/add.md
+++ b/library/core/src/ptr/docs/add.md
@@ -14,19 +14,15 @@
 * The offset in bytes, `count * size_of::<T>()`, computed on mathematical integers (without
 "wrapping around"), must fit in an `isize`.
 
+* Let `result` be `self.addr() + count * size_of::<T>()`, computed on mathematical integers.
+This must fit in a `usize`.
+
 * If the computed offset is non-zero, then `self` must be [derived from][crate::ptr#provenance] a pointer to some
-[allocation], and the entire memory range between `self` and the result must be in
-bounds of that allocation. In particular, this range must not "wrap around" the edge
-of the address space.
+[allocation], and the entire memory range between `self` and `result`
+(i.e., `self.addr()..result`) must be in bounds of that allocation.
 
-Allocations can never be larger than `isize::MAX` bytes, so if the computed offset
-stays in bounds of the allocation, it is guaranteed to satisfy the first requirement.
-This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
-safe.
+Allocations can never be larger than `isize::MAX` bytes and they can only contain addresses
+representable by `usize`, so technically the last condition implies the first two. This implies, for
+instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always safe.
 
-Consider using [`wrapping_add`] instead if these constraints are
-difficult to satisfy. The only advantage of this method is that it
-enables more aggressive compiler optimizations.
-
-[`wrapping_add`]: #method.wrapping_add
 [allocation]: crate::ptr#allocation
diff --git a/library/core/src/ptr/docs/offset.md b/library/core/src/ptr/docs/offset.md
index f04f560..b1add36 100644
--- a/library/core/src/ptr/docs/offset.md
+++ b/library/core/src/ptr/docs/offset.md
@@ -10,20 +10,16 @@
 * The offset in bytes, `count * size_of::<T>()`, computed on mathematical integers (without
 "wrapping around"), must fit in an `isize`.
 
+* Let `result` be `self.addr() + count * size_of::<T>()`, computed on mathematical integers.
+This must fit in a `usize`.
+
 * If the computed offset is non-zero, then `self` must be [derived from][crate::ptr#provenance] a pointer to some
-[allocation], and the entire memory range between `self` and the result must be in
-bounds of that allocation. In particular, this range must not "wrap around" the edge
-of the address space. Note that "range" here refers to a half-open range as usual in Rust,
-i.e., `self..result` for non-negative offsets and `result..self` for negative offsets.
+[allocation], and the entire memory range between `self` and `result`
+(i.e., `min(self.addr(), result)..max(self.addr(), result)`)
+must be in bounds of that allocation.
 
-Allocations can never be larger than `isize::MAX` bytes, so if the computed offset
-stays in bounds of the allocation, it is guaranteed to satisfy the first requirement.
-This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
-safe.
+Allocations can never be larger than `isize::MAX` bytes and they can only contain addresses
+representable by `usize`, so technically the last condition implies the first two. This implies, for
+instance, that `vec.as_ptr().offset(vec.len() as isize)` (for `vec: Vec<T>`) is always safe.
 
-Consider using [`wrapping_offset`] instead if these constraints are
-difficult to satisfy. The only advantage of this method is that it
-enables more aggressive compiler optimizations.
-
-[`wrapping_offset`]: #method.wrapping_offset
 [allocation]: crate::ptr#allocation
diff --git a/library/core/src/ptr/docs/sub.md b/library/core/src/ptr/docs/sub.md
new file mode 100644
index 0000000..b8873b0
--- /dev/null
+++ b/library/core/src/ptr/docs/sub.md
@@ -0,0 +1,27 @@
+Subtracts an unsigned offset from a pointer.
+
+This can only move the pointer backward (or not move it). If you need to move forward or
+backward depending on the value, then you might want [`offset`](#method.offset) instead
+which takes a signed offset.
+
+`count` is in units of T; e.g., a `count` of 3 represents a pointer
+offset of `3 * size_of::<T>()` bytes.
+
+# Safety
+
+If any of the following conditions are violated, the result is Undefined Behavior:
+
+* The offset in bytes, `count * size_of::<T>()`, computed on mathematical integers (without
+  "wrapping around"), must fit in an `isize`.
+
+* Let `result` be `self.addr() - count * size_of::<T>()`, computed on mathematical integers.
+This must fit in a `usize`.
+
+* If the computed offset is non-zero, then `self` must be [derived from][crate::ptr#provenance] a pointer to some
+[allocation], and the entire memory range between `self` and `result`
+(i.e., `result..self.addr()`) must be in bounds of that allocation.
+
+Allocations can never be larger than `isize::MAX` bytes and they can only contain addresses
+representable by `usize`, so technically the last condition implies the first two.
+
+[allocation]: crate::ptr#allocation
diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs
index 4b68d96..fd8dafa 100644
--- a/library/core/src/ptr/mut_ptr.rs
+++ b/library/core/src/ptr/mut_ptr.rs
@@ -334,6 +334,10 @@ pub const fn to_raw_parts(self) -> (*mut (), <T as super::Pointee>::Metadata) {
 
     #[doc = include_str!("./docs/offset.md")]
     ///
+    /// Consider using [`wrapping_offset`](#method.wrapping_offset) instead if these constraints are
+    /// difficult to satisfy. The only advantage of this method is that it
+    /// enables more aggressive compiler optimizations.
+    ///
     /// # Examples
     ///
     /// ```
@@ -909,6 +913,10 @@ pub const fn guaranteed_ne(self, other: *mut T) -> Option<bool>
 
     #[doc = include_str!("./docs/add.md")]
     ///
+    /// Consider using [`wrapping_add`](#method.wrapping_add) instead if these constraints are
+    /// difficult to satisfy. The only advantage of this method is that it
+    /// enables more aggressive compiler optimizations.
+    ///
     /// # Examples
     ///
     /// ```
@@ -982,39 +990,12 @@ const fn runtime_add_nowrap(this: *const (), count: usize, size: usize) -> bool
         unsafe { self.cast::<u8>().add(count).with_metadata_of(self) }
     }
 
-    /// Subtracts an unsigned offset from a pointer.
+    #[doc = include_str!("./docs/sub.md")]
     ///
-    /// This can only move the pointer backward (or not move it). If you need to move forward or
-    /// backward depending on the value, then you might want [`offset`](#method.offset) instead
-    /// which takes a signed offset.
-    ///
-    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
-    /// offset of `3 * size_of::<T>()` bytes.
-    ///
-    /// # Safety
-    ///
-    /// If any of the following conditions are violated, the result is Undefined Behavior:
-    ///
-    /// * The offset in bytes, `count * size_of::<T>()`, computed on mathematical integers (without
-    ///   "wrapping around"), must fit in an `isize`.
-    ///
-    /// * If the computed offset is non-zero, then `self` must be [derived from][crate::ptr#provenance] a pointer to some
-    ///   [allocation], and the entire memory range between `self` and the result must be in
-    ///   bounds of that allocation. In particular, this range must not "wrap around" the edge
-    ///   of the address space.
-    ///
-    /// Allocations can never be larger than `isize::MAX` bytes, so if the computed offset
-    /// stays in bounds of the allocation, it is guaranteed to satisfy the first requirement.
-    /// This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
-    /// safe.
-    ///
-    /// Consider using [`wrapping_sub`] instead if these constraints are
+    /// Consider using [`wrapping_sub`](#method.wrapping_sub) instead if these constraints are
     /// difficult to satisfy. The only advantage of this method is that it
     /// enables more aggressive compiler optimizations.
     ///
-    /// [`wrapping_sub`]: #method.wrapping_sub
-    /// [allocation]: crate::ptr#allocation
-    ///
     /// # Examples
     ///
     /// ```
diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs
index 86e9d01..bafc374 100644
--- a/library/core/src/ptr/non_null.rs
+++ b/library/core/src/ptr/non_null.rs
@@ -528,28 +528,7 @@ pub fn try_cast_aligned<U>(self) -> Option<NonNull<U>> {
         if self.is_aligned_to(align_of::<U>()) { Some(self.cast()) } else { None }
     }
 
-    /// Adds an offset to a pointer.
-    ///
-    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
-    /// offset of `3 * size_of::<T>()` bytes.
-    ///
-    /// # Safety
-    ///
-    /// If any of the following conditions are violated, the result is Undefined Behavior:
-    ///
-    /// * The computed offset, `count * size_of::<T>()` bytes, must not overflow `isize`.
-    ///
-    /// * If the computed offset is non-zero, then `self` must be derived from a pointer to some
-    ///   [allocation], and the entire memory range between `self` and the result must be in
-    ///   bounds of that allocation. In particular, this range must not "wrap around" the edge
-    ///   of the address space.
-    ///
-    /// Allocations can never be larger than `isize::MAX` bytes, so if the computed offset
-    /// stays in bounds of the allocation, it is guaranteed to satisfy the first requirement.
-    /// This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
-    /// safe.
-    ///
-    /// [allocation]: crate::ptr#allocation
+    #[doc = include_str!("./docs/offset.md")]
     ///
     /// # Examples
     ///
@@ -604,28 +583,7 @@ pub fn try_cast_aligned<U>(self) -> Option<NonNull<U>> {
         unsafe { transmute(self.as_ptr().byte_offset(count)) }
     }
 
-    /// Adds an offset to a pointer (convenience for `.offset(count as isize)`).
-    ///
-    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
-    /// offset of `3 * size_of::<T>()` bytes.
-    ///
-    /// # Safety
-    ///
-    /// If any of the following conditions are violated, the result is Undefined Behavior:
-    ///
-    /// * The computed offset, `count * size_of::<T>()` bytes, must not overflow `isize`.
-    ///
-    /// * If the computed offset is non-zero, then `self` must be derived from a pointer to some
-    ///   [allocation], and the entire memory range between `self` and the result must be in
-    ///   bounds of that allocation. In particular, this range must not "wrap around" the edge
-    ///   of the address space.
-    ///
-    /// Allocations can never be larger than `isize::MAX` bytes, so if the computed offset
-    /// stays in bounds of the allocation, it is guaranteed to satisfy the first requirement.
-    /// This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
-    /// safe.
-    ///
-    /// [allocation]: crate::ptr#allocation
+    #[doc = include_str!("./docs/add.md")]
     ///
     /// # Examples
     ///
@@ -680,29 +638,7 @@ pub fn try_cast_aligned<U>(self) -> Option<NonNull<U>> {
         unsafe { transmute(self.as_ptr().byte_add(count)) }
     }
 
-    /// Subtracts an offset from a pointer (convenience for
-    /// `.offset((count as isize).wrapping_neg())`).
-    ///
-    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
-    /// offset of `3 * size_of::<T>()` bytes.
-    ///
-    /// # Safety
-    ///
-    /// If any of the following conditions are violated, the result is Undefined Behavior:
-    ///
-    /// * The computed offset, `count * size_of::<T>()` bytes, must not overflow `isize`.
-    ///
-    /// * If the computed offset is non-zero, then `self` must be derived from a pointer to some
-    ///   [allocation], and the entire memory range between `self` and the result must be in
-    ///   bounds of that allocation. In particular, this range must not "wrap around" the edge
-    ///   of the address space.
-    ///
-    /// Allocations can never be larger than `isize::MAX` bytes, so if the computed offset
-    /// stays in bounds of the allocation, it is guaranteed to satisfy the first requirement.
-    /// This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
-    /// safe.
-    ///
-    /// [allocation]: crate::ptr#allocation
+    #[doc = include_str!("./docs/sub.md")]
     ///
     /// # Examples
     ///
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index f0e1a1d..a1915fb 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -912,8 +912,6 @@ pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
     /// # Examples
     ///
     /// ```
-    /// #![feature(result_option_map_or_default)]
-    ///
     /// let x: Result<_, &str> = Ok("foo");
     /// let y: Result<&str, _> = Err("bar");
     ///
@@ -923,7 +921,7 @@ pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
     ///
     /// [default value]: Default::default
     #[inline]
-    #[unstable(feature = "result_option_map_or_default", issue = "138099")]
+    #[stable(feature = "result_option_map_or_default", since = "CURRENT_RUSTC_VERSION")]
     #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")]
     pub const fn map_or_default<U, F>(self, f: F) -> U
     where
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs
index fe8ed6c..74e7092 100644
--- a/library/core/src/str/mod.rs
+++ b/library/core/src/str/mod.rs
@@ -15,6 +15,7 @@
 
 use self::pattern::{DoubleEndedSearcher, Pattern, ReverseSearcher, Searcher};
 use crate::char::{self, EscapeDebugExtArgs};
+use crate::hint::assert_unchecked;
 use crate::range::Range;
 use crate::slice::{self, SliceIndex};
 use crate::ub_checks::assert_unsafe_precondition;
@@ -421,21 +422,35 @@ pub const fn is_char_boundary(&self, index: usize) -> bool {
     #[inline]
     pub const fn floor_char_boundary(&self, index: usize) -> usize {
         if index >= self.len() {
-            self.len()
-        } else {
-            let mut i = index;
-            while i > 0 {
-                if self.as_bytes()[i].is_utf8_char_boundary() {
-                    break;
-                }
-                i -= 1;
-            }
-
-            //  The character boundary will be within four bytes of the index
-            debug_assert!(i >= index.saturating_sub(3));
-
-            i
+            return self.len();
         }
+        if self.as_bytes()[index].is_utf8_char_boundary() {
+            return index;
+        }
+        // Unlike `ceil_char_boundary`, the loop is unrolled manually to prevent the compiler from
+        // generating excessive unrolled loop bodies when `index` is statically known.
+
+        // The first byte of `&str` must always be a char boundary, so we can assume `i > 0` below
+        // for any `i` where `self.as_bytes()[i]` is not a char boundary.
+        debug_assert!(self.as_bytes()[0].is_utf8_char_boundary());
+
+        // SAFETY: `self.as_bytes()[0]` is always a char boundary with valid `&str`
+        unsafe { assert_unchecked(index >= 1) };
+        if self.as_bytes()[index - 1].is_utf8_char_boundary() {
+            return index - 1;
+        }
+
+        // SAFETY: `self.as_bytes()[0]` is always a char boundary with valid `&str`
+        unsafe { assert_unchecked(index >= 2) };
+        if self.as_bytes()[index - 2].is_utf8_char_boundary() {
+            return index - 2;
+        }
+
+        // `self.as_bytes()[0]` is always a char boundary with valid `&str`
+        debug_assert!(index >= 3);
+        // The character boundary will be within four bytes of the index
+        debug_assert!(self.as_bytes()[index - 3].is_utf8_char_boundary());
+        index - 3
     }
 
     /// Finds the closest `x` not below `index` where [`is_char_boundary(x)`] is `true`.
@@ -467,14 +482,14 @@ pub const fn ceil_char_boundary(&self, index: usize) -> usize {
             self.len()
         } else {
             let mut i = index;
-            while i < self.len() {
-                if self.as_bytes()[i].is_utf8_char_boundary() {
+            while !self.as_bytes()[i].is_utf8_char_boundary() {
+                i += 1;
+                if i >= self.len() {
                     break;
                 }
-                i += 1;
             }
 
-            //  The character boundary will be within four bytes of the index
+            // The character boundary will be within four bytes of the index
             debug_assert!(i <= index + 3);
 
             i
@@ -2826,6 +2841,9 @@ pub const fn as_ascii(&self) -> Option<&[ascii::Char]> {
     /// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`,
     /// but without allocating and copying temporaries.
     ///
+    /// For Unicode-aware case-insensitive matching, consider
+    /// [`str::eq_ignore_case_unnormalized`].
+    ///
     /// # Examples
     ///
     /// ```
@@ -2841,6 +2859,59 @@ pub const fn eq_ignore_ascii_case(&self, other: &str) -> bool {
         self.as_bytes().eq_ignore_ascii_case(other.as_bytes())
     }
 
+    /// Checks that two strings are a caseless match, according to
+    /// [Definition 144] in Chapter 3 of the Unicode Standard.
+    ///
+    /// [Definition 144]: https://www.unicode.org/versions/latest/core-spec/chapter-3/#G53513
+    ///
+    /// Same as `a.to_casefold_unnormalized() == b.to_casefold_unnormalized()`,
+    /// but without allocating. See that method's documentation,
+    /// as well as [`char::to_casefold_unnormalized()`],
+    /// for more information about case folding.
+    ///
+    /// No [normalization] (e.g. NFC) is performed, so visually and semantically identical strings
+    /// might still compare unequal. For example, `"Å"` (U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE)
+    /// is considered distinct from `"Å"` (A followed by U+030A COMBINING RING ABOVE),
+    /// even though Unicode considers them canonically equivalent.
+    ///
+    /// In addition, this method is independent of language/locale,
+    /// so the special behavior of I/ı/İ/i in Turkish and Azeri is not handled.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(casefold)]
+    /// assert!("Ferris".eq_ignore_case_unnormalized("FERRIS"));
+    /// assert!("Ferrös".eq_ignore_case_unnormalized("FERRÖS"));
+    /// assert!("ẞ".eq_ignore_case_unnormalized("ss"));
+    /// ```
+    ///
+    /// No NFC [normalization] is performed:
+    ///
+    /// ```rust
+    /// #![feature(casefold)]
+    /// // These two strings are visually and semantically identical...
+    /// let comp = "Å";
+    /// let decomp = "Å";
+    ///
+    /// // ... but not codepoint-for-codepoint equal.
+    /// assert_eq!(comp, "\u{C5}");
+    /// assert_eq!(decomp, "A\u{030A}");
+    ///
+    /// // Their case-foldings are likewise unequal:
+    /// assert!(!comp.eq_ignore_case_unnormalized(decomp));
+    /// ```
+    ///
+    /// [normalization]: https://www.unicode.org/faq/normalization
+    #[unstable(feature = "casefold", issue = "154742")]
+    #[must_use]
+    #[inline]
+    pub fn eq_ignore_case_unnormalized(&self, other: &str) -> bool {
+        self.chars()
+            .flat_map(char::to_casefold_unnormalized)
+            .eq(other.chars().flat_map(char::to_casefold_unnormalized))
+    }
+
     /// Converts this string to its ASCII upper case equivalent in-place.
     ///
     /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs
index 77e0093..c014bc2 100644
--- a/library/core/src/str/pattern.rs
+++ b/library/core/src/str/pattern.rs
@@ -1496,7 +1496,13 @@ fn next<S>(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> S::O
             let start =
                 if long_period { self.crit_pos } else { cmp::max(self.crit_pos, self.memory) };
             for i in start..needle.len() {
-                if needle[i] != haystack[self.position + i] {
+                // SAFETY: on every iteration of `'search`, the `haystack.get(self.position + needle_last)`
+                // check returned `Some`, so `self.position + needle_last < haystack.len()`.
+                // Since `i < needle.len()` implies `i <= needle_last`, we have
+                // `self.position + i < haystack.len()`.
+                // Every path that mutates `self.position` below either returns or re-enters `'search`,
+                // which re-runs the check before reaching the loop again.
+                if needle[i] != unsafe { *haystack.get_unchecked(self.position + i) } {
                     self.position += i - self.crit_pos + 1;
                     if !long_period {
                         self.memory = 0;
@@ -1508,7 +1514,13 @@ fn next<S>(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> S::O
             // See if the left part of the needle matches
             let start = if long_period { 0 } else { self.memory };
             for i in (start..self.crit_pos).rev() {
-                if needle[i] != haystack[self.position + i] {
+                // SAFETY: on every iteration of `'search`, the `haystack.get(self.position + needle_last)`
+                // check returned `Some`, so `self.position + needle_last < haystack.len()`.
+                // Since `i < self.crit_pos <= needle.len()`, we have `i <= needle_last`, and thus
+                // `self.position + i <= self.position + needle_last < haystack.len()`.
+                // Every path that mutates `self.position` below either returns or re-enters `'search`,
+                // which re-runs the check before reaching the loop again.
+                if needle[i] != unsafe { *haystack.get_unchecked(self.position + i) } {
                     self.position += self.period;
                     if !long_period {
                         self.memory = needle.len() - self.period;
@@ -1583,7 +1595,14 @@ fn next_back<S>(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) ->
                 cmp::min(self.crit_pos_back, self.memory_back)
             };
             for i in (0..crit).rev() {
-                if needle[i] != haystack[self.end - needle.len() + i] {
+                // SAFETY: On every iteration of `'search`, `haystack.get(self.end.wrapping_sub(needle.len()))`
+                //   returned `Some`, so `self.end >= needle.len()` and `self.end - needle.len() < haystack.len()`.
+                //   Since `self.end <= haystack.len()` and `i < needle.len()`, we have
+                //   `self.end - needle.len() + i < self.end <= haystack.len()`, so
+                //   `haystack.get_unchecked(self.end - needle.len() + i)` is safe.
+                // - The path that mutates `self.end` either re-enters `'search`, which re-runs the checks
+                //   before reaching this loop again, or returns on match, so the invariant holds.
+                if needle[i] != unsafe { *haystack.get_unchecked(self.end - needle.len() + i) } {
                     self.end -= self.crit_pos_back - i;
                     if !long_period {
                         self.memory_back = needle.len();
@@ -1595,7 +1614,12 @@ fn next_back<S>(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) ->
             // See if the right part of the needle matches
             let needle_end = if long_period { needle.len() } else { self.memory_back };
             for i in self.crit_pos_back..needle_end {
-                if needle[i] != haystack[self.end - needle.len() + i] {
+                // SAFETY: The same `self.end - needle.len() + i < haystack.len()` argument as the
+                // left-part loop applies: the `haystack.get(self.end.wrapping_sub(needle.len()))`
+                // check at the top of `'search` established the bound for this iteration, and
+                // every mutation of `self.end` is followed by `continue 'search` (which re-runs
+                // the check) or a `return` (which exits before any further unsafe access).
+                if needle[i] != unsafe { *haystack.get_unchecked(self.end - needle.len() + i) } {
                     self.end -= self.period;
                     if !long_period {
                         self.memory_back = self.period;
diff --git a/library/core/src/str/traits.rs b/library/core/src/str/traits.rs
index fb0fee3..e4bf752 100644
--- a/library/core/src/str/traits.rs
+++ b/library/core/src/str/traits.rs
@@ -118,6 +118,35 @@ fn index_mut(self, slice: &mut str) -> &mut Self::Output {
     }
 }
 
+/// Check that a range is in bounds for slicing a string.
+/// If this returns true, it is safe to call `slice.get_unchecked(range)` or
+/// `slice.get_unchecked_mut(range)`.
+#[inline(always)]
+const fn check_range(slice: &str, range: crate::range::Range<usize>) -> bool {
+    let crate::range::Range { start, end } = range;
+    let bytes = slice.as_bytes();
+
+    if start > end || end > slice.len() {
+        return false;
+    }
+
+    if start == slice.len() {
+        // If `start == slice.len()`, then `end == slice.len()` must also be true.
+        return true;
+    }
+
+    // SAFETY:
+    // `start > end || end > slice.len()` is false, so `start <= end <= slice.len()` is true.
+    // `start == slice.len()` is false, so `start < slice.len()` is also true.
+    //
+    // No need to check for `end == 0`, because if `end == 0` is true then `start == slice.len()`
+    // would also be true, which is already handled above.
+    unsafe {
+        (start == 0 || bytes.as_ptr().add(start).read().is_utf8_char_boundary())
+            && (end == slice.len() || bytes.as_ptr().add(end).read().is_utf8_char_boundary())
+    }
+}
+
 /// Implements substring slicing with syntax `&self[begin .. end]` or `&mut
 /// self[begin .. end]`.
 ///
@@ -159,30 +188,11 @@ fn index_mut(self, slice: &mut str) -> &mut Self::Output {
     type Output = str;
     #[inline]
     fn get(self, slice: &str) -> Option<&Self::Output> {
-        if self.start <= self.end
-            && slice.is_char_boundary(self.start)
-            && slice.is_char_boundary(self.end)
-        {
-            // SAFETY: just checked that `start` and `end` are on a char boundary,
-            // and we are passing in a safe reference, so the return value will also be one.
-            // We also checked char boundaries, so this is valid UTF-8.
-            Some(unsafe { &*self.get_unchecked(slice) })
-        } else {
-            None
-        }
+        range::Range::from(self).get(slice)
     }
     #[inline]
     fn get_mut(self, slice: &mut str) -> Option<&mut Self::Output> {
-        if self.start <= self.end
-            && slice.is_char_boundary(self.start)
-            && slice.is_char_boundary(self.end)
-        {
-            // SAFETY: just checked that `start` and `end` are on a char boundary.
-            // We know the pointer is unique because we got it from `slice`.
-            Some(unsafe { &mut *self.get_unchecked_mut(slice) })
-        } else {
-            None
-        }
+        range::Range::from(self).get_mut(slice)
     }
     #[inline]
     #[track_caller]
@@ -235,26 +245,11 @@ unsafe fn get_unchecked_mut(self, slice: *mut str) -> *mut Self::Output {
     }
     #[inline]
     fn index(self, slice: &str) -> &Self::Output {
-        let (start, end) = (self.start, self.end);
-        match self.get(slice) {
-            Some(s) => s,
-            None => super::slice_error_fail(slice, start, end),
-        }
+        range::Range::from(self).index(slice)
     }
     #[inline]
     fn index_mut(self, slice: &mut str) -> &mut Self::Output {
-        // is_char_boundary checks that the index is in [0, .len()]
-        // cannot reuse `get` as above, because of NLL trouble
-        if self.start <= self.end
-            && slice.is_char_boundary(self.start)
-            && slice.is_char_boundary(self.end)
-        {
-            // SAFETY: just checked that `start` and `end` are on a char boundary,
-            // and we are passing in a safe reference, so the return value will also be one.
-            unsafe { &mut *self.get_unchecked_mut(slice) }
-        } else {
-            super::slice_error_fail(slice, self.start, self.end)
-        }
+        range::Range::from(self).index_mut(slice)
     }
 }
 
@@ -264,11 +259,8 @@ fn index_mut(self, slice: &mut str) -> &mut Self::Output {
     type Output = str;
     #[inline]
     fn get(self, slice: &str) -> Option<&Self::Output> {
-        if self.start <= self.end
-            && slice.is_char_boundary(self.start)
-            && slice.is_char_boundary(self.end)
-        {
-            // SAFETY: just checked that `start` and `end` are on a char boundary,
+        if check_range(slice, self) {
+            // SAFETY: just checked that `self` is in bounds,
             // and we are passing in a safe reference, so the return value will also be one.
             // We also checked char boundaries, so this is valid UTF-8.
             Some(unsafe { &*self.get_unchecked(slice) })
@@ -278,11 +270,8 @@ fn get(self, slice: &str) -> Option<&Self::Output> {
     }
     #[inline]
     fn get_mut(self, slice: &mut str) -> Option<&mut Self::Output> {
-        if self.start <= self.end
-            && slice.is_char_boundary(self.start)
-            && slice.is_char_boundary(self.end)
-        {
-            // SAFETY: just checked that `start` and `end` are on a char boundary.
+        if check_range(slice, self) {
+            // SAFETY: just checked that `self` is in bounds.
             // We know the pointer is unique because we got it from `slice`.
             Some(unsafe { &mut *self.get_unchecked_mut(slice) })
         } else {
@@ -348,13 +337,9 @@ fn index(self, slice: &str) -> &Self::Output {
     }
     #[inline]
     fn index_mut(self, slice: &mut str) -> &mut Self::Output {
-        // is_char_boundary checks that the index is in [0, .len()]
         // cannot reuse `get` as above, because of NLL trouble
-        if self.start <= self.end
-            && slice.is_char_boundary(self.start)
-            && slice.is_char_boundary(self.end)
-        {
-            // SAFETY: just checked that `start` and `end` are on a char boundary,
+        if check_range(slice, self) {
+            // SAFETY: just checked that `self` is in bounds,
             // and we are passing in a safe reference, so the return value will also be one.
             unsafe { &mut *self.get_unchecked_mut(slice) }
         } else {
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
index ec96099..4f22e01 100644
--- a/library/core/src/sync/atomic.rs
+++ b/library/core/src/sync/atomic.rs
@@ -4223,8 +4223,9 @@ unsafe fn atomic_umin<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
 /// An atomic fence.
 ///
 /// Fences create synchronization between themselves and atomic operations or fences in other
-/// threads. To achieve this, a fence prevents the compiler and CPU from reordering certain types of
-/// memory operations around it.
+/// threads. It can be helpful to think of a fence as preventing the compiler and CPU from
+/// reordering certain types of memory operations around it, but that is a simplified model which
+/// fails to capture some of the nuances.
 ///
 /// There are 3 different ways to use an atomic fence:
 ///
@@ -4374,6 +4375,7 @@ unsafe fn atomic_umin<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_diagnostic_item = "fence"]
+#[doc(alias = "atomic_thread_fence")]
 #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
 pub fn fence(order: Ordering) {
     // SAFETY: using an atomic fence is safe.
@@ -4388,15 +4390,15 @@ pub fn fence(order: Ordering) {
     }
 }
 
-/// A "compiler-only" atomic fence.
+/// An atomic fence for synchronization within a single thread.
 ///
 /// Like [`fence`], this function establishes synchronization with other atomic operations and
 /// fences. However, unlike [`fence`], `compiler_fence` only establishes synchronization with
 /// operations *in the same thread*. This may at first sound rather useless, since code within a
 /// thread is typically already totally ordered and does not need any further synchronization.
-/// However, there are cases where code can run on the same thread without being ordered:
+/// However, there are cases where code can run on the same thread without being synchronized:
 /// - The most common case is that of a *signal handler*: a signal handler runs in the same thread
-///   as the code it interrupted, but it is not ordered with respect to that code. `compiler_fence`
+///   as the code it interrupted, but it is not synchronized with that code. `compiler_fence`
 ///   can be used to establish synchronization between a thread and its signal handler, the same way
 ///   that `fence` can be used to establish synchronization across threads.
 /// - Similar situations can arise in embedded programming with interrupt handlers, or in custom
@@ -4407,9 +4409,14 @@ pub fn fence(order: Ordering) {
 /// [`fence`], synchronization still requires atomic operations to be used in both threads -- it is
 /// not possible to perform synchronization entirely with fences and non-atomic operations.
 ///
-/// `compiler_fence` does not emit any machine code, but restricts the kinds of memory re-ordering
-/// the compiler is allowed to do. `compiler_fence` corresponds to [`atomic_signal_fence`] in C and
-/// C++.
+/// `compiler_fence` does not emit any machine code. However, note that `compiler_fence` is also
+/// *not* a "compiler barrier". It can be helpful to think of a `compiler_fence` as preventing the
+/// compiler from reordering certain types of memory operations around it, but that is a simplified
+/// model which fails to capture some of the nuances. The only actual guarantee made by
+/// `compiler_fence` is establishing synchronization with signal handlers and similar kinds of code,
+/// under the rules described in the [`fence`] documentation.
+///
+/// `compiler_fence` corresponds to [`atomic_signal_fence`] in C and C++.
 ///
 /// [`atomic_signal_fence`]: https://en.cppreference.com/w/cpp/atomic/atomic_signal_fence
 ///
@@ -4452,6 +4459,7 @@ pub fn fence(order: Ordering) {
 #[inline]
 #[stable(feature = "compiler_fences", since = "1.21.0")]
 #[rustc_diagnostic_item = "compiler_fence"]
+#[doc(alias = "atomic_signal_fence")]
 #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
 pub fn compiler_fence(order: Ordering) {
     // SAFETY: using an atomic fence is safe.
diff --git a/library/core/src/sync/sync_view.rs b/library/core/src/sync/sync_view.rs
index 3b02c4c..63e157b 100644
--- a/library/core/src/sync/sync_view.rs
+++ b/library/core/src/sync/sync_view.rs
@@ -188,7 +188,7 @@ impl<T: ?Sized + Sync> SyncView<T> {
     #[rustc_const_unstable(feature = "exclusive_wrapper", issue = "98407")]
     #[must_use]
     #[inline]
-    pub const fn as_pin(self: Pin<&Self>) -> Pin<&T> {
+    pub const fn as_pin_ref(self: Pin<&Self>) -> Pin<&T> {
         // SAFETY: `SyncView` can only produce `&T` if itself is unpinned
         // `Pin::map_unchecked` is not const, so we do this conversion manually
         unsafe { Pin::new_unchecked(&self.get_ref().inner) }
diff --git a/library/core/src/unicode/unicode_data.rs b/library/core/src/unicode/unicode_data.rs
index 83d3808..9df020c 100644
--- a/library/core/src/unicode/unicode_data.rs
+++ b/library/core/src/unicode/unicode_data.rs
@@ -10,7 +10,8 @@
 // to_lower        :  1112 bytes,   1462 codepoints in 185 ranges (U+0000C0 - U+01E921) using 2-level LUT
 // to_upper        :  1998 bytes,   1554 codepoints in 299 ranges (U+0000B5 - U+01E943) using 2-level LUT
 // to_title        :   340 bytes,    135 codepoints in  49 ranges (U+0000DF - U+00FB17) using 2-level LUT
-// Total           :  9629 bytes
+// to_casefold     :    32 bytes,    174 codepoints in   5 ranges (U+000131 - U+00ABBF) using 2-level LUT
+// Total           :  9661 bytes
 
 #[inline(always)]
 const fn bitset_search<
@@ -846,7 +847,7 @@ unsafe fn reconstruct(plane: u16, low: u16) -> char {
     }
 
     pub fn to_lower(c: char) -> [char; 3] {
-        // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%253AChanges_When_Lowercased%253A%5D-%5B%253AASCII%253A%5D&abb=on
+        // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=[:Changes_When_Lowercased:]-[:ASCII:]&abb=on
         if c < '\u{C0}' {
             return [c.to_ascii_lowercase(), '\0', '\0'];
         }
@@ -855,7 +856,7 @@ unsafe fn reconstruct(plane: u16, low: u16) -> char {
     }
 
     pub fn to_upper(c: char) -> [char; 3] {
-        // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%253AChanges_When_Uppercased%253A%5D-%5B%253AASCII%253A%5D&abb=on
+        // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=[:Changes_When_Uppercased:]-[:ASCII:]&abb=on
         if c < '\u{B5}' {
             return [c.to_ascii_uppercase(), '\0', '\0'];
         }
@@ -864,7 +865,7 @@ unsafe fn reconstruct(plane: u16, low: u16) -> char {
     }
 
     pub fn to_title(c: char) -> [char; 3] {
-        // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%253AChanges_When_Titlecased%253A%5D-%5B%253AASCII%253A%5D&abb=on
+        // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=[:Changes_When_Titlecased:]-[:ASCII:]&abb=on
         if c < '\u{B5}' {
             return [c.to_ascii_uppercase(), '\0', '\0'];
         }
@@ -872,6 +873,88 @@ unsafe fn reconstruct(plane: u16, low: u16) -> char {
         lookup(c, &TITLECASE_LUT).or_else(|| lookup(c, &UPPERCASE_LUT)).unwrap_or([c, '\0', '\0'])
     }
 
+    pub fn to_casefold(c: char) -> [char; 3] {
+        // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=[:Changes_When_Casefolded:]-[:ASCII:]&abb=on
+        if c < '\u{B5}' {
+            return [c.to_ascii_lowercase(), '\0', '\0'];
+        }
+
+
+        lookup(c, &CASEFOLD_LUT).unwrap_or_else(|| {
+            // Fall back to lowercase of uppercase
+
+            let uppercase = lookup(c, &UPPERCASE_LUT).unwrap_or([c, '\0', '\0']);
+
+            // We need to take the lowercase of each character in `uppercase`,
+            // and then concatenate them together.
+
+            // Lowercase the first uppercased char
+            let mut final_result = to_lower(uppercase[0]);
+
+            if uppercase[1] != '\0' {
+                // There's a 2nd uppercase char, lowercase it as well
+                let lowercase_1 = to_lower(uppercase[1]);
+
+                // The lowercase of the second uppercase character
+                // can't be 3 chars long;
+                // that would bring the total case-folding length
+                // above 3 characters, which would violate
+                // a Unicode stability guarantee.
+                debug_assert_eq!(lowercase_1[2], '\0');
+
+                // Currently, in every case where there
+                // are multiple uppercased characters,
+                // the lowercase of the first uppercase
+                // has length 1. However, Unicode doesn't
+                // guarantee this.
+                // If, after updating the Unicode data
+                // to a new Unicode version, the below
+                // assertion starts to fail in
+                // `coretests/tests/unicode.rs` `to_casefold()`,
+                // delete it, and uncomment the
+                // `if` condition and corresponding
+                // `else` block below it.
+                debug_assert_eq!(final_result[1], '\0');
+                //if final_result[1] == '\0' {
+
+                final_result[1] = lowercase_1[0];
+
+                if uppercase[2] != '\0' {
+                    // There's a 3rd uppercased char, lowercase it as well.
+                    // Because of the Unicode stability guarantee that case-folding
+                    // does not expand a string more than 3x in length,
+                    // we know this lowercase must be 1 char long.
+
+                    debug_assert_eq!(lowercase_1[1], '\0');
+                    let lowercase_2 = to_lower(uppercase[2]);
+                    debug_assert_eq!(lowercase_2[1], '\0');
+                    debug_assert_eq!(lowercase_2[2], '\0');
+                    final_result[2] = lowercase_2[0];
+                } else {
+                    // Currently, the lowercase of
+                    // the second uppercase character
+                    // can't be 2 chars long either,
+                    // but Unicode doesn't guarantee this.
+                    // If, after updating the Unicode data
+                    // to a new Unicode version, the below
+                    // assertion starts to fail in
+                    // `coretests/tests/unicode.rs` `to_casefold()`,
+                    // delete it and uncomment the line
+                    // below it.
+                    debug_assert_eq!(lowercase_1[1], '\0');
+                    //final_result[2] = lowercase_1[1];
+                }
+
+                /*} else {
+                    final_result[2] = lowercase_1[0];
+                    debug_assert_eq!(lowercase_1[1], '\0');
+                    debug_assert_eq!(uppercase[2], '\0')
+                }*/
+            }
+            final_result
+        })
+    }
+
     static LOWERCASE_LUT: L1Lut = L1Lut {
         l2_luts: [
             L2Lut {
@@ -1188,4 +1271,24 @@ unsafe fn reconstruct(plane: u16, low: u16) -> char {
             },
         ],
     };
+
+    static CASEFOLD_LUT: L1Lut = L1Lut {
+        l2_luts: [
+            L2Lut {
+                singles: &[ // 4 entries, 24 bytes
+                    (Range::singleton(0x0131), 0), (Range::step_by_1(0x13a0..=0x13f5), 0),
+                    (Range::step_by_1(0x13f8..=0x13fd), -8), (Range::step_by_1(0xab70..=0xabbf), 26672),
+                ],
+                multis: &[ // 1 entries, 8 bytes
+                    (0x1e9e, [0x0073, 0x0073, 0x0000]),
+                ],
+            },
+            L2Lut {
+                singles: &[ // 0 entries, 0 bytes
+                ],
+                multis: &[ // 0 entries, 0 bytes
+                ],
+            },
+        ],
+    };
 }
diff --git a/library/coretests/benches/pattern.rs b/library/coretests/benches/pattern.rs
index b0f8b39..15dfda9 100644
--- a/library/coretests/benches/pattern.rs
+++ b/library/coretests/benches/pattern.rs
@@ -39,3 +39,51 @@ fn ends_with_str(b: &mut Bencher) {
         }
     })
 }
+
+fn make_haystack() -> String {
+    "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem \
+    sit amet dolor ultricies condimentum. Praesent iaculis purus elit, ac malesuada \
+    quam malesuada in. Duis sed orci eros. Suspendisse sit amet magna mollis, mollis \
+    nunc luctus, imperdiet mi. Integer fringilla non sem ut lacinia. Fusce varius \
+    tortor a risus porttitor hendrerit. Morbi mauris dui, ultricies nec tempus vel, \
+    gravida nec quam. In est dui, tincidunt sed tempus interdum, adipiscing laoreet \
+    ante. Etiam tempor, tellus quis sagittis interdum, nulla purus mattis sem, quis \
+    auctor erat odio ac tellus. In nec nunc sit amet diam volutpat molestie at sed \
+    ipsum. Vestibulum laoreet consequat vulputate. Integer accumsan lorem ac dignissim \
+    placerat. Suspendisse convallis faucibus lorem. Aliquam erat volutpat."
+        .repeat(50)
+}
+
+#[bench]
+fn find_str(b: &mut Bencher) {
+    let s = make_haystack();
+    let haystack = black_box(s.as_str());
+    b.bytes = haystack.len() as u64;
+    b.iter(|| black_box(haystack.find("the english language")))
+}
+
+#[bench]
+fn rfind_str(b: &mut Bencher) {
+    let s = make_haystack();
+    let haystack = black_box(s.as_str());
+    b.bytes = haystack.len() as u64;
+    b.iter(|| black_box(haystack.rfind("the english language")))
+}
+
+#[bench]
+fn find_str_worst_case(b: &mut Bencher) {
+    let near_miss = "the english languagX";
+    let haystack_str = near_miss.repeat(2000);
+    let haystack = black_box(haystack_str.as_str());
+    b.bytes = haystack.len() as u64;
+    b.iter(|| black_box(haystack.find("the english language")))
+}
+
+#[bench]
+fn rfind_str_worst_case(b: &mut Bencher) {
+    let near_miss = "the english languagX";
+    let haystack_str = near_miss.repeat(2000);
+    let haystack = black_box(haystack_str.as_str());
+    b.bytes = haystack.len() as u64;
+    b.iter(|| black_box(haystack.rfind("the english language")))
+}
diff --git a/library/coretests/tests/char.rs b/library/coretests/tests/char.rs
index 4337200..e0921e2 100644
--- a/library/coretests/tests/char.rs
+++ b/library/coretests/tests/char.rs
@@ -213,6 +213,41 @@ fn upper(c: char) -> String {
 }
 
 #[test]
+fn test_to_casefold_unnormalized() {
+    fn fold(c: char) -> String {
+        let to_casefold = c.to_casefold_unnormalized();
+        assert_eq!(to_casefold.len(), to_casefold.count());
+        let iter: String = c.to_casefold_unnormalized().collect();
+        let disp: String = c.to_casefold_unnormalized().to_string();
+        assert_eq!(iter, disp);
+        let iter_rev: String = c.to_casefold_unnormalized().rev().collect();
+        let disp_rev: String = disp.chars().rev().collect();
+        assert_eq!(iter_rev, disp_rev);
+        iter
+    }
+    assert_eq!(fold('A'), "a");
+    assert_eq!(fold('Ö'), "ö");
+    assert_eq!(fold('ß'), "ss");
+    assert_eq!(fold('ẞ'), "ss");
+    assert_eq!(fold('Ü'), "ü");
+    assert_eq!(fold('💩'), "💩");
+    assert_eq!(fold('Σ'), "σ");
+    assert_eq!(fold('ς'), "σ");
+    assert_eq!(fold('Τ'), "τ");
+    assert_eq!(fold('Ι'), "ι");
+    assert_eq!(fold('Γ'), "γ");
+    assert_eq!(fold('Μ'), "μ");
+    assert_eq!(fold('Α'), "α");
+    assert_eq!(fold('Dž'), "dž");
+    assert_eq!(fold('fi'), "fi");
+    assert_eq!(fold('İ'), "i\u{307}");
+    assert_eq!(fold('ꮿ'), "Ꮿ");
+    assert_eq!(fold('Ꮿ'), "Ꮿ");
+    assert_eq!(fold('ῲ'), "ὼι");
+    assert_eq!(fold('\u{0345}'), "ι");
+}
+
+#[test]
 fn test_is_control() {
     assert!('\u{0}'.is_control());
     assert!('\u{3}'.is_control());
diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs
index aa6aa14..1799da9 100644
--- a/library/coretests/tests/lib.rs
+++ b/library/coretests/tests/lib.rs
@@ -10,6 +10,7 @@
 #![feature(async_iterator)]
 #![feature(borrowed_buf_init)]
 #![feature(bstr)]
+#![feature(casefold)]
 #![feature(cfg_target_has_reliable_f16_f128)]
 #![feature(char_internals)]
 #![feature(clone_to_uninit)]
@@ -67,6 +68,7 @@
 #![feature(hashmap_internals)]
 #![feature(int_from_ascii)]
 #![feature(int_roundings)]
+#![feature(integer_casts)]
 #![feature(io_slice_as_bytes)]
 #![feature(ip)]
 #![feature(is_ascii_octdigit)]
@@ -82,6 +84,7 @@
 #![feature(iterator_try_collect)]
 #![feature(iterator_try_reduce)]
 #![feature(layout_for_ptr)]
+#![feature(macro_metavar_expr_concat)]
 #![feature(maybe_uninit_fill)]
 #![feature(maybe_uninit_uninit_array_transpose)]
 #![feature(min_specialization)]
@@ -97,7 +100,6 @@
 #![feature(pointer_is_aligned_to)]
 #![feature(portable_simd)]
 #![feature(ptr_metadata)]
-#![feature(result_option_map_or_default)]
 #![feature(rustc_attrs)]
 #![feature(signed_bigint_helpers)]
 #![feature(slice_from_ptr_range)]
diff --git a/library/coretests/tests/num/cast.rs b/library/coretests/tests/num/cast.rs
new file mode 100644
index 0000000..dddfd3a
--- /dev/null
+++ b/library/coretests/tests/num/cast.rs
@@ -0,0 +1,101 @@
+use std::sync::LazyLock;
+
+// All (negative) integers which are at or near a power of two to test
+// boundary conditions. We use strings so we can convert to any type using
+// parsing, while still being able to use the *position* in ORDERED_VALS for
+// comparisons.
+static ORDERED_VALS: LazyLock<Vec<String>> = LazyLock::new(|| {
+    let mut pos_int_vals = Vec::new();
+    for exp in 0..=127 {
+        let val = 1_u128 << exp;
+        pos_int_vals.push(val.saturating_sub(2));
+        pos_int_vals.push(val.saturating_sub(1));
+        pos_int_vals.push(val);
+        pos_int_vals.push(val.saturating_add(1));
+        pos_int_vals.push(val.saturating_add(2));
+    }
+    pos_int_vals.sort();
+    pos_int_vals.dedup();
+
+    let mut pos_str_vals: Vec<_> = pos_int_vals.iter().map(|i| i.to_string()).collect();
+
+    // These are manual because the upper ones overflow even u128.
+    pos_str_vals.push("340282366920938463463374607431768211454".to_owned()); // 2**128 - 2
+    pos_str_vals.push("340282366920938463463374607431768211455".to_owned()); // 2**128 - 1
+    pos_str_vals.push("340282366920938463463374607431768211456".to_owned()); // 2**128
+    pos_str_vals.push("340282366920938463463374607431768211457".to_owned()); // 2**128 + 1
+    pos_str_vals.push("340282366920938463463374607431768211458".to_owned()); // 2**128 + 2
+
+    let mut out = Vec::new();
+    for val in pos_str_vals[1..].iter().rev() {
+        out.push(format!("-{val}"));
+    }
+    out.extend(pos_str_vals);
+    out
+});
+
+macro_rules! make_checked_cast_test {
+    ($Src:ident as [$($Dst:ident),*]) => {$(
+        #[test]
+        #[allow(non_snake_case)]
+        fn ${concat(test_checked_cast_, $Src, _to_, $Dst)}() {
+            for val in ORDERED_VALS.iter() {
+                if let Some(src) = val.parse::<$Src>().ok() {
+                    let dst: Option<$Dst> = val.parse().ok();
+                    assert_eq!(src.checked_cast::<$Dst>(), dst);
+                }
+            }
+        }
+    )*}
+}
+
+macro_rules! make_bounded_cast_test {
+    (|$src:ident| $raw:expr, $Src:ident as [$($Dst:ident),*]) => {$(
+        #[test]
+        #[allow(non_snake_case)]
+        fn ${concat(test_bounded_cast_, $Src, _to_, $Dst)}() {
+            let ord_idx = |s| ORDERED_VALS.iter().position(|v| *v == s).unwrap();
+            let dst_min_idx = ord_idx(<$Dst>::MIN.to_string());
+            let dst_max_idx = ord_idx(<$Dst>::MAX.to_string());
+            for (val_idx, val) in ORDERED_VALS.iter().enumerate() {
+                if let Some($src) = val.parse::<$Src>().ok() {
+                    let dst: Option<$Dst> = val.parse().ok();
+
+                    assert_eq!($src.wrapping_cast::<$Dst>(), $raw as $Dst);
+
+                    if val_idx > dst_max_idx {
+                        assert_eq!($src.saturating_cast::<$Dst>(), <$Dst>::MAX);
+                    } else if val_idx < dst_min_idx {
+                        assert_eq!($src.saturating_cast::<$Dst>(), <$Dst>::MIN);
+                    } else {
+                        assert_eq!($src.saturating_cast::<$Dst>(), dst.unwrap());
+                    }
+                }
+            }
+        }
+    )*}
+}
+
+macro_rules! make_tests_for_src {
+    (|$src:ident| $raw:expr, [$($Src:ident),*]) => {$(
+        make_checked_cast_test!(             $Src as [u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize]);
+        make_bounded_cast_test!(|$src| $raw, $Src as [u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize]);
+
+        // NonZero types are not (yet) implemented.
+        // make_checked_cast_test!($Src as [
+        //     NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize,
+        //     NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize
+        // ]);
+    )*}
+}
+
+make_tests_for_src!(|x| x, [u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize]);
+
+// NonZero types are not (yet) implemented.
+// make_tests_for_src!(
+//     |x| x.get(),
+//     [
+//         NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize,
+//         NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize
+//     ]
+// );
diff --git a/library/coretests/tests/num/int_macros.rs b/library/coretests/tests/num/int_macros.rs
index 1334881..f391fe2 100644
--- a/library/coretests/tests/num/int_macros.rs
+++ b/library/coretests/tests/num/int_macros.rs
@@ -318,49 +318,290 @@ fn test_from_str_radix() {
 
             fn test_pow() {
                 {
-                    const R: $T = 2;
-                    assert_eq_const_safe!($T: R.pow(2), 4 as $T);
-                    assert_eq_const_safe!($T: R.pow(0), 1 as $T);
-                    assert_eq_const_safe!($T: R.wrapping_pow(2), 4 as $T);
+                    const R: $T = 0;
                     assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
-                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(4 as $T));
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS - 1), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS + 1), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), 0 as $T);
+
                     assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
-                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (4 as $T, false));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS - 1), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS + 1), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), Some(0 as $T));
+
                     assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
-                    assert_eq_const_safe!($T: R.saturating_pow(2), 4 as $T);
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS - 1), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS + 1), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (0 as $T, false));
+
                     assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS - 1), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS + 1), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), 0 as $T);
                 }
 
                 {
-                    const R: $T = MAX;
-                    // use `^` to represent .pow() with no overflow.
-                    // if itest::MAX == 2^j-1, then itest is a `j` bit int,
-                    // so that `itest::MAX*itest::MAX == 2^(2*j)-2^(j+1)+1`,
-                    // thussaturating_pow the overflowing result is exactly 1.
+                    const R: $T = 1;
+                    assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), 1 as $T);
                     assert_eq_const_safe!($T: R.wrapping_pow(2), 1 as $T);
-                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), None);
-                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (1 as $T, true));
-                    assert_eq_const_safe!($T: R.saturating_pow(2), MAX);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS - 1), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS + 1), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), 1 as $T);
+
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS - 1), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS + 1), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), Some(1 as $T));
+
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS - 1), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS + 1), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (1 as $T, false));
+
+                    assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS - 1), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS + 1), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), 1 as $T);
                 }
 
                 {
-                    // test for negative exponent.
-                    const R: $T = -2;
-                    assert_eq_const_safe!($T: R.pow(2), 4 as $T);
-                    assert_eq_const_safe!($T: R.pow(3), -8 as $T);
-                    assert_eq_const_safe!($T: R.pow(0), 1 as $T);
-                    assert_eq_const_safe!($T: R.wrapping_pow(2), 4 as $T);
-                    assert_eq_const_safe!($T: R.wrapping_pow(3), -8 as $T);
+                    const R: $T = -1;
                     assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
-                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(4 as $T));
-                    assert_eq_const_safe!(Option<$T>: R.checked_pow(3), Some(-8 as $T));
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), -1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS - 1), -1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS + 1), -1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), -1 as $T);
+
                     assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
-                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (4 as $T, false));
-                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(3), (-8 as $T, false));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(-1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS - 1), Some(-1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS + 1), Some(-1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), Some(-1 as $T));
+
                     assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
-                    assert_eq_const_safe!($T: R.saturating_pow(2), 4 as $T);
-                    assert_eq_const_safe!($T: R.saturating_pow(3), -8 as $T);
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (-1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS - 1), (-1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS + 1), (-1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (-1 as $T, false));
+
                     assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), -1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS - 1), -1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS + 1), -1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), -1 as $T);
+                }
+
+                {
+                    const R: $T = 2;
+                    assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), 2 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 4 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS - 1), $T::MIN);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS + 1), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), 0 as $T);
+
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(2 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(4 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS - 1), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS + 1), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), None);
+
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (2 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (4 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS - 1), ($T::MIN, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS + 1), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (0 as $T, true));
+
+                    assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), 2 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), 4 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS - 1), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS + 1), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), $T::MAX);
+                }
+
+                {
+                    const R: $T = -2;
+                    assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), -2 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 4 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS - 1), $T::MIN);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS + 1), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), 0 as $T);
+
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(-2 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(4 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS - 1), Some($T::MIN));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS + 1), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), None);
+
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (-2 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (4 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS - 1), ($T::MIN, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS + 1), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (0 as $T, true));
+
+                    assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), -2 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), 4 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS - 1), $T::MIN);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS + 1), $T::MIN);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), $T::MIN);
+                }
+
+                // Overflow in the shift caclculation should result in the final
+                // result being 0 rather than accidentally succeeding due to a
+                // shift within the word size.
+                // eg `4 ** 0x8000_0000` should give 0 rather than 1 << 0
+                {
+                    const R: $T = 4;
+                    const HALF: u32 = u32::MAX / 2 + 1;
+                    assert_eq_const_safe!($T: R.wrapping_pow(HALF), 0 as $T);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(HALF), None);
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(HALF), (0 as $T, true));
+                    assert_eq_const_safe!($T: R.saturating_pow(HALF), $T::MAX);
+                }
+
+                {
+                    const R: $T = -4;
+                    const HALF: u32 = u32::MAX / 2 + 1;
+                    assert_eq_const_safe!($T: R.wrapping_pow(HALF), 0 as $T);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(HALF), None);
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(HALF), (0 as $T, true));
+                    assert_eq_const_safe!($T: R.saturating_pow(HALF), $T::MAX);
+                }
+
+                {
+                    const R: $T = $T::MAX;
+                    assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), R as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 1 as $T);
+
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), R as $T);
+
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(R as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), None);
+
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (R as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (1 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (1 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (R as $T, true));
+
+                    assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), R as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS - 1), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS + 1), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), $T::MAX);
+                }
+
+                {
+                    const R: $T = $T::MIN;
+                    assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), R as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS - 1), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow($T::BITS + 1), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), 0 as $T);
+
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(R as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS - 1), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow($T::BITS + 1), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), None);
+
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (R as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS - 1), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow($T::BITS + 1), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (0 as $T, true));
+
+                    assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), R as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS - 1), $T::MIN);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow($T::BITS + 1), $T::MIN);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), $T::MIN);
                 }
             }
 
diff --git a/library/coretests/tests/num/mod.rs b/library/coretests/tests/num/mod.rs
index a82ac6f..90666fc 100644
--- a/library/coretests/tests/num/mod.rs
+++ b/library/coretests/tests/num/mod.rs
@@ -23,6 +23,7 @@
 
 mod bignum;
 mod carryless_mul;
+mod cast;
 mod const_from;
 mod dec2flt;
 mod float_ieee754_flt2dec_dec2flt;
diff --git a/library/coretests/tests/num/uint_macros.rs b/library/coretests/tests/num/uint_macros.rs
index b686df0..8189776 100644
--- a/library/coretests/tests/num/uint_macros.rs
+++ b/library/coretests/tests/num/uint_macros.rs
@@ -338,29 +338,124 @@ fn test_parse_bytes() {
 
             fn test_pow() {
                 {
-                    const R: $T = 2;
-                    assert_eq_const_safe!($T: R.pow(2), 4 as $T);
-                    assert_eq_const_safe!($T: R.pow(0), 1 as $T);
-                    assert_eq_const_safe!($T: R.wrapping_pow(2), 4 as $T);
+                    const R: $T = 0;
                     assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
-                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(4 as $T));
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), 0 as $T);
+
                     assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
-                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (4 as $T, false));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), Some(0 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), Some(0 as $T));
+
                     assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
-                    assert_eq_const_safe!($T: R.saturating_pow(2), 4 as $T);
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (0 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (0 as $T, false));
+
                     assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), 0 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), 0 as $T);
+                }
+
+                {
+                    const R: $T = 1;
+                    assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), 1 as $T);
+
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), Some(1 as $T));
+
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (1 as $T, false));
+
+                    assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), 1 as $T);
+                }
+
+                {
+                    const R: $T = 2;
+                    assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), 2 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(2), 4 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 0 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), 0 as $T);
+
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(2 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(2), Some(4 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), None);
+
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (2 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (4 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (0 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (0 as $T, true));
+
+                    assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), 2 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(2), 4 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), $T::MAX);
+                }
+
+                // Overflow in the shift caclculation should result in the final
+                // result being 0 rather than accidentally succeeding due to a
+                // shift within the word size.
+                // eg `4 ** 0x8000_0000` should give 0 rather than 1 << 0
+                {
+                    const R: $T = 4;
+                    const HALF: u32 = u32::MAX / 2 + 1;
+                    assert_eq_const_safe!($T: R.wrapping_pow(HALF), 0 as $T);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(HALF), None);
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(HALF), (0 as $T, true));
+                    assert_eq_const_safe!($T: R.saturating_pow(HALF), $T::MAX);
                 }
 
                 {
                     const R: $T = $T::MAX;
-                    // use `^` to represent .pow() with no overflow.
-                    // if itest::MAX == 2^j-1, then itest is a `j` bit int,
-                    // so that `itest::MAX*itest::MAX == 2^(2*j)-2^(j+1)+1`,
-                    // thussaturating_pow the overflowing result is exactly 1.
+                    assert_eq_const_safe!($T: R.wrapping_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(1), R as $T);
                     assert_eq_const_safe!($T: R.wrapping_pow(2), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(128), 1 as $T);
+                    assert_eq_const_safe!($T: R.wrapping_pow(129), R as $T);
+
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(0), Some(1 as $T));
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(1), Some(R as $T));
                     assert_eq_const_safe!(Option<$T>: R.checked_pow(2), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(128), None);
+                    assert_eq_const_safe!(Option<$T>: R.checked_pow(129), None);
+
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(0), (1 as $T, false));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(1), (R as $T, false));
                     assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (1 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(128), (1 as $T, true));
+                    assert_eq_const_safe!(($T, bool): R.overflowing_pow(129), (R as $T, true));
+
+                    assert_eq_const_safe!($T: R.saturating_pow(0), 1 as $T);
+                    assert_eq_const_safe!($T: R.saturating_pow(1), R as $T);
                     assert_eq_const_safe!($T: R.saturating_pow(2), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(128), $T::MAX);
+                    assert_eq_const_safe!($T: R.saturating_pow(129), $T::MAX);
                 }
             }
 
diff --git a/library/coretests/tests/unicode.rs b/library/coretests/tests/unicode.rs
index 12eed25..05cea23 100644
--- a/library/coretests/tests/unicode.rs
+++ b/library/coretests/tests/unicode.rs
@@ -124,3 +124,22 @@ fn to_titlecase() {
         unicode_data::conversions::to_upper,
     );
 }
+
+/// This test verifies some assumptions we currently make about Unicode casings
+/// which might be falsified by future versions of the standard.
+/// It's important that it gets run with debug assertions enabled,
+/// so that the debug assertions in `core/src/unicode/unicode_data.rs`
+/// `conversions::to_casefold` get run with every possible Unicode character as input.
+#[test]
+#[cfg_attr(miri, ignore)] // Miri is too slow
+fn to_casefold() {
+    test_case_mapping(test_data::TO_CASEFOLD, unicode_data::conversions::to_casefold, |c| {
+        let upper = unicode_data::conversions::to_upper(c);
+        let lower = upper.map(unicode_data::conversions::to_lower);
+        let mut result = ['\0'; 3];
+        for (i, c) in lower.into_iter().flatten().filter(|&c| c != '\0').enumerate() {
+            result[i] = c;
+        }
+        result
+    });
+}
diff --git a/library/coretests/tests/unicode/test_data.rs b/library/coretests/tests/unicode/test_data.rs
index 962770a..77b976c 100644
--- a/library/coretests/tests/unicode/test_data.rs
+++ b/library/coretests/tests/unicode/test_data.rs
@@ -2931,3 +2931,94 @@
     ('\u{fb16}', ['\u{54e}', '\u{576}', '\u{0}']),
     ('\u{fb17}', ['\u{544}', '\u{56d}', '\u{0}']),
 ];
+
+#[rustfmt::skip]
+pub(super) static TO_CASEFOLD: &[(char, [char; 3]); 174] = &[
+    ('\u{131}', ['\u{131}', '\u{0}', '\u{0}']), ('\u{13a0}', ['\u{13a0}', '\u{0}', '\u{0}']),
+    ('\u{13a1}', ['\u{13a1}', '\u{0}', '\u{0}']), ('\u{13a2}', ['\u{13a2}', '\u{0}', '\u{0}']),
+    ('\u{13a3}', ['\u{13a3}', '\u{0}', '\u{0}']), ('\u{13a4}', ['\u{13a4}', '\u{0}', '\u{0}']),
+    ('\u{13a5}', ['\u{13a5}', '\u{0}', '\u{0}']), ('\u{13a6}', ['\u{13a6}', '\u{0}', '\u{0}']),
+    ('\u{13a7}', ['\u{13a7}', '\u{0}', '\u{0}']), ('\u{13a8}', ['\u{13a8}', '\u{0}', '\u{0}']),
+    ('\u{13a9}', ['\u{13a9}', '\u{0}', '\u{0}']), ('\u{13aa}', ['\u{13aa}', '\u{0}', '\u{0}']),
+    ('\u{13ab}', ['\u{13ab}', '\u{0}', '\u{0}']), ('\u{13ac}', ['\u{13ac}', '\u{0}', '\u{0}']),
+    ('\u{13ad}', ['\u{13ad}', '\u{0}', '\u{0}']), ('\u{13ae}', ['\u{13ae}', '\u{0}', '\u{0}']),
+    ('\u{13af}', ['\u{13af}', '\u{0}', '\u{0}']), ('\u{13b0}', ['\u{13b0}', '\u{0}', '\u{0}']),
+    ('\u{13b1}', ['\u{13b1}', '\u{0}', '\u{0}']), ('\u{13b2}', ['\u{13b2}', '\u{0}', '\u{0}']),
+    ('\u{13b3}', ['\u{13b3}', '\u{0}', '\u{0}']), ('\u{13b4}', ['\u{13b4}', '\u{0}', '\u{0}']),
+    ('\u{13b5}', ['\u{13b5}', '\u{0}', '\u{0}']), ('\u{13b6}', ['\u{13b6}', '\u{0}', '\u{0}']),
+    ('\u{13b7}', ['\u{13b7}', '\u{0}', '\u{0}']), ('\u{13b8}', ['\u{13b8}', '\u{0}', '\u{0}']),
+    ('\u{13b9}', ['\u{13b9}', '\u{0}', '\u{0}']), ('\u{13ba}', ['\u{13ba}', '\u{0}', '\u{0}']),
+    ('\u{13bb}', ['\u{13bb}', '\u{0}', '\u{0}']), ('\u{13bc}', ['\u{13bc}', '\u{0}', '\u{0}']),
+    ('\u{13bd}', ['\u{13bd}', '\u{0}', '\u{0}']), ('\u{13be}', ['\u{13be}', '\u{0}', '\u{0}']),
+    ('\u{13bf}', ['\u{13bf}', '\u{0}', '\u{0}']), ('\u{13c0}', ['\u{13c0}', '\u{0}', '\u{0}']),
+    ('\u{13c1}', ['\u{13c1}', '\u{0}', '\u{0}']), ('\u{13c2}', ['\u{13c2}', '\u{0}', '\u{0}']),
+    ('\u{13c3}', ['\u{13c3}', '\u{0}', '\u{0}']), ('\u{13c4}', ['\u{13c4}', '\u{0}', '\u{0}']),
+    ('\u{13c5}', ['\u{13c5}', '\u{0}', '\u{0}']), ('\u{13c6}', ['\u{13c6}', '\u{0}', '\u{0}']),
+    ('\u{13c7}', ['\u{13c7}', '\u{0}', '\u{0}']), ('\u{13c8}', ['\u{13c8}', '\u{0}', '\u{0}']),
+    ('\u{13c9}', ['\u{13c9}', '\u{0}', '\u{0}']), ('\u{13ca}', ['\u{13ca}', '\u{0}', '\u{0}']),
+    ('\u{13cb}', ['\u{13cb}', '\u{0}', '\u{0}']), ('\u{13cc}', ['\u{13cc}', '\u{0}', '\u{0}']),
+    ('\u{13cd}', ['\u{13cd}', '\u{0}', '\u{0}']), ('\u{13ce}', ['\u{13ce}', '\u{0}', '\u{0}']),
+    ('\u{13cf}', ['\u{13cf}', '\u{0}', '\u{0}']), ('\u{13d0}', ['\u{13d0}', '\u{0}', '\u{0}']),
+    ('\u{13d1}', ['\u{13d1}', '\u{0}', '\u{0}']), ('\u{13d2}', ['\u{13d2}', '\u{0}', '\u{0}']),
+    ('\u{13d3}', ['\u{13d3}', '\u{0}', '\u{0}']), ('\u{13d4}', ['\u{13d4}', '\u{0}', '\u{0}']),
+    ('\u{13d5}', ['\u{13d5}', '\u{0}', '\u{0}']), ('\u{13d6}', ['\u{13d6}', '\u{0}', '\u{0}']),
+    ('\u{13d7}', ['\u{13d7}', '\u{0}', '\u{0}']), ('\u{13d8}', ['\u{13d8}', '\u{0}', '\u{0}']),
+    ('\u{13d9}', ['\u{13d9}', '\u{0}', '\u{0}']), ('\u{13da}', ['\u{13da}', '\u{0}', '\u{0}']),
+    ('\u{13db}', ['\u{13db}', '\u{0}', '\u{0}']), ('\u{13dc}', ['\u{13dc}', '\u{0}', '\u{0}']),
+    ('\u{13dd}', ['\u{13dd}', '\u{0}', '\u{0}']), ('\u{13de}', ['\u{13de}', '\u{0}', '\u{0}']),
+    ('\u{13df}', ['\u{13df}', '\u{0}', '\u{0}']), ('\u{13e0}', ['\u{13e0}', '\u{0}', '\u{0}']),
+    ('\u{13e1}', ['\u{13e1}', '\u{0}', '\u{0}']), ('\u{13e2}', ['\u{13e2}', '\u{0}', '\u{0}']),
+    ('\u{13e3}', ['\u{13e3}', '\u{0}', '\u{0}']), ('\u{13e4}', ['\u{13e4}', '\u{0}', '\u{0}']),
+    ('\u{13e5}', ['\u{13e5}', '\u{0}', '\u{0}']), ('\u{13e6}', ['\u{13e6}', '\u{0}', '\u{0}']),
+    ('\u{13e7}', ['\u{13e7}', '\u{0}', '\u{0}']), ('\u{13e8}', ['\u{13e8}', '\u{0}', '\u{0}']),
+    ('\u{13e9}', ['\u{13e9}', '\u{0}', '\u{0}']), ('\u{13ea}', ['\u{13ea}', '\u{0}', '\u{0}']),
+    ('\u{13eb}', ['\u{13eb}', '\u{0}', '\u{0}']), ('\u{13ec}', ['\u{13ec}', '\u{0}', '\u{0}']),
+    ('\u{13ed}', ['\u{13ed}', '\u{0}', '\u{0}']), ('\u{13ee}', ['\u{13ee}', '\u{0}', '\u{0}']),
+    ('\u{13ef}', ['\u{13ef}', '\u{0}', '\u{0}']), ('\u{13f0}', ['\u{13f0}', '\u{0}', '\u{0}']),
+    ('\u{13f1}', ['\u{13f1}', '\u{0}', '\u{0}']), ('\u{13f2}', ['\u{13f2}', '\u{0}', '\u{0}']),
+    ('\u{13f3}', ['\u{13f3}', '\u{0}', '\u{0}']), ('\u{13f4}', ['\u{13f4}', '\u{0}', '\u{0}']),
+    ('\u{13f5}', ['\u{13f5}', '\u{0}', '\u{0}']), ('\u{13f8}', ['\u{13f0}', '\u{0}', '\u{0}']),
+    ('\u{13f9}', ['\u{13f1}', '\u{0}', '\u{0}']), ('\u{13fa}', ['\u{13f2}', '\u{0}', '\u{0}']),
+    ('\u{13fb}', ['\u{13f3}', '\u{0}', '\u{0}']), ('\u{13fc}', ['\u{13f4}', '\u{0}', '\u{0}']),
+    ('\u{13fd}', ['\u{13f5}', '\u{0}', '\u{0}']), ('\u{1e9e}', ['s', 's', '\u{0}']),
+    ('\u{ab70}', ['\u{13a0}', '\u{0}', '\u{0}']), ('\u{ab71}', ['\u{13a1}', '\u{0}', '\u{0}']),
+    ('\u{ab72}', ['\u{13a2}', '\u{0}', '\u{0}']), ('\u{ab73}', ['\u{13a3}', '\u{0}', '\u{0}']),
+    ('\u{ab74}', ['\u{13a4}', '\u{0}', '\u{0}']), ('\u{ab75}', ['\u{13a5}', '\u{0}', '\u{0}']),
+    ('\u{ab76}', ['\u{13a6}', '\u{0}', '\u{0}']), ('\u{ab77}', ['\u{13a7}', '\u{0}', '\u{0}']),
+    ('\u{ab78}', ['\u{13a8}', '\u{0}', '\u{0}']), ('\u{ab79}', ['\u{13a9}', '\u{0}', '\u{0}']),
+    ('\u{ab7a}', ['\u{13aa}', '\u{0}', '\u{0}']), ('\u{ab7b}', ['\u{13ab}', '\u{0}', '\u{0}']),
+    ('\u{ab7c}', ['\u{13ac}', '\u{0}', '\u{0}']), ('\u{ab7d}', ['\u{13ad}', '\u{0}', '\u{0}']),
+    ('\u{ab7e}', ['\u{13ae}', '\u{0}', '\u{0}']), ('\u{ab7f}', ['\u{13af}', '\u{0}', '\u{0}']),
+    ('\u{ab80}', ['\u{13b0}', '\u{0}', '\u{0}']), ('\u{ab81}', ['\u{13b1}', '\u{0}', '\u{0}']),
+    ('\u{ab82}', ['\u{13b2}', '\u{0}', '\u{0}']), ('\u{ab83}', ['\u{13b3}', '\u{0}', '\u{0}']),
+    ('\u{ab84}', ['\u{13b4}', '\u{0}', '\u{0}']), ('\u{ab85}', ['\u{13b5}', '\u{0}', '\u{0}']),
+    ('\u{ab86}', ['\u{13b6}', '\u{0}', '\u{0}']), ('\u{ab87}', ['\u{13b7}', '\u{0}', '\u{0}']),
+    ('\u{ab88}', ['\u{13b8}', '\u{0}', '\u{0}']), ('\u{ab89}', ['\u{13b9}', '\u{0}', '\u{0}']),
+    ('\u{ab8a}', ['\u{13ba}', '\u{0}', '\u{0}']), ('\u{ab8b}', ['\u{13bb}', '\u{0}', '\u{0}']),
+    ('\u{ab8c}', ['\u{13bc}', '\u{0}', '\u{0}']), ('\u{ab8d}', ['\u{13bd}', '\u{0}', '\u{0}']),
+    ('\u{ab8e}', ['\u{13be}', '\u{0}', '\u{0}']), ('\u{ab8f}', ['\u{13bf}', '\u{0}', '\u{0}']),
+    ('\u{ab90}', ['\u{13c0}', '\u{0}', '\u{0}']), ('\u{ab91}', ['\u{13c1}', '\u{0}', '\u{0}']),
+    ('\u{ab92}', ['\u{13c2}', '\u{0}', '\u{0}']), ('\u{ab93}', ['\u{13c3}', '\u{0}', '\u{0}']),
+    ('\u{ab94}', ['\u{13c4}', '\u{0}', '\u{0}']), ('\u{ab95}', ['\u{13c5}', '\u{0}', '\u{0}']),
+    ('\u{ab96}', ['\u{13c6}', '\u{0}', '\u{0}']), ('\u{ab97}', ['\u{13c7}', '\u{0}', '\u{0}']),
+    ('\u{ab98}', ['\u{13c8}', '\u{0}', '\u{0}']), ('\u{ab99}', ['\u{13c9}', '\u{0}', '\u{0}']),
+    ('\u{ab9a}', ['\u{13ca}', '\u{0}', '\u{0}']), ('\u{ab9b}', ['\u{13cb}', '\u{0}', '\u{0}']),
+    ('\u{ab9c}', ['\u{13cc}', '\u{0}', '\u{0}']), ('\u{ab9d}', ['\u{13cd}', '\u{0}', '\u{0}']),
+    ('\u{ab9e}', ['\u{13ce}', '\u{0}', '\u{0}']), ('\u{ab9f}', ['\u{13cf}', '\u{0}', '\u{0}']),
+    ('\u{aba0}', ['\u{13d0}', '\u{0}', '\u{0}']), ('\u{aba1}', ['\u{13d1}', '\u{0}', '\u{0}']),
+    ('\u{aba2}', ['\u{13d2}', '\u{0}', '\u{0}']), ('\u{aba3}', ['\u{13d3}', '\u{0}', '\u{0}']),
+    ('\u{aba4}', ['\u{13d4}', '\u{0}', '\u{0}']), ('\u{aba5}', ['\u{13d5}', '\u{0}', '\u{0}']),
+    ('\u{aba6}', ['\u{13d6}', '\u{0}', '\u{0}']), ('\u{aba7}', ['\u{13d7}', '\u{0}', '\u{0}']),
+    ('\u{aba8}', ['\u{13d8}', '\u{0}', '\u{0}']), ('\u{aba9}', ['\u{13d9}', '\u{0}', '\u{0}']),
+    ('\u{abaa}', ['\u{13da}', '\u{0}', '\u{0}']), ('\u{abab}', ['\u{13db}', '\u{0}', '\u{0}']),
+    ('\u{abac}', ['\u{13dc}', '\u{0}', '\u{0}']), ('\u{abad}', ['\u{13dd}', '\u{0}', '\u{0}']),
+    ('\u{abae}', ['\u{13de}', '\u{0}', '\u{0}']), ('\u{abaf}', ['\u{13df}', '\u{0}', '\u{0}']),
+    ('\u{abb0}', ['\u{13e0}', '\u{0}', '\u{0}']), ('\u{abb1}', ['\u{13e1}', '\u{0}', '\u{0}']),
+    ('\u{abb2}', ['\u{13e2}', '\u{0}', '\u{0}']), ('\u{abb3}', ['\u{13e3}', '\u{0}', '\u{0}']),
+    ('\u{abb4}', ['\u{13e4}', '\u{0}', '\u{0}']), ('\u{abb5}', ['\u{13e5}', '\u{0}', '\u{0}']),
+    ('\u{abb6}', ['\u{13e6}', '\u{0}', '\u{0}']), ('\u{abb7}', ['\u{13e7}', '\u{0}', '\u{0}']),
+    ('\u{abb8}', ['\u{13e8}', '\u{0}', '\u{0}']), ('\u{abb9}', ['\u{13e9}', '\u{0}', '\u{0}']),
+    ('\u{abba}', ['\u{13ea}', '\u{0}', '\u{0}']), ('\u{abbb}', ['\u{13eb}', '\u{0}', '\u{0}']),
+    ('\u{abbc}', ['\u{13ec}', '\u{0}', '\u{0}']), ('\u{abbd}', ['\u{13ed}', '\u{0}', '\u{0}']),
+    ('\u{abbe}', ['\u{13ee}', '\u{0}', '\u{0}']), ('\u{abbf}', ['\u{13ef}', '\u{0}', '\u{0}']),
+];
diff --git a/library/proc_macro/src/bridge/client.rs b/library/proc_macro/src/bridge/client.rs
index 3d8ad71..31741a1 100644
--- a/library/proc_macro/src/bridge/client.rs
+++ b/library/proc_macro/src/bridge/client.rs
@@ -1,7 +1,6 @@
 //! Client-side types.
 
 use std::cell::RefCell;
-use std::marker::PhantomData;
 
 use super::*;
 
@@ -20,30 +19,35 @@ fn drop(&mut self) {
 }
 
 impl<S> Encode<S> for TokenStream {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         mem::ManuallyDrop::new(self).handle.encode(w, s);
     }
 }
 
 impl<S> Encode<S> for &TokenStream {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         self.handle.encode(w, s);
     }
 }
 
 impl<S> Decode<'_, '_, S> for TokenStream {
+    #[inline]
     fn decode(r: &mut &[u8], s: &mut S) -> Self {
         TokenStream { handle: handle::Handle::decode(r, s) }
     }
 }
 
 impl Encode<()> for crate::TokenStream {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut ()) {
         self.0.encode(w, s)
     }
 }
 
 impl Decode<'_, '_, ()> for crate::TokenStream {
+    #[inline]
     fn decode(r: &mut &[u8], s: &mut ()) -> Self {
         crate::TokenStream(Some(Decode::decode(r, s)))
     }
@@ -58,12 +62,14 @@ impl !Send for Span {}
 impl !Sync for Span {}
 
 impl<S> Encode<S> for Span {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         self.handle.encode(w, s);
     }
 }
 
 impl<S> Decode<'_, '_, S> for Span {
+    #[inline]
     fn decode(r: &mut &[u8], s: &mut S) -> Self {
         Span { handle: handle::Handle::decode(r, s) }
     }
@@ -201,26 +207,13 @@ pub(crate) fn is_available() -> bool {
 /// A client-side RPC entry-point, which may be using a different `proc_macro`
 /// from the one used by the server, but can be invoked compatibly.
 ///
-/// Note that the (phantom) `I` ("input") and `O` ("output") type parameters
-/// decorate the `Client<I, O>` with the RPC "interface" of the entry-point, but
-/// do not themselves participate in ABI, at all, only facilitate type-checking.
-///
-/// E.g. `Client<TokenStream, TokenStream>` is the common proc macro interface,
-/// used for `#[proc_macro] fn foo(input: TokenStream) -> TokenStream`,
-/// indicating that the RPC input and output will be serialized token streams,
-/// and forcing the use of APIs that take/return `S::TokenStream`, server-side.
+/// Note that the input and output type parameters are erased. They do not
+/// participate in the ABI, so while using the wrong runN method will likely
+/// result in a panic, it will not result in UB.
 #[repr(C)]
-pub struct Client<I, O> {
+#[derive(Copy, Clone)]
+pub struct Client {
     pub(super) run: extern "C" fn(BridgeConfig<'_>) -> Buffer,
-
-    pub(super) _marker: PhantomData<fn(I) -> O>,
-}
-
-impl<I, O> Copy for Client<I, O> {}
-impl<I, O> Clone for Client<I, O> {
-    fn clone(&self) -> Self {
-        *self
-    }
 }
 
 fn maybe_install_panic_hook(force_show_panics: bool) {
@@ -279,18 +272,15 @@ fn run_client<A: for<'a, 's> Decode<'a, 's, ()>>(
     buf
 }
 
-impl Client<crate::TokenStream, crate::TokenStream> {
+impl Client {
     pub const fn expand1(f: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy) -> Self {
         Client {
             run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
                 run_client(bridge, |input| f(input))
             }),
-            _marker: PhantomData,
         }
     }
-}
 
-impl Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream> {
     pub const fn expand2(
         f: impl Fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream + Copy,
     ) -> Self {
@@ -298,59 +288,6 @@ pub const fn expand2(
             run: super::selfless_reify::reify_to_extern_c_fn_hrt_bridge(move |bridge| {
                 run_client(bridge, |(input, input2)| f(input, input2))
             }),
-            _marker: PhantomData,
         }
     }
 }
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub enum ProcMacro {
-    CustomDerive {
-        trait_name: &'static str,
-        attributes: &'static [&'static str],
-        client: Client<crate::TokenStream, crate::TokenStream>,
-    },
-
-    Attr {
-        name: &'static str,
-        client: Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream>,
-    },
-
-    Bang {
-        name: &'static str,
-        client: Client<crate::TokenStream, crate::TokenStream>,
-    },
-}
-
-impl ProcMacro {
-    pub fn name(&self) -> &'static str {
-        match self {
-            ProcMacro::CustomDerive { trait_name, .. } => trait_name,
-            ProcMacro::Attr { name, .. } => name,
-            ProcMacro::Bang { name, .. } => name,
-        }
-    }
-
-    pub const fn custom_derive(
-        trait_name: &'static str,
-        attributes: &'static [&'static str],
-        expand: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy,
-    ) -> Self {
-        ProcMacro::CustomDerive { trait_name, attributes, client: Client::expand1(expand) }
-    }
-
-    pub const fn attr(
-        name: &'static str,
-        expand: impl Fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream + Copy,
-    ) -> Self {
-        ProcMacro::Attr { name, client: Client::expand2(expand) }
-    }
-
-    pub const fn bang(
-        name: &'static str,
-        expand: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy,
-    ) -> Self {
-        ProcMacro::Bang { name, client: Client::expand1(expand) }
-    }
-}
diff --git a/library/proc_macro/src/bridge/mod.rs b/library/proc_macro/src/bridge/mod.rs
index 72f4e2d..8a08222 100644
--- a/library/proc_macro/src/bridge/mod.rs
+++ b/library/proc_macro/src/bridge/mod.rs
@@ -162,9 +162,11 @@ struct Marked<T, M> {
 
 impl<T, M> Mark for Marked<T, M> {
     type Unmarked = T;
+    #[inline]
     fn mark(unmarked: Self::Unmarked) -> Self {
         Marked { value: unmarked, _marker: marker::PhantomData }
     }
+    #[inline]
     fn unmark(self) -> Self::Unmarked {
         self.value
     }
@@ -174,6 +176,7 @@ impl<'a, T> Mark for &'a Marked<T, client::TokenStream> {
     fn mark(_: Self::Unmarked) -> Self {
         unreachable!()
     }
+    #[inline]
     fn unmark(self) -> Self::Unmarked {
         &self.value
     }
@@ -181,10 +184,12 @@ fn unmark(self) -> Self::Unmarked {
 
 impl<T: Mark> Mark for Vec<T> {
     type Unmarked = Vec<T::Unmarked>;
+    #[inline]
     fn mark(unmarked: Self::Unmarked) -> Self {
         // Should be a no-op due to std's in-place collect optimizations.
         unmarked.into_iter().map(T::mark).collect()
     }
+    #[inline]
     fn unmark(self) -> Self::Unmarked {
         // Should be a no-op due to std's in-place collect optimizations.
         self.into_iter().map(T::unmark).collect()
@@ -196,9 +201,11 @@ macro_rules! mark_noop {
         $(
             impl Mark for $ty {
                 type Unmarked = Self;
+                #[inline]
                 fn mark(unmarked: Self::Unmarked) -> Self {
                     unmarked
                 }
+                #[inline]
                 fn unmark(self) -> Self::Unmarked {
                     self
                 }
@@ -276,11 +283,13 @@ macro_rules! mark_compound {
     (struct $name:ident <$($T:ident),+> { $($field:ident),* $(,)? }) => {
         impl<$($T: Mark),+> Mark for $name <$($T),+> {
             type Unmarked = $name <$($T::Unmarked),+>;
+            #[inline]
             fn mark(unmarked: Self::Unmarked) -> Self {
                 $name {
                     $($field: Mark::mark(unmarked.$field)),*
                 }
             }
+            #[inline]
             fn unmark(self) -> Self::Unmarked {
                 $name {
                     $($field: Mark::unmark(self.$field)),*
@@ -291,6 +300,7 @@ fn unmark(self) -> Self::Unmarked {
     (enum $name:ident <$($T:ident),+> { $($variant:ident $(($field:ident))?),* $(,)? }) => {
         impl<$($T: Mark),+> Mark for $name <$($T),+> {
             type Unmarked = $name <$($T::Unmarked),+>;
+            #[inline]
             fn mark(unmarked: Self::Unmarked) -> Self {
                 match unmarked {
                     $($name::$variant $(($field))? => {
@@ -298,6 +308,7 @@ fn mark(unmarked: Self::Unmarked) -> Self {
                     })*
                 }
             }
+            #[inline]
             fn unmark(self) -> Self::Unmarked {
                 match self {
                     $($name::$variant $(($field))? => {
diff --git a/library/proc_macro/src/bridge/rpc.rs b/library/proc_macro/src/bridge/rpc.rs
index de1aae5..63a246b 100644
--- a/library/proc_macro/src/bridge/rpc.rs
+++ b/library/proc_macro/src/bridge/rpc.rs
@@ -17,12 +17,14 @@ pub(super) trait Decode<'a, 's, S>: Sized {
 macro_rules! rpc_encode_decode {
     (le $ty:ty) => {
         impl<S> Encode<S> for $ty {
+            #[inline]
             fn encode(self, w: &mut Buffer, _: &mut S) {
                 w.extend_from_array(&self.to_le_bytes());
             }
         }
 
         impl<S> Decode<'_, '_, S> for $ty {
+            #[inline]
             fn decode(r: &mut &[u8], _: &mut S) -> Self {
                 const N: usize = size_of::<$ty>();
 
@@ -44,6 +46,7 @@ fn encode(self, w: &mut Buffer, s: &mut S) {
         impl<'a, S, $($($T: for<'s> Decode<'a, 's, S>),+)?> Decode<'a, '_, S>
             for $name $(<$($T),+>)?
         {
+            #[inline]
             fn decode(r: &mut &'a [u8], s: &mut S) -> Self {
                 $name {
                     $($field: Decode::decode(r, s)),*
@@ -59,6 +62,7 @@ fn decode(r: &mut &'a [u8], s: &mut S) -> Self {
             $(const $variant: u8 = Tag::$variant as u8;)*
 
             impl<S, $($($T: Encode<S>),+)?> Encode<S> for $name $(<$($T),+>)? {
+                #[inline]
                 fn encode(self, w: &mut Buffer, s: &mut S) {
                     match self {
                         $($name::$variant $(($field))* => {
@@ -72,6 +76,7 @@ fn encode(self, w: &mut Buffer, s: &mut S) {
             impl<'a, S, $($($T: for<'s> Decode<'a, 's, S>),+)?> Decode<'a, '_, S>
                 for $name $(<$($T),+>)?
             {
+                #[inline]
                 fn decode(r: &mut &'a [u8], s: &mut S) -> Self {
                     match u8::decode(r, s) {
                         $($variant => {
@@ -87,20 +92,24 @@ fn decode(r: &mut &'a [u8], s: &mut S) -> Self {
 }
 
 impl<S> Encode<S> for () {
+    #[inline]
     fn encode(self, _: &mut Buffer, _: &mut S) {}
 }
 
 impl<S> Decode<'_, '_, S> for () {
+    #[inline]
     fn decode(_: &mut &[u8], _: &mut S) -> Self {}
 }
 
 impl<S> Encode<S> for u8 {
+    #[inline]
     fn encode(self, w: &mut Buffer, _: &mut S) {
         w.push(self);
     }
 }
 
 impl<S> Decode<'_, '_, S> for u8 {
+    #[inline]
     fn decode(r: &mut &[u8], _: &mut S) -> Self {
         let x = r[0];
         *r = &r[1..];
@@ -117,6 +126,7 @@ fn decode(r: &mut &[u8], _: &mut S) -> Self {
 
 #[cfg(not(target_pointer_width = "64"))]
 impl<S> Encode<S> for usize {
+    #[inline]
     fn encode(self, w: &mut Buffer, _: &mut S) {
         const N: usize = size_of::<usize>();
 
@@ -131,6 +141,7 @@ fn encode(self, w: &mut Buffer, _: &mut S) {
 
 #[cfg(not(target_pointer_width = "64"))]
 impl<S> Decode<'_, '_, S> for usize {
+    #[inline]
     fn decode(r: &mut &[u8], _: &mut S) -> Self {
         const N: usize = size_of::<usize>();
         const {
@@ -146,12 +157,14 @@ fn decode(r: &mut &[u8], _: &mut S) -> Self {
 }
 
 impl<S> Encode<S> for bool {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         (self as u8).encode(w, s);
     }
 }
 
 impl<S> Decode<'_, '_, S> for bool {
+    #[inline]
     fn decode(r: &mut &[u8], s: &mut S) -> Self {
         match u8::decode(r, s) {
             0 => false,
@@ -162,18 +175,21 @@ fn decode(r: &mut &[u8], s: &mut S) -> Self {
 }
 
 impl<S> Encode<S> for NonZero<u32> {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         self.get().encode(w, s);
     }
 }
 
 impl<S> Decode<'_, '_, S> for NonZero<u32> {
+    #[inline]
     fn decode(r: &mut &[u8], s: &mut S) -> Self {
         Self::new(u32::decode(r, s)).unwrap()
     }
 }
 
 impl<S, A: Encode<S>, B: Encode<S>> Encode<S> for (A, B) {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         self.0.encode(w, s);
         self.1.encode(w, s);
@@ -183,12 +199,14 @@ fn encode(self, w: &mut Buffer, s: &mut S) {
 impl<'a, S, A: for<'s> Decode<'a, 's, S>, B: for<'s> Decode<'a, 's, S>> Decode<'a, '_, S>
     for (A, B)
 {
+    #[inline]
     fn decode(r: &mut &'a [u8], s: &mut S) -> Self {
         (Decode::decode(r, s), Decode::decode(r, s))
     }
 }
 
 impl<S> Encode<S> for &str {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         let bytes = self.as_bytes();
         bytes.len().encode(w, s);
@@ -197,6 +215,7 @@ fn encode(self, w: &mut Buffer, s: &mut S) {
 }
 
 impl<'a, S> Decode<'a, '_, S> for &'a str {
+    #[inline]
     fn decode(r: &mut &'a [u8], s: &mut S) -> Self {
         let len = usize::decode(r, s);
         let xs = &r[..len];
@@ -206,18 +225,21 @@ fn decode(r: &mut &'a [u8], s: &mut S) -> Self {
 }
 
 impl<S> Encode<S> for String {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         self[..].encode(w, s);
     }
 }
 
 impl<S> Decode<'_, '_, S> for String {
+    #[inline]
     fn decode(r: &mut &[u8], s: &mut S) -> Self {
         <&str>::decode(r, s).to_string()
     }
 }
 
 impl<S, T: Encode<S>> Encode<S> for Vec<T> {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         self.len().encode(w, s);
         for x in self {
@@ -227,6 +249,7 @@ fn encode(self, w: &mut Buffer, s: &mut S) {
 }
 
 impl<'a, S, T: for<'s> Decode<'a, 's, S>> Decode<'a, '_, S> for Vec<T> {
+    #[inline]
     fn decode(r: &mut &'a [u8], s: &mut S) -> Self {
         let len = usize::decode(r, s);
         let mut vec = Vec::with_capacity(len);
@@ -289,12 +312,14 @@ pub fn into_string(self) -> Option<String> {
 }
 
 impl<S> Encode<S> for PanicMessage {
+    #[inline]
     fn encode(self, w: &mut Buffer, s: &mut S) {
         self.as_str().encode(w, s);
     }
 }
 
 impl<S> Decode<'_, '_, S> for PanicMessage {
+    #[inline]
     fn decode(r: &mut &[u8], s: &mut S) -> Self {
         match Option::<String>::decode(r, s) {
             Some(s) => PanicMessage::String(s),
diff --git a/library/proc_macro/src/bridge/server.rs b/library/proc_macro/src/bridge/server.rs
index 6a739da..c97e07f 100644
--- a/library/proc_macro/src/bridge/server.rs
+++ b/library/proc_macro/src/bridge/server.rs
@@ -268,8 +268,8 @@ fn run_server<
     Result::decode(&mut &buf[..], &mut dispatcher.handle_store)
 }
 
-impl client::Client<crate::TokenStream, crate::TokenStream> {
-    pub fn run<S>(
+impl client::Client {
+    pub fn run1<S>(
         &self,
         strategy: &impl ExecutionStrategy,
         server: S,
@@ -279,14 +279,12 @@ pub fn run<S>(
     where
         S: Server,
     {
-        let client::Client { run, _marker } = *self;
+        let client::Client { run } = *self;
         run_server(strategy, server, <MarkedTokenStream<S>>::mark(input), run, force_show_panics)
             .map(|s| <Option<MarkedTokenStream<S>>>::unmark(s).unwrap_or_default())
     }
-}
 
-impl client::Client<(crate::TokenStream, crate::TokenStream), crate::TokenStream> {
-    pub fn run<S>(
+    pub fn run2<S>(
         &self,
         strategy: &impl ExecutionStrategy,
         server: S,
@@ -297,7 +295,7 @@ pub fn run<S>(
     where
         S: Server,
     {
-        let client::Client { run, _marker } = *self;
+        let client::Client { run } = *self;
         run_server(
             strategy,
             server,
diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs
index a01bf38..4d6e7cb 100644
--- a/library/proc_macro/src/lib.rs
+++ b/library/proc_macro/src/lib.rs
@@ -28,6 +28,7 @@
 #![feature(rustc_attrs)]
 #![feature(extend_one)]
 #![feature(mem_conjure_zst)]
+#![feature(f16)]
 #![recursion_limit = "256"]
 #![allow(internal_features)]
 #![deny(ffi_unwind_calls)]
@@ -44,7 +45,9 @@
 mod escape;
 mod to_tokens;
 
+use core::convert::From;
 use core::ops::BitOr;
+use std::borrow::Cow;
 use std::ffi::CStr;
 use std::ops::{Range, RangeBounds};
 use std::path::PathBuf;
@@ -53,8 +56,6 @@
 
 #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
 pub use diagnostic::{Diagnostic, Level, MultiSpan};
-#[unstable(feature = "proc_macro_value", issue = "136652")]
-pub use rustc_literal_escaper::EscapeError;
 use rustc_literal_escaper::{
     MixedUnit, unescape_byte, unescape_byte_str, unescape_c_str, unescape_char, unescape_str,
 };
@@ -64,6 +65,135 @@
 use crate::bridge::client::Methods as BridgeMethods;
 use crate::escape::{EscapeOptions, escape_bytes};
 
+/// Mostly relating to malformed escape sequences, but also a few other problems.
+#[unstable(feature = "proc_macro_value", issue = "136652")]
+#[derive(Debug, PartialEq, Eq)]
+#[non_exhaustive]
+pub enum EscapeError {
+    /// Expected 1 char, but 0 were found.
+    ZeroChars,
+    /// Expected 1 char, but more than 1 were found.
+    MoreThanOneChar,
+
+    /// Escaped '\' character without continuation.
+    LoneSlash,
+    /// Invalid escape character (e.g. '\z').
+    InvalidEscape,
+    /// Raw '\r' encountered.
+    BareCarriageReturn,
+    /// Raw '\r' encountered in raw string.
+    BareCarriageReturnInRawString,
+    /// Unescaped character that was expected to be escaped (e.g. raw '\t').
+    EscapeOnlyChar,
+
+    /// Numeric character escape is too short (e.g. '\x1').
+    TooShortHexEscape,
+    /// Invalid character in numeric escape (e.g. '\xz')
+    InvalidCharInHexEscape,
+    /// Character code in numeric escape is non-ascii (e.g. '\xFF').
+    OutOfRangeHexEscape,
+
+    /// '\u' not followed by '{'.
+    NoBraceInUnicodeEscape,
+    /// Non-hexadecimal value in '\u{..}'.
+    InvalidCharInUnicodeEscape,
+    /// '\u{}'
+    EmptyUnicodeEscape,
+    /// No closing brace in '\u{..}', e.g. '\u{12'.
+    UnclosedUnicodeEscape,
+    /// '\u{_12}'
+    LeadingUnderscoreUnicodeEscape,
+    /// More than 6 characters in '\u{..}', e.g. '\u{10FFFF_FF}'
+    OverlongUnicodeEscape,
+    /// Invalid in-bound unicode character code, e.g. '\u{DFFF}'.
+    LoneSurrogateUnicodeEscape,
+    /// Out of bounds unicode character code, e.g. '\u{FFFFFF}'.
+    OutOfRangeUnicodeEscape,
+
+    /// Unicode escape code in byte literal.
+    UnicodeEscapeInByte,
+    /// Non-ascii character in byte literal, byte string literal, or raw byte string literal.
+    NonAsciiCharInByte,
+
+    /// `\0` in a C string literal.
+    NulInCStr,
+
+    /// After a line ending with '\', the next line contains whitespace
+    /// characters that are not skipped.
+    UnskippedWhitespaceWarning,
+
+    /// After a line ending with '\', multiple lines are skipped.
+    MultipleSkippedLinesWarning,
+}
+
+#[unstable(feature = "proc_macro_value", issue = "136652")]
+#[doc(hidden)]
+impl From<rustc_literal_escaper::EscapeError> for EscapeError {
+    fn from(value: rustc_literal_escaper::EscapeError) -> Self {
+        use rustc_literal_escaper::EscapeError as EE;
+
+        match value {
+            EE::ZeroChars => Self::ZeroChars,
+            EE::MoreThanOneChar => Self::MoreThanOneChar,
+            EE::LoneSlash => Self::LoneSlash,
+            EE::InvalidEscape => Self::InvalidEscape,
+            EE::BareCarriageReturn => Self::BareCarriageReturn,
+            EE::BareCarriageReturnInRawString => Self::BareCarriageReturnInRawString,
+            EE::EscapeOnlyChar => Self::EscapeOnlyChar,
+            EE::TooShortHexEscape => Self::TooShortHexEscape,
+            EE::InvalidCharInHexEscape => Self::InvalidCharInHexEscape,
+            EE::OutOfRangeHexEscape => Self::OutOfRangeHexEscape,
+            EE::NoBraceInUnicodeEscape => Self::NoBraceInUnicodeEscape,
+            EE::InvalidCharInUnicodeEscape => Self::InvalidCharInUnicodeEscape,
+            EE::EmptyUnicodeEscape => Self::EmptyUnicodeEscape,
+            EE::UnclosedUnicodeEscape => Self::UnclosedUnicodeEscape,
+            EE::LeadingUnderscoreUnicodeEscape => Self::LeadingUnderscoreUnicodeEscape,
+            EE::OverlongUnicodeEscape => Self::OverlongUnicodeEscape,
+            EE::LoneSurrogateUnicodeEscape => Self::LoneSurrogateUnicodeEscape,
+            EE::OutOfRangeUnicodeEscape => Self::OutOfRangeUnicodeEscape,
+            EE::UnicodeEscapeInByte => Self::UnicodeEscapeInByte,
+            EE::NonAsciiCharInByte => Self::NonAsciiCharInByte,
+            EE::NulInCStr => Self::NulInCStr,
+            EE::UnskippedWhitespaceWarning => Self::UnskippedWhitespaceWarning,
+            EE::MultipleSkippedLinesWarning => Self::MultipleSkippedLinesWarning,
+        }
+    }
+}
+
+#[unstable(feature = "proc_macro_value", issue = "136652")]
+impl error::Error for EscapeError {}
+
+#[unstable(feature = "proc_macro_value", issue = "136652")]
+impl fmt::Display for EscapeError {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str(match self {
+            Self::ZeroChars => "zero chars",
+            Self::MoreThanOneChar => "more than one char",
+            Self::LoneSlash => "lone slash",
+            Self::InvalidEscape => "invalid escape",
+            Self::BareCarriageReturn => "bare carriage return",
+            Self::BareCarriageReturnInRawString => "bare carriage return in raw string",
+            Self::EscapeOnlyChar => "escape only char",
+            Self::TooShortHexEscape => "too short hex escape",
+            Self::InvalidCharInHexEscape => "invalid char in hex escape",
+            Self::OutOfRangeHexEscape => "out of range hex escape",
+            Self::NoBraceInUnicodeEscape => "no brace in unicode escape",
+            Self::InvalidCharInUnicodeEscape => "invalid char in unicode escape",
+            Self::EmptyUnicodeEscape => "empty unicode escape",
+            Self::UnclosedUnicodeEscape => "unclosed unicode escape",
+            Self::LeadingUnderscoreUnicodeEscape => "leading underscore unicode escape",
+            Self::OverlongUnicodeEscape => "overlong unicode escape",
+            Self::LoneSurrogateUnicodeEscape => "lone surrogate unicode escape",
+            Self::OutOfRangeUnicodeEscape => "out of range unicode escape",
+            Self::UnicodeEscapeInByte => "unicode escape in byte",
+            Self::NonAsciiCharInByte => "non ascii char in byte",
+            Self::NulInCStr => "nul in CStr",
+            Self::UnskippedWhitespaceWarning => "unskipped whitespace warning",
+            Self::MultipleSkippedLinesWarning => "multiple skipped lines warning",
+        })
+    }
+}
+
 /// Errors returned when trying to retrieve a literal unescaped value.
 #[unstable(feature = "proc_macro_value", issue = "136652")]
 #[derive(Debug, PartialEq, Eq)]
@@ -1183,6 +1313,63 @@ pub fn $name(n: $kind) -> Literal {
     )*)
 }
 
+macro_rules! integer_values {
+    ($($nb:ident => $fn_name:ident,)+) => {
+        $(
+            #[doc = concat!(
+                "Returns the unescaped `",
+                stringify!($nb),
+                "` value if the literal is a `",
+                stringify!($nb),
+                "` or if it's an \"unmarked\" integer which doesn't overflow.")]
+            #[unstable(feature = "proc_macro_value", issue = "136652")]
+            pub fn $fn_name(&self) -> Result<$nb, ConversionErrorKind> {
+                if self.0.kind != bridge::LitKind::Integer {
+                    return Err(ConversionErrorKind::InvalidLiteralKind);
+                }
+                self.with_symbol_and_suffix(|symbol, suffix| {
+                    match suffix {
+                        stringify!($nb) | "" => {
+                            let symbol = strip_underscores(symbol);
+                            let (number, base) = parse_number(&symbol);
+                            $nb::from_str_radix(&number, base as u32).map_err(|_| ConversionErrorKind::InvalidLiteralKind)
+                        }
+                        _ => Err(ConversionErrorKind::InvalidLiteralKind),
+                    }
+                })
+            }
+        )+
+    }
+}
+
+macro_rules! float_values {
+    ($($nb:ident => $fn_name:ident,)+) => {
+        $(
+            #[doc = concat!(
+                "Returns the unescaped `",
+                stringify!($nb),
+                "` value if the literal is a `",
+                stringify!($nb),
+                "` or if it's an \"unmarked\" float which doesn't overflow.")]
+            #[unstable(feature = "proc_macro_value", issue = "136652")]
+            pub fn $fn_name(&self) -> Result<$nb, ConversionErrorKind> {
+                if self.0.kind != bridge::LitKind::Float {
+                    return Err(ConversionErrorKind::InvalidLiteralKind);
+                }
+                self.with_symbol_and_suffix(|symbol, suffix| {
+                    match suffix {
+                        stringify!($nb) | "" => {
+                            let number = strip_underscores(symbol);
+                            $nb::from_str(&number).map_err(|_| ConversionErrorKind::InvalidLiteralKind)
+                        }
+                        _ => Err(ConversionErrorKind::InvalidLiteralKind),
+                    }
+                })
+            }
+        )+
+    }
+}
+
 impl Literal {
     fn new(kind: bridge::LitKind, value: &str, suffix: Option<&str>) -> Self {
         Literal(bridge::Literal {
@@ -1461,9 +1648,8 @@ fn get_hashes_str(num: u8) -> &'static str {
     #[unstable(feature = "proc_macro_value", issue = "136652")]
     pub fn byte_character_value(&self) -> Result<u8, ConversionErrorKind> {
         self.0.symbol.with(|symbol| match self.0.kind {
-            bridge::LitKind::Char => {
-                unescape_byte(symbol).map_err(ConversionErrorKind::FailedToUnescape)
-            }
+            bridge::LitKind::Char => unescape_byte(symbol)
+                .map_err(|err| ConversionErrorKind::FailedToUnescape(err.into())),
             _ => Err(ConversionErrorKind::InvalidLiteralKind),
         })
     }
@@ -1472,9 +1658,8 @@ pub fn byte_character_value(&self) -> Result<u8, ConversionErrorKind> {
     #[unstable(feature = "proc_macro_value", issue = "136652")]
     pub fn character_value(&self) -> Result<char, ConversionErrorKind> {
         self.0.symbol.with(|symbol| match self.0.kind {
-            bridge::LitKind::Char => {
-                unescape_char(symbol).map_err(ConversionErrorKind::FailedToUnescape)
-            }
+            bridge::LitKind::Char => unescape_char(symbol)
+                .map_err(|err| ConversionErrorKind::FailedToUnescape(err.into())),
             _ => Err(ConversionErrorKind::InvalidLiteralKind),
         })
     }
@@ -1497,7 +1682,7 @@ pub fn str_value(&self) -> Result<String, ConversionErrorKind> {
                             Ok(c) => buf.push(c),
                             Err(err) => {
                                 if err.is_fatal() {
-                                    error = Some(ConversionErrorKind::FailedToUnescape(err));
+                                    error = Some(ConversionErrorKind::FailedToUnescape(err.into()));
                                 }
                             }
                         },
@@ -1528,7 +1713,7 @@ pub fn cstr_value(&self) -> Result<Vec<u8>, ConversionErrorKind> {
                     Ok(MixedUnit::HighByte(b)) => buf.push(b.get()),
                     Err(err) => {
                         if err.is_fatal() {
-                            error = Some(ConversionErrorKind::FailedToUnescape(err));
+                            error = Some(ConversionErrorKind::FailedToUnescape(err.into()));
                         }
                     }
                 });
@@ -1564,7 +1749,7 @@ pub fn byte_str_value(&self) -> Result<Vec<u8>, ConversionErrorKind> {
                     Ok(b) => buf.push(b),
                     Err(err) => {
                         if err.is_fatal() {
-                            error = Some(ConversionErrorKind::FailedToUnescape(err));
+                            error = Some(ConversionErrorKind::FailedToUnescape(err.into()));
                         }
                     }
                 });
@@ -1578,6 +1763,82 @@ pub fn byte_str_value(&self) -> Result<Vec<u8>, ConversionErrorKind> {
             _ => Err(ConversionErrorKind::InvalidLiteralKind),
         })
     }
+
+    integer_values! {
+        u8 => u8_value,
+        u16 => u16_value,
+        u32 => u32_value,
+        u64 => u64_value,
+        u128 => u128_value,
+        i8 => i8_value,
+        i16 => i16_value,
+        i32 => i32_value,
+        i64 => i64_value,
+        i128 => i128_value,
+    }
+
+    float_values! {
+        f16 => f16_value,
+        f32 => f32_value,
+        f64 => f64_value,
+        // FIXME: `f128` doesn't implement `FromStr` for the moment so we cannot obtain it from
+        // a `&str`. To be uncommented when it's added.
+        // f128 => f128_value,
+    }
+}
+
+#[repr(u32)]
+#[derive(PartialEq, Eq)]
+enum Base {
+    Decimal = 10,
+    Binary = 2,
+    Octal = 8,
+    Hexadecimal = 16,
+}
+
+fn parse_number(value: &str) -> (&str, Base) {
+    let mut iter = value.as_bytes().iter().copied();
+    let Some(first_digit) = iter.next() else {
+        return ("0", Base::Decimal);
+    };
+    let Some(second_digit) = iter.next() else {
+        return (value, Base::Decimal);
+    };
+
+    let mut base = Base::Decimal;
+    if first_digit == b'0' {
+        // Attempt to parse encoding base.
+        match second_digit {
+            b'b' => {
+                base = Base::Binary;
+            }
+            b'o' => {
+                base = Base::Octal;
+            }
+            b'x' => {
+                base = Base::Hexadecimal;
+            }
+            _ => {}
+        }
+    }
+
+    let offset = if base == Base::Decimal { 0 } else { 2 };
+
+    (&value[offset..], base)
+}
+
+fn strip_underscores(value_s: &str) -> Cow<'_, str> {
+    let value = value_s.as_bytes();
+    if value.iter().copied().all(|c| c != b'_' && c != b'f') {
+        return Cow::Borrowed(value_s);
+    }
+    let mut output = String::with_capacity(value.len());
+    for c in value.iter().copied() {
+        if c != b'_' {
+            output.push(c as char);
+        }
+    }
+    Cow::Owned(output)
 }
 
 /// Parse a single literal from its stringified representation.
diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs
index 62afcfe..eb619aa 100644
--- a/library/std/src/fs/tests.rs
+++ b/library/std/src/fs/tests.rs
@@ -2182,7 +2182,13 @@ fn test_rename_directory_to_non_empty_directory() {
     fs::write(target_path.join("target_file.txt"), b"target hello world").unwrap();
 
     let err = fs::rename(source_path, target_path).unwrap_err();
-    assert_eq!(err.kind(), ErrorKind::DirectoryNotEmpty);
+    assert_matches!(
+        err.kind(),
+        // On ext4, ntfs, apfs, tmpfs, and btrfs `DirectoryNotEmpty` is returned.
+        // On xfs `AlreadyExists` is returned.
+        ErrorKind::DirectoryNotEmpty | ErrorKind::AlreadyExists,
+        "Expected DirectoryNotEmpty or AlreadyExists error, got {err}"
+    );
 }
 
 #[test]
diff --git a/library/std/src/io/buffered/linewritershim.rs b/library/std/src/io/buffered/linewritershim.rs
index 967e248..fc250e6 100644
--- a/library/std/src/io/buffered/linewritershim.rs
+++ b/library/std/src/io/buffered/linewritershim.rs
@@ -40,15 +40,88 @@ fn buffered(&self) -> &[u8] {
         self.buffer.buffer()
     }
 
-    /// Flushes the buffer iff the last byte is a newline (indicating that an
-    /// earlier write only succeeded partially, and we want to retry flushing
-    /// the buffered line before continuing with a subsequent write).
+    /// Flushes the buffer if and only if the last byte is a newline
+    /// (indicating that an earlier write only succeeded partially, and we
+    /// want to retry flushing the buffered line before continuing with a
+    /// subsequent write).
     fn flush_if_completed_line(&mut self) -> io::Result<()> {
         match self.buffered().last().copied() {
             Some(b'\n') => self.buffer.flush_buf(),
             _ => Ok(()),
         }
     }
+
+    /// Vectored line-buffered write over an already-capped list of buffers.
+    ///
+    /// The caller is responsible for trimming `bufs` to the prefix it is
+    /// willing to scan (see `MAX_BUFS_TO_SCAN`). This method only ever writes
+    /// or buffers bytes from `bufs`, so any newline it might bury in the
+    /// `BufWriter` is one it has itself scanned for -- buffers the caller
+    /// dropped past the cap can never end up stuck in the buffer. Bytes not
+    /// accounted for in the return value are left for the next call.
+    fn write_vectored_scanned(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
+        // Find the buffer containing the last newline.
+        let last_newline_buf_idx = bufs
+            .iter()
+            .enumerate()
+            .rev()
+            .find_map(|(i, buf)| memchr::memchr(b'\n', buf).map(|_| i));
+
+        // If there are no new newlines (that is, if this write is less than
+        // one line), just do a regular buffered write.
+        let last_newline_buf_idx = match last_newline_buf_idx {
+            None => {
+                self.flush_if_completed_line()?;
+                return self.buffer.write_vectored(bufs);
+            }
+            Some(i) => i,
+        };
+
+        // Flush existing content to prepare for our write.
+        self.buffer.flush_buf()?;
+
+        // This is what we're going to try to write directly to the inner
+        // writer. The rest will be buffered, if nothing goes wrong.
+        let (lines, tail) = bufs.split_at(last_newline_buf_idx + 1);
+
+        // Write `lines` directly to the inner writer. In keeping with the
+        // `write` convention, make at most one attempt to add new (unbuffered)
+        // data. Because this write doesn't touch the BufWriter state directly,
+        // and the buffer is known to be empty, we don't need to worry about
+        // self.panicked here.
+        let flushed = self.inner_mut().write_vectored(lines)?;
+
+        // If inner returns Ok(0), propagate that to the caller without
+        // doing additional buffering; otherwise we're just guaranteeing
+        // an "ErrorKind::WriteZero" later.
+        if flushed == 0 {
+            return Ok(0);
+        }
+
+        // Don't try to reconstruct the exact amount written; just bail
+        // in the event of a partial write.
+        let mut lines_len: usize = 0;
+        for buf in lines {
+            // With overlapping/duplicate slices the total length may in theory
+            // exceed usize::MAX
+            lines_len = lines_len.saturating_add(buf.len());
+            if flushed < lines_len {
+                return Ok(flushed);
+            }
+        }
+
+        // Now that the write has succeeded, buffer the rest (or as much of the
+        // rest as possible). `tail` is the part of the scanned prefix after the
+        // last newline, so it cannot contain a newline of its own.
+        let buffered: usize = tail
+            .iter()
+            .filter(|buf| !buf.is_empty())
+            .map(|buf| self.buffer.write_to_buf(buf))
+            .take_while(|&n| n > 0)
+            .sum();
+
+        Ok(flushed + buffered)
+    }
 }
 
 impl<'a, W: ?Sized + Write> Write for LineWriterShim<'a, W> {
@@ -185,71 +258,26 @@ fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
             };
         }
 
-        // Find the buffer containing the last newline
-        // FIXME: This is overly slow if there are very many bufs and none contain
-        // newlines. e.g. writev() on Linux only writes up to 1024 slices, so
-        // scanning the rest is wasted effort. This makes write_all_vectored()
-        // quadratic.
-        let last_newline_buf_idx = bufs
-            .iter()
-            .enumerate()
-            .rev()
-            .find_map(|(i, buf)| memchr::memchr(b'\n', buf).map(|_| i));
-
-        // If there are no new newlines (that is, if this write is less than
-        // one line), just do a regular buffered write
-        let last_newline_buf_idx = match last_newline_buf_idx {
-            // No newlines; just do a normal buffered write
-            None => {
-                self.flush_if_completed_line()?;
-                return self.buffer.write_vectored(bufs);
-            }
-            Some(i) => i,
-        };
-
-        // Flush existing content to prepare for our write
-        self.buffer.flush_buf()?;
-
-        // This is what we're going to try to write directly to the inner
-        // writer. The rest will be buffered, if nothing goes wrong.
-        let (lines, tail) = bufs.split_at(last_newline_buf_idx + 1);
-
-        // Write `lines` directly to the inner writer. In keeping with the
-        // `write` convention, make at most one attempt to add new (unbuffered)
-        // data. Because this write doesn't touch the BufWriter state directly,
-        // and the buffer is known to be empty, we don't need to worry about
-        // self.panicked here.
-        let flushed = self.inner_mut().write_vectored(lines)?;
-
-        // If inner returns Ok(0), propagate that to the caller without
-        // doing additional buffering; otherwise we're just guaranteeing
-        // an "ErrorKind::WriteZero" later.
-        if flushed == 0 {
-            return Ok(0);
-        }
-
-        // Don't try to reconstruct the exact amount written; just bail
-        // in the event of a partial write
-        let mut lines_len: usize = 0;
-        for buf in lines {
-            // With overlapping/duplicate slices the total length may in theory
-            // exceed usize::MAX
-            lines_len = lines_len.saturating_add(buf.len());
-            if flushed < lines_len {
-                return Ok(flushed);
-            }
-        }
-
-        // Now that the write has succeeded, buffer the rest (or as much of the
-        // rest as possible)
-        let buffered: usize = tail
-            .iter()
-            .filter(|buf| !buf.is_empty())
-            .map(|buf| self.buffer.write_to_buf(buf))
-            .take_while(|&n| n > 0)
-            .sum();
-
-        Ok(flushed + buffered)
+        // Only scan (and operate on) the first MAX_BUFS_TO_SCAN slices. The cap
+        // is what keeps write_all_vectored() from going quadratic when callers
+        // pass many newline-free slices -- without it, every iteration of the
+        // outer loop rescans every remaining buffer. 1024 is a portable,
+        // generous upper bound: it is the value of UIO_MAXIOV / IOV_MAX on
+        // Linux and the BSDs (and the hardcoded cap in
+        // sys::net::connection::socket::solid), so on those platforms it also
+        // lines up with the most a single writev() can retire. On platforms
+        // whose syscall cap is smaller (POSIX requires only 16) or that have no
+        // cap at all (Windows), the constant still serves its primary purpose
+        // of bounding scan work.
+        //
+        // Everything past the cap is left untouched for the next call; the
+        // outer loop in write_all_vectored() makes forward progress via the
+        // short return value, and correctness is preserved everywhere. We hand
+        // the capped prefix to a helper so the rest of the logic can only ever
+        // see -- and therefore only ever write or buffer -- buffers we have
+        // actually scanned for newlines.
+        const MAX_BUFS_TO_SCAN: usize = 1024;
+        self.write_vectored_scanned(&bufs[..bufs.len().min(MAX_BUFS_TO_SCAN)])
     }
 
     fn is_write_vectored(&self) -> bool {
diff --git a/library/std/src/io/buffered/tests.rs b/library/std/src/io/buffered/tests.rs
index 742e753..8888ffa 100644
--- a/library/std/src/io/buffered/tests.rs
+++ b/library/std/src/io/buffered/tests.rs
@@ -752,6 +752,133 @@ fn err() -> io::Error {
     }
 }
 
+/// Regression test for the quadratic scan in `LineWriterShim::write_vectored`.
+///
+/// When given a long list of newline-free buffers and a sink that only
+/// retires a few slices per call, the previous implementation rescanned all
+/// remaining buffers on every iteration of `write_all_vectored`, producing
+/// O(N^2) work. The fix caps the scan to a constant prefix; this test
+/// verifies that bytes still come out in order when the only newline lives
+/// past that cap.
+#[test]
+fn line_vectored_long_input_past_scan_cap() {
+    /// Vectored sink that retires at most one non-empty slice per call,
+    /// mimicking a writev() bounded by IOV_MAX.
+    #[derive(Default)]
+    struct OneSliceSink {
+        buffer: Vec<u8>,
+    }
+
+    impl Write for OneSliceSink {
+        fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+            self.buffer.extend_from_slice(buf);
+            Ok(buf.len())
+        }
+        fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
+            for b in bufs {
+                if !b.is_empty() {
+                    self.buffer.extend_from_slice(b);
+                    return Ok(b.len());
+                }
+            }
+            Ok(0)
+        }
+        fn flush(&mut self) -> io::Result<()> {
+            Ok(())
+        }
+        fn is_write_vectored(&self) -> bool {
+            true
+        }
+    }
+
+    // Place the only newline well past the 1024-slice scan cap.
+    const N: usize = 1500;
+    const NEWLINE_AT: usize = 1400;
+    let bytes: Vec<u8> = (0..N).map(|i| if i == NEWLINE_AT { b'\n' } else { b'a' }).collect();
+    let mut io_slices: Vec<IoSlice<'_>> = bytes.chunks(1).map(IoSlice::new).collect();
+
+    let mut writer = LineWriter::new(OneSliceSink::default());
+    writer.write_all_vectored(&mut io_slices).unwrap();
+
+    // The newline past the scan cap must still trigger a flush through
+    // the inner writer; only the tail after the newline may remain buffered.
+    assert_eq!(writer.get_ref().buffer, bytes[..=NEWLINE_AT]);
+
+    writer.flush().unwrap();
+    assert_eq!(writer.get_ref().buffer, bytes);
+}
+
+/// Regression test for newlines buried past the `write_vectored` scan cap.
+///
+/// `LineWriterShim::write_vectored` only scans a bounded prefix of the slice
+/// list for newlines. An earlier version computed the head/tail split against
+/// the *full* list, so when more than the cap's worth of slices were passed in
+/// a single call and one of the unscanned slices held a newline, that newline
+/// was silently copied into the inner `BufWriter` instead of being flushed --
+/// leaving a completed line stuck in the buffer.
+///
+/// The invariant this checks is the core line-buffering guarantee: once all
+/// input has been written, everything up to and including the *last* newline
+/// must have reached the inner writer, and only the trailing partial line may
+/// remain buffered. It holds regardless of the exact scan-cap value, and it is
+/// driven through the public `write_all_vectored` entry point so the cap
+/// boundary is crossed naturally.
+#[test]
+fn line_vectored_flushes_newline_past_scan_cap() {
+    /// Vectored sink that accepts every slice in full, so any data that fails
+    /// to reach it must have been (incorrectly) left in the LineWriter buffer.
+    #[derive(Default)]
+    struct FullSink {
+        buffer: Vec<u8>,
+    }
+
+    impl Write for FullSink {
+        fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+            self.buffer.extend_from_slice(buf);
+            Ok(buf.len())
+        }
+        fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
+            let mut written = 0;
+            for b in bufs {
+                self.buffer.extend_from_slice(b);
+                written += b.len();
+            }
+            Ok(written)
+        }
+        fn flush(&mut self) -> io::Result<()> {
+            Ok(())
+        }
+        fn is_write_vectored(&self) -> bool {
+            true
+        }
+    }
+
+    // Two newlines: one comfortably inside the scan cap and one well past it,
+    // so a single `write_vectored` call sees the first but not the second.
+    const N: usize = 1100;
+    const FIRST_NEWLINE: usize = 5;
+    const LAST_NEWLINE: usize = 1050;
+    let bytes: Vec<u8> = (0..N)
+        .map(|i| if i == FIRST_NEWLINE || i == LAST_NEWLINE { b'\n' } else { b'a' })
+        .collect();
+    let mut io_slices: Vec<IoSlice<'_>> = bytes.chunks(1).map(IoSlice::new).collect();
+
+    // The buffer has to be large enough to hold the whole tail past the first
+    // newline; otherwise it fills up before the buggy split would even reach
+    // the second newline, masking the bug.
+    let mut writer = LineWriter::with_capacity(4096, FullSink::default());
+    writer.write_all_vectored(&mut io_slices).unwrap();
+
+    // Everything up to and including the last newline must have been flushed;
+    // only the trailing partial line is allowed to remain buffered. The buggy
+    // version left the last newline buried in the buffer, so the sink only saw
+    // up to the first newline.
+    assert_eq!(writer.get_ref().buffer, bytes[..=LAST_NEWLINE]);
+
+    writer.flush().unwrap();
+    assert_eq!(writer.get_ref().buffer, bytes);
+}
+
 /// Test that, in cases where vectored writing is not enabled, the
 /// LineWriter uses the normal `write` call, which more-correctly handles
 /// partial lines
diff --git a/library/std/src/os/motor/ffi.rs b/library/std/src/os/motor/ffi.rs
index 36531d4..08fa4d2 100644
--- a/library/std/src/os/motor/ffi.rs
+++ b/library/std/src/os/motor/ffi.rs
@@ -5,9 +5,6 @@
 use crate::sys::{AsInner, IntoInner};
 
 /// Motor OS–specific extensions to [`OsString`].
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 pub impl(self) trait OsStringExt {
     /// Yields the underlying UTF-8 string of this [`OsString`].
     ///
@@ -23,9 +20,6 @@ fn into_string(self) -> String {
 }
 
 /// Motor OS–specific extensions to [`OsString`].
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 pub impl(self) trait OsStrExt {
     /// Gets the underlying UTF-8 string view of the [`OsStr`] slice.
     ///
diff --git a/library/std/src/os/unix/ffi/os_str.rs b/library/std/src/os/unix/ffi/os_str.rs
index 8779224..5beabd5 100644
--- a/library/std/src/os/unix/ffi/os_str.rs
+++ b/library/std/src/os/unix/ffi/os_str.rs
@@ -7,9 +7,6 @@
 // Keep this in mind when applying changes to this file that only apply to `unix`.
 
 /// Platform-specific extensions to [`OsString`].
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub impl(self) trait OsStringExt {
     /// Creates an [`OsString`] from a byte vector.
@@ -38,9 +35,6 @@ fn into_vec(self) -> Vec<u8> {
 }
 
 /// Platform-specific extensions to [`OsStr`].
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub impl(self) trait OsStrExt {
     #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs
index 8a15dda..827146d 100644
--- a/library/std/src/os/unix/fs.rs
+++ b/library/std/src/os/unix/fs.rs
@@ -1008,7 +1008,7 @@ fn ino(&self) -> u64 {
     }
 }
 
-/// Sealed Unix-specific extension methods for [`fs::DirEntry`].
+/// Unix-specific extension methods for [`fs::DirEntry`].
 #[unstable(feature = "dir_entry_ext2", issue = "85573")]
 pub impl(self) trait DirEntryExt2 {
     /// Returns a reference to the underlying `OsStr` of this entry's filename.
diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs
index c64859d..b0a4150 100644
--- a/library/std/src/os/unix/process.rs
+++ b/library/std/src/os/unix/process.rs
@@ -30,9 +30,6 @@
 }
 
 /// Unix-specific extensions to the [`process::Command`] builder.
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub impl(self) trait CommandExt {
     /// Sets the child process's user ID. This translates to a
@@ -286,9 +283,6 @@ fn setsid(&mut self, setsid: bool) -> &mut process::Command {
 ///
 /// A Unix wait status (a Rust `ExitStatus`) can represent a Unix exit status, but can also
 /// represent other kinds of process event.
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub impl(self) trait ExitStatusExt {
     /// Creates a new `ExitStatus` or `ExitStatusError` from the raw underlying integer status
diff --git a/library/std/src/os/windows/ffi.rs b/library/std/src/os/windows/ffi.rs
index 9d5af1b..ed93397 100644
--- a/library/std/src/os/windows/ffi.rs
+++ b/library/std/src/os/windows/ffi.rs
@@ -62,9 +62,6 @@
 use crate::sys::{AsInner, FromInner};
 
 /// Windows-specific extensions to [`OsString`].
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub impl(self) trait OsStringExt {
     /// Creates an `OsString` from a potentially ill-formed UTF-16 slice of
@@ -96,9 +93,6 @@ fn from_wide(wide: &[u16]) -> OsString {
 }
 
 /// Windows-specific extensions to [`OsStr`].
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub impl(self) trait OsStrExt {
     /// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially
diff --git a/library/std/src/os/windows/process.rs b/library/std/src/os/windows/process.rs
index 65f63db..3332714 100644
--- a/library/std/src/os/windows/process.rs
+++ b/library/std/src/os/windows/process.rs
@@ -148,9 +148,6 @@ fn from(handle: OwnedHandle) -> process::ChildStderr {
 }
 
 /// Windows-specific extensions to [`process::ExitStatus`].
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[stable(feature = "exit_status_from", since = "1.12.0")]
 pub impl(self) trait ExitStatusExt {
     /// Creates a new `ExitStatus` from the raw underlying `u32` return value of
@@ -167,9 +164,6 @@ fn from_raw(raw: u32) -> Self {
 }
 
 /// Windows-specific extensions to the [`process::Command`] builder.
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[stable(feature = "windows_process_extensions", since = "1.16.0")]
 pub impl(self) trait CommandExt {
     /// Sets the [process creation flags][1] to be passed to `CreateProcess`.
@@ -456,9 +450,6 @@ fn main_thread_handle(&self) -> BorrowedHandle<'_> {
 }
 
 /// Windows-specific extensions to [`process::ExitCode`].
-///
-/// This trait is sealed: it cannot be implemented outside the standard library.
-/// This is so that future additional methods are not breaking changes.
 #[unstable(feature = "windows_process_exit_code_from", issue = "111688")]
 pub impl(self) trait ExitCodeExt {
     /// Creates a new `ExitCode` from the raw underlying `u32` return value of
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 2d1f6a2..cfcaabf 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -1803,14 +1803,13 @@ pub fn into_os_string(self) -> OsString {
     /// # Examples
     ///
     /// ```
-    /// #![feature(pathbuf_into_string)]
     /// use std::path::PathBuf;
     ///
     /// let path_buf = PathBuf::from("foo");
     /// let string = path_buf.into_string();
     /// assert_eq!(string, Ok(String::from("foo")));
     /// ```
-    #[unstable(feature = "pathbuf_into_string", issue = "156203")]
+    #[stable(feature = "pathbuf_into_string", since = "CURRENT_RUSTC_VERSION")]
     pub fn into_string(self) -> Result<String, PathBuf> {
         self.into_os_string().into_string().map_err(PathBuf::from)
     }
diff --git a/library/std/src/process.rs b/library/std/src/process.rs
index feead5b..9da5bf6 100644
--- a/library/std/src/process.rs
+++ b/library/std/src/process.rs
@@ -1062,6 +1062,26 @@ pub fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Command {
     ///
     /// By default, stdin, stdout and stderr are inherited from the parent.
     ///
+    /// # Errors
+    ///
+    /// This method returns an [`io::Error`] if the child process could not be
+    /// spawned. Common reasons include:
+    ///
+    /// * the program could not be found (for example, it does not exist, or,
+    ///   when given a bare name, it is not present in the `PATH`);
+    /// * the current process does not have permission to execute the program
+    ///   (for example, the file is not marked executable, or execution is
+    ///   denied by a security policy such as `seccomp`);
+    /// * the operating system could not create the new process because of
+    ///   resource exhaustion (for example, a limit on the number of processes
+    ///   was reached).
+    ///
+    /// An error is only returned for failures that occur while the child is
+    /// being spawned. Once the child has started successfully, anything that
+    /// happens to it afterwards — including being terminated by a signal — is
+    /// reported through its [`ExitStatus`] rather than as an error from the
+    /// spawning method.
+    ///
     /// # Examples
     ///
     /// ```no_run
@@ -1084,6 +1104,20 @@ pub fn spawn(&mut self) -> io::Result<Child> {
     /// attempt by the child process to read from the stdin stream will result
     /// in the stream immediately closing.
     ///
+    /// # Errors
+    ///
+    /// Like [`spawn`], this method returns an [`io::Error`] if the child
+    /// process could not be spawned; see [`spawn`] for the common reasons. It
+    /// may also return an error if reading the child's output or waiting on the
+    /// child fails.
+    ///
+    /// Note that this method does **not** return an error if the child runs and
+    /// then exits unsuccessfully, or is terminated by a signal. In those cases
+    /// it still returns [`Ok`], and the outcome is reflected in the
+    /// [`ExitStatus`] stored in the returned [`Output`].
+    ///
+    /// [`spawn`]: Command::spawn
+    ///
     /// # Examples
     ///
     /// ```should_panic
@@ -1111,6 +1145,19 @@ pub fn output(&mut self) -> io::Result<Output> {
     ///
     /// By default, stdin, stdout and stderr are inherited from the parent.
     ///
+    /// # Errors
+    ///
+    /// Like [`spawn`], this method returns an [`io::Error`] if the child
+    /// process could not be spawned; see [`spawn`] for the common reasons. It
+    /// may also return an error if waiting on the child fails.
+    ///
+    /// Note that this method does **not** return an error if the child runs and
+    /// then exits unsuccessfully, or is terminated by a signal. In those cases
+    /// it still returns [`Ok`], and the outcome is reflected in the returned
+    /// [`ExitStatus`].
+    ///
+    /// [`spawn`]: Command::spawn
+    ///
     /// # Examples
     ///
     /// ```should_panic
diff --git a/library/std/src/random.rs b/library/std/src/random.rs
index 8274060..c00dc3e 100644
--- a/library/std/src/random.rs
+++ b/library/std/src/random.rs
@@ -45,7 +45,9 @@
 /// TEEOS                  | `TEE_GenerateRandom`
 /// UEFI                   | [`EFI_RNG_PROTOCOL`](https://uefi.org/specs/UEFI/2.10/37_Secure_Technologies.html#random-number-generator-protocol)
 /// VxWorks                | `randABytes` after waiting for `randSecure` to become ready
-/// WASI                   | [`random_get`](https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#-random_getbuf-pointeru8-buf_len-size---result-errno)
+/// WASIp1                 | [`random_get`](https://github.com/WebAssembly/WASI/blob/wasi-0.1/preview1/docs.md#-random_getbuf-pointeru8-buf_len-size---result-errno)
+/// WASIp2                 | [`get-random-bytes`]
+/// WASIp3                 | [`get-random-bytes`]
 /// ZKVM                   | `sys_rand`
 ///
 /// Note that the sources used might change over time.
@@ -56,6 +58,7 @@
 ///
 /// [`getrandom`]: https://www.man7.org/linux/man-pages/man2/getrandom.2.html
 /// [`/dev/urandom`]: https://www.man7.org/linux/man-pages/man4/random.4.html
+/// [`get-random-bytes`]: https://github.com/WebAssembly/WASI/blob/main/proposals/random/imports.md#get-random-bytes-func
 #[doc(alias = "getrandom", alias = "getentropy", alias = "arc4random")]
 #[derive(Default, Debug, Clone, Copy)]
 #[unstable(feature = "random", issue = "130703")]
diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs
index eefec06..c922126 100644
--- a/library/std/src/sys/fs/unix.rs
+++ b/library/std/src/sys/fs/unix.rs
@@ -1441,269 +1441,148 @@ unsafe fn os_datasync(fd: c_int) -> c_int {
         }
     }
 
-    #[cfg(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    ))]
     pub fn lock(&self) -> io::Result<()> {
-        cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_EX) })?;
-        return Ok(());
+        cfg_select! {
+            any(
+                target_os = "freebsd",
+                target_os = "fuchsia",
+                target_os = "hurd",
+                target_os = "linux",
+                target_os = "netbsd",
+                target_os = "openbsd",
+                target_os = "cygwin",
+                target_os = "illumos",
+                target_os = "aix",
+                target_os = "android",
+                target_vendor = "apple",
+            ) => {
+                cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_EX) })?;
+                return Ok(());
+            }
+            _ => {
+                Err(io::const_error!(io::ErrorKind::Unsupported, "lock() not supported"))
+            }
+        }
     }
 
-    #[cfg(target_os = "solaris")]
-    pub fn lock(&self) -> io::Result<()> {
-        let mut flock: libc::flock = unsafe { mem::zeroed() };
-        flock.l_type = libc::F_WRLCK as libc::c_short;
-        flock.l_whence = libc::SEEK_SET as libc::c_short;
-        cvt(unsafe { libc::fcntl(self.as_raw_fd(), libc::F_SETLKW, &flock) })?;
-        Ok(())
-    }
-
-    #[cfg(not(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "solaris",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    )))]
-    pub fn lock(&self) -> io::Result<()> {
-        Err(io::const_error!(io::ErrorKind::Unsupported, "lock() not supported"))
-    }
-
-    #[cfg(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    ))]
     pub fn lock_shared(&self) -> io::Result<()> {
-        cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_SH) })?;
-        return Ok(());
+        cfg_select! {
+            any(
+                target_os = "freebsd",
+                target_os = "fuchsia",
+                target_os = "hurd",
+                target_os = "linux",
+                target_os = "netbsd",
+                target_os = "openbsd",
+                target_os = "cygwin",
+                target_os = "illumos",
+                target_os = "aix",
+                target_os = "android",
+                target_vendor = "apple",
+            ) => {
+                cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_SH) })?;
+                return Ok(());
+            }
+            _ => {
+                Err(io::const_error!(io::ErrorKind::Unsupported, "lock_shared() not supported"))
+            }
+        }
     }
 
-    #[cfg(target_os = "solaris")]
-    pub fn lock_shared(&self) -> io::Result<()> {
-        let mut flock: libc::flock = unsafe { mem::zeroed() };
-        flock.l_type = libc::F_RDLCK as libc::c_short;
-        flock.l_whence = libc::SEEK_SET as libc::c_short;
-        cvt(unsafe { libc::fcntl(self.as_raw_fd(), libc::F_SETLKW, &flock) })?;
-        Ok(())
-    }
-
-    #[cfg(not(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "solaris",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    )))]
-    pub fn lock_shared(&self) -> io::Result<()> {
-        Err(io::const_error!(io::ErrorKind::Unsupported, "lock_shared() not supported"))
-    }
-
-    #[cfg(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    ))]
     pub fn try_lock(&self) -> Result<(), TryLockError> {
-        let result = cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_EX | libc::LOCK_NB) });
-        if let Err(err) = result {
-            if err.kind() == io::ErrorKind::WouldBlock {
-                Err(TryLockError::WouldBlock)
-            } else {
-                Err(TryLockError::Error(err))
+        cfg_select! {
+            any(
+                target_os = "freebsd",
+                target_os = "fuchsia",
+                target_os = "hurd",
+                target_os = "linux",
+                target_os = "netbsd",
+                target_os = "openbsd",
+                target_os = "cygwin",
+                target_os = "illumos",
+                target_os = "aix",
+                target_os = "android",
+                target_vendor = "apple",
+            ) => {
+                let result = cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_EX | libc::LOCK_NB) });
+                if let Err(err) = result {
+                    if err.kind() == io::ErrorKind::WouldBlock {
+                        Err(TryLockError::WouldBlock)
+                    } else {
+                        Err(TryLockError::Error(err))
+                    }
+                } else {
+                    Ok(())
+                }
             }
-        } else {
-            Ok(())
+            _ => {
+                Err(TryLockError::Error(io::const_error!(
+                    io::ErrorKind::Unsupported,
+                    "try_lock() not supported"
+                )))
+            }
         }
     }
 
-    #[cfg(target_os = "solaris")]
-    pub fn try_lock(&self) -> Result<(), TryLockError> {
-        let mut flock: libc::flock = unsafe { mem::zeroed() };
-        flock.l_type = libc::F_WRLCK as libc::c_short;
-        flock.l_whence = libc::SEEK_SET as libc::c_short;
-        let result = cvt(unsafe { libc::fcntl(self.as_raw_fd(), libc::F_SETLK, &flock) });
-        if let Err(err) = result {
-            if err.kind() == io::ErrorKind::WouldBlock {
-                Err(TryLockError::WouldBlock)
-            } else {
-                Err(TryLockError::Error(err))
-            }
-        } else {
-            Ok(())
-        }
-    }
-
-    #[cfg(not(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "solaris",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    )))]
-    pub fn try_lock(&self) -> Result<(), TryLockError> {
-        Err(TryLockError::Error(io::const_error!(
-            io::ErrorKind::Unsupported,
-            "try_lock() not supported"
-        )))
-    }
-
-    #[cfg(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    ))]
     pub fn try_lock_shared(&self) -> Result<(), TryLockError> {
-        let result = cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_SH | libc::LOCK_NB) });
-        if let Err(err) = result {
-            if err.kind() == io::ErrorKind::WouldBlock {
-                Err(TryLockError::WouldBlock)
-            } else {
-                Err(TryLockError::Error(err))
+        cfg_select! {
+                any(
+                target_os = "freebsd",
+                target_os = "fuchsia",
+                target_os = "hurd",
+                target_os = "linux",
+                target_os = "netbsd",
+                target_os = "openbsd",
+                target_os = "cygwin",
+                target_os = "illumos",
+                target_os = "aix",
+                target_os = "android",
+                target_vendor = "apple",
+            ) => {
+                let result = cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_SH | libc::LOCK_NB) });
+                if let Err(err) = result {
+                    if err.kind() == io::ErrorKind::WouldBlock {
+                        Err(TryLockError::WouldBlock)
+                    } else {
+                        Err(TryLockError::Error(err))
+                    }
+                } else {
+                    Ok(())
+                }
             }
-        } else {
-            Ok(())
+            _ => {
+                Err(TryLockError::Error(io::const_error!(
+                    io::ErrorKind::Unsupported,
+                    "try_lock_shared() not supported"
+                )))
+            }
         }
     }
 
-    #[cfg(target_os = "solaris")]
-    pub fn try_lock_shared(&self) -> Result<(), TryLockError> {
-        let mut flock: libc::flock = unsafe { mem::zeroed() };
-        flock.l_type = libc::F_RDLCK as libc::c_short;
-        flock.l_whence = libc::SEEK_SET as libc::c_short;
-        let result = cvt(unsafe { libc::fcntl(self.as_raw_fd(), libc::F_SETLK, &flock) });
-        if let Err(err) = result {
-            if err.kind() == io::ErrorKind::WouldBlock {
-                Err(TryLockError::WouldBlock)
-            } else {
-                Err(TryLockError::Error(err))
+    pub fn unlock(&self) -> io::Result<()> {
+        cfg_select! {
+            any(
+                target_os = "freebsd",
+                target_os = "fuchsia",
+                target_os = "hurd",
+                target_os = "linux",
+                target_os = "netbsd",
+                target_os = "openbsd",
+                target_os = "cygwin",
+                target_os = "illumos",
+                target_os = "aix",
+                target_os = "android",
+                target_vendor = "apple",
+            ) => {
+                cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_UN) })?;
+                return Ok(());
             }
-        } else {
-            Ok(())
+            _ => {
+                Err(io::const_error!(io::ErrorKind::Unsupported, "unlock() not supported"))
+            }
         }
     }
 
-    #[cfg(not(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "solaris",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    )))]
-    pub fn try_lock_shared(&self) -> Result<(), TryLockError> {
-        Err(TryLockError::Error(io::const_error!(
-            io::ErrorKind::Unsupported,
-            "try_lock_shared() not supported"
-        )))
-    }
-
-    #[cfg(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    ))]
-    pub fn unlock(&self) -> io::Result<()> {
-        cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_UN) })?;
-        return Ok(());
-    }
-
-    #[cfg(target_os = "solaris")]
-    pub fn unlock(&self) -> io::Result<()> {
-        let mut flock: libc::flock = unsafe { mem::zeroed() };
-        flock.l_type = libc::F_UNLCK as libc::c_short;
-        flock.l_whence = libc::SEEK_SET as libc::c_short;
-        cvt(unsafe { libc::fcntl(self.as_raw_fd(), libc::F_SETLKW, &flock) })?;
-        Ok(())
-    }
-
-    #[cfg(not(any(
-        target_os = "freebsd",
-        target_os = "fuchsia",
-        target_os = "hurd",
-        target_os = "linux",
-        target_os = "netbsd",
-        target_os = "openbsd",
-        target_os = "cygwin",
-        target_os = "solaris",
-        target_os = "illumos",
-        target_os = "aix",
-        target_os = "android",
-        target_vendor = "apple",
-    )))]
-    pub fn unlock(&self) -> io::Result<()> {
-        Err(io::const_error!(io::ErrorKind::Unsupported, "unlock() not supported"))
-    }
-
     pub fn truncate(&self, size: u64) -> io::Result<()> {
         let size: off64_t =
             size.try_into().map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?;
diff --git a/library/std/src/sys/process/unix/unsupported/wait_status/tests.rs b/library/std/src/sys/process/unix/unsupported/wait_status/tests.rs
index 0d9232f..51af14f0a 100644
--- a/library/std/src/sys/process/unix/unsupported/wait_status/tests.rs
+++ b/library/std/src/sys/process/unix/unsupported/wait_status/tests.rs
@@ -8,6 +8,7 @@
 // I.e. we're using Linux as a proxy for "trad unix".
 #[cfg(target_os = "linux")]
 #[test]
+#[cfg_attr(miri, ignore)] // Miri is too slow
 fn compare_with_linux() {
     use super::ExitStatus as Emulated;
     use crate::os::unix::process::ExitStatusExt as _;
diff --git a/library/std/src/sys/thread_local/guard/windows.rs b/library/std/src/sys/thread_local/guard/windows.rs
index 01ac952..7a9c69a 100644
--- a/library/std/src/sys/thread_local/guard/windows.rs
+++ b/library/std/src/sys/thread_local/guard/windows.rs
@@ -106,6 +106,7 @@ fn drop(&mut self) {
     }
 }
 
+/// Set up the current thread to invoke `cleanup` when it finishes.
 pub fn enable() {
     let registered = if cfg!(target_thread_local) {
         #[thread_local]
diff --git a/library/std/src/sys/thread_local/key/racy.rs b/library/std/src/sys/thread_local/key/racy.rs
index a12ff7a..0a10925 100644
--- a/library/std/src/sys/thread_local/key/racy.rs
+++ b/library/std/src/sys/thread_local/key/racy.rs
@@ -42,6 +42,7 @@ pub fn force(&self) -> super::Key {
         }
     }
 
+    #[cold]
     fn lazy_init(&self) -> usize {
         // POSIX allows the key created here to be KEY_SENTVAL, but the compare_exchange
         // below relies on using KEY_SENTVAL as a sentinel value to check who won the
diff --git a/library/std/src/sys/thread_local/key/windows.rs b/library/std/src/sys/thread_local/key/windows.rs
index 2ff0fd11..420b628 100644
--- a/library/std/src/sys/thread_local/key/windows.rs
+++ b/library/std/src/sys/thread_local/key/windows.rs
@@ -60,6 +60,12 @@ pub const fn new(dtor: Option<Dtor>) -> LazyKey {
 
     #[inline]
     pub fn force(&'static self) -> Key {
+        if self.dtor.is_some() {
+            // Needs to be called on all threads where the key might have a non-null value!
+            // Otherwise, `run_dtors` might not be called on this thread.
+            guard::enable();
+        }
+
         match self.key.load(Acquire) {
             0 => unsafe { self.init() },
             key => key - 1,
@@ -88,6 +94,8 @@ unsafe fn init(&'static self) -> Key {
                 }
 
                 unsafe {
+                    // Add ourselves to the `DTORS` list, so that when `run_dtors` gets called,
+                    // our dtor is invoked.
                     register_dtor(self);
                 }
 
@@ -144,8 +152,6 @@ pub unsafe fn get(key: Key) -> *mut u8 {
 /// Should only be called once per key, otherwise loops or breaks may occur in
 /// the linked list.
 unsafe fn register_dtor(key: &'static LazyKey) {
-    guard::enable();
-
     let this = <*const LazyKey>::cast_mut(key);
     // Use acquire ordering to pass along the changes done by the previously
     // registered keys when we store the new head with release ordering.
diff --git a/library/std/src/sys/thread_local/key/xous.rs b/library/std/src/sys/thread_local/key/xous.rs
index db83d2b..5d9b71d 100644
--- a/library/std/src/sys/thread_local/key/xous.rs
+++ b/library/std/src/sys/thread_local/key/xous.rs
@@ -68,6 +68,7 @@
     static DTORS: Atomic<*mut Node>;
 }
 
+#[inline]
 fn tls_ptr_addr() -> *mut *mut u8 {
     let mut tp: usize;
     unsafe {
@@ -81,14 +82,19 @@ fn tls_ptr_addr() -> *mut *mut u8 {
 
 /// Creates an area of memory that's unique per thread. This area will
 /// contain all thread local pointers.
+#[inline]
 fn tls_table() -> &'static mut [*mut u8] {
     let tp = tls_ptr_addr();
 
     if !tp.is_null() {
-        return unsafe {
-            core::slice::from_raw_parts_mut(tp, TLS_MEMORY_SIZE / size_of::<*mut u8>())
-        };
+        unsafe { core::slice::from_raw_parts_mut(tp, TLS_MEMORY_SIZE / size_of::<*mut u8>()) }
+    } else {
+        tls_table_slow()
     }
+}
+
+#[cold]
+fn tls_table_slow() -> &'static mut [*mut u8] {
     // If the TP register is `0`, then this thread hasn't initialized
     // its TLS yet. Allocate a new page to store this memory.
     let tp = unsafe {
diff --git a/library/std/src/sys/thread_local/mod.rs b/library/std/src/sys/thread_local/mod.rs
index e88011a..d48bb1c 100644
--- a/library/std/src/sys/thread_local/mod.rs
+++ b/library/std/src/sys/thread_local/mod.rs
@@ -81,7 +81,7 @@ pub(crate) mod destructors {
 
 /// This module provides a way to schedule the execution of the destructor list
 /// and the [runtime cleanup](crate::rt::thread_cleanup) function. Calling `enable`
-/// should ensure that these functions are called at the right times.
+/// sets up the current thread to ensure that these functions are called at the right times.
 pub(crate) mod guard {
     cfg_select! {
         all(target_thread_local, target_vendor = "apple") => {
diff --git a/library/std/src/sys/thread_local/native/eager.rs b/library/std/src/sys/thread_local/native/eager.rs
index 23abad6..0acef0b 100644
--- a/library/std/src/sys/thread_local/native/eager.rs
+++ b/library/std/src/sys/thread_local/native/eager.rs
@@ -4,8 +4,8 @@
 
 #[derive(Clone, Copy)]
 enum State {
-    Initial,
-    Alive,
+    Alive = 0,
+    Unregistered,
     Destroyed,
 }
 
@@ -19,7 +19,7 @@ pub struct Storage<T> {
 
 impl<T> Storage<T> {
     pub const fn new(val: T) -> Storage<T> {
-        Storage { state: Cell::new(State::Initial), val: UnsafeCell::new(val) }
+        Storage { state: Cell::new(State::Unregistered), val: UnsafeCell::new(val) }
     }
 
     /// Gets a pointer to the TLS value. If the TLS variable has been destroyed,
@@ -32,16 +32,22 @@ pub const fn new(val: T) -> Storage<T> {
     /// The `self` reference must remain valid until the TLS destructor is run.
     #[inline]
     pub unsafe fn get(&self) -> *const T {
-        match self.state.get() {
-            State::Alive => self.val.get(),
-            State::Destroyed => ptr::null(),
-            State::Initial => unsafe { self.initialize() },
+        if let State::Alive = self.state.get() {
+            self.val.get()
+        } else {
+            unsafe { self.get_or_init_slow() }
         }
     }
 
     #[cold]
-    unsafe fn initialize(&self) -> *const T {
-        // Register the destructor
+    unsafe fn get_or_init_slow(&self) -> *const T {
+        match self.state.get() {
+            State::Unregistered => {}
+            State::Alive => return self.val.get(),
+            State::Destroyed => return ptr::null(),
+        }
+
+        // Register the destructor.
 
         // SAFETY:
         // The caller guarantees that `self` will be valid until thread destruction.
diff --git a/library/std/src/sys/thread_local/os.rs b/library/std/src/sys/thread_local/os.rs
index e1d9d80..bc044aa 100644
--- a/library/std/src/sys/thread_local/os.rs
+++ b/library/std/src/sys/thread_local/os.rs
@@ -162,6 +162,7 @@ pub const fn new() -> Storage<T, ALIGN> {
     ///
     /// The resulting pointer may not be used after reentrant inialialization
     /// or thread destruction has occurred.
+    #[inline]
     pub fn get(&'static self, i: Option<&mut Option<T>>, f: impl FnOnce() -> T) -> *const T {
         let key = self.key.force();
         let ptr = unsafe { get(key) as *mut Value<T> };
@@ -178,6 +179,7 @@ pub fn get(&'static self, i: Option<&mut Option<T>>, f: impl FnOnce() -> T) -> *
     /// # Safety
     /// * `key` must be the result of calling `self.key.force()`
     /// * `ptr` must be the current value associated with `key`.
+    #[cold]
     unsafe fn try_initialize(
         key: Key,
         ptr: *mut Value<T>,
diff --git a/library/std/src/thread/lifecycle.rs b/library/std/src/thread/lifecycle.rs
index af239be..d3a97bb 100644
--- a/library/std/src/thread/lifecycle.rs
+++ b/library/std/src/thread/lifecycle.rs
@@ -66,7 +66,7 @@ pub(super) unsafe fn spawn_unchecked<'scope, F, T>(
     let rust_start = move || {
         let f = f.into_inner();
         let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| {
-            crate::sys::backtrace::__rust_begin_short_backtrace(|| hooks.run());
+            crate::sys::backtrace::__rust_begin_short_backtrace(|| hooks.inherit_and_run());
             crate::sys::backtrace::__rust_begin_short_backtrace(f)
         }));
         // SAFETY: `their_packet` as been built just above and moved by the
diff --git a/library/std/src/thread/spawnhook.rs b/library/std/src/thread/spawnhook.rs
index 254793a..bb36fb6 100644
--- a/library/std/src/thread/spawnhook.rs
+++ b/library/std/src/thread/spawnhook.rs
@@ -144,7 +144,7 @@ pub(super) struct ChildSpawnHooks {
 
 impl ChildSpawnHooks {
     // This is run on the newly spawned thread, directly at the start.
-    pub(super) fn run(self) {
+    pub(super) fn inherit_and_run(self) {
         SPAWN_HOOKS.set(self.hooks);
         for run in self.to_run {
             run();
diff --git a/library/std/src/time.rs b/library/std/src/time.rs
index 1f31ea5..4dda806 100644
--- a/library/std/src/time.rs
+++ b/library/std/src/time.rs
@@ -112,17 +112,16 @@
 /// |-----------|----------------------------------------------------------------------|
 /// | SGX       | [`insecure_time` usercall]. More information on [timekeeping in SGX] |
 /// | UNIX      | [clock_gettime] with `CLOCK_MONOTONIC`                               |
+/// | WASI      | [clock_gettime] with `CLOCK_MONOTONIC`                               |
 /// | Darwin    | [clock_gettime] with `CLOCK_UPTIME_RAW`                              |
 /// | VXWorks   | [clock_gettime] with `CLOCK_MONOTONIC`                               |
 /// | SOLID     | `get_tim`                                                            |
-/// | WASI      | [__wasi_clock_time_get] with `monotonic`                             |
 /// | Windows   | [QueryPerformanceCounter]                                            |
 ///
 /// [currently]: crate::io#platform-specific-behavior
 /// [QueryPerformanceCounter]: https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter
 /// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time
 /// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode
-/// [__wasi_clock_time_get]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#clock_time_get
 /// [clock_gettime]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_getres.html
 ///
 /// **Disclaimer:** These system calls might change over time.
@@ -224,17 +223,16 @@
 /// |-----------|----------------------------------------------------------------------|
 /// | SGX       | [`insecure_time` usercall]. More information on [timekeeping in SGX] |
 /// | UNIX      | [clock_gettime (Realtime Clock)]                                     |
+/// | WASI      | [clock_gettime (Realtime Clock)]                                     |
 /// | Darwin    | [clock_gettime (Realtime Clock)]                                     |
 /// | VXWorks   | [clock_gettime (Realtime Clock)]                                     |
 /// | SOLID     | `SOLID_RTC_ReadTime`                                                 |
-/// | WASI      | [__wasi_clock_time_get (Realtime Clock)]                             |
 /// | Windows   | [GetSystemTimePreciseAsFileTime] / [GetSystemTimeAsFileTime]         |
 ///
 /// [currently]: crate::io#platform-specific-behavior
 /// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time
 /// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode
 /// [clock_gettime (Realtime Clock)]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_getres.html
-/// [__wasi_clock_time_get (Realtime Clock)]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#clock_time_get
 /// [GetSystemTimePreciseAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
 /// [GetSystemTimeAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime
 ///
diff --git a/library/std/tests/thread_local/tests.rs b/library/std/tests/thread_local/tests.rs
index 7324b88..633bab3 100644
--- a/library/std/tests/thread_local/tests.rs
+++ b/library/std/tests/thread_local/tests.rs
@@ -408,6 +408,7 @@ fn drop(&mut self) {
 // https://github.com/rust-lang/rust/pull/148799#issuecomment-3731806901
 #[cfg(target_os = "windows")]
 #[test]
+#[cfg_attr(miri, ignore)] // Miri does not support fibers
 fn fiber_does_not_trigger_dtor() {
     use core::ffi::c_void;
     use std::ptr;
diff --git a/library/stdarch/crates/core_arch/missing-x86.md b/library/stdarch/crates/core_arch/missing-x86.md
index e9f68eb..637c8d4 100644
--- a/library/stdarch/crates/core_arch/missing-x86.md
+++ b/library/stdarch/crates/core_arch/missing-x86.md
@@ -1,41 +1,4 @@
 
-<details><summary>["AMX-BF16"]</summary><p>
-
-  * [ ] [`__tile_dpbf16ps`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_dpbf16ps)
-</p></details>
-
-
-<details><summary>["AMX-COMPLEX"]</summary><p>
-
-  * [ ] [`__tile_cmmimfp16ps`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_cmmimfp16ps)
-  * [ ] [`__tile_cmmrlfp16ps`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_cmmrlfp16ps)
-</p></details>
-
-
-<details><summary>["AMX-FP16"]</summary><p>
-
-  * [ ] [`__tile_dpfp16ps`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_dpfp16ps)
-</p></details>
-
-
-<details><summary>["AMX-INT8"]</summary><p>
-
-  * [ ] [`__tile_dpbssd`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_dpbssd)
-  * [ ] [`__tile_dpbsud`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_dpbsud)
-  * [ ] [`__tile_dpbusd`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_dpbusd)
-  * [ ] [`__tile_dpbuud`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_dpbuud)
-</p></details>
-
-
-<details><summary>["AMX-TILE"]</summary><p>
-
-  * [ ] [`__tile_loadd`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_loadd)
-  * [ ] [`__tile_stored`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_stored)
-  * [ ] [`__tile_stream_loadd`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_stream_loadd)
-  * [ ] [`__tile_zero`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__tile_zero)
-</p></details>
-
-
 <details><summary>["AVX512_FP16"]</summary><p>
 
   * [ ] [`_mm256_set1_pch`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_pch)
@@ -70,12 +33,6 @@
 </p></details>
 
 
-<details><summary>["CLFLUSHOPT"]</summary><p>
-
-  * [ ] [`_mm_clflushopt`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_clflushopt)
-</p></details>
-
-
 <details><summary>["CLWB"]</summary><p>
 
   * [ ] [`_mm_clwb`](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_clwb)
diff --git a/library/stdarch/crates/core_arch/src/aarch64/mod.rs b/library/stdarch/crates/core_arch/src/aarch64/mod.rs
index 0292be2..1f07f02 100644
--- a/library/stdarch/crates/core_arch/src/aarch64/mod.rs
+++ b/library/stdarch/crates/core_arch/src/aarch64/mod.rs
@@ -26,16 +26,16 @@
 pub use self::neon::*;
 
 // The rest of `core_arch::aarch64` is available on `arm64ec` but SVE is not supported on `arm64ec`.
-#[cfg(any(target_arch = "aarch64", doc))]
+#[cfg(any(all(target_arch = "aarch64", target_endian = "little"), doc))]
 mod sve;
-#[cfg(any(target_arch = "aarch64", doc))]
+#[cfg(any(all(target_arch = "aarch64", target_endian = "little"), doc))]
 #[unstable(feature = "stdarch_aarch64_sve", issue = "145052")]
 pub use self::sve::*;
 
 // The rest of `core_arch::aarch64` is available on `arm64ec` but SVE is not supported on `arm64ec`.
-#[cfg(any(target_arch = "aarch64", doc))]
+#[cfg(any(all(target_arch = "aarch64", target_endian = "little"), doc))]
 mod sve2;
-#[cfg(any(target_arch = "aarch64", doc))]
+#[cfg(any(all(target_arch = "aarch64", target_endian = "little"), doc))]
 #[unstable(feature = "stdarch_aarch64_sve", issue = "145052")]
 pub use self::sve2::*;
 
diff --git a/library/stdarch/crates/core_arch/src/aarch64/sve/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/sve/generated.rs
index 6c6a247..e1157f3 100644
--- a/library/stdarch/crates/core_arch/src/aarch64/sve/generated.rs
+++ b/library/stdarch/crates/core_arch/src/aarch64/sve/generated.rs
@@ -12,6 +12,7 @@
 
 use super::*;
 use crate::core_arch::arch::aarch64::*;
+use super::{AsSigned, AsUnsigned};
 
 #[doc = "Absolute difference"]
 #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/svabd[_f32]_m)"]
diff --git a/library/stdarch/crates/core_arch/src/aarch64/sve/ld_st_tests_aarch64.rs b/library/stdarch/crates/core_arch/src/aarch64/sve/ld_st_tests_aarch64.rs
index 3007ba4..ca76106 100644
--- a/library/stdarch/crates/core_arch/src/aarch64/sve/ld_st_tests_aarch64.rs
+++ b/library/stdarch/crates/core_arch/src/aarch64/sve/ld_st_tests_aarch64.rs
@@ -84,71 +84,61 @@
         .expect("u64 data incorrectly initialised")
 });
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_f32(vector: svfloat32_t, expected: svfloat32_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_f32(vector: svfloat32_t, expected: svfloat32_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_f32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_f64(vector: svfloat64_t, expected: svfloat64_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_f64(vector: svfloat64_t, expected: svfloat64_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_f64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i8(vector: svint8_t, expected: svint8_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_i8(vector: svint8_t, expected: svint8_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b8(), defined));
     let cmp = svcmpne_s8(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i16(vector: svint16_t, expected: svint16_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_i16(vector: svint16_t, expected: svint16_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b16(), defined));
     let cmp = svcmpne_s16(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i32(vector: svint32_t, expected: svint32_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_i32(vector: svint32_t, expected: svint32_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_s32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i64(vector: svint64_t, expected: svint64_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_i64(vector: svint64_t, expected: svint64_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_s64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u8(vector: svuint8_t, expected: svuint8_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_u8(vector: svuint8_t, expected: svuint8_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b8(), defined));
     let cmp = svcmpne_u8(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u16(vector: svuint16_t, expected: svuint16_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_u16(vector: svuint16_t, expected: svuint16_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b16(), defined));
     let cmp = svcmpne_u16(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u32(vector: svuint32_t, expected: svuint32_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_u32(vector: svuint32_t, expected: svuint32_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_u32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_u64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
@@ -166,12 +156,14 @@ unsafe fn test_svld1_f32_with_svst1_f32() {
     }
     svsetffr();
     let loaded = svld1_f32(svptrue_b32(), storage.as_ptr() as *const f32);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -187,12 +179,14 @@ unsafe fn test_svld1_f64_with_svst1_f64() {
     }
     svsetffr();
     let loaded = svld1_f64(svptrue_b64(), storage.as_ptr() as *const f64);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -205,9 +199,11 @@ unsafe fn test_svld1_s8_with_svst1_s8() {
     }
     svsetffr();
     let loaded = svld1_s8(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         loaded,
         svindex_s8((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -220,9 +216,11 @@ unsafe fn test_svld1_s16_with_svst1_s16() {
     }
     svsetffr();
     let loaded = svld1_s16(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -235,9 +233,11 @@ unsafe fn test_svld1_s32_with_svst1_s32() {
     }
     svsetffr();
     let loaded = svld1_s32(svptrue_b32(), storage.as_ptr() as *const i32);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -250,9 +250,11 @@ unsafe fn test_svld1_s64_with_svst1_s64() {
     }
     svsetffr();
     let loaded = svld1_s64(svptrue_b64(), storage.as_ptr() as *const i64);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -265,9 +267,11 @@ unsafe fn test_svld1_u8_with_svst1_u8() {
     }
     svsetffr();
     let loaded = svld1_u8(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         loaded,
         svindex_u8((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -280,9 +284,11 @@ unsafe fn test_svld1_u16_with_svst1_u16() {
     }
     svsetffr();
     let loaded = svld1_u16(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -295,9 +301,11 @@ unsafe fn test_svld1_u32_with_svst1_u32() {
     }
     svsetffr();
     let loaded = svld1_u32(svptrue_b32(), storage.as_ptr() as *const u32);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -310,9 +318,11 @@ unsafe fn test_svld1_u64_with_svst1_u64() {
     }
     svsetffr();
     let loaded = svld1_u64(svptrue_b64(), storage.as_ptr() as *const u64);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -329,12 +339,14 @@ unsafe fn test_svld1_gather_s32index_f32_with_svst1_scatter_s32index_f32() {
     }
     svsetffr();
     let loaded = svld1_gather_s32index_f32(svptrue_b32(), storage.as_ptr() as *const f32, indices);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -348,9 +360,11 @@ unsafe fn test_svld1_gather_s32index_s32_with_svst1_scatter_s32index_s32() {
     }
     svsetffr();
     let loaded = svld1_gather_s32index_s32(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -364,9 +378,11 @@ unsafe fn test_svld1_gather_s32index_u32_with_svst1_scatter_s32index_u32() {
     }
     svsetffr();
     let loaded = svld1_gather_s32index_u32(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -383,12 +399,14 @@ unsafe fn test_svld1_gather_s64index_f64_with_svst1_scatter_s64index_f64() {
     }
     svsetffr();
     let loaded = svld1_gather_s64index_f64(svptrue_b64(), storage.as_ptr() as *const f64, indices);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -402,9 +420,11 @@ unsafe fn test_svld1_gather_s64index_s64_with_svst1_scatter_s64index_s64() {
     }
     svsetffr();
     let loaded = svld1_gather_s64index_s64(svptrue_b64(), storage.as_ptr() as *const i64, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -418,9 +438,11 @@ unsafe fn test_svld1_gather_s64index_u64_with_svst1_scatter_s64index_u64() {
     }
     svsetffr();
     let loaded = svld1_gather_s64index_u64(svptrue_b64(), storage.as_ptr() as *const u64, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -437,12 +459,14 @@ unsafe fn test_svld1_gather_u32index_f32_with_svst1_scatter_u32index_f32() {
     }
     svsetffr();
     let loaded = svld1_gather_u32index_f32(svptrue_b32(), storage.as_ptr() as *const f32, indices);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -456,9 +480,11 @@ unsafe fn test_svld1_gather_u32index_s32_with_svst1_scatter_u32index_s32() {
     }
     svsetffr();
     let loaded = svld1_gather_u32index_s32(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -472,9 +498,11 @@ unsafe fn test_svld1_gather_u32index_u32_with_svst1_scatter_u32index_u32() {
     }
     svsetffr();
     let loaded = svld1_gather_u32index_u32(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -491,12 +519,14 @@ unsafe fn test_svld1_gather_u64index_f64_with_svst1_scatter_u64index_f64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64index_f64(svptrue_b64(), storage.as_ptr() as *const f64, indices);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -510,9 +540,11 @@ unsafe fn test_svld1_gather_u64index_s64_with_svst1_scatter_u64index_s64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64index_s64(svptrue_b64(), storage.as_ptr() as *const i64, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -526,9 +558,11 @@ unsafe fn test_svld1_gather_u64index_u64_with_svst1_scatter_u64index_u64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64index_u64(svptrue_b64(), storage.as_ptr() as *const u64, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -545,12 +579,14 @@ unsafe fn test_svld1_gather_s32offset_f32_with_svst1_scatter_s32offset_f32() {
     }
     svsetffr();
     let loaded = svld1_gather_s32offset_f32(svptrue_b32(), storage.as_ptr() as *const f32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -564,9 +600,11 @@ unsafe fn test_svld1_gather_s32offset_s32_with_svst1_scatter_s32offset_s32() {
     }
     svsetffr();
     let loaded = svld1_gather_s32offset_s32(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -580,9 +618,11 @@ unsafe fn test_svld1_gather_s32offset_u32_with_svst1_scatter_s32offset_u32() {
     }
     svsetffr();
     let loaded = svld1_gather_s32offset_u32(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -599,12 +639,14 @@ unsafe fn test_svld1_gather_s64offset_f64_with_svst1_scatter_s64offset_f64() {
     }
     svsetffr();
     let loaded = svld1_gather_s64offset_f64(svptrue_b64(), storage.as_ptr() as *const f64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -618,9 +660,11 @@ unsafe fn test_svld1_gather_s64offset_s64_with_svst1_scatter_s64offset_s64() {
     }
     svsetffr();
     let loaded = svld1_gather_s64offset_s64(svptrue_b64(), storage.as_ptr() as *const i64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -634,9 +678,11 @@ unsafe fn test_svld1_gather_s64offset_u64_with_svst1_scatter_s64offset_u64() {
     }
     svsetffr();
     let loaded = svld1_gather_s64offset_u64(svptrue_b64(), storage.as_ptr() as *const u64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -653,12 +699,14 @@ unsafe fn test_svld1_gather_u32offset_f32_with_svst1_scatter_u32offset_f32() {
     }
     svsetffr();
     let loaded = svld1_gather_u32offset_f32(svptrue_b32(), storage.as_ptr() as *const f32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -672,9 +720,11 @@ unsafe fn test_svld1_gather_u32offset_s32_with_svst1_scatter_u32offset_s32() {
     }
     svsetffr();
     let loaded = svld1_gather_u32offset_s32(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -688,9 +738,11 @@ unsafe fn test_svld1_gather_u32offset_u32_with_svst1_scatter_u32offset_u32() {
     }
     svsetffr();
     let loaded = svld1_gather_u32offset_u32(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -707,12 +759,14 @@ unsafe fn test_svld1_gather_u64offset_f64_with_svst1_scatter_u64offset_f64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64offset_f64(svptrue_b64(), storage.as_ptr() as *const f64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -726,9 +780,11 @@ unsafe fn test_svld1_gather_u64offset_s64_with_svst1_scatter_u64offset_s64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64offset_s64(svptrue_b64(), storage.as_ptr() as *const i64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -742,9 +798,11 @@ unsafe fn test_svld1_gather_u64offset_u64_with_svst1_scatter_u64offset_u64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64offset_u64(svptrue_b64(), storage.as_ptr() as *const u64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -763,12 +821,14 @@ unsafe fn test_svld1_gather_u64base_f64_with_svst1_scatter_u64base_f64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64base_f64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -784,9 +844,11 @@ unsafe fn test_svld1_gather_u64base_s64_with_svst1_scatter_u64base_s64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64base_s64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -802,9 +864,11 @@ unsafe fn test_svld1_gather_u64base_u64_with_svst1_scatter_u64base_u64() {
     }
     svsetffr();
     let loaded = svld1_gather_u64base_u64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -830,12 +894,14 @@ unsafe fn test_svld1_gather_u32base_index_f32_with_svst1_scatter_u32base_index_f
         bases,
         storage.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -858,9 +924,11 @@ unsafe fn test_svld1_gather_u32base_index_s32_with_svst1_scatter_u32base_index_s
         bases,
         storage.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -883,9 +951,11 @@ unsafe fn test_svld1_gather_u32base_index_u32_with_svst1_scatter_u32base_index_u
         bases,
         storage.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -904,12 +974,14 @@ unsafe fn test_svld1_gather_u64base_index_f64_with_svst1_scatter_u64base_index_f
     }
     svsetffr();
     let loaded = svld1_gather_u64base_index_f64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -925,9 +997,11 @@ unsafe fn test_svld1_gather_u64base_index_s64_with_svst1_scatter_u64base_index_s
     }
     svsetffr();
     let loaded = svld1_gather_u64base_index_s64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -943,9 +1017,11 @@ unsafe fn test_svld1_gather_u64base_index_u64_with_svst1_scatter_u64base_index_u
     }
     svsetffr();
     let loaded = svld1_gather_u64base_index_u64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -971,12 +1047,14 @@ unsafe fn test_svld1_gather_u32base_offset_f32_with_svst1_scatter_u32base_offset
         bases,
         storage.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -999,9 +1077,11 @@ unsafe fn test_svld1_gather_u32base_offset_s32_with_svst1_scatter_u32base_offset
         bases,
         storage.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1024,9 +1104,11 @@ unsafe fn test_svld1_gather_u32base_offset_u32_with_svst1_scatter_u32base_offset
         bases,
         storage.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1045,12 +1127,14 @@ unsafe fn test_svld1_gather_u64base_offset_f64_with_svst1_scatter_u64base_offset
     }
     svsetffr();
     let loaded = svld1_gather_u64base_offset_f64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1066,9 +1150,11 @@ unsafe fn test_svld1_gather_u64base_offset_s64_with_svst1_scatter_u64base_offset
     }
     svsetffr();
     let loaded = svld1_gather_u64base_offset_s64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1084,9 +1170,11 @@ unsafe fn test_svld1_gather_u64base_offset_u64_with_svst1_scatter_u64base_offset
     }
     svsetffr();
     let loaded = svld1_gather_u64base_offset_u64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1106,6 +1194,7 @@ unsafe fn test_svld1_vnum_f32_with_svst1_vnum_f32() {
     }
     svsetffr();
     let loaded = svld1_vnum_f32(svptrue_b32(), storage.as_ptr() as *const f32, 1);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
@@ -1115,6 +1204,7 @@ unsafe fn test_svld1_vnum_f32_with_svst1_vnum_f32() {
                 1usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1134,6 +1224,7 @@ unsafe fn test_svld1_vnum_f64_with_svst1_vnum_f64() {
     }
     svsetffr();
     let loaded = svld1_vnum_f64(svptrue_b64(), storage.as_ptr() as *const f64, 1);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
@@ -1143,6 +1234,7 @@ unsafe fn test_svld1_vnum_f64_with_svst1_vnum_f64() {
                 1usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1159,12 +1251,14 @@ unsafe fn test_svld1_vnum_s8_with_svst1_vnum_s8() {
     }
     svsetffr();
     let loaded = svld1_vnum_s8(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         loaded,
         svindex_s8(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1181,12 +1275,14 @@ unsafe fn test_svld1_vnum_s16_with_svst1_vnum_s16() {
     }
     svsetffr();
     let loaded = svld1_vnum_s16(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1203,12 +1299,14 @@ unsafe fn test_svld1_vnum_s32_with_svst1_vnum_s32() {
     }
     svsetffr();
     let loaded = svld1_vnum_s32(svptrue_b32(), storage.as_ptr() as *const i32, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1225,12 +1323,14 @@ unsafe fn test_svld1_vnum_s64_with_svst1_vnum_s64() {
     }
     svsetffr();
     let loaded = svld1_vnum_s64(svptrue_b64(), storage.as_ptr() as *const i64, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1247,12 +1347,14 @@ unsafe fn test_svld1_vnum_u8_with_svst1_vnum_u8() {
     }
     svsetffr();
     let loaded = svld1_vnum_u8(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         loaded,
         svindex_u8(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1269,12 +1371,14 @@ unsafe fn test_svld1_vnum_u16_with_svst1_vnum_u16() {
     }
     svsetffr();
     let loaded = svld1_vnum_u16(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1291,12 +1395,14 @@ unsafe fn test_svld1_vnum_u32_with_svst1_vnum_u32() {
     }
     svsetffr();
     let loaded = svld1_vnum_u32(svptrue_b32(), storage.as_ptr() as *const u32, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1313,12 +1419,14 @@ unsafe fn test_svld1_vnum_u64_with_svst1_vnum_u64() {
     }
     svsetffr();
     let loaded = svld1_vnum_u64(svptrue_b64(), storage.as_ptr() as *const u64, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1327,14 +1435,17 @@ unsafe fn test_svld1ro_f32() {
         println!("Skipping test_svld1ro_f32 due to SVE vector length");
         return;
     }
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_f32(svptrue_b32(), F32_DATA.as_ptr());
+    let loaded = svld1ro_f32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svtrn1q_f32(
             svdupq_n_f32(0usize as f32, 1usize as f32, 2usize as f32, 3usize as f32),
             svdupq_n_f32(4usize as f32, 5usize as f32, 6usize as f32, 7usize as f32),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1343,14 +1454,17 @@ unsafe fn test_svld1ro_f64() {
         println!("Skipping test_svld1ro_f64 due to SVE vector length");
         return;
     }
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_f64(svptrue_b64(), F64_DATA.as_ptr());
+    let loaded = svld1ro_f64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svtrn1q_f64(
             svdupq_n_f64(0usize as f64, 1usize as f64),
             svdupq_n_f64(2usize as f64, 3usize as f64),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1359,8 +1473,10 @@ unsafe fn test_svld1ro_s8() {
         println!("Skipping test_svld1ro_s8 due to SVE vector length");
         return;
     }
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_s8(svptrue_b8(), I8_DATA.as_ptr());
+    let loaded = svld1ro_s8(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         loaded,
         svtrn1q_s8(
@@ -1401,6 +1517,7 @@ unsafe fn test_svld1ro_s8() {
                 31usize as i8,
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1409,8 +1526,10 @@ unsafe fn test_svld1ro_s16() {
         println!("Skipping test_svld1ro_s16 due to SVE vector length");
         return;
     }
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_s16(svptrue_b16(), I16_DATA.as_ptr());
+    let loaded = svld1ro_s16(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svtrn1q_s16(
@@ -1435,6 +1554,7 @@ unsafe fn test_svld1ro_s16() {
                 15usize as i16,
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1443,14 +1563,17 @@ unsafe fn test_svld1ro_s32() {
         println!("Skipping test_svld1ro_s32 due to SVE vector length");
         return;
     }
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_s32(svptrue_b32(), I32_DATA.as_ptr());
+    let loaded = svld1ro_s32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svtrn1q_s32(
             svdupq_n_s32(0usize as i32, 1usize as i32, 2usize as i32, 3usize as i32),
             svdupq_n_s32(4usize as i32, 5usize as i32, 6usize as i32, 7usize as i32),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1459,14 +1582,17 @@ unsafe fn test_svld1ro_s64() {
         println!("Skipping test_svld1ro_s64 due to SVE vector length");
         return;
     }
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_s64(svptrue_b64(), I64_DATA.as_ptr());
+    let loaded = svld1ro_s64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svtrn1q_s64(
             svdupq_n_s64(0usize as i64, 1usize as i64),
             svdupq_n_s64(2usize as i64, 3usize as i64),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1475,8 +1601,10 @@ unsafe fn test_svld1ro_u8() {
         println!("Skipping test_svld1ro_u8 due to SVE vector length");
         return;
     }
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_u8(svptrue_b8(), U8_DATA.as_ptr());
+    let loaded = svld1ro_u8(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         loaded,
         svtrn1q_u8(
@@ -1517,6 +1645,7 @@ unsafe fn test_svld1ro_u8() {
                 31usize as u8,
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1525,8 +1654,10 @@ unsafe fn test_svld1ro_u16() {
         println!("Skipping test_svld1ro_u16 due to SVE vector length");
         return;
     }
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_u16(svptrue_b16(), U16_DATA.as_ptr());
+    let loaded = svld1ro_u16(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svtrn1q_u16(
@@ -1551,6 +1682,7 @@ unsafe fn test_svld1ro_u16() {
                 15usize as u16,
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1559,14 +1691,17 @@ unsafe fn test_svld1ro_u32() {
         println!("Skipping test_svld1ro_u32 due to SVE vector length");
         return;
     }
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_u32(svptrue_b32(), U32_DATA.as_ptr());
+    let loaded = svld1ro_u32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svtrn1q_u32(
             svdupq_n_u32(0usize as u32, 1usize as u32, 2usize as u32, 3usize as u32),
             svdupq_n_u32(4usize as u32, 5usize as u32, 6usize as u32, 7usize as u32),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,f64mm")]
@@ -1575,35 +1710,45 @@ unsafe fn test_svld1ro_u64() {
         println!("Skipping test_svld1ro_u64 due to SVE vector length");
         return;
     }
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1ro_u64(svptrue_b64(), U64_DATA.as_ptr());
+    let loaded = svld1ro_u64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svtrn1q_u64(
             svdupq_n_u64(0usize as u64, 1usize as u64),
             svdupq_n_u64(2usize as u64, 3usize as u64),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_f32() {
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_f32(svptrue_b32(), F32_DATA.as_ptr());
+    let loaded = svld1rq_f32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svdupq_n_f32(0usize as f32, 1usize as f32, 2usize as f32, 3usize as f32),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_f64() {
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_f64(svptrue_b64(), F64_DATA.as_ptr());
-    assert_vector_matches_f64(loaded, svdupq_n_f64(0usize as f64, 1usize as f64));
+    let loaded = svld1rq_f64(svptrue_b64(), ptr);
+    let defined = svrdffr();
+    assert_vector_matches_f64(loaded, svdupq_n_f64(0usize as f64, 1usize as f64), defined);
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_s8() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_s8(svptrue_b8(), I8_DATA.as_ptr());
+    let loaded = svld1rq_s8(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         loaded,
         svdupq_n_s8(
@@ -1624,12 +1769,15 @@ unsafe fn test_svld1rq_s8() {
             14usize as i8,
             15usize as i8,
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_s16() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_s16(svptrue_b16(), I16_DATA.as_ptr());
+    let loaded = svld1rq_s16(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svdupq_n_s16(
@@ -1642,27 +1790,35 @@ unsafe fn test_svld1rq_s16() {
             6usize as i16,
             7usize as i16,
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_s32() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_s32(svptrue_b32(), I32_DATA.as_ptr());
+    let loaded = svld1rq_s32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svdupq_n_s32(0usize as i32, 1usize as i32, 2usize as i32, 3usize as i32),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_s64() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_s64(svptrue_b64(), I64_DATA.as_ptr());
-    assert_vector_matches_i64(loaded, svdupq_n_s64(0usize as i64, 1usize as i64));
+    let loaded = svld1rq_s64(svptrue_b64(), ptr);
+    let defined = svrdffr();
+    assert_vector_matches_i64(loaded, svdupq_n_s64(0usize as i64, 1usize as i64), defined);
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_u8() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_u8(svptrue_b8(), U8_DATA.as_ptr());
+    let loaded = svld1rq_u8(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         loaded,
         svdupq_n_u8(
@@ -1683,12 +1839,15 @@ unsafe fn test_svld1rq_u8() {
             14usize as u8,
             15usize as u8,
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_u16() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_u16(svptrue_b16(), U16_DATA.as_ptr());
+    let loaded = svld1rq_u16(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svdupq_n_u16(
@@ -1701,22 +1860,28 @@ unsafe fn test_svld1rq_u16() {
             6usize as u16,
             7usize as u16,
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_u32() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_u32(svptrue_b32(), U32_DATA.as_ptr());
+    let loaded = svld1rq_u32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svdupq_n_u32(0usize as u32, 1usize as u32, 2usize as u32, 3usize as u32),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1rq_u64() {
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let loaded = svld1rq_u64(svptrue_b64(), U64_DATA.as_ptr());
-    assert_vector_matches_u64(loaded, svdupq_n_u64(0usize as u64, 1usize as u64));
+    let loaded = svld1rq_u64(svptrue_b64(), ptr);
+    let defined = svrdffr();
+    assert_vector_matches_u64(loaded, svdupq_n_u64(0usize as u64, 1usize as u64), defined);
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svld1sb_gather_s32offset_s32_with_svst1b_scatter_s32offset_s32() {
@@ -1729,9 +1894,11 @@ unsafe fn test_svld1sb_gather_s32offset_s32_with_svst1b_scatter_s32offset_s32()
     }
     svsetffr();
     let loaded = svld1sb_gather_s32offset_s32(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1746,9 +1913,11 @@ unsafe fn test_svld1sh_gather_s32offset_s32_with_svst1h_scatter_s32offset_s32()
     svsetffr();
     let loaded =
         svld1sh_gather_s32offset_s32(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1762,9 +1931,11 @@ unsafe fn test_svld1sb_gather_s32offset_u32_with_svst1b_scatter_s32offset_u32()
     }
     svsetffr();
     let loaded = svld1sb_gather_s32offset_u32(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1779,9 +1950,11 @@ unsafe fn test_svld1sh_gather_s32offset_u32_with_svst1h_scatter_s32offset_u32()
     svsetffr();
     let loaded =
         svld1sh_gather_s32offset_u32(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1795,9 +1968,11 @@ unsafe fn test_svld1sb_gather_s64offset_s64_with_svst1b_scatter_s64offset_s64()
     }
     svsetffr();
     let loaded = svld1sb_gather_s64offset_s64(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1812,9 +1987,11 @@ unsafe fn test_svld1sh_gather_s64offset_s64_with_svst1h_scatter_s64offset_s64()
     svsetffr();
     let loaded =
         svld1sh_gather_s64offset_s64(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1829,9 +2006,11 @@ unsafe fn test_svld1sw_gather_s64offset_s64_with_svst1w_scatter_s64offset_s64()
     svsetffr();
     let loaded =
         svld1sw_gather_s64offset_s64(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1845,9 +2024,11 @@ unsafe fn test_svld1sb_gather_s64offset_u64_with_svst1b_scatter_s64offset_u64()
     }
     svsetffr();
     let loaded = svld1sb_gather_s64offset_u64(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1862,9 +2043,11 @@ unsafe fn test_svld1sh_gather_s64offset_u64_with_svst1h_scatter_s64offset_u64()
     svsetffr();
     let loaded =
         svld1sh_gather_s64offset_u64(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1879,9 +2062,11 @@ unsafe fn test_svld1sw_gather_s64offset_u64_with_svst1w_scatter_s64offset_u64()
     svsetffr();
     let loaded =
         svld1sw_gather_s64offset_u64(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1895,9 +2080,11 @@ unsafe fn test_svld1sb_gather_u32offset_s32_with_svst1b_scatter_u32offset_s32()
     }
     svsetffr();
     let loaded = svld1sb_gather_u32offset_s32(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1912,9 +2099,11 @@ unsafe fn test_svld1sh_gather_u32offset_s32_with_svst1h_scatter_u32offset_s32()
     svsetffr();
     let loaded =
         svld1sh_gather_u32offset_s32(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1928,9 +2117,11 @@ unsafe fn test_svld1sb_gather_u32offset_u32_with_svst1b_scatter_u32offset_u32()
     }
     svsetffr();
     let loaded = svld1sb_gather_u32offset_u32(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1945,9 +2136,11 @@ unsafe fn test_svld1sh_gather_u32offset_u32_with_svst1h_scatter_u32offset_u32()
     svsetffr();
     let loaded =
         svld1sh_gather_u32offset_u32(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1961,9 +2154,11 @@ unsafe fn test_svld1sb_gather_u64offset_s64_with_svst1b_scatter_u64offset_s64()
     }
     svsetffr();
     let loaded = svld1sb_gather_u64offset_s64(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1978,9 +2173,11 @@ unsafe fn test_svld1sh_gather_u64offset_s64_with_svst1h_scatter_u64offset_s64()
     svsetffr();
     let loaded =
         svld1sh_gather_u64offset_s64(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -1995,9 +2192,11 @@ unsafe fn test_svld1sw_gather_u64offset_s64_with_svst1w_scatter_u64offset_s64()
     svsetffr();
     let loaded =
         svld1sw_gather_u64offset_s64(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2011,9 +2210,11 @@ unsafe fn test_svld1sb_gather_u64offset_u64_with_svst1b_scatter_u64offset_u64()
     }
     svsetffr();
     let loaded = svld1sb_gather_u64offset_u64(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2028,9 +2229,11 @@ unsafe fn test_svld1sh_gather_u64offset_u64_with_svst1h_scatter_u64offset_u64()
     svsetffr();
     let loaded =
         svld1sh_gather_u64offset_u64(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2045,9 +2248,11 @@ unsafe fn test_svld1sw_gather_u64offset_u64_with_svst1w_scatter_u64offset_u64()
     svsetffr();
     let loaded =
         svld1sw_gather_u64offset_u64(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2070,9 +2275,11 @@ unsafe fn test_svld1sb_gather_u32base_offset_s32_with_svst1b_scatter_u32base_off
         bases,
         storage.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2095,9 +2302,11 @@ unsafe fn test_svld1sh_gather_u32base_offset_s32_with_svst1h_scatter_u32base_off
         bases,
         storage.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2120,9 +2329,11 @@ unsafe fn test_svld1sb_gather_u32base_offset_u32_with_svst1b_scatter_u32base_off
         bases,
         storage.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2145,9 +2356,11 @@ unsafe fn test_svld1sh_gather_u32base_offset_u32_with_svst1h_scatter_u32base_off
         bases,
         storage.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2163,9 +2376,11 @@ unsafe fn test_svld1sb_gather_u64base_offset_s64_with_svst1b_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1sb_gather_u64base_offset_s64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2181,9 +2396,11 @@ unsafe fn test_svld1sh_gather_u64base_offset_s64_with_svst1h_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1sh_gather_u64base_offset_s64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2199,9 +2416,11 @@ unsafe fn test_svld1sw_gather_u64base_offset_s64_with_svst1w_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1sw_gather_u64base_offset_s64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2217,9 +2436,11 @@ unsafe fn test_svld1sb_gather_u64base_offset_u64_with_svst1b_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1sb_gather_u64base_offset_u64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2235,9 +2456,11 @@ unsafe fn test_svld1sh_gather_u64base_offset_u64_with_svst1h_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1sh_gather_u64base_offset_u64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2253,9 +2476,11 @@ unsafe fn test_svld1sw_gather_u64base_offset_u64_with_svst1w_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1sw_gather_u64base_offset_u64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2271,9 +2496,11 @@ unsafe fn test_svld1sb_gather_u64base_s64_with_svst1b_scatter_u64base_s64() {
     }
     svsetffr();
     let loaded = svld1sb_gather_u64base_s64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2289,9 +2516,11 @@ unsafe fn test_svld1sh_gather_u64base_s64_with_svst1h_scatter_u64base_s64() {
     }
     svsetffr();
     let loaded = svld1sh_gather_u64base_s64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2307,9 +2536,11 @@ unsafe fn test_svld1sw_gather_u64base_s64_with_svst1w_scatter_u64base_s64() {
     }
     svsetffr();
     let loaded = svld1sw_gather_u64base_s64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2325,9 +2556,11 @@ unsafe fn test_svld1sb_gather_u64base_u64_with_svst1b_scatter_u64base_u64() {
     }
     svsetffr();
     let loaded = svld1sb_gather_u64base_u64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2343,9 +2576,11 @@ unsafe fn test_svld1sh_gather_u64base_u64_with_svst1h_scatter_u64base_u64() {
     }
     svsetffr();
     let loaded = svld1sh_gather_u64base_u64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2361,9 +2596,11 @@ unsafe fn test_svld1sw_gather_u64base_u64_with_svst1w_scatter_u64base_u64() {
     }
     svsetffr();
     let loaded = svld1sw_gather_u64base_u64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2376,9 +2613,11 @@ unsafe fn test_svld1sb_s16_with_svst1b_s16() {
     }
     svsetffr();
     let loaded = svld1sb_s16(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2391,9 +2630,11 @@ unsafe fn test_svld1sb_s32_with_svst1b_s32() {
     }
     svsetffr();
     let loaded = svld1sb_s32(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2406,9 +2647,11 @@ unsafe fn test_svld1sh_s32_with_svst1h_s32() {
     }
     svsetffr();
     let loaded = svld1sh_s32(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2421,9 +2664,11 @@ unsafe fn test_svld1sb_s64_with_svst1b_s64() {
     }
     svsetffr();
     let loaded = svld1sb_s64(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2436,9 +2681,11 @@ unsafe fn test_svld1sh_s64_with_svst1h_s64() {
     }
     svsetffr();
     let loaded = svld1sh_s64(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2451,9 +2698,11 @@ unsafe fn test_svld1sw_s64_with_svst1w_s64() {
     }
     svsetffr();
     let loaded = svld1sw_s64(svptrue_b32(), storage.as_ptr() as *const i32);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2466,9 +2715,11 @@ unsafe fn test_svld1sb_u16_with_svst1b_u16() {
     }
     svsetffr();
     let loaded = svld1sb_u16(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2481,9 +2732,11 @@ unsafe fn test_svld1sb_u32_with_svst1b_u32() {
     }
     svsetffr();
     let loaded = svld1sb_u32(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2496,9 +2749,11 @@ unsafe fn test_svld1sh_u32_with_svst1h_u32() {
     }
     svsetffr();
     let loaded = svld1sh_u32(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2511,9 +2766,11 @@ unsafe fn test_svld1sb_u64_with_svst1b_u64() {
     }
     svsetffr();
     let loaded = svld1sb_u64(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2526,9 +2783,11 @@ unsafe fn test_svld1sh_u64_with_svst1h_u64() {
     }
     svsetffr();
     let loaded = svld1sh_u64(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2541,9 +2800,11 @@ unsafe fn test_svld1sw_u64_with_svst1w_u64() {
     }
     svsetffr();
     let loaded = svld1sw_u64(svptrue_b32(), storage.as_ptr() as *const i32);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2560,12 +2821,14 @@ unsafe fn test_svld1sb_vnum_s16_with_svst1b_vnum_s16() {
     }
     svsetffr();
     let loaded = svld1sb_vnum_s16(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2582,12 +2845,14 @@ unsafe fn test_svld1sb_vnum_s32_with_svst1b_vnum_s32() {
     }
     svsetffr();
     let loaded = svld1sb_vnum_s32(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2604,12 +2869,14 @@ unsafe fn test_svld1sh_vnum_s32_with_svst1h_vnum_s32() {
     }
     svsetffr();
     let loaded = svld1sh_vnum_s32(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2626,12 +2893,14 @@ unsafe fn test_svld1sb_vnum_s64_with_svst1b_vnum_s64() {
     }
     svsetffr();
     let loaded = svld1sb_vnum_s64(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2648,12 +2917,14 @@ unsafe fn test_svld1sh_vnum_s64_with_svst1h_vnum_s64() {
     }
     svsetffr();
     let loaded = svld1sh_vnum_s64(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2670,12 +2941,14 @@ unsafe fn test_svld1sw_vnum_s64_with_svst1w_vnum_s64() {
     }
     svsetffr();
     let loaded = svld1sw_vnum_s64(svptrue_b32(), storage.as_ptr() as *const i32, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2692,12 +2965,14 @@ unsafe fn test_svld1sb_vnum_u16_with_svst1b_vnum_u16() {
     }
     svsetffr();
     let loaded = svld1sb_vnum_u16(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2714,12 +2989,14 @@ unsafe fn test_svld1sb_vnum_u32_with_svst1b_vnum_u32() {
     }
     svsetffr();
     let loaded = svld1sb_vnum_u32(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2736,12 +3013,14 @@ unsafe fn test_svld1sh_vnum_u32_with_svst1h_vnum_u32() {
     }
     svsetffr();
     let loaded = svld1sh_vnum_u32(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2758,12 +3037,14 @@ unsafe fn test_svld1sb_vnum_u64_with_svst1b_vnum_u64() {
     }
     svsetffr();
     let loaded = svld1sb_vnum_u64(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2780,12 +3061,14 @@ unsafe fn test_svld1sh_vnum_u64_with_svst1h_vnum_u64() {
     }
     svsetffr();
     let loaded = svld1sh_vnum_u64(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2802,12 +3085,14 @@ unsafe fn test_svld1sw_vnum_u64_with_svst1w_vnum_u64() {
     }
     svsetffr();
     let loaded = svld1sw_vnum_u64(svptrue_b32(), storage.as_ptr() as *const i32, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2822,9 +3107,11 @@ unsafe fn test_svld1sh_gather_s32index_s32_with_svst1h_scatter_s32index_s32() {
     svsetffr();
     let loaded =
         svld1sh_gather_s32index_s32(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2839,9 +3126,11 @@ unsafe fn test_svld1sh_gather_s32index_u32_with_svst1h_scatter_s32index_u32() {
     svsetffr();
     let loaded =
         svld1sh_gather_s32index_u32(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2856,9 +3145,11 @@ unsafe fn test_svld1sh_gather_s64index_s64_with_svst1h_scatter_s64index_s64() {
     svsetffr();
     let loaded =
         svld1sh_gather_s64index_s64(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2873,9 +3164,11 @@ unsafe fn test_svld1sw_gather_s64index_s64_with_svst1w_scatter_s64index_s64() {
     svsetffr();
     let loaded =
         svld1sw_gather_s64index_s64(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2890,9 +3183,11 @@ unsafe fn test_svld1sh_gather_s64index_u64_with_svst1h_scatter_s64index_u64() {
     svsetffr();
     let loaded =
         svld1sh_gather_s64index_u64(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2907,9 +3202,11 @@ unsafe fn test_svld1sw_gather_s64index_u64_with_svst1w_scatter_s64index_u64() {
     svsetffr();
     let loaded =
         svld1sw_gather_s64index_u64(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2924,9 +3221,11 @@ unsafe fn test_svld1sh_gather_u32index_s32_with_svst1h_scatter_u32index_s32() {
     svsetffr();
     let loaded =
         svld1sh_gather_u32index_s32(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2941,9 +3240,11 @@ unsafe fn test_svld1sh_gather_u32index_u32_with_svst1h_scatter_u32index_u32() {
     svsetffr();
     let loaded =
         svld1sh_gather_u32index_u32(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2958,9 +3259,11 @@ unsafe fn test_svld1sh_gather_u64index_s64_with_svst1h_scatter_u64index_s64() {
     svsetffr();
     let loaded =
         svld1sh_gather_u64index_s64(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2975,9 +3278,11 @@ unsafe fn test_svld1sw_gather_u64index_s64_with_svst1w_scatter_u64index_s64() {
     svsetffr();
     let loaded =
         svld1sw_gather_u64index_s64(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -2992,9 +3297,11 @@ unsafe fn test_svld1sh_gather_u64index_u64_with_svst1h_scatter_u64index_u64() {
     svsetffr();
     let loaded =
         svld1sh_gather_u64index_u64(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3009,9 +3316,11 @@ unsafe fn test_svld1sw_gather_u64index_u64_with_svst1w_scatter_u64index_u64() {
     svsetffr();
     let loaded =
         svld1sw_gather_u64index_u64(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3034,9 +3343,11 @@ unsafe fn test_svld1sh_gather_u32base_index_s32_with_svst1h_scatter_u32base_inde
         bases,
         storage.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3059,9 +3370,11 @@ unsafe fn test_svld1sh_gather_u32base_index_u32_with_svst1h_scatter_u32base_inde
         bases,
         storage.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3077,9 +3390,11 @@ unsafe fn test_svld1sh_gather_u64base_index_s64_with_svst1h_scatter_u64base_inde
     }
     svsetffr();
     let loaded = svld1sh_gather_u64base_index_s64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3095,9 +3410,11 @@ unsafe fn test_svld1sw_gather_u64base_index_s64_with_svst1w_scatter_u64base_inde
     }
     svsetffr();
     let loaded = svld1sw_gather_u64base_index_s64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3113,9 +3430,11 @@ unsafe fn test_svld1sh_gather_u64base_index_u64_with_svst1h_scatter_u64base_inde
     }
     svsetffr();
     let loaded = svld1sh_gather_u64base_index_u64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3131,9 +3450,11 @@ unsafe fn test_svld1sw_gather_u64base_index_u64_with_svst1w_scatter_u64base_inde
     }
     svsetffr();
     let loaded = svld1sw_gather_u64base_index_u64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3147,9 +3468,11 @@ unsafe fn test_svld1ub_gather_s32offset_s32_with_svst1b_scatter_s32offset_s32()
     }
     svsetffr();
     let loaded = svld1ub_gather_s32offset_s32(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3164,9 +3487,11 @@ unsafe fn test_svld1uh_gather_s32offset_s32_with_svst1h_scatter_s32offset_s32()
     svsetffr();
     let loaded =
         svld1uh_gather_s32offset_s32(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3180,9 +3505,11 @@ unsafe fn test_svld1ub_gather_s32offset_u32_with_svst1b_scatter_s32offset_u32()
     }
     svsetffr();
     let loaded = svld1ub_gather_s32offset_u32(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3197,9 +3524,11 @@ unsafe fn test_svld1uh_gather_s32offset_u32_with_svst1h_scatter_s32offset_u32()
     svsetffr();
     let loaded =
         svld1uh_gather_s32offset_u32(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3213,9 +3542,11 @@ unsafe fn test_svld1ub_gather_s64offset_s64_with_svst1b_scatter_s64offset_s64()
     }
     svsetffr();
     let loaded = svld1ub_gather_s64offset_s64(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3230,9 +3561,11 @@ unsafe fn test_svld1uh_gather_s64offset_s64_with_svst1h_scatter_s64offset_s64()
     svsetffr();
     let loaded =
         svld1uh_gather_s64offset_s64(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3247,9 +3580,11 @@ unsafe fn test_svld1uw_gather_s64offset_s64_with_svst1w_scatter_s64offset_s64()
     svsetffr();
     let loaded =
         svld1uw_gather_s64offset_s64(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3263,9 +3598,11 @@ unsafe fn test_svld1ub_gather_s64offset_u64_with_svst1b_scatter_s64offset_u64()
     }
     svsetffr();
     let loaded = svld1ub_gather_s64offset_u64(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3280,9 +3617,11 @@ unsafe fn test_svld1uh_gather_s64offset_u64_with_svst1h_scatter_s64offset_u64()
     svsetffr();
     let loaded =
         svld1uh_gather_s64offset_u64(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3297,9 +3636,11 @@ unsafe fn test_svld1uw_gather_s64offset_u64_with_svst1w_scatter_s64offset_u64()
     svsetffr();
     let loaded =
         svld1uw_gather_s64offset_u64(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3313,9 +3654,11 @@ unsafe fn test_svld1ub_gather_u32offset_s32_with_svst1b_scatter_u32offset_s32()
     }
     svsetffr();
     let loaded = svld1ub_gather_u32offset_s32(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3330,9 +3673,11 @@ unsafe fn test_svld1uh_gather_u32offset_s32_with_svst1h_scatter_u32offset_s32()
     svsetffr();
     let loaded =
         svld1uh_gather_u32offset_s32(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3346,9 +3691,11 @@ unsafe fn test_svld1ub_gather_u32offset_u32_with_svst1b_scatter_u32offset_u32()
     }
     svsetffr();
     let loaded = svld1ub_gather_u32offset_u32(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3363,9 +3710,11 @@ unsafe fn test_svld1uh_gather_u32offset_u32_with_svst1h_scatter_u32offset_u32()
     svsetffr();
     let loaded =
         svld1uh_gather_u32offset_u32(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3379,9 +3728,11 @@ unsafe fn test_svld1ub_gather_u64offset_s64_with_svst1b_scatter_u64offset_s64()
     }
     svsetffr();
     let loaded = svld1ub_gather_u64offset_s64(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3396,9 +3747,11 @@ unsafe fn test_svld1uh_gather_u64offset_s64_with_svst1h_scatter_u64offset_s64()
     svsetffr();
     let loaded =
         svld1uh_gather_u64offset_s64(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3413,9 +3766,11 @@ unsafe fn test_svld1uw_gather_u64offset_s64_with_svst1w_scatter_u64offset_s64()
     svsetffr();
     let loaded =
         svld1uw_gather_u64offset_s64(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3429,9 +3784,11 @@ unsafe fn test_svld1ub_gather_u64offset_u64_with_svst1b_scatter_u64offset_u64()
     }
     svsetffr();
     let loaded = svld1ub_gather_u64offset_u64(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3446,9 +3803,11 @@ unsafe fn test_svld1uh_gather_u64offset_u64_with_svst1h_scatter_u64offset_u64()
     svsetffr();
     let loaded =
         svld1uh_gather_u64offset_u64(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3463,9 +3822,11 @@ unsafe fn test_svld1uw_gather_u64offset_u64_with_svst1w_scatter_u64offset_u64()
     svsetffr();
     let loaded =
         svld1uw_gather_u64offset_u64(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3488,9 +3849,11 @@ unsafe fn test_svld1ub_gather_u32base_offset_s32_with_svst1b_scatter_u32base_off
         bases,
         storage.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3513,9 +3876,11 @@ unsafe fn test_svld1uh_gather_u32base_offset_s32_with_svst1h_scatter_u32base_off
         bases,
         storage.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3538,9 +3903,11 @@ unsafe fn test_svld1ub_gather_u32base_offset_u32_with_svst1b_scatter_u32base_off
         bases,
         storage.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3563,9 +3930,11 @@ unsafe fn test_svld1uh_gather_u32base_offset_u32_with_svst1h_scatter_u32base_off
         bases,
         storage.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3581,9 +3950,11 @@ unsafe fn test_svld1ub_gather_u64base_offset_s64_with_svst1b_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1ub_gather_u64base_offset_s64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3599,9 +3970,11 @@ unsafe fn test_svld1uh_gather_u64base_offset_s64_with_svst1h_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1uh_gather_u64base_offset_s64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3617,9 +3990,11 @@ unsafe fn test_svld1uw_gather_u64base_offset_s64_with_svst1w_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1uw_gather_u64base_offset_s64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3635,9 +4010,11 @@ unsafe fn test_svld1ub_gather_u64base_offset_u64_with_svst1b_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1ub_gather_u64base_offset_u64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3653,9 +4030,11 @@ unsafe fn test_svld1uh_gather_u64base_offset_u64_with_svst1h_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1uh_gather_u64base_offset_u64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3671,9 +4050,11 @@ unsafe fn test_svld1uw_gather_u64base_offset_u64_with_svst1w_scatter_u64base_off
     }
     svsetffr();
     let loaded = svld1uw_gather_u64base_offset_u64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3689,9 +4070,11 @@ unsafe fn test_svld1ub_gather_u64base_s64_with_svst1b_scatter_u64base_s64() {
     }
     svsetffr();
     let loaded = svld1ub_gather_u64base_s64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3707,9 +4090,11 @@ unsafe fn test_svld1uh_gather_u64base_s64_with_svst1h_scatter_u64base_s64() {
     }
     svsetffr();
     let loaded = svld1uh_gather_u64base_s64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3725,9 +4110,11 @@ unsafe fn test_svld1uw_gather_u64base_s64_with_svst1w_scatter_u64base_s64() {
     }
     svsetffr();
     let loaded = svld1uw_gather_u64base_s64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3743,9 +4130,11 @@ unsafe fn test_svld1ub_gather_u64base_u64_with_svst1b_scatter_u64base_u64() {
     }
     svsetffr();
     let loaded = svld1ub_gather_u64base_u64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3761,9 +4150,11 @@ unsafe fn test_svld1uh_gather_u64base_u64_with_svst1h_scatter_u64base_u64() {
     }
     svsetffr();
     let loaded = svld1uh_gather_u64base_u64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3779,9 +4170,11 @@ unsafe fn test_svld1uw_gather_u64base_u64_with_svst1w_scatter_u64base_u64() {
     }
     svsetffr();
     let loaded = svld1uw_gather_u64base_u64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3794,9 +4187,11 @@ unsafe fn test_svld1ub_s16_with_svst1b_s16() {
     }
     svsetffr();
     let loaded = svld1ub_s16(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3809,9 +4204,11 @@ unsafe fn test_svld1ub_s32_with_svst1b_s32() {
     }
     svsetffr();
     let loaded = svld1ub_s32(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3824,9 +4221,11 @@ unsafe fn test_svld1uh_s32_with_svst1h_s32() {
     }
     svsetffr();
     let loaded = svld1uh_s32(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3839,9 +4238,11 @@ unsafe fn test_svld1ub_s64_with_svst1b_s64() {
     }
     svsetffr();
     let loaded = svld1ub_s64(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3854,9 +4255,11 @@ unsafe fn test_svld1uh_s64_with_svst1h_s64() {
     }
     svsetffr();
     let loaded = svld1uh_s64(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3869,9 +4272,11 @@ unsafe fn test_svld1uw_s64_with_svst1w_s64() {
     }
     svsetffr();
     let loaded = svld1uw_s64(svptrue_b32(), storage.as_ptr() as *const u32);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3884,9 +4289,11 @@ unsafe fn test_svld1ub_u16_with_svst1b_u16() {
     }
     svsetffr();
     let loaded = svld1ub_u16(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3899,9 +4306,11 @@ unsafe fn test_svld1ub_u32_with_svst1b_u32() {
     }
     svsetffr();
     let loaded = svld1ub_u32(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3914,9 +4323,11 @@ unsafe fn test_svld1uh_u32_with_svst1h_u32() {
     }
     svsetffr();
     let loaded = svld1uh_u32(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3929,9 +4340,11 @@ unsafe fn test_svld1ub_u64_with_svst1b_u64() {
     }
     svsetffr();
     let loaded = svld1ub_u64(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3944,9 +4357,11 @@ unsafe fn test_svld1uh_u64_with_svst1h_u64() {
     }
     svsetffr();
     let loaded = svld1uh_u64(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3959,9 +4374,11 @@ unsafe fn test_svld1uw_u64_with_svst1w_u64() {
     }
     svsetffr();
     let loaded = svld1uw_u64(svptrue_b32(), storage.as_ptr() as *const u32);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -3978,12 +4395,14 @@ unsafe fn test_svld1ub_vnum_s16_with_svst1b_vnum_s16() {
     }
     svsetffr();
     let loaded = svld1ub_vnum_s16(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4000,12 +4419,14 @@ unsafe fn test_svld1ub_vnum_s32_with_svst1b_vnum_s32() {
     }
     svsetffr();
     let loaded = svld1ub_vnum_s32(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4022,12 +4443,14 @@ unsafe fn test_svld1uh_vnum_s32_with_svst1h_vnum_s32() {
     }
     svsetffr();
     let loaded = svld1uh_vnum_s32(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4044,12 +4467,14 @@ unsafe fn test_svld1ub_vnum_s64_with_svst1b_vnum_s64() {
     }
     svsetffr();
     let loaded = svld1ub_vnum_s64(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4066,12 +4491,14 @@ unsafe fn test_svld1uh_vnum_s64_with_svst1h_vnum_s64() {
     }
     svsetffr();
     let loaded = svld1uh_vnum_s64(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4088,12 +4515,14 @@ unsafe fn test_svld1uw_vnum_s64_with_svst1w_vnum_s64() {
     }
     svsetffr();
     let loaded = svld1uw_vnum_s64(svptrue_b32(), storage.as_ptr() as *const u32, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4110,12 +4539,14 @@ unsafe fn test_svld1ub_vnum_u16_with_svst1b_vnum_u16() {
     }
     svsetffr();
     let loaded = svld1ub_vnum_u16(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4132,12 +4563,14 @@ unsafe fn test_svld1ub_vnum_u32_with_svst1b_vnum_u32() {
     }
     svsetffr();
     let loaded = svld1ub_vnum_u32(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4154,12 +4587,14 @@ unsafe fn test_svld1uh_vnum_u32_with_svst1h_vnum_u32() {
     }
     svsetffr();
     let loaded = svld1uh_vnum_u32(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4176,12 +4611,14 @@ unsafe fn test_svld1ub_vnum_u64_with_svst1b_vnum_u64() {
     }
     svsetffr();
     let loaded = svld1ub_vnum_u64(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4198,12 +4635,14 @@ unsafe fn test_svld1uh_vnum_u64_with_svst1h_vnum_u64() {
     }
     svsetffr();
     let loaded = svld1uh_vnum_u64(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4220,12 +4659,14 @@ unsafe fn test_svld1uw_vnum_u64_with_svst1w_vnum_u64() {
     }
     svsetffr();
     let loaded = svld1uw_vnum_u64(svptrue_b32(), storage.as_ptr() as *const u32, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4240,9 +4681,11 @@ unsafe fn test_svld1uh_gather_s32index_s32_with_svst1h_scatter_s32index_s32() {
     svsetffr();
     let loaded =
         svld1uh_gather_s32index_s32(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4257,9 +4700,11 @@ unsafe fn test_svld1uh_gather_s32index_u32_with_svst1h_scatter_s32index_u32() {
     svsetffr();
     let loaded =
         svld1uh_gather_s32index_u32(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4274,9 +4719,11 @@ unsafe fn test_svld1uh_gather_s64index_s64_with_svst1h_scatter_s64index_s64() {
     svsetffr();
     let loaded =
         svld1uh_gather_s64index_s64(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4291,9 +4738,11 @@ unsafe fn test_svld1uw_gather_s64index_s64_with_svst1w_scatter_s64index_s64() {
     svsetffr();
     let loaded =
         svld1uw_gather_s64index_s64(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4308,9 +4757,11 @@ unsafe fn test_svld1uh_gather_s64index_u64_with_svst1h_scatter_s64index_u64() {
     svsetffr();
     let loaded =
         svld1uh_gather_s64index_u64(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4325,9 +4776,11 @@ unsafe fn test_svld1uw_gather_s64index_u64_with_svst1w_scatter_s64index_u64() {
     svsetffr();
     let loaded =
         svld1uw_gather_s64index_u64(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4342,9 +4795,11 @@ unsafe fn test_svld1uh_gather_u32index_s32_with_svst1h_scatter_u32index_s32() {
     svsetffr();
     let loaded =
         svld1uh_gather_u32index_s32(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4359,9 +4814,11 @@ unsafe fn test_svld1uh_gather_u32index_u32_with_svst1h_scatter_u32index_u32() {
     svsetffr();
     let loaded =
         svld1uh_gather_u32index_u32(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4376,9 +4833,11 @@ unsafe fn test_svld1uh_gather_u64index_s64_with_svst1h_scatter_u64index_s64() {
     svsetffr();
     let loaded =
         svld1uh_gather_u64index_s64(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4393,9 +4852,11 @@ unsafe fn test_svld1uw_gather_u64index_s64_with_svst1w_scatter_u64index_s64() {
     svsetffr();
     let loaded =
         svld1uw_gather_u64index_s64(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4410,9 +4871,11 @@ unsafe fn test_svld1uh_gather_u64index_u64_with_svst1h_scatter_u64index_u64() {
     svsetffr();
     let loaded =
         svld1uh_gather_u64index_u64(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4427,9 +4890,11 @@ unsafe fn test_svld1uw_gather_u64index_u64_with_svst1w_scatter_u64index_u64() {
     svsetffr();
     let loaded =
         svld1uw_gather_u64index_u64(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4452,9 +4917,11 @@ unsafe fn test_svld1uh_gather_u32base_index_s32_with_svst1h_scatter_u32base_inde
         bases,
         storage.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4477,9 +4944,11 @@ unsafe fn test_svld1uh_gather_u32base_index_u32_with_svst1h_scatter_u32base_inde
         bases,
         storage.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4495,9 +4964,11 @@ unsafe fn test_svld1uh_gather_u64base_index_s64_with_svst1h_scatter_u64base_inde
     }
     svsetffr();
     let loaded = svld1uh_gather_u64base_index_s64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4513,9 +4984,11 @@ unsafe fn test_svld1uw_gather_u64base_index_s64_with_svst1w_scatter_u64base_inde
     }
     svsetffr();
     let loaded = svld1uw_gather_u64base_index_s64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4531,9 +5004,11 @@ unsafe fn test_svld1uh_gather_u64base_index_u64_with_svst1h_scatter_u64base_inde
     }
     svsetffr();
     let loaded = svld1uh_gather_u64base_index_u64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4549,9 +5024,11 @@ unsafe fn test_svld1uw_gather_u64base_index_u64_with_svst1w_scatter_u64base_inde
     }
     svsetffr();
     let loaded = svld1uw_gather_u64base_index_u64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4573,12 +5050,14 @@ unsafe fn test_svld2_f32_with_svst2_f32() {
     }
     svsetffr();
     let loaded = svld2_f32(svptrue_b32(), storage.as_ptr() as *const f32);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         svget2_f32::<{ 0usize as i32 }>(loaded),
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget2_f32::<{ 1usize as i32 }>(loaded),
@@ -4586,6 +5065,7 @@ unsafe fn test_svld2_f32_with_svst2_f32() {
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4607,12 +5087,14 @@ unsafe fn test_svld2_f64_with_svst2_f64() {
     }
     svsetffr();
     let loaded = svld2_f64(svptrue_b64(), storage.as_ptr() as *const f64);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         svget2_f64::<{ 0usize as i32 }>(loaded),
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget2_f64::<{ 1usize as i32 }>(loaded),
@@ -4620,6 +5102,7 @@ unsafe fn test_svld2_f64_with_svst2_f64() {
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4635,13 +5118,16 @@ unsafe fn test_svld2_s8_with_svst2_s8() {
     }
     svsetffr();
     let loaded = svld2_s8(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         svget2_s8::<{ 0usize as i32 }>(loaded),
         svindex_s8((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i8(
         svget2_s8::<{ 1usize as i32 }>(loaded),
         svindex_s8((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4657,13 +5143,16 @@ unsafe fn test_svld2_s16_with_svst2_s16() {
     }
     svsetffr();
     let loaded = svld2_s16(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         svget2_s16::<{ 0usize as i32 }>(loaded),
         svindex_s16((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i16(
         svget2_s16::<{ 1usize as i32 }>(loaded),
         svindex_s16((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4679,13 +5168,16 @@ unsafe fn test_svld2_s32_with_svst2_s32() {
     }
     svsetffr();
     let loaded = svld2_s32(svptrue_b32(), storage.as_ptr() as *const i32);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         svget2_s32::<{ 0usize as i32 }>(loaded),
         svindex_s32((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i32(
         svget2_s32::<{ 1usize as i32 }>(loaded),
         svindex_s32((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4701,13 +5193,16 @@ unsafe fn test_svld2_s64_with_svst2_s64() {
     }
     svsetffr();
     let loaded = svld2_s64(svptrue_b64(), storage.as_ptr() as *const i64);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         svget2_s64::<{ 0usize as i32 }>(loaded),
         svindex_s64((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i64(
         svget2_s64::<{ 1usize as i32 }>(loaded),
         svindex_s64((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4723,13 +5218,16 @@ unsafe fn test_svld2_u8_with_svst2_u8() {
     }
     svsetffr();
     let loaded = svld2_u8(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         svget2_u8::<{ 0usize as i32 }>(loaded),
         svindex_u8((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u8(
         svget2_u8::<{ 1usize as i32 }>(loaded),
         svindex_u8((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4745,13 +5243,16 @@ unsafe fn test_svld2_u16_with_svst2_u16() {
     }
     svsetffr();
     let loaded = svld2_u16(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         svget2_u16::<{ 0usize as i32 }>(loaded),
         svindex_u16((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u16(
         svget2_u16::<{ 1usize as i32 }>(loaded),
         svindex_u16((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4767,13 +5268,16 @@ unsafe fn test_svld2_u32_with_svst2_u32() {
     }
     svsetffr();
     let loaded = svld2_u32(svptrue_b32(), storage.as_ptr() as *const u32);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         svget2_u32::<{ 0usize as i32 }>(loaded),
         svindex_u32((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u32(
         svget2_u32::<{ 1usize as i32 }>(loaded),
         svindex_u32((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4789,13 +5293,16 @@ unsafe fn test_svld2_u64_with_svst2_u64() {
     }
     svsetffr();
     let loaded = svld2_u64(svptrue_b64(), storage.as_ptr() as *const u64);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         svget2_u64::<{ 0usize as i32 }>(loaded),
         svindex_u64((0usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u64(
         svget2_u64::<{ 1usize as i32 }>(loaded),
         svindex_u64((1usize).try_into().unwrap(), 2usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4824,6 +5331,7 @@ unsafe fn test_svld2_vnum_f32_with_svst2_vnum_f32() {
     }
     svsetffr();
     let loaded = svld2_vnum_f32(svptrue_b32(), storage.as_ptr() as *const f32, 1);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         svget2_f32::<{ 0usize as i32 }>(loaded),
         svcvt_f32_s32_x(
@@ -4833,6 +5341,7 @@ unsafe fn test_svld2_vnum_f32_with_svst2_vnum_f32() {
                 2usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget2_f32::<{ 1usize as i32 }>(loaded),
@@ -4843,6 +5352,7 @@ unsafe fn test_svld2_vnum_f32_with_svst2_vnum_f32() {
                 2usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4871,6 +5381,7 @@ unsafe fn test_svld2_vnum_f64_with_svst2_vnum_f64() {
     }
     svsetffr();
     let loaded = svld2_vnum_f64(svptrue_b64(), storage.as_ptr() as *const f64, 1);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         svget2_f64::<{ 0usize as i32 }>(loaded),
         svcvt_f64_s64_x(
@@ -4880,6 +5391,7 @@ unsafe fn test_svld2_vnum_f64_with_svst2_vnum_f64() {
                 2usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget2_f64::<{ 1usize as i32 }>(loaded),
@@ -4890,6 +5402,7 @@ unsafe fn test_svld2_vnum_f64_with_svst2_vnum_f64() {
                 2usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4912,12 +5425,14 @@ unsafe fn test_svld2_vnum_s8_with_svst2_vnum_s8() {
     }
     svsetffr();
     let loaded = svld2_vnum_s8(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         svget2_s8::<{ 0usize as i32 }>(loaded),
         svindex_s8(
             (len + 0usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i8(
         svget2_s8::<{ 1usize as i32 }>(loaded),
@@ -4925,6 +5440,7 @@ unsafe fn test_svld2_vnum_s8_with_svst2_vnum_s8() {
             (len + 1usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4947,12 +5463,14 @@ unsafe fn test_svld2_vnum_s16_with_svst2_vnum_s16() {
     }
     svsetffr();
     let loaded = svld2_vnum_s16(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         svget2_s16::<{ 0usize as i32 }>(loaded),
         svindex_s16(
             (len + 0usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i16(
         svget2_s16::<{ 1usize as i32 }>(loaded),
@@ -4960,6 +5478,7 @@ unsafe fn test_svld2_vnum_s16_with_svst2_vnum_s16() {
             (len + 1usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -4982,12 +5501,14 @@ unsafe fn test_svld2_vnum_s32_with_svst2_vnum_s32() {
     }
     svsetffr();
     let loaded = svld2_vnum_s32(svptrue_b32(), storage.as_ptr() as *const i32, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         svget2_s32::<{ 0usize as i32 }>(loaded),
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i32(
         svget2_s32::<{ 1usize as i32 }>(loaded),
@@ -4995,6 +5516,7 @@ unsafe fn test_svld2_vnum_s32_with_svst2_vnum_s32() {
             (len + 1usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5017,12 +5539,14 @@ unsafe fn test_svld2_vnum_s64_with_svst2_vnum_s64() {
     }
     svsetffr();
     let loaded = svld2_vnum_s64(svptrue_b64(), storage.as_ptr() as *const i64, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         svget2_s64::<{ 0usize as i32 }>(loaded),
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i64(
         svget2_s64::<{ 1usize as i32 }>(loaded),
@@ -5030,6 +5554,7 @@ unsafe fn test_svld2_vnum_s64_with_svst2_vnum_s64() {
             (len + 1usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5052,12 +5577,14 @@ unsafe fn test_svld2_vnum_u8_with_svst2_vnum_u8() {
     }
     svsetffr();
     let loaded = svld2_vnum_u8(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         svget2_u8::<{ 0usize as i32 }>(loaded),
         svindex_u8(
             (len + 0usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u8(
         svget2_u8::<{ 1usize as i32 }>(loaded),
@@ -5065,6 +5592,7 @@ unsafe fn test_svld2_vnum_u8_with_svst2_vnum_u8() {
             (len + 1usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5087,12 +5615,14 @@ unsafe fn test_svld2_vnum_u16_with_svst2_vnum_u16() {
     }
     svsetffr();
     let loaded = svld2_vnum_u16(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         svget2_u16::<{ 0usize as i32 }>(loaded),
         svindex_u16(
             (len + 0usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u16(
         svget2_u16::<{ 1usize as i32 }>(loaded),
@@ -5100,6 +5630,7 @@ unsafe fn test_svld2_vnum_u16_with_svst2_vnum_u16() {
             (len + 1usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5122,12 +5653,14 @@ unsafe fn test_svld2_vnum_u32_with_svst2_vnum_u32() {
     }
     svsetffr();
     let loaded = svld2_vnum_u32(svptrue_b32(), storage.as_ptr() as *const u32, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         svget2_u32::<{ 0usize as i32 }>(loaded),
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u32(
         svget2_u32::<{ 1usize as i32 }>(loaded),
@@ -5135,6 +5668,7 @@ unsafe fn test_svld2_vnum_u32_with_svst2_vnum_u32() {
             (len + 1usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5157,12 +5691,14 @@ unsafe fn test_svld2_vnum_u64_with_svst2_vnum_u64() {
     }
     svsetffr();
     let loaded = svld2_vnum_u64(svptrue_b64(), storage.as_ptr() as *const u64, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         svget2_u64::<{ 0usize as i32 }>(loaded),
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u64(
         svget2_u64::<{ 1usize as i32 }>(loaded),
@@ -5170,6 +5706,7 @@ unsafe fn test_svld2_vnum_u64_with_svst2_vnum_u64() {
             (len + 1usize).try_into().unwrap(),
             2usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5195,12 +5732,14 @@ unsafe fn test_svld3_f32_with_svst3_f32() {
     }
     svsetffr();
     let loaded = svld3_f32(svptrue_b32(), storage.as_ptr() as *const f32);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         svget3_f32::<{ 0usize as i32 }>(loaded),
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget3_f32::<{ 1usize as i32 }>(loaded),
@@ -5208,6 +5747,7 @@ unsafe fn test_svld3_f32_with_svst3_f32() {
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget3_f32::<{ 2usize as i32 }>(loaded),
@@ -5215,6 +5755,7 @@ unsafe fn test_svld3_f32_with_svst3_f32() {
             svptrue_b32(),
             svindex_s32((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5240,12 +5781,14 @@ unsafe fn test_svld3_f64_with_svst3_f64() {
     }
     svsetffr();
     let loaded = svld3_f64(svptrue_b64(), storage.as_ptr() as *const f64);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         svget3_f64::<{ 0usize as i32 }>(loaded),
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget3_f64::<{ 1usize as i32 }>(loaded),
@@ -5253,6 +5796,7 @@ unsafe fn test_svld3_f64_with_svst3_f64() {
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget3_f64::<{ 2usize as i32 }>(loaded),
@@ -5260,6 +5804,7 @@ unsafe fn test_svld3_f64_with_svst3_f64() {
             svptrue_b64(),
             svindex_s64((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5276,17 +5821,21 @@ unsafe fn test_svld3_s8_with_svst3_s8() {
     }
     svsetffr();
     let loaded = svld3_s8(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         svget3_s8::<{ 0usize as i32 }>(loaded),
         svindex_s8((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i8(
         svget3_s8::<{ 1usize as i32 }>(loaded),
         svindex_s8((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i8(
         svget3_s8::<{ 2usize as i32 }>(loaded),
         svindex_s8((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5303,17 +5852,21 @@ unsafe fn test_svld3_s16_with_svst3_s16() {
     }
     svsetffr();
     let loaded = svld3_s16(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         svget3_s16::<{ 0usize as i32 }>(loaded),
         svindex_s16((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i16(
         svget3_s16::<{ 1usize as i32 }>(loaded),
         svindex_s16((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i16(
         svget3_s16::<{ 2usize as i32 }>(loaded),
         svindex_s16((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5330,17 +5883,21 @@ unsafe fn test_svld3_s32_with_svst3_s32() {
     }
     svsetffr();
     let loaded = svld3_s32(svptrue_b32(), storage.as_ptr() as *const i32);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         svget3_s32::<{ 0usize as i32 }>(loaded),
         svindex_s32((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i32(
         svget3_s32::<{ 1usize as i32 }>(loaded),
         svindex_s32((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i32(
         svget3_s32::<{ 2usize as i32 }>(loaded),
         svindex_s32((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5357,17 +5914,21 @@ unsafe fn test_svld3_s64_with_svst3_s64() {
     }
     svsetffr();
     let loaded = svld3_s64(svptrue_b64(), storage.as_ptr() as *const i64);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         svget3_s64::<{ 0usize as i32 }>(loaded),
         svindex_s64((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i64(
         svget3_s64::<{ 1usize as i32 }>(loaded),
         svindex_s64((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i64(
         svget3_s64::<{ 2usize as i32 }>(loaded),
         svindex_s64((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5384,17 +5945,21 @@ unsafe fn test_svld3_u8_with_svst3_u8() {
     }
     svsetffr();
     let loaded = svld3_u8(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         svget3_u8::<{ 0usize as i32 }>(loaded),
         svindex_u8((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u8(
         svget3_u8::<{ 1usize as i32 }>(loaded),
         svindex_u8((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u8(
         svget3_u8::<{ 2usize as i32 }>(loaded),
         svindex_u8((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5411,17 +5976,21 @@ unsafe fn test_svld3_u16_with_svst3_u16() {
     }
     svsetffr();
     let loaded = svld3_u16(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         svget3_u16::<{ 0usize as i32 }>(loaded),
         svindex_u16((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u16(
         svget3_u16::<{ 1usize as i32 }>(loaded),
         svindex_u16((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u16(
         svget3_u16::<{ 2usize as i32 }>(loaded),
         svindex_u16((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5438,17 +6007,21 @@ unsafe fn test_svld3_u32_with_svst3_u32() {
     }
     svsetffr();
     let loaded = svld3_u32(svptrue_b32(), storage.as_ptr() as *const u32);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         svget3_u32::<{ 0usize as i32 }>(loaded),
         svindex_u32((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u32(
         svget3_u32::<{ 1usize as i32 }>(loaded),
         svindex_u32((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u32(
         svget3_u32::<{ 2usize as i32 }>(loaded),
         svindex_u32((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5465,17 +6038,21 @@ unsafe fn test_svld3_u64_with_svst3_u64() {
     }
     svsetffr();
     let loaded = svld3_u64(svptrue_b64(), storage.as_ptr() as *const u64);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         svget3_u64::<{ 0usize as i32 }>(loaded),
         svindex_u64((0usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u64(
         svget3_u64::<{ 1usize as i32 }>(loaded),
         svindex_u64((1usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u64(
         svget3_u64::<{ 2usize as i32 }>(loaded),
         svindex_u64((2usize).try_into().unwrap(), 3usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5511,6 +6088,7 @@ unsafe fn test_svld3_vnum_f32_with_svst3_vnum_f32() {
     }
     svsetffr();
     let loaded = svld3_vnum_f32(svptrue_b32(), storage.as_ptr() as *const f32, 1);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         svget3_f32::<{ 0usize as i32 }>(loaded),
         svcvt_f32_s32_x(
@@ -5520,6 +6098,7 @@ unsafe fn test_svld3_vnum_f32_with_svst3_vnum_f32() {
                 3usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget3_f32::<{ 1usize as i32 }>(loaded),
@@ -5530,6 +6109,7 @@ unsafe fn test_svld3_vnum_f32_with_svst3_vnum_f32() {
                 3usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget3_f32::<{ 2usize as i32 }>(loaded),
@@ -5540,6 +6120,7 @@ unsafe fn test_svld3_vnum_f32_with_svst3_vnum_f32() {
                 3usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5575,6 +6156,7 @@ unsafe fn test_svld3_vnum_f64_with_svst3_vnum_f64() {
     }
     svsetffr();
     let loaded = svld3_vnum_f64(svptrue_b64(), storage.as_ptr() as *const f64, 1);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         svget3_f64::<{ 0usize as i32 }>(loaded),
         svcvt_f64_s64_x(
@@ -5584,6 +6166,7 @@ unsafe fn test_svld3_vnum_f64_with_svst3_vnum_f64() {
                 3usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget3_f64::<{ 1usize as i32 }>(loaded),
@@ -5594,6 +6177,7 @@ unsafe fn test_svld3_vnum_f64_with_svst3_vnum_f64() {
                 3usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget3_f64::<{ 2usize as i32 }>(loaded),
@@ -5604,6 +6188,7 @@ unsafe fn test_svld3_vnum_f64_with_svst3_vnum_f64() {
                 3usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5630,12 +6215,14 @@ unsafe fn test_svld3_vnum_s8_with_svst3_vnum_s8() {
     }
     svsetffr();
     let loaded = svld3_vnum_s8(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         svget3_s8::<{ 0usize as i32 }>(loaded),
         svindex_s8(
             (len + 0usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i8(
         svget3_s8::<{ 1usize as i32 }>(loaded),
@@ -5643,6 +6230,7 @@ unsafe fn test_svld3_vnum_s8_with_svst3_vnum_s8() {
             (len + 1usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i8(
         svget3_s8::<{ 2usize as i32 }>(loaded),
@@ -5650,6 +6238,7 @@ unsafe fn test_svld3_vnum_s8_with_svst3_vnum_s8() {
             (len + 2usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5676,12 +6265,14 @@ unsafe fn test_svld3_vnum_s16_with_svst3_vnum_s16() {
     }
     svsetffr();
     let loaded = svld3_vnum_s16(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         svget3_s16::<{ 0usize as i32 }>(loaded),
         svindex_s16(
             (len + 0usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i16(
         svget3_s16::<{ 1usize as i32 }>(loaded),
@@ -5689,6 +6280,7 @@ unsafe fn test_svld3_vnum_s16_with_svst3_vnum_s16() {
             (len + 1usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i16(
         svget3_s16::<{ 2usize as i32 }>(loaded),
@@ -5696,6 +6288,7 @@ unsafe fn test_svld3_vnum_s16_with_svst3_vnum_s16() {
             (len + 2usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5722,12 +6315,14 @@ unsafe fn test_svld3_vnum_s32_with_svst3_vnum_s32() {
     }
     svsetffr();
     let loaded = svld3_vnum_s32(svptrue_b32(), storage.as_ptr() as *const i32, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         svget3_s32::<{ 0usize as i32 }>(loaded),
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i32(
         svget3_s32::<{ 1usize as i32 }>(loaded),
@@ -5735,6 +6330,7 @@ unsafe fn test_svld3_vnum_s32_with_svst3_vnum_s32() {
             (len + 1usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i32(
         svget3_s32::<{ 2usize as i32 }>(loaded),
@@ -5742,6 +6338,7 @@ unsafe fn test_svld3_vnum_s32_with_svst3_vnum_s32() {
             (len + 2usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5768,12 +6365,14 @@ unsafe fn test_svld3_vnum_s64_with_svst3_vnum_s64() {
     }
     svsetffr();
     let loaded = svld3_vnum_s64(svptrue_b64(), storage.as_ptr() as *const i64, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         svget3_s64::<{ 0usize as i32 }>(loaded),
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i64(
         svget3_s64::<{ 1usize as i32 }>(loaded),
@@ -5781,6 +6380,7 @@ unsafe fn test_svld3_vnum_s64_with_svst3_vnum_s64() {
             (len + 1usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i64(
         svget3_s64::<{ 2usize as i32 }>(loaded),
@@ -5788,6 +6388,7 @@ unsafe fn test_svld3_vnum_s64_with_svst3_vnum_s64() {
             (len + 2usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5814,12 +6415,14 @@ unsafe fn test_svld3_vnum_u8_with_svst3_vnum_u8() {
     }
     svsetffr();
     let loaded = svld3_vnum_u8(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         svget3_u8::<{ 0usize as i32 }>(loaded),
         svindex_u8(
             (len + 0usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u8(
         svget3_u8::<{ 1usize as i32 }>(loaded),
@@ -5827,6 +6430,7 @@ unsafe fn test_svld3_vnum_u8_with_svst3_vnum_u8() {
             (len + 1usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u8(
         svget3_u8::<{ 2usize as i32 }>(loaded),
@@ -5834,6 +6438,7 @@ unsafe fn test_svld3_vnum_u8_with_svst3_vnum_u8() {
             (len + 2usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5860,12 +6465,14 @@ unsafe fn test_svld3_vnum_u16_with_svst3_vnum_u16() {
     }
     svsetffr();
     let loaded = svld3_vnum_u16(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         svget3_u16::<{ 0usize as i32 }>(loaded),
         svindex_u16(
             (len + 0usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u16(
         svget3_u16::<{ 1usize as i32 }>(loaded),
@@ -5873,6 +6480,7 @@ unsafe fn test_svld3_vnum_u16_with_svst3_vnum_u16() {
             (len + 1usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u16(
         svget3_u16::<{ 2usize as i32 }>(loaded),
@@ -5880,6 +6488,7 @@ unsafe fn test_svld3_vnum_u16_with_svst3_vnum_u16() {
             (len + 2usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5906,12 +6515,14 @@ unsafe fn test_svld3_vnum_u32_with_svst3_vnum_u32() {
     }
     svsetffr();
     let loaded = svld3_vnum_u32(svptrue_b32(), storage.as_ptr() as *const u32, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         svget3_u32::<{ 0usize as i32 }>(loaded),
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u32(
         svget3_u32::<{ 1usize as i32 }>(loaded),
@@ -5919,6 +6530,7 @@ unsafe fn test_svld3_vnum_u32_with_svst3_vnum_u32() {
             (len + 1usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u32(
         svget3_u32::<{ 2usize as i32 }>(loaded),
@@ -5926,6 +6538,7 @@ unsafe fn test_svld3_vnum_u32_with_svst3_vnum_u32() {
             (len + 2usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -5952,12 +6565,14 @@ unsafe fn test_svld3_vnum_u64_with_svst3_vnum_u64() {
     }
     svsetffr();
     let loaded = svld3_vnum_u64(svptrue_b64(), storage.as_ptr() as *const u64, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         svget3_u64::<{ 0usize as i32 }>(loaded),
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u64(
         svget3_u64::<{ 1usize as i32 }>(loaded),
@@ -5965,6 +6580,7 @@ unsafe fn test_svld3_vnum_u64_with_svst3_vnum_u64() {
             (len + 1usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u64(
         svget3_u64::<{ 2usize as i32 }>(loaded),
@@ -5972,6 +6588,7 @@ unsafe fn test_svld3_vnum_u64_with_svst3_vnum_u64() {
             (len + 2usize).try_into().unwrap(),
             3usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6001,12 +6618,14 @@ unsafe fn test_svld4_f32_with_svst4_f32() {
     }
     svsetffr();
     let loaded = svld4_f32(svptrue_b32(), storage.as_ptr() as *const f32);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         svget4_f32::<{ 0usize as i32 }>(loaded),
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget4_f32::<{ 1usize as i32 }>(loaded),
@@ -6014,6 +6633,7 @@ unsafe fn test_svld4_f32_with_svst4_f32() {
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget4_f32::<{ 2usize as i32 }>(loaded),
@@ -6021,6 +6641,7 @@ unsafe fn test_svld4_f32_with_svst4_f32() {
             svptrue_b32(),
             svindex_s32((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget4_f32::<{ 3usize as i32 }>(loaded),
@@ -6028,6 +6649,7 @@ unsafe fn test_svld4_f32_with_svst4_f32() {
             svptrue_b32(),
             svindex_s32((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6057,12 +6679,14 @@ unsafe fn test_svld4_f64_with_svst4_f64() {
     }
     svsetffr();
     let loaded = svld4_f64(svptrue_b64(), storage.as_ptr() as *const f64);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         svget4_f64::<{ 0usize as i32 }>(loaded),
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget4_f64::<{ 1usize as i32 }>(loaded),
@@ -6070,6 +6694,7 @@ unsafe fn test_svld4_f64_with_svst4_f64() {
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget4_f64::<{ 2usize as i32 }>(loaded),
@@ -6077,6 +6702,7 @@ unsafe fn test_svld4_f64_with_svst4_f64() {
             svptrue_b64(),
             svindex_s64((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget4_f64::<{ 3usize as i32 }>(loaded),
@@ -6084,6 +6710,7 @@ unsafe fn test_svld4_f64_with_svst4_f64() {
             svptrue_b64(),
             svindex_s64((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6101,21 +6728,26 @@ unsafe fn test_svld4_s8_with_svst4_s8() {
     }
     svsetffr();
     let loaded = svld4_s8(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         svget4_s8::<{ 0usize as i32 }>(loaded),
         svindex_s8((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i8(
         svget4_s8::<{ 1usize as i32 }>(loaded),
         svindex_s8((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i8(
         svget4_s8::<{ 2usize as i32 }>(loaded),
         svindex_s8((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i8(
         svget4_s8::<{ 3usize as i32 }>(loaded),
         svindex_s8((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6133,21 +6765,26 @@ unsafe fn test_svld4_s16_with_svst4_s16() {
     }
     svsetffr();
     let loaded = svld4_s16(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         svget4_s16::<{ 0usize as i32 }>(loaded),
         svindex_s16((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i16(
         svget4_s16::<{ 1usize as i32 }>(loaded),
         svindex_s16((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i16(
         svget4_s16::<{ 2usize as i32 }>(loaded),
         svindex_s16((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i16(
         svget4_s16::<{ 3usize as i32 }>(loaded),
         svindex_s16((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6165,21 +6802,26 @@ unsafe fn test_svld4_s32_with_svst4_s32() {
     }
     svsetffr();
     let loaded = svld4_s32(svptrue_b32(), storage.as_ptr() as *const i32);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         svget4_s32::<{ 0usize as i32 }>(loaded),
         svindex_s32((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i32(
         svget4_s32::<{ 1usize as i32 }>(loaded),
         svindex_s32((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i32(
         svget4_s32::<{ 2usize as i32 }>(loaded),
         svindex_s32((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i32(
         svget4_s32::<{ 3usize as i32 }>(loaded),
         svindex_s32((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6197,21 +6839,26 @@ unsafe fn test_svld4_s64_with_svst4_s64() {
     }
     svsetffr();
     let loaded = svld4_s64(svptrue_b64(), storage.as_ptr() as *const i64);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         svget4_s64::<{ 0usize as i32 }>(loaded),
         svindex_s64((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i64(
         svget4_s64::<{ 1usize as i32 }>(loaded),
         svindex_s64((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i64(
         svget4_s64::<{ 2usize as i32 }>(loaded),
         svindex_s64((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_i64(
         svget4_s64::<{ 3usize as i32 }>(loaded),
         svindex_s64((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6229,21 +6876,26 @@ unsafe fn test_svld4_u8_with_svst4_u8() {
     }
     svsetffr();
     let loaded = svld4_u8(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         svget4_u8::<{ 0usize as i32 }>(loaded),
         svindex_u8((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u8(
         svget4_u8::<{ 1usize as i32 }>(loaded),
         svindex_u8((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u8(
         svget4_u8::<{ 2usize as i32 }>(loaded),
         svindex_u8((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u8(
         svget4_u8::<{ 3usize as i32 }>(loaded),
         svindex_u8((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6261,21 +6913,26 @@ unsafe fn test_svld4_u16_with_svst4_u16() {
     }
     svsetffr();
     let loaded = svld4_u16(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         svget4_u16::<{ 0usize as i32 }>(loaded),
         svindex_u16((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u16(
         svget4_u16::<{ 1usize as i32 }>(loaded),
         svindex_u16((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u16(
         svget4_u16::<{ 2usize as i32 }>(loaded),
         svindex_u16((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u16(
         svget4_u16::<{ 3usize as i32 }>(loaded),
         svindex_u16((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6293,21 +6950,26 @@ unsafe fn test_svld4_u32_with_svst4_u32() {
     }
     svsetffr();
     let loaded = svld4_u32(svptrue_b32(), storage.as_ptr() as *const u32);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         svget4_u32::<{ 0usize as i32 }>(loaded),
         svindex_u32((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u32(
         svget4_u32::<{ 1usize as i32 }>(loaded),
         svindex_u32((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u32(
         svget4_u32::<{ 2usize as i32 }>(loaded),
         svindex_u32((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u32(
         svget4_u32::<{ 3usize as i32 }>(loaded),
         svindex_u32((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6325,21 +6987,26 @@ unsafe fn test_svld4_u64_with_svst4_u64() {
     }
     svsetffr();
     let loaded = svld4_u64(svptrue_b64(), storage.as_ptr() as *const u64);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         svget4_u64::<{ 0usize as i32 }>(loaded),
         svindex_u64((0usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u64(
         svget4_u64::<{ 1usize as i32 }>(loaded),
         svindex_u64((1usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u64(
         svget4_u64::<{ 2usize as i32 }>(loaded),
         svindex_u64((2usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
     assert_vector_matches_u64(
         svget4_u64::<{ 3usize as i32 }>(loaded),
         svindex_u64((3usize).try_into().unwrap(), 4usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6382,6 +7049,7 @@ unsafe fn test_svld4_vnum_f32_with_svst4_vnum_f32() {
     }
     svsetffr();
     let loaded = svld4_vnum_f32(svptrue_b32(), storage.as_ptr() as *const f32, 1);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         svget4_f32::<{ 0usize as i32 }>(loaded),
         svcvt_f32_s32_x(
@@ -6391,6 +7059,7 @@ unsafe fn test_svld4_vnum_f32_with_svst4_vnum_f32() {
                 4usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget4_f32::<{ 1usize as i32 }>(loaded),
@@ -6401,6 +7070,7 @@ unsafe fn test_svld4_vnum_f32_with_svst4_vnum_f32() {
                 4usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget4_f32::<{ 2usize as i32 }>(loaded),
@@ -6411,6 +7081,7 @@ unsafe fn test_svld4_vnum_f32_with_svst4_vnum_f32() {
                 4usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f32(
         svget4_f32::<{ 3usize as i32 }>(loaded),
@@ -6421,6 +7092,7 @@ unsafe fn test_svld4_vnum_f32_with_svst4_vnum_f32() {
                 4usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6463,6 +7135,7 @@ unsafe fn test_svld4_vnum_f64_with_svst4_vnum_f64() {
     }
     svsetffr();
     let loaded = svld4_vnum_f64(svptrue_b64(), storage.as_ptr() as *const f64, 1);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         svget4_f64::<{ 0usize as i32 }>(loaded),
         svcvt_f64_s64_x(
@@ -6472,6 +7145,7 @@ unsafe fn test_svld4_vnum_f64_with_svst4_vnum_f64() {
                 4usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget4_f64::<{ 1usize as i32 }>(loaded),
@@ -6482,6 +7156,7 @@ unsafe fn test_svld4_vnum_f64_with_svst4_vnum_f64() {
                 4usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget4_f64::<{ 2usize as i32 }>(loaded),
@@ -6492,6 +7167,7 @@ unsafe fn test_svld4_vnum_f64_with_svst4_vnum_f64() {
                 4usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
     assert_vector_matches_f64(
         svget4_f64::<{ 3usize as i32 }>(loaded),
@@ -6502,6 +7178,7 @@ unsafe fn test_svld4_vnum_f64_with_svst4_vnum_f64() {
                 4usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6532,12 +7209,14 @@ unsafe fn test_svld4_vnum_s8_with_svst4_vnum_s8() {
     }
     svsetffr();
     let loaded = svld4_vnum_s8(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         svget4_s8::<{ 0usize as i32 }>(loaded),
         svindex_s8(
             (len + 0usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i8(
         svget4_s8::<{ 1usize as i32 }>(loaded),
@@ -6545,6 +7224,7 @@ unsafe fn test_svld4_vnum_s8_with_svst4_vnum_s8() {
             (len + 1usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i8(
         svget4_s8::<{ 2usize as i32 }>(loaded),
@@ -6552,6 +7232,7 @@ unsafe fn test_svld4_vnum_s8_with_svst4_vnum_s8() {
             (len + 2usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i8(
         svget4_s8::<{ 3usize as i32 }>(loaded),
@@ -6559,6 +7240,7 @@ unsafe fn test_svld4_vnum_s8_with_svst4_vnum_s8() {
             (len + 3usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6589,12 +7271,14 @@ unsafe fn test_svld4_vnum_s16_with_svst4_vnum_s16() {
     }
     svsetffr();
     let loaded = svld4_vnum_s16(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         svget4_s16::<{ 0usize as i32 }>(loaded),
         svindex_s16(
             (len + 0usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i16(
         svget4_s16::<{ 1usize as i32 }>(loaded),
@@ -6602,6 +7286,7 @@ unsafe fn test_svld4_vnum_s16_with_svst4_vnum_s16() {
             (len + 1usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i16(
         svget4_s16::<{ 2usize as i32 }>(loaded),
@@ -6609,6 +7294,7 @@ unsafe fn test_svld4_vnum_s16_with_svst4_vnum_s16() {
             (len + 2usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i16(
         svget4_s16::<{ 3usize as i32 }>(loaded),
@@ -6616,6 +7302,7 @@ unsafe fn test_svld4_vnum_s16_with_svst4_vnum_s16() {
             (len + 3usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6646,12 +7333,14 @@ unsafe fn test_svld4_vnum_s32_with_svst4_vnum_s32() {
     }
     svsetffr();
     let loaded = svld4_vnum_s32(svptrue_b32(), storage.as_ptr() as *const i32, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         svget4_s32::<{ 0usize as i32 }>(loaded),
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i32(
         svget4_s32::<{ 1usize as i32 }>(loaded),
@@ -6659,6 +7348,7 @@ unsafe fn test_svld4_vnum_s32_with_svst4_vnum_s32() {
             (len + 1usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i32(
         svget4_s32::<{ 2usize as i32 }>(loaded),
@@ -6666,6 +7356,7 @@ unsafe fn test_svld4_vnum_s32_with_svst4_vnum_s32() {
             (len + 2usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i32(
         svget4_s32::<{ 3usize as i32 }>(loaded),
@@ -6673,6 +7364,7 @@ unsafe fn test_svld4_vnum_s32_with_svst4_vnum_s32() {
             (len + 3usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6703,12 +7395,14 @@ unsafe fn test_svld4_vnum_s64_with_svst4_vnum_s64() {
     }
     svsetffr();
     let loaded = svld4_vnum_s64(svptrue_b64(), storage.as_ptr() as *const i64, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         svget4_s64::<{ 0usize as i32 }>(loaded),
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i64(
         svget4_s64::<{ 1usize as i32 }>(loaded),
@@ -6716,6 +7410,7 @@ unsafe fn test_svld4_vnum_s64_with_svst4_vnum_s64() {
             (len + 1usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i64(
         svget4_s64::<{ 2usize as i32 }>(loaded),
@@ -6723,6 +7418,7 @@ unsafe fn test_svld4_vnum_s64_with_svst4_vnum_s64() {
             (len + 2usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_i64(
         svget4_s64::<{ 3usize as i32 }>(loaded),
@@ -6730,6 +7426,7 @@ unsafe fn test_svld4_vnum_s64_with_svst4_vnum_s64() {
             (len + 3usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6760,12 +7457,14 @@ unsafe fn test_svld4_vnum_u8_with_svst4_vnum_u8() {
     }
     svsetffr();
     let loaded = svld4_vnum_u8(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         svget4_u8::<{ 0usize as i32 }>(loaded),
         svindex_u8(
             (len + 0usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u8(
         svget4_u8::<{ 1usize as i32 }>(loaded),
@@ -6773,6 +7472,7 @@ unsafe fn test_svld4_vnum_u8_with_svst4_vnum_u8() {
             (len + 1usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u8(
         svget4_u8::<{ 2usize as i32 }>(loaded),
@@ -6780,6 +7480,7 @@ unsafe fn test_svld4_vnum_u8_with_svst4_vnum_u8() {
             (len + 2usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u8(
         svget4_u8::<{ 3usize as i32 }>(loaded),
@@ -6787,6 +7488,7 @@ unsafe fn test_svld4_vnum_u8_with_svst4_vnum_u8() {
             (len + 3usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6817,12 +7519,14 @@ unsafe fn test_svld4_vnum_u16_with_svst4_vnum_u16() {
     }
     svsetffr();
     let loaded = svld4_vnum_u16(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         svget4_u16::<{ 0usize as i32 }>(loaded),
         svindex_u16(
             (len + 0usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u16(
         svget4_u16::<{ 1usize as i32 }>(loaded),
@@ -6830,6 +7534,7 @@ unsafe fn test_svld4_vnum_u16_with_svst4_vnum_u16() {
             (len + 1usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u16(
         svget4_u16::<{ 2usize as i32 }>(loaded),
@@ -6837,6 +7542,7 @@ unsafe fn test_svld4_vnum_u16_with_svst4_vnum_u16() {
             (len + 2usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u16(
         svget4_u16::<{ 3usize as i32 }>(loaded),
@@ -6844,6 +7550,7 @@ unsafe fn test_svld4_vnum_u16_with_svst4_vnum_u16() {
             (len + 3usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6874,12 +7581,14 @@ unsafe fn test_svld4_vnum_u32_with_svst4_vnum_u32() {
     }
     svsetffr();
     let loaded = svld4_vnum_u32(svptrue_b32(), storage.as_ptr() as *const u32, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         svget4_u32::<{ 0usize as i32 }>(loaded),
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u32(
         svget4_u32::<{ 1usize as i32 }>(loaded),
@@ -6887,6 +7596,7 @@ unsafe fn test_svld4_vnum_u32_with_svst4_vnum_u32() {
             (len + 1usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u32(
         svget4_u32::<{ 2usize as i32 }>(loaded),
@@ -6894,6 +7604,7 @@ unsafe fn test_svld4_vnum_u32_with_svst4_vnum_u32() {
             (len + 2usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u32(
         svget4_u32::<{ 3usize as i32 }>(loaded),
@@ -6901,6 +7612,7 @@ unsafe fn test_svld4_vnum_u32_with_svst4_vnum_u32() {
             (len + 3usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -6931,12 +7643,14 @@ unsafe fn test_svld4_vnum_u64_with_svst4_vnum_u64() {
     }
     svsetffr();
     let loaded = svld4_vnum_u64(svptrue_b64(), storage.as_ptr() as *const u64, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         svget4_u64::<{ 0usize as i32 }>(loaded),
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u64(
         svget4_u64::<{ 1usize as i32 }>(loaded),
@@ -6944,6 +7658,7 @@ unsafe fn test_svld4_vnum_u64_with_svst4_vnum_u64() {
             (len + 1usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u64(
         svget4_u64::<{ 2usize as i32 }>(loaded),
@@ -6951,6 +7666,7 @@ unsafe fn test_svld4_vnum_u64_with_svst4_vnum_u64() {
             (len + 2usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
     assert_vector_matches_u64(
         svget4_u64::<{ 3usize as i32 }>(loaded),
@@ -6958,400 +7674,503 @@ unsafe fn test_svld4_vnum_u64_with_svst4_vnum_u64() {
             (len + 3usize).try_into().unwrap(),
             4usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_f32() {
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_f32(svptrue_b32(), F32_DATA.as_ptr());
-    let loaded = svldff1_f32(svptrue_b32(), F32_DATA.as_ptr());
+    let _ = svld1_f32(svptrue_b32(), ptr);
+    let loaded = svldff1_f32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_f64() {
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_f64(svptrue_b64(), F64_DATA.as_ptr());
-    let loaded = svldff1_f64(svptrue_b64(), F64_DATA.as_ptr());
+    let _ = svld1_f64(svptrue_b64(), ptr);
+    let loaded = svldff1_f64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_s8() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_s8(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldff1_s8(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1_s8(svptrue_b8(), ptr);
+    let loaded = svldff1_s8(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         loaded,
         svindex_s8((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_s16() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_s16(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldff1_s16(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1_s16(svptrue_b16(), ptr);
+    let loaded = svldff1_s16(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_s32() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_s32(svptrue_b32(), I32_DATA.as_ptr());
-    let loaded = svldff1_s32(svptrue_b32(), I32_DATA.as_ptr());
+    let _ = svld1_s32(svptrue_b32(), ptr);
+    let loaded = svldff1_s32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_s64() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_s64(svptrue_b64(), I64_DATA.as_ptr());
-    let loaded = svldff1_s64(svptrue_b64(), I64_DATA.as_ptr());
+    let _ = svld1_s64(svptrue_b64(), ptr);
+    let loaded = svldff1_s64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_u8() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_u8(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldff1_u8(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1_u8(svptrue_b8(), ptr);
+    let loaded = svldff1_u8(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         loaded,
         svindex_u8((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_u16() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_u16(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldff1_u16(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1_u16(svptrue_b16(), ptr);
+    let loaded = svldff1_u16(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_u32() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_u32(svptrue_b32(), U32_DATA.as_ptr());
-    let loaded = svldff1_u32(svptrue_b32(), U32_DATA.as_ptr());
+    let _ = svld1_u32(svptrue_b32(), ptr);
+    let loaded = svldff1_u32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_u64() {
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_u64(svptrue_b64(), U64_DATA.as_ptr());
-    let loaded = svldff1_u64(svptrue_b64(), U64_DATA.as_ptr());
+    let _ = svld1_u64(svptrue_b64(), ptr);
+    let loaded = svldff1_u64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s32index_f32() {
     let indices = svindex_s32(0, 1);
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s32index_f32(svptrue_b32(), F32_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_s32index_f32(svptrue_b32(), F32_DATA.as_ptr(), indices);
+    let _ = svld1_gather_s32index_f32(svptrue_b32(), ptr, indices);
+    let loaded = svldff1_gather_s32index_f32(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s32index_s32() {
     let indices = svindex_s32(0, 1);
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s32index_s32(svptrue_b32(), I32_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_s32index_s32(svptrue_b32(), I32_DATA.as_ptr(), indices);
+    let _ = svld1_gather_s32index_s32(svptrue_b32(), ptr, indices);
+    let loaded = svldff1_gather_s32index_s32(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s32index_u32() {
     let indices = svindex_s32(0, 1);
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s32index_u32(svptrue_b32(), U32_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_s32index_u32(svptrue_b32(), U32_DATA.as_ptr(), indices);
+    let _ = svld1_gather_s32index_u32(svptrue_b32(), ptr, indices);
+    let loaded = svldff1_gather_s32index_u32(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s64index_f64() {
     let indices = svindex_s64(0, 1);
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s64index_f64(svptrue_b64(), F64_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_s64index_f64(svptrue_b64(), F64_DATA.as_ptr(), indices);
+    let _ = svld1_gather_s64index_f64(svptrue_b64(), ptr, indices);
+    let loaded = svldff1_gather_s64index_f64(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s64index_s64() {
     let indices = svindex_s64(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s64index_s64(svptrue_b64(), I64_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_s64index_s64(svptrue_b64(), I64_DATA.as_ptr(), indices);
+    let _ = svld1_gather_s64index_s64(svptrue_b64(), ptr, indices);
+    let loaded = svldff1_gather_s64index_s64(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s64index_u64() {
     let indices = svindex_s64(0, 1);
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s64index_u64(svptrue_b64(), U64_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_s64index_u64(svptrue_b64(), U64_DATA.as_ptr(), indices);
+    let _ = svld1_gather_s64index_u64(svptrue_b64(), ptr, indices);
+    let loaded = svldff1_gather_s64index_u64(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u32index_f32() {
     let indices = svindex_u32(0, 1);
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u32index_f32(svptrue_b32(), F32_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_u32index_f32(svptrue_b32(), F32_DATA.as_ptr(), indices);
+    let _ = svld1_gather_u32index_f32(svptrue_b32(), ptr, indices);
+    let loaded = svldff1_gather_u32index_f32(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u32index_s32() {
     let indices = svindex_u32(0, 1);
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u32index_s32(svptrue_b32(), I32_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_u32index_s32(svptrue_b32(), I32_DATA.as_ptr(), indices);
+    let _ = svld1_gather_u32index_s32(svptrue_b32(), ptr, indices);
+    let loaded = svldff1_gather_u32index_s32(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u32index_u32() {
     let indices = svindex_u32(0, 1);
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u32index_u32(svptrue_b32(), U32_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_u32index_u32(svptrue_b32(), U32_DATA.as_ptr(), indices);
+    let _ = svld1_gather_u32index_u32(svptrue_b32(), ptr, indices);
+    let loaded = svldff1_gather_u32index_u32(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u64index_f64() {
     let indices = svindex_u64(0, 1);
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u64index_f64(svptrue_b64(), F64_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_u64index_f64(svptrue_b64(), F64_DATA.as_ptr(), indices);
+    let _ = svld1_gather_u64index_f64(svptrue_b64(), ptr, indices);
+    let loaded = svldff1_gather_u64index_f64(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u64index_s64() {
     let indices = svindex_u64(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u64index_s64(svptrue_b64(), I64_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_u64index_s64(svptrue_b64(), I64_DATA.as_ptr(), indices);
+    let _ = svld1_gather_u64index_s64(svptrue_b64(), ptr, indices);
+    let loaded = svldff1_gather_u64index_s64(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u64index_u64() {
     let indices = svindex_u64(0, 1);
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u64index_u64(svptrue_b64(), U64_DATA.as_ptr(), indices);
-    let loaded = svldff1_gather_u64index_u64(svptrue_b64(), U64_DATA.as_ptr(), indices);
+    let _ = svld1_gather_u64index_u64(svptrue_b64(), ptr, indices);
+    let loaded = svldff1_gather_u64index_u64(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s32offset_f32() {
     let offsets = svindex_s32(0, 4u32.try_into().unwrap());
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s32offset_f32(svptrue_b32(), F32_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_s32offset_f32(svptrue_b32(), F32_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_s32offset_f32(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1_gather_s32offset_f32(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s32offset_s32() {
     let offsets = svindex_s32(0, 4u32.try_into().unwrap());
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s32offset_s32(svptrue_b32(), I32_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_s32offset_s32(svptrue_b32(), I32_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_s32offset_s32(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1_gather_s32offset_s32(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s32offset_u32() {
     let offsets = svindex_s32(0, 4u32.try_into().unwrap());
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s32offset_u32(svptrue_b32(), U32_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_s32offset_u32(svptrue_b32(), U32_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_s32offset_u32(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1_gather_s32offset_u32(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s64offset_f64() {
     let offsets = svindex_s64(0, 8u32.try_into().unwrap());
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s64offset_f64(svptrue_b64(), F64_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_s64offset_f64(svptrue_b64(), F64_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_s64offset_f64(svptrue_b64(), ptr, offsets);
+    let loaded = svldff1_gather_s64offset_f64(svptrue_b64(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s64offset_s64() {
     let offsets = svindex_s64(0, 8u32.try_into().unwrap());
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s64offset_s64(svptrue_b64(), I64_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_s64offset_s64(svptrue_b64(), I64_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_s64offset_s64(svptrue_b64(), ptr, offsets);
+    let loaded = svldff1_gather_s64offset_s64(svptrue_b64(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_s64offset_u64() {
     let offsets = svindex_s64(0, 8u32.try_into().unwrap());
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_s64offset_u64(svptrue_b64(), U64_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_s64offset_u64(svptrue_b64(), U64_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_s64offset_u64(svptrue_b64(), ptr, offsets);
+    let loaded = svldff1_gather_s64offset_u64(svptrue_b64(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u32offset_f32() {
     let offsets = svindex_u32(0, 4u32.try_into().unwrap());
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u32offset_f32(svptrue_b32(), F32_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_u32offset_f32(svptrue_b32(), F32_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_u32offset_f32(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1_gather_u32offset_f32(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u32offset_s32() {
     let offsets = svindex_u32(0, 4u32.try_into().unwrap());
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u32offset_s32(svptrue_b32(), I32_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_u32offset_s32(svptrue_b32(), I32_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_u32offset_s32(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1_gather_u32offset_s32(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u32offset_u32() {
     let offsets = svindex_u32(0, 4u32.try_into().unwrap());
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u32offset_u32(svptrue_b32(), U32_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_u32offset_u32(svptrue_b32(), U32_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_u32offset_u32(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1_gather_u32offset_u32(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u64offset_f64() {
     let offsets = svindex_u64(0, 8u32.try_into().unwrap());
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u64offset_f64(svptrue_b64(), F64_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_u64offset_f64(svptrue_b64(), F64_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_u64offset_f64(svptrue_b64(), ptr, offsets);
+    let loaded = svldff1_gather_u64offset_f64(svptrue_b64(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u64offset_s64() {
     let offsets = svindex_u64(0, 8u32.try_into().unwrap());
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u64offset_s64(svptrue_b64(), I64_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_u64offset_s64(svptrue_b64(), I64_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_u64offset_s64(svptrue_b64(), ptr, offsets);
+    let loaded = svldff1_gather_u64offset_s64(svptrue_b64(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_gather_u64offset_u64() {
     let offsets = svindex_u64(0, 8u32.try_into().unwrap());
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_gather_u64offset_u64(svptrue_b64(), U64_DATA.as_ptr(), offsets);
-    let loaded = svldff1_gather_u64offset_u64(svptrue_b64(), U64_DATA.as_ptr(), offsets);
+    let _ = svld1_gather_u64offset_u64(svptrue_b64(), ptr, offsets);
+    let loaded = svldff1_gather_u64offset_u64(svptrue_b64(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7362,12 +8181,14 @@ unsafe fn test_svldff1_gather_u64base_f64() {
     svsetffr();
     let _ = svld1_gather_u64base_f64(svptrue_b64(), bases);
     let loaded = svldff1_gather_u64base_f64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7378,9 +8199,11 @@ unsafe fn test_svldff1_gather_u64base_s64() {
     svsetffr();
     let _ = svld1_gather_u64base_s64(svptrue_b64(), bases);
     let loaded = svldff1_gather_u64base_s64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7391,9 +8214,11 @@ unsafe fn test_svldff1_gather_u64base_u64() {
     svsetffr();
     let _ = svld1_gather_u64base_u64(svptrue_b64(), bases);
     let loaded = svldff1_gather_u64base_u64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7410,12 +8235,14 @@ unsafe fn test_svldff1_gather_u32base_index_f32() {
         bases,
         F32_DATA.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7432,9 +8259,11 @@ unsafe fn test_svldff1_gather_u32base_index_s32() {
         bases,
         I32_DATA.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7451,9 +8280,11 @@ unsafe fn test_svldff1_gather_u32base_index_u32() {
         bases,
         U32_DATA.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7464,12 +8295,14 @@ unsafe fn test_svldff1_gather_u64base_index_f64() {
     svsetffr();
     let _ = svld1_gather_u64base_index_f64(svptrue_b64(), bases, 1.try_into().unwrap());
     let loaded = svldff1_gather_u64base_index_f64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7480,9 +8313,11 @@ unsafe fn test_svldff1_gather_u64base_index_s64() {
     svsetffr();
     let _ = svld1_gather_u64base_index_s64(svptrue_b64(), bases, 1.try_into().unwrap());
     let loaded = svldff1_gather_u64base_index_s64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7493,9 +8328,11 @@ unsafe fn test_svldff1_gather_u64base_index_u64() {
     svsetffr();
     let _ = svld1_gather_u64base_index_u64(svptrue_b64(), bases, 1.try_into().unwrap());
     let loaded = svldff1_gather_u64base_index_u64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7512,12 +8349,14 @@ unsafe fn test_svldff1_gather_u32base_offset_f32() {
         bases,
         F32_DATA.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7534,9 +8373,11 @@ unsafe fn test_svldff1_gather_u32base_offset_s32() {
         bases,
         I32_DATA.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7553,9 +8394,11 @@ unsafe fn test_svldff1_gather_u32base_offset_u32() {
         bases,
         U32_DATA.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7566,12 +8409,14 @@ unsafe fn test_svldff1_gather_u64base_offset_f64() {
     svsetffr();
     let _ = svld1_gather_u64base_offset_f64(svptrue_b64(), bases, 8u32.try_into().unwrap());
     let loaded = svldff1_gather_u64base_offset_f64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7582,9 +8427,11 @@ unsafe fn test_svldff1_gather_u64base_offset_s64() {
     svsetffr();
     let _ = svld1_gather_u64base_offset_s64(svptrue_b64(), bases, 8u32.try_into().unwrap());
     let loaded = svldff1_gather_u64base_offset_s64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7595,16 +8442,20 @@ unsafe fn test_svldff1_gather_u64base_offset_u64() {
     svsetffr();
     let _ = svld1_gather_u64base_offset_u64(svptrue_b64(), bases, 8u32.try_into().unwrap());
     let loaded = svldff1_gather_u64base_offset_u64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_f32() {
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_f32(svptrue_b32(), F32_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_f32(svptrue_b32(), F32_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_f32(svptrue_b32(), ptr, 1);
+    let loaded = svldff1_vnum_f32(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_f32(
         loaded,
@@ -7615,13 +8466,16 @@ unsafe fn test_svldff1_vnum_f32() {
                 1usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_f64() {
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_f64(svptrue_b64(), F64_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_f64(svptrue_b64(), F64_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_f64(svptrue_b64(), ptr, 1);
+    let loaded = svldff1_vnum_f64(svptrue_b64(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_f64(
         loaded,
@@ -7632,13 +8486,16 @@ unsafe fn test_svldff1_vnum_f64() {
                 1usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_s8() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_s8(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_s8(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_s8(svptrue_b8(), ptr, 1);
+    let loaded = svldff1_vnum_s8(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntb() as usize;
     assert_vector_matches_i8(
         loaded,
@@ -7646,13 +8503,16 @@ unsafe fn test_svldff1_vnum_s8() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_s16() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_s16(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_s16(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_s16(svptrue_b16(), ptr, 1);
+    let loaded = svldff1_vnum_s16(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_i16(
         loaded,
@@ -7660,13 +8520,16 @@ unsafe fn test_svldff1_vnum_s16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_s32() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_s32(svptrue_b32(), I32_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_s32(svptrue_b32(), I32_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_s32(svptrue_b32(), ptr, 1);
+    let loaded = svldff1_vnum_s32(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -7674,13 +8537,16 @@ unsafe fn test_svldff1_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_s64() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_s64(svptrue_b64(), I64_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_s64(svptrue_b64(), I64_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_s64(svptrue_b64(), ptr, 1);
+    let loaded = svldff1_vnum_s64(svptrue_b64(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -7688,13 +8554,16 @@ unsafe fn test_svldff1_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_u8() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_u8(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_u8(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_u8(svptrue_b8(), ptr, 1);
+    let loaded = svldff1_vnum_u8(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntb() as usize;
     assert_vector_matches_u8(
         loaded,
@@ -7702,13 +8571,16 @@ unsafe fn test_svldff1_vnum_u8() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_u16() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_u16(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_u16(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_u16(svptrue_b16(), ptr, 1);
+    let loaded = svldff1_vnum_u16(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_u16(
         loaded,
@@ -7716,13 +8588,16 @@ unsafe fn test_svldff1_vnum_u16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_u32() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_u32(svptrue_b32(), U32_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_u32(svptrue_b32(), U32_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_u32(svptrue_b32(), ptr, 1);
+    let loaded = svldff1_vnum_u32(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -7730,13 +8605,16 @@ unsafe fn test_svldff1_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1_vnum_u64() {
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_u64(svptrue_b64(), U64_DATA.as_ptr(), 1);
-    let loaded = svldff1_vnum_u64(svptrue_b64(), U64_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_u64(svptrue_b64(), ptr, 1);
+    let loaded = svldff1_vnum_u64(svptrue_b64(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -7744,226 +8622,287 @@ unsafe fn test_svldff1_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_gather_s32offset_s32() {
     let offsets = svindex_s32(0, 1u32.try_into().unwrap());
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_gather_s32offset_s32(svptrue_b8(), I8_DATA.as_ptr(), offsets);
-    let loaded = svldff1sb_gather_s32offset_s32(svptrue_b8(), I8_DATA.as_ptr(), offsets);
+    let _ = svld1sb_gather_s32offset_s32(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1sb_gather_s32offset_s32(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_s32offset_s32() {
     let offsets = svindex_s32(0, 2u32.try_into().unwrap());
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_s32offset_s32(svptrue_b16(), I16_DATA.as_ptr(), offsets);
-    let loaded = svldff1sh_gather_s32offset_s32(svptrue_b16(), I16_DATA.as_ptr(), offsets);
+    let _ = svld1sh_gather_s32offset_s32(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1sh_gather_s32offset_s32(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_gather_s32offset_u32() {
     let offsets = svindex_s32(0, 1u32.try_into().unwrap());
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_gather_s32offset_u32(svptrue_b8(), I8_DATA.as_ptr(), offsets);
-    let loaded = svldff1sb_gather_s32offset_u32(svptrue_b8(), I8_DATA.as_ptr(), offsets);
+    let _ = svld1sb_gather_s32offset_u32(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1sb_gather_s32offset_u32(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_s32offset_u32() {
     let offsets = svindex_s32(0, 2u32.try_into().unwrap());
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_s32offset_u32(svptrue_b16(), I16_DATA.as_ptr(), offsets);
-    let loaded = svldff1sh_gather_s32offset_u32(svptrue_b16(), I16_DATA.as_ptr(), offsets);
+    let _ = svld1sh_gather_s32offset_u32(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1sh_gather_s32offset_u32(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_gather_s64offset_s64() {
     let offsets = svindex_s64(0, 1u32.try_into().unwrap());
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_gather_s64offset_s64(svptrue_b8(), I8_DATA.as_ptr(), offsets);
-    let loaded = svldff1sb_gather_s64offset_s64(svptrue_b8(), I8_DATA.as_ptr(), offsets);
+    let _ = svld1sb_gather_s64offset_s64(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1sb_gather_s64offset_s64(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_s64offset_s64() {
     let offsets = svindex_s64(0, 2u32.try_into().unwrap());
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_s64offset_s64(svptrue_b16(), I16_DATA.as_ptr(), offsets);
-    let loaded = svldff1sh_gather_s64offset_s64(svptrue_b16(), I16_DATA.as_ptr(), offsets);
+    let _ = svld1sh_gather_s64offset_s64(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1sh_gather_s64offset_s64(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_gather_s64offset_s64() {
     let offsets = svindex_s64(0, 4u32.try_into().unwrap());
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_gather_s64offset_s64(svptrue_b32(), I32_DATA.as_ptr(), offsets);
-    let loaded = svldff1sw_gather_s64offset_s64(svptrue_b32(), I32_DATA.as_ptr(), offsets);
+    let _ = svld1sw_gather_s64offset_s64(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1sw_gather_s64offset_s64(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_gather_s64offset_u64() {
     let offsets = svindex_s64(0, 1u32.try_into().unwrap());
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_gather_s64offset_u64(svptrue_b8(), I8_DATA.as_ptr(), offsets);
-    let loaded = svldff1sb_gather_s64offset_u64(svptrue_b8(), I8_DATA.as_ptr(), offsets);
+    let _ = svld1sb_gather_s64offset_u64(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1sb_gather_s64offset_u64(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_s64offset_u64() {
     let offsets = svindex_s64(0, 2u32.try_into().unwrap());
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_s64offset_u64(svptrue_b16(), I16_DATA.as_ptr(), offsets);
-    let loaded = svldff1sh_gather_s64offset_u64(svptrue_b16(), I16_DATA.as_ptr(), offsets);
+    let _ = svld1sh_gather_s64offset_u64(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1sh_gather_s64offset_u64(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_gather_s64offset_u64() {
     let offsets = svindex_s64(0, 4u32.try_into().unwrap());
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_gather_s64offset_u64(svptrue_b32(), I32_DATA.as_ptr(), offsets);
-    let loaded = svldff1sw_gather_s64offset_u64(svptrue_b32(), I32_DATA.as_ptr(), offsets);
+    let _ = svld1sw_gather_s64offset_u64(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1sw_gather_s64offset_u64(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_gather_u32offset_s32() {
     let offsets = svindex_u32(0, 1u32.try_into().unwrap());
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_gather_u32offset_s32(svptrue_b8(), I8_DATA.as_ptr(), offsets);
-    let loaded = svldff1sb_gather_u32offset_s32(svptrue_b8(), I8_DATA.as_ptr(), offsets);
+    let _ = svld1sb_gather_u32offset_s32(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1sb_gather_u32offset_s32(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_u32offset_s32() {
     let offsets = svindex_u32(0, 2u32.try_into().unwrap());
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_u32offset_s32(svptrue_b16(), I16_DATA.as_ptr(), offsets);
-    let loaded = svldff1sh_gather_u32offset_s32(svptrue_b16(), I16_DATA.as_ptr(), offsets);
+    let _ = svld1sh_gather_u32offset_s32(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1sh_gather_u32offset_s32(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_gather_u32offset_u32() {
     let offsets = svindex_u32(0, 1u32.try_into().unwrap());
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_gather_u32offset_u32(svptrue_b8(), I8_DATA.as_ptr(), offsets);
-    let loaded = svldff1sb_gather_u32offset_u32(svptrue_b8(), I8_DATA.as_ptr(), offsets);
+    let _ = svld1sb_gather_u32offset_u32(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1sb_gather_u32offset_u32(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_u32offset_u32() {
     let offsets = svindex_u32(0, 2u32.try_into().unwrap());
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_u32offset_u32(svptrue_b16(), I16_DATA.as_ptr(), offsets);
-    let loaded = svldff1sh_gather_u32offset_u32(svptrue_b16(), I16_DATA.as_ptr(), offsets);
+    let _ = svld1sh_gather_u32offset_u32(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1sh_gather_u32offset_u32(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_gather_u64offset_s64() {
     let offsets = svindex_u64(0, 1u32.try_into().unwrap());
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_gather_u64offset_s64(svptrue_b8(), I8_DATA.as_ptr(), offsets);
-    let loaded = svldff1sb_gather_u64offset_s64(svptrue_b8(), I8_DATA.as_ptr(), offsets);
+    let _ = svld1sb_gather_u64offset_s64(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1sb_gather_u64offset_s64(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_u64offset_s64() {
     let offsets = svindex_u64(0, 2u32.try_into().unwrap());
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_u64offset_s64(svptrue_b16(), I16_DATA.as_ptr(), offsets);
-    let loaded = svldff1sh_gather_u64offset_s64(svptrue_b16(), I16_DATA.as_ptr(), offsets);
+    let _ = svld1sh_gather_u64offset_s64(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1sh_gather_u64offset_s64(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_gather_u64offset_s64() {
     let offsets = svindex_u64(0, 4u32.try_into().unwrap());
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_gather_u64offset_s64(svptrue_b32(), I32_DATA.as_ptr(), offsets);
-    let loaded = svldff1sw_gather_u64offset_s64(svptrue_b32(), I32_DATA.as_ptr(), offsets);
+    let _ = svld1sw_gather_u64offset_s64(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1sw_gather_u64offset_s64(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_gather_u64offset_u64() {
     let offsets = svindex_u64(0, 1u32.try_into().unwrap());
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_gather_u64offset_u64(svptrue_b8(), I8_DATA.as_ptr(), offsets);
-    let loaded = svldff1sb_gather_u64offset_u64(svptrue_b8(), I8_DATA.as_ptr(), offsets);
+    let _ = svld1sb_gather_u64offset_u64(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1sb_gather_u64offset_u64(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_u64offset_u64() {
     let offsets = svindex_u64(0, 2u32.try_into().unwrap());
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_u64offset_u64(svptrue_b16(), I16_DATA.as_ptr(), offsets);
-    let loaded = svldff1sh_gather_u64offset_u64(svptrue_b16(), I16_DATA.as_ptr(), offsets);
+    let _ = svld1sh_gather_u64offset_u64(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1sh_gather_u64offset_u64(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_gather_u64offset_u64() {
     let offsets = svindex_u64(0, 4u32.try_into().unwrap());
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_gather_u64offset_u64(svptrue_b32(), I32_DATA.as_ptr(), offsets);
-    let loaded = svldff1sw_gather_u64offset_u64(svptrue_b32(), I32_DATA.as_ptr(), offsets);
+    let _ = svld1sw_gather_u64offset_u64(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1sw_gather_u64offset_u64(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7980,9 +8919,11 @@ unsafe fn test_svldff1sb_gather_u32base_offset_s32() {
         bases,
         I8_DATA.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -7999,9 +8940,11 @@ unsafe fn test_svldff1sh_gather_u32base_offset_s32() {
         bases,
         I16_DATA.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8018,9 +8961,11 @@ unsafe fn test_svldff1sb_gather_u32base_offset_u32() {
         bases,
         I8_DATA.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8037,9 +8982,11 @@ unsafe fn test_svldff1sh_gather_u32base_offset_u32() {
         bases,
         I16_DATA.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8050,9 +8997,11 @@ unsafe fn test_svldff1sb_gather_u64base_offset_s64() {
     svsetffr();
     let _ = svld1sb_gather_u64base_offset_s64(svptrue_b8(), bases, 1u32.try_into().unwrap());
     let loaded = svldff1sb_gather_u64base_offset_s64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8064,9 +9013,11 @@ unsafe fn test_svldff1sh_gather_u64base_offset_s64() {
     let _ = svld1sh_gather_u64base_offset_s64(svptrue_b16(), bases, 2u32.try_into().unwrap());
     let loaded =
         svldff1sh_gather_u64base_offset_s64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8078,9 +9029,11 @@ unsafe fn test_svldff1sw_gather_u64base_offset_s64() {
     let _ = svld1sw_gather_u64base_offset_s64(svptrue_b32(), bases, 4u32.try_into().unwrap());
     let loaded =
         svldff1sw_gather_u64base_offset_s64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8091,9 +9044,11 @@ unsafe fn test_svldff1sb_gather_u64base_offset_u64() {
     svsetffr();
     let _ = svld1sb_gather_u64base_offset_u64(svptrue_b8(), bases, 1u32.try_into().unwrap());
     let loaded = svldff1sb_gather_u64base_offset_u64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8105,9 +9060,11 @@ unsafe fn test_svldff1sh_gather_u64base_offset_u64() {
     let _ = svld1sh_gather_u64base_offset_u64(svptrue_b16(), bases, 2u32.try_into().unwrap());
     let loaded =
         svldff1sh_gather_u64base_offset_u64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8119,9 +9076,11 @@ unsafe fn test_svldff1sw_gather_u64base_offset_u64() {
     let _ = svld1sw_gather_u64base_offset_u64(svptrue_b32(), bases, 4u32.try_into().unwrap());
     let loaded =
         svldff1sw_gather_u64base_offset_u64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8132,9 +9091,11 @@ unsafe fn test_svldff1sb_gather_u64base_s64() {
     svsetffr();
     let _ = svld1sb_gather_u64base_s64(svptrue_b8(), bases);
     let loaded = svldff1sb_gather_u64base_s64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8145,9 +9106,11 @@ unsafe fn test_svldff1sh_gather_u64base_s64() {
     svsetffr();
     let _ = svld1sh_gather_u64base_s64(svptrue_b16(), bases);
     let loaded = svldff1sh_gather_u64base_s64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8158,9 +9121,11 @@ unsafe fn test_svldff1sw_gather_u64base_s64() {
     svsetffr();
     let _ = svld1sw_gather_u64base_s64(svptrue_b32(), bases);
     let loaded = svldff1sw_gather_u64base_s64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8171,9 +9136,11 @@ unsafe fn test_svldff1sb_gather_u64base_u64() {
     svsetffr();
     let _ = svld1sb_gather_u64base_u64(svptrue_b8(), bases);
     let loaded = svldff1sb_gather_u64base_u64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8184,9 +9151,11 @@ unsafe fn test_svldff1sh_gather_u64base_u64() {
     svsetffr();
     let _ = svld1sh_gather_u64base_u64(svptrue_b16(), bases);
     let loaded = svldff1sh_gather_u64base_u64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8197,136 +9166,176 @@ unsafe fn test_svldff1sw_gather_u64base_u64() {
     svsetffr();
     let _ = svld1sw_gather_u64base_u64(svptrue_b32(), bases);
     let loaded = svldff1sw_gather_u64base_u64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_s16() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_s16(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldff1sb_s16(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_s16(svptrue_b8(), ptr);
+    let loaded = svldff1sb_s16(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_s32() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_s32(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldff1sb_s32(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_s32(svptrue_b8(), ptr);
+    let loaded = svldff1sb_s32(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_s32() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_s32(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldff1sh_s32(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1sh_s32(svptrue_b16(), ptr);
+    let loaded = svldff1sh_s32(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_s64() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_s64(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldff1sb_s64(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_s64(svptrue_b8(), ptr);
+    let loaded = svldff1sb_s64(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_s64() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_s64(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldff1sh_s64(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1sh_s64(svptrue_b16(), ptr);
+    let loaded = svldff1sh_s64(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_s64() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_s64(svptrue_b32(), I32_DATA.as_ptr());
-    let loaded = svldff1sw_s64(svptrue_b32(), I32_DATA.as_ptr());
+    let _ = svld1sw_s64(svptrue_b32(), ptr);
+    let loaded = svldff1sw_s64(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_u16() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_u16(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldff1sb_u16(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_u16(svptrue_b8(), ptr);
+    let loaded = svldff1sb_u16(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_u32() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_u32(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldff1sb_u32(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_u32(svptrue_b8(), ptr);
+    let loaded = svldff1sb_u32(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_u32() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_u32(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldff1sh_u32(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1sh_u32(svptrue_b16(), ptr);
+    let loaded = svldff1sh_u32(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_u64() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_u64(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldff1sb_u64(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_u64(svptrue_b8(), ptr);
+    let loaded = svldff1sb_u64(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_u64() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_u64(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldff1sh_u64(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1sh_u64(svptrue_b16(), ptr);
+    let loaded = svldff1sh_u64(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_u64() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_u64(svptrue_b32(), I32_DATA.as_ptr());
-    let loaded = svldff1sw_u64(svptrue_b32(), I32_DATA.as_ptr());
+    let _ = svld1sw_u64(svptrue_b32(), ptr);
+    let loaded = svldff1sw_u64(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_vnum_s16() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_s16(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldff1sb_vnum_s16(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_s16(svptrue_b8(), ptr, 1);
+    let loaded = svldff1sb_vnum_s16(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_i16(
         loaded,
@@ -8334,13 +9343,16 @@ unsafe fn test_svldff1sb_vnum_s16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_vnum_s32() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_s32(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldff1sb_vnum_s32(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_s32(svptrue_b8(), ptr, 1);
+    let loaded = svldff1sb_vnum_s32(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -8348,13 +9360,16 @@ unsafe fn test_svldff1sb_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_vnum_s32() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_vnum_s32(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldff1sh_vnum_s32(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1sh_vnum_s32(svptrue_b16(), ptr, 1);
+    let loaded = svldff1sh_vnum_s32(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -8362,13 +9377,16 @@ unsafe fn test_svldff1sh_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_vnum_s64() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_s64(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldff1sb_vnum_s64(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_s64(svptrue_b8(), ptr, 1);
+    let loaded = svldff1sb_vnum_s64(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -8376,13 +9394,16 @@ unsafe fn test_svldff1sb_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_vnum_s64() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_vnum_s64(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldff1sh_vnum_s64(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1sh_vnum_s64(svptrue_b16(), ptr, 1);
+    let loaded = svldff1sh_vnum_s64(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -8390,13 +9411,16 @@ unsafe fn test_svldff1sh_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_vnum_s64() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_vnum_s64(svptrue_b32(), I32_DATA.as_ptr(), 1);
-    let loaded = svldff1sw_vnum_s64(svptrue_b32(), I32_DATA.as_ptr(), 1);
+    let _ = svld1sw_vnum_s64(svptrue_b32(), ptr, 1);
+    let loaded = svldff1sw_vnum_s64(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -8404,13 +9428,16 @@ unsafe fn test_svldff1sw_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_vnum_u16() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_u16(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldff1sb_vnum_u16(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_u16(svptrue_b8(), ptr, 1);
+    let loaded = svldff1sb_vnum_u16(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_u16(
         loaded,
@@ -8418,13 +9445,16 @@ unsafe fn test_svldff1sb_vnum_u16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_vnum_u32() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_u32(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldff1sb_vnum_u32(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_u32(svptrue_b8(), ptr, 1);
+    let loaded = svldff1sb_vnum_u32(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -8432,13 +9462,16 @@ unsafe fn test_svldff1sb_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_vnum_u32() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_vnum_u32(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldff1sh_vnum_u32(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1sh_vnum_u32(svptrue_b16(), ptr, 1);
+    let loaded = svldff1sh_vnum_u32(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -8446,13 +9479,16 @@ unsafe fn test_svldff1sh_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sb_vnum_u64() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_u64(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldff1sb_vnum_u64(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_u64(svptrue_b8(), ptr, 1);
+    let loaded = svldff1sb_vnum_u64(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -8460,13 +9496,16 @@ unsafe fn test_svldff1sb_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_vnum_u64() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_vnum_u64(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldff1sh_vnum_u64(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1sh_vnum_u64(svptrue_b16(), ptr, 1);
+    let loaded = svldff1sh_vnum_u64(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -8474,13 +9513,16 @@ unsafe fn test_svldff1sh_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_vnum_u64() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_vnum_u64(svptrue_b32(), I32_DATA.as_ptr(), 1);
-    let loaded = svldff1sw_vnum_u64(svptrue_b32(), I32_DATA.as_ptr(), 1);
+    let _ = svld1sw_vnum_u64(svptrue_b32(), ptr, 1);
+    let loaded = svldff1sw_vnum_u64(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -8488,138 +9530,175 @@ unsafe fn test_svldff1sw_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_s32index_s32() {
     let indices = svindex_s32(0, 1);
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_s32index_s32(svptrue_b16(), I16_DATA.as_ptr(), indices);
-    let loaded = svldff1sh_gather_s32index_s32(svptrue_b16(), I16_DATA.as_ptr(), indices);
+    let _ = svld1sh_gather_s32index_s32(svptrue_b16(), ptr, indices);
+    let loaded = svldff1sh_gather_s32index_s32(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_s32index_u32() {
     let indices = svindex_s32(0, 1);
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_s32index_u32(svptrue_b16(), I16_DATA.as_ptr(), indices);
-    let loaded = svldff1sh_gather_s32index_u32(svptrue_b16(), I16_DATA.as_ptr(), indices);
+    let _ = svld1sh_gather_s32index_u32(svptrue_b16(), ptr, indices);
+    let loaded = svldff1sh_gather_s32index_u32(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_s64index_s64() {
     let indices = svindex_s64(0, 1);
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_s64index_s64(svptrue_b16(), I16_DATA.as_ptr(), indices);
-    let loaded = svldff1sh_gather_s64index_s64(svptrue_b16(), I16_DATA.as_ptr(), indices);
+    let _ = svld1sh_gather_s64index_s64(svptrue_b16(), ptr, indices);
+    let loaded = svldff1sh_gather_s64index_s64(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_gather_s64index_s64() {
     let indices = svindex_s64(0, 1);
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_gather_s64index_s64(svptrue_b32(), I32_DATA.as_ptr(), indices);
-    let loaded = svldff1sw_gather_s64index_s64(svptrue_b32(), I32_DATA.as_ptr(), indices);
+    let _ = svld1sw_gather_s64index_s64(svptrue_b32(), ptr, indices);
+    let loaded = svldff1sw_gather_s64index_s64(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_s64index_u64() {
     let indices = svindex_s64(0, 1);
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_s64index_u64(svptrue_b16(), I16_DATA.as_ptr(), indices);
-    let loaded = svldff1sh_gather_s64index_u64(svptrue_b16(), I16_DATA.as_ptr(), indices);
+    let _ = svld1sh_gather_s64index_u64(svptrue_b16(), ptr, indices);
+    let loaded = svldff1sh_gather_s64index_u64(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_gather_s64index_u64() {
     let indices = svindex_s64(0, 1);
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_gather_s64index_u64(svptrue_b32(), I32_DATA.as_ptr(), indices);
-    let loaded = svldff1sw_gather_s64index_u64(svptrue_b32(), I32_DATA.as_ptr(), indices);
+    let _ = svld1sw_gather_s64index_u64(svptrue_b32(), ptr, indices);
+    let loaded = svldff1sw_gather_s64index_u64(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_u32index_s32() {
     let indices = svindex_u32(0, 1);
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_u32index_s32(svptrue_b16(), I16_DATA.as_ptr(), indices);
-    let loaded = svldff1sh_gather_u32index_s32(svptrue_b16(), I16_DATA.as_ptr(), indices);
+    let _ = svld1sh_gather_u32index_s32(svptrue_b16(), ptr, indices);
+    let loaded = svldff1sh_gather_u32index_s32(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_u32index_u32() {
     let indices = svindex_u32(0, 1);
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_u32index_u32(svptrue_b16(), I16_DATA.as_ptr(), indices);
-    let loaded = svldff1sh_gather_u32index_u32(svptrue_b16(), I16_DATA.as_ptr(), indices);
+    let _ = svld1sh_gather_u32index_u32(svptrue_b16(), ptr, indices);
+    let loaded = svldff1sh_gather_u32index_u32(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_u64index_s64() {
     let indices = svindex_u64(0, 1);
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_u64index_s64(svptrue_b16(), I16_DATA.as_ptr(), indices);
-    let loaded = svldff1sh_gather_u64index_s64(svptrue_b16(), I16_DATA.as_ptr(), indices);
+    let _ = svld1sh_gather_u64index_s64(svptrue_b16(), ptr, indices);
+    let loaded = svldff1sh_gather_u64index_s64(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_gather_u64index_s64() {
     let indices = svindex_u64(0, 1);
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_gather_u64index_s64(svptrue_b32(), I32_DATA.as_ptr(), indices);
-    let loaded = svldff1sw_gather_u64index_s64(svptrue_b32(), I32_DATA.as_ptr(), indices);
+    let _ = svld1sw_gather_u64index_s64(svptrue_b32(), ptr, indices);
+    let loaded = svldff1sw_gather_u64index_s64(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sh_gather_u64index_u64() {
     let indices = svindex_u64(0, 1);
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_gather_u64index_u64(svptrue_b16(), I16_DATA.as_ptr(), indices);
-    let loaded = svldff1sh_gather_u64index_u64(svptrue_b16(), I16_DATA.as_ptr(), indices);
+    let _ = svld1sh_gather_u64index_u64(svptrue_b16(), ptr, indices);
+    let loaded = svldff1sh_gather_u64index_u64(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1sw_gather_u64index_u64() {
     let indices = svindex_u64(0, 1);
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_gather_u64index_u64(svptrue_b32(), I32_DATA.as_ptr(), indices);
-    let loaded = svldff1sw_gather_u64index_u64(svptrue_b32(), I32_DATA.as_ptr(), indices);
+    let _ = svld1sw_gather_u64index_u64(svptrue_b32(), ptr, indices);
+    let loaded = svldff1sw_gather_u64index_u64(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8636,9 +9715,11 @@ unsafe fn test_svldff1sh_gather_u32base_index_s32() {
         bases,
         I16_DATA.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8655,9 +9736,11 @@ unsafe fn test_svldff1sh_gather_u32base_index_u32() {
         bases,
         I16_DATA.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8668,9 +9751,11 @@ unsafe fn test_svldff1sh_gather_u64base_index_s64() {
     svsetffr();
     let _ = svld1sh_gather_u64base_index_s64(svptrue_b16(), bases, 1.try_into().unwrap());
     let loaded = svldff1sh_gather_u64base_index_s64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8681,9 +9766,11 @@ unsafe fn test_svldff1sw_gather_u64base_index_s64() {
     svsetffr();
     let _ = svld1sw_gather_u64base_index_s64(svptrue_b32(), bases, 1.try_into().unwrap());
     let loaded = svldff1sw_gather_u64base_index_s64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8694,9 +9781,11 @@ unsafe fn test_svldff1sh_gather_u64base_index_u64() {
     svsetffr();
     let _ = svld1sh_gather_u64base_index_u64(svptrue_b16(), bases, 1.try_into().unwrap());
     let loaded = svldff1sh_gather_u64base_index_u64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8707,229 +9796,291 @@ unsafe fn test_svldff1sw_gather_u64base_index_u64() {
     svsetffr();
     let _ = svld1sw_gather_u64base_index_u64(svptrue_b32(), bases, 1.try_into().unwrap());
     let loaded = svldff1sw_gather_u64base_index_u64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_gather_s32offset_s32() {
     let offsets = svindex_s32(0, 1u32.try_into().unwrap());
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_gather_s32offset_s32(svptrue_b8(), U8_DATA.as_ptr(), offsets);
-    let loaded = svldff1ub_gather_s32offset_s32(svptrue_b8(), U8_DATA.as_ptr(), offsets);
+    let _ = svld1ub_gather_s32offset_s32(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1ub_gather_s32offset_s32(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_s32offset_s32() {
     let offsets = svindex_s32(0, 2u32.try_into().unwrap());
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_s32offset_s32(svptrue_b16(), U16_DATA.as_ptr(), offsets);
-    let loaded = svldff1uh_gather_s32offset_s32(svptrue_b16(), U16_DATA.as_ptr(), offsets);
+    let _ = svld1uh_gather_s32offset_s32(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1uh_gather_s32offset_s32(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_gather_s32offset_u32() {
     let offsets = svindex_s32(0, 1u32.try_into().unwrap());
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_gather_s32offset_u32(svptrue_b8(), U8_DATA.as_ptr(), offsets);
-    let loaded = svldff1ub_gather_s32offset_u32(svptrue_b8(), U8_DATA.as_ptr(), offsets);
+    let _ = svld1ub_gather_s32offset_u32(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1ub_gather_s32offset_u32(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_s32offset_u32() {
     let offsets = svindex_s32(0, 2u32.try_into().unwrap());
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_s32offset_u32(svptrue_b16(), U16_DATA.as_ptr(), offsets);
-    let loaded = svldff1uh_gather_s32offset_u32(svptrue_b16(), U16_DATA.as_ptr(), offsets);
+    let _ = svld1uh_gather_s32offset_u32(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1uh_gather_s32offset_u32(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_gather_s64offset_s64() {
     let offsets = svindex_s64(0, 1u32.try_into().unwrap());
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_gather_s64offset_s64(svptrue_b8(), U8_DATA.as_ptr(), offsets);
-    let loaded = svldff1ub_gather_s64offset_s64(svptrue_b8(), U8_DATA.as_ptr(), offsets);
+    let _ = svld1ub_gather_s64offset_s64(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1ub_gather_s64offset_s64(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_s64offset_s64() {
     let offsets = svindex_s64(0, 2u32.try_into().unwrap());
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_s64offset_s64(svptrue_b16(), U16_DATA.as_ptr(), offsets);
-    let loaded = svldff1uh_gather_s64offset_s64(svptrue_b16(), U16_DATA.as_ptr(), offsets);
+    let _ = svld1uh_gather_s64offset_s64(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1uh_gather_s64offset_s64(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_gather_s64offset_s64() {
     let offsets = svindex_s64(0, 4u32.try_into().unwrap());
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_gather_s64offset_s64(svptrue_b32(), U32_DATA.as_ptr(), offsets);
-    let loaded = svldff1uw_gather_s64offset_s64(svptrue_b32(), U32_DATA.as_ptr(), offsets);
+    let _ = svld1uw_gather_s64offset_s64(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1uw_gather_s64offset_s64(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_gather_s64offset_u64() {
     let offsets = svindex_s64(0, 1u32.try_into().unwrap());
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_gather_s64offset_u64(svptrue_b8(), U8_DATA.as_ptr(), offsets);
-    let loaded = svldff1ub_gather_s64offset_u64(svptrue_b8(), U8_DATA.as_ptr(), offsets);
+    let _ = svld1ub_gather_s64offset_u64(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1ub_gather_s64offset_u64(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_s64offset_u64() {
     let offsets = svindex_s64(0, 2u32.try_into().unwrap());
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_s64offset_u64(svptrue_b16(), U16_DATA.as_ptr(), offsets);
-    let loaded = svldff1uh_gather_s64offset_u64(svptrue_b16(), U16_DATA.as_ptr(), offsets);
+    let _ = svld1uh_gather_s64offset_u64(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1uh_gather_s64offset_u64(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_gather_s64offset_u64() {
     let offsets = svindex_s64(0, 4u32.try_into().unwrap());
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_gather_s64offset_u64(svptrue_b32(), U32_DATA.as_ptr(), offsets);
-    let loaded = svldff1uw_gather_s64offset_u64(svptrue_b32(), U32_DATA.as_ptr(), offsets);
+    let _ = svld1uw_gather_s64offset_u64(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1uw_gather_s64offset_u64(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_gather_u32offset_s32() {
     let offsets = svindex_u32(0, 1u32.try_into().unwrap());
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_gather_u32offset_s32(svptrue_b8(), U8_DATA.as_ptr(), offsets);
-    let loaded = svldff1ub_gather_u32offset_s32(svptrue_b8(), U8_DATA.as_ptr(), offsets);
+    let _ = svld1ub_gather_u32offset_s32(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1ub_gather_u32offset_s32(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_u32offset_s32() {
     let offsets = svindex_u32(0, 2u32.try_into().unwrap());
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_u32offset_s32(svptrue_b16(), U16_DATA.as_ptr(), offsets);
-    let loaded = svldff1uh_gather_u32offset_s32(svptrue_b16(), U16_DATA.as_ptr(), offsets);
+    let _ = svld1uh_gather_u32offset_s32(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1uh_gather_u32offset_s32(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_gather_u32offset_u32() {
     let offsets = svindex_u32(0, 1u32.try_into().unwrap());
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_gather_u32offset_u32(svptrue_b8(), U8_DATA.as_ptr(), offsets);
-    let loaded = svldff1ub_gather_u32offset_u32(svptrue_b8(), U8_DATA.as_ptr(), offsets);
+    let _ = svld1ub_gather_u32offset_u32(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1ub_gather_u32offset_u32(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_u32offset_u32() {
     let offsets = svindex_u32(0, 2u32.try_into().unwrap());
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_u32offset_u32(svptrue_b16(), U16_DATA.as_ptr(), offsets);
-    let loaded = svldff1uh_gather_u32offset_u32(svptrue_b16(), U16_DATA.as_ptr(), offsets);
+    let _ = svld1uh_gather_u32offset_u32(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1uh_gather_u32offset_u32(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_gather_u64offset_s64() {
     let offsets = svindex_u64(0, 1u32.try_into().unwrap());
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_gather_u64offset_s64(svptrue_b8(), U8_DATA.as_ptr(), offsets);
-    let loaded = svldff1ub_gather_u64offset_s64(svptrue_b8(), U8_DATA.as_ptr(), offsets);
+    let _ = svld1ub_gather_u64offset_s64(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1ub_gather_u64offset_s64(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_u64offset_s64() {
     let offsets = svindex_u64(0, 2u32.try_into().unwrap());
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_u64offset_s64(svptrue_b16(), U16_DATA.as_ptr(), offsets);
-    let loaded = svldff1uh_gather_u64offset_s64(svptrue_b16(), U16_DATA.as_ptr(), offsets);
+    let _ = svld1uh_gather_u64offset_s64(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1uh_gather_u64offset_s64(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_gather_u64offset_s64() {
     let offsets = svindex_u64(0, 4u32.try_into().unwrap());
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_gather_u64offset_s64(svptrue_b32(), U32_DATA.as_ptr(), offsets);
-    let loaded = svldff1uw_gather_u64offset_s64(svptrue_b32(), U32_DATA.as_ptr(), offsets);
+    let _ = svld1uw_gather_u64offset_s64(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1uw_gather_u64offset_s64(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_gather_u64offset_u64() {
     let offsets = svindex_u64(0, 1u32.try_into().unwrap());
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_gather_u64offset_u64(svptrue_b8(), U8_DATA.as_ptr(), offsets);
-    let loaded = svldff1ub_gather_u64offset_u64(svptrue_b8(), U8_DATA.as_ptr(), offsets);
+    let _ = svld1ub_gather_u64offset_u64(svptrue_b8(), ptr, offsets);
+    let loaded = svldff1ub_gather_u64offset_u64(svptrue_b8(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_u64offset_u64() {
     let offsets = svindex_u64(0, 2u32.try_into().unwrap());
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_u64offset_u64(svptrue_b16(), U16_DATA.as_ptr(), offsets);
-    let loaded = svldff1uh_gather_u64offset_u64(svptrue_b16(), U16_DATA.as_ptr(), offsets);
+    let _ = svld1uh_gather_u64offset_u64(svptrue_b16(), ptr, offsets);
+    let loaded = svldff1uh_gather_u64offset_u64(svptrue_b16(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_gather_u64offset_u64() {
     let offsets = svindex_u64(0, 4u32.try_into().unwrap());
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_gather_u64offset_u64(svptrue_b32(), U32_DATA.as_ptr(), offsets);
-    let loaded = svldff1uw_gather_u64offset_u64(svptrue_b32(), U32_DATA.as_ptr(), offsets);
+    let _ = svld1uw_gather_u64offset_u64(svptrue_b32(), ptr, offsets);
+    let loaded = svldff1uw_gather_u64offset_u64(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8946,9 +10097,11 @@ unsafe fn test_svldff1ub_gather_u32base_offset_s32() {
         bases,
         U8_DATA.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8965,9 +10118,11 @@ unsafe fn test_svldff1uh_gather_u32base_offset_s32() {
         bases,
         U16_DATA.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -8984,9 +10139,11 @@ unsafe fn test_svldff1ub_gather_u32base_offset_u32() {
         bases,
         U8_DATA.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9003,9 +10160,11 @@ unsafe fn test_svldff1uh_gather_u32base_offset_u32() {
         bases,
         U16_DATA.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9016,9 +10175,11 @@ unsafe fn test_svldff1ub_gather_u64base_offset_s64() {
     svsetffr();
     let _ = svld1ub_gather_u64base_offset_s64(svptrue_b8(), bases, 1u32.try_into().unwrap());
     let loaded = svldff1ub_gather_u64base_offset_s64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9030,9 +10191,11 @@ unsafe fn test_svldff1uh_gather_u64base_offset_s64() {
     let _ = svld1uh_gather_u64base_offset_s64(svptrue_b16(), bases, 2u32.try_into().unwrap());
     let loaded =
         svldff1uh_gather_u64base_offset_s64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9044,9 +10207,11 @@ unsafe fn test_svldff1uw_gather_u64base_offset_s64() {
     let _ = svld1uw_gather_u64base_offset_s64(svptrue_b32(), bases, 4u32.try_into().unwrap());
     let loaded =
         svldff1uw_gather_u64base_offset_s64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9057,9 +10222,11 @@ unsafe fn test_svldff1ub_gather_u64base_offset_u64() {
     svsetffr();
     let _ = svld1ub_gather_u64base_offset_u64(svptrue_b8(), bases, 1u32.try_into().unwrap());
     let loaded = svldff1ub_gather_u64base_offset_u64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9071,9 +10238,11 @@ unsafe fn test_svldff1uh_gather_u64base_offset_u64() {
     let _ = svld1uh_gather_u64base_offset_u64(svptrue_b16(), bases, 2u32.try_into().unwrap());
     let loaded =
         svldff1uh_gather_u64base_offset_u64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9085,9 +10254,11 @@ unsafe fn test_svldff1uw_gather_u64base_offset_u64() {
     let _ = svld1uw_gather_u64base_offset_u64(svptrue_b32(), bases, 4u32.try_into().unwrap());
     let loaded =
         svldff1uw_gather_u64base_offset_u64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9098,9 +10269,11 @@ unsafe fn test_svldff1ub_gather_u64base_s64() {
     svsetffr();
     let _ = svld1ub_gather_u64base_s64(svptrue_b8(), bases);
     let loaded = svldff1ub_gather_u64base_s64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9111,9 +10284,11 @@ unsafe fn test_svldff1uh_gather_u64base_s64() {
     svsetffr();
     let _ = svld1uh_gather_u64base_s64(svptrue_b16(), bases);
     let loaded = svldff1uh_gather_u64base_s64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9124,9 +10299,11 @@ unsafe fn test_svldff1uw_gather_u64base_s64() {
     svsetffr();
     let _ = svld1uw_gather_u64base_s64(svptrue_b32(), bases);
     let loaded = svldff1uw_gather_u64base_s64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9137,9 +10314,11 @@ unsafe fn test_svldff1ub_gather_u64base_u64() {
     svsetffr();
     let _ = svld1ub_gather_u64base_u64(svptrue_b8(), bases);
     let loaded = svldff1ub_gather_u64base_u64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9150,9 +10329,11 @@ unsafe fn test_svldff1uh_gather_u64base_u64() {
     svsetffr();
     let _ = svld1uh_gather_u64base_u64(svptrue_b16(), bases);
     let loaded = svldff1uh_gather_u64base_u64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9163,136 +10344,176 @@ unsafe fn test_svldff1uw_gather_u64base_u64() {
     svsetffr();
     let _ = svld1uw_gather_u64base_u64(svptrue_b32(), bases);
     let loaded = svldff1uw_gather_u64base_u64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_s16() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_s16(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldff1ub_s16(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_s16(svptrue_b8(), ptr);
+    let loaded = svldff1ub_s16(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_s32() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_s32(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldff1ub_s32(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_s32(svptrue_b8(), ptr);
+    let loaded = svldff1ub_s32(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_s32() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_s32(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldff1uh_s32(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1uh_s32(svptrue_b16(), ptr);
+    let loaded = svldff1uh_s32(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_s64() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_s64(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldff1ub_s64(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_s64(svptrue_b8(), ptr);
+    let loaded = svldff1ub_s64(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_s64() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_s64(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldff1uh_s64(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1uh_s64(svptrue_b16(), ptr);
+    let loaded = svldff1uh_s64(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_s64() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_s64(svptrue_b32(), U32_DATA.as_ptr());
-    let loaded = svldff1uw_s64(svptrue_b32(), U32_DATA.as_ptr());
+    let _ = svld1uw_s64(svptrue_b32(), ptr);
+    let loaded = svldff1uw_s64(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_u16() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_u16(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldff1ub_u16(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_u16(svptrue_b8(), ptr);
+    let loaded = svldff1ub_u16(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_u32() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_u32(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldff1ub_u32(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_u32(svptrue_b8(), ptr);
+    let loaded = svldff1ub_u32(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_u32() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_u32(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldff1uh_u32(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1uh_u32(svptrue_b16(), ptr);
+    let loaded = svldff1uh_u32(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_u64() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_u64(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldff1ub_u64(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_u64(svptrue_b8(), ptr);
+    let loaded = svldff1ub_u64(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_u64() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_u64(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldff1uh_u64(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1uh_u64(svptrue_b16(), ptr);
+    let loaded = svldff1uh_u64(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_u64() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_u64(svptrue_b32(), U32_DATA.as_ptr());
-    let loaded = svldff1uw_u64(svptrue_b32(), U32_DATA.as_ptr());
+    let _ = svld1uw_u64(svptrue_b32(), ptr);
+    let loaded = svldff1uw_u64(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_vnum_s16() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_s16(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldff1ub_vnum_s16(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_s16(svptrue_b8(), ptr, 1);
+    let loaded = svldff1ub_vnum_s16(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_i16(
         loaded,
@@ -9300,13 +10521,16 @@ unsafe fn test_svldff1ub_vnum_s16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_vnum_s32() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_s32(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldff1ub_vnum_s32(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_s32(svptrue_b8(), ptr, 1);
+    let loaded = svldff1ub_vnum_s32(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -9314,13 +10538,16 @@ unsafe fn test_svldff1ub_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_vnum_s32() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_vnum_s32(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldff1uh_vnum_s32(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1uh_vnum_s32(svptrue_b16(), ptr, 1);
+    let loaded = svldff1uh_vnum_s32(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -9328,13 +10555,16 @@ unsafe fn test_svldff1uh_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_vnum_s64() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_s64(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldff1ub_vnum_s64(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_s64(svptrue_b8(), ptr, 1);
+    let loaded = svldff1ub_vnum_s64(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -9342,13 +10572,16 @@ unsafe fn test_svldff1ub_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_vnum_s64() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_vnum_s64(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldff1uh_vnum_s64(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1uh_vnum_s64(svptrue_b16(), ptr, 1);
+    let loaded = svldff1uh_vnum_s64(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -9356,13 +10589,16 @@ unsafe fn test_svldff1uh_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_vnum_s64() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_vnum_s64(svptrue_b32(), U32_DATA.as_ptr(), 1);
-    let loaded = svldff1uw_vnum_s64(svptrue_b32(), U32_DATA.as_ptr(), 1);
+    let _ = svld1uw_vnum_s64(svptrue_b32(), ptr, 1);
+    let loaded = svldff1uw_vnum_s64(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -9370,13 +10606,16 @@ unsafe fn test_svldff1uw_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_vnum_u16() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_u16(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldff1ub_vnum_u16(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_u16(svptrue_b8(), ptr, 1);
+    let loaded = svldff1ub_vnum_u16(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_u16(
         loaded,
@@ -9384,13 +10623,16 @@ unsafe fn test_svldff1ub_vnum_u16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_vnum_u32() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_u32(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldff1ub_vnum_u32(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_u32(svptrue_b8(), ptr, 1);
+    let loaded = svldff1ub_vnum_u32(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -9398,13 +10640,16 @@ unsafe fn test_svldff1ub_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_vnum_u32() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_vnum_u32(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldff1uh_vnum_u32(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1uh_vnum_u32(svptrue_b16(), ptr, 1);
+    let loaded = svldff1uh_vnum_u32(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -9412,13 +10657,16 @@ unsafe fn test_svldff1uh_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1ub_vnum_u64() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_u64(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldff1ub_vnum_u64(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_u64(svptrue_b8(), ptr, 1);
+    let loaded = svldff1ub_vnum_u64(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -9426,13 +10674,16 @@ unsafe fn test_svldff1ub_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_vnum_u64() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_vnum_u64(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldff1uh_vnum_u64(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1uh_vnum_u64(svptrue_b16(), ptr, 1);
+    let loaded = svldff1uh_vnum_u64(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -9440,13 +10691,16 @@ unsafe fn test_svldff1uh_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_vnum_u64() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_vnum_u64(svptrue_b32(), U32_DATA.as_ptr(), 1);
-    let loaded = svldff1uw_vnum_u64(svptrue_b32(), U32_DATA.as_ptr(), 1);
+    let _ = svld1uw_vnum_u64(svptrue_b32(), ptr, 1);
+    let loaded = svldff1uw_vnum_u64(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -9454,138 +10708,175 @@ unsafe fn test_svldff1uw_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_s32index_s32() {
     let indices = svindex_s32(0, 1);
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_s32index_s32(svptrue_b16(), U16_DATA.as_ptr(), indices);
-    let loaded = svldff1uh_gather_s32index_s32(svptrue_b16(), U16_DATA.as_ptr(), indices);
+    let _ = svld1uh_gather_s32index_s32(svptrue_b16(), ptr, indices);
+    let loaded = svldff1uh_gather_s32index_s32(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_s32index_u32() {
     let indices = svindex_s32(0, 1);
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_s32index_u32(svptrue_b16(), U16_DATA.as_ptr(), indices);
-    let loaded = svldff1uh_gather_s32index_u32(svptrue_b16(), U16_DATA.as_ptr(), indices);
+    let _ = svld1uh_gather_s32index_u32(svptrue_b16(), ptr, indices);
+    let loaded = svldff1uh_gather_s32index_u32(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_s64index_s64() {
     let indices = svindex_s64(0, 1);
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_s64index_s64(svptrue_b16(), U16_DATA.as_ptr(), indices);
-    let loaded = svldff1uh_gather_s64index_s64(svptrue_b16(), U16_DATA.as_ptr(), indices);
+    let _ = svld1uh_gather_s64index_s64(svptrue_b16(), ptr, indices);
+    let loaded = svldff1uh_gather_s64index_s64(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_gather_s64index_s64() {
     let indices = svindex_s64(0, 1);
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_gather_s64index_s64(svptrue_b32(), U32_DATA.as_ptr(), indices);
-    let loaded = svldff1uw_gather_s64index_s64(svptrue_b32(), U32_DATA.as_ptr(), indices);
+    let _ = svld1uw_gather_s64index_s64(svptrue_b32(), ptr, indices);
+    let loaded = svldff1uw_gather_s64index_s64(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_s64index_u64() {
     let indices = svindex_s64(0, 1);
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_s64index_u64(svptrue_b16(), U16_DATA.as_ptr(), indices);
-    let loaded = svldff1uh_gather_s64index_u64(svptrue_b16(), U16_DATA.as_ptr(), indices);
+    let _ = svld1uh_gather_s64index_u64(svptrue_b16(), ptr, indices);
+    let loaded = svldff1uh_gather_s64index_u64(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_gather_s64index_u64() {
     let indices = svindex_s64(0, 1);
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_gather_s64index_u64(svptrue_b32(), U32_DATA.as_ptr(), indices);
-    let loaded = svldff1uw_gather_s64index_u64(svptrue_b32(), U32_DATA.as_ptr(), indices);
+    let _ = svld1uw_gather_s64index_u64(svptrue_b32(), ptr, indices);
+    let loaded = svldff1uw_gather_s64index_u64(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_u32index_s32() {
     let indices = svindex_u32(0, 1);
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_u32index_s32(svptrue_b16(), U16_DATA.as_ptr(), indices);
-    let loaded = svldff1uh_gather_u32index_s32(svptrue_b16(), U16_DATA.as_ptr(), indices);
+    let _ = svld1uh_gather_u32index_s32(svptrue_b16(), ptr, indices);
+    let loaded = svldff1uh_gather_u32index_s32(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_u32index_u32() {
     let indices = svindex_u32(0, 1);
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_u32index_u32(svptrue_b16(), U16_DATA.as_ptr(), indices);
-    let loaded = svldff1uh_gather_u32index_u32(svptrue_b16(), U16_DATA.as_ptr(), indices);
+    let _ = svld1uh_gather_u32index_u32(svptrue_b16(), ptr, indices);
+    let loaded = svldff1uh_gather_u32index_u32(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_u64index_s64() {
     let indices = svindex_u64(0, 1);
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_u64index_s64(svptrue_b16(), U16_DATA.as_ptr(), indices);
-    let loaded = svldff1uh_gather_u64index_s64(svptrue_b16(), U16_DATA.as_ptr(), indices);
+    let _ = svld1uh_gather_u64index_s64(svptrue_b16(), ptr, indices);
+    let loaded = svldff1uh_gather_u64index_s64(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_gather_u64index_s64() {
     let indices = svindex_u64(0, 1);
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_gather_u64index_s64(svptrue_b32(), U32_DATA.as_ptr(), indices);
-    let loaded = svldff1uw_gather_u64index_s64(svptrue_b32(), U32_DATA.as_ptr(), indices);
+    let _ = svld1uw_gather_u64index_s64(svptrue_b32(), ptr, indices);
+    let loaded = svldff1uw_gather_u64index_s64(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uh_gather_u64index_u64() {
     let indices = svindex_u64(0, 1);
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_gather_u64index_u64(svptrue_b16(), U16_DATA.as_ptr(), indices);
-    let loaded = svldff1uh_gather_u64index_u64(svptrue_b16(), U16_DATA.as_ptr(), indices);
+    let _ = svld1uh_gather_u64index_u64(svptrue_b16(), ptr, indices);
+    let loaded = svldff1uh_gather_u64index_u64(svptrue_b16(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldff1uw_gather_u64index_u64() {
     let indices = svindex_u64(0, 1);
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_gather_u64index_u64(svptrue_b32(), U32_DATA.as_ptr(), indices);
-    let loaded = svldff1uw_gather_u64index_u64(svptrue_b32(), U32_DATA.as_ptr(), indices);
+    let _ = svld1uw_gather_u64index_u64(svptrue_b32(), ptr, indices);
+    let loaded = svldff1uw_gather_u64index_u64(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9602,9 +10893,11 @@ unsafe fn test_svldff1uh_gather_u32base_index_s32() {
         bases,
         U16_DATA.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9621,9 +10914,11 @@ unsafe fn test_svldff1uh_gather_u32base_index_u32() {
         bases,
         U16_DATA.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9634,9 +10929,11 @@ unsafe fn test_svldff1uh_gather_u64base_index_s64() {
     svsetffr();
     let _ = svld1uh_gather_u64base_index_s64(svptrue_b16(), bases, 1.try_into().unwrap());
     let loaded = svldff1uh_gather_u64base_index_s64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9647,9 +10944,11 @@ unsafe fn test_svldff1uw_gather_u64base_index_s64() {
     svsetffr();
     let _ = svld1uw_gather_u64base_index_s64(svptrue_b32(), bases, 1.try_into().unwrap());
     let loaded = svldff1uw_gather_u64base_index_s64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9660,9 +10959,11 @@ unsafe fn test_svldff1uh_gather_u64base_index_u64() {
     svsetffr();
     let _ = svld1uh_gather_u64base_index_u64(svptrue_b16(), bases, 1.try_into().unwrap());
     let loaded = svldff1uh_gather_u64base_index_u64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -9673,122 +10974,156 @@ unsafe fn test_svldff1uw_gather_u64base_index_u64() {
     svsetffr();
     let _ = svld1uw_gather_u64base_index_u64(svptrue_b32(), bases, 1.try_into().unwrap());
     let loaded = svldff1uw_gather_u64base_index_u64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_f32() {
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_f32(svptrue_b32(), F32_DATA.as_ptr());
-    let loaded = svldnf1_f32(svptrue_b32(), F32_DATA.as_ptr());
+    let _ = svld1_f32(svptrue_b32(), ptr);
+    let loaded = svldnf1_f32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_f64() {
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_f64(svptrue_b64(), F64_DATA.as_ptr());
-    let loaded = svldnf1_f64(svptrue_b64(), F64_DATA.as_ptr());
+    let _ = svld1_f64(svptrue_b64(), ptr);
+    let loaded = svldnf1_f64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_s8() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_s8(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldnf1_s8(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1_s8(svptrue_b8(), ptr);
+    let loaded = svldnf1_s8(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         loaded,
         svindex_s8((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_s16() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_s16(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldnf1_s16(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1_s16(svptrue_b16(), ptr);
+    let loaded = svldnf1_s16(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_s32() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_s32(svptrue_b32(), I32_DATA.as_ptr());
-    let loaded = svldnf1_s32(svptrue_b32(), I32_DATA.as_ptr());
+    let _ = svld1_s32(svptrue_b32(), ptr);
+    let loaded = svldnf1_s32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_s64() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_s64(svptrue_b64(), I64_DATA.as_ptr());
-    let loaded = svldnf1_s64(svptrue_b64(), I64_DATA.as_ptr());
+    let _ = svld1_s64(svptrue_b64(), ptr);
+    let loaded = svldnf1_s64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_u8() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_u8(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldnf1_u8(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1_u8(svptrue_b8(), ptr);
+    let loaded = svldnf1_u8(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         loaded,
         svindex_u8((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_u16() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_u16(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldnf1_u16(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1_u16(svptrue_b16(), ptr);
+    let loaded = svldnf1_u16(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_u32() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_u32(svptrue_b32(), U32_DATA.as_ptr());
-    let loaded = svldnf1_u32(svptrue_b32(), U32_DATA.as_ptr());
+    let _ = svld1_u32(svptrue_b32(), ptr);
+    let loaded = svldnf1_u32(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_u64() {
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_u64(svptrue_b64(), U64_DATA.as_ptr());
-    let loaded = svldnf1_u64(svptrue_b64(), U64_DATA.as_ptr());
+    let _ = svld1_u64(svptrue_b64(), ptr);
+    let loaded = svldnf1_u64(svptrue_b64(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_f32() {
+    let ptr = F32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_f32(svptrue_b32(), F32_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_f32(svptrue_b32(), F32_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_f32(svptrue_b32(), ptr, 1);
+    let loaded = svldnf1_vnum_f32(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_f32(
         loaded,
@@ -9799,13 +11134,16 @@ unsafe fn test_svldnf1_vnum_f32() {
                 1usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_f64() {
+    let ptr = F64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_f64(svptrue_b64(), F64_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_f64(svptrue_b64(), F64_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_f64(svptrue_b64(), ptr, 1);
+    let loaded = svldnf1_vnum_f64(svptrue_b64(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_f64(
         loaded,
@@ -9816,13 +11154,16 @@ unsafe fn test_svldnf1_vnum_f64() {
                 1usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_s8() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_s8(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_s8(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_s8(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1_vnum_s8(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntb() as usize;
     assert_vector_matches_i8(
         loaded,
@@ -9830,13 +11171,16 @@ unsafe fn test_svldnf1_vnum_s8() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_s16() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_s16(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_s16(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_s16(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1_vnum_s16(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_i16(
         loaded,
@@ -9844,13 +11188,16 @@ unsafe fn test_svldnf1_vnum_s16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_s32() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_s32(svptrue_b32(), I32_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_s32(svptrue_b32(), I32_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_s32(svptrue_b32(), ptr, 1);
+    let loaded = svldnf1_vnum_s32(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -9858,13 +11205,16 @@ unsafe fn test_svldnf1_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_s64() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_s64(svptrue_b64(), I64_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_s64(svptrue_b64(), I64_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_s64(svptrue_b64(), ptr, 1);
+    let loaded = svldnf1_vnum_s64(svptrue_b64(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -9872,13 +11222,16 @@ unsafe fn test_svldnf1_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_u8() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_u8(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_u8(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_u8(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1_vnum_u8(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntb() as usize;
     assert_vector_matches_u8(
         loaded,
@@ -9886,13 +11239,16 @@ unsafe fn test_svldnf1_vnum_u8() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_u16() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_u16(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_u16(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_u16(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1_vnum_u16(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_u16(
         loaded,
@@ -9900,13 +11256,16 @@ unsafe fn test_svldnf1_vnum_u16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_u32() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_u32(svptrue_b32(), U32_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_u32(svptrue_b32(), U32_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_u32(svptrue_b32(), ptr, 1);
+    let loaded = svldnf1_vnum_u32(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -9914,13 +11273,16 @@ unsafe fn test_svldnf1_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1_vnum_u64() {
+    let ptr = U64_DATA.as_ptr();
     svsetffr();
-    let _ = svld1_vnum_u64(svptrue_b64(), U64_DATA.as_ptr(), 1);
-    let loaded = svldnf1_vnum_u64(svptrue_b64(), U64_DATA.as_ptr(), 1);
+    let _ = svld1_vnum_u64(svptrue_b64(), ptr, 1);
+    let loaded = svldnf1_vnum_u64(svptrue_b64(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -9928,133 +11290,172 @@ unsafe fn test_svldnf1_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_s16() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_s16(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldnf1sb_s16(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_s16(svptrue_b8(), ptr);
+    let loaded = svldnf1sb_s16(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_s32() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_s32(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldnf1sb_s32(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_s32(svptrue_b8(), ptr);
+    let loaded = svldnf1sb_s32(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sh_s32() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_s32(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldnf1sh_s32(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1sh_s32(svptrue_b16(), ptr);
+    let loaded = svldnf1sh_s32(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_s64() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_s64(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldnf1sb_s64(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_s64(svptrue_b8(), ptr);
+    let loaded = svldnf1sb_s64(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sh_s64() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_s64(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldnf1sh_s64(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1sh_s64(svptrue_b16(), ptr);
+    let loaded = svldnf1sh_s64(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sw_s64() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_s64(svptrue_b32(), I32_DATA.as_ptr());
-    let loaded = svldnf1sw_s64(svptrue_b32(), I32_DATA.as_ptr());
+    let _ = svld1sw_s64(svptrue_b32(), ptr);
+    let loaded = svldnf1sw_s64(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_u16() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_u16(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldnf1sb_u16(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_u16(svptrue_b8(), ptr);
+    let loaded = svldnf1sb_u16(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_u32() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_u32(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldnf1sb_u32(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_u32(svptrue_b8(), ptr);
+    let loaded = svldnf1sb_u32(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sh_u32() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_u32(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldnf1sh_u32(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1sh_u32(svptrue_b16(), ptr);
+    let loaded = svldnf1sh_u32(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_u64() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_u64(svptrue_b8(), I8_DATA.as_ptr());
-    let loaded = svldnf1sb_u64(svptrue_b8(), I8_DATA.as_ptr());
+    let _ = svld1sb_u64(svptrue_b8(), ptr);
+    let loaded = svldnf1sb_u64(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sh_u64() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_u64(svptrue_b16(), I16_DATA.as_ptr());
-    let loaded = svldnf1sh_u64(svptrue_b16(), I16_DATA.as_ptr());
+    let _ = svld1sh_u64(svptrue_b16(), ptr);
+    let loaded = svldnf1sh_u64(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sw_u64() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_u64(svptrue_b32(), I32_DATA.as_ptr());
-    let loaded = svldnf1sw_u64(svptrue_b32(), I32_DATA.as_ptr());
+    let _ = svld1sw_u64(svptrue_b32(), ptr);
+    let loaded = svldnf1sw_u64(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_vnum_s16() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_s16(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldnf1sb_vnum_s16(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_s16(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1sb_vnum_s16(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_i16(
         loaded,
@@ -10062,13 +11463,16 @@ unsafe fn test_svldnf1sb_vnum_s16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_vnum_s32() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_s32(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldnf1sb_vnum_s32(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_s32(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1sb_vnum_s32(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -10076,13 +11480,16 @@ unsafe fn test_svldnf1sb_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sh_vnum_s32() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_vnum_s32(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldnf1sh_vnum_s32(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1sh_vnum_s32(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1sh_vnum_s32(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -10090,13 +11497,16 @@ unsafe fn test_svldnf1sh_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_vnum_s64() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_s64(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldnf1sb_vnum_s64(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_s64(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1sb_vnum_s64(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -10104,13 +11514,16 @@ unsafe fn test_svldnf1sb_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sh_vnum_s64() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_vnum_s64(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldnf1sh_vnum_s64(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1sh_vnum_s64(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1sh_vnum_s64(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -10118,13 +11531,16 @@ unsafe fn test_svldnf1sh_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sw_vnum_s64() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_vnum_s64(svptrue_b32(), I32_DATA.as_ptr(), 1);
-    let loaded = svldnf1sw_vnum_s64(svptrue_b32(), I32_DATA.as_ptr(), 1);
+    let _ = svld1sw_vnum_s64(svptrue_b32(), ptr, 1);
+    let loaded = svldnf1sw_vnum_s64(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -10132,13 +11548,16 @@ unsafe fn test_svldnf1sw_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_vnum_u16() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_u16(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldnf1sb_vnum_u16(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_u16(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1sb_vnum_u16(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_u16(
         loaded,
@@ -10146,13 +11565,16 @@ unsafe fn test_svldnf1sb_vnum_u16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_vnum_u32() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_u32(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldnf1sb_vnum_u32(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_u32(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1sb_vnum_u32(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -10160,13 +11582,16 @@ unsafe fn test_svldnf1sb_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sh_vnum_u32() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_vnum_u32(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldnf1sh_vnum_u32(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1sh_vnum_u32(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1sh_vnum_u32(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -10174,13 +11599,16 @@ unsafe fn test_svldnf1sh_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sb_vnum_u64() {
+    let ptr = I8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sb_vnum_u64(svptrue_b8(), I8_DATA.as_ptr(), 1);
-    let loaded = svldnf1sb_vnum_u64(svptrue_b8(), I8_DATA.as_ptr(), 1);
+    let _ = svld1sb_vnum_u64(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1sb_vnum_u64(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -10188,13 +11616,16 @@ unsafe fn test_svldnf1sb_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sh_vnum_u64() {
+    let ptr = I16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sh_vnum_u64(svptrue_b16(), I16_DATA.as_ptr(), 1);
-    let loaded = svldnf1sh_vnum_u64(svptrue_b16(), I16_DATA.as_ptr(), 1);
+    let _ = svld1sh_vnum_u64(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1sh_vnum_u64(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -10202,13 +11633,16 @@ unsafe fn test_svldnf1sh_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1sw_vnum_u64() {
+    let ptr = I32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1sw_vnum_u64(svptrue_b32(), I32_DATA.as_ptr(), 1);
-    let loaded = svldnf1sw_vnum_u64(svptrue_b32(), I32_DATA.as_ptr(), 1);
+    let _ = svld1sw_vnum_u64(svptrue_b32(), ptr, 1);
+    let loaded = svldnf1sw_vnum_u64(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -10216,133 +11650,172 @@ unsafe fn test_svldnf1sw_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_s16() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_s16(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldnf1ub_s16(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_s16(svptrue_b8(), ptr);
+    let loaded = svldnf1ub_s16(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_s32() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_s32(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldnf1ub_s32(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_s32(svptrue_b8(), ptr);
+    let loaded = svldnf1ub_s32(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uh_s32() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_s32(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldnf1uh_s32(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1uh_s32(svptrue_b16(), ptr);
+    let loaded = svldnf1uh_s32(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_s64() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_s64(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldnf1ub_s64(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_s64(svptrue_b8(), ptr);
+    let loaded = svldnf1ub_s64(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uh_s64() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_s64(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldnf1uh_s64(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1uh_s64(svptrue_b16(), ptr);
+    let loaded = svldnf1uh_s64(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uw_s64() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_s64(svptrue_b32(), U32_DATA.as_ptr());
-    let loaded = svldnf1uw_s64(svptrue_b32(), U32_DATA.as_ptr());
+    let _ = svld1uw_s64(svptrue_b32(), ptr);
+    let loaded = svldnf1uw_s64(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_u16() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_u16(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldnf1ub_u16(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_u16(svptrue_b8(), ptr);
+    let loaded = svldnf1ub_u16(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_u32() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_u32(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldnf1ub_u32(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_u32(svptrue_b8(), ptr);
+    let loaded = svldnf1ub_u32(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uh_u32() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_u32(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldnf1uh_u32(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1uh_u32(svptrue_b16(), ptr);
+    let loaded = svldnf1uh_u32(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_u64() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_u64(svptrue_b8(), U8_DATA.as_ptr());
-    let loaded = svldnf1ub_u64(svptrue_b8(), U8_DATA.as_ptr());
+    let _ = svld1ub_u64(svptrue_b8(), ptr);
+    let loaded = svldnf1ub_u64(svptrue_b8(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uh_u64() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_u64(svptrue_b16(), U16_DATA.as_ptr());
-    let loaded = svldnf1uh_u64(svptrue_b16(), U16_DATA.as_ptr());
+    let _ = svld1uh_u64(svptrue_b16(), ptr);
+    let loaded = svldnf1uh_u64(svptrue_b16(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uw_u64() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_u64(svptrue_b32(), U32_DATA.as_ptr());
-    let loaded = svldnf1uw_u64(svptrue_b32(), U32_DATA.as_ptr());
+    let _ = svld1uw_u64(svptrue_b32(), ptr);
+    let loaded = svldnf1uw_u64(svptrue_b32(), ptr);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_vnum_s16() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_s16(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldnf1ub_vnum_s16(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_s16(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1ub_vnum_s16(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_i16(
         loaded,
@@ -10350,13 +11823,16 @@ unsafe fn test_svldnf1ub_vnum_s16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_vnum_s32() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_s32(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldnf1ub_vnum_s32(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_s32(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1ub_vnum_s32(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -10364,13 +11840,16 @@ unsafe fn test_svldnf1ub_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uh_vnum_s32() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_vnum_s32(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldnf1uh_vnum_s32(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1uh_vnum_s32(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1uh_vnum_s32(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_i32(
         loaded,
@@ -10378,13 +11857,16 @@ unsafe fn test_svldnf1uh_vnum_s32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_vnum_s64() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_s64(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldnf1ub_vnum_s64(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_s64(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1ub_vnum_s64(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -10392,13 +11874,16 @@ unsafe fn test_svldnf1ub_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uh_vnum_s64() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_vnum_s64(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldnf1uh_vnum_s64(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1uh_vnum_s64(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1uh_vnum_s64(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -10406,13 +11891,16 @@ unsafe fn test_svldnf1uh_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uw_vnum_s64() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_vnum_s64(svptrue_b32(), U32_DATA.as_ptr(), 1);
-    let loaded = svldnf1uw_vnum_s64(svptrue_b32(), U32_DATA.as_ptr(), 1);
+    let _ = svld1uw_vnum_s64(svptrue_b32(), ptr, 1);
+    let loaded = svldnf1uw_vnum_s64(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_i64(
         loaded,
@@ -10420,13 +11908,16 @@ unsafe fn test_svldnf1uw_vnum_s64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_vnum_u16() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_u16(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldnf1ub_vnum_u16(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_u16(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1ub_vnum_u16(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcnth() as usize;
     assert_vector_matches_u16(
         loaded,
@@ -10434,13 +11925,16 @@ unsafe fn test_svldnf1ub_vnum_u16() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_vnum_u32() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_u32(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldnf1ub_vnum_u32(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_u32(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1ub_vnum_u32(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -10448,13 +11942,16 @@ unsafe fn test_svldnf1ub_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uh_vnum_u32() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_vnum_u32(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldnf1uh_vnum_u32(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1uh_vnum_u32(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1uh_vnum_u32(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntw() as usize;
     assert_vector_matches_u32(
         loaded,
@@ -10462,13 +11959,16 @@ unsafe fn test_svldnf1uh_vnum_u32() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1ub_vnum_u64() {
+    let ptr = U8_DATA.as_ptr();
     svsetffr();
-    let _ = svld1ub_vnum_u64(svptrue_b8(), U8_DATA.as_ptr(), 1);
-    let loaded = svldnf1ub_vnum_u64(svptrue_b8(), U8_DATA.as_ptr(), 1);
+    let _ = svld1ub_vnum_u64(svptrue_b8(), ptr, 1);
+    let loaded = svldnf1ub_vnum_u64(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -10476,13 +11976,16 @@ unsafe fn test_svldnf1ub_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uh_vnum_u64() {
+    let ptr = U16_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uh_vnum_u64(svptrue_b16(), U16_DATA.as_ptr(), 1);
-    let loaded = svldnf1uh_vnum_u64(svptrue_b16(), U16_DATA.as_ptr(), 1);
+    let _ = svld1uh_vnum_u64(svptrue_b16(), ptr, 1);
+    let loaded = svldnf1uh_vnum_u64(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -10490,13 +11993,16 @@ unsafe fn test_svldnf1uh_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svldnf1uw_vnum_u64() {
+    let ptr = U32_DATA.as_ptr();
     svsetffr();
-    let _ = svld1uw_vnum_u64(svptrue_b32(), U32_DATA.as_ptr(), 1);
-    let loaded = svldnf1uw_vnum_u64(svptrue_b32(), U32_DATA.as_ptr(), 1);
+    let _ = svld1uw_vnum_u64(svptrue_b32(), ptr, 1);
+    let loaded = svldnf1uw_vnum_u64(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
     let len = svcntd() as usize;
     assert_vector_matches_u64(
         loaded,
@@ -10504,6 +12010,7 @@ unsafe fn test_svldnf1uw_vnum_u64() {
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10519,12 +12026,14 @@ unsafe fn test_svldnt1_f32_with_svstnt1_f32() {
     }
     svsetffr();
     let loaded = svldnt1_f32(svptrue_b32(), storage.as_ptr() as *const f32);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10540,12 +12049,14 @@ unsafe fn test_svldnt1_f64_with_svstnt1_f64() {
     }
     svsetffr();
     let loaded = svldnt1_f64(svptrue_b64(), storage.as_ptr() as *const f64);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10558,9 +12069,11 @@ unsafe fn test_svldnt1_s8_with_svstnt1_s8() {
     }
     svsetffr();
     let loaded = svldnt1_s8(svptrue_b8(), storage.as_ptr() as *const i8);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         loaded,
         svindex_s8((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10573,9 +12086,11 @@ unsafe fn test_svldnt1_s16_with_svstnt1_s16() {
     }
     svsetffr();
     let loaded = svldnt1_s16(svptrue_b16(), storage.as_ptr() as *const i16);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10588,9 +12103,11 @@ unsafe fn test_svldnt1_s32_with_svstnt1_s32() {
     }
     svsetffr();
     let loaded = svldnt1_s32(svptrue_b32(), storage.as_ptr() as *const i32);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10603,9 +12120,11 @@ unsafe fn test_svldnt1_s64_with_svstnt1_s64() {
     }
     svsetffr();
     let loaded = svldnt1_s64(svptrue_b64(), storage.as_ptr() as *const i64);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10618,9 +12137,11 @@ unsafe fn test_svldnt1_u8_with_svstnt1_u8() {
     }
     svsetffr();
     let loaded = svldnt1_u8(svptrue_b8(), storage.as_ptr() as *const u8);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         loaded,
         svindex_u8((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10633,9 +12154,11 @@ unsafe fn test_svldnt1_u16_with_svstnt1_u16() {
     }
     svsetffr();
     let loaded = svldnt1_u16(svptrue_b16(), storage.as_ptr() as *const u16);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10648,9 +12171,11 @@ unsafe fn test_svldnt1_u32_with_svstnt1_u32() {
     }
     svsetffr();
     let loaded = svldnt1_u32(svptrue_b32(), storage.as_ptr() as *const u32);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10663,9 +12188,11 @@ unsafe fn test_svldnt1_u64_with_svstnt1_u64() {
     }
     svsetffr();
     let loaded = svldnt1_u64(svptrue_b64(), storage.as_ptr() as *const u64);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10685,6 +12212,7 @@ unsafe fn test_svldnt1_vnum_f32_with_svstnt1_vnum_f32() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_f32(svptrue_b32(), storage.as_ptr() as *const f32, 1);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
@@ -10694,6 +12222,7 @@ unsafe fn test_svldnt1_vnum_f32_with_svstnt1_vnum_f32() {
                 1usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10713,6 +12242,7 @@ unsafe fn test_svldnt1_vnum_f64_with_svstnt1_vnum_f64() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_f64(svptrue_b64(), storage.as_ptr() as *const f64, 1);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
@@ -10722,6 +12252,7 @@ unsafe fn test_svldnt1_vnum_f64_with_svstnt1_vnum_f64() {
                 1usize.try_into().unwrap(),
             ),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10738,12 +12269,14 @@ unsafe fn test_svldnt1_vnum_s8_with_svstnt1_vnum_s8() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_s8(svptrue_b8(), storage.as_ptr() as *const i8, 1);
+    let defined = svrdffr();
     assert_vector_matches_i8(
         loaded,
         svindex_s8(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10760,12 +12293,14 @@ unsafe fn test_svldnt1_vnum_s16_with_svstnt1_vnum_s16() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_s16(svptrue_b16(), storage.as_ptr() as *const i16, 1);
+    let defined = svrdffr();
     assert_vector_matches_i16(
         loaded,
         svindex_s16(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10782,12 +12317,14 @@ unsafe fn test_svldnt1_vnum_s32_with_svstnt1_vnum_s32() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_s32(svptrue_b32(), storage.as_ptr() as *const i32, 1);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10804,12 +12341,14 @@ unsafe fn test_svldnt1_vnum_s64_with_svstnt1_vnum_s64() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_s64(svptrue_b64(), storage.as_ptr() as *const i64, 1);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10826,12 +12365,14 @@ unsafe fn test_svldnt1_vnum_u8_with_svstnt1_vnum_u8() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_u8(svptrue_b8(), storage.as_ptr() as *const u8, 1);
+    let defined = svrdffr();
     assert_vector_matches_u8(
         loaded,
         svindex_u8(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10848,12 +12389,14 @@ unsafe fn test_svldnt1_vnum_u16_with_svstnt1_vnum_u16() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_u16(svptrue_b16(), storage.as_ptr() as *const u16, 1);
+    let defined = svrdffr();
     assert_vector_matches_u16(
         loaded,
         svindex_u16(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10870,12 +12413,14 @@ unsafe fn test_svldnt1_vnum_u32_with_svstnt1_vnum_u32() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_u32(svptrue_b32(), storage.as_ptr() as *const u32, 1);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
@@ -10892,193 +12437,187 @@ unsafe fn test_svldnt1_vnum_u64_with_svstnt1_vnum_u64() {
     }
     svsetffr();
     let loaded = svldnt1_vnum_u64(svptrue_b64(), storage.as_ptr() as *const u64, 1);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64(
             (len + 0usize).try_into().unwrap(),
             1usize.try_into().unwrap(),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfb::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b8(), I64_DATA.as_ptr());
+    let loaded = svprfb::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b8(), ptr);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfh::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b16(), I64_DATA.as_ptr());
+    let loaded = svprfh::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b16(), ptr);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfw::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), I64_DATA.as_ptr());
+    let loaded = svprfw::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfd::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), I64_DATA.as_ptr());
+    let loaded = svprfd::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb_gather_s32offset() {
     let offsets = svindex_s32(0, 4u32.try_into().unwrap());
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfb_gather_s32offset::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b32(),
-        I64_DATA.as_ptr(),
-        offsets,
-    );
+    let loaded =
+        svprfb_gather_s32offset::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh_gather_s32index() {
     let indices = svindex_s32(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfh_gather_s32index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b32(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfh_gather_s32index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw_gather_s32index() {
     let indices = svindex_s32(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfw_gather_s32index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b32(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfw_gather_s32index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd_gather_s32index() {
     let indices = svindex_s32(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfd_gather_s32index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b32(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfd_gather_s32index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb_gather_s64offset() {
     let offsets = svindex_s64(0, 8u32.try_into().unwrap());
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfb_gather_s64offset::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b64(),
-        I64_DATA.as_ptr(),
-        offsets,
-    );
+    let loaded =
+        svprfb_gather_s64offset::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, offsets);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh_gather_s64index() {
     let indices = svindex_s64(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfh_gather_s64index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b64(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfh_gather_s64index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw_gather_s64index() {
     let indices = svindex_s64(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfw_gather_s64index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b64(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfw_gather_s64index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd_gather_s64index() {
     let indices = svindex_s64(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfd_gather_s64index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b64(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfd_gather_s64index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb_gather_u32offset() {
     let offsets = svindex_u32(0, 4u32.try_into().unwrap());
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfb_gather_u32offset::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b32(),
-        I64_DATA.as_ptr(),
-        offsets,
-    );
+    let loaded =
+        svprfb_gather_u32offset::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, offsets);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh_gather_u32index() {
     let indices = svindex_u32(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfh_gather_u32index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b32(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfh_gather_u32index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw_gather_u32index() {
     let indices = svindex_u32(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfw_gather_u32index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b32(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfw_gather_u32index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd_gather_u32index() {
     let indices = svindex_u32(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfd_gather_u32index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b32(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfd_gather_u32index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb_gather_u64offset() {
     let offsets = svindex_u64(0, 8u32.try_into().unwrap());
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfb_gather_u64offset::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b64(),
-        I64_DATA.as_ptr(),
-        offsets,
-    );
+    let loaded =
+        svprfb_gather_u64offset::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, offsets);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh_gather_u64index() {
     let indices = svindex_u64(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfh_gather_u64index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b64(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfh_gather_u64index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw_gather_u64index() {
     let indices = svindex_u64(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfw_gather_u64index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b64(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfw_gather_u64index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd_gather_u64index() {
     let indices = svindex_u64(0, 1);
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfd_gather_u64index::<{ svprfop::SV_PLDL1KEEP }, i64>(
-        svptrue_b64(),
-        I64_DATA.as_ptr(),
-        indices,
-    );
+    let loaded =
+        svprfd_gather_u64index::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, indices);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb_gather_u64base() {
@@ -11087,6 +12626,7 @@ unsafe fn test_svprfb_gather_u64base() {
     let bases = svadd_u64_x(svptrue_b64(), bases, offsets);
     svsetffr();
     let loaded = svprfb_gather_u64base::<{ svprfop::SV_PLDL1KEEP }>(svptrue_b64(), bases);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh_gather_u64base() {
@@ -11095,6 +12635,7 @@ unsafe fn test_svprfh_gather_u64base() {
     let bases = svadd_u64_x(svptrue_b64(), bases, offsets);
     svsetffr();
     let loaded = svprfh_gather_u64base::<{ svprfop::SV_PLDL1KEEP }>(svptrue_b64(), bases);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw_gather_u64base() {
@@ -11103,6 +12644,7 @@ unsafe fn test_svprfw_gather_u64base() {
     let bases = svadd_u64_x(svptrue_b64(), bases, offsets);
     svsetffr();
     let loaded = svprfw_gather_u64base::<{ svprfop::SV_PLDL1KEEP }>(svptrue_b64(), bases);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd_gather_u64base() {
@@ -11111,6 +12653,7 @@ unsafe fn test_svprfd_gather_u64base() {
     let bases = svadd_u64_x(svptrue_b64(), bases, offsets);
     svsetffr();
     let loaded = svprfd_gather_u64base::<{ svprfop::SV_PLDL1KEEP }>(svptrue_b64(), bases);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb_gather_u32base_offset() {
@@ -11121,6 +12664,7 @@ unsafe fn test_svprfb_gather_u32base_offset() {
         bases,
         U32_DATA.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh_gather_u32base_index() {
@@ -11131,6 +12675,7 @@ unsafe fn test_svprfh_gather_u32base_index() {
         bases,
         U32_DATA.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw_gather_u32base_index() {
@@ -11141,6 +12686,7 @@ unsafe fn test_svprfw_gather_u32base_index() {
         bases,
         U32_DATA.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd_gather_u32base_index() {
@@ -11151,6 +12697,7 @@ unsafe fn test_svprfd_gather_u32base_index() {
         bases,
         U32_DATA.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb_gather_u64base_offset() {
@@ -11163,6 +12710,7 @@ unsafe fn test_svprfb_gather_u64base_offset() {
         bases,
         8u32.try_into().unwrap(),
     );
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh_gather_u64base_index() {
@@ -11175,6 +12723,7 @@ unsafe fn test_svprfh_gather_u64base_index() {
         bases,
         1.try_into().unwrap(),
     );
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw_gather_u64base_index() {
@@ -11187,6 +12736,7 @@ unsafe fn test_svprfw_gather_u64base_index() {
         bases,
         1.try_into().unwrap(),
     );
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd_gather_u64base_index() {
@@ -11199,37 +12749,46 @@ unsafe fn test_svprfd_gather_u64base_index() {
         bases,
         1.try_into().unwrap(),
     );
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfb_vnum() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfb_vnum::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b8(), I64_DATA.as_ptr(), 1);
+    let loaded = svprfb_vnum::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b8(), ptr, 1);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfh_vnum() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfh_vnum::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b16(), I64_DATA.as_ptr(), 1);
+    let loaded = svprfh_vnum::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b16(), ptr, 1);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfw_vnum() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfw_vnum::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), I64_DATA.as_ptr(), 1);
+    let loaded = svprfw_vnum::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b32(), ptr, 1);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_svprfd_vnum() {
+    let ptr = I64_DATA.as_ptr();
     svsetffr();
-    let loaded = svprfd_vnum::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), I64_DATA.as_ptr(), 1);
+    let loaded = svprfd_vnum::<{ svprfop::SV_PLDL1KEEP }, i64>(svptrue_b64(), ptr, 1);
+    let defined = svrdffr();
 }
 #[simd_test(enable = "sve")]
 unsafe fn test_ffr() {
     svsetffr();
     let ffr = svrdffr();
-    assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svindex_u8(1, 0));
+    assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svindex_u8(1, 0), ffr);
     let pred = svdupq_n_b8(
         true, false, true, false, true, false, true, false, true, false, true, false, true, false,
         true, false,
     );
     svwrffr(pred);
     let ffr = svrdffr_z(svptrue_b8());
-    assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svdup_n_u8_z(pred, 1));
+    assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svdup_n_u8_z(pred, 1), ffr);
 }
diff --git a/library/stdarch/crates/core_arch/src/aarch64/sve/mod.rs b/library/stdarch/crates/core_arch/src/aarch64/sve/mod.rs
index 04a9235..a3f70ab 100644
--- a/library/stdarch/crates/core_arch/src/aarch64/sve/mod.rs
+++ b/library/stdarch/crates/core_arch/src/aarch64/sve/mod.rs
@@ -374,9 +374,6 @@ pub enum svprfop {
     SV_PSTL3STRM = 13,
 }
 
-// FIXME(arm-maintainers): On MSVC targets, it seemed like spurious corruption of the FFR was being
-// observed non-deterministically on CI. Disabling these tests out of caution on that platform until
-// it is investigated.
-#[cfg(all(test, not(target_env = "msvc")))]
+#[cfg(test)]
 #[path = "ld_st_tests_aarch64.rs"]
 mod ld_st_tests;
diff --git a/library/stdarch/crates/core_arch/src/aarch64/sve2/ld_st_tests_aarch64.rs b/library/stdarch/crates/core_arch/src/aarch64/sve2/ld_st_tests_aarch64.rs
index 2ec3ad6..e71fd12 100644
--- a/library/stdarch/crates/core_arch/src/aarch64/sve2/ld_st_tests_aarch64.rs
+++ b/library/stdarch/crates/core_arch/src/aarch64/sve2/ld_st_tests_aarch64.rs
@@ -84,71 +84,61 @@
         .expect("u64 data incorrectly initialised")
 });
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_f32(vector: svfloat32_t, expected: svfloat32_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_f32(vector: svfloat32_t, expected: svfloat32_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_f32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_f64(vector: svfloat64_t, expected: svfloat64_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_f64(vector: svfloat64_t, expected: svfloat64_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_f64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i8(vector: svint8_t, expected: svint8_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_i8(vector: svint8_t, expected: svint8_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b8(), defined));
     let cmp = svcmpne_s8(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i16(vector: svint16_t, expected: svint16_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_i16(vector: svint16_t, expected: svint16_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b16(), defined));
     let cmp = svcmpne_s16(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i32(vector: svint32_t, expected: svint32_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_i32(vector: svint32_t, expected: svint32_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_s32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i64(vector: svint64_t, expected: svint64_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_i64(vector: svint64_t, expected: svint64_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_s64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u8(vector: svuint8_t, expected: svuint8_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_u8(vector: svuint8_t, expected: svuint8_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b8(), defined));
     let cmp = svcmpne_u8(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u16(vector: svuint16_t, expected: svuint16_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_u16(vector: svuint16_t, expected: svuint16_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b16(), defined));
     let cmp = svcmpne_u16(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u32(vector: svuint32_t, expected: svuint32_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_u32(vector: svuint32_t, expected: svuint32_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_u32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t) {
-    let defined = svrdffr();
+fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t, defined: svbool_t) {
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_u64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
@@ -168,12 +158,14 @@ unsafe fn test_svldnt1_gather_s64index_f64_with_svstnt1_scatter_s64index_f64() {
     svsetffr();
     let loaded =
         svldnt1_gather_s64index_f64(svptrue_b64(), storage.as_ptr() as *const f64, indices);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -188,9 +180,11 @@ unsafe fn test_svldnt1_gather_s64index_s64_with_svstnt1_scatter_s64index_s64() {
     svsetffr();
     let loaded =
         svldnt1_gather_s64index_s64(svptrue_b64(), storage.as_ptr() as *const i64, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -205,9 +199,11 @@ unsafe fn test_svldnt1_gather_s64index_u64_with_svstnt1_scatter_s64index_u64() {
     svsetffr();
     let loaded =
         svldnt1_gather_s64index_u64(svptrue_b64(), storage.as_ptr() as *const u64, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -225,12 +221,14 @@ unsafe fn test_svldnt1_gather_u64index_f64_with_svstnt1_scatter_u64index_f64() {
     svsetffr();
     let loaded =
         svldnt1_gather_u64index_f64(svptrue_b64(), storage.as_ptr() as *const f64, indices);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -245,9 +243,11 @@ unsafe fn test_svldnt1_gather_u64index_s64_with_svstnt1_scatter_u64index_s64() {
     svsetffr();
     let loaded =
         svldnt1_gather_u64index_s64(svptrue_b64(), storage.as_ptr() as *const i64, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -262,9 +262,11 @@ unsafe fn test_svldnt1_gather_u64index_u64_with_svstnt1_scatter_u64index_u64() {
     svsetffr();
     let loaded =
         svldnt1_gather_u64index_u64(svptrue_b64(), storage.as_ptr() as *const u64, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -282,12 +284,14 @@ unsafe fn test_svldnt1_gather_s64offset_f64_with_svstnt1_scatter_s64offset_f64()
     svsetffr();
     let loaded =
         svldnt1_gather_s64offset_f64(svptrue_b64(), storage.as_ptr() as *const f64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -302,9 +306,11 @@ unsafe fn test_svldnt1_gather_s64offset_s64_with_svstnt1_scatter_s64offset_s64()
     svsetffr();
     let loaded =
         svldnt1_gather_s64offset_s64(svptrue_b64(), storage.as_ptr() as *const i64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -319,9 +325,11 @@ unsafe fn test_svldnt1_gather_s64offset_u64_with_svstnt1_scatter_s64offset_u64()
     svsetffr();
     let loaded =
         svldnt1_gather_s64offset_u64(svptrue_b64(), storage.as_ptr() as *const u64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -339,12 +347,14 @@ unsafe fn test_svldnt1_gather_u32offset_f32_with_svstnt1_scatter_u32offset_f32()
     svsetffr();
     let loaded =
         svldnt1_gather_u32offset_f32(svptrue_b32(), storage.as_ptr() as *const f32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -359,9 +369,11 @@ unsafe fn test_svldnt1_gather_u32offset_s32_with_svstnt1_scatter_u32offset_s32()
     svsetffr();
     let loaded =
         svldnt1_gather_u32offset_s32(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -376,9 +388,11 @@ unsafe fn test_svldnt1_gather_u32offset_u32_with_svstnt1_scatter_u32offset_u32()
     svsetffr();
     let loaded =
         svldnt1_gather_u32offset_u32(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -396,12 +410,14 @@ unsafe fn test_svldnt1_gather_u64offset_f64_with_svstnt1_scatter_u64offset_f64()
     svsetffr();
     let loaded =
         svldnt1_gather_u64offset_f64(svptrue_b64(), storage.as_ptr() as *const f64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -416,9 +432,11 @@ unsafe fn test_svldnt1_gather_u64offset_s64_with_svstnt1_scatter_u64offset_s64()
     svsetffr();
     let loaded =
         svldnt1_gather_u64offset_s64(svptrue_b64(), storage.as_ptr() as *const i64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -433,9 +451,11 @@ unsafe fn test_svldnt1_gather_u64offset_u64_with_svstnt1_scatter_u64offset_u64()
     svsetffr();
     let loaded =
         svldnt1_gather_u64offset_u64(svptrue_b64(), storage.as_ptr() as *const u64, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -454,12 +474,14 @@ unsafe fn test_svldnt1_gather_u64base_f64_with_svstnt1_scatter_u64base_f64() {
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_f64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -475,9 +497,11 @@ unsafe fn test_svldnt1_gather_u64base_s64_with_svstnt1_scatter_u64base_s64() {
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_s64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -493,9 +517,11 @@ unsafe fn test_svldnt1_gather_u64base_u64_with_svstnt1_scatter_u64base_u64() {
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_u64(svptrue_b64(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -521,12 +547,14 @@ unsafe fn test_svldnt1_gather_u32base_index_f32_with_svstnt1_scatter_u32base_ind
         bases,
         storage.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -549,9 +577,11 @@ unsafe fn test_svldnt1_gather_u32base_index_s32_with_svstnt1_scatter_u32base_ind
         bases,
         storage.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -574,9 +604,11 @@ unsafe fn test_svldnt1_gather_u32base_index_u32_with_svstnt1_scatter_u32base_ind
         bases,
         storage.as_ptr() as i64 / (4u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -595,12 +627,14 @@ unsafe fn test_svldnt1_gather_u64base_index_f64_with_svstnt1_scatter_u64base_ind
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_index_f64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -616,9 +650,11 @@ unsafe fn test_svldnt1_gather_u64base_index_s64_with_svstnt1_scatter_u64base_ind
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_index_s64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -634,9 +670,11 @@ unsafe fn test_svldnt1_gather_u64base_index_u64_with_svstnt1_scatter_u64base_ind
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_index_u64(svptrue_b64(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -662,12 +700,14 @@ unsafe fn test_svldnt1_gather_u32base_offset_f32_with_svstnt1_scatter_u32base_of
         bases,
         storage.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_f32(
         loaded,
         svcvt_f32_s32_x(
             svptrue_b32(),
             svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -690,9 +730,11 @@ unsafe fn test_svldnt1_gather_u32base_offset_s32_with_svstnt1_scatter_u32base_of
         bases,
         storage.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -715,9 +757,11 @@ unsafe fn test_svldnt1_gather_u32base_offset_u32_with_svstnt1_scatter_u32base_of
         bases,
         storage.as_ptr() as i64 + 4u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -736,12 +780,14 @@ unsafe fn test_svldnt1_gather_u64base_offset_f64_with_svstnt1_scatter_u64base_of
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_offset_f64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_f64(
         loaded,
         svcvt_f64_s64_x(
             svptrue_b64(),
             svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
         ),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -757,9 +803,11 @@ unsafe fn test_svldnt1_gather_u64base_offset_s64_with_svstnt1_scatter_u64base_of
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_offset_s64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -775,9 +823,11 @@ unsafe fn test_svldnt1_gather_u64base_offset_u64_with_svstnt1_scatter_u64base_of
     }
     svsetffr();
     let loaded = svldnt1_gather_u64base_offset_u64(svptrue_b64(), bases, 8u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -792,9 +842,11 @@ unsafe fn test_svldnt1sb_gather_s64offset_s64_with_svstnt1b_scatter_s64offset_s6
     svsetffr();
     let loaded =
         svldnt1sb_gather_s64offset_s64(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -809,9 +861,11 @@ unsafe fn test_svldnt1sh_gather_s64offset_s64_with_svstnt1h_scatter_s64offset_s6
     svsetffr();
     let loaded =
         svldnt1sh_gather_s64offset_s64(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -826,9 +880,11 @@ unsafe fn test_svldnt1sw_gather_s64offset_s64_with_svstnt1w_scatter_s64offset_s6
     svsetffr();
     let loaded =
         svldnt1sw_gather_s64offset_s64(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -843,9 +899,11 @@ unsafe fn test_svldnt1sb_gather_s64offset_u64_with_svstnt1b_scatter_s64offset_u6
     svsetffr();
     let loaded =
         svldnt1sb_gather_s64offset_u64(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -860,9 +918,11 @@ unsafe fn test_svldnt1sh_gather_s64offset_u64_with_svstnt1h_scatter_s64offset_u6
     svsetffr();
     let loaded =
         svldnt1sh_gather_s64offset_u64(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -877,9 +937,11 @@ unsafe fn test_svldnt1sw_gather_s64offset_u64_with_svstnt1w_scatter_s64offset_u6
     svsetffr();
     let loaded =
         svldnt1sw_gather_s64offset_u64(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -894,9 +956,11 @@ unsafe fn test_svldnt1sb_gather_u32offset_s32_with_svstnt1b_scatter_u32offset_s3
     svsetffr();
     let loaded =
         svldnt1sb_gather_u32offset_s32(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -911,9 +975,11 @@ unsafe fn test_svldnt1sh_gather_u32offset_s32_with_svstnt1h_scatter_u32offset_s3
     svsetffr();
     let loaded =
         svldnt1sh_gather_u32offset_s32(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -928,9 +994,11 @@ unsafe fn test_svldnt1sb_gather_u32offset_u32_with_svstnt1b_scatter_u32offset_u3
     svsetffr();
     let loaded =
         svldnt1sb_gather_u32offset_u32(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -945,9 +1013,11 @@ unsafe fn test_svldnt1sh_gather_u32offset_u32_with_svstnt1h_scatter_u32offset_u3
     svsetffr();
     let loaded =
         svldnt1sh_gather_u32offset_u32(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -962,9 +1032,11 @@ unsafe fn test_svldnt1sb_gather_u64offset_s64_with_svstnt1b_scatter_u64offset_s6
     svsetffr();
     let loaded =
         svldnt1sb_gather_u64offset_s64(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -979,9 +1051,11 @@ unsafe fn test_svldnt1sh_gather_u64offset_s64_with_svstnt1h_scatter_u64offset_s6
     svsetffr();
     let loaded =
         svldnt1sh_gather_u64offset_s64(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -996,9 +1070,11 @@ unsafe fn test_svldnt1sw_gather_u64offset_s64_with_svstnt1w_scatter_u64offset_s6
     svsetffr();
     let loaded =
         svldnt1sw_gather_u64offset_s64(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1013,9 +1089,11 @@ unsafe fn test_svldnt1sb_gather_u64offset_u64_with_svstnt1b_scatter_u64offset_u6
     svsetffr();
     let loaded =
         svldnt1sb_gather_u64offset_u64(svptrue_b8(), storage.as_ptr() as *const i8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1030,9 +1108,11 @@ unsafe fn test_svldnt1sh_gather_u64offset_u64_with_svstnt1h_scatter_u64offset_u6
     svsetffr();
     let loaded =
         svldnt1sh_gather_u64offset_u64(svptrue_b16(), storage.as_ptr() as *const i16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1047,9 +1127,11 @@ unsafe fn test_svldnt1sw_gather_u64offset_u64_with_svstnt1w_scatter_u64offset_u6
     svsetffr();
     let loaded =
         svldnt1sw_gather_u64offset_u64(svptrue_b32(), storage.as_ptr() as *const i32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1072,9 +1154,11 @@ unsafe fn test_svldnt1sb_gather_u32base_offset_s32_with_svstnt1b_scatter_u32base
         bases,
         storage.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1097,9 +1181,11 @@ unsafe fn test_svldnt1sh_gather_u32base_offset_s32_with_svstnt1h_scatter_u32base
         bases,
         storage.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1122,9 +1208,11 @@ unsafe fn test_svldnt1sb_gather_u32base_offset_u32_with_svstnt1b_scatter_u32base
         bases,
         storage.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1147,9 +1235,11 @@ unsafe fn test_svldnt1sh_gather_u32base_offset_u32_with_svstnt1h_scatter_u32base
         bases,
         storage.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1165,9 +1255,11 @@ unsafe fn test_svldnt1sb_gather_u64base_offset_s64_with_svstnt1b_scatter_u64base
     }
     svsetffr();
     let loaded = svldnt1sb_gather_u64base_offset_s64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1184,9 +1276,11 @@ unsafe fn test_svldnt1sh_gather_u64base_offset_s64_with_svstnt1h_scatter_u64base
     svsetffr();
     let loaded =
         svldnt1sh_gather_u64base_offset_s64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1203,9 +1297,11 @@ unsafe fn test_svldnt1sw_gather_u64base_offset_s64_with_svstnt1w_scatter_u64base
     svsetffr();
     let loaded =
         svldnt1sw_gather_u64base_offset_s64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1221,9 +1317,11 @@ unsafe fn test_svldnt1sb_gather_u64base_offset_u64_with_svstnt1b_scatter_u64base
     }
     svsetffr();
     let loaded = svldnt1sb_gather_u64base_offset_u64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1240,9 +1338,11 @@ unsafe fn test_svldnt1sh_gather_u64base_offset_u64_with_svstnt1h_scatter_u64base
     svsetffr();
     let loaded =
         svldnt1sh_gather_u64base_offset_u64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1259,9 +1359,11 @@ unsafe fn test_svldnt1sw_gather_u64base_offset_u64_with_svstnt1w_scatter_u64base
     svsetffr();
     let loaded =
         svldnt1sw_gather_u64base_offset_u64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1277,9 +1379,11 @@ unsafe fn test_svldnt1sb_gather_u64base_s64_with_svstnt1b_scatter_u64base_s64()
     }
     svsetffr();
     let loaded = svldnt1sb_gather_u64base_s64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1295,9 +1399,11 @@ unsafe fn test_svldnt1sh_gather_u64base_s64_with_svstnt1h_scatter_u64base_s64()
     }
     svsetffr();
     let loaded = svldnt1sh_gather_u64base_s64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1313,9 +1419,11 @@ unsafe fn test_svldnt1sw_gather_u64base_s64_with_svstnt1w_scatter_u64base_s64()
     }
     svsetffr();
     let loaded = svldnt1sw_gather_u64base_s64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1331,9 +1439,11 @@ unsafe fn test_svldnt1sb_gather_u64base_u64_with_svstnt1b_scatter_u64base_u64()
     }
     svsetffr();
     let loaded = svldnt1sb_gather_u64base_u64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1349,9 +1459,11 @@ unsafe fn test_svldnt1sh_gather_u64base_u64_with_svstnt1h_scatter_u64base_u64()
     }
     svsetffr();
     let loaded = svldnt1sh_gather_u64base_u64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1367,9 +1479,11 @@ unsafe fn test_svldnt1sw_gather_u64base_u64_with_svstnt1w_scatter_u64base_u64()
     }
     svsetffr();
     let loaded = svldnt1sw_gather_u64base_u64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1384,9 +1498,11 @@ unsafe fn test_svldnt1sh_gather_s64index_s64_with_svstnt1h_scatter_s64index_s64(
     svsetffr();
     let loaded =
         svldnt1sh_gather_s64index_s64(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1401,9 +1517,11 @@ unsafe fn test_svldnt1sw_gather_s64index_s64_with_svstnt1w_scatter_s64index_s64(
     svsetffr();
     let loaded =
         svldnt1sw_gather_s64index_s64(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1418,9 +1536,11 @@ unsafe fn test_svldnt1sh_gather_s64index_u64_with_svstnt1h_scatter_s64index_u64(
     svsetffr();
     let loaded =
         svldnt1sh_gather_s64index_u64(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1435,9 +1555,11 @@ unsafe fn test_svldnt1sw_gather_s64index_u64_with_svstnt1w_scatter_s64index_u64(
     svsetffr();
     let loaded =
         svldnt1sw_gather_s64index_u64(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1452,9 +1574,11 @@ unsafe fn test_svldnt1sh_gather_u64index_s64_with_svstnt1h_scatter_u64index_s64(
     svsetffr();
     let loaded =
         svldnt1sh_gather_u64index_s64(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1469,9 +1593,11 @@ unsafe fn test_svldnt1sw_gather_u64index_s64_with_svstnt1w_scatter_u64index_s64(
     svsetffr();
     let loaded =
         svldnt1sw_gather_u64index_s64(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1486,9 +1612,11 @@ unsafe fn test_svldnt1sh_gather_u64index_u64_with_svstnt1h_scatter_u64index_u64(
     svsetffr();
     let loaded =
         svldnt1sh_gather_u64index_u64(svptrue_b16(), storage.as_ptr() as *const i16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1503,9 +1631,11 @@ unsafe fn test_svldnt1sw_gather_u64index_u64_with_svstnt1w_scatter_u64index_u64(
     svsetffr();
     let loaded =
         svldnt1sw_gather_u64index_u64(svptrue_b32(), storage.as_ptr() as *const i32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1528,9 +1658,11 @@ unsafe fn test_svldnt1sh_gather_u32base_index_s32_with_svstnt1h_scatter_u32base_
         bases,
         storage.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1553,9 +1685,11 @@ unsafe fn test_svldnt1sh_gather_u32base_index_u32_with_svstnt1h_scatter_u32base_
         bases,
         storage.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1571,9 +1705,11 @@ unsafe fn test_svldnt1sh_gather_u64base_index_s64_with_svstnt1h_scatter_u64base_
     }
     svsetffr();
     let loaded = svldnt1sh_gather_u64base_index_s64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1589,9 +1725,11 @@ unsafe fn test_svldnt1sw_gather_u64base_index_s64_with_svstnt1w_scatter_u64base_
     }
     svsetffr();
     let loaded = svldnt1sw_gather_u64base_index_s64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1607,9 +1745,11 @@ unsafe fn test_svldnt1sh_gather_u64base_index_u64_with_svstnt1h_scatter_u64base_
     }
     svsetffr();
     let loaded = svldnt1sh_gather_u64base_index_u64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1625,9 +1765,11 @@ unsafe fn test_svldnt1sw_gather_u64base_index_u64_with_svstnt1w_scatter_u64base_
     }
     svsetffr();
     let loaded = svldnt1sw_gather_u64base_index_u64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1642,9 +1784,11 @@ unsafe fn test_svldnt1ub_gather_s64offset_s64_with_svstnt1b_scatter_s64offset_s6
     svsetffr();
     let loaded =
         svldnt1ub_gather_s64offset_s64(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1659,9 +1803,11 @@ unsafe fn test_svldnt1uh_gather_s64offset_s64_with_svstnt1h_scatter_s64offset_s6
     svsetffr();
     let loaded =
         svldnt1uh_gather_s64offset_s64(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1676,9 +1822,11 @@ unsafe fn test_svldnt1uw_gather_s64offset_s64_with_svstnt1w_scatter_s64offset_s6
     svsetffr();
     let loaded =
         svldnt1uw_gather_s64offset_s64(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1693,9 +1841,11 @@ unsafe fn test_svldnt1ub_gather_s64offset_u64_with_svstnt1b_scatter_s64offset_u6
     svsetffr();
     let loaded =
         svldnt1ub_gather_s64offset_u64(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1710,9 +1860,11 @@ unsafe fn test_svldnt1uh_gather_s64offset_u64_with_svstnt1h_scatter_s64offset_u6
     svsetffr();
     let loaded =
         svldnt1uh_gather_s64offset_u64(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1727,9 +1879,11 @@ unsafe fn test_svldnt1uw_gather_s64offset_u64_with_svstnt1w_scatter_s64offset_u6
     svsetffr();
     let loaded =
         svldnt1uw_gather_s64offset_u64(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1744,9 +1898,11 @@ unsafe fn test_svldnt1ub_gather_u32offset_s32_with_svstnt1b_scatter_u32offset_s3
     svsetffr();
     let loaded =
         svldnt1ub_gather_u32offset_s32(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1761,9 +1917,11 @@ unsafe fn test_svldnt1uh_gather_u32offset_s32_with_svstnt1h_scatter_u32offset_s3
     svsetffr();
     let loaded =
         svldnt1uh_gather_u32offset_s32(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1778,9 +1936,11 @@ unsafe fn test_svldnt1ub_gather_u32offset_u32_with_svstnt1b_scatter_u32offset_u3
     svsetffr();
     let loaded =
         svldnt1ub_gather_u32offset_u32(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1795,9 +1955,11 @@ unsafe fn test_svldnt1uh_gather_u32offset_u32_with_svstnt1h_scatter_u32offset_u3
     svsetffr();
     let loaded =
         svldnt1uh_gather_u32offset_u32(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1812,9 +1974,11 @@ unsafe fn test_svldnt1ub_gather_u64offset_s64_with_svstnt1b_scatter_u64offset_s6
     svsetffr();
     let loaded =
         svldnt1ub_gather_u64offset_s64(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1829,9 +1993,11 @@ unsafe fn test_svldnt1uh_gather_u64offset_s64_with_svstnt1h_scatter_u64offset_s6
     svsetffr();
     let loaded =
         svldnt1uh_gather_u64offset_s64(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1846,9 +2012,11 @@ unsafe fn test_svldnt1uw_gather_u64offset_s64_with_svstnt1w_scatter_u64offset_s6
     svsetffr();
     let loaded =
         svldnt1uw_gather_u64offset_s64(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1863,9 +2031,11 @@ unsafe fn test_svldnt1ub_gather_u64offset_u64_with_svstnt1b_scatter_u64offset_u6
     svsetffr();
     let loaded =
         svldnt1ub_gather_u64offset_u64(svptrue_b8(), storage.as_ptr() as *const u8, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1880,9 +2050,11 @@ unsafe fn test_svldnt1uh_gather_u64offset_u64_with_svstnt1h_scatter_u64offset_u6
     svsetffr();
     let loaded =
         svldnt1uh_gather_u64offset_u64(svptrue_b16(), storage.as_ptr() as *const u16, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1897,9 +2069,11 @@ unsafe fn test_svldnt1uw_gather_u64offset_u64_with_svstnt1w_scatter_u64offset_u6
     svsetffr();
     let loaded =
         svldnt1uw_gather_u64offset_u64(svptrue_b32(), storage.as_ptr() as *const u32, offsets);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1922,9 +2096,11 @@ unsafe fn test_svldnt1ub_gather_u32base_offset_s32_with_svstnt1b_scatter_u32base
         bases,
         storage.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1947,9 +2123,11 @@ unsafe fn test_svldnt1uh_gather_u32base_offset_s32_with_svstnt1h_scatter_u32base
         bases,
         storage.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1972,9 +2150,11 @@ unsafe fn test_svldnt1ub_gather_u32base_offset_u32_with_svstnt1b_scatter_u32base
         bases,
         storage.as_ptr() as i64 + 1u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -1997,9 +2177,11 @@ unsafe fn test_svldnt1uh_gather_u32base_offset_u32_with_svstnt1h_scatter_u32base
         bases,
         storage.as_ptr() as i64 + 2u32 as i64,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2015,9 +2197,11 @@ unsafe fn test_svldnt1ub_gather_u64base_offset_s64_with_svstnt1b_scatter_u64base
     }
     svsetffr();
     let loaded = svldnt1ub_gather_u64base_offset_s64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2034,9 +2218,11 @@ unsafe fn test_svldnt1uh_gather_u64base_offset_s64_with_svstnt1h_scatter_u64base
     svsetffr();
     let loaded =
         svldnt1uh_gather_u64base_offset_s64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2053,9 +2239,11 @@ unsafe fn test_svldnt1uw_gather_u64base_offset_s64_with_svstnt1w_scatter_u64base
     svsetffr();
     let loaded =
         svldnt1uw_gather_u64base_offset_s64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2071,9 +2259,11 @@ unsafe fn test_svldnt1ub_gather_u64base_offset_u64_with_svstnt1b_scatter_u64base
     }
     svsetffr();
     let loaded = svldnt1ub_gather_u64base_offset_u64(svptrue_b8(), bases, 1u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2090,9 +2280,11 @@ unsafe fn test_svldnt1uh_gather_u64base_offset_u64_with_svstnt1h_scatter_u64base
     svsetffr();
     let loaded =
         svldnt1uh_gather_u64base_offset_u64(svptrue_b16(), bases, 2u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2109,9 +2301,11 @@ unsafe fn test_svldnt1uw_gather_u64base_offset_u64_with_svstnt1w_scatter_u64base
     svsetffr();
     let loaded =
         svldnt1uw_gather_u64base_offset_u64(svptrue_b32(), bases, 4u32.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2127,9 +2321,11 @@ unsafe fn test_svldnt1ub_gather_u64base_s64_with_svstnt1b_scatter_u64base_s64()
     }
     svsetffr();
     let loaded = svldnt1ub_gather_u64base_s64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2145,9 +2341,11 @@ unsafe fn test_svldnt1uh_gather_u64base_s64_with_svstnt1h_scatter_u64base_s64()
     }
     svsetffr();
     let loaded = svldnt1uh_gather_u64base_s64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2163,9 +2361,11 @@ unsafe fn test_svldnt1uw_gather_u64base_s64_with_svstnt1w_scatter_u64base_s64()
     }
     svsetffr();
     let loaded = svldnt1uw_gather_u64base_s64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2181,9 +2381,11 @@ unsafe fn test_svldnt1ub_gather_u64base_u64_with_svstnt1b_scatter_u64base_u64()
     }
     svsetffr();
     let loaded = svldnt1ub_gather_u64base_u64(svptrue_b8(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2199,9 +2401,11 @@ unsafe fn test_svldnt1uh_gather_u64base_u64_with_svstnt1h_scatter_u64base_u64()
     }
     svsetffr();
     let loaded = svldnt1uh_gather_u64base_u64(svptrue_b16(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2217,9 +2421,11 @@ unsafe fn test_svldnt1uw_gather_u64base_u64_with_svstnt1w_scatter_u64base_u64()
     }
     svsetffr();
     let loaded = svldnt1uw_gather_u64base_u64(svptrue_b32(), bases);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2234,9 +2440,11 @@ unsafe fn test_svldnt1uh_gather_s64index_s64_with_svstnt1h_scatter_s64index_s64(
     svsetffr();
     let loaded =
         svldnt1uh_gather_s64index_s64(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2251,9 +2459,11 @@ unsafe fn test_svldnt1uw_gather_s64index_s64_with_svstnt1w_scatter_s64index_s64(
     svsetffr();
     let loaded =
         svldnt1uw_gather_s64index_s64(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2268,9 +2478,11 @@ unsafe fn test_svldnt1uh_gather_s64index_u64_with_svstnt1h_scatter_s64index_u64(
     svsetffr();
     let loaded =
         svldnt1uh_gather_s64index_u64(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2285,9 +2497,11 @@ unsafe fn test_svldnt1uw_gather_s64index_u64_with_svstnt1w_scatter_s64index_u64(
     svsetffr();
     let loaded =
         svldnt1uw_gather_s64index_u64(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2302,9 +2516,11 @@ unsafe fn test_svldnt1uh_gather_u64index_s64_with_svstnt1h_scatter_u64index_s64(
     svsetffr();
     let loaded =
         svldnt1uh_gather_u64index_s64(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2319,9 +2535,11 @@ unsafe fn test_svldnt1uw_gather_u64index_s64_with_svstnt1w_scatter_u64index_s64(
     svsetffr();
     let loaded =
         svldnt1uw_gather_u64index_s64(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2336,9 +2554,11 @@ unsafe fn test_svldnt1uh_gather_u64index_u64_with_svstnt1h_scatter_u64index_u64(
     svsetffr();
     let loaded =
         svldnt1uh_gather_u64index_u64(svptrue_b16(), storage.as_ptr() as *const u16, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2353,9 +2573,11 @@ unsafe fn test_svldnt1uw_gather_u64index_u64_with_svstnt1w_scatter_u64index_u64(
     svsetffr();
     let loaded =
         svldnt1uw_gather_u64index_u64(svptrue_b32(), storage.as_ptr() as *const u32, indices);
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((0usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2378,9 +2600,11 @@ unsafe fn test_svldnt1uh_gather_u32base_index_s32_with_svstnt1h_scatter_u32base_
         bases,
         storage.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_i32(
         loaded,
         svindex_s32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2403,9 +2627,11 @@ unsafe fn test_svldnt1uh_gather_u32base_index_u32_with_svstnt1h_scatter_u32base_
         bases,
         storage.as_ptr() as i64 / (2u32 as i64) + 1,
     );
+    let defined = svrdffr();
     assert_vector_matches_u32(
         loaded,
         svindex_u32((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2421,9 +2647,11 @@ unsafe fn test_svldnt1uh_gather_u64base_index_s64_with_svstnt1h_scatter_u64base_
     }
     svsetffr();
     let loaded = svldnt1uh_gather_u64base_index_s64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2439,9 +2667,11 @@ unsafe fn test_svldnt1uw_gather_u64base_index_s64_with_svstnt1w_scatter_u64base_
     }
     svsetffr();
     let loaded = svldnt1uw_gather_u64base_index_s64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_i64(
         loaded,
         svindex_s64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2457,9 +2687,11 @@ unsafe fn test_svldnt1uh_gather_u64base_index_u64_with_svstnt1h_scatter_u64base_
     }
     svsetffr();
     let loaded = svldnt1uh_gather_u64base_index_u64(svptrue_b16(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
 #[simd_test(enable = "sve,sve2")]
@@ -2475,8 +2707,10 @@ unsafe fn test_svldnt1uw_gather_u64base_index_u64_with_svstnt1w_scatter_u64base_
     }
     svsetffr();
     let loaded = svldnt1uw_gather_u64base_index_u64(svptrue_b32(), bases, 1.try_into().unwrap());
+    let defined = svrdffr();
     assert_vector_matches_u64(
         loaded,
         svindex_u64((1usize).try_into().unwrap(), 1usize.try_into().unwrap()),
+        defined,
     );
 }
diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs
index 5284a3c..7c0c798 100644
--- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs
+++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs
@@ -9597,7 +9597,7 @@ pub fn vcvtq_u32_f32(a: float32x4_t) -> uint32x4_t {
 #[rustc_legacy_const_generics(3)]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9622,7 +9622,7 @@ pub fn vdot_lane_s32<const LANE: i32>(a: int32x2_t, b: int8x8_t, c: int8x8_t) ->
 #[rustc_legacy_const_generics(3)]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9647,7 +9647,7 @@ pub fn vdotq_lane_s32<const LANE: i32>(a: int32x4_t, b: int8x16_t, c: int8x8_t)
 #[rustc_legacy_const_generics(3)]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9672,7 +9672,7 @@ pub fn vdot_lane_u32<const LANE: i32>(a: uint32x2_t, b: uint8x8_t, c: uint8x8_t)
 #[rustc_legacy_const_generics(3)]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9695,7 +9695,14 @@ pub fn vdotq_lane_u32<const LANE: i32>(a: uint32x4_t, b: uint8x16_t, c: uint8x8_
     assert_instr(sdot, LANE = 0)
 )]
 #[rustc_legacy_const_generics(3)]
-#[unstable(feature = "stdarch_neon_dotprod", issue = "117224")]
+#[cfg_attr(
+    not(target_arch = "arm"),
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
+)]
+#[cfg_attr(
+    target_arch = "arm",
+    unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
+)]
 pub fn vdot_laneq_s32<const LANE: i32>(a: int32x2_t, b: int8x8_t, c: int8x16_t) -> int32x2_t {
     static_assert_uimm_bits!(LANE, 2);
     let c = vreinterpretq_s32_s8(c);
@@ -9713,7 +9720,14 @@ pub fn vdot_laneq_s32<const LANE: i32>(a: int32x2_t, b: int8x8_t, c: int8x16_t)
     assert_instr(sdot, LANE = 0)
 )]
 #[rustc_legacy_const_generics(3)]
-#[unstable(feature = "stdarch_neon_dotprod", issue = "117224")]
+#[cfg_attr(
+    not(target_arch = "arm"),
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
+)]
+#[cfg_attr(
+    target_arch = "arm",
+    unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
+)]
 pub fn vdotq_laneq_s32<const LANE: i32>(a: int32x4_t, b: int8x16_t, c: int8x16_t) -> int32x4_t {
     static_assert_uimm_bits!(LANE, 2);
     let c = vreinterpretq_s32_s8(c);
@@ -9731,7 +9745,14 @@ pub fn vdotq_laneq_s32<const LANE: i32>(a: int32x4_t, b: int8x16_t, c: int8x16_t
     assert_instr(udot, LANE = 0)
 )]
 #[rustc_legacy_const_generics(3)]
-#[unstable(feature = "stdarch_neon_dotprod", issue = "117224")]
+#[cfg_attr(
+    not(target_arch = "arm"),
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
+)]
+#[cfg_attr(
+    target_arch = "arm",
+    unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
+)]
 pub fn vdot_laneq_u32<const LANE: i32>(a: uint32x2_t, b: uint8x8_t, c: uint8x16_t) -> uint32x2_t {
     static_assert_uimm_bits!(LANE, 2);
     let c = vreinterpretq_u32_u8(c);
@@ -9749,7 +9770,14 @@ pub fn vdot_laneq_u32<const LANE: i32>(a: uint32x2_t, b: uint8x8_t, c: uint8x16_
     assert_instr(udot, LANE = 0)
 )]
 #[rustc_legacy_const_generics(3)]
-#[unstable(feature = "stdarch_neon_dotprod", issue = "117224")]
+#[cfg_attr(
+    not(target_arch = "arm"),
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
+)]
+#[cfg_attr(
+    target_arch = "arm",
+    unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800")
+)]
 pub fn vdotq_laneq_u32<const LANE: i32>(a: uint32x4_t, b: uint8x16_t, c: uint8x16_t) -> uint32x4_t {
     static_assert_uimm_bits!(LANE, 2);
     let c = vreinterpretq_u32_u8(c);
@@ -9769,7 +9797,7 @@ pub fn vdotq_laneq_u32<const LANE: i32>(a: uint32x4_t, b: uint8x16_t, c: uint8x1
 )]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9799,7 +9827,7 @@ pub fn vdot_s32(a: int32x2_t, b: int8x8_t, c: int8x8_t) -> int32x2_t {
 )]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9835,7 +9863,7 @@ pub fn vdot_s32(a: int32x2_t, b: int8x8_t, c: int8x8_t) -> int32x2_t {
 )]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9865,7 +9893,7 @@ pub fn vdotq_s32(a: int32x4_t, b: int8x16_t, c: int8x16_t) -> int32x4_t {
 )]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9903,7 +9931,7 @@ pub fn vdotq_s32(a: int32x4_t, b: int8x16_t, c: int8x16_t) -> int32x4_t {
 )]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9933,7 +9961,7 @@ pub fn vdot_u32(a: uint32x2_t, b: uint8x8_t, c: uint8x8_t) -> uint32x2_t {
 )]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9969,7 +9997,7 @@ pub fn vdot_u32(a: uint32x2_t, b: uint8x8_t, c: uint8x8_t) -> uint32x2_t {
 )]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
@@ -9999,7 +10027,7 @@ pub fn vdotq_u32(a: uint32x4_t, b: uint8x16_t, c: uint8x16_t) -> uint32x4_t {
 )]
 #[cfg_attr(
     not(target_arch = "arm"),
-    unstable(feature = "stdarch_neon_dotprod", issue = "117224")
+    stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")
 )]
 #[cfg_attr(
     target_arch = "arm",
diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs
index 4cc7f64..3af59b1 100644
--- a/library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs
+++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs
@@ -5326,6 +5326,23 @@ unsafe fn $name() {
         test_vld3q_lane_f16(f16, 24, 7, float16x8x3_t, vst3q_lane_f16, vld3q_lane_f16);
         test_vld4q_lane_f16(f16, 32, 7, float16x8x4_t, vst4q_lane_f16, vld4q_lane_f16);
     }
+
+    // FIXME: simd_test (which uses is_arm_feature_detected) does not support the v8
+    // feature that we need on arm.
+    #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))]
+    #[simd_test(enable = "crc")]
+    fn crc32() {
+        assert_eq!(__crc32b(u32::MAX, u8::MAX), 16777215);
+        assert_eq!(__crc32h(u32::MAX, u16::MAX), 65535);
+        assert_eq!(__crc32w(u32::MAX, u32::MAX), 0);
+
+        assert_eq!(__crc32cb(u32::MAX, u8::MAX), 16777215);
+        assert_eq!(__crc32ch(u32::MAX, u16::MAX), 65535);
+        assert_eq!(__crc32cw(u32::MAX, u32::MAX), 0);
+
+        assert_eq!(__crc32d(u32::MAX, u64::MAX), 3736805603);
+        assert_eq!(__crc32cd(u32::MAX, u64::MAX), 3080238136);
+    }
 }
 
 #[cfg(all(test, target_arch = "arm"))]
diff --git a/library/stdarch/crates/core_arch/src/lib.rs b/library/stdarch/crates/core_arch/src/lib.rs
index b9d63b4..0991ec1 100644
--- a/library/stdarch/crates/core_arch/src/lib.rs
+++ b/library/stdarch/crates/core_arch/src/lib.rs
@@ -40,6 +40,7 @@
     const_eval_select,
     maybe_uninit_as_bytes,
     movrs_target_feature,
+    clflushopt_target_feature,
     min_adt_const_params
 )]
 #![cfg_attr(test, feature(test, abi_vectorcall, stdarch_internal))]
diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs b/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs
index ec7693e..6a6a3ae 100644
--- a/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs
+++ b/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs
@@ -147,22 +147,6 @@
     fn __lasx_xvhsubw_wu_hu(a: __v16u16, b: __v16u16) -> __v8i32;
     #[link_name = "llvm.loongarch.lasx.xvhsubw.du.wu"]
     fn __lasx_xvhsubw_du_wu(a: __v8u32, b: __v8u32) -> __v4i64;
-    #[link_name = "llvm.loongarch.lasx.xvpackev.b"]
-    fn __lasx_xvpackev_b(a: __v32i8, b: __v32i8) -> __v32i8;
-    #[link_name = "llvm.loongarch.lasx.xvpackev.h"]
-    fn __lasx_xvpackev_h(a: __v16i16, b: __v16i16) -> __v16i16;
-    #[link_name = "llvm.loongarch.lasx.xvpackev.w"]
-    fn __lasx_xvpackev_w(a: __v8i32, b: __v8i32) -> __v8i32;
-    #[link_name = "llvm.loongarch.lasx.xvpackev.d"]
-    fn __lasx_xvpackev_d(a: __v4i64, b: __v4i64) -> __v4i64;
-    #[link_name = "llvm.loongarch.lasx.xvpackod.b"]
-    fn __lasx_xvpackod_b(a: __v32i8, b: __v32i8) -> __v32i8;
-    #[link_name = "llvm.loongarch.lasx.xvpackod.h"]
-    fn __lasx_xvpackod_h(a: __v16i16, b: __v16i16) -> __v16i16;
-    #[link_name = "llvm.loongarch.lasx.xvpackod.w"]
-    fn __lasx_xvpackod_w(a: __v8i32, b: __v8i32) -> __v8i32;
-    #[link_name = "llvm.loongarch.lasx.xvpackod.d"]
-    fn __lasx_xvpackod_d(a: __v4i64, b: __v4i64) -> __v4i64;
     #[link_name = "llvm.loongarch.lasx.xvshuf.b"]
     fn __lasx_xvshuf_b(a: __v32i8, b: __v32i8, c: __v32i8) -> __v32i8;
     #[link_name = "llvm.loongarch.lasx.xvshuf.h"]
@@ -183,12 +167,6 @@
     fn __lasx_xvbitsel_v(a: __v32u8, b: __v32u8, c: __v32u8) -> __v32u8;
     #[link_name = "llvm.loongarch.lasx.xvbitseli.b"]
     fn __lasx_xvbitseli_b(a: __v32u8, b: __v32u8, c: u32) -> __v32u8;
-    #[link_name = "llvm.loongarch.lasx.xvshuf4i.b"]
-    fn __lasx_xvshuf4i_b(a: __v32i8, b: u32) -> __v32i8;
-    #[link_name = "llvm.loongarch.lasx.xvshuf4i.h"]
-    fn __lasx_xvshuf4i_h(a: __v16i16, b: u32) -> __v16i16;
-    #[link_name = "llvm.loongarch.lasx.xvshuf4i.w"]
-    fn __lasx_xvshuf4i_w(a: __v8i32, b: u32) -> __v8i32;
     #[link_name = "llvm.loongarch.lasx.xvclo.b"]
     fn __lasx_xvclo_b(a: __v32i8) -> __v32i8;
     #[link_name = "llvm.loongarch.lasx.xvclo.h"]
@@ -1570,62 +1548,6 @@ pub fn lasx_xvhsubw_du_wu(a: m256i, b: m256i) -> m256i {
 #[inline]
 #[target_feature(enable = "lasx")]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvpackev_b(a: m256i, b: m256i) -> m256i {
-    unsafe { transmute(__lasx_xvpackev_b(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvpackev_h(a: m256i, b: m256i) -> m256i {
-    unsafe { transmute(__lasx_xvpackev_h(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvpackev_w(a: m256i, b: m256i) -> m256i {
-    unsafe { transmute(__lasx_xvpackev_w(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvpackev_d(a: m256i, b: m256i) -> m256i {
-    unsafe { transmute(__lasx_xvpackev_d(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvpackod_b(a: m256i, b: m256i) -> m256i {
-    unsafe { transmute(__lasx_xvpackod_b(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvpackod_h(a: m256i, b: m256i) -> m256i {
-    unsafe { transmute(__lasx_xvpackod_h(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvpackod_w(a: m256i, b: m256i) -> m256i {
-    unsafe { transmute(__lasx_xvpackod_w(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvpackod_d(a: m256i, b: m256i) -> m256i {
-    unsafe { transmute(__lasx_xvpackod_d(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn lasx_xvshuf_b(a: m256i, b: m256i, c: m256i) -> m256i {
     unsafe { transmute(__lasx_xvshuf_b(transmute(a), transmute(b), transmute(c))) }
 }
@@ -1705,33 +1627,6 @@ pub fn lasx_xvbitseli_b<const IMM8: u32>(a: m256i, b: m256i) -> m256i {
 
 #[inline]
 #[target_feature(enable = "lasx")]
-#[rustc_legacy_const_generics(1)]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvshuf4i_b<const IMM8: u32>(a: m256i) -> m256i {
-    static_assert_uimm_bits!(IMM8, 8);
-    unsafe { transmute(__lasx_xvshuf4i_b(transmute(a), IMM8)) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[rustc_legacy_const_generics(1)]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvshuf4i_h<const IMM8: u32>(a: m256i) -> m256i {
-    static_assert_uimm_bits!(IMM8, 8);
-    unsafe { transmute(__lasx_xvshuf4i_h(transmute(a), IMM8)) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
-#[rustc_legacy_const_generics(1)]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lasx_xvshuf4i_w<const IMM8: u32>(a: m256i) -> m256i {
-    static_assert_uimm_bits!(IMM8, 8);
-    unsafe { transmute(__lasx_xvshuf4i_w(transmute(a), IMM8)) }
-}
-
-#[inline]
-#[target_feature(enable = "lasx")]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn lasx_xvclo_b(a: m256i) -> m256i {
     unsafe { transmute(__lasx_xvclo_b(transmute(a))) }
diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs b/library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs
index aa4144c..4dfe807 100644
--- a/library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs
+++ b/library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs
@@ -69,7 +69,7 @@
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(
         b,
         a,
@@ -82,25 +82,25 @@
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvh_h<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvh_h<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [4, 20, 5, 21, 6, 22, 7, 23, 12, 28, 13, 29, 14, 30, 15, 31])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvh_w<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvh_w<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [2, 10, 3, 11, 6, 14, 7, 15])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvh_d<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvh_d<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [1, 5, 3, 7])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(
         b,
         a,
@@ -113,25 +113,25 @@
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvl_h<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvl_h<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [0, 16, 1, 17, 2, 18, 3, 19, 8, 24, 9, 25, 10, 26, 11, 27])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvl_w<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvl_w<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [0, 8, 1, 9, 4, 12, 5, 13])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvl_d<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvl_d<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [0, 4, 2, 6])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
+const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
     simd_shuffle!(
         a,
         a,
@@ -145,7 +145,7 @@
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
+const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
     simd_shuffle!(
         a,
         a,
@@ -158,19 +158,19 @@
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_replvei_w<const I: u32, T: Copy>(a: T) -> T {
+const unsafe fn simd_replvei_w<const I: u32, T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [I, I, I, I, I + 4, I + 4, I + 4, I + 4])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_replvei_d<const I: u32, T: Copy>(a: T) -> T {
+const unsafe fn simd_replvei_d<const I: u32, T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [I, I, I + 2, I + 2])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(super) const unsafe fn simd_replve0_b<T: Copy>(a: T) -> T {
+const unsafe fn simd_replve0_b<T: Copy>(a: T) -> T {
     simd_shuffle!(
         a,
         a,
@@ -183,28 +183,137 @@
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(super) const unsafe fn simd_replve0_h<T: Copy>(a: T) -> T {
+const unsafe fn simd_replve0_h<T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(super) const unsafe fn simd_replve0_w<T: Copy>(a: T) -> T {
+const unsafe fn simd_replve0_w<T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [0, 0, 0, 0, 0, 0, 0, 0])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(super) const unsafe fn simd_replve0_d<T: Copy>(a: T) -> T {
+const unsafe fn simd_replve0_d<T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [0, 0, 0, 0])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(super) const unsafe fn simd_replve0_q<T: Copy>(a: T) -> T {
+const unsafe fn simd_replve0_q<T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [0, 1, 0, 1])
 }
 
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packev_b<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(
+        b,
+        a,
+        [
+            0, 32, 2, 34, 4, 36, 6, 38, 8, 40, 10, 42, 12, 44, 14, 46,
+            16, 48, 18, 50, 20, 52, 22, 54, 24, 56, 26, 58, 28, 60, 30, 62
+        ]
+    )
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packev_h<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packev_w<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [0, 8, 2, 10, 4, 12, 6, 14])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packev_d<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [0, 4, 2, 6])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packod_b<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(
+        b,
+        a,
+        [
+            1, 33, 3, 35, 5, 37, 7, 39, 9, 41, 11, 43, 13, 45, 15, 47,
+            17, 49, 19, 51, 21, 53, 23, 55, 25, 57, 27, 59, 29, 61, 31, 63
+        ]
+    )
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packod_h<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packod_w<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [1, 9, 3, 11, 5, 13, 7, 15])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packod_d<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [1, 5, 3, 7])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_shuf4i_b<const I: u32, T: Copy>(a: T) -> T {
+    simd_shuffle!(
+        a,
+        a,
+        [
+            ((I >> 0) & 3) + 0, ((I >> 2) & 3) + 0, ((I >> 4) & 3) + 0, ((I >> 6) & 3) + 0,
+            ((I >> 0) & 3) + 4, ((I >> 2) & 3) + 4, ((I >> 4) & 3) + 4, ((I >> 6) & 3) + 4,
+            ((I >> 0) & 3) + 8, ((I >> 2) & 3) + 8, ((I >> 4) & 3) + 8, ((I >> 6) & 3) + 8,
+            ((I >> 0) & 3) + 12, ((I >> 2) & 3) + 12, ((I >> 4) & 3) + 12, ((I >> 6) & 3) + 12,
+            ((I >> 0) & 3) + 16, ((I >> 2) & 3) + 16, ((I >> 4) & 3) + 16, ((I >> 6) & 3) + 16,
+            ((I >> 0) & 3) + 20, ((I >> 2) & 3) + 20, ((I >> 4) & 3) + 20, ((I >> 6) & 3) + 20,
+            ((I >> 0) & 3) + 24, ((I >> 2) & 3) + 24, ((I >> 4) & 3) + 24, ((I >> 6) & 3) + 24,
+            ((I >> 0) & 3) + 28, ((I >> 2) & 3) + 28, ((I >> 4) & 3) + 28, ((I >> 6) & 3) + 28
+        ]
+    )
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_shuf4i_h<const I: u32, T: Copy>(a: T) -> T {
+    simd_shuffle!(
+        a,
+        a,
+        [
+            ((I >> 0) & 3) + 0, ((I >> 2) & 3) + 0, ((I >> 4) & 3) + 0, ((I >> 6) & 3) + 0,
+            ((I >> 0) & 3) + 4, ((I >> 2) & 3) + 4, ((I >> 4) & 3) + 4, ((I >> 6) & 3) + 4,
+            ((I >> 0) & 3) + 8, ((I >> 2) & 3) + 8, ((I >> 4) & 3) + 8, ((I >> 6) & 3) + 8,
+            ((I >> 0) & 3) + 12, ((I >> 2) & 3) + 12, ((I >> 4) & 3) + 12, ((I >> 6) & 3) + 12,
+        ]
+    )
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_shuf4i_w<const I: u32, T: Copy>(a: T) -> T {
+    simd_shuffle!(
+        a,
+        a,
+        [
+            ((I >> 0) & 3) + 0, ((I >> 2) & 3) + 0, ((I >> 4) & 3) + 0, ((I >> 6) & 3) + 0,
+            ((I >> 0) & 3) + 4, ((I >> 2) & 3) + 4, ((I >> 4) & 3) + 4, ((I >> 6) & 3) + 4
+        ]
+    )
+}
+
 impl_vv!("lasx", lasx_xvpcnt_b, is::simd_ctpop, m256i, i8x32);
 impl_vv!("lasx", lasx_xvpcnt_h, is::simd_ctpop, m256i, i16x16);
 impl_vv!("lasx", lasx_xvpcnt_w, is::simd_ctpop, m256i, i32x8);
@@ -381,6 +490,14 @@
 impl_vvv!("lasx", lasx_xvilvl_h, simd_ilvl_h, m256i, i16x16);
 impl_vvv!("lasx", lasx_xvilvl_w, simd_ilvl_w, m256i, i32x8);
 impl_vvv!("lasx", lasx_xvilvl_d, simd_ilvl_d, m256i, i64x4);
+impl_vvv!("lasx", lasx_xvpackev_b, simd_packev_b, m256i, i8x32);
+impl_vvv!("lasx", lasx_xvpackev_h, simd_packev_h, m256i, i16x16);
+impl_vvv!("lasx", lasx_xvpackev_w, simd_packev_w, m256i, i32x8);
+impl_vvv!("lasx", lasx_xvpackev_d, simd_packev_d, m256i, i64x4);
+impl_vvv!("lasx", lasx_xvpackod_b, simd_packod_b, m256i, i8x32);
+impl_vvv!("lasx", lasx_xvpackod_h, simd_packod_h, m256i, i16x16);
+impl_vvv!("lasx", lasx_xvpackod_w, simd_packod_w, m256i, i32x8);
+impl_vvv!("lasx", lasx_xvpackod_d, simd_packod_d, m256i, i64x4);
 
 impl_vuv!("lasx", lasx_xvslli_b, is::simd_shl, m256i, i8x32);
 impl_vuv!("lasx", lasx_xvslli_h, is::simd_shl, m256i, i16x16);
@@ -418,6 +535,9 @@
 impl_vuv!("lasx", lasx_xvrepl128vei_h, simd_replvei_h, m256i, i16x16, 3, const);
 impl_vuv!("lasx", lasx_xvrepl128vei_w, simd_replvei_w, m256i, i32x8, 2, const);
 impl_vuv!("lasx", lasx_xvrepl128vei_d, simd_replvei_d, m256i, i64x4, 1, const);
+impl_vuv!("lasx", lasx_xvshuf4i_b, simd_shuf4i_b, m256i, i8x32, 8, const);
+impl_vuv!("lasx", lasx_xvshuf4i_h, simd_shuf4i_h, m256i, i16x16, 8, const);
+impl_vuv!("lasx", lasx_xvshuf4i_w, simd_shuf4i_w, m256i, i32x8, 8, const);
 
 impl_vug!("lasx", lasx_xvpickve2gr_w, is::simd_extract, m256i, i32x8, i32, 3);
 impl_vug!("lasx", lasx_xvpickve2gr_d, is::simd_extract, m256i, i64x4, i64, 2);
diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs b/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs
index 9f13d2b..5558660 100644
--- a/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs
+++ b/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs
@@ -155,22 +155,6 @@
     fn __lsx_vreplve_w(a: __v4i32, b: i32) -> __v4i32;
     #[link_name = "llvm.loongarch.lsx.vreplve.d"]
     fn __lsx_vreplve_d(a: __v2i64, b: i32) -> __v2i64;
-    #[link_name = "llvm.loongarch.lsx.vpackev.b"]
-    fn __lsx_vpackev_b(a: __v16i8, b: __v16i8) -> __v16i8;
-    #[link_name = "llvm.loongarch.lsx.vpackev.h"]
-    fn __lsx_vpackev_h(a: __v8i16, b: __v8i16) -> __v8i16;
-    #[link_name = "llvm.loongarch.lsx.vpackev.w"]
-    fn __lsx_vpackev_w(a: __v4i32, b: __v4i32) -> __v4i32;
-    #[link_name = "llvm.loongarch.lsx.vpackev.d"]
-    fn __lsx_vpackev_d(a: __v2i64, b: __v2i64) -> __v2i64;
-    #[link_name = "llvm.loongarch.lsx.vpackod.b"]
-    fn __lsx_vpackod_b(a: __v16i8, b: __v16i8) -> __v16i8;
-    #[link_name = "llvm.loongarch.lsx.vpackod.h"]
-    fn __lsx_vpackod_h(a: __v8i16, b: __v8i16) -> __v8i16;
-    #[link_name = "llvm.loongarch.lsx.vpackod.w"]
-    fn __lsx_vpackod_w(a: __v4i32, b: __v4i32) -> __v4i32;
-    #[link_name = "llvm.loongarch.lsx.vpackod.d"]
-    fn __lsx_vpackod_d(a: __v2i64, b: __v2i64) -> __v2i64;
     #[link_name = "llvm.loongarch.lsx.vshuf.h"]
     fn __lsx_vshuf_h(a: __v8i16, b: __v8i16, c: __v8i16) -> __v8i16;
     #[link_name = "llvm.loongarch.lsx.vshuf.w"]
@@ -189,12 +173,6 @@
     fn __lsx_vbitsel_v(a: __v16u8, b: __v16u8, c: __v16u8) -> __v16u8;
     #[link_name = "llvm.loongarch.lsx.vbitseli.b"]
     fn __lsx_vbitseli_b(a: __v16u8, b: __v16u8, c: u32) -> __v16u8;
-    #[link_name = "llvm.loongarch.lsx.vshuf4i.b"]
-    fn __lsx_vshuf4i_b(a: __v16i8, b: u32) -> __v16i8;
-    #[link_name = "llvm.loongarch.lsx.vshuf4i.h"]
-    fn __lsx_vshuf4i_h(a: __v8i16, b: u32) -> __v8i16;
-    #[link_name = "llvm.loongarch.lsx.vshuf4i.w"]
-    fn __lsx_vshuf4i_w(a: __v4i32, b: u32) -> __v4i32;
     #[link_name = "llvm.loongarch.lsx.vclo.b"]
     fn __lsx_vclo_b(a: __v16i8) -> __v16i8;
     #[link_name = "llvm.loongarch.lsx.vclo.h"]
@@ -379,8 +357,6 @@
     fn __lsx_vfrstp_b(a: __v16i8, b: __v16i8, c: __v16i8) -> __v16i8;
     #[link_name = "llvm.loongarch.lsx.vfrstp.h"]
     fn __lsx_vfrstp_h(a: __v8i16, b: __v8i16, c: __v8i16) -> __v8i16;
-    #[link_name = "llvm.loongarch.lsx.vshuf4i.d"]
-    fn __lsx_vshuf4i_d(a: __v2i64, b: __v2i64, c: u32) -> __v2i64;
     #[link_name = "llvm.loongarch.lsx.vbsrl.v"]
     fn __lsx_vbsrl_v(a: __v16i8, b: u32) -> __v16i8;
     #[link_name = "llvm.loongarch.lsx.vbsll.v"]
@@ -1520,62 +1496,6 @@ pub fn lsx_vreplve_d(a: m128i, b: i32) -> m128i {
 #[inline]
 #[target_feature(enable = "lsx")]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vpackev_b(a: m128i, b: m128i) -> m128i {
-    unsafe { transmute(__lsx_vpackev_b(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vpackev_h(a: m128i, b: m128i) -> m128i {
-    unsafe { transmute(__lsx_vpackev_h(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vpackev_w(a: m128i, b: m128i) -> m128i {
-    unsafe { transmute(__lsx_vpackev_w(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vpackev_d(a: m128i, b: m128i) -> m128i {
-    unsafe { transmute(__lsx_vpackev_d(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vpackod_b(a: m128i, b: m128i) -> m128i {
-    unsafe { transmute(__lsx_vpackod_b(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vpackod_h(a: m128i, b: m128i) -> m128i {
-    unsafe { transmute(__lsx_vpackod_h(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vpackod_w(a: m128i, b: m128i) -> m128i {
-    unsafe { transmute(__lsx_vpackod_w(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vpackod_d(a: m128i, b: m128i) -> m128i {
-    unsafe { transmute(__lsx_vpackod_d(transmute(a), transmute(b))) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn lsx_vshuf_h(a: m128i, b: m128i, c: m128i) -> m128i {
     unsafe { transmute(__lsx_vshuf_h(transmute(a), transmute(b), transmute(c))) }
 }
@@ -1648,33 +1568,6 @@ pub fn lsx_vbitseli_b<const IMM8: u32>(a: m128i, b: m128i) -> m128i {
 
 #[inline]
 #[target_feature(enable = "lsx")]
-#[rustc_legacy_const_generics(1)]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vshuf4i_b<const IMM8: u32>(a: m128i) -> m128i {
-    static_assert_uimm_bits!(IMM8, 8);
-    unsafe { transmute(__lsx_vshuf4i_b(transmute(a), IMM8)) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[rustc_legacy_const_generics(1)]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vshuf4i_h<const IMM8: u32>(a: m128i) -> m128i {
-    static_assert_uimm_bits!(IMM8, 8);
-    unsafe { transmute(__lsx_vshuf4i_h(transmute(a), IMM8)) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
-#[rustc_legacy_const_generics(1)]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vshuf4i_w<const IMM8: u32>(a: m128i) -> m128i {
-    static_assert_uimm_bits!(IMM8, 8);
-    unsafe { transmute(__lsx_vshuf4i_w(transmute(a), IMM8)) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn lsx_vclo_b(a: m128i) -> m128i {
     unsafe { transmute(__lsx_vclo_b(transmute(a))) }
@@ -2335,15 +2228,6 @@ pub fn lsx_vfrstp_h(a: m128i, b: m128i, c: m128i) -> m128i {
 
 #[inline]
 #[target_feature(enable = "lsx")]
-#[rustc_legacy_const_generics(2)]
-#[unstable(feature = "stdarch_loongarch", issue = "117427")]
-pub fn lsx_vshuf4i_d<const IMM8: u32>(a: m128i, b: m128i) -> m128i {
-    static_assert_uimm_bits!(IMM8, 8);
-    unsafe { transmute(__lsx_vshuf4i_d(transmute(a), transmute(b), IMM8)) }
-}
-
-#[inline]
-#[target_feature(enable = "lsx")]
 #[rustc_legacy_const_generics(1)]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn lsx_vbsrl_v<const IMM5: u32>(a: m128i) -> m128i {
diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs b/library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs
index 2d24256..0b0df11 100644
--- a/library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs
+++ b/library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs
@@ -55,76 +55,164 @@
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvh_b<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvh_h<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvh_h<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [4, 12, 5, 13, 6, 14, 7, 15])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvh_w<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvh_w<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [2, 6, 3, 7])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvh_d<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvh_d<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [1, 3])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvl_b<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvl_h<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvl_h<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [0, 8, 1, 9, 2, 10, 3, 11])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvl_w<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvl_w<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [0, 4, 1, 5])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_ilvl_d<T: Copy>(a: T, b: T) -> T {
+const unsafe fn simd_ilvl_d<T: Copy>(a: T, b: T) -> T {
     simd_shuffle!(b, a, [0, 2])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
+const unsafe fn simd_replvei_b<const I: u32, T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
+const unsafe fn simd_replvei_h<const I: u32, T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [I, I, I, I, I, I, I, I])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_replvei_w<const I: u32, T: Copy>(a: T) -> T {
+const unsafe fn simd_replvei_w<const I: u32, T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [I, I, I, I])
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_replvei_d<const I: u32, T: Copy>(a: T) -> T {
+const unsafe fn simd_replvei_d<const I: u32, T: Copy>(a: T) -> T {
     simd_shuffle!(a, a, [I, I])
 }
 
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packev_b<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packev_h<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [0, 8, 2, 10, 4, 12, 6, 14])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packev_w<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [0, 4, 2, 6])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packev_d<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [0, 2])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packod_b<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packod_h<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [1, 9, 3, 11, 5, 13, 7, 15])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packod_w<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [1, 5, 3, 7])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_packod_d<T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(b, a, [1, 3])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_shuf4i_b<const I: u32, T: Copy>(a: T) -> T {
+    simd_shuffle!(
+        a,
+        a,
+        [
+            ((I >> 0) & 3) + 0, ((I >> 2) & 3) + 0, ((I >> 4) & 3) + 0, ((I >> 6) & 3) + 0,
+            ((I >> 0) & 3) + 4, ((I >> 2) & 3) + 4, ((I >> 4) & 3) + 4, ((I >> 6) & 3) + 4,
+            ((I >> 0) & 3) + 8, ((I >> 2) & 3) + 8, ((I >> 4) & 3) + 8, ((I >> 6) & 3) + 8,
+            ((I >> 0) & 3) + 12, ((I >> 2) & 3) + 12, ((I >> 4) & 3) + 12, ((I >> 6) & 3) + 12
+        ]
+    )
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_shuf4i_h<const I: u32, T: Copy>(a: T) -> T {
+    simd_shuffle!(
+        a,
+        a,
+        [
+            ((I >> 0) & 3) + 0, ((I >> 2) & 3) + 0, ((I >> 4) & 3) + 0, ((I >> 6) & 3) + 0,
+            ((I >> 0) & 3) + 4, ((I >> 2) & 3) + 4, ((I >> 4) & 3) + 4, ((I >> 6) & 3) + 4
+        ]
+    )
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_shuf4i_w<const I: u32, T: Copy>(a: T) -> T {
+    simd_shuffle!(a, a, [((I >> 0) & 3), ((I >> 2) & 3), ((I >> 4) & 3), ((I >> 6) & 3)])
+}
+
+#[inline(always)]
+#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
+const unsafe fn simd_shuf4i_d<const I: u32, T: Copy>(a: T, b: T) -> T {
+    simd_shuffle!(a, b, [((I >> 0) & 3), ((I >> 2) & 3)])
+}
+
 impl_vv!("lsx", lsx_vpcnt_b, is::simd_ctpop, m128i, i8x16);
 impl_vv!("lsx", lsx_vpcnt_h, is::simd_ctpop, m128i, i16x8);
 impl_vv!("lsx", lsx_vpcnt_w, is::simd_ctpop, m128i, i32x4);
@@ -296,6 +384,14 @@
 impl_vvv!("lsx", lsx_vilvl_h, simd_ilvl_h, m128i, i16x8);
 impl_vvv!("lsx", lsx_vilvl_w, simd_ilvl_w, m128i, i32x4);
 impl_vvv!("lsx", lsx_vilvl_d, simd_ilvl_d, m128i, i64x2);
+impl_vvv!("lsx", lsx_vpackev_b, simd_packev_b, m128i, i8x16);
+impl_vvv!("lsx", lsx_vpackev_h, simd_packev_h, m128i, i16x8);
+impl_vvv!("lsx", lsx_vpackev_w, simd_packev_w, m128i, i32x4);
+impl_vvv!("lsx", lsx_vpackev_d, simd_packev_d, m128i, i64x2);
+impl_vvv!("lsx", lsx_vpackod_b, simd_packod_b, m128i, i8x16);
+impl_vvv!("lsx", lsx_vpackod_h, simd_packod_h, m128i, i16x8);
+impl_vvv!("lsx", lsx_vpackod_w, simd_packod_w, m128i, i32x4);
+impl_vvv!("lsx", lsx_vpackod_d, simd_packod_d, m128i, i64x2);
 
 impl_vuv!("lsx", lsx_vslli_b, is::simd_shl, m128i, i8x16);
 impl_vuv!("lsx", lsx_vslli_h, is::simd_shl, m128i, i16x8);
@@ -333,6 +429,9 @@
 impl_vuv!("lsx", lsx_vreplvei_h, simd_replvei_h, m128i, i16x8, 3, const);
 impl_vuv!("lsx", lsx_vreplvei_w, simd_replvei_w, m128i, i32x4, 2, const);
 impl_vuv!("lsx", lsx_vreplvei_d, simd_replvei_d, m128i, i64x2, 1, const);
+impl_vuv!("lsx", lsx_vshuf4i_b, simd_shuf4i_b, m128i, i8x16, 8, const);
+impl_vuv!("lsx", lsx_vshuf4i_h, simd_shuf4i_h, m128i, i16x8, 8, const);
+impl_vuv!("lsx", lsx_vshuf4i_w, simd_shuf4i_w, m128i, i32x4, 8, const);
 
 impl_vug!("lsx", lsx_vpickve2gr_b, is::simd_extract, m128i, i8x16, i32, 4);
 impl_vug!("lsx", lsx_vpickve2gr_h, is::simd_extract, m128i, i16x8, i32, 3);
@@ -381,6 +480,8 @@
 impl_vvvv!("lsx", lsx_vfnmsub_s, ls::simd_fnmsub, m128, f32x4);
 impl_vvvv!("lsx", lsx_vfnmsub_d, ls::simd_fnmsub, m128d, f64x2);
 
+impl_vvuv!("lsx", lsx_vshuf4i_d, simd_shuf4i_d, m128i, i64x2, 8, const);
+
 impl_vugv!("lsx", lsx_vinsgr2vr_b, is::simd_insert, m128i, i8x16, i32, 4);
 impl_vugv!("lsx", lsx_vinsgr2vr_h, is::simd_insert, m128i, i16x8, i32, 3);
 impl_vugv!("lsx", lsx_vinsgr2vr_w, is::simd_insert, m128i, i32x4, i32, 2);
diff --git a/library/stdarch/crates/core_arch/src/loongarch64/mod.rs b/library/stdarch/crates/core_arch/src/loongarch64/mod.rs
index e8bf098..7e9f45f 100644
--- a/library/stdarch/crates/core_arch/src/loongarch64/mod.rs
+++ b/library/stdarch/crates/core_arch/src/loongarch64/mod.rs
@@ -64,14 +64,14 @@ pub fn rdtime_d() -> (i64, isize) {
 #[inline(always)]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn crc_w_b_w(a: i8, b: i32) -> i32 {
-    unsafe { __crc_w_b_w(a as i32, b) }
+    unsafe { __crc_w_b_w(a.cast_unsigned() as i32, b) }
 }
 
 /// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320)
 #[inline(always)]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn crc_w_h_w(a: i16, b: i32) -> i32 {
-    unsafe { __crc_w_h_w(a as i32, b) }
+    unsafe { __crc_w_h_w(a.cast_unsigned() as i32, b) }
 }
 
 /// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320)
@@ -92,14 +92,14 @@ pub fn crc_w_d_w(a: i64, b: i32) -> i32 {
 #[inline(always)]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn crcc_w_b_w(a: i8, b: i32) -> i32 {
-    unsafe { __crcc_w_b_w(a as i32, b) }
+    unsafe { __crcc_w_b_w(a.cast_unsigned() as i32, b) }
 }
 
 /// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78)
 #[inline(always)]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub fn crcc_w_h_w(a: i16, b: i32) -> i32 {
-    unsafe { __crcc_w_h_w(a as i32, b) }
+    unsafe { __crcc_w_h_w(a.cast_unsigned() as i32, b) }
 }
 
 /// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78)
@@ -163,14 +163,14 @@ pub unsafe fn iocsrwr_d(a: i64, b: i32) {
     __iocsrwr_d(a, b)
 }
 
-/// Generates the less-than-or-equal asseration instruction
+/// Generates the less-than-or-equal assertion instruction
 #[inline(always)]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub unsafe fn asrtle(a: i64, b: i64) {
     __asrtle(a, b);
 }
 
-/// Generates the greater-than asseration instruction
+/// Generates the greater-than assertion instruction
 #[inline(always)]
 #[unstable(feature = "stdarch_loongarch", issue = "117427")]
 pub unsafe fn asrtgt(a: i64, b: i64) {
@@ -194,3 +194,21 @@ pub unsafe fn ldpte<const IMM8: i64>(a: i64) {
     static_assert_uimm_bits!(IMM8, 8);
     __ldpte(a, IMM8)
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn crc32() {
+        assert_eq!(crc_w_b_w(-1, -1), 16777215);
+        assert_eq!(crc_w_h_w(-1, -1), 65535);
+        assert_eq!(crc_w_w_w(-1, -1), 0);
+        assert_eq!(crc_w_d_w(-1, -1), 3736805603u32.cast_signed());
+
+        assert_eq!(crcc_w_b_w(-1, -1), 16777215);
+        assert_eq!(crcc_w_h_w(-1, -1), 65535);
+        assert_eq!(crcc_w_w_w(-1, -1), 0);
+        assert_eq!(crcc_w_d_w(-1, -1), 3080238136u32.cast_signed());
+    }
+}
diff --git a/library/stdarch/crates/core_arch/src/loongarch64/simd.rs b/library/stdarch/crates/core_arch/src/loongarch64/simd.rs
index 24ee487..2c4a0f8 100644
--- a/library/stdarch/crates/core_arch/src/loongarch64/simd.rs
+++ b/library/stdarch/crates/core_arch/src/loongarch64/simd.rs
@@ -48,21 +48,21 @@ unsafe fn splat(v: i64) -> Self {
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_abs<T: Copy + const SimdExt>(a: T) -> T {
+pub(super) const unsafe fn simd_abs<T: Copy + const SimdExt>(a: T) -> T {
     let m: T = is::simd_lt(a, ls::simd_splat(0));
     is::simd_select(m, is::simd_neg(a), a)
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_absd<T: Copy>(a: T, b: T) -> T {
+pub(super) const unsafe fn simd_absd<T: Copy>(a: T, b: T) -> T {
     let m: T = is::simd_gt(a, b);
     is::simd_select(m, is::simd_sub(a, b), is::simd_sub(b, a))
 }
 
 #[inline(always)]
 #[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")]
-pub(crate) const unsafe fn simd_adda<T: Copy + const SimdExt>(a: T, b: T) -> T {
+pub(super) const unsafe fn simd_adda<T: Copy + const SimdExt>(a: T, b: T) -> T {
     is::simd_add(ls::simd_abs(a), ls::simd_abs(b))
 }
 
@@ -334,11 +334,31 @@ pub fn $name(a: $oty, b: $oty, c: $oty) -> $oty {
 
 pub(super) use impl_vvvv;
 
+macro_rules! impl_vvuv {
+    ($ft:literal, $name:ident, $op:ident, $oty:ty, $ity:ident, $ibs:expr, const) => {
+        #[inline]
+        #[target_feature(enable = $ft)]
+        #[rustc_legacy_const_generics(2)]
+        #[unstable(feature = "stdarch_loongarch", issue = "117427")]
+        pub fn $name<const IMM: u32>(a: $oty, b: $oty) -> $oty {
+            static_assert_uimm_bits!(IMM, $ibs);
+            unsafe {
+                let a: $ity = transmute(a);
+                let b: $ity = transmute(b);
+                let r: $ity = $op::<IMM, _>(a, b);
+                transmute(r)
+            }
+        }
+    };
+}
+
+pub(super) use impl_vvuv;
+
 macro_rules! impl_vugv {
     ($ft:literal, $name:ident, $op:path, $oty:ty, $ity:ident, $gty:ty, $ibs:expr) => {
         #[inline]
         #[target_feature(enable = $ft)]
-        #[rustc_legacy_const_generics(1)]
+        #[rustc_legacy_const_generics(2)]
         #[unstable(feature = "stdarch_loongarch", issue = "117427")]
         pub fn $name<const IMM: u32>(a: $oty, b: $gty) -> $oty {
             static_assert_uimm_bits!(IMM, $ibs);
diff --git a/library/stdarch/crates/core_arch/src/macros.rs b/library/stdarch/crates/core_arch/src/macros.rs
index def2fd6..6a2b62c 100644
--- a/library/stdarch/crates/core_arch/src/macros.rs
+++ b/library/stdarch/crates/core_arch/src/macros.rs
@@ -266,23 +266,22 @@ macro_rules! deinterleaving_load {
         transmute((v0, v1))
     }};
 
+    // N = 3
     ($elem:ty, $lanes:literal, 3, $ptr:expr) => {{
         use $crate::core_arch::macros::deinterleave_mask;
         use $crate::core_arch::simd::Simd;
-        use $crate::mem::{MaybeUninit, transmute};
+        use $crate::mem::transmute;
 
         type V = Simd<$elem, $lanes>;
-        type W = Simd<$elem, { $lanes * 3 }>;
+        type Arr = [$elem; { $lanes * 3 }];
 
+        // NOTE: copy_nonoverlapping requires both pointers to be aligned to at least align_of::<$elem>(),
+        // passing a pointer that is not sufficiently aligned is an UB.
+        let arr: Arr = $crate::ptr::read_unaligned($ptr as *const [$elem; { $lanes * 3 }]);
         // NOTE: repr(simd) adds padding to make the total size a power of two.
-        // Hence reading W from ptr might read out of bounds.
-        let mut mem = MaybeUninit::<W>::uninit();
-        $crate::ptr::copy_nonoverlapping(
-            $ptr.cast::<$elem>(),
-            mem.as_mut_ptr().cast::<$elem>(),
-            $lanes * 3,
-        );
-        let w = mem.assume_init();
+        // Hence reading a W from ptr might read out of bounds.
+        type W = Simd<$elem, { $lanes * 3 }>;
+        let w: W = W::from_array(arr);
 
         let v0: V = simd_shuffle!(w, w, deinterleave_mask::<$lanes, 3, 0>());
         let v1: V = simd_shuffle!(w, w, deinterleave_mask::<$lanes, 3, 1>());
@@ -291,6 +290,7 @@ macro_rules! deinterleaving_load {
         transmute((v0, v1, v2))
     }};
 
+    // N = 4
     ($elem:ty, $lanes:literal, 4, $ptr:expr) => {{
         use $crate::core_arch::macros::deinterleave_mask;
         use $crate::core_arch::simd::Simd;
@@ -345,16 +345,17 @@ macro_rules! interleaving_store {
         let v2v2: Simd<$elem, { $lanes * 2 }> =
             simd_shuffle!($v.2, $v.2, identity::<{ $lanes * 2 }>());
 
-        type W = Simd<$elem, { $lanes * 3 }>;
-
         // NOTE: repr(simd) adds padding to make the total size a power of two.
         // Hence writing W to ptr might write out of bounds.
+        type W = Simd<$elem, { $lanes * 3 }>;
+
         let w: W = simd_shuffle!(v0v1, v2v2, interleave_mask::<{ $lanes * 3 }, $lanes, 3>());
-        $crate::ptr::copy_nonoverlapping(
-            (&w as *const W).cast::<$elem>(),
-            $ptr.cast::<$elem>(),
-            $lanes * 3,
-        );
+
+        let arr: [$elem; { $lanes * 3 }] = $crate::mem::transmute_copy(&w);
+
+        // NOTE: copy_nonoverlapping requires both pointers to be aligned to at least align_of::<$elem>(),
+        // passing a pointer that is not sufficiently aligned is an UB.
+        $ptr.cast::<[$elem; { $lanes * 3 }]>().write_unaligned(arr);
     }};
 
     // N = 4
diff --git a/library/stdarch/crates/core_arch/src/x86/avx512f.rs b/library/stdarch/crates/core_arch/src/x86/avx512f.rs
index 66ea63b..9b90ad6 100644
--- a/library/stdarch/crates/core_arch/src/x86/avx512f.rs
+++ b/library/stdarch/crates/core_arch/src/x86/avx512f.rs
@@ -15529,17 +15529,17 @@ pub fn _mm512_maskz_cvt_roundps_ph<const ROUNDING: i32>(k: __mmask16, a: __m512)
 
 /// Convert packed single-precision (32-bit) floating-point elements in a to packed half-precision (16-bit) floating-point elements, and store the results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set).\
 /// Rounding is done according to the imm8\[2:0\] parameter, which can be one of:
-/// * [`_MM_FROUND_TO_NEAREST_INT`] | [`_MM_FROUND_NO_EXC`] : round to nearest and suppress exceptions
-/// * [`_MM_FROUND_TO_NEG_INF`] | [`_MM_FROUND_NO_EXC`] : round down and suppress exceptions
-/// * [`_MM_FROUND_TO_POS_INF`] | [`_MM_FROUND_NO_EXC`] : round up and suppress exceptions
-/// * [`_MM_FROUND_TO_ZERO`] | [`_MM_FROUND_NO_EXC`] : truncate and suppress exceptions
+/// * [`_MM_FROUND_TO_NEAREST_INT`] : round to nearest
+/// * [`_MM_FROUND_TO_NEG_INF`] : round down
+/// * [`_MM_FROUND_TO_POS_INF`] : round up
+/// * [`_MM_FROUND_TO_ZERO`] : truncate
 /// * [`_MM_FROUND_CUR_DIRECTION`] : use `MXCSR.RC` - see [`_MM_SET_ROUNDING_MODE`]
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_mask_cvt_roundps_ph&expand=1352)
 #[inline]
 #[target_feature(enable = "avx512f,avx512vl")]
 #[stable(feature = "stdarch_x86_avx512", since = "1.89")]
-#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 8))]
+#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 0))]
 #[rustc_legacy_const_generics(3)]
 pub fn _mm256_mask_cvt_roundps_ph<const IMM8: i32>(
     src: __m128i,
@@ -15547,7 +15547,7 @@ pub fn _mm256_mask_cvt_roundps_ph<const IMM8: i32>(
     a: __m256,
 ) -> __m128i {
     unsafe {
-        static_assert_uimm_bits!(IMM8, 8);
+        static_assert_round_mode!(IMM8);
         let a = a.as_f32x8();
         let src = src.as_i16x8();
         let r = vcvtps2ph256(a, IMM8, src, k);
@@ -15557,21 +15557,21 @@ pub fn _mm256_mask_cvt_roundps_ph<const IMM8: i32>(
 
 /// Convert packed single-precision (32-bit) floating-point elements in a to packed half-precision (16-bit) floating-point elements, and store the results in dst using zeromask k (elements are zeroed out when the corresponding mask bit is not set).\
 /// Rounding is done according to the imm8\[2:0\] parameter, which can be one of:\
-/// * [`_MM_FROUND_TO_NEAREST_INT`] | [`_MM_FROUND_NO_EXC`] : round to nearest and suppress exceptions
-/// * [`_MM_FROUND_TO_NEG_INF`] | [`_MM_FROUND_NO_EXC`] : round down and suppress exceptions
-/// * [`_MM_FROUND_TO_POS_INF`] | [`_MM_FROUND_NO_EXC`] : round up and suppress exceptions
-/// * [`_MM_FROUND_TO_ZERO`] | [`_MM_FROUND_NO_EXC`] : truncate and suppress exceptions
+/// * [`_MM_FROUND_TO_NEAREST_INT`] : round to nearest
+/// * [`_MM_FROUND_TO_NEG_INF`] : round down
+/// * [`_MM_FROUND_TO_POS_INF`] : round up
+/// * [`_MM_FROUND_TO_ZERO`] : truncate
 /// * [`_MM_FROUND_CUR_DIRECTION`] : use `MXCSR.RC` - see [`_MM_SET_ROUNDING_MODE`]
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_maskz_cvt_roundps_ph&expand=1353)
 #[inline]
 #[target_feature(enable = "avx512f,avx512vl")]
 #[stable(feature = "stdarch_x86_avx512", since = "1.89")]
-#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 8))]
+#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 0))]
 #[rustc_legacy_const_generics(2)]
 pub fn _mm256_maskz_cvt_roundps_ph<const IMM8: i32>(k: __mmask8, a: __m256) -> __m128i {
     unsafe {
-        static_assert_uimm_bits!(IMM8, 8);
+        static_assert_round_mode!(IMM8);
         let a = a.as_f32x8();
         let r = vcvtps2ph256(a, IMM8, i16x8::ZERO, k);
         transmute(r)
@@ -15580,21 +15580,21 @@ pub fn _mm256_maskz_cvt_roundps_ph<const IMM8: i32>(k: __mmask8, a: __m256) -> _
 
 /// Convert packed single-precision (32-bit) floating-point elements in a to packed half-precision (16-bit) floating-point elements, and store the results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set).\
 /// Rounding is done according to the imm8\[2:0\] parameter, which can be one of:\
-/// * [`_MM_FROUND_TO_NEAREST_INT`] | [`_MM_FROUND_NO_EXC`] : round to nearest and suppress exceptions
-/// * [`_MM_FROUND_TO_NEG_INF`] | [`_MM_FROUND_NO_EXC`] : round down and suppress exceptions
-/// * [`_MM_FROUND_TO_POS_INF`] | [`_MM_FROUND_NO_EXC`] : round up and suppress exceptions
-/// * [`_MM_FROUND_TO_ZERO`] | [`_MM_FROUND_NO_EXC`] : truncate and suppress exceptions
+/// * [`_MM_FROUND_TO_NEAREST_INT`] : round to nearest
+/// * [`_MM_FROUND_TO_NEG_INF`] : round down
+/// * [`_MM_FROUND_TO_POS_INF`] : round up
+/// * [`_MM_FROUND_TO_ZERO`] : truncate
 /// * [`_MM_FROUND_CUR_DIRECTION`] : use `MXCSR.RC` - see [`_MM_SET_ROUNDING_MODE`]
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mask_cvt_roundps_ph&expand=1350)
 #[inline]
 #[target_feature(enable = "avx512f,avx512vl")]
 #[stable(feature = "stdarch_x86_avx512", since = "1.89")]
-#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 8))]
+#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 0))]
 #[rustc_legacy_const_generics(3)]
 pub fn _mm_mask_cvt_roundps_ph<const IMM8: i32>(src: __m128i, k: __mmask8, a: __m128) -> __m128i {
     unsafe {
-        static_assert_uimm_bits!(IMM8, 8);
+        static_assert_round_mode!(IMM8);
         let a = a.as_f32x4();
         let src = src.as_i16x8();
         let r = vcvtps2ph128(a, IMM8, src, k);
@@ -15604,21 +15604,21 @@ pub fn _mm_mask_cvt_roundps_ph<const IMM8: i32>(src: __m128i, k: __mmask8, a: __
 
 /// Convert packed single-precision (32-bit) floating-point elements in a to packed half-precision (16-bit) floating-point elements, and store the results in dst using zeromask k (elements are zeroed out when the corresponding mask bit is not set).\
 /// Rounding is done according to the imm8\[2:0\] parameter, which can be one of:\
-/// * [`_MM_FROUND_TO_NEAREST_INT`] | [`_MM_FROUND_NO_EXC`] : round to nearest and suppress exceptions
-/// * [`_MM_FROUND_TO_NEG_INF`] | [`_MM_FROUND_NO_EXC`] : round down and suppress exceptions
-/// * [`_MM_FROUND_TO_POS_INF`] | [`_MM_FROUND_NO_EXC`] : round up and suppress exceptions
-/// * [`_MM_FROUND_TO_ZERO`] | [`_MM_FROUND_NO_EXC`] : truncate and suppress exceptions
+/// * [`_MM_FROUND_TO_NEAREST_INT`] : round to nearest
+/// * [`_MM_FROUND_TO_NEG_INF`] : round down
+/// * [`_MM_FROUND_TO_POS_INF`] : round up
+/// * [`_MM_FROUND_TO_ZERO`] : truncate
 /// * [`_MM_FROUND_CUR_DIRECTION`] : use `MXCSR.RC` - see [`_MM_SET_ROUNDING_MODE`]
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_maskz_cvt_roundps_ph&expand=1351)
 #[inline]
 #[target_feature(enable = "avx512f,avx512vl")]
 #[stable(feature = "stdarch_x86_avx512", since = "1.89")]
-#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 8))]
+#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 0))]
 #[rustc_legacy_const_generics(2)]
 pub fn _mm_maskz_cvt_roundps_ph<const IMM8: i32>(k: __mmask8, a: __m128) -> __m128i {
     unsafe {
-        static_assert_uimm_bits!(IMM8, 8);
+        static_assert_round_mode!(IMM8);
         let a = a.as_f32x4();
         let r = vcvtps2ph128(a, IMM8, i16x8::ZERO, k);
         transmute(r)
@@ -15722,11 +15722,11 @@ pub fn _mm512_maskz_cvtps_ph<const ROUNDING: i32>(k: __mmask16, a: __m512) -> __
 #[inline]
 #[target_feature(enable = "avx512f,avx512vl")]
 #[stable(feature = "stdarch_x86_avx512", since = "1.89")]
-#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 8))]
+#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 0))]
 #[rustc_legacy_const_generics(3)]
 pub fn _mm256_mask_cvtps_ph<const IMM8: i32>(src: __m128i, k: __mmask8, a: __m256) -> __m128i {
     unsafe {
-        static_assert_uimm_bits!(IMM8, 8);
+        static_assert_round_mode!(IMM8);
         let a = a.as_f32x8();
         let src = src.as_i16x8();
         let r = vcvtps2ph256(a, IMM8, src, k);
@@ -15746,11 +15746,11 @@ pub fn _mm256_mask_cvtps_ph<const IMM8: i32>(src: __m128i, k: __mmask8, a: __m25
 #[inline]
 #[target_feature(enable = "avx512f,avx512vl")]
 #[stable(feature = "stdarch_x86_avx512", since = "1.89")]
-#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 8))]
+#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 0))]
 #[rustc_legacy_const_generics(2)]
 pub fn _mm256_maskz_cvtps_ph<const IMM8: i32>(k: __mmask8, a: __m256) -> __m128i {
     unsafe {
-        static_assert_uimm_bits!(IMM8, 8);
+        static_assert_round_mode!(IMM8);
         let a = a.as_f32x8();
         let r = vcvtps2ph256(a, IMM8, i16x8::ZERO, k);
         transmute(r)
@@ -15769,11 +15769,11 @@ pub fn _mm256_maskz_cvtps_ph<const IMM8: i32>(k: __mmask8, a: __m256) -> __m128i
 #[inline]
 #[target_feature(enable = "avx512f,avx512vl")]
 #[stable(feature = "stdarch_x86_avx512", since = "1.89")]
-#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 8))]
+#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 0))]
 #[rustc_legacy_const_generics(3)]
 pub fn _mm_mask_cvtps_ph<const IMM8: i32>(src: __m128i, k: __mmask8, a: __m128) -> __m128i {
     unsafe {
-        static_assert_uimm_bits!(IMM8, 8);
+        static_assert_round_mode!(IMM8);
         let a = a.as_f32x4();
         let src = src.as_i16x8();
         let r = vcvtps2ph128(a, IMM8, src, k);
@@ -15793,11 +15793,11 @@ pub fn _mm_mask_cvtps_ph<const IMM8: i32>(src: __m128i, k: __mmask8, a: __m128)
 #[inline]
 #[target_feature(enable = "avx512f,avx512vl")]
 #[stable(feature = "stdarch_x86_avx512", since = "1.89")]
-#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 8))]
+#[cfg_attr(test, assert_instr(vcvtps2ph, IMM8 = 0))]
 #[rustc_legacy_const_generics(2)]
 pub fn _mm_maskz_cvtps_ph<const IMM8: i32>(k: __mmask8, a: __m128) -> __m128i {
     unsafe {
-        static_assert_uimm_bits!(IMM8, 8);
+        static_assert_round_mode!(IMM8);
         let a = a.as_f32x4();
         let r = vcvtps2ph128(a, IMM8, i16x8::ZERO, k);
         transmute(r)
@@ -50942,9 +50942,9 @@ fn test_mm512_maskz_cvt_roundps_ph() {
     fn test_mm256_mask_cvt_roundps_ph() {
         let a = _mm256_set1_ps(1.);
         let src = _mm_set1_epi16(0);
-        let r = _mm256_mask_cvt_roundps_ph::<_MM_FROUND_NO_EXC>(src, 0, a);
+        let r = _mm256_mask_cvt_roundps_ph::<_MM_FROUND_CUR_DIRECTION>(src, 0, a);
         assert_eq_m128i(r, src);
-        let r = _mm256_mask_cvt_roundps_ph::<_MM_FROUND_NO_EXC>(src, 0b11111111, a);
+        let r = _mm256_mask_cvt_roundps_ph::<_MM_FROUND_CUR_DIRECTION>(src, 0b11111111, a);
         let e = _mm_setr_epi64x(4323521613979991040, 4323521613979991040);
         assert_eq_m128i(r, e);
     }
@@ -50952,9 +50952,9 @@ fn test_mm256_mask_cvt_roundps_ph() {
     #[simd_test(enable = "avx512f,avx512vl")]
     fn test_mm256_maskz_cvt_roundps_ph() {
         let a = _mm256_set1_ps(1.);
-        let r = _mm256_maskz_cvt_roundps_ph::<_MM_FROUND_NO_EXC>(0, a);
+        let r = _mm256_maskz_cvt_roundps_ph::<_MM_FROUND_CUR_DIRECTION>(0, a);
         assert_eq_m128i(r, _mm_setzero_si128());
-        let r = _mm256_maskz_cvt_roundps_ph::<_MM_FROUND_NO_EXC>(0b11111111, a);
+        let r = _mm256_maskz_cvt_roundps_ph::<_MM_FROUND_CUR_DIRECTION>(0b11111111, a);
         let e = _mm_setr_epi64x(4323521613979991040, 4323521613979991040);
         assert_eq_m128i(r, e);
     }
@@ -50963,9 +50963,9 @@ fn test_mm256_maskz_cvt_roundps_ph() {
     fn test_mm_mask_cvt_roundps_ph() {
         let a = _mm_set1_ps(1.);
         let src = _mm_set1_epi16(0);
-        let r = _mm_mask_cvt_roundps_ph::<_MM_FROUND_NO_EXC>(src, 0, a);
+        let r = _mm_mask_cvt_roundps_ph::<_MM_FROUND_CUR_DIRECTION>(src, 0, a);
         assert_eq_m128i(r, src);
-        let r = _mm_mask_cvt_roundps_ph::<_MM_FROUND_NO_EXC>(src, 0b00001111, a);
+        let r = _mm_mask_cvt_roundps_ph::<_MM_FROUND_CUR_DIRECTION>(src, 0b00001111, a);
         let e = _mm_setr_epi64x(4323521613979991040, 0);
         assert_eq_m128i(r, e);
     }
@@ -50973,9 +50973,9 @@ fn test_mm_mask_cvt_roundps_ph() {
     #[simd_test(enable = "avx512f,avx512vl")]
     fn test_mm_maskz_cvt_roundps_ph() {
         let a = _mm_set1_ps(1.);
-        let r = _mm_maskz_cvt_roundps_ph::<_MM_FROUND_NO_EXC>(0, a);
+        let r = _mm_maskz_cvt_roundps_ph::<_MM_FROUND_CUR_DIRECTION>(0, a);
         assert_eq_m128i(r, _mm_setzero_si128());
-        let r = _mm_maskz_cvt_roundps_ph::<_MM_FROUND_NO_EXC>(0b00001111, a);
+        let r = _mm_maskz_cvt_roundps_ph::<_MM_FROUND_CUR_DIRECTION>(0b00001111, a);
         let e = _mm_setr_epi64x(4323521613979991040, 0);
         assert_eq_m128i(r, e);
     }
@@ -51018,9 +51018,9 @@ fn test_mm512_maskz_cvtps_ph() {
     fn test_mm256_mask_cvtps_ph() {
         let a = _mm256_set1_ps(1.);
         let src = _mm_set1_epi16(0);
-        let r = _mm256_mask_cvtps_ph::<_MM_FROUND_NO_EXC>(src, 0, a);
+        let r = _mm256_mask_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(src, 0, a);
         assert_eq_m128i(r, src);
-        let r = _mm256_mask_cvtps_ph::<_MM_FROUND_NO_EXC>(src, 0b11111111, a);
+        let r = _mm256_mask_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(src, 0b11111111, a);
         let e = _mm_setr_epi64x(4323521613979991040, 4323521613979991040);
         assert_eq_m128i(r, e);
     }
@@ -51028,9 +51028,9 @@ fn test_mm256_mask_cvtps_ph() {
     #[simd_test(enable = "avx512f,avx512vl")]
     fn test_mm256_maskz_cvtps_ph() {
         let a = _mm256_set1_ps(1.);
-        let r = _mm256_maskz_cvtps_ph::<_MM_FROUND_NO_EXC>(0, a);
+        let r = _mm256_maskz_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(0, a);
         assert_eq_m128i(r, _mm_setzero_si128());
-        let r = _mm256_maskz_cvtps_ph::<_MM_FROUND_NO_EXC>(0b11111111, a);
+        let r = _mm256_maskz_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(0b11111111, a);
         let e = _mm_setr_epi64x(4323521613979991040, 4323521613979991040);
         assert_eq_m128i(r, e);
     }
@@ -51039,9 +51039,9 @@ fn test_mm256_maskz_cvtps_ph() {
     fn test_mm_mask_cvtps_ph() {
         let a = _mm_set1_ps(1.);
         let src = _mm_set1_epi16(0);
-        let r = _mm_mask_cvtps_ph::<_MM_FROUND_NO_EXC>(src, 0, a);
+        let r = _mm_mask_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(src, 0, a);
         assert_eq_m128i(r, src);
-        let r = _mm_mask_cvtps_ph::<_MM_FROUND_NO_EXC>(src, 0b00001111, a);
+        let r = _mm_mask_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(src, 0b00001111, a);
         let e = _mm_setr_epi64x(4323521613979991040, 0);
         assert_eq_m128i(r, e);
     }
@@ -51049,9 +51049,9 @@ fn test_mm_mask_cvtps_ph() {
     #[simd_test(enable = "avx512f,avx512vl")]
     fn test_mm_maskz_cvtps_ph() {
         let a = _mm_set1_ps(1.);
-        let r = _mm_maskz_cvtps_ph::<_MM_FROUND_NO_EXC>(0, a);
+        let r = _mm_maskz_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(0, a);
         assert_eq_m128i(r, _mm_setzero_si128());
-        let r = _mm_maskz_cvtps_ph::<_MM_FROUND_NO_EXC>(0b00001111, a);
+        let r = _mm_maskz_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(0b00001111, a);
         let e = _mm_setr_epi64x(4323521613979991040, 0);
         assert_eq_m128i(r, e);
     }
diff --git a/library/stdarch/crates/core_arch/src/x86/clflushopt.rs b/library/stdarch/crates/core_arch/src/x86/clflushopt.rs
new file mode 100644
index 0000000..07d5a9c
--- /dev/null
+++ b/library/stdarch/crates/core_arch/src/x86/clflushopt.rs
@@ -0,0 +1,51 @@
+//! `CLFLUSHOPT` cache-line flush.
+
+#[cfg(test)]
+use stdarch_test::assert_instr;
+
+#[allow(improper_ctypes)]
+unsafe extern "unadjusted" {
+    #[link_name = "llvm.x86.clflushopt"]
+    fn clflushopt(p: *const u8);
+}
+
+/// Invalidates from every level of the cache hierarchy the cache line that
+/// contains `p`.
+///
+/// Unlike [`_mm_clflush`], `CLFLUSHOPT` is only ordered with respect to older
+/// writes to the flushed cache line and with respect to fence/locked
+/// operations; it is *not* serialized against other `CLFLUSHOPT`/`CLFLUSH`
+/// instructions or unrelated stores. This makes flushing a range of lines
+/// substantially faster, but a fence (e.g. [`_mm_sfence`] or [`_mm_mfence`]) is
+/// required afterward to order the flushes against subsequent operations.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_clflushopt)
+///
+/// # Safety
+///
+/// Unlike the prefetch intrinsics, `CLFLUSHOPT` is subject to all the
+/// permission checking and faults associated with a byte load, so `p` must
+/// point to a byte that is valid for reads.
+///
+/// [`_mm_clflush`]: crate::arch::x86::_mm_clflush
+/// [`_mm_sfence`]: crate::arch::x86::_mm_sfence
+/// [`_mm_mfence`]: crate::arch::x86::_mm_mfence
+#[inline]
+#[target_feature(enable = "clflushopt")]
+#[cfg_attr(test, assert_instr(clflushopt))]
+#[unstable(feature = "simd_x86_clflushopt", issue = "157096")]
+pub unsafe fn _mm_clflushopt(p: *const u8) {
+    clflushopt(p);
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::core_arch::x86::*;
+    use stdarch_test::simd_test;
+
+    #[simd_test(enable = "clflushopt")]
+    unsafe fn test_mm_clflushopt() {
+        let x = 0_u8;
+        _mm_clflushopt(core::ptr::addr_of!(x));
+    }
+}
diff --git a/library/stdarch/crates/core_arch/src/x86/f16c.rs b/library/stdarch/crates/core_arch/src/x86/f16c.rs
index a0bb992..62a9f00 100644
--- a/library/stdarch/crates/core_arch/src/x86/f16c.rs
+++ b/library/stdarch/crates/core_arch/src/x86/f16c.rs
@@ -56,10 +56,10 @@ pub const fn _mm256_cvtph_ps(a: __m128i) -> __m256 {
 ///
 /// Rounding is done according to the `imm_rounding` parameter, which can be one of:
 ///
-/// * [`_MM_FROUND_TO_NEAREST_INT`] | [`_MM_FROUND_NO_EXC`] : round to nearest and suppress exceptions
-/// * [`_MM_FROUND_TO_NEG_INF`] | [`_MM_FROUND_NO_EXC`] : round down and suppress exceptions
-/// * [`_MM_FROUND_TO_POS_INF`] | [`_MM_FROUND_NO_EXC`] : round up and suppress exceptions
-/// * [`_MM_FROUND_TO_ZERO`] | [`_MM_FROUND_NO_EXC`] : truncate and suppress exceptions
+/// * [`_MM_FROUND_TO_NEAREST_INT`] : round to nearest
+/// * [`_MM_FROUND_TO_NEG_INF`] : round down
+/// * [`_MM_FROUND_TO_POS_INF`] : round up
+/// * [`_MM_FROUND_TO_ZERO`] : truncate
 /// * [`_MM_FROUND_CUR_DIRECTION`] : use `MXCSR.RC` - see [`_MM_SET_ROUNDING_MODE`]
 ///
 /// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cvtps_ph)
@@ -69,7 +69,7 @@ pub const fn _mm256_cvtph_ps(a: __m128i) -> __m256 {
 #[rustc_legacy_const_generics(1)]
 #[stable(feature = "x86_f16c_intrinsics", since = "1.68.0")]
 pub fn _mm_cvtps_ph<const IMM_ROUNDING: i32>(a: __m128) -> __m128i {
-    static_assert_uimm_bits!(IMM_ROUNDING, 3);
+    static_assert_round_mode!(IMM_ROUNDING);
     unsafe {
         let a = a.as_f32x4();
         let r = llvm_vcvtps2ph_128(a, IMM_ROUNDING);
@@ -82,10 +82,10 @@ pub fn _mm_cvtps_ph<const IMM_ROUNDING: i32>(a: __m128) -> __m128i {
 ///
 /// Rounding is done according to the `imm_rounding` parameter, which can be one of:
 ///
-/// * [`_MM_FROUND_TO_NEAREST_INT`] | [`_MM_FROUND_NO_EXC`] : round to nearest and suppress exceptions
-/// * [`_MM_FROUND_TO_NEG_INF`] | [`_MM_FROUND_NO_EXC`] : round down and suppress exceptions
-/// * [`_MM_FROUND_TO_POS_INF`] | [`_MM_FROUND_NO_EXC`] : round up and suppress exceptions
-/// * [`_MM_FROUND_TO_ZERO`] | [`_MM_FROUND_NO_EXC`] : truncate and suppress exceptions
+/// * [`_MM_FROUND_TO_NEAREST_INT`] : round to nearest
+/// * [`_MM_FROUND_TO_NEG_INF`] : round down
+/// * [`_MM_FROUND_TO_POS_INF`] : round up
+/// * [`_MM_FROUND_TO_ZERO`] : truncate
 /// * [`_MM_FROUND_CUR_DIRECTION`] : use `MXCSR.RC` - see [`_MM_SET_ROUNDING_MODE`]
 ///
 /// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtps_ph)
@@ -95,7 +95,7 @@ pub fn _mm_cvtps_ph<const IMM_ROUNDING: i32>(a: __m128) -> __m128i {
 #[rustc_legacy_const_generics(1)]
 #[stable(feature = "x86_f16c_intrinsics", since = "1.68.0")]
 pub fn _mm256_cvtps_ph<const IMM_ROUNDING: i32>(a: __m256) -> __m128i {
-    static_assert_uimm_bits!(IMM_ROUNDING, 3);
+    static_assert_round_mode!(IMM_ROUNDING);
     unsafe {
         let a = a.as_f32x8();
         let r = llvm_vcvtps2ph_256(a, IMM_ROUNDING);
diff --git a/library/stdarch/crates/core_arch/src/x86/macros.rs b/library/stdarch/crates/core_arch/src/x86/macros.rs
index 9b9c24a..739abbe 100644
--- a/library/stdarch/crates/core_arch/src/x86/macros.rs
+++ b/library/stdarch/crates/core_arch/src/x86/macros.rs
@@ -3,6 +3,15 @@
 // Helper macro used to trigger const eval errors when the const generic immediate value `imm` is
 // not a round number.
 #[allow(unused)]
+macro_rules! static_assert_round_mode {
+    ($imm:ident) => {
+        static_assert!($imm >= 0 && $imm < 5, "Invalid IMM value")
+    };
+}
+
+// Helper macro used to trigger const eval errors when the const generic immediate value `imm` is
+// not a round number.
+#[allow(unused)]
 macro_rules! static_assert_rounding {
     ($imm:ident) => {
         static_assert!(
diff --git a/library/stdarch/crates/core_arch/src/x86/mod.rs b/library/stdarch/crates/core_arch/src/x86/mod.rs
index f5a8acb..fbf1002 100644
--- a/library/stdarch/crates/core_arch/src/x86/mod.rs
+++ b/library/stdarch/crates/core_arch/src/x86/mod.rs
@@ -692,6 +692,10 @@ pub(crate) const fn $as_from(self) -> $from {
 #[stable(feature = "simd_x86_adx", since = "1.33.0")]
 pub use self::adx::*;
 
+mod clflushopt;
+#[unstable(feature = "simd_x86_clflushopt", issue = "157096")]
+pub use self::clflushopt::*;
+
 #[cfg(test)]
 use stdarch_test::assert_instr;
 
diff --git a/library/stdarch/crates/core_arch/src/x86/sse2.rs b/library/stdarch/crates/core_arch/src/x86/sse2.rs
index 1f97f3c..6271970 100644
--- a/library/stdarch/crates/core_arch/src/x86/sse2.rs
+++ b/library/stdarch/crates/core_arch/src/x86/sse2.rs
@@ -29,6 +29,12 @@ pub fn _mm_pause() {
 /// the cache hierarchy.
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_clflush)
+///
+/// # Safety
+///
+/// Unlike the prefetch intrinsics, `CLFLUSH` is subject to all the permission
+/// checking and faults associated with a byte load, so `p` must point to a
+/// byte that is valid for reads.
 #[inline]
 #[target_feature(enable = "sse2")]
 #[cfg_attr(test, assert_instr(clflush))]
diff --git a/library/stdarch/crates/core_arch/src/x86_64/amx.rs b/library/stdarch/crates/core_arch/src/x86_64/amx.rs
index b3b3e86..cddae18 100644
--- a/library/stdarch/crates/core_arch/src/x86_64/amx.rs
+++ b/library/stdarch/crates/core_arch/src/x86_64/amx.rs
@@ -1,14 +1,34 @@
+use crate::core_arch::x86_64::{__tile1024i, Tile};
 use crate::core_arch::{simd::*, x86::*};
 
 #[cfg(test)]
 use stdarch_test::assert_instr;
 
-/// Load tile configuration from a 64-byte memory location specified by mem_addr.
+/// Load tile configuration from a 64-byte memory location specified by `mem_addr`.
 /// The tile configuration format is specified below, and includes the tile type pallette,
 /// the number of bytes per row, and the number of rows. If the specified pallette_id is zero,
 /// that signifies the init state for both the tile config and the tile data, and the tiles are zeroed.
 /// Any invalid configurations will result in #GP fault.
 ///
+/// ```intel
+/// //	format of memory payload. each field is a byte.
+///		 0: palette
+///		 1: start_row
+///	  2-15: reserved, must be zero
+///	 16-17: tile0.colsb
+///	 18-19: tile1.colsb
+///	 20-21: tile2.colsb
+///			...
+///	 30-31: tile7.colsb
+///	 32-47: reserved, must be zero
+///		48: tile0.rows
+///		49: tile1.rows
+///		50: tile2.rows
+///			 ...
+///		55: tile7.rows
+///	 56-63: reserved, must be zero
+/// ```
+///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_tile_loadconfig&ig_expand=6875)
 #[inline]
 #[target_feature(enable = "amx-tile")]
@@ -18,8 +38,8 @@ pub unsafe fn _tile_loadconfig(mem_addr: *const u8) {
     ldtilecfg(mem_addr);
 }
 
-/// Stores the current tile configuration to a 64-byte memory location specified by mem_addr.
-/// The tile configuration format is specified below, and includes the tile type pallette,
+/// Stores the current tile configuration to a 64-byte memory location specified by `mem_addr`.
+/// The tile configuration format is as specified in [`_tile_loadconfig`], and includes the tile type pallette,
 /// the number of bytes per row, and the number of rows. If tiles are not configured, all zeroes will be stored to memory.
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_tile_storeconfig&ig_expand=6879)
@@ -31,7 +51,7 @@ pub unsafe fn _tile_storeconfig(mem_addr: *mut u8) {
     sttilecfg(mem_addr);
 }
 
-/// Load tile rows from memory specifieid by base address and stride into destination tile dst using the tile configuration previously configured via _tile_loadconfig.
+/// Load tile rows from memory specified by base address and stride into destination tile dst using the tile configuration previously configured via [`_tile_loadconfig`].
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_tile_loadd&ig_expand=6877)
 #[inline]
@@ -41,7 +61,19 @@ pub unsafe fn _tile_storeconfig(mem_addr: *mut u8) {
 #[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
 pub unsafe fn _tile_loadd<const DST: i32>(base: *const u8, stride: usize) {
     static_assert_uimm_bits!(DST, 3);
-    tileloadd64(DST as i8, base, stride);
+    tileloadd64(DST as i8, base, stride as u64);
+}
+
+/// Load tile rows from memory specified by base address and stride into destination tile dst. The shape
+/// of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_loadd&ig_expand=6877)
+#[inline]
+#[target_feature(enable = "amx-tile")]
+#[cfg_attr(test, assert_instr(tileloadd))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_loadd(dst: *mut __tile1024i, base: *const u8, stride: usize) {
+    (*dst).tile = tileloadd64_internal((*dst).rows, (*dst).colsb, base, stride as u64);
 }
 
 /// Release the tile configuration to return to the init state, which releases all storage it currently holds.
@@ -55,7 +87,7 @@ pub unsafe fn _tile_release() {
     tilerelease();
 }
 
-/// Store the tile specified by src to memory specifieid by base address and stride using the tile configuration previously configured via _tile_loadconfig.
+/// Store the tile specified by src to memory specified by base address and stride using the tile configuration previously configured via [`_tile_loadconfig`].
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_tile_stored&ig_expand=6881)
 #[inline]
@@ -65,11 +97,23 @@ pub unsafe fn _tile_release() {
 #[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
 pub unsafe fn _tile_stored<const DST: i32>(base: *mut u8, stride: usize) {
     static_assert_uimm_bits!(DST, 3);
-    tilestored64(DST as i8, base, stride);
+    tilestored64(DST as i8, base, stride as u64);
 }
 
-/// Load tile rows from memory specifieid by base address and stride into destination tile dst using the tile configuration
-/// previously configured via _tile_loadconfig. This intrinsic provides a hint to the implementation that the data will
+/// Store the tile specified by src to memory specified by base address and stride. The shape of the tile
+/// is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_stored&ig_expand=6881)
+#[inline]
+#[target_feature(enable = "amx-tile")]
+#[cfg_attr(test, assert_instr(tilestored))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_stored(base: *mut u8, stride: usize, src: __tile1024i) {
+    tilestored64_internal(src.rows, src.colsb, base, stride as u64, src.tile);
+}
+
+/// Load tile rows from memory specified by base address and stride into destination tile dst using the tile configuration
+/// previously configured via [`_tile_loadconfig`]. This intrinsic provides a hint to the implementation that the data will
 /// likely not be reused in the near future and the data caching can be optimized accordingly.
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_tile_stream_loadd&ig_expand=6883)
@@ -80,10 +124,24 @@ pub unsafe fn _tile_stored<const DST: i32>(base: *mut u8, stride: usize) {
 #[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
 pub unsafe fn _tile_stream_loadd<const DST: i32>(base: *const u8, stride: usize) {
     static_assert_uimm_bits!(DST, 3);
-    tileloaddt164(DST as i8, base, stride);
+    tileloaddt164(DST as i8, base, stride as u64);
 }
 
-/// Zero the tile specified by tdest.
+/// Load tile rows from memory specified by base address and stride into destination tile dst. The shape
+/// of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+/// This intrinsic provides a hint to the implementation that the data will likely not be reused in the
+/// near future and the data caching can be optimized accordingly.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_stream_loadd&ig_expand=6883)
+#[inline]
+#[target_feature(enable = "amx-tile")]
+#[cfg_attr(test, assert_instr(tileloaddt1))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_stream_loadd(dst: *mut __tile1024i, base: *const u8, stride: usize) {
+    (*dst).tile = tileloaddt164_internal((*dst).rows, (*dst).colsb, base, stride as u64);
+}
+
+/// Zero the tile specified by `tdest`.
 ///
 /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_tile_zero&ig_expand=6885)
 #[inline]
@@ -96,6 +154,18 @@ pub unsafe fn _tile_zero<const DST: i32>() {
     tilezero(DST as i8);
 }
 
+/// Zero the tile specified by `dst`. The shape of the tile is specified in the struct of [`__tile1024i`].
+/// The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_zero&ig_expand=6885)
+#[inline]
+#[target_feature(enable = "amx-tile")]
+#[cfg_attr(test, assert_instr(tilezero))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_zero(dst: *mut __tile1024i) {
+    (*dst).tile = tilezero_internal((*dst).rows, (*dst).colsb);
+}
+
 /// Compute dot-product of BF16 (16-bit) floating-point pairs in tiles a and b,
 /// accumulating the intermediate single-precision (32-bit) floating-point elements
 /// with elements in dst, and store the 32-bit result back to tile dst.
@@ -113,6 +183,20 @@ pub unsafe fn _tile_dpbf16ps<const DST: i32, const A: i32, const B: i32>() {
     tdpbf16ps(DST as i8, A as i8, B as i8);
 }
 
+/// Compute dot-product of FP16 (16-bit) floating-point pairs in tiles a and b,
+/// accumulating the intermediate single-precision (32-bit) floating-point elements
+/// with elements in dst, and store the 32-bit result back to tile dst. The shape of the tile
+/// is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbf16ps&ig_expand=6864)
+#[inline]
+#[target_feature(enable = "amx-bf16")]
+#[cfg_attr(test, assert_instr(tdpbf16ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dpbf16ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdpbf16ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Compute dot-product of bytes in tiles with a source/destination accumulator.
 /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding
 /// signed 8-bit integers in b, producing 4 intermediate 32-bit results.
@@ -133,6 +217,21 @@ pub unsafe fn _tile_dpbssd<const DST: i32, const A: i32, const B: i32>() {
 
 /// Compute dot-product of bytes in tiles with a source/destination accumulator.
 /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding
+/// signed 8-bit integers in b, producing 4 intermediate 32-bit results.
+/// Sum these 4 results with the corresponding 32-bit integer in dst, and store the 32-bit result back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbssd&ig_expand=6866)
+#[inline]
+#[target_feature(enable = "amx-int8")]
+#[cfg_attr(test, assert_instr(tdpbssd))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dpbssd(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdpbssd_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
+/// Compute dot-product of bytes in tiles with a source/destination accumulator.
+/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding
 /// unsigned 8-bit integers in b, producing 4 intermediate 32-bit results.
 /// Sum these 4 results with the corresponding 32-bit integer in dst, and store the 32-bit result back to tile dst.
 ///
@@ -150,6 +249,21 @@ pub unsafe fn _tile_dpbsud<const DST: i32, const A: i32, const B: i32>() {
 }
 
 /// Compute dot-product of bytes in tiles with a source/destination accumulator.
+/// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding
+/// unsigned 8-bit integers in b, producing 4 intermediate 32-bit results.
+/// Sum these 4 results with the corresponding 32-bit integer in dst, and store the 32-bit result back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbsud&ig_expand=6868)
+#[inline]
+#[target_feature(enable = "amx-int8")]
+#[cfg_attr(test, assert_instr(tdpbsud))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dpbsud(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdpbsud_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
+/// Compute dot-product of bytes in tiles with a source/destination accumulator.
 /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding
 /// signed 8-bit integers in b, producing 4 intermediate 32-bit results.
 /// Sum these 4 results with the corresponding 32-bit integer in dst, and store the 32-bit result back to tile dst.
@@ -169,6 +283,21 @@ pub unsafe fn _tile_dpbusd<const DST: i32, const A: i32, const B: i32>() {
 
 /// Compute dot-product of bytes in tiles with a source/destination accumulator.
 /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding
+/// signed 8-bit integers in b, producing 4 intermediate 32-bit results.
+/// Sum these 4 results with the corresponding 32-bit integer in dst, and store the 32-bit result back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbusd&ig_expand=6870)
+#[inline]
+#[target_feature(enable = "amx-int8")]
+#[cfg_attr(test, assert_instr(tdpbusd))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dpbusd(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdpbusd_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
+/// Compute dot-product of bytes in tiles with a source/destination accumulator.
+/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding
 /// unsigned 8-bit integers in b, producing 4 intermediate 32-bit results.
 /// Sum these 4 results with the corresponding 32-bit integer in dst, and store the 32-bit result back to tile dst.
 ///
@@ -185,6 +314,21 @@ pub unsafe fn _tile_dpbuud<const DST: i32, const A: i32, const B: i32>() {
     tdpbuud(DST as i8, A as i8, B as i8);
 }
 
+/// Compute dot-product of bytes in tiles with a source/destination accumulator.
+/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding
+/// unsigned 8-bit integers in b, producing 4 intermediate 32-bit results.
+/// Sum these 4 results with the corresponding 32-bit integer in dst, and store the 32-bit result back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpbuud&ig_expand=6872)
+#[inline]
+#[target_feature(enable = "amx-int8")]
+#[cfg_attr(test, assert_instr(tdpbuud))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dpbuud(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdpbuud_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Compute dot-product of FP16 (16-bit) floating-point pairs in tiles a and b,
 /// accumulating the intermediate single-precision (32-bit) floating-point elements
 ///  with elements in dst, and store the 32-bit result back to tile dst.
@@ -202,6 +346,20 @@ pub unsafe fn _tile_dpfp16ps<const DST: i32, const A: i32, const B: i32>() {
     tdpfp16ps(DST as i8, A as i8, B as i8);
 }
 
+/// Compute dot-product of FP16 (16-bit) floating-point pairs in tiles a and b,
+/// accumulating the intermediate single-precision (32-bit) floating-point elements
+///  with elements in dst, and store the 32-bit result back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_dpfp16ps&ig_expand=6874)
+#[inline]
+#[target_feature(enable = "amx-fp16")]
+#[cfg_attr(test, assert_instr(tdpfp16ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dpfp16ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdpfp16ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Perform matrix multiplication of two tiles containing complex elements and accumulate the results into a packed single precision tile.
 /// Each dword element in input tiles a and b is interpreted as a complex number with FP16 real part and FP16 imaginary part.
 /// Calculates the imaginary part of the result. For each possible combination of (row of a, column of b),
@@ -225,6 +383,24 @@ pub unsafe fn _tile_cmmimfp16ps<const DST: i32, const A: i32, const B: i32>() {
 
 /// Perform matrix multiplication of two tiles containing complex elements and accumulate the results into a packed single precision tile.
 /// Each dword element in input tiles a and b is interpreted as a complex number with FP16 real part and FP16 imaginary part.
+/// Calculates the imaginary part of the result. For each possible combination of (row of a, column of b),
+/// it performs a set of multiplication and accumulations on all corresponding complex numbers (one from a and one from b).
+/// The imaginary part of the a element is multiplied with the real part of the corresponding b element, and the real part of
+/// the a element is multiplied with the imaginary part of the corresponding b elements. The two accumulated results are added,
+/// and then accumulated into the corresponding row and column of dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_cmmimfp16ps&ig_expand=6860)
+#[inline]
+#[target_feature(enable = "amx-complex")]
+#[cfg_attr(test, assert_instr(tcmmimfp16ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_cmmimfp16ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tcmmimfp16ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
+/// Perform matrix multiplication of two tiles containing complex elements and accumulate the results into a packed single precision tile.
+/// Each dword element in input tiles a and b is interpreted as a complex number with FP16 real part and FP16 imaginary part.
 /// Calculates the real part of the result. For each possible combination of (row of a, column of b),
 /// it performs a set of multiplication and accumulations on all corresponding complex numbers (one from a and one from b).
 /// The real part of the a element is multiplied with the real part of the corresponding b element, and the negated imaginary part of
@@ -244,6 +420,24 @@ pub unsafe fn _tile_cmmrlfp16ps<const DST: i32, const A: i32, const B: i32>() {
     tcmmrlfp16ps(DST as i8, A as i8, B as i8);
 }
 
+/// Perform matrix multiplication of two tiles containing complex elements and accumulate the results into a packed single precision tile.
+/// Each dword element in input tiles a and b is interpreted as a complex number with FP16 real part and FP16 imaginary part.
+/// Calculates the real part of the result. For each possible combination of (row of a, column of b),
+/// it performs a set of multiplication and accumulations on all corresponding complex numbers (one from a and one from b).
+/// The real part of the a element is multiplied with the real part of the corresponding b element, and the negated imaginary part of
+/// the a element is multiplied with the imaginary part of the corresponding b elements.
+/// The two accumulated results are added, and then accumulated into the corresponding row and column of dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=__tile_cmmrlfp16ps&ig_expand=6862)
+#[inline]
+#[target_feature(enable = "amx-complex")]
+#[cfg_attr(test, assert_instr(tcmmrlfp16ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_cmmrlfp16ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tcmmrlfp16ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Compute dot-product of BF8 (8-bit E5M2) floating-point elements in tile a and BF8 (8-bit E5M2)
 /// floating-point elements in tile b, accumulating the intermediate single-precision
 /// (32-bit) floating-point elements with elements in dst, and store the 32-bit result
@@ -263,6 +457,19 @@ pub unsafe fn _tile_dpbf8ps<const DST: i32, const A: i32, const B: i32>() {
     tdpbf8ps(DST as i8, A as i8, B as i8);
 }
 
+/// Compute dot-product of BF8 (8-bit E5M2) floating-point elements in tile a and BF8 (8-bit E5M2)
+/// floating-point elements in tile b, accumulating the intermediate single-precision
+/// (32-bit) floating-point elements with elements in dst, and store the 32-bit result
+/// back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-fp8")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdpbf8ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dpbf8ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdpbf8ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Compute dot-product of BF8 (8-bit E5M2) floating-point elements in tile a and HF8
 /// (8-bit E4M3) floating-point elements in tile b, accumulating the intermediate single-precision
 /// (32-bit) floating-point elements with elements in dst, and store the 32-bit result
@@ -282,6 +489,19 @@ pub unsafe fn _tile_dpbhf8ps<const DST: i32, const A: i32, const B: i32>() {
     tdpbhf8ps(DST as i8, A as i8, B as i8);
 }
 
+/// Compute dot-product of BF8 (8-bit E5M2) floating-point elements in tile a and HF8
+/// (8-bit E4M3) floating-point elements in tile b, accumulating the intermediate single-precision
+/// (32-bit) floating-point elements with elements in dst, and store the 32-bit result
+/// back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-fp8")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdpbhf8ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dpbhf8ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdpbhf8ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Compute dot-product of HF8 (8-bit E4M3) floating-point elements in tile a and BF8
 /// (8-bit E5M2) floating-point elements in tile b, accumulating the intermediate single-precision
 /// (32-bit) floating-point elements with elements in dst, and store the 32-bit result
@@ -301,6 +521,19 @@ pub unsafe fn _tile_dphbf8ps<const DST: i32, const A: i32, const B: i32>() {
     tdphbf8ps(DST as i8, A as i8, B as i8);
 }
 
+/// Compute dot-product of HF8 (8-bit E4M3) floating-point elements in tile a and BF8
+/// (8-bit E5M2) floating-point elements in tile b, accumulating the intermediate single-precision
+/// (32-bit) floating-point elements with elements in dst, and store the 32-bit result
+/// back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-fp8")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdphbf8ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dphbf8ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdphbf8ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Compute dot-product of HF8 (8-bit E4M3) floating-point elements in tile a and HF8 (8-bit E4M3)
 /// floating-point elements in tile b, accumulating the intermediate single-precision
 /// (32-bit) floating-point elements with elements in dst, and store the 32-bit result
@@ -320,8 +553,21 @@ pub unsafe fn _tile_dphf8ps<const DST: i32, const A: i32, const B: i32>() {
     tdphf8ps(DST as i8, A as i8, B as i8);
 }
 
+/// Compute dot-product of HF8 (8-bit E4M3) floating-point elements in tile a and HF8 (8-bit E4M3)
+/// floating-point elements in tile b, accumulating the intermediate single-precision
+/// (32-bit) floating-point elements with elements in dst, and store the 32-bit result
+/// back to tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-fp8")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tdphf8ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_dphf8ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tdphf8ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Load tile rows from memory specified by base address and stride into destination tile dst
-/// using the tile configuration previously configured via _tile_loadconfig.
+/// using the tile configuration previously configured via [`_tile_loadconfig`].
 /// Additionally, this intrinsic indicates the source memory location is likely to become
 /// read-shared by multiple processors, i.e., read in the future by at least one other processor
 /// before it is written, assuming it is ever written in the future.
@@ -335,11 +581,24 @@ pub unsafe fn _tile_dphf8ps<const DST: i32, const A: i32, const B: i32>() {
 #[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
 pub unsafe fn _tile_loaddrs<const DST: i32>(base: *const u8, stride: usize) {
     static_assert_uimm_bits!(DST, 3);
-    tileloaddrs64(DST as i8, base, stride);
+    tileloaddrs64(DST as i8, base, stride as u64);
+}
+
+/// Load tile rows from memory specified by base address and stride into destination tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+/// Additionally, this intrinsic indicates the source memory location is likely to become
+/// read-shared by multiple processors, i.e., read in the future by at least one other processor
+/// before it is written, assuming it is ever written in the future.
+#[inline]
+#[target_feature(enable = "amx-movrs")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tileloaddrs))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_loaddrs(dst: *mut __tile1024i, base: *const u8, stride: usize) {
+    (*dst).tile = tileloaddrs64_internal((*dst).rows, (*dst).colsb, base, stride as u64);
 }
 
 /// Load tile rows from memory specified by base address and stride into destination tile dst
-/// using the tile configuration previously configured via _tile_loadconfig.
+/// using the tile configuration previously configured via [`_tile_loadconfig`].
 /// Provides a hint to the implementation that the data would be reused but does not need
 /// to be resident in the nearest cache levels.
 /// Additionally, this intrinsic indicates the source memory location is likely to become
@@ -355,7 +614,22 @@ pub unsafe fn _tile_loaddrs<const DST: i32>(base: *const u8, stride: usize) {
 #[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
 pub unsafe fn _tile_stream_loaddrs<const DST: i32>(base: *const u8, stride: usize) {
     static_assert_uimm_bits!(DST, 3);
-    tileloaddrst164(DST as i8, base, stride);
+    tileloaddrst164(DST as i8, base, stride as u64);
+}
+
+/// Load tile rows from memory specified by base address and stride into destination tile dst.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+/// Provides a hint to the implementation that the data would be reused but does not need
+/// to be resident in the nearest cache levels.
+/// Additionally, this intrinsic indicates the source memory location is likely to become
+/// read-shared by multiple processors, i.e., read in the future by at least one other processor
+/// before it is written, assuming it is ever written in the future.
+#[inline]
+#[target_feature(enable = "amx-movrs")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tileloaddrst1))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_stream_loaddrs(dst: *mut __tile1024i, base: *const u8, stride: usize) {
+    (*dst).tile = tileloaddrst164_internal((*dst).rows, (*dst).colsb, base, stride as u64);
 }
 
 /// Perform matrix multiplication of two tiles a and b, containing packed single precision (32-bit)
@@ -383,6 +657,25 @@ pub unsafe fn _tile_mmultf32ps<const DST: i32, const A: i32, const B: i32>() {
     tmmultf32ps(DST as i8, A as i8, B as i8);
 }
 
+/// Perform matrix multiplication of two tiles a and b, containing packed single precision (32-bit)
+/// floating-point elements, which are converted to TF32 (tensor-float32) format, and accumulate the
+///  results into a packed single precision tile.
+/// For each possible combination of (row of a, column of b), it performs
+///  - convert to TF32
+///  - multiply the corresponding elements of a and b
+///  - accumulate the results into the corresponding row and column of dst using round-to-nearest-even
+/// rounding mode.
+/// Output FP32 denormals are always flushed to zero, input single precision denormals are always
+/// handled and *not* treated as zero.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-tf32")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tmmultf32ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_mmultf32ps(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
+    (*dst).tile = tmmultf32ps_internal(a.rows, b.colsb, a.colsb, (*dst).tile, a.tile, b.tile);
+}
+
 /// Moves a row from a tile register to a zmm register, converting the packed 32-bit signed integer
 /// elements to packed single-precision (32-bit) floating-point elements.
 #[inline]
@@ -414,6 +707,17 @@ pub unsafe fn _tile_cvtrowd2psi<const TILE: i32, const ROW: i32>() -> __m512 {
     tcvtrowd2psi(TILE as i8, ROW as u32).as_m512()
 }
 
+/// Moves a row from a tile register to a zmm register, converting the packed 32-bit signed integer
+/// elements to packed single-precision (32-bit) floating-point elements.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-avx512,avx10.2")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowd2ps))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_cvtrowd2ps(src: __tile1024i, row: u32) -> __m512 {
+    tcvtrowd2ps_internal(src.rows, src.colsb, src.tile, row).as_m512()
+}
+
 /// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit)
 /// floating-point elements to packed half-precision (16-bit) floating-point elements. The resulting
 /// 16-bit elements are placed in the high 16-bits within each 32-bit element of the returned vector.
@@ -449,6 +753,18 @@ pub unsafe fn _tile_cvtrowps2phhi<const TILE: i32, const ROW: i32>() -> __m512h
 
 /// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit)
 /// floating-point elements to packed half-precision (16-bit) floating-point elements. The resulting
+/// 16-bit elements are placed in the high 16-bits within each 32-bit element of the returned vector.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-avx512,avx10.2")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2phh))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_cvtrowps2phh(src: __tile1024i, row: u32) -> __m512h {
+    tcvtrowps2phh_internal(src.rows, src.colsb, src.tile, row).as_m512h()
+}
+
+/// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit)
+/// floating-point elements to packed half-precision (16-bit) floating-point elements. The resulting
 /// 16-bit elements are placed in the low 16-bits within each 32-bit element of the returned vector.
 #[inline]
 #[rustc_legacy_const_generics(0)]
@@ -481,6 +797,18 @@ pub unsafe fn _tile_cvtrowps2phli<const TILE: i32, const ROW: i32>() -> __m512h
 }
 
 /// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit)
+/// floating-point elements to packed half-precision (16-bit) floating-point elements. The resulting
+/// 16-bit elements are placed in the low 16-bits within each 32-bit element of the returned vector.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-avx512,avx10.2")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2phl))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_cvtrowps2phl(src: __tile1024i, row: u32) -> __m512h {
+    tcvtrowps2phl_internal(src.rows, src.colsb, src.tile, row).as_m512h()
+}
+
+/// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit)
 /// floating-point elements to packed BF16 (16-bit) floating-point elements. The resulting
 /// 16-bit elements are placed in the high 16-bits within each 32-bit element of the returned vector.
 #[inline]
@@ -515,6 +843,18 @@ pub unsafe fn _tile_cvtrowps2bf16hi<const TILE: i32, const ROW: i32>() -> __m512
 
 /// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit)
 /// floating-point elements to packed BF16 (16-bit) floating-point elements. The resulting
+/// 16-bit elements are placed in the high 16-bits within each 32-bit element of the returned vector.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-avx512,avx10.2")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2bf16h))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_cvtrowps2bf16h(src: __tile1024i, row: u32) -> __m512bh {
+    tcvtrowps2bf16h_internal(src.rows, src.colsb, src.tile, row).as_m512bh()
+}
+
+/// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit)
+/// floating-point elements to packed BF16 (16-bit) floating-point elements. The resulting
 /// 16-bit elements are placed in the low 16-bits within each 32-bit element of the returned vector.
 #[inline]
 #[rustc_legacy_const_generics(0)]
@@ -546,6 +886,18 @@ pub unsafe fn _tile_cvtrowps2bf16li<const TILE: i32, const ROW: i32>() -> __m512
     tcvtrowps2bf16li(TILE as i8, ROW as u32).as_m512bh()
 }
 
+/// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit)
+/// floating-point elements to packed BF16 (16-bit) floating-point elements. The resulting
+/// 16-bit elements are placed in the low 16-bits within each 32-bit element of the returned vector.
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-avx512,avx10.2")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tcvtrowps2bf16l))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_cvtrowps2bf16l(src: __tile1024i, row: u32) -> __m512bh {
+    tcvtrowps2bf16l_internal(src.rows, src.colsb, src.tile, row).as_m512bh()
+}
+
 /// Moves one row of tile data into a zmm vector register
 #[inline]
 #[rustc_legacy_const_generics(0)]
@@ -575,83 +927,169 @@ pub unsafe fn _tile_movrowi<const TILE: i32, const ROW: i32>() -> __m512i {
     tilemovrowi(TILE as i8, ROW as u32).as_m512i()
 }
 
+/// Moves one row of tile data into a zmm vector register
+/// The shape of the tile is specified in the struct of [`__tile1024i`]. The register of the tile is allocated by the compiler.
+#[inline]
+#[target_feature(enable = "amx-avx512,avx10.2")]
+#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(tilemovrow))]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub unsafe fn __tile_movrow(src: __tile1024i, row: u32) -> __m512i {
+    tilemovrow_internal(src.rows, src.colsb, src.tile, row).as_m512i()
+}
+
 #[allow(improper_ctypes)]
-unsafe extern "C" {
+unsafe extern "unadjusted" {
     #[link_name = "llvm.x86.ldtilecfg"]
     fn ldtilecfg(mem_addr: *const u8);
     #[link_name = "llvm.x86.sttilecfg"]
     fn sttilecfg(mem_addr: *mut u8);
+
     #[link_name = "llvm.x86.tileloadd64"]
-    fn tileloadd64(dst: i8, base: *const u8, stride: usize);
+    fn tileloadd64(dst: i8, base: *const u8, stride: u64);
+    #[link_name = "llvm.x86.tileloadd64.internal"]
+    fn tileloadd64_internal(rows: u16, colsb: u16, base: *const u8, stride: u64) -> Tile;
+
     #[link_name = "llvm.x86.tileloaddt164"]
-    fn tileloaddt164(dst: i8, base: *const u8, stride: usize);
+    fn tileloaddt164(dst: i8, base: *const u8, stride: u64);
+    #[link_name = "llvm.x86.tileloaddt164.internal"]
+    fn tileloaddt164_internal(rows: u16, colsb: u16, base: *const u8, stride: u64) -> Tile;
+
     #[link_name = "llvm.x86.tilerelease"]
     fn tilerelease();
+
     #[link_name = "llvm.x86.tilestored64"]
-    fn tilestored64(dst: i8, base: *mut u8, stride: usize);
+    fn tilestored64(dst: i8, base: *mut u8, stride: u64);
+    #[link_name = "llvm.x86.tilestored64.internal"]
+    fn tilestored64_internal(rows: u16, colsb: u16, base: *mut u8, stride: u64, src: Tile);
+
     #[link_name = "llvm.x86.tilezero"]
     fn tilezero(dst: i8);
+    #[link_name = "llvm.x86.tilezero.internal"]
+    fn tilezero_internal(rows: u16, colsb: u16) -> Tile;
+
     #[link_name = "llvm.x86.tdpbf16ps"]
     fn tdpbf16ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdpbf16ps.internal"]
+    fn tdpbf16ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdpbuud"]
     fn tdpbuud(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdpbuud.internal"]
+    fn tdpbuud_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdpbusd"]
     fn tdpbusd(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdpbusd.internal"]
+    fn tdpbusd_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdpbsud"]
     fn tdpbsud(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdpbsud.internal"]
+    fn tdpbsud_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdpbssd"]
     fn tdpbssd(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdpbssd.internal"]
+    fn tdpbssd_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdpfp16ps"]
     fn tdpfp16ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdpfp16ps.internal"]
+    fn tdpfp16ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tcmmimfp16ps"]
     fn tcmmimfp16ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tcmmimfp16ps.internal"]
+    fn tcmmimfp16ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tcmmrlfp16ps"]
     fn tcmmrlfp16ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tcmmrlfp16ps.internal"]
+    fn tcmmrlfp16ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdpbf8ps"]
     fn tdpbf8ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdpbf8ps.internal"]
+    fn tdpbf8ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdpbhf8ps"]
     fn tdpbhf8ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdpbhf8ps.internal"]
+    fn tdpbhf8ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdphbf8ps"]
     fn tdphbf8ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdphbf8ps.internal"]
+    fn tdphbf8ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tdphf8ps"]
     fn tdphf8ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tdphf8ps.internal"]
+    fn tdphf8ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tileloaddrs64"]
-    fn tileloaddrs64(dst: i8, base: *const u8, stride: usize);
+    fn tileloaddrs64(dst: i8, base: *const u8, stride: u64);
+    #[link_name = "llvm.x86.tileloaddrs64.internal"]
+    fn tileloaddrs64_internal(rows: u16, colsb: u16, base: *const u8, stride: u64) -> Tile;
+
     #[link_name = "llvm.x86.tileloaddrst164"]
-    fn tileloaddrst164(dst: i8, base: *const u8, stride: usize);
+    fn tileloaddrst164(dst: i8, base: *const u8, stride: u64);
+    #[link_name = "llvm.x86.tileloaddrst164.internal"]
+    fn tileloaddrst164_internal(rows: u16, colsb: u16, base: *const u8, stride: u64) -> Tile;
+
     #[link_name = "llvm.x86.tmmultf32ps"]
     fn tmmultf32ps(dst: i8, a: i8, b: i8);
+    #[link_name = "llvm.x86.tmmultf32ps.internal"]
+    fn tmmultf32ps_internal(m: u16, n: u16, k: u16, dst: Tile, a: Tile, b: Tile) -> Tile;
+
     #[link_name = "llvm.x86.tcvtrowd2ps"]
     fn tcvtrowd2ps(tile: i8, row: u32) -> f32x16;
     #[link_name = "llvm.x86.tcvtrowd2psi"]
     fn tcvtrowd2psi(tile: i8, row: u32) -> f32x16;
+    #[link_name = "llvm.x86.tcvtrowd2ps.internal"]
+    fn tcvtrowd2ps_internal(rows: u16, colsb: u16, src: Tile, row: u32) -> f32x16;
+
     #[link_name = "llvm.x86.tcvtrowps2phh"]
     fn tcvtrowps2phh(tile: i8, row: u32) -> f16x32;
     #[link_name = "llvm.x86.tcvtrowps2phhi"]
     fn tcvtrowps2phhi(tile: i8, row: u32) -> f16x32;
+    #[link_name = "llvm.x86.tcvtrowps2phh.internal"]
+    fn tcvtrowps2phh_internal(rows: u16, colsb: u16, src: Tile, row: u32) -> f16x32;
+
     #[link_name = "llvm.x86.tcvtrowps2phl"]
     fn tcvtrowps2phl(tile: i8, row: u32) -> f16x32;
     #[link_name = "llvm.x86.tcvtrowps2phli"]
     fn tcvtrowps2phli(tile: i8, row: u32) -> f16x32;
+    #[link_name = "llvm.x86.tcvtrowps2phl.internal"]
+    fn tcvtrowps2phl_internal(rows: u16, colsb: u16, src: Tile, row: u32) -> f16x32;
+
     #[link_name = "llvm.x86.tcvtrowps2bf16h"]
     fn tcvtrowps2bf16h(tile: i8, row: u32) -> u16x32;
     #[link_name = "llvm.x86.tcvtrowps2bf16hi"]
     fn tcvtrowps2bf16hi(tile: i8, row: u32) -> u16x32;
+    #[link_name = "llvm.x86.tcvtrowps2bf16h.internal"]
+    fn tcvtrowps2bf16h_internal(rows: u16, colsb: u16, src: Tile, row: u32) -> u16x32;
+
     #[link_name = "llvm.x86.tcvtrowps2bf16l"]
     fn tcvtrowps2bf16l(tile: i8, row: u32) -> u16x32;
     #[link_name = "llvm.x86.tcvtrowps2bf16li"]
     fn tcvtrowps2bf16li(tile: i8, row: u32) -> u16x32;
+    #[link_name = "llvm.x86.tcvtrowps2bf16l.internal"]
+    fn tcvtrowps2bf16l_internal(rows: u16, colsb: u16, src: Tile, row: u32) -> u16x32;
+
     #[link_name = "llvm.x86.tilemovrow"]
     fn tilemovrow(tile: i8, row: u32) -> i32x16;
     #[link_name = "llvm.x86.tilemovrowi"]
     fn tilemovrowi(tile: i8, row: u32) -> i32x16;
+    #[link_name = "llvm.x86.tilemovrow.internal"]
+    fn tilemovrow_internal(rows: u16, colsb: u16, src: Tile, row: u32) -> i32x16;
 }
 
 #[cfg(test)]
 mod tests {
     use crate::core_arch::x86::_mm_cvtness_sbh;
     use crate::core_arch::x86_64::*;
-    use core::{array, mem::transmute};
+    use core::array;
     use stdarch_test::simd_test;
     #[cfg(target_os = "linux")]
     use syscalls::{Sysno, syscall};
@@ -704,19 +1142,23 @@ fn _init_amx() {}
     #[cfg(target_os = "linux")]
     #[target_feature(enable = "amx-tile")]
     #[inline]
-    unsafe fn _init_amx() {
+    fn _init_amx() {
         let mut ret: usize;
         let mut xfeatures: usize = 0;
-        ret = syscall!(Sysno::arch_prctl, 0x1022, &mut xfeatures as *mut usize)
-            .expect("arch_prctl ARCH_GET_XCOMP_PERM syscall failed");
+        ret = unsafe {
+            syscall!(Sysno::arch_prctl, 0x1022, &raw mut xfeatures)
+                .expect("arch_prctl ARCH_GET_XCOMP_PERM syscall failed")
+        };
         if ret != 0 {
             panic!("Failed to get XFEATURES");
         } else {
             match 0b11 & (xfeatures >> 17) {
                 0 => panic!("AMX is not available"),
                 1 => {
-                    ret = syscall!(Sysno::arch_prctl, 0x1023, 18)
-                        .expect("arch_prctl ARCH_REQ_XCOMP_PERM syscall failed");
+                    ret = unsafe {
+                        syscall!(Sysno::arch_prctl, 0x1023, 18)
+                            .expect("arch_prctl ARCH_REQ_XCOMP_PERM syscall failed")
+                    };
                     if ret != 0 {
                         panic!("Failed to enable AMX");
                     }
@@ -727,6 +1169,18 @@ unsafe fn _init_amx() {
         }
     }
 
+    impl __tile1024i {
+        #[inline]
+        #[target_feature(enable = "amx-tile")]
+        fn zeroed(rows: u16, colsb: u16) -> Self {
+            Self {
+                rows,
+                colsb,
+                tile: unsafe { super::tilezero_internal(rows, colsb) },
+            }
+        }
+    }
+
     #[simd_test(enable = "amx-tile")]
     fn test_tile_loadconfig() {
         unsafe {
@@ -759,13 +1213,27 @@ fn test_tile_zero() {
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
             let mut out = [[1_i8; 64]; 16];
-            _tile_stored::<0>(&mut out as *mut [i8; 64] as *mut u8, 64);
+            _tile_stored::<0>(out.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(out, [[0; 64]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-tile")]
+    fn test__tile_zero() {
+        unsafe {
+            _init_amx();
+
+            let tile = __tile1024i::zeroed(16, 64);
+
+            let mut out = [[1_i8; 64]; 16];
+            __tile_stored(out.as_mut_ptr().cast(), 64, tile);
+
+            assert_eq!(out, [[0; 64]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-tile")]
     fn test_tile_stored() {
         unsafe {
             _init_amx();
@@ -776,13 +1244,27 @@ fn test_tile_stored() {
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
             let mut out = [[1_i8; 64]; 16];
-            _tile_stored::<0>(&mut out as *mut [i8; 64] as *mut u8, 64);
+            _tile_stored::<0>(out.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(out, [[0; 64]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-tile")]
+    fn test__tile_stored() {
+        unsafe {
+            _init_amx();
+
+            let tile = __tile1024i::zeroed(16, 64);
+
+            let mut out = [[1_i8; 64]; 16];
+            __tile_stored(out.as_mut_ptr().cast(), 64, tile);
+
+            assert_eq!(out, [[0; 64]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-tile")]
     fn test_tile_loadd() {
         unsafe {
             _init_amx();
@@ -793,15 +1275,31 @@ fn test_tile_loadd() {
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
             let mat = [1_i8; 1024];
-            _tile_loadd::<0>(&mat as *const i8 as *const u8, 64);
+            _tile_loadd::<0>(mat.as_ptr().cast(), 64);
             let mut out = [[0_i8; 64]; 16];
-            _tile_stored::<0>(&mut out as *mut [i8; 64] as *mut u8, 64);
+            _tile_stored::<0>(out.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(out, [[1; 64]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-tile")]
+    fn test__tile_loadd() {
+        unsafe {
+            _init_amx();
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+
+            let mat = [1_i8; 1024];
+            __tile_loadd(&mut tile, mat.as_ptr().cast(), 64);
+            let mut out = [[0_i8; 64]; 16];
+            __tile_stored(out.as_mut_ptr().cast(), 64, tile);
+
+            assert_eq!(out, [[1; 64]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-tile")]
     fn test_tile_stream_loadd() {
         unsafe {
             _init_amx();
@@ -812,29 +1310,46 @@ fn test_tile_stream_loadd() {
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
             let mat = [1_i8; 1024];
-            _tile_stream_loadd::<0>(&mat as *const i8 as *const u8, 64);
+            _tile_stream_loadd::<0>(mat.as_ptr().cast(), 64);
             let mut out = [[0_i8; 64]; 16];
-            _tile_stored::<0>(&mut out as *mut [i8; 64] as *mut u8, 64);
+            _tile_stored::<0>(out.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(out, [[1; 64]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-tile")]
+    fn test__tile_stream_loadd() {
+        unsafe {
+            _init_amx();
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+
+            let mat = [1_i8; 1024];
+            __tile_stream_loadd(&mut tile, mat.as_ptr().cast(), 64);
+            let mut out = [[0_i8; 64]; 16];
+            __tile_stored(out.as_mut_ptr().cast(), 64, tile);
+
+            assert_eq!(out, [[1; 64]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-tile")]
     fn test_tile_release() {
         unsafe {
             _tile_release();
         }
     }
 
-    #[simd_test(enable = "amx-bf16,avx512f")]
+    const BF16_1: u16 = 0x3f80;
+    const BF16_2: u16 = 0x4000;
+
+    #[simd_test(enable = "amx-bf16")]
     fn test_tile_dpbf16ps() {
         unsafe {
             _init_amx();
-            let bf16_1: u16 = _mm_cvtness_sbh(1.0).to_bits();
-            let bf16_2: u16 = _mm_cvtness_sbh(2.0).to_bits();
-            let ones: [u8; 1024] = transmute([bf16_1; 512]);
-            let twos: [u8; 1024] = transmute([bf16_2; 512]);
+            let ones = [BF16_1; 512];
+            let twos = [BF16_2; 512];
             let mut res = [[0f32; 16]; 16];
             let mut config = __tilecfg::default();
             config.palette = 1;
@@ -844,15 +1359,36 @@ fn test_tile_dpbf16ps() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr().cast(), 64);
+            _tile_loadd::<2>(twos.as_ptr().cast(), 64);
             _tile_dpbf16ps::<0, 1, 2>();
-            _tile_stored::<0>(&mut res as *mut [f32; 16] as *mut u8, 64);
+            _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(res, [[64f32; 16]; 16]);
         }
     }
 
+    #[simd_test(enable = "amx-bf16")]
+    fn test__tile_dpbf16ps() {
+        unsafe {
+            _init_amx();
+            let ones = [BF16_1; 512];
+            let twos = [BF16_2; 512];
+            let mut res = [[0f32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr().cast(), 64);
+            __tile_loadd(&mut b, twos.as_ptr().cast(), 64);
+            __tile_dpbf16ps(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[64f32; 16]; 16]);
+        }
+    }
+
     #[simd_test(enable = "amx-int8")]
     fn test_tile_dpbssd() {
         unsafe {
@@ -868,16 +1404,37 @@ fn test_tile_dpbssd() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const i8 as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const i8 as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr().cast(), 64);
+            _tile_loadd::<2>(twos.as_ptr().cast(), 64);
             _tile_dpbssd::<0, 1, 2>();
-            _tile_stored::<0>(&mut res as *mut [i32; 16] as *mut u8, 64);
+            _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(res, [[128_i32; 16]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-int8")]
+    fn test__tile_dpbssd() {
+        unsafe {
+            _init_amx();
+            let ones = [-1_i8; 1024];
+            let twos = [-2_i8; 1024];
+            let mut res = [[0_i32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr().cast(), 64);
+            __tile_loadd(&mut b, twos.as_ptr().cast(), 64);
+            __tile_dpbssd(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[128_i32; 16]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-int8")]
     fn test_tile_dpbsud() {
         unsafe {
             _init_amx();
@@ -892,16 +1449,37 @@ fn test_tile_dpbsud() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const i8 as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr().cast(), 64);
+            _tile_loadd::<2>(twos.as_ptr(), 64);
             _tile_dpbsud::<0, 1, 2>();
-            _tile_stored::<0>(&mut res as *mut [i32; 16] as *mut u8, 64);
+            _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(res, [[-128_i32; 16]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-int8")]
+    fn test__tile_dpbsud() {
+        unsafe {
+            _init_amx();
+            let ones = [-1_i8; 1024];
+            let twos = [2_u8; 1024];
+            let mut res = [[0_i32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr().cast(), 64);
+            __tile_loadd(&mut b, twos.as_ptr(), 64);
+            __tile_dpbsud(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[-128_i32; 16]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-int8")]
     fn test_tile_dpbusd() {
         unsafe {
             _init_amx();
@@ -916,16 +1494,37 @@ fn test_tile_dpbusd() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const i8 as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr(), 64);
+            _tile_loadd::<2>(twos.as_ptr().cast(), 64);
             _tile_dpbusd::<0, 1, 2>();
-            _tile_stored::<0>(&mut res as *mut [i32; 16] as *mut u8, 64);
+            _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(res, [[-128_i32; 16]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-int8")]
+    fn test__tile_dpbusd() {
+        unsafe {
+            _init_amx();
+            let ones = [1_u8; 1024];
+            let twos = [-2_i8; 1024];
+            let mut res = [[0_i32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr(), 64);
+            __tile_loadd(&mut b, twos.as_ptr().cast(), 64);
+            __tile_dpbusd(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[-128_i32; 16]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-int8")]
     fn test_tile_dpbuud() {
         unsafe {
             _init_amx();
@@ -940,15 +1539,36 @@ fn test_tile_dpbuud() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr(), 64);
+            _tile_loadd::<2>(twos.as_ptr(), 64);
             _tile_dpbuud::<0, 1, 2>();
-            _tile_stored::<0>(&mut res as *mut [i32; 16] as *mut u8, 64);
+            _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(res, [[128_i32; 16]; 16]);
         }
     }
 
+    #[simd_test(enable = "amx-int8")]
+    fn test__tile_dpbuud() {
+        unsafe {
+            _init_amx();
+            let ones = [1_u8; 1024];
+            let twos = [2_u8; 1024];
+            let mut res = [[0_i32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr(), 64);
+            __tile_loadd(&mut b, twos.as_ptr(), 64);
+            __tile_dpbuud(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[128_i32; 16]; 16]);
+        }
+    }
+
     #[simd_test(enable = "amx-fp16")]
     fn test_tile_dpfp16ps() {
         unsafe {
@@ -964,15 +1584,36 @@ fn test_tile_dpfp16ps() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const f16 as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const f16 as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr().cast(), 64);
+            _tile_loadd::<2>(twos.as_ptr().cast(), 64);
             _tile_dpfp16ps::<0, 1, 2>();
-            _tile_stored::<0>(&mut res as *mut [f32; 16] as *mut u8, 64);
+            _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(res, [[64f32; 16]; 16]);
         }
     }
 
+    #[simd_test(enable = "amx-fp16")]
+    fn test__tile_dpfp16ps() {
+        unsafe {
+            _init_amx();
+            let ones = [1f16; 512];
+            let twos = [2f16; 512];
+            let mut res = [[0f32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr().cast(), 64);
+            __tile_loadd(&mut b, twos.as_ptr().cast(), 64);
+            __tile_dpfp16ps(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[64f32; 16]; 16]);
+        }
+    }
+
     #[simd_test(enable = "amx-complex")]
     fn test_tile_cmmimfp16ps() {
         unsafe {
@@ -988,16 +1629,37 @@ fn test_tile_cmmimfp16ps() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const f16 as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const f16 as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr().cast(), 64);
+            _tile_loadd::<2>(twos.as_ptr().cast(), 64);
             _tile_cmmimfp16ps::<0, 1, 2>();
-            _tile_stored::<0>(&mut res as *mut [f32; 16] as *mut u8, 64);
+            _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(res, [[64f32; 16]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-complex")]
+    fn test__tile_cmmimfp16ps() {
+        unsafe {
+            _init_amx();
+            let ones = [1f16; 512];
+            let twos = [2f16; 512];
+            let mut res = [[0f32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr().cast(), 64);
+            __tile_loadd(&mut b, twos.as_ptr().cast(), 64);
+            __tile_cmmimfp16ps(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[64f32; 16]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-complex")]
     fn test_tile_cmmrlfp16ps() {
         unsafe {
             _init_amx();
@@ -1012,15 +1674,36 @@ fn test_tile_cmmrlfp16ps() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const f16 as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const f16 as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr().cast(), 64);
+            _tile_loadd::<2>(twos.as_ptr().cast(), 64);
             _tile_cmmrlfp16ps::<0, 1, 2>();
-            _tile_stored::<0>(&mut res as *mut [f32; 16] as *mut u8, 64);
+            _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(res, [[0f32; 16]; 16]);
         }
     }
 
+    #[simd_test(enable = "amx-complex")]
+    fn test__tile_cmmrlfp16ps() {
+        unsafe {
+            _init_amx();
+            let ones = [1f16; 512];
+            let twos = [2f16; 512];
+            let mut res = [[0f32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr().cast(), 64);
+            __tile_loadd(&mut b, twos.as_ptr().cast(), 64);
+            __tile_cmmrlfp16ps(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[0f32; 16]; 16]);
+        }
+    }
+
     const BF8_ONE: u8 = 0x3c;
     const BF8_TWO: u8 = 0x40;
     const HF8_ONE: u8 = 0x38;
@@ -1041,8 +1724,8 @@ fn test_tile_dpbf8ps() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr(), 64);
+            _tile_loadd::<2>(twos.as_ptr(), 64);
             _tile_dpbf8ps::<0, 1, 2>();
             _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
@@ -1051,6 +1734,27 @@ fn test_tile_dpbf8ps() {
     }
 
     #[simd_test(enable = "amx-fp8")]
+    fn test__tile_dpbf8ps() {
+        unsafe {
+            _init_amx();
+            let ones = [BF8_ONE; 1024];
+            let twos = [BF8_TWO; 1024];
+            let mut res = [[0.0_f32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr(), 64);
+            __tile_loadd(&mut b, twos.as_ptr(), 64);
+            __tile_dpbf8ps(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[128.0_f32; 16]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-fp8")]
     fn test_tile_dpbhf8ps() {
         unsafe {
             _init_amx();
@@ -1065,8 +1769,8 @@ fn test_tile_dpbhf8ps() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr(), 64);
+            _tile_loadd::<2>(twos.as_ptr(), 64);
             _tile_dpbhf8ps::<0, 1, 2>();
             _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
@@ -1075,6 +1779,27 @@ fn test_tile_dpbhf8ps() {
     }
 
     #[simd_test(enable = "amx-fp8")]
+    fn test__tile_dpbhf8ps() {
+        unsafe {
+            _init_amx();
+            let ones = [BF8_ONE; 1024];
+            let twos = [HF8_TWO; 1024];
+            let mut res = [[0.0_f32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr(), 64);
+            __tile_loadd(&mut b, twos.as_ptr(), 64);
+            __tile_dpbhf8ps(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[128.0_f32; 16]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-fp8")]
     fn test_tile_dphbf8ps() {
         unsafe {
             _init_amx();
@@ -1089,8 +1814,8 @@ fn test_tile_dphbf8ps() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr(), 64);
+            _tile_loadd::<2>(twos.as_ptr(), 64);
             _tile_dphbf8ps::<0, 1, 2>();
             _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
@@ -1099,6 +1824,27 @@ fn test_tile_dphbf8ps() {
     }
 
     #[simd_test(enable = "amx-fp8")]
+    fn test__tile_dphbf8ps() {
+        unsafe {
+            _init_amx();
+            let ones = [HF8_ONE; 1024];
+            let twos = [BF8_TWO; 1024];
+            let mut res = [[0.0_f32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr(), 64);
+            __tile_loadd(&mut b, twos.as_ptr(), 64);
+            __tile_dphbf8ps(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[128.0_f32; 16]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-fp8")]
     fn test_tile_dphf8ps() {
         unsafe {
             _init_amx();
@@ -1113,8 +1859,8 @@ fn test_tile_dphf8ps() {
             });
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
-            _tile_loadd::<1>(&ones as *const u8, 64);
-            _tile_loadd::<2>(&twos as *const u8, 64);
+            _tile_loadd::<1>(ones.as_ptr(), 64);
+            _tile_loadd::<2>(twos.as_ptr(), 64);
             _tile_dphf8ps::<0, 1, 2>();
             _tile_stored::<0>(res.as_mut_ptr().cast(), 64);
             _tile_release();
@@ -1122,6 +1868,27 @@ fn test_tile_dphf8ps() {
         }
     }
 
+    #[simd_test(enable = "amx-fp8")]
+    fn test__tile_dphf8ps() {
+        unsafe {
+            _init_amx();
+            let ones = [HF8_ONE; 1024];
+            let twos = [HF8_TWO; 1024];
+            let mut res = [[0.0_f32; 16]; 16];
+
+            let mut a = __tile1024i::zeroed(16, 64);
+            let mut b = __tile1024i::zeroed(16, 64);
+            let mut c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut a, ones.as_ptr(), 64);
+            __tile_loadd(&mut b, twos.as_ptr(), 64);
+            __tile_dphf8ps(&mut c, a, b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, c);
+
+            assert_eq!(res, [[128.0_f32; 16]; 16]);
+        }
+    }
+
     #[simd_test(enable = "amx-movrs")]
     fn test_tile_loaddrs() {
         unsafe {
@@ -1133,15 +1900,31 @@ fn test_tile_loaddrs() {
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
             let mat = [1_i8; 1024];
-            _tile_loaddrs::<0>(&mat as *const i8 as *const u8, 64);
+            _tile_loaddrs::<0>(mat.as_ptr().cast(), 64);
             let mut out = [[0_i8; 64]; 16];
-            _tile_stored::<0>(&mut out as *mut [i8; 64] as *mut u8, 64);
+            _tile_stored::<0>(out.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(out, [[1; 64]; 16]);
         }
     }
 
     #[simd_test(enable = "amx-movrs")]
+    fn test__tile_loaddrs() {
+        unsafe {
+            _init_amx();
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+
+            let mat = [1_i8; 1024];
+            __tile_loaddrs(&mut tile, mat.as_ptr().cast(), 64);
+            let mut out = [[0_i8; 64]; 16];
+            __tile_stored(out.as_mut_ptr().cast(), 64, tile);
+
+            assert_eq!(out, [[1; 64]; 16]);
+        }
+    }
+
+    #[simd_test(enable = "amx-movrs")]
     fn test_tile_stream_loaddrs() {
         unsafe {
             _init_amx();
@@ -1152,14 +1935,30 @@ fn test_tile_stream_loaddrs() {
             _tile_loadconfig(config.as_ptr());
             _tile_zero::<0>();
             let mat = [1_i8; 1024];
-            _tile_stream_loaddrs::<0>(&mat as *const i8 as *const u8, 64);
+            _tile_stream_loaddrs::<0>(mat.as_ptr().cast(), 64);
             let mut out = [[0_i8; 64]; 16];
-            _tile_stored::<0>(&mut out as *mut [i8; 64] as *mut u8, 64);
+            _tile_stored::<0>(out.as_mut_ptr().cast(), 64);
             _tile_release();
             assert_eq!(out, [[1; 64]; 16]);
         }
     }
 
+    #[simd_test(enable = "amx-movrs")]
+    fn test__tile_stream_loaddrs() {
+        unsafe {
+            _init_amx();
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+
+            let mat = [1_i8; 1024];
+            __tile_stream_loaddrs(&mut tile, mat.as_ptr().cast(), 64);
+            let mut out = [[0_i8; 64]; 16];
+            __tile_stored(out.as_mut_ptr().cast(), 64, tile);
+
+            assert_eq!(out, [[1; 64]; 16]);
+        }
+    }
+
     #[simd_test(enable = "amx-avx512,avx10.2")]
     fn test_tile_movrow() {
         unsafe {
@@ -1224,6 +2023,22 @@ fn test_tile_movrowi() {
     }
 
     #[simd_test(enable = "amx-avx512,avx10.2")]
+    fn test__tile_movrow() {
+        unsafe {
+            _init_amx();
+            let array: [[u8; 64]; 16] = array::from_fn(|i| [i as _; _]);
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+            __tile_loadd(&mut tile, array.as_ptr().cast(), 64);
+
+            for i in 0..16 {
+                let row = __tile_movrow(tile, i);
+                assert_eq!(*row.as_u8x64().as_array(), [i as _; _]);
+            }
+        }
+    }
+
+    #[simd_test(enable = "amx-avx512,avx10.2")]
     fn test_tile_cvtrowd2ps() {
         unsafe {
             _init_amx();
@@ -1263,6 +2078,22 @@ fn test_tile_cvtrowd2psi() {
     }
 
     #[simd_test(enable = "amx-avx512,avx10.2")]
+    fn test__tile_cvtrowd2ps() {
+        unsafe {
+            _init_amx();
+            let array: [[u32; 16]; 16] = array::from_fn(|i| [i as _; _]);
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+            __tile_loadd(&mut tile, array.as_ptr().cast(), 64);
+
+            for i in 0..16 {
+                let row = __tile_cvtrowd2ps(tile, i);
+                assert_eq!(*row.as_f32x16().as_array(), [i as _; _]);
+            }
+        }
+    }
+
+    #[simd_test(enable = "amx-avx512,avx10.2")]
     fn test_tile_cvtrowps2phh() {
         unsafe {
             _init_amx();
@@ -1307,6 +2138,25 @@ fn test_tile_cvtrowps2phhi() {
     }
 
     #[simd_test(enable = "amx-avx512,avx10.2")]
+    fn test__tile_cvtrowps2phh() {
+        unsafe {
+            _init_amx();
+            let array: [[f32; 16]; 16] = array::from_fn(|i| [i as _; _]);
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+            __tile_loadd(&mut tile, array.as_ptr().cast(), 64);
+
+            for i in 0..16 {
+                let row = __tile_cvtrowps2phh(tile, i);
+                assert_eq!(
+                    *row.as_f16x32().as_array(),
+                    array::from_fn(|j| if j & 1 == 0 { 0.0 } else { i as _ })
+                );
+            }
+        }
+    }
+
+    #[simd_test(enable = "amx-avx512,avx10.2")]
     fn test_tile_cvtrowps2phl() {
         unsafe {
             _init_amx();
@@ -1351,6 +2201,25 @@ fn test_tile_cvtrowps2phli() {
     }
 
     #[simd_test(enable = "amx-avx512,avx10.2")]
+    fn test__tile_cvtrowps2phl() {
+        unsafe {
+            _init_amx();
+            let array: [[f32; 16]; 16] = array::from_fn(|i| [i as _; _]);
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+            __tile_loadd(&mut tile, array.as_ptr().cast(), 64);
+
+            for i in 0..16 {
+                let row = __tile_cvtrowps2phl(tile, i);
+                assert_eq!(
+                    *row.as_f16x32().as_array(),
+                    array::from_fn(|j| if j & 1 == 0 { i as _ } else { 0.0 })
+                );
+            }
+        }
+    }
+
+    #[simd_test(enable = "amx-avx512,avx10.2")]
     fn test_tile_cvtrowps2bf16h() {
         unsafe {
             _init_amx();
@@ -1403,6 +2272,29 @@ fn test_tile_cvtrowps2bf16hi() {
     }
 
     #[simd_test(enable = "amx-avx512,avx10.2")]
+    fn test__tile_cvtrowps2bf16h() {
+        unsafe {
+            _init_amx();
+            let array: [[f32; 16]; 16] = array::from_fn(|i| [i as _; _]);
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+            __tile_loadd(&mut tile, array.as_ptr().cast(), 64);
+
+            for i in 0..16 {
+                let row = __tile_cvtrowps2bf16h(tile, i);
+                assert_eq!(
+                    *row.as_u16x32().as_array(),
+                    array::from_fn(|j| if j & 1 == 0 {
+                        0
+                    } else {
+                        _mm_cvtness_sbh(i as _).to_bits()
+                    })
+                );
+            }
+        }
+    }
+
+    #[simd_test(enable = "amx-avx512,avx10.2")]
     fn test_tile_cvtrowps2bf16l() {
         unsafe {
             _init_amx();
@@ -1454,6 +2346,29 @@ fn test_tile_cvtrowps2bf16li() {
         }
     }
 
+    #[simd_test(enable = "amx-avx512,avx10.2")]
+    fn test__tile_cvtrowps2bf16l() {
+        unsafe {
+            _init_amx();
+            let array: [[f32; 16]; 16] = array::from_fn(|i| [i as _; _]);
+
+            let mut tile = __tile1024i::zeroed(16, 64);
+            __tile_loadd(&mut tile, array.as_ptr().cast(), 64);
+
+            for i in 0..16 {
+                let row = __tile_cvtrowps2bf16l(tile, i);
+                assert_eq!(
+                    *row.as_u16x32().as_array(),
+                    array::from_fn(|j| if j & 1 == 0 {
+                        _mm_cvtness_sbh(i as _).to_bits()
+                    } else {
+                        0
+                    })
+                );
+            }
+        }
+    }
+
     #[simd_test(enable = "amx-tf32")]
     fn test_tile_mmultf32ps() {
         unsafe {
@@ -1480,4 +2395,26 @@ fn test_tile_mmultf32ps() {
             assert_eq!(res, expected);
         }
     }
+
+    #[simd_test(enable = "amx-tf32")]
+    fn test__tile_mmultf32ps() {
+        unsafe {
+            _init_amx();
+            let a: [[f32; 16]; 16] = array::from_fn(|i| [i as _; _]);
+            let b: [[f32; 16]; 16] = [array::from_fn(|j| j as _); _];
+            let mut res = [[0.0; 16]; 16];
+
+            let mut tile_a = __tile1024i::zeroed(16, 64);
+            let mut tile_b = __tile1024i::zeroed(16, 64);
+            let mut tile_c = __tile1024i::zeroed(16, 64);
+
+            __tile_loadd(&mut tile_a, a.as_ptr().cast(), 64);
+            __tile_loadd(&mut tile_b, b.as_ptr().cast(), 64);
+            __tile_mmultf32ps(&mut tile_c, tile_a, tile_b);
+            __tile_stored(res.as_mut_ptr().cast(), 64, tile_c);
+
+            let expected = array::from_fn(|i| array::from_fn(|j| 16.0 * i as f32 * j as f32));
+            assert_eq!(res, expected);
+        }
+    }
 }
diff --git a/library/stdarch/crates/core_arch/src/x86_64/mod.rs b/library/stdarch/crates/core_arch/src/x86_64/mod.rs
index 4638417..6f1177a 100644
--- a/library/stdarch/crates/core_arch/src/x86_64/mod.rs
+++ b/library/stdarch/crates/core_arch/src/x86_64/mod.rs
@@ -3,6 +3,43 @@
 #[macro_use]
 mod macros;
 
+// Any 1024-byte vector should work
+type Tile = crate::core_arch::simd::Simd<u8, 1024>;
+
+/// A tile register, used by AMX instructions.
+///
+/// This type is the same as the `__tile1024i` type defined by Intel, representing a 1024-byte tile register.
+/// Usage of this type typically corresponds to the `amx-tile` and up target features for x86_64.
+///
+/// This struct contains the tile configuration information as well as the tile itself.
+/// The tile configuration information consists of the row count and the size of each column in bytes,
+/// with `row * colsb` never exceeding 1024.
+///
+/// The typical usage pattern looks like
+/// ```ignore
+/// let tile = MaybeUninit::uninit();
+/// let tile_ptr = tile.as_mut_ptr();
+///
+/// (*tile_ptr).rows = rows;
+/// (*tile_ptr).colsb = colsb;
+/// __tile_zero(tile_ptr);
+///
+/// let tile = tile.assume_init();
+/// ```
+/// Most intrinsics using `__tile1024i` (except for the store intrinsics) have a destination parameter
+/// of type `*mut __tile1024i`, and it expects the `rows` and `colsb` fields of the destination
+/// to be initialized. After the function call, the whole struct can be assumed to be initialized.
+/// Moreover, for dot-product intrinsics, it is UB if the shape of two operands are not compatible
+/// as a matrix product or if the shape of the destination doesn't match the expected shape.
+#[derive(Copy, Clone, Debug)]
+#[allow(non_camel_case_types)]
+#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
+pub struct __tile1024i {
+    pub rows: u16,
+    pub colsb: u16,
+    tile: Tile,
+}
+
 mod fxsr;
 #[stable(feature = "simd_x86", since = "1.27.0")]
 pub use self::fxsr::*;
diff --git a/library/stdarch/crates/intrinsic-test/src/common/argument.rs b/library/stdarch/crates/intrinsic-test/src/common/argument.rs
index 25207a8..eaec5b7 100644
--- a/library/stdarch/crates/intrinsic-test/src/common/argument.rs
+++ b/library/stdarch/crates/intrinsic-test/src/common/argument.rs
@@ -1,9 +1,10 @@
 use itertools::Itertools;
 
 use crate::common::intrinsic_helpers::TypeKind;
+use crate::common::values::test_values_array_name;
 
+use super::PASSES;
 use super::constraint::Constraint;
-use super::gen_rust::PASSES;
 use super::intrinsic_helpers::IntrinsicTypeDefinition;
 
 /// An argument for the intrinsic.
@@ -52,17 +53,6 @@ pub fn has_constraint(&self) -> bool {
         self.constraint.is_some()
     }
 
-    /// Returns a string with the name of the static variable containing test values for intrinsic
-    /// arguments of this type.
-    pub(crate) fn rust_vals_array_name(&self) -> impl std::fmt::Display {
-        let loads = crate::common::gen_rust::PASSES;
-        format!(
-            "{ty}_{load_size}",
-            ty = self.ty.rust_scalar_type().to_uppercase(),
-            load_size = self.ty.num_lanes() * self.ty.num_vectors() + loads - 1,
-        )
-    }
-
     /// Should this argument be passed by reference in C wrapper function declarations?
     ///
     /// SIMD types and `f16` are currently passed by reference.
@@ -165,41 +155,6 @@ pub fn as_c_call_param_rust(&self) -> String {
             .join("")
     }
 
-    /// Returns a string defining a static variable with test values used for all intrinsics with
-    /// arguments of `arg`'s type.
-    ///
-    /// e.g.
-    /// ```rust,ignore
-    /// static U8_20: [u8; 20] = [
-    ///     0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0xf0,
-    ///     0x80, 0x3b, 0xff,
-    /// ];
-    /// ```
-    ///
-    /// `num_lanes * num_vectors + loads - 1` elements are present in the array, which is sufficient
-    /// for a `loads` number of `num_lanes * num_vectors` windows into the array to be loaded:
-    ///
-    /// ```text
-    /// [0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0xf0, 0x80, 0x3b, 0xff]
-    /// ^^^^^^^^^^^^^^^^^^^ first window of `num_lanes * num_vectors` elements (e.g. four elements)
-    ///       ^^^^^^^^^^^^^^^^^^ second window
-    ///                                                                 `loads`th window ^^^^^^^^^^^^^^^^^^^^^^
-    /// ```
-    pub fn gen_arg_rust(
-        arg: &Argument<T>,
-        w: &mut impl std::io::Write,
-        loads: u32,
-    ) -> std::io::Result<()> {
-        writeln!(
-            w,
-            "static {name}: [{ty}; {load_size}] = {values};\n",
-            name = arg.rust_vals_array_name(),
-            ty = arg.ty.rust_scalar_type(),
-            load_size = arg.ty.num_lanes() * arg.ty.num_vectors() + loads - 1,
-            values = arg.ty.populate_random(loads)
-        )
-    }
-
     /// Returns a string defining a local variable for each argument and loading a value into each
     /// using a load intrinsic.
     ///
@@ -226,14 +181,14 @@ pub fn load_values_rust(&self) -> String {
                     format!(
                         "let {name} = {load}({vals_name}.as_ptr().add((i+{idx}) % {PASSES}) as _);\n",
                         name = arg.generate_name(),
-                        vals_name = arg.rust_vals_array_name(),
+                        vals_name = test_values_array_name(&arg.ty),
                         load = arg.ty.get_load_function(),
                     )
                 } else {
                     format!(
                         "let {name} = {vals_name}[(i+{idx}) % {PASSES}];\n",
                         name = arg.generate_name(),
-                        vals_name = arg.rust_vals_array_name(),
+                        vals_name = test_values_array_name(&arg.ty),
                     )
                 }
             })
diff --git a/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs b/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs
index cb07fa6..02f6e40 100644
--- a/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs
+++ b/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs
@@ -3,14 +3,11 @@
 use itertools::Itertools;
 
 use super::intrinsic_helpers::IntrinsicTypeDefinition;
-use crate::common::argument::ArgumentList;
+use crate::common::PASSES;
 use crate::common::cli::{CcArgStyle, ProcessedCli};
 use crate::common::intrinsic::Intrinsic;
 use crate::common::intrinsic_helpers::TypeKind;
-
-// The number of times each intrinsic will be called - influences the generation of the
-// test arrays to minimise repeated testing of the same test values.
-pub(crate) const PASSES: u32 = 20;
+use crate::common::values::{test_values_array_name, test_values_array_static};
 
 /// Rust definitions that are included verbatim in the generated source. In particular, defines
 /// a wrapper around float types that defines `NaN`s to be equal reflexively to enable
@@ -135,10 +132,10 @@ pub fn write_lib_rs<T: IntrinsicTypeDefinition>(
     for intrinsic in intrinsics {
         for arg in &intrinsic.arguments.args {
             if !arg.has_constraint() {
-                let name = arg.rust_vals_array_name().to_string();
+                let name = test_values_array_name(&arg.ty);
 
                 if seen.insert(name) {
-                    ArgumentList::gen_arg_rust(arg, w, PASSES)?;
+                    test_values_array_static(w, &arg.ty)?;
                 }
             }
         }
@@ -163,7 +160,6 @@ pub fn write_lib_rs<T: IntrinsicTypeDefinition>(
 fn generate_rust_test_loop<T: IntrinsicTypeDefinition>(
     w: &mut impl std::io::Write,
     intrinsic: &Intrinsic<T>,
-    passes: u32,
 ) -> std::io::Result<()> {
     let intrinsic_name = &intrinsic.name;
 
@@ -247,7 +243,7 @@ fn generate_rust_test_loop<T: IntrinsicTypeDefinition>(
         loaded_args = intrinsic.arguments.load_values_rust(),
         rust_args = intrinsic.arguments.as_call_param_rust(),
         c_args = intrinsic.arguments.as_c_call_param_rust(),
-        passes = passes,
+        passes = PASSES,
         cast_prefix = cast_prefix,
         cast_suffix = cast_suffix,
     )
@@ -267,7 +263,7 @@ fn create_rust_test<T: IntrinsicTypeDefinition>(
         intrinsic_name = intrinsic.name,
     )?;
 
-    generate_rust_test_loop(w, intrinsic, PASSES)?;
+    generate_rust_test_loop(w, intrinsic)?;
 
     writeln!(w, "}}")?;
 
diff --git a/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs b/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs
index a894d5c..ca5aeba 100644
--- a/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs
+++ b/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs
@@ -3,10 +3,6 @@
 use std::ops::Deref;
 use std::str::FromStr;
 
-use itertools::Itertools as _;
-
-use super::values::value_for_array;
-
 #[derive(Debug, PartialEq, Copy, Clone)]
 pub enum Sign {
     Signed,
@@ -197,92 +193,6 @@ pub fn is_simd(&self) -> bool {
     pub fn is_ptr(&self) -> bool {
         self.ptr
     }
-
-    /// Returns the elements used in the test value arrays in `gen_arg_rust`. Uses the same
-    /// `num_lanes * num_vectors + loads - 1` arithmetic to produce the number of values that
-    /// `ArgumentList::gen_arg_rust` expects and `ArgumentList::load_values_rust` needs.
-    ///
-    /// Each value in the array starts as a bit pattern from `common::values::value_from_array`
-    /// which is then printed as a hex value in the generated code (and if identified as a negative
-    /// value, with the appropriate minus and corrected hex pattern). Calls to `fN::from_bits` are
-    /// generated for floats.
-    pub fn populate_random(&self, loads: u32) -> String {
-        match self {
-            IntrinsicType {
-                bit_len: Some(bit_len @ (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 16 | 32 | 64)),
-                kind:
-                    kind @ (TypeKind::Int(_) | TypeKind::Poly | TypeKind::Char(_) | TypeKind::Mask),
-                vec_len,
-                ..
-            } => {
-                format!(
-                    "[\n{body}\n]",
-                    body = (0..(self.num_lanes() * vec_len.unwrap_or(1) + loads - 1)).format_with(
-                        ",\n",
-                        |i, fmt| {
-                            let src = value_for_array(*bit_len, i);
-                            assert!(src == 0 || src.ilog2() < *bit_len);
-                            if *kind == TypeKind::Int(Sign::Signed) && (src >> (*bit_len - 1)) != 0
-                            {
-                                // `src` is a two's complement representation of a negative value.
-                                let mask = !0u64 >> (64 - *bit_len);
-                                let ones_compl = src ^ mask;
-                                let twos_compl = ones_compl + 1;
-                                fmt(&format_args!("-{twos_compl:#x}"))
-                            } else {
-                                fmt(&format_args!("{src:#x}"))
-                            }
-                        }
-                    )
-                )
-            }
-            IntrinsicType {
-                kind: TypeKind::Float,
-                bit_len: Some(bit_len @ (16 | 32 | 64)),
-                vec_len,
-                ..
-            } => {
-                format!(
-                    "[\n{body}\n]",
-                    body = (0..(self.num_lanes() * vec_len.unwrap_or(1) + loads - 1)).format_with(
-                        ",\n",
-                        |i, fmt| fmt(&format_args!(
-                            "f{bit_len}::from_bits({src:#x})",
-                            src = value_for_array(*bit_len, i)
-                        ))
-                    )
-                )
-            }
-            IntrinsicType {
-                kind: TypeKind::Vector,
-                bit_len: Some(128 | 256 | 512),
-                vec_len,
-                ..
-            } => {
-                let effective_bit_len = 32;
-                format!(
-                    "[\n{body}\n]",
-                    body = (0..(vec_len.unwrap_or(1) * self.num_lanes() + loads - 1)).format_with(
-                        ",\n",
-                        |i, fmt| {
-                            let src = value_for_array(effective_bit_len, i);
-                            assert!(src == 0 || src.ilog2() < effective_bit_len);
-                            if (src >> (effective_bit_len - 1)) != 0 {
-                                // `src` is a two's complement representation of a negative value.
-                                let mask = !0u64 >> (64 - effective_bit_len);
-                                let ones_compl = src ^ mask;
-                                let twos_compl = ones_compl + 1;
-                                fmt(&format_args!("-{twos_compl:#x}"))
-                            } else {
-                                fmt(&format_args!("{src:#x}"))
-                            }
-                        }
-                    )
-                )
-            }
-            _ => unimplemented!("populate random: {self:#?}"),
-        }
-    }
 }
 
 pub trait IntrinsicTypeDefinition: Deref<Target = IntrinsicType> {
diff --git a/library/stdarch/crates/intrinsic-test/src/common/mod.rs b/library/stdarch/crates/intrinsic-test/src/common/mod.rs
index 3775e45..b577491 100644
--- a/library/stdarch/crates/intrinsic-test/src/common/mod.rs
+++ b/library/stdarch/crates/intrinsic-test/src/common/mod.rs
@@ -23,6 +23,10 @@
 mod gen_rust;
 mod values;
 
+// The number of times each intrinsic will be called - influences the generation of the
+// test arrays to minimise repeated testing of the same test values.
+pub(crate) const PASSES: u32 = 20;
+
 /// Architectures must support this trait
 /// to be successfully tested.
 pub trait SupportedArchitectureTest {
diff --git a/library/stdarch/crates/intrinsic-test/src/common/values.rs b/library/stdarch/crates/intrinsic-test/src/common/values.rs
index 01dc071..4c3dd07 100644
--- a/library/stdarch/crates/intrinsic-test/src/common/values.rs
+++ b/library/stdarch/crates/intrinsic-test/src/common/values.rs
@@ -1,3 +1,127 @@
+use itertools::Itertools as _;
+
+use crate::common::{
+    PASSES,
+    intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, Sign, SimdLen, TypeKind},
+};
+
+/// Maximum size of a SVE vector
+pub const MAX_SVE_BITS: u32 = 2048;
+
+/// Writes a string defining a static variable with test values used for all intrinsics with
+/// arguments of type `ty` to `w`.
+///
+/// e.g.
+/// ```rust,ignore
+/// static U8_20: [u8; 20] = [
+///     0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0xf0,
+///     0x80, 0x3b, 0xff,
+/// ];
+/// ```
+pub fn test_values_array_static<T: IntrinsicTypeDefinition>(
+    w: &mut impl std::io::Write,
+    ty: &T,
+) -> std::io::Result<()> {
+    writeln!(
+        w,
+        "static {name}: [{ty}; {load_size}] = {values};\n",
+        name = test_values_array_name(ty),
+        ty = ty.rust_scalar_type(),
+        load_size = test_values_array_length(&ty),
+        values = test_values_array(&ty)
+    )
+}
+
+/// Returns a string with the name of the static variable containing test values for intrinsic
+/// arguments of this type.
+pub fn test_values_array_name<T: IntrinsicTypeDefinition>(ty: &T) -> String {
+    format!(
+        "{ty}_{load_size}",
+        ty = ty.rust_scalar_type().to_uppercase(),
+        load_size = test_values_array_length(&ty),
+    )
+}
+
+/// Returns the elements used in the test value arrays in `gen_arg_rust`. Uses the
+/// `test_values_array_length` fn to determine the number of values that
+/// `test_values_array_static` expects and `ArgumentList::load_values_rust` needs.
+///
+/// Each value in the array starts as a bit pattern from `bit_pattern_for_test_values_array`
+/// which is then printed as a hex value in the generated code (and if identified as a negative
+/// value, with the appropriate minus and corrected hex pattern). Calls to `fN::from_bits` are
+/// generated for floats.
+pub fn test_values_array(ty: &IntrinsicType) -> String {
+    let (bit_len, kind) = match ty {
+        IntrinsicType {
+            kind: TypeKind::Float,
+            bit_len: Some(bit_len),
+            ..
+        } => (*bit_len, TypeKind::Float),
+        IntrinsicType {
+            kind: TypeKind::Vector,
+            ..
+        } => (32, TypeKind::Vector),
+        IntrinsicType {
+            kind,
+            bit_len: Some(bit_len),
+            ..
+        } => (*bit_len, *kind),
+        _ => unimplemented!(),
+    };
+
+    format!(
+        "[{}]",
+        (0..test_values_array_length(ty)).format_with(",", |i, fmt| {
+            let src = bit_pattern_for_test_values_array(bit_len, i);
+            assert!(src == 0 || src.ilog2() < bit_len);
+            match kind {
+                TypeKind::Float => fmt(&format_args!("f{bit_len}::from_bits({src:#x})")),
+                TypeKind::Vector | TypeKind::Int(Sign::Signed) if (src >> (bit_len - 1)) != 0 => {
+                    // `src` is a two's complement representation of a negative value.
+                    let mask = !0u64 >> (64 - bit_len);
+                    let ones_compl = src ^ mask;
+                    let twos_compl = ones_compl + 1;
+                    fmt(&format_args!("-{twos_compl:#x}"))
+                }
+                _ => fmt(&format_args!("{src:#x}")),
+            }
+        })
+    )
+}
+
+/// Returns the number of values that need to be in an array of test values such that there can be
+/// `num_loads` distinct windows for a given vector of type `ty`.
+///
+/// For example, vectors of type `uint32x2x2_t` load four values (`2 x 2`) and so to support
+/// `num_loads=10` distinct windows, the total length of the array of test values must be
+/// `(2 x 2) + 10 - 1`:
+///
+/// ```text
+/// [0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB, 0xC, 0xD]
+///  ^^^^^^^^^^^^^^^^^^ first window
+///       ^^^^^^^^^^^^^^^^^^ second window
+///                                   10th window ^^^^^^^^^^^^^^^^^^
+/// ```
+///
+/// For scalable vectors (only SVE is currently supported), assume that the length of the vector is
+/// the maximum supported by the architecture.
+pub fn test_values_array_length(ty: &IntrinsicType) -> u32 {
+    let IntrinsicType {
+        simd_len, vec_len, ..
+    } = ty;
+
+    let simd_len = simd_len.map_or(1, |v| {
+        if let SimdLen::Fixed(n) = v {
+            n
+        } else {
+            MAX_SVE_BITS / ty.inner_size()
+        }
+    });
+    let vec_len = vec_len.unwrap_or(1);
+
+    (simd_len * vec_len) + PASSES - 1
+}
+
 /// Returns a bit pattern for a value being output into a array of test values. Bit patterns come
 /// from one of many constant arrays of test values. The specific constant array used depends on
 /// the number of bits - `bits` - of the type having test values generated for it. This function
@@ -7,145 +131,216 @@
 /// Each constant array of bit patterns should ideally be at least the length of the largest array
 /// of test values that will be requested (e.g. 51 for a `poly8x8x4` when `PASSES=20`:
 /// `(8 * 4) + 20 - 1`), otherwise values will be repeated.
-pub fn value_for_array(bits: u32, index: u32) -> u64 {
+pub fn bit_pattern_for_test_values_array(bits: u32, index: u32) -> u64 {
     let index = index as usize;
     match bits {
-        1 => VALUES_8[index % 2].into(),
-        2 => VALUES_8[index % 4].into(),
-        3 => VALUES_8[index % 8].into(),
-        4 => VALUES_8[index % 16].into(),
-        5 => VALUES_5[index % VALUES_5.len()].into(),
-        6 => VALUES_6[index % VALUES_6.len()].into(),
-        7 => VALUES_7[index % VALUES_7.len()].into(),
-        8 => VALUES_8[index % VALUES_8.len()].into(),
-        16 => VALUES_16[index % VALUES_16.len()].into(),
-        32 => VALUES_32[index % VALUES_32.len()].into(),
-        64 => VALUES_64[index % VALUES_64.len()],
-        _ => unimplemented!("value_for_array(bits: {bits}, ..)"),
+        bits @ (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) => BIT_PATTERNS_8[index % (1 << bits)].into(),
+        16 => BIT_PATTERNS_16[index % BIT_PATTERNS_16.len()].into(),
+        32 => BIT_PATTERNS_32[index % BIT_PATTERNS_32.len()].into(),
+        64 => BIT_PATTERNS_64[index % BIT_PATTERNS_64.len()],
+        _ => unimplemented!("bit_pattern_for_test_values_array(bits: {bits}, ..)"),
     }
 }
 
-pub const VALUES_5: &[u8] = &[
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x019, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e,
-    0x1f,
+// Contains every possible 8-bit value in order
+pub const BIT_PATTERNS_8: &[u8] = &[
+    0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11,
+    0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21,
+    0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
+    0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,
+    0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
+    0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61,
+    0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
+    0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
+    0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
+    0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
+    0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
+    0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1,
+    0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1,
+    0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1,
+    0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1,
+    0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const VALUES_6: &[u8] = &[
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x039, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
-    0x3f,
-];
+#[rustfmt::skip]
+pub const BIT_PATTERNS_16: &[u16] = &[
+    // Simple values:
+    // 0.0
+    0x0000,
+    // The smallest normal value
+    0x0400,
+    // The value just below 0.5
+    0x37ff,
+    // 0.5
+    0x3800,
+    // The value just above 0.5
+    0x3801,
+    // The value just below 1.0
+    0x3bff,
+    // 1.0
+    0x3c00,
+    // The value just above 1.0
+    0x3c01,
+    // 1.5
+    0x3e00,
+    // 10
+    0x4900,
+    // The largest finite value
+    0x7bff,
+    // Infinity.
+    0x7c00,
 
-pub const VALUES_7: &[u8] = &[
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x079, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e,
-    0x7f,
-];
+    // NaNs:
+    // Quiet NaNs
+    0x7f23,
+    0x7e00,
+    // Signalling NaNs
+    0x7d23,
+    0x7c01,
 
-pub const VALUES_8: &[u8] = &[
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0xf0, 0x80, 0x3b, 0xff,
-];
+    // Subnormals:
+    // A recognisable bit pattern
+    0x0012,
+    // The largest subnormal value
+    0x03ff,
+    // The smallest subnormal value
+    0x0001,
 
-pub const VALUES_16: &[u16] = &[
-    0x0000, // 0.0
-    0x0400, // The smallest normal value.
-    0x37ff, // The value just below 0.5.
-    0x3800, // 0.5
-    0x3801, // The value just above 0.5.
-    0x3bff, // The value just below 1.0.
-    0x3c00, // 1.0
-    0x3c01, // The value just above 1.0.
-    0x3e00, // 1.5
-    0x4900, // 10
-    0x7bff, // The largest finite value.
-    0x7c00, // Infinity.
-    // NaNs.
-    //  - Quiet NaNs
-    0x7f23, 0x7e00, //  - Signalling NaNs
-    0x7d23, 0x7c01, // Subnormals.
-    //  - A recognisable bit pattern.
-    0x0012, //  - The largest subnormal value.
-    0x03ff, //  - The smallest subnormal value.
-    0x0001, // The same values again, but negated.
+    // Other values:
+    // Above values, negated
     0x8000, 0x8400, 0xb7ff, 0xb800, 0xb801, 0xbbff, 0xbc00, 0xbc01, 0xbe00, 0xc900, 0xfbff, 0xfc00,
     0xff23, 0xfe00, 0xfd23, 0xfc01, 0x8012, 0x83ff, 0x8001,
+    // Random values 
+    0xfc00, 0xc000, 0x5140, 0x5800, 0x63d2, 0x5630, 0x3560, 0x9191, 0x4178, 0x6212, 0x67d0, 0x3312,
+    0x4cef, 0x4973, 0x3ecc, 0x5166, 0x4d80, 0x6248, 0x46fd, 0x39c4, 0x39c5, 0x4866, 0x6050, 0x498e,
+    0x4a0f,
+    // Previous values in a different order
+    0x3555, 0xfc00, 0xc000, 0x9191, 0x5140, 0x5800, 0x8001, 0x83ff, 0x63d2, 0x5630, 0x3560, 0x4178,
+    0x7d23, 0x7c01, 0x0012, 0xb800, 0x03ff, 0x0001, 0x7e00, 0x7f23, 0x8000, 0x8400, 0xb7ff, 0xb801,
+    0x3312, 0x4cef, 0x4973, 0x39c4, 0x3ecc, 0x5166, 0x67d0, 0x6212, 0x4d80, 0x6248, 0x46fd, 0x39c5,
+    0xbc01, 0xbe00, 0xc900, 0xfc01, 0xfbff, 0xfc00, 0xbc00, 0xbbff, 0xff23, 0xfe00, 0xfd23, 0x8012,
+    0x37ff, 0x3800, 0x3801, 0x7bff, 0x3bff, 0x3c00, 0x0400, 0x0000, 0x3c01, 0x3e00, 0x4900, 0x7c00,
+    0x498e, 0x4a0f, 0x6050, 0x4866,
+
+    // Specific values:
+    // As close to 1/3 as possible.
+    0x3555,
 ];
 
-pub const VALUES_32: &[u32] = &[
-    // Simple values.
-    0x00000000, // 0.0
-    0x00800000, // The smallest normal value.
-    0x3effffff, // The value just below 0.5.
-    0x3f000000, // 0.5
-    0x3f000001, // The value just above 0.5.
-    0x3f7fffff, // The value just below 1.0.
-    0x3f800000, // 1.0
-    0x3f800001, // The value just above 1.0.
-    0x3fc00000, // 1.5
-    0x41200000, // 10
-    0x7f8fffff, // The largest finite value.
-    0x7f800000, // Infinity.
-    // NaNs.
-    //  - Quiet NaNs
-    0x7fd23456, 0x7fc00000, //  - Signalling NaNs
-    0x7f923456, 0x7f800001, // Subnormals.
-    //  - A recognisable bit pattern.
-    0x00123456, //  - The largest subnormal value.
-    0x007fffff, //  - The smallest subnormal value.
-    0x00000001, // The same values again, but negated.
+#[rustfmt::skip]
+pub const BIT_PATTERNS_32: &[u32] = &[
+    // Simple values:
+    // 0.0
+    0x00000000,
+    // The smallest normal value
+    0x00800000,
+    // The value just below 0.5
+    0x3effffff,
+    // 0.5
+    0x3f000000,
+    // The value just above 0.5
+    0x3f000001,
+    // The value just below 1.0
+    0x3f7fffff,
+    // 1.0
+    0x3f800000,
+    // The value just above 1.0
+    0x3f800001,
+    // 1.5
+    0x3fc00000,
+    // 10
+    0x41200000,
+    // The largest finite value
+    0x7f8fffff,
+    // Infinity
+    0x7f800000,
+
+    // NaNs:
+    // Quiet NaNs
+    0x7fd23456,
+    0x7fc00000,
+    // Signalling NaNs
+    0x7f923456,
+    0x7f800001,
+
+    // Subnormals:
+    // A recognisable bit pattern
+    0x00123456,
+    // The largest subnormal value
+    0x007fffff,
+    // The smallest subnormal value
+    0x00000001,
+
+    // Other values:
+    // Above values, negated
     0x80000000, 0x80800000, 0xbeffffff, 0xbf000000, 0xbf000001, 0xbf7fffff, 0xbf800000, 0xbf800001,
     0xbfc00000, 0xc1200000, 0xff8fffff, 0xff800000, 0xffd23456, 0xffc00000, 0xff923456, 0xff800001,
-    0x80123456, 0x807fffff, 0x80000001,
+    0x80123456, 0x807fffff, 0x80000001, 0x80123456, 0x807fffff, 0x80000001,
+    // Random values
+    0x4205cccd, 0x4229178D, 0x42C6A0C5, 0x3B3302F7, 0x3F9DF45E, 0x41DAA3D7, 0x47C3501D, 0xC3889333,
+    0xC2C675C3, 0xC69C449A, 0xC341FD71, 0xC502DFD7, 0xBBB43958, 0x3EE24DD3, 0x42B1C28F, 0x42F06666,
+    0x45D379C3, 0x44637148, 0x3CBBECAB, 0x4113EDFA, 0x444B22F2, 0x1FD93A96, 0x9921055F, 0xFF626925,
+    
+    // Specific values:
+    // Approximately Pi
+    0x40490fdb,
+    // Approximately 1/3
+    0x3eaaaaab,
 ];
 
-pub const VALUES_64: &[u64] = &[
-    // Simple values.
-    0x0000000000000000, // 0.0
-    0x0010000000000000, // The smallest normal value.
-    0x3fdfffffffffffff, // The value just below 0.5.
-    0x3fe0000000000000, // 0.5
-    0x3fe0000000000001, // The value just above 0.5.
-    0x3fefffffffffffff, // The value just below 1.0.
-    0x3ff0000000000000, // 1.0
-    0x3ff0000000000001, // The value just above 1.0.
-    0x3ff8000000000000, // 1.5
-    0x4024000000000000, // 10
-    0x7fefffffffffffff, // The largest finite value.
-    0x7ff0000000000000, // Infinity.
-    // NaNs.
-    //  - Quiet NaNs
-    0x7ff923456789abcd,
-    0x7ff8000000000000,
-    //  - Signalling NaNs
-    0x7ff123456789abcd,
+#[rustfmt::skip]
+pub const BIT_PATTERNS_64: &[u64] = &[
+    // Simple values:
+    // 0.0
+    0x0000000000000000,
+    // The smallest normal value
+    0x0010000000000000,
+    // The value just below 0.5
+    0x3fdfffffffffffff,
+    // 0.5
+    0x3fe0000000000000,
+    // The value just above 0.5
+    0x3fe0000000000001,
+    // The value just below 1.0
+    0x3fefffffffffffff,
+    // 1.0
+    0x3ff0000000000000,
+    // The value just above 1.0
+    0x3ff0000000000001,
+    // 1.5
+    0x3ff8000000000000,
+    // 10
+    0x4024000000000000,
+    // The largest finite value
+    0x7fefffffffffffff,
+    // Infinity
     0x7ff0000000000000,
-    // Subnormals.
-    //  - A recognisable bit pattern.
+
+    // NaNs:
+    // Quiet NaNs
+    0x7ff923456789abcd, 0x7ff8000000000000,
+    // Signalling NaNs
+    0x7ff123456789abcd, 0x7ff0000000000000,
+
+    // Subnormals:
+    // A recognisable bit pattern
     0x000123456789abcd,
-    //  - The largest subnormal value.
+    // The largest subnormal value
     0x000fffffffffffff,
-    //  - The smallest subnormal value.
+    // The smallest subnormal value
     0x0000000000000001,
-    // The same values again, but negated.
-    0x8000000000000000,
-    0x8010000000000000,
-    0xbfdfffffffffffff,
-    0xbfe0000000000000,
-    0xbfe0000000000001,
-    0xbfefffffffffffff,
-    0xbff0000000000000,
-    0xbff0000000000001,
-    0xbff8000000000000,
-    0xc024000000000000,
-    0xffefffffffffffff,
-    0xfff0000000000000,
-    0xfff923456789abcd,
-    0xfff8000000000000,
-    0xfff123456789abcd,
-    0xfff0000000000000,
-    0x800123456789abcd,
-    0x800fffffffffffff,
-    0x8000000000000001,
+
+    // Other values:
+    // Above values, negated
+    0x8000000000000000, 0x8010000000000000, 0xbfdfffffffffffff, 0xbfe0000000000000,
+    0xbfe0000000000001, 0xbfefffffffffffff, 0xbff0000000000000, 0xbff0000000000001,
+    0xbff8000000000000, 0xc024000000000000, 0xffefffffffffffff, 0xfff0000000000000,
+    0xfff923456789abcd, 0xfff8000000000000, 0xfff123456789abcd, 0xfff0000000000000,
+    0x800123456789abcd, 0x800fffffffffffff, 0x8000000000000001,
+
+    // Specific values:
+    // Pi
+    0x400921FB54442D18,
+    // Approximately 1/3
+    0x3fd5555555555555,
 ];
diff --git a/library/stdarch/crates/intrinsic-test/src/x86/constraint.rs b/library/stdarch/crates/intrinsic-test/src/x86/constraint.rs
index 608ffdd..cda9a7e 100644
--- a/library/stdarch/crates/intrinsic-test/src/x86/constraint.rs
+++ b/library/stdarch/crates/intrinsic-test/src/x86/constraint.rs
@@ -9,24 +9,22 @@ pub fn map_constraints(fn_name: &str, imm_type: &String, imm_width: u32) -> Opti
         return Some(Constraint::Range(0..max));
     }
     match imm_type.as_str() {
-        // Legal values for variables of `_MM_FROUND` type are:
-        // 8 =>  (_MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC) // round to nearest, and suppress exceptions
-        // 9 =>  (_MM_FROUND_TO_NEG_INF |_MM_FROUND_NO_EXC)     // round down, and suppress exceptions
-        // 10 => (_MM_FROUND_TO_POS_INF |_MM_FROUND_NO_EXC)     // round up, and suppress exceptions
-        // 11 => (_MM_FROUND_TO_ZERO |_MM_FROUND_NO_EXC)        // truncate, and suppress exceptions
-        // 4 =>   _MM_FROUND_CUR_DIRECTION                      // use MXCSR.RC; see _MM_SET_ROUNDING_MODE
+        // _mm512_cvt{_round}ps_ph functions can accept a larger set of values for _MM_FROUND
+        "_MM_FROUND"
+            if fn_name.starts_with("_mm512")
+                && (fn_name.ends_with("cvtps_ph") || fn_name.ends_with("cvt_roundps_ph")) =>
+        {
+            Some(Constraint::Set(vec![0, 1, 2, 3, 4, 8, 9, 10, 11, 12]))
+        }
         "_MM_FROUND" => Some(Constraint::Set(vec![4, 8, 9, 10, 11])),
         "_MM_INDEX_SCALE" => Some(Constraint::Set(vec![1, 2, 4, 8])),
         "_MM_CMPINT" => Some(Constraint::Range(0..8)),
-        "_MM_REDUCE" => Some(Constraint::Range(0..8)),
-        "_MM_FROUND_SAE" => Some(Constraint::Equal(8)),
+        "_MM_REDUCE" => Some(Constraint::Range(0..256)),
+        "_MM_FROUND_SAE" => Some(Constraint::Set(vec![4, 8])),
         "_MM_MANTISSA_NORM" => Some(Constraint::Range(0..4)),
-        "_MM_MANTISSA_NORM_ENUM" => Some(Constraint::Range(0..4)),
         "_MM_MANTISSA_SIGN" => Some(Constraint::Range(0..3)),
         "_MM_PERM" => Some(Constraint::Range(0..256)),
-        "_MM_PERM_ENUM" => Some(Constraint::Range(0..256)),
-        "_MM_CMPINT_ENUM" => Some(Constraint::Range(0..8)),
-        "_MM_ROUND_MODE" => Some(Constraint::Set(vec![0, 0x2, 0x4, 0x6])),
+        "_MM_ROUND_MODE" => Some(Constraint::Range(0..5)),
         "_CMP_" => Some(Constraint::Range(0..32)),
         _ => None,
     }
diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml
index e8682cf..12055cc 100644
--- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml
+++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml
@@ -14,6 +14,10 @@
 neon-stable-fp16: &neon-stable-fp16
   FnCall: [stable, ['feature = "stdarch_neon_fp16"', 'since = "1.94.0"']]
 
+# #[stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION")]
+neon-stable-dotprod: &neon-stable-dotprod
+  FnCall: [stable, ['feature = "stdarch_neon_dotprod"', 'since = "CURRENT_RUSTC_VERSION"']]
+
 # #[cfg_attr(target_arch = "arm", unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800"))]
 neon-cfg-arm-unstable: &neon-cfg-arm-unstable
   FnCall: ['cfg_attr', ['target_arch = "arm"', {FnCall: ['unstable', ['feature = "stdarch_arm_neon_intrinsics"', 'issue = "111800"']]}]]
@@ -59,6 +63,10 @@
 neon-not-arm-stable-fp16: &neon-not-arm-stable-fp16
   FnCall: [cfg_attr, [{ FnCall: [not, ['target_arch = "arm"']]}, {FnCall: [stable, ['feature = "stdarch_neon_fp16"', 'since = "1.94.0"']]}]]
 
+# #[cfg_attr(not(target_arch = "arm"), stable(feature = "stdarch_neon_dotprod", since = "CURRENT_RUSTC_VERSION"))]
+neon-not-arm-stable-dotprod: &neon-not-arm-stable-dotprod
+  FnCall: [cfg_attr, [{ FnCall: [not, ['target_arch = "arm"']]}, {FnCall: [stable, ['feature = "stdarch_neon_dotprod"', 'since = "CURRENT_RUSTC_VERSION"']]}]]
+
 # #[cfg_attr(all(test, not(target_env = "msvc"))]
 msvc-disabled: &msvc-disabled
   FnCall: [all, [test, {FnCall: [not, ['target_env = "msvc"']]}]]
@@ -7033,7 +7041,8 @@
       - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vsdot, 'LANE = 0']]}]]
       - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [sdot, 'LANE = 0']]}]]
       - FnCall: [rustc_legacy_const_generics, ['3']]
-      - FnCall: [unstable, ['feature = "stdarch_neon_dotprod"', 'issue = "117224"']]
+      - *neon-not-arm-stable-dotprod
+      - *neon-cfg-arm-unstable
     safety: safe
     types:
       - [int32x2_t, int8x8_t, int8x16_t, '']
@@ -7063,7 +7072,8 @@
       - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vudot, 'LANE = 0']]}]]
       - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [udot, 'LANE = 0']]}]]
       - FnCall: [rustc_legacy_const_generics, ['3']]
-      - FnCall: [unstable, ['feature = "stdarch_neon_dotprod"', 'issue = "117224"']]
+      - *neon-not-arm-stable-dotprod
+      - *neon-cfg-arm-unstable
     safety: safe
     types:
       - [uint32x2_t, uint8x8_t, uint8x16_t, '']
@@ -7091,7 +7101,7 @@
       - FnCall: [target_feature, ['enable = "neon,dotprod"']]
       - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vsdot]]}]]
       - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [sdot]]}]]
-      - FnCall: [cfg_attr, [{FnCall: [not, ['target_arch = "arm"']]}, {FnCall: [unstable, ['feature = "stdarch_neon_dotprod"', 'issue = "117224"']]}]]
+      - *neon-not-arm-stable-dotprod
       - *neon-cfg-arm-unstable
     safety: safe
     big_endian_inverse: true
@@ -7116,7 +7126,7 @@
       - FnCall: [target_feature, ['enable = "neon,dotprod"']]
       - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vudot]]}]]
       - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [udot]]}]]
-      - FnCall: [cfg_attr, [{FnCall: [not, ['target_arch = "arm"']]}, {FnCall: [unstable, ['feature = "stdarch_neon_dotprod"', 'issue = "117224"']]}]]
+      - *neon-not-arm-stable-dotprod
       - *neon-cfg-arm-unstable
     safety: safe
     big_endian_inverse: true
@@ -7143,7 +7153,7 @@
       - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vsdot, 'LANE = 0']]}]]
       - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [sdot, 'LANE = 0']]}]]
       - FnCall: [rustc_legacy_const_generics, ['3']]
-      - FnCall: [cfg_attr, [{FnCall: [not, ['target_arch = "arm"']]}, {FnCall: [unstable, ['feature = "stdarch_neon_dotprod"', 'issue = "117224"']]}]]
+      - *neon-not-arm-stable-dotprod
       - *neon-cfg-arm-unstable
     safety: safe
     types:
@@ -7174,7 +7184,7 @@
       - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vudot, 'LANE = 0']]}]]
       - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [udot, 'LANE = 0']]}]]
       - FnCall: [rustc_legacy_const_generics, ['3']]
-      - FnCall: [cfg_attr, [{FnCall: [not, ['target_arch = "arm"']]}, {FnCall: [unstable, ['feature = "stdarch_neon_dotprod"', 'issue = "117224"']]}]]
+      - *neon-not-arm-stable-dotprod
       - *neon-cfg-arm-unstable
     safety: safe
     types:
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs b/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs
index cbd5df5..672047f 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs
@@ -303,12 +303,12 @@ fn generate_single_test(
         (None, quote!())
     };
 
-    let ptr = if chars.gather_bases_type.is_some() {
-        quote!()
+    let (ptr_arg, init_ptr) = if chars.gather_bases_type.is_some() {
+        (quote!(), quote!())
     } else if chars.is_prf {
-        quote!(, I64_DATA.as_ptr())
+        (quote!(,ptr), quote!(let ptr = I64_DATA.as_ptr();))
     } else {
-        quote!(, #data_array.as_ptr())
+        (quote!(,ptr), quote!(let ptr = #data_array.as_ptr();))
     };
 
     let tuple_len = &chars.tuple_len;
@@ -320,18 +320,17 @@ fn generate_single_test(
             .map(|i| get_expected_range(i, &chars))
             .collect()
     };
-    let asserts: Vec<_> =
-        if *tuple_len > 1 {
-            let svget = format_ident!("svget{tuple_len}_{acle_type}");
-            expecteds.iter().enumerate().map(|(i, expected)| {
-            quote! (#assert_fn(#svget::<{ #i as i32 }>(loaded), #expected);)
+    let asserts: Vec<_> = if *tuple_len > 1 {
+        let svget = format_ident!("svget{tuple_len}_{acle_type}");
+        expecteds.iter().enumerate().map(|(i, expected)| {
+            quote! (#assert_fn(#svget::<{ #i as i32 }>(loaded), #expected, defined);)
         }).collect()
-        } else {
-            expecteds
-                .iter()
-                .map(|expected| quote! (#assert_fn(loaded, #expected);))
-                .collect()
-        };
+    } else {
+        expecteds
+            .iter()
+            .map(|expected| quote! (#assert_fn(loaded, #expected, defined);))
+            .collect()
+    };
 
     let function = if chars.is_prf {
         if fn_name.contains("gather") && fn_name.contains("base") && !fn_name.starts_with("svprf_")
@@ -385,6 +384,7 @@ fn generate_single_test(
         } else {
             (quote!(), quote!())
         };
+
         let args = quote!(#pred_fn() #store_ptr #vnum_arg #bases_arg #offset_arg #index_arg #offsets_arg #indices_arg);
         let call = if chars.uses_ffr {
             // Doing a normal load first maximises the number of elements our ff/nf test loads
@@ -398,12 +398,14 @@ fn generate_single_test(
                 svsetffr();
                 let _ = #non_ffr_fn_name(#args);
                 let loaded = #function(#args);
+                let defined = svrdffr();
             }
         } else {
             // Note that the FFR must be set for all tests as the assert functions mask against it
             quote! {
                 svsetffr();
                 let loaded = #function(#args);
+                let defined = svrdffr();
             }
         };
 
@@ -429,7 +431,7 @@ unsafe fn #test_name() {
             }
         })
     } else {
-        let args = quote!(#pred_fn() #ptr #vnum_arg #bases_arg #offset_arg #index_arg #offsets_arg #indices_arg);
+        let args = quote!(#pred_fn() #ptr_arg #vnum_arg #bases_arg #offset_arg #index_arg #offsets_arg #indices_arg);
         let call = if chars.uses_ffr {
             // Doing a normal load first maximises the number of elements our ff/nf test loads
             let non_ffr_fn_name = format_ident!(
@@ -439,15 +441,19 @@ unsafe fn #test_name() {
                     .replace("svldnf1", "svld1")
             );
             quote! {
+                #init_ptr
                 svsetffr();
                 let _ = #non_ffr_fn_name(#args);
                 let loaded = #function(#args);
+                let defined = svrdffr();
             }
         } else {
             // Note that the FFR must be set for all tests as the assert functions mask against it
             quote! {
+                #init_ptr
                 svsetffr();
                 let loaded = #function(#args);
+                let defined = svrdffr();
             }
         };
         Ok(quote! {
@@ -715,80 +721,70 @@ fn new(intr: &Intrinsic) -> Result<LdIntrCharacteristics, String> {
 }});
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_f32(vector: svfloat32_t, expected: svfloat32_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_f32(vector: svfloat32_t, expected: svfloat32_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_f32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_f64(vector: svfloat64_t, expected: svfloat64_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_f64(vector: svfloat64_t, expected: svfloat64_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_f64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i8(vector: svint8_t, expected: svint8_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_i8(vector: svint8_t, expected: svint8_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b8(), defined));
     let cmp = svcmpne_s8(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i16(vector: svint16_t, expected: svint16_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_i16(vector: svint16_t, expected: svint16_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b16(), defined));
     let cmp = svcmpne_s16(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i32(vector: svint32_t, expected: svint32_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_i32(vector: svint32_t, expected: svint32_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_s32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_i64(vector: svint64_t, expected: svint64_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_i64(vector: svint64_t, expected: svint64_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_s64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u8(vector: svuint8_t, expected: svuint8_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_u8(vector: svuint8_t, expected: svuint8_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b8(), defined));
     let cmp = svcmpne_u8(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u16(vector: svuint16_t, expected: svuint16_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_u16(vector: svuint16_t, expected: svuint16_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b16(), defined));
     let cmp = svcmpne_u16(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u32(vector: svuint32_t, expected: svuint32_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_u32(vector: svuint32_t, expected: svuint32_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b32(), defined));
     let cmp = svcmpne_u32(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
 }}
 
 #[target_feature(enable = "sve")]
-fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t) {{
-    let defined = svrdffr();
+fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t, defined: svbool_t) {{
     assert!(svptest_first(svptrue_b64(), defined));
     let cmp = svcmpne_u64(defined, vector, expected);
     assert!(!svptest_any(defined, cmp))
@@ -801,11 +797,11 @@ fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t) {{
 unsafe fn test_ffr() {
     svsetffr();
     let ffr = svrdffr();
-    assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svindex_u8(1, 0));
+    assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svindex_u8(1, 0), ffr);
     let pred = svdupq_n_b8(true, false, true, false, true, false, true, false,
                            true, false, true, false, true, false, true, false);
     svwrffr(pred);
     let ffr = svrdffr_z(svptrue_b8());
-    assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svdup_n_u8_z(pred, 1));
+    assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svdup_n_u8_z(pred, 1), ffr);
 }
 ";
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/main.rs b/library/stdarch/crates/stdarch-gen-arm/src/main.rs
index b7e2aa4..717a170 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/main.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/main.rs
@@ -166,7 +166,7 @@ fn generate_file(
 
 "#,
         uses_neon = if generated_input.ctx.uses_neon_types {
-            "\nuse crate::core_arch::arch::aarch64::*;"
+            "\nuse crate::core_arch::arch::aarch64::*;\nuse super::{AsSigned, AsUnsigned};"
         } else {
             ""
         },
diff --git a/library/stdarch/crates/stdarch-gen-loongarch/lasx.spec b/library/stdarch/crates/stdarch-gen-loongarch/lasx.spec
index c74199c..41432ad 100644
--- a/library/stdarch/crates/stdarch-gen-loongarch/lasx.spec
+++ b/library/stdarch/crates/stdarch-gen-loongarch/lasx.spec
@@ -1520,41 +1520,49 @@
 data-types = V4DI, V4DI, V4DI
 
 /// lasx_xvpackev_b
+impl = portable
 name = lasx_xvpackev_b
 asm-fmts = xd, xj, xk
 data-types = V32QI, V32QI, V32QI
 
 /// lasx_xvpackev_h
+impl = portable
 name = lasx_xvpackev_h
 asm-fmts = xd, xj, xk
 data-types = V16HI, V16HI, V16HI
 
 /// lasx_xvpackev_w
+impl = portable
 name = lasx_xvpackev_w
 asm-fmts = xd, xj, xk
 data-types = V8SI, V8SI, V8SI
 
 /// lasx_xvpackev_d
+impl = portable
 name = lasx_xvpackev_d
 asm-fmts = xd, xj, xk
 data-types = V4DI, V4DI, V4DI
 
 /// lasx_xvpackod_b
+impl = portable
 name = lasx_xvpackod_b
 asm-fmts = xd, xj, xk
 data-types = V32QI, V32QI, V32QI
 
 /// lasx_xvpackod_h
+impl = portable
 name = lasx_xvpackod_h
 asm-fmts = xd, xj, xk
 data-types = V16HI, V16HI, V16HI
 
 /// lasx_xvpackod_w
+impl = portable
 name = lasx_xvpackod_w
 asm-fmts = xd, xj, xk
 data-types = V8SI, V8SI, V8SI
 
 /// lasx_xvpackod_d
+impl = portable
 name = lasx_xvpackod_d
 asm-fmts = xd, xj, xk
 data-types = V4DI, V4DI, V4DI
@@ -1634,16 +1642,19 @@
 data-types = UV32QI, UV32QI, UV32QI, USI
 
 /// lasx_xvshuf4i_b
+impl = portable
 name = lasx_xvshuf4i_b
 asm-fmts = xd, xj, ui8
 data-types = V32QI, V32QI, USI
 
 /// lasx_xvshuf4i_h
+impl = portable
 name = lasx_xvshuf4i_h
 asm-fmts = xd, xj, ui8
 data-types = V16HI, V16HI, USI
 
 /// lasx_xvshuf4i_w
+impl = portable
 name = lasx_xvshuf4i_w
 asm-fmts = xd, xj, ui8
 data-types = V8SI, V8SI, USI
diff --git a/library/stdarch/crates/stdarch-gen-loongarch/lsx.spec b/library/stdarch/crates/stdarch-gen-loongarch/lsx.spec
index c59f56a..211c3c0 100644
--- a/library/stdarch/crates/stdarch-gen-loongarch/lsx.spec
+++ b/library/stdarch/crates/stdarch-gen-loongarch/lsx.spec
@@ -1540,41 +1540,49 @@
 data-types = V2DI, V2DI, V2DI
 
 /// lsx_vpackev_b
+impl = portable
 name = lsx_vpackev_b
 asm-fmts = vd, vj, vk
 data-types = V16QI, V16QI, V16QI
 
 /// lsx_vpackev_h
+impl = portable
 name = lsx_vpackev_h
 asm-fmts = vd, vj, vk
 data-types = V8HI, V8HI, V8HI
 
 /// lsx_vpackev_w
+impl = portable
 name = lsx_vpackev_w
 asm-fmts = vd, vj, vk
 data-types = V4SI, V4SI, V4SI
 
 /// lsx_vpackev_d
+impl = portable
 name = lsx_vpackev_d
 asm-fmts = vd, vj, vk
 data-types = V2DI, V2DI, V2DI
 
 /// lsx_vpackod_b
+impl = portable
 name = lsx_vpackod_b
 asm-fmts = vd, vj, vk
 data-types = V16QI, V16QI, V16QI
 
 /// lsx_vpackod_h
+impl = portable
 name = lsx_vpackod_h
 asm-fmts = vd, vj, vk
 data-types = V8HI, V8HI, V8HI
 
 /// lsx_vpackod_w
+impl = portable
 name = lsx_vpackod_w
 asm-fmts = vd, vj, vk
 data-types = V4SI, V4SI, V4SI
 
 /// lsx_vpackod_d
+impl = portable
 name = lsx_vpackod_d
 asm-fmts = vd, vj, vk
 data-types = V2DI, V2DI, V2DI
@@ -1649,16 +1657,19 @@
 data-types = UV16QI, UV16QI, UV16QI, USI
 
 /// lsx_vshuf4i_b
+impl = portable
 name = lsx_vshuf4i_b
 asm-fmts = vd, vj, ui8
 data-types = V16QI, V16QI, USI
 
 /// lsx_vshuf4i_h
+impl = portable
 name = lsx_vshuf4i_h
 asm-fmts = vd, vj, ui8
 data-types = V8HI, V8HI, USI
 
 /// lsx_vshuf4i_w
+impl = portable
 name = lsx_vshuf4i_w
 asm-fmts = vd, vj, ui8
 data-types = V4SI, V4SI, USI
@@ -2358,6 +2369,7 @@
 data-types = V8HI, V8HI, V8HI, V8HI
 
 /// lsx_vshuf4i_d
+impl = portable
 name = lsx_vshuf4i_d
 asm-fmts = vd, vj, ui8
 data-types = V2DI, V2DI, V2DI, USI
diff --git a/library/stdarch/crates/stdarch-gen-loongarch/src/portable-intrinsics.txt b/library/stdarch/crates/stdarch-gen-loongarch/src/portable-intrinsics.txt
index 228c914..abbfcb3 100644
--- a/library/stdarch/crates/stdarch-gen-loongarch/src/portable-intrinsics.txt
+++ b/library/stdarch/crates/stdarch-gen-loongarch/src/portable-intrinsics.txt
@@ -251,6 +251,18 @@
 lsx_vreplvei_h
 lsx_vreplvei_w
 lsx_vreplvei_d
+lsx_vpackev_b
+lsx_vpackev_h
+lsx_vpackev_w
+lsx_vpackev_d
+lsx_vpackod_b
+lsx_vpackod_h
+lsx_vpackod_w
+lsx_vpackod_d
+lsx_vshuf4i_b
+lsx_vshuf4i_h
+lsx_vshuf4i_w
+lsx_vshuf4i_d
 
 # LASX intrinsics
 lasx_xvsll_b
@@ -504,3 +516,14 @@
 lasx_xvreplve0_w
 lasx_xvreplve0_d
 lasx_xvreplve0_q
+lasx_xvpackev_b
+lasx_xvpackev_h
+lasx_xvpackev_w
+lasx_xvpackev_d
+lasx_xvpackod_b
+lasx_xvpackod_h
+lasx_xvpackod_w
+lasx_xvpackod_d
+lasx_xvshuf4i_b
+lasx_xvshuf4i_h
+lasx_xvshuf4i_w
diff --git a/library/stdarch/crates/stdarch-test/src/lib.rs b/library/stdarch/crates/stdarch-test/src/lib.rs
index ecaf95f..c468ebd 100644
--- a/library/stdarch/crates/stdarch-test/src/lib.rs
+++ b/library/stdarch/crates/stdarch-test/src/lib.rs
@@ -172,6 +172,10 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) {
                 // vst1q_p64_x4_nop : #instructions = 33 >= 22 (limit)
                 "nop" if fnname.contains("vst1q_p64") => 34,
 
+                // AMX intrinsics generate a lot of move instructions to load/store the tile registers
+                // due to Rust ABI
+                _ if fnname.contains("___tile") => 165,
+
                 // Original limit was 20 instructions, but ARM DSP Intrinsics
                 // are exactly 20 instructions long. So, bump the limit to 22
                 // instead of adding here a long list of exceptions.
diff --git a/library/stdarch/crates/stdarch-verify/src/lib.rs b/library/stdarch/crates/stdarch-verify/src/lib.rs
index f7304ab..5412ab4 100644
--- a/library/stdarch/crates/stdarch-verify/src/lib.rs
+++ b/library/stdarch/crates/stdarch-verify/src/lib.rs
@@ -202,6 +202,7 @@ fn to_type(t: &syn::Type) -> proc_macro2::TokenStream {
             "_MM_MANTISSA_NORM_ENUM" => quote! { &MM_MANTISSA_NORM_ENUM },
             "_MM_MANTISSA_SIGN_ENUM" => quote! { &MM_MANTISSA_SIGN_ENUM },
             "_MM_PERM_ENUM" => quote! { &MM_PERM_ENUM },
+            "__tile1024i" => quote! { &TILE1024I },
             "bool" => quote! { &BOOL },
             "bf16" => quote! { &BF16 },
             "f16" => quote! { &F16 },
diff --git a/library/stdarch/crates/stdarch-verify/tests/x86-intel.rs b/library/stdarch/crates/stdarch-verify/tests/x86-intel.rs
index 024a873..32726d1 100644
--- a/library/stdarch/crates/stdarch-verify/tests/x86-intel.rs
+++ b/library/stdarch/crates/stdarch-verify/tests/x86-intel.rs
@@ -62,6 +62,7 @@ struct Function {
 static MM_MANTISSA_NORM_ENUM: Type = Type::MM_MANTISSA_NORM_ENUM;
 static MM_MANTISSA_SIGN_ENUM: Type = Type::MM_MANTISSA_SIGN_ENUM;
 static MM_PERM_ENUM: Type = Type::MM_PERM_ENUM;
+static TILE1024I: Type = Type::TILE1024I;
 
 static TUPLE: Type = Type::Tuple;
 static CPUID: Type = Type::CpuidResult;
@@ -102,6 +103,7 @@ enum Type {
     CpuidResult,
     Never,
     Ordering,
+    TILE1024I,
 }
 
 stdarch_verify::x86_functions!(static FUNCTIONS);
@@ -661,12 +663,14 @@ fn matches(rust: &Function, intel: &Intrinsic) -> Result<(), String> {
 fn pointed_type(intrinsic: &Intrinsic) -> Result<Type, String> {
     Ok(
         if intrinsic.tech == "AMX"
-            || intrinsic
-                .cpuid
-                .iter()
-                .any(|cpuid| matches!(&**cpuid, "KEYLOCKER" | "KEYLOCKER_WIDE" | "XSAVE" | "FXSR"))
+            || intrinsic.cpuid.iter().any(|cpuid| {
+                matches!(
+                    &**cpuid,
+                    "KEYLOCKER" | "KEYLOCKER_WIDE" | "XSAVE" | "FXSR" | "CLFLUSHOPT"
+                )
+            })
         {
-            // AMX, KEYLOCKER and XSAVE intrinsics should take `*u8`
+            // AMX, KEYLOCKER, XSAVE and CLFLUSHOPT intrinsics should take `*u8`
             U8
         } else if intrinsic.name == "_mm_clflush" {
             // Just a false match in the following logic
@@ -774,6 +778,7 @@ fn equate(
         (&Type::MMASK32, "__mmask32") => {}
         (&Type::MMASK16, "__mmask16") => {}
         (&Type::MMASK8, "__mmask8") => {}
+        (&Type::TILE1024I, "__tile1024i") => {}
 
         (&Type::MutPtr(_type), "void*") | (&Type::ConstPtr(_type), "void const*") => {
             let pointed_type = pointed_type(intrinsic)?;
@@ -812,6 +817,7 @@ fn equate(
         (&Type::MutPtr(&Type::M512BH), "__m512bh*") => {}
         (&Type::MutPtr(&Type::M512I), "__m512i*") => {}
         (&Type::MutPtr(&Type::M512D), "__m512d*") => {}
+        (&Type::MutPtr(&Type::TILE1024I), "__tile1024i*") => {}
 
         (&Type::ConstPtr(&Type::PrimFloat(16)), "_Float16 const*") => {}
         (&Type::ConstPtr(&Type::PrimFloat(32)), "float const*") => {}
diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs
index ead6e08..6967c7f 100644
--- a/library/unwind/src/libunwind.rs
+++ b/library/unwind/src/libunwind.rs
@@ -72,7 +72,7 @@ pub enum _Unwind_Reason_Code {
 #[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))]
 pub const unwinder_private_data_size: usize = 2;
 
-#[cfg(all(target_arch = "wasm32", target_os = "emscripten"))]
+#[cfg(all(target_family = "wasm", target_os = "emscripten"))]
 pub const unwinder_private_data_size: usize = 20;
 
 #[cfg(all(target_arch = "wasm32", any(target_os = "linux", target_os = "wasi")))]
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 5637928..fcec091 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -926,6 +926,21 @@
         >>> rb.get_toml('key', 'c') is None
         True
 
+        A dotted key names a table relative to its enclosing section, so the
+        full table path must match for the key to be found:
+
+        >>> rb.config_toml = 'build.cargo = "/path/to/cargo"'
+        >>> rb.get_toml('cargo', 'build')
+        '/path/to/cargo'
+        >>> rb.get_toml('cargo', 'other') is None
+        True
+
+        A dotted key inside a section composes with that section's name:
+
+        >>> rb.config_toml = '[target]\\nx86_64-unknown-linux-gnu.cc = "gcc"'
+        >>> rb.get_toml('cc', 'target.x86_64-unknown-linux-gnu')
+        'gcc'
+
         >>> rb.config_toml = 'key1 = true'
         >>> rb.get_toml("key1")
         'true'
@@ -940,10 +955,24 @@
             if section_match is not None:
                 cur_section = section_match.group(1)
 
-            match = re.match(r"^{}\s*=(.*)$".format(key), line)
+            # Match the key, optionally preceded by a dotted-table prefix (the
+            # `build.` in `build.cargo`), which names a table relative to the
+            # current `[section]` and is appended to `cur_section`. This is a
+            # subset parser, not full TOML: quoted names (e.g. the `'a.b'` that
+            # configure.py emits for dotted targets) are not matched here.
+            match = re.match(
+                r"^\s*(?:([\w.-]+)\.)?{}\s*=(.*)$".format(re.escape(key)), line
+            )
             if match is not None:
-                value = match.group(1)
-                if section is None or section == cur_section:
+                prefix = match.group(1)
+                if prefix is None:
+                    line_section = cur_section
+                elif cur_section is None:
+                    line_section = prefix
+                else:
+                    line_section = "{}.{}".format(cur_section, prefix)
+                value = match.group(2)
+                if section is None or section == line_section:
                     return RustBuild.get_string(value) or value.strip()
         return None
 
@@ -959,7 +988,10 @@
         """Return config path for the given program at the given stage
 
         >>> rb = RustBuild()
-        >>> rb.config_toml = 'rustc = "rustc"\\n'
+        >>> rb.config_toml = 'build.rustc = "rustc"\\n'
+        >>> rb.program_config('rustc')
+        'rustc'
+        >>> rb.config_toml = '[build]\\nrustc = "rustc"\\n'
         >>> rb.program_config('rustc')
         'rustc'
         >>> rb.config_toml = ''
@@ -968,7 +1000,7 @@
         ... "bin", "cargo")
         True
         """
-        config = self.get_toml(program)
+        config = self.get_toml(program, "build")
         if config:
             return os.path.expanduser(config)
         return os.path.join(self.bin_root(), "bin", "{}{}".format(program, EXE_SUFFIX))
diff --git a/src/bootstrap/bootstrap_test.py b/src/bootstrap/bootstrap_test.py
index b9cd0d7..163191a 100644
--- a/src/bootstrap/bootstrap_test.py
+++ b/src/bootstrap/bootstrap_test.py
@@ -190,6 +190,73 @@
         self.assertNotEqual(build.config_toml.find("codegen-backends = ['llvm']"), -1)
 
 
+class GetTomlDottedKeys(unittest.TestCase):
+    """Test that get_toml understands the dotted-table key syntax that a
+    hand-written bootstrap.toml may use (e.g. `build.cargo = "..."`), and that
+    it checks the table a key belongs to. See issue #156948."""
+
+    def parse(self, config_toml):
+        return bootstrap.RustBuild(config_toml=config_toml, args=bootstrap.FakeArgs())
+
+    def test_dotted_key(self):
+        build = self.parse('build.cargo = "/path/to/cargo"')
+        self.assertEqual(build.get_toml("cargo", "build"), "/path/to/cargo")
+
+    def test_dotted_key_matches_section_form(self):
+        dotted = self.parse('build.cargo = "/path/to/cargo"')
+        section = self.parse('[build]\ncargo = "/path/to/cargo"')
+        self.assertEqual(
+            dotted.get_toml("cargo", "build"), section.get_toml("cargo", "build")
+        )
+
+    def test_dotted_key_wrong_section(self):
+        # A `cargo` key in some other table must not be picked up for `build`.
+        build = self.parse('[foo]\ncargo = "false"')
+        self.assertIsNone(build.get_toml("cargo", "build"))
+
+    def test_program_config_requires_build_table(self):
+        # A cargo/rustc key outside [build] must be ignored; program_config
+        # falls back to the stage0 default path rather than the misplaced value.
+        wrong = self.parse('[foo]\ncargo = "/wrong/cargo"')
+        cargo_default = os.path.join(
+            wrong.bin_root(), "bin", "cargo" + bootstrap.EXE_SUFFIX
+        )
+        self.assertEqual(wrong.cargo(), cargo_default)
+
+        wrong_rustc = self.parse('[foo]\nrustc = "/wrong/rustc"')
+        rustc_default = os.path.join(
+            wrong_rustc.bin_root(), "bin", "rustc" + bootstrap.EXE_SUFFIX
+        )
+        self.assertEqual(wrong_rustc.rustc(), rustc_default)
+
+        # A dotted key in the build table is honored.
+        right = self.parse('build.cargo = "/path/to/cargo"')
+        self.assertEqual(right.cargo(), "/path/to/cargo")
+
+    def test_dotted_target_key(self):
+        build = self.parse('target.x86_64-unknown-linux-gnu.cc = "gcc"')
+        self.assertEqual(build.get_toml("cc", "target.x86_64-unknown-linux-gnu"), "gcc")
+
+    def test_dotted_key_inside_section(self):
+        # A dotted key nested under a `[section]` header composes with that
+        # section's name; it is equivalent to the fully top-level dotted form.
+        nested = self.parse('[target]\nx86_64-unknown-linux-gnu.cc = "gcc"')
+        self.assertEqual(
+            nested.get_toml("cc", "target.x86_64-unknown-linux-gnu"), "gcc"
+        )
+        top_level = self.parse('target.x86_64-unknown-linux-gnu.cc = "gcc"')
+        self.assertEqual(
+            nested.get_toml("cc", "target.x86_64-unknown-linux-gnu"),
+            top_level.get_toml("cc", "target.x86_64-unknown-linux-gnu"),
+        )
+
+    def test_dotted_prefix_does_not_alias_other_section(self):
+        # `build.cargo` inside `[foo]` is `foo.build.cargo`, not the top-level
+        # `[build]` table, so it must not be returned for section "build".
+        build = self.parse('[foo]\nbuild.cargo = "false"')
+        self.assertIsNone(build.get_toml("cargo", "build"))
+
+
 class BuildBootstrap(unittest.TestCase):
     """Test that we generate the appropriate arguments when building bootstrap"""
 
diff --git a/src/bootstrap/download-ci-llvm-stamp b/src/bootstrap/download-ci-llvm-stamp
index 0fccbd7..eb3f664 100644
--- a/src/bootstrap/download-ci-llvm-stamp
+++ b/src/bootstrap/download-ci-llvm-stamp
@@ -1,4 +1,4 @@
 Change this file to make users of the `download-ci-llvm` configuration download
 a new version of LLVM from CI, even if the LLVM submodule hasn’t changed.
 
-Last change is for: https://github.com/rust-lang/rust/pull/157205
+Last change is for: https://github.com/rust-lang/rust/pull/157557
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile
index 7ca2dbb..2c9788a 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile
+++ b/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:22.04
+FROM ubuntu:26.04
 
 ARG DEBIAN_FRONTEND=noninteractive
 RUN apt-get update && apt-get install -y --no-install-recommends \
diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml
index 6b6d560..2bdf83a 100644
--- a/src/ci/github-actions/jobs.yml
+++ b/src/ci/github-actions/jobs.yml
@@ -467,6 +467,7 @@
         --enable-profiler
         --disable-docs
         --set rust.jemalloc
+        --set llvm.link-shared=true
         --set rust.lto=thin
         --set rust.codegen-units=1
       # Ensure that host tooling is built to support our minimum support macOS version.
diff --git a/src/doc/rustc/src/platform-support/arm-none-eabi.md b/src/doc/rustc/src/platform-support/arm-none-eabi.md
index 5d22cef..4a6c478 100644
--- a/src/doc/rustc/src/platform-support/arm-none-eabi.md
+++ b/src/doc/rustc/src/platform-support/arm-none-eabi.md
@@ -12,7 +12,7 @@
 ### Tier 2 Target List
 
 - Arm A-Profile Architectures
-  - [`armv7a-none-eabi`](armv7a-none-eabi.md)
+  - [`armv7a-none-eabi` and `armv7a-none-eabihf`](armv7a-none-eabi.md)
   - [`thumbv7a-none-eabi` and `thumbv7a-none-eabihf`](armv7a-none-eabi.md)
 - Arm R-Profile Architectures
   - [`armv7r-none-eabi` and `armv7r-none-eabihf`](armv7r-none-eabi.md)
@@ -32,7 +32,7 @@
 ### Tier 3 Target List
 
 - Arm A-Profile Architectures
-  - [`armv7a-none-eabihf`](armv7a-none-eabi.md)
+  - None
 - Arm R-Profile Architectures
   - None
 - Arm M-Profile Architectures
diff --git a/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md b/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md
index 02510d9..5c74e7b 100644
--- a/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md
+++ b/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md
@@ -8,6 +8,7 @@
 ## Target maintainers
 
 [@kjetilkjeka](https://github.com/kjetilkjeka)
+[@kulst](https://github.com/kulst)
 
 ## Requirements
 
diff --git a/src/doc/rustdoc/src/write-documentation/documentation-tests.md b/src/doc/rustdoc/src/write-documentation/documentation-tests.md
index 4084c1d..84d9827 100644
--- a/src/doc/rustdoc/src/write-documentation/documentation-tests.md
+++ b/src/doc/rustdoc/src/write-documentation/documentation-tests.md
@@ -1,7 +1,7 @@
 # Documentation tests
 
-`rustdoc` supports executing your documentation examples as tests. This makes sure
-that examples within your documentation are up to date and working.
+`rustdoc` supports executing your documentation examples as tests.
+This makes sure that examples within your documentation are up to date and working.
 
 The basic idea is this:
 
@@ -14,11 +14,13 @@
 # fn f() {}
 ```
 
-The triple backticks start and end code blocks. If this were in a file named `foo.rs`,
-running `rustdoc --test foo.rs` will extract this example, and then run it as a test.
+Here, the triple backticks start and end the code block.
+If this were in a file named `foo.rs`, running `rustdoc --test foo.rs` will extract this example,
+and then run it as a test.
 
-Please note that by default, if no language is set for the block code, rustdoc
-assumes it is Rust code. So the following:
+Please note that by default,
+if no language is set for the block code, rustdoc assumes it is Rust code.
+So the following:
 
 ``````markdown
 ```rust
@@ -321,21 +323,43 @@
 
 ## Attributes
 
-Code blocks can be annotated with attributes that help `rustdoc` do the right
-thing when testing your code:
+Code blocks can be annotated with attributes that tell `rustdoc` how to build and interpret the test.
+They follow the [code fence] in the opening line.
+As such, they share the place with language strings like `rust` or `text`.
+Multiple attributes can be provided by separating them with commas, spaces or tabs.
+You can also write comments which are enclosed in parentheses `(…)`.
 
-The `ignore` attribute tells Rust to ignore your code. This is almost never
-what you want as it's the most generic. Instead, consider annotating it
-with `text` if it's not code or using `#`s to get a working example that
-only shows the part you care about.
+As alluded to in the introduction at the very top,
+unless you specify `rust` or something that isn't an attribute (except for `custom`),
+the code block is assumed to be Rust source code (and is syntax highlighted as such).
+
+You can of course add `rust` explicitly (like `rust,ignore`) if the Markdown is also consumed by
+other tools (e.g., if it's contained inside of a `README.md` that's included via `include_str`).
+
+### `ignore`
+
+The `ignore` attribute tells `rustdoc` to ignore your code. This is useful if you would like to
+have Rust syntax highlighting but the snippet is incomplete or pseudocode.
+It is customary to add the reason why it should be ignored in a `(…)` comment.
 
 ```rust
 /// ```ignore
 /// fn foo() {
 /// ```
+///
+/// ```ignore (needs extra dependency)
+/// use dependency::functionality;
+/// functionality();
+/// ```
 # fn foo() {}
 ```
 
+Do note that this is almost never what you want as it's the most generic.
+Instead, consider annotating it with `text` if it's not code or
+using `#`s to get a working example that only shows the part you care about.
+
+### `should_panic`
+
 `should_panic` tells `rustdoc` that the code should compile correctly but
 panic during execution. If the code doesn't panic, the test will fail.
 
@@ -346,6 +370,8 @@
 # fn foo() {}
 ```
 
+### `no_run`
+
 The `no_run` attribute will compile your code but not run it. This is
 important for examples such as "Here's how to retrieve a web page,"
 which you would want to ensure compiles, but might be run in a test
@@ -361,10 +387,10 @@
 # fn foo() {}
 ```
 
+### `compile_fail`
+
 `compile_fail` tells `rustdoc` that the compilation should fail. If it
-compiles, then the test will fail. However, please note that code failing
-with the current Rust release may work in a future release, as new features
-are added.
+compiles, then the test will fail.
 
 ```rust
 /// ```compile_fail
@@ -374,6 +400,13 @@
 # fn foo() {}
 ```
 
+<div class="warning">
+However, please note that code failing with the current Rust release may work in a future release,
+as new features are added!
+</div>
+
+### `edition…`
+
 `edition2015`, `edition2018`, `edition2021`, and `edition2024` tell `rustdoc`
 that the code sample should be compiled using the respective edition of Rust.
 
@@ -390,6 +423,8 @@
 # fn foo() {}
 ```
 
+### `standalone_crate`
+
 Starting in the 2024 edition[^edition-note], compatible doctests are merged as one before being
 run. We combine doctests for performance reasons: the slowest part of doctests is to compile them.
 Merging all of them into one file and compiling this new file, then running the doctests is much
@@ -441,7 +476,7 @@
 In this case, it means that the line information will not change if you add/remove other
 doctests.
 
-### Ignoring targets
+### `ignore-…`: Ignoring targets
 
 Attributes starting with `ignore-` can be used to ignore doctests for specific
 targets. For example, `ignore-x86_64` will avoid building doctests when the
@@ -478,7 +513,7 @@
 In older versions, this will be ignored on all targets, but starting with
 version 1.88.0, `ignore-x86_64` will override `ignore`.
 
-### Custom CSS classes for code blocks
+### `{…}` & `custom`: Custom CSS classes for code blocks
 
 ```rust
 /// ```custom,{class=language-c}
@@ -504,8 +539,9 @@
 pub struct Bar;
 ```
 
-To be noted, `rust` and `.rust`/`class=rust` have different effects: `rust` indicates that this is
-a Rust code block whereas the two others add a "rust" CSS class on the code block.
+To be noted, `rust` and `{.rust}` / `{class=rust}` have different effects:
+`rust` indicates that this is a Rust code block whereas
+the two others add a "rust" CSS class on the code block in the generated HTML.
 
 You can also use double quotes:
 
@@ -516,24 +552,42 @@
 pub struct Bar;
 ```
 
+### `test_harness`
+
+With `test_harness` applied, `rustdoc` will run any contained *test functions*
+instead of the (potentially implicit) `main` function.
+
+```rust
+//! ```test_harness
+//! #[test]
+//! #[should_panic]
+//! fn abc() { assert!(false); }
+//!
+//! #[test]
+//! fn xyz() { assert!(true); }
+//! ```
+```
+
+You can read more about *test functions* in [the Book][testing-book] or in [the Rust Reference][testing-ref].
+
+[testing-book]: ../../book/ch11-01-writing-tests.html
+[testing-ref]: ../../reference/attributes/testing.html
+
 ## Syntax reference
 
-The *exact* syntax for code blocks, including the edge cases, can be found
-in the [Fenced Code Blocks](https://spec.commonmark.org/0.29/#fenced-code-blocks)
-section of the CommonMark specification.
+The *exact* syntax for code blocks, including the edge cases,
+can be found in the [Fenced Code Blocks] section of the CommonMark specification.
 
-Rustdoc also accepts *indented* code blocks as an alternative to fenced
-code blocks: instead of surrounding your code with three backticks, you
-can indent each line by four or more spaces.
+Rustdoc also accepts *indented* code blocks as an alternative to fenced code blocks:
+Instead of surrounding your code with a [code fence] (e.g., three backticks),
+you can indent each line by four or more spaces.
 
 ``````markdown
     let foo = "foo";
     assert_eq!(foo, "foo");
 ``````
 
-These, too, are documented in the CommonMark specification, in the
-[Indented Code Blocks](https://spec.commonmark.org/0.29/#indented-code-blocks)
-section.
+These, too, are documented in the CommonMark specification, in the [Indented Code Blocks] section.
 
 However, it's preferable to use fenced code blocks over indented code blocks.
 Not only are fenced code blocks considered more idiomatic for Rust code,
@@ -595,3 +649,8 @@
 The `--test-run-directory` flag allows controlling the run directory separately from the compilation directory.
 This is particularly useful in workspaces, where compiler invocations and thus diagnostics should be
 relative to the workspace directory, but documentation test examples should run relative to the crate directory.
+
+
+[code fence]: https://spec.commonmark.org/0.29/#code-fence
+[Fenced Code Blocks]: https://spec.commonmark.org/0.29/#fenced-code-blocks
+[Indented Code Blocks]: https://spec.commonmark.org/0.29/#indented-code-blocks
diff --git a/src/doc/unstable-book/src/compiler-flags/staticlib-hide-internal-symbols.md b/src/doc/unstable-book/src/compiler-flags/staticlib-hide-internal-symbols.md
new file mode 100644
index 0000000..55c5cf8
--- /dev/null
+++ b/src/doc/unstable-book/src/compiler-flags/staticlib-hide-internal-symbols.md
@@ -0,0 +1,32 @@
+# `staticlib-hide-internal-symbols`
+
+When building a `staticlib`, this option hides all non-exported Rust-internal
+symbols. On ELF targets, this sets `STV_HIDDEN` visibility. On Apple (Mach-O)
+targets, this sets the `N_PEXT` (private external) bit.
+
+This is a lightweight, zero-overhead operation: only the visibility/type byte of
+each internal symbol is modified in-place.
+
+Only symbols explicitly exported via `#[no_mangle]` or `#[export_name]` are left
+unchanged. All other `GLOBAL`/`WEAK` symbols (including `pub(crate)` and `pub`
+items without `#[no_mangle]`) are hidden.
+
+This option can only be used with `--crate-type staticlib`. Using it with
+other crate types will result in a compilation warning.
+
+Supported on ELF targets (Linux, BSD, etc.) and Apple targets (macOS, iOS, etc.).
+On unsupported targets (Windows), a warning is emitted and the flag has no effect.
+
+This option can be combined with `-Zstaticlib-rename-internal-symbols`.
+When both are enabled, symbols are both renamed and hidden.
+
+## Comparison with `-Zdefault-visibility=hidden`
+
+`-Zdefault-visibility=hidden` sets visibility at LLVM IR codegen time. It targets
+shared objects (`cdylib`/`dylib`) and only affects the current crate's codegen.
+
+`-Zstaticlib-hide-internal-symbols` patches visibility bytes post-compilation in
+the final `.a` archive, which includes object files from all upstream static
+dependencies. This means internal symbols from the entire dependency tree are
+hidden, not just those from the current crate. Hidden symbols are also excluded
+from the linker's global symbol table, which can slightly reduce final binary size.
diff --git a/src/doc/unstable-book/src/language-features/asm-experimental-arch.md b/src/doc/unstable-book/src/language-features/asm-experimental-arch.md
index 23ac46b..d09da7c 100644
--- a/src/doc/unstable-book/src/language-features/asm-experimental-arch.md
+++ b/src/doc/unstable-book/src/language-features/asm-experimental-arch.md
@@ -18,6 +18,7 @@
 - M68k
 - CSKY
 - SPARC
+- Xtensa
 
 ## Register classes
 
@@ -46,6 +47,10 @@
 | CSKY         | `freg`         | `f[0-31]`                          | `f`                  |
 | SPARC        | `reg`          | `r[2-29]`                          | `r`                  |
 | SPARC        | `yreg`         | `y`                                | Only clobbers        |
+| Xtensa       | `reg`          | `a[2-15]`                          | `r`                  |
+| Xtensa       | `freg`         | `f[0-15]`                          | `f`                  |
+| Xtensa       | `sreg`         | `sar`, `scompare1`, `lbeg`, `lend`, `lcount`, `acclo`, `acchi`, `m[0-3]` | Only clobbers |
+| Xtensa       | `breg`         | `b[0-15]`                          | Only clobbers        |
 
 > **Notes**:
 > - NVPTX doesn't have a fixed register set, so named registers are not supported.
@@ -77,6 +82,10 @@
 | CSKY         | `freg`                          | None           | `f32`,                                  |
 | SPARC        | `reg`                           | None           | `i8`, `i16`, `i32`, `i64` (SPARC64 only) |
 | SPARC        | `yreg`                          | N/A            | Only clobbers                           |
+| Xtensa       | `reg`                           | None           | `i8`, `i16`, `i32`                      |
+| Xtensa       | `freg`                          | `fp`           | `f32`                                   |
+| Xtensa       | `sreg`                          | N/A            | Only clobbers                           |
+| Xtensa       | `breg`                          | `bool`         | Only clobbers                           |
 
 ## Register aliases
 
@@ -113,6 +122,7 @@
 | SPARC        | `r[8-15]`     | `o[0-7]`  |
 | SPARC        | `r[16-23]`    | `l[0-7]`  |
 | SPARC        | `r[24-31]`    | `i[0-7]`  |
+| Xtensa       | `a1`          | `sp`      |
 
 > **Notes**:
 > - TI does not mandate a frame pointer for MSP430, but toolchains are allowed
@@ -145,6 +155,9 @@
 | SPARC        | `r5`/`g5`                               | Reserved for system. (SPARC32 only) |
 | SPARC        | `r6`/`g6`, `r7`/`g7`                    | Reserved for system. |
 | SPARC        | `r31`/`i7`                              | Return address cannot be used as inputs or outputs. |
+| Xtensa       | `a0`                                    | This is the return address register and is used internally by LLVM. |
+| Xtensa       | `a1`/`sp`                               | This is the stack pointer and is used internally by LLVM. |
+| Xtensa       | `a7` (windowed ABI) / `a15` (call0 ABI) | The frame pointer cannot be used as an input or output. |
 
 
 ## Template modifiers
@@ -160,6 +173,8 @@
 | SPARC        | `reg`          | None     | `%o0`          | None          |
 | CSKY         | `reg`          | None     | `r0`           | None          |
 | CSKY         | `freg`         | None     | `f0`           | None          |
+| Xtensa       | `reg`          | None     | `a2`           | None          |
+| Xtensa       | `freg`         | None     | `f0`           | None          |
 
 # Flags covered by `preserves_flags`
 
diff --git a/src/etc/lldb_batchmode/runner.py b/src/etc/lldb_batchmode/runner.py
index e9b1063..cdc5458 100644
--- a/src/etc/lldb_batchmode/runner.py
+++ b/src/etc/lldb_batchmode/runner.py
@@ -98,7 +98,7 @@
                     "registering breakpoint callback, id = " + str(breakpoint_id)
                 )
                 callback_command = f"breakpoint command add -s python {str(breakpoint_id)} -o \
-                    'import lldb_batchmode; lldb_batchmode.breakpoint_callback'"
+'import lldb_batchmode; lldb_batchmode.runner.breakpoint_callback'"
 
                 command_interpreter.HandleCommand(callback_command, res)
                 if res.Succeeded():
diff --git a/src/etc/lldb_lookup.py b/src/etc/lldb_lookup.py
index cc3e841..057caf7 100644
--- a/src/etc/lldb_lookup.py
+++ b/src/etc/lldb_lookup.py
@@ -114,6 +114,8 @@
         FEATURE_FLAGS |= LLDBFeature.StaticFields
     if getattr(lldb, "eFormatterMatchCallback", None) is not None:
         FEATURE_FLAGS |= LLDBFeature.TypeRecognizers
+    if getattr(lldb, "eBasicTypeFloat128", None) is not None:
+        FEATURE_FLAGS |= LLDBFeature.Float128
 
     register_providers_compatibility()
 
@@ -393,7 +395,7 @@
 def is_udt(type: lldb.SBType, _dict: LLDBOpaque) -> bool:
     return (
         type.GetBasicType() == lldb.eBasicTypeInvalid
-        and not type.IsScopedEnumerationType()
+        and not type.GetEnumerationIntegerType().IsValid()
         and not type.IsPointerType()
         and not type.IsArrayType()
     )
diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py
index 81841dc..f6c2ab8 100644
--- a/src/etc/lldb_providers.py
+++ b/src/etc/lldb_providers.py
@@ -1,6 +1,6 @@
 from __future__ import annotations
 import sys
-from typing import Generator, List, TYPE_CHECKING, Optional
+from typing import Generator, Dict, List, TYPE_CHECKING, Optional
 from enum import Flag, auto
 
 from lldb import (
@@ -9,6 +9,15 @@
     eBasicTypeLong,
     eBasicTypeUnsignedLong,
     eBasicTypeUnsignedChar,
+    eBasicTypeUnsignedShort,
+    eBasicTypeUnsignedLongLong,
+    eBasicTypeSignedChar,
+    eBasicTypeShort,
+    eBasicTypeLongLong,
+    eBasicTypeFloat,
+    eBasicTypeDouble,
+    eBasicTypeHalf,
+    eBasicTypeChar32,
     eFormatChar,
     eTypeIsInteger,
 )
@@ -67,6 +76,9 @@
     """Added in LLDB 18. Adds functions to `SBType` the inspection of a struct's static fields."""
     TypeRecognizers = auto()
     """Added in LLDB 19. Callback-based type matching for synthetic/summary providers."""
+    Float128 = auto()
+    """Added in LLDB 22.1. Adds builtin support for Float 128's, including an `eBasicTypeFloat128`,
+    a formatter, and handlers in `TypeSystemClang`"""
 
 
 FEATURE_FLAGS: LLDBFeature = LLDBFeature(0)
@@ -198,6 +210,21 @@
 
 MSVC_PTR_PREFIX: List[str] = ["ref$<", "ref_mut$<", "ptr_const$<", "ptr_mut$<"]
 
+PRIMITIVE_TYPES: Dict[str, int] = {
+    "u8": eBasicTypeUnsignedChar,
+    "u16": eBasicTypeUnsignedShort,
+    "u32": eBasicTypeUnsignedLong,
+    "u64": eBasicTypeUnsignedLongLong,
+    "i8": eBasicTypeSignedChar,
+    "i16": eBasicTypeShort,
+    "i32": eBasicTypeLong,
+    "i64": eBasicTypeLongLong,
+    "f16": eBasicTypeHalf,
+    "f32": eBasicTypeFloat,
+    "f64": eBasicTypeDouble,
+    "char": eBasicTypeChar32,
+}
+
 
 def resolve_msvc_template_arg(arg_name: str, target: SBTarget) -> SBType:
     """
@@ -214,6 +241,22 @@
     current version of LLDB, so instead the types are generated via `base_type.GetPointerType()` and
     `base_type.GetArrayType()`, which bypass the PDB file and ask clang directly for the type node.
     """
+
+    # As of LLDB 22, finding primitives based on `FindFirstType` with their rust name no longer
+    # works. Instead, we can look them up by their `eBasicType` equivalent. For usize and isize,
+    # we convert them to their bit-sized counterpart before the lookup
+    if arg_name == "isize" or arg_name == "usize":
+        equivalent = f"{arg_name[0]}{target.GetAddressByteSize() * 8}"
+        return target.GetBasicType(PRIMITIVE_TYPES[equivalent])
+
+    if (basic_type := PRIMITIVE_TYPES.get(arg_name)) is not None:
+        return target.GetBasicType(basic_type)
+
+    if arg_name == "f128" and LLDBFeature.Float128 in FEATURE_FLAGS:
+        from lldb import eBasicTypeFloat128
+
+        return target.GetBasicType(eBasicTypeFloat128)
+
     result = target.FindFirstType(arg_name)
 
     if result.IsValid():
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 7442ec99..c2fd72e 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -417,15 +417,10 @@ fn clean_where_predicate<'tcx>(
                 bound_params,
             }
         }
-
         hir::WherePredicateKind::RegionPredicate(wrp) => WherePredicate::RegionPredicate {
             lifetime: clean_lifetime(wrp.lifetime, cx),
             bounds: wrp.bounds.iter().filter_map(|x| clean_generic_bound(x, cx)).collect(),
         },
-
-        // We should never actually reach this case because these predicates should've already been
-        // rejected in an earlier compiler pass. This feature isn't fully implemented (#20041).
-        hir::WherePredicateKind::EqPredicate(_) => bug!("EqPredicate"),
     })
 }
 
@@ -530,7 +525,7 @@ fn clean_projection_predicate<'tcx>(
     pred: ty::Binder<'tcx, ty::ProjectionPredicate<'tcx>>,
     cx: &mut DocContext<'tcx>,
 ) -> WherePredicate {
-    WherePredicate::EqPredicate {
+    WherePredicate::ProjectionPredicate {
         lhs: clean_projection(pred.map_bound(|p| p.projection_term), cx, None),
         rhs: clean_middle_term(pred.map_bound(|p| p.term), cx),
     }
@@ -797,8 +792,8 @@ pub(crate) fn clean_generics<'tcx>(
                     }
                 }
             }
-            WherePredicate::EqPredicate { lhs, rhs } => {
-                eq_predicates.push(WherePredicate::EqPredicate { lhs, rhs });
+            WherePredicate::ProjectionPredicate { lhs, rhs } => {
+                eq_predicates.push(WherePredicate::ProjectionPredicate { lhs, rhs });
             }
         }
     }
diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs
index a5b5660..fecbc91 100644
--- a/src/librustdoc/clean/simplify.rs
+++ b/src/librustdoc/clean/simplify.rs
@@ -40,7 +40,7 @@ pub(crate) fn where_clauses(tcx: TyCtxt<'_>, clauses: ThinVec<WP>) -> ThinVec<WP
             WP::RegionPredicate { lifetime, bounds } => {
                 lifetimes.push((lifetime, bounds));
             }
-            WP::EqPredicate { lhs, rhs } => equalities.push((lhs, rhs)),
+            WP::ProjectionPredicate { lhs, rhs } => equalities.push((lhs, rhs)),
         }
     }
 
@@ -61,7 +61,7 @@ pub(crate) fn where_clauses(tcx: TyCtxt<'_>, clauses: ThinVec<WP>) -> ThinVec<WP
         bounds,
         bound_params,
     }));
-    clauses.extend(equalities.into_iter().map(|(lhs, rhs)| WP::EqPredicate { lhs, rhs }));
+    clauses.extend(equalities.into_iter().map(|(lhs, rhs)| WP::ProjectionPredicate { lhs, rhs }));
     clauses
 }
 
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs
index 9c757cf..1d51424 100644
--- a/src/librustdoc/clean/types.rs
+++ b/src/librustdoc/clean/types.rs
@@ -822,7 +822,7 @@ fn build_fn_header(
                 {
                     hir::Constness::NotConst
                 } else {
-                    hir::Constness::Const
+                    hir::Constness::Const { always: false }
                 }
             } else {
                 hir::Constness::NotConst
@@ -853,11 +853,8 @@ fn build_fn_header(
                         safety.into()
                     },
                     abi,
-                    constness: if tcx.is_const_fn(def_id) {
-                        hir::Constness::Const
-                    } else {
-                        hir::Constness::NotConst
-                    },
+                    // Foreign functions can never be const or comptime
+                    constness: hir::Constness::NotConst,
                     asyncness: hir::IsAsync::NotAsync,
                 }
             }
@@ -1250,7 +1247,7 @@ pub(crate) fn name(self) -> Symbol {
 pub(crate) enum WherePredicate {
     BoundPredicate { ty: Type, bounds: Vec<GenericBound>, bound_params: Vec<GenericParamDef> },
     RegionPredicate { lifetime: Lifetime, bounds: Vec<GenericBound> },
-    EqPredicate { lhs: QPathData, rhs: Term },
+    ProjectionPredicate { lhs: QPathData, rhs: Term },
 }
 
 impl WherePredicate {
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs
index 4367209..f49840a 100644
--- a/src/librustdoc/clean/utils.rs
+++ b/src/librustdoc/clean/utils.rs
@@ -350,15 +350,20 @@ fn print_pat(pat: &Pat<'_>, wild: bool) -> impl Display {
 
 pub(crate) fn print_const(tcx: TyCtxt<'_>, n: ty::Const<'_>) -> String {
     match n.kind() {
-        ty::ConstKind::Unevaluated(ty::UnevaluatedConst { kind, .. }) => {
-            if let Some(def) = kind.def_id().as_local()
-                && let Some(body_id) = tcx.hir_maybe_body_owned_by(def)
-            {
-                rendered_const(tcx, body_id, def)
-            } else {
-                inline::print_inlined_const(tcx, kind.def_id())
+        ty::ConstKind::Unevaluated(ty::UnevaluatedConst { kind, .. }) => match kind {
+            ty::UnevaluatedConstKind::Projection { def_id }
+            | ty::UnevaluatedConstKind::Inherent { def_id }
+            | ty::UnevaluatedConstKind::Free { def_id }
+            | ty::UnevaluatedConstKind::Anon { def_id } => {
+                if let Some(local_def_id) = def_id.as_local()
+                    && let Some(body_id) = tcx.hir_maybe_body_owned_by(local_def_id)
+                {
+                    rendered_const(tcx, body_id, local_def_id)
+                } else {
+                    inline::print_inlined_const(tcx, def_id)
+                }
             }
-        }
+        },
         // array lengths are obviously usize
         ty::ConstKind::Value(cv) if *cv.ty.kind() == ty::Uint(ty::UintTy::Usize) => {
             cv.to_leaf().to_string()
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index cbb5fed..f44212f 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -20,8 +20,8 @@
 use rustc_hir::{ConstStability, StabilityLevel, StableSince};
 use rustc_metadata::creader::CStore;
 use rustc_middle::ty::{self, TyCtxt, TypingMode};
-use rustc_span::Symbol;
 use rustc_span::symbol::kw;
+use rustc_span::{Ident, Symbol};
 use tracing::{debug, trace};
 
 use super::url_parts_builder::UrlPartsBuilder;
@@ -138,7 +138,7 @@ fn print_where_predicate(predicate: &clean::WherePredicate, cx: &Context<'_>) ->
                 }
                 Ok(())
             }
-            clean::WherePredicate::EqPredicate { lhs, rhs } => {
+            clean::WherePredicate::ProjectionPredicate { lhs, rhs } => {
                 let opts = WithOpts::from(f);
                 write!(
                     f,
@@ -1109,8 +1109,23 @@ fn print_qpath_data(qpath_data: &clean::QPathData, cx: &Context<'_>) -> impl Dis
                 Some(trait_) => href(trait_.def_id(), cx).ok(),
                 None => self_type.def_id(cx.cache()).and_then(|did| href(did, cx).ok()),
             };
+            let tcx = cx.tcx();
+            let assoc_type_is_hidden = !cx.cache().document_hidden
+                && trait_.as_ref().is_some_and(|trait_| {
+                    let trait_did = trait_.def_id();
+                    tcx.associated_items(trait_did)
+                        .find_by_ident_and_kind(
+                            tcx,
+                            Ident::with_dummy_span(assoc.name),
+                            ty::AssocTag::Type,
+                            trait_did,
+                        )
+                        .is_some_and(|assoc_item| tcx.is_doc_hidden(assoc_item.def_id))
+                });
 
-            if let Some(HrefInfo { url, rust_path, .. }) = parent_href {
+            if let Some(HrefInfo { url, rust_path, .. }) = parent_href
+                && !assoc_type_is_hidden
+            {
                 write!(
                     f,
                     "<a class=\"associatedtype\" href=\"{url}#{shortty}.{name}\" \
@@ -1494,15 +1509,21 @@ pub(crate) fn print_constness_with_space(
     overall_stab: Option<StableSince>,
     const_stab: Option<ConstStability>,
 ) -> &'static str {
-    match c {
-        hir::Constness::Const => match (overall_stab, const_stab) {
+    match *c {
+        hir::Constness::Const { always } => match (overall_stab, const_stab) {
             // const stable...
             (_, Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }))
             // ...or when feature(staged_api) is not set...
             | (_, None)
             // ...or when const unstable, but overall unstable too
             | (None, Some(ConstStability { level: StabilityLevel::Unstable { .. }, .. })) => {
-                "const "
+                if always {
+                    // FIXME(comptime) show something when stable, currently relying on the attribute
+                    // being rendered as part of the regular attribute list.
+                    ""
+                } else {
+                    "const "
+                }
             }
             // const unstable (and overall stable)
             (Some(_), Some(ConstStability { level: StabilityLevel::Unstable { .. }, .. })) => "",
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 6679d16..b05a831 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -846,11 +846,12 @@ pub(crate) enum Ignore {
     Some(Vec<String>),
 }
 
-/// This is the parser for fenced codeblocks attributes. It implements the following eBNF:
+/// This is the parser for fenced codeblocks attributes.
 ///
-/// ```eBNF
+/// It implements the following grammar as expressed in ABNF:
+///
+/// ```ABNF
 /// lang-string = *(token-list / delimited-attribute-list / comment)
-///
 /// bareword = LEADINGCHAR *(CHAR)
 /// bareword-without-leading-char = CHAR *(CHAR)
 /// quoted-string = QUOTE *(NONQUOTE) QUOTE
@@ -861,7 +862,7 @@ pub(crate) enum Ignore {
 /// attribute-list = [sep] attribute *(sep attribute) [sep]
 /// delimited-attribute-list = OPEN-CURLY-BRACKET attribute-list CLOSE-CURLY-BRACKET
 /// token-list = [sep] token *(sep token) [sep]
-/// comment = OPEN_PAREN *(all characters) CLOSE_PAREN
+/// comment = OPEN_PAREN *<all characters except closing parentheses> CLOSE_PAREN
 ///
 /// OPEN_PAREN = "("
 /// CLOSE_PARENT = ")"
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index fd6d389..5558c36 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -40,6 +40,7 @@
 mod write_shared;
 
 use std::borrow::Cow;
+use std::cmp::Ordering;
 use std::collections::VecDeque;
 use std::fmt::{self, Display as _, Write};
 use std::iter::Peekable;
@@ -79,7 +80,7 @@
 use crate::html::markdown::{
     HeadingOffset, IdMap, Markdown, MarkdownItemInfo, MarkdownSummaryLine, short_markdown_summary,
 };
-use crate::html::render::print_item::compare_names;
+use crate::html::render::print_item::ImplString;
 use crate::html::render::search_index::get_function_type_for_search;
 use crate::html::static_files::SCRAPE_EXAMPLES_HELP_MD;
 use crate::html::{highlight, sources};
@@ -954,46 +955,50 @@ fn impl_trait_key(cx: &Context<'_>, i: &Impl) -> Option<String> {
 
 // Render the list of items inside one of the sections "Trait Implementations",
 // "Auto Trait Implementations," "Blanket Trait Implementations" (on struct/enum pages).
-fn render_impls(
-    cx: &Context<'_>,
-    mut w: impl Write,
-    impls: &[&Impl],
-    containing_item: &clean::Item,
+fn render_impls<'a, 'cx>(
+    cx: &'a Context<'cx>,
+    mut impls: Vec<&'a Impl>,
+    containing_item: &'a clean::Item,
     toggle_open_by_default: bool,
-) -> fmt::Result {
+) -> impl fmt::Display + use<'a, 'cx> {
+    impls.sort_by_cached_key(|imp| {
+        let prefix = match imp.inner_impl().polarity {
+            ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => Ordering::Greater,
+            ty::ImplPolarity::Negative => Ordering::Less,
+        };
+        (prefix, ImplString::new_path(imp, cx))
+    });
     // Render each impl alongside its `impl_trait_key`, which is used as the primary sorting key
     // to match the impl order in the sidebar.
-    let mut keyed_rendered_impls = impls
-        .iter()
-        .map(|i| {
-            let did = i.trait_did().unwrap();
-            let provided_trait_methods = i.inner_impl().provided_trait_methods(cx.tcx());
-            let assoc_link = AssocItemLink::GotoSource(did.into(), &provided_trait_methods);
-            let imp = render_impl(
-                cx,
-                i,
-                containing_item,
-                assoc_link,
-                RenderMode::Normal,
-                None,
-                &[],
-                ImplRenderingParameters {
-                    show_def_docs: true,
-                    show_default_items: true,
-                    show_non_assoc_items: true,
-                    toggle_open_by_default,
-                },
-            );
-            (impl_trait_key(cx, i).unwrap(), imp.to_string())
-        })
-        .collect::<Vec<_>>();
 
-    // Sort and then remove the `impl_trait_key`s, which are no longer needed after sorting.
-    keyed_rendered_impls
-        .sort_by(|(k1, h1), (k2, h2)| compare_names(k1, k2).then_with(|| h1.cmp(h2)));
-    let joined: String = keyed_rendered_impls.into_iter().map(|a| a.1).collect();
-
-    w.write_str(&joined)
+    fmt::from_fn(move |f| {
+        impls
+            .iter()
+            .map(|i| {
+                fmt::from_fn(|f| {
+                    let did = i.trait_did().unwrap();
+                    let provided_trait_methods = i.inner_impl().provided_trait_methods(cx.tcx());
+                    let assoc_link = AssocItemLink::GotoSource(did.into(), &provided_trait_methods);
+                    render_impl(
+                        cx,
+                        i,
+                        containing_item,
+                        assoc_link,
+                        RenderMode::Normal,
+                        None,
+                        &[],
+                        ImplRenderingParameters {
+                            show_def_docs: true,
+                            show_default_items: true,
+                            show_non_assoc_items: true,
+                            toggle_open_by_default,
+                        },
+                    )
+                    .fmt(f)
+                })
+            })
+            .joined("", f)
+    })
 }
 
 /// Build a (possibly empty) `href` attribute (a key-value pair) for the given associated item.
@@ -1415,16 +1420,12 @@ fn render_all_impls(
     mut w: impl Write,
     cx: &Context<'_>,
     containing_item: &clean::Item,
-    concrete_impls: &[&Impl],
-    auto_trait_impls: &[&Impl],
-    blanket_impls: &[&Impl],
+    concrete_impls: Vec<&Impl>,
+    auto_trait_impls: Vec<&Impl>,
+    blanket_impls: Vec<&Impl>,
 ) -> fmt::Result {
-    let impls = {
-        let mut buf = String::new();
-        render_impls(cx, &mut buf, concrete_impls, containing_item, true)?;
-        buf
-    };
-    if !impls.is_empty() {
+    if !concrete_impls.is_empty() {
+        let impls = render_impls(cx, concrete_impls, containing_item, true);
         write!(
             w,
             "{}<div id=\"trait-implementations-list\">{impls}</div>",
@@ -1433,25 +1434,24 @@ fn render_all_impls(
     }
 
     if !auto_trait_impls.is_empty() {
+        let impls = render_impls(cx, auto_trait_impls, containing_item, false);
         // FIXME: Change the ID to `auto-trait-implementations-list`!
         write!(
             w,
-            "{}<div id=\"synthetic-implementations-list\">",
+            "{}<div id=\"synthetic-implementations-list\">{impls}</div>",
             write_impl_section_heading("Auto Trait Implementations", "synthetic-implementations",)
         )?;
-        render_impls(cx, &mut w, auto_trait_impls, containing_item, false)?;
-        w.write_str("</div>")?;
     }
 
     if !blanket_impls.is_empty() {
+        let impls = render_impls(cx, blanket_impls, containing_item, false);
         write!(
             w,
-            "{}<div id=\"blanket-implementations-list\">",
+            "{}<div id=\"blanket-implementations-list\">{impls}</div>",
             write_impl_section_heading("Blanket Implementations", "blanket-implementations")
         )?;
-        render_impls(cx, &mut w, blanket_impls, containing_item, false)?;
-        w.write_str("</div>")?;
     }
+
     Ok(())
 }
 
@@ -1588,14 +1588,7 @@ fn render_assoc_items_inner(
         let (blanket_impls, concrete_impls): (Vec<&Impl>, _) =
             trait_impls.into_iter().partition(|t| t.inner_impl().kind.is_blanket());
 
-        render_all_impls(
-            w,
-            cx,
-            containing_item,
-            &concrete_impls,
-            &auto_trait_impls,
-            &blanket_impls,
-        )?;
+        render_all_impls(w, cx, containing_item, concrete_impls, auto_trait_impls, blanket_impls)?;
     }
     Ok(())
 }
@@ -3068,18 +3061,6 @@ fn repr_attribute<'tcx>(
         return is_public.then(|| "#[repr(transparent)]".into());
     }
 
-    // Fast path which avoids looking through the variants and fields in
-    // the common case of no `#[repr]` or in the case of `#[repr(Rust)]`.
-    // FIXME: This check is not very robust / forward compatible!
-    if !repr.c()
-        && !repr.simd()
-        && repr.int.is_none()
-        && repr.pack.is_none()
-        && repr.align.is_none()
-    {
-        return None;
-    }
-
     // The repr is public iff all components are public and visible.
     let is_public = adt
         .variants()
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 8385e69..7469b08 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -32,8 +32,8 @@
 use crate::html::escape::{Escape, EscapeBodyTextWithWbr};
 use crate::html::format::{
     Ending, PrintWithSpace, full_print_fn_decl, print_abi_with_space, print_constness_with_space,
-    print_generic_bound, print_generics, print_impl, print_import, print_type, print_where_clause,
-    visibility_print_with_space,
+    print_generic_bound, print_generics, print_impl, print_import, print_path, print_type,
+    print_where_clause, visibility_print_with_space,
 };
 use crate::html::markdown::{HeadingOffset, MarkdownSummaryLine};
 use crate::html::render::sidebar::filters;
@@ -1016,9 +1016,9 @@ fn trait_item(cx: &Context<'_>, m: &clean::Item, t: &clean::Item) -> impl fmt::D
             let (mut synthetic, mut concrete): (Vec<&&Impl>, Vec<&&Impl>) =
                 local.iter().partition(|i| i.inner_impl().kind.is_auto());
 
-            synthetic.sort_by_cached_key(|i| ImplString::new(i, cx));
-            concrete.sort_by_cached_key(|i| ImplString::new(i, cx));
-            foreign.sort_by_cached_key(|i| ImplString::new(i, cx));
+            synthetic.sort_by_cached_key(|i| ImplString::new_impl(i, cx));
+            concrete.sort_by_cached_key(|i| ImplString::new_impl(i, cx));
+            foreign.sort_by_cached_key(|i| ImplString::new_impl(i, cx));
 
             if !foreign.is_empty() {
                 write!(
@@ -1969,7 +1969,7 @@ fn item_primitive(cx: &Context<'_>, it: &clean::Item) -> impl fmt::Display {
             let (concrete, synthetic, blanket_impl) =
                 get_filtered_impls_for_reference(&cx.shared, it);
 
-            render_all_impls(w, cx, it, &concrete, &synthetic, &blanket_impl)
+            render_all_impls(w, cx, it, concrete, synthetic, blanket_impl)
         }
     })
 }
@@ -2346,16 +2346,21 @@ fn wrap_item<W, F>(w: &mut W, f: F) -> fmt::Result
 }
 
 #[derive(PartialEq, Eq)]
-struct ImplString {
+pub(super) struct ImplString {
     // Plain text (not HTML text) because this is only used for sorting purposes, and the plain
     // text is much shorter and thus faster to compare.
     cmp_text: String,
 }
 
 impl ImplString {
-    fn new(i: &Impl, cx: &Context<'_>) -> ImplString {
+    fn new_impl(i: &Impl, cx: &Context<'_>) -> Self {
         let impl_ = i.inner_impl();
-        ImplString { cmp_text: format!("{:#}", print_impl(impl_, false, cx)) }
+        Self { cmp_text: format!("{:#}", print_impl(impl_, false, cx)) }
+    }
+
+    pub(super) fn new_path(i: &Impl, cx: &Context<'_>) -> Option<Self> {
+        let path = i.inner_impl().trait_.as_ref()?;
+        Some(Self { cmp_text: format!("{:#}", print_path(path, cx)) })
     }
 }
 
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs
index 84faa98..2f80b8d 100644
--- a/src/librustdoc/json/conversions.rs
+++ b/src/librustdoc/json/conversions.rs
@@ -410,7 +410,7 @@ fn from_clean(header: &rustc_hir::FnHeader, renderer: &JsonRenderer<'_>) -> Self
         };
         FunctionHeader {
             is_async: header.is_async(),
-            is_const: header.is_const(),
+            is_const: matches!(header.constness, rustc_hir::Constness::Const { .. }),
             is_unsafe,
             abi: header.abi.into_json(renderer),
         }
@@ -497,7 +497,7 @@ fn from_clean(predicate: &clean::WherePredicate, renderer: &JsonRenderer<'_>) ->
                     })
                     .collect(),
             },
-            EqPredicate { lhs, rhs } => WherePredicate::EqPredicate {
+            ProjectionPredicate { lhs, rhs } => WherePredicate::EqPredicate {
                 // The LHS currently has type `Type` but it should be a `QualifiedPath` since it may
                 // refer to an associated const. However, `EqPredicate` shouldn't exist in the first
                 // place: <https://github.com/rust-lang/rust/141368>.
diff --git a/src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs b/src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs
index 8ec095c..9ea7015 100644
--- a/src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs
+++ b/src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs
@@ -56,7 +56,7 @@ fn check_body(&mut self, cx: &LateContext<'tcx>, body: &Body<'tcx>) {
         // Inline const supports type inference.
         let is_parent_const = matches!(
             cx.tcx.hir_body_const_context(cx.tcx.hir_body_owner_def_id(body.id())),
-            Some(ConstContext::Const { inline: false } | ConstContext::Static(_))
+            Some(ConstContext::Const { allow_const_fn_promotion: true } | ConstContext::Static(_))
         );
         let mut visitor = NumericFallbackVisitor::new(cx, is_parent_const);
         visitor.visit_body(body);
diff --git a/src/tools/clippy/clippy_lints/src/derivable_impls.rs b/src/tools/clippy/clippy_lints/src/derivable_impls.rs
index 811c360..9367f6a 100644
--- a/src/tools/clippy/clippy_lints/src/derivable_impls.rs
+++ b/src/tools/clippy/clippy_lints/src/derivable_impls.rs
@@ -253,7 +253,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
             && !attrs.iter().any(|attr| attr.doc_str().is_some())
             && cx.tcx.hir_attrs(impl_item_hir).is_empty()
         {
-            let is_const = constness == hir::Constness::Const;
+            let is_const = matches!(constness, hir::Constness::Const { always: false });
             if adt_def.is_struct() {
                 check_struct(
                     cx,
diff --git a/src/tools/clippy/clippy_lints/src/lifetimes.rs b/src/tools/clippy/clippy_lints/src/lifetimes.rs
index ea99b52..8b50ce2 100644
--- a/src/tools/clippy/clippy_lints/src/lifetimes.rs
+++ b/src/tools/clippy/clippy_lints/src/lifetimes.rs
@@ -551,14 +551,6 @@ fn has_where_lifetimes<'tcx>(cx: &LateContext<'tcx>, generics: &'tcx Generics<'_
                     }
                 }
             },
-            WherePredicateKind::EqPredicate(ref pred) => {
-                let mut visitor = RefVisitor::new(cx);
-                walk_unambig_ty(&mut visitor, pred.lhs_ty);
-                walk_unambig_ty(&mut visitor, pred.rhs_ty);
-                if !visitor.lts.is_empty() {
-                    return true;
-                }
-            },
         }
     }
     false
diff --git a/src/tools/clippy/clippy_lints/src/methods/should_implement_trait.rs b/src/tools/clippy/clippy_lints/src/methods/should_implement_trait.rs
index 599ff69..9e0d630 100644
--- a/src/tools/clippy/clippy_lints/src/methods/should_implement_trait.rs
+++ b/src/tools/clippy/clippy_lints/src/methods/should_implement_trait.rs
@@ -29,7 +29,7 @@ pub(super) fn check_impl_item<'tcx>(
         && first_arg_ty_opt
             .is_none_or(|first_arg_ty| method_config.self_kind.matches(cx, self_ty, first_arg_ty))
         && sig.header.is_safe()
-        && !sig.header.is_const()
+        && matches!(sig.header.constness, hir::Constness::NotConst)
         && !sig.header.is_async()
         && sig.header.abi == ExternAbi::Rust
         && method_config.lifetime_param_cond(impl_item)
diff --git a/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs b/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs
index 4d4dc56..0660943 100644
--- a/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs
+++ b/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs
@@ -187,7 +187,7 @@ fn check_fn(
 // We don't have to lint on something that's already `const`
 #[must_use]
 fn already_const(header: hir::FnHeader) -> bool {
-    header.constness == Constness::Const
+    matches!(header.constness, Constness::Const { .. })
 }
 
 fn could_be_const_with_abi(cx: &LateContext<'_>, msrv: Msrv, abi: ExternAbi) -> bool {
diff --git a/src/tools/clippy/clippy_lints/src/multiple_bound_locations.rs b/src/tools/clippy/clippy_lints/src/multiple_bound_locations.rs
index 5b6b4f1..8b02c48 100644
--- a/src/tools/clippy/clippy_lints/src/multiple_bound_locations.rs
+++ b/src/tools/clippy/clippy_lints/src/multiple_bound_locations.rs
@@ -69,7 +69,6 @@ fn check_fn(&mut self, cx: &EarlyContext<'_>, kind: FnKind<'_>, _: Span, _: Node
                             emit_lint(cx, *bound_span, pred.lifetime.ident.span);
                         }
                     },
-                    WherePredicateKind::EqPredicate(_) => {},
                 }
             }
         }
diff --git a/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs b/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs
index e0a1825..fa93cf2 100644
--- a/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs
+++ b/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs
@@ -787,7 +787,6 @@ fn eq_where_predicate(l: &WherePredicate, r: &WherePredicate) -> bool {
             (RegionPredicate(l), RegionPredicate(r)) => {
                 eq_id(l.lifetime.ident, r.lifetime.ident) && over(&l.bounds, &r.bounds, eq_generic_bound)
             },
-            (EqPredicate(l), EqPredicate(r)) => eq_ty(&l.lhs_ty, &r.lhs_ty) && eq_ty(&l.rhs_ty, &r.rhs_ty),
             _ => false,
         }
 }
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 55c0372..7b642fc 100644
--- a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs
+++ b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs
@@ -242,7 +242,7 @@ fn expr_search_pat_inner(tcx: TyCtxt<'_>, e: &Expr<'_>, outer_span: Span) -> (Pa
 fn fn_header_search_pat(header: FnHeader) -> Pat {
     if header.is_async() {
         Pat::Str("async")
-    } else if header.is_const() {
+    } else if matches!(header.constness, rustc_hir::Constness::Const { always: false }) {
         Pat::Str("const")
     } else if header.is_unsafe() {
         Pat::Str("unsafe")
diff --git a/src/tools/clippy/clippy_utils/src/hir_utils.rs b/src/tools/clippy/clippy_utils/src/hir_utils.rs
index 7590090..38724a1 100644
--- a/src/tools/clippy/clippy_utils/src/hir_utils.rs
+++ b/src/tools/clippy/clippy_utils/src/hir_utils.rs
@@ -301,9 +301,6 @@ fn eq_generics_predicate(&mut self, left: &[WherePredicate<'_>], right: &[WhereP
                 Self::eq_lifetime(l_region.lifetime, r_region.lifetime)
                     && self.eq_generics_bound(l_region.bounds, r_region.bounds)
             },
-            (WherePredicateKind::EqPredicate(l_eq), WherePredicateKind::EqPredicate(r_eq)) => {
-                self.eq_ty(l_eq.lhs_ty, r_eq.lhs_ty)
-            },
             _ => false,
         })
     }
diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs
index 1ad12da..fbc8882 100644
--- a/src/tools/clippy/clippy_utils/src/lib.rs
+++ b/src/tools/clippy/clippy_utils/src/lib.rs
@@ -242,7 +242,7 @@ pub fn is_inside_always_const_context(tcx: TyCtxt<'_>, hir_id: HirId) -> bool {
     };
     match ctx {
         ConstFn => false,
-        Static(_) | Const { inline: _ } => true,
+        Static(_) | Const { allow_const_fn_promotion: _ } => true,
     }
 }
 
diff --git a/src/tools/compiletest/src/directives/directive_names.rs b/src/tools/compiletest/src/directives/directive_names.rs
index 41ea492..b8f8d314 100644
--- a/src/tools/compiletest/src/directives/directive_names.rs
+++ b/src/tools/compiletest/src/directives/directive_names.rs
@@ -61,6 +61,7 @@
     "ignore-avr",
     "ignore-backends",
     "ignore-beta",
+    "ignore-bpf",
     "ignore-cdb",
     "ignore-compare-mode-next-solver",
     "ignore-compare-mode-polonius",
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 72817ad..27bbc56 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1645,6 +1645,11 @@ fn make_compile_args(
             if self.config.mode == TestMode::CodegenUnits {
                 compiler.args(&["-Z", "human_readable_cgu_names"]);
             }
+
+            if self.config.mode == TestMode::DebugInfo && cfg!(target_os = "windows") {
+                // Prevent debugger processes from creating new console windows.
+                compiler.args(&["-Z", r#"crate-attr=windows_subsystem="windows""#]);
+            }
         }
 
         if self.config.optimize_tests && compiler_kind == CompilerKind::Rustc {
@@ -2714,8 +2719,10 @@ fn compare_output(
                 (&tmp.0, &tmp.1)
             }
         } else if compare_output_by_lines {
-            let mut actual_lines: Vec<&str> = actual.lines().collect();
-            let mut expected_lines: Vec<&str> = expected.lines().collect();
+            // Filter out padded empty code lines
+            let mut actual_lines: Vec<&str> = actual.lines().filter(|l| l.trim() != "|").collect();
+            let mut expected_lines: Vec<&str> =
+                expected.lines().filter(|l| l.trim() != "|").collect();
             actual_lines.sort_unstable();
             expected_lines.sort_unstable();
             if actual_lines == expected_lines {
diff --git a/src/tools/compiletest/src/runtest/compute_diff.rs b/src/tools/compiletest/src/runtest/compute_diff.rs
index e03a5bf..ce796d2 100644
--- a/src/tools/compiletest/src/runtest/compute_diff.rs
+++ b/src/tools/compiletest/src/runtest/compute_diff.rs
@@ -112,10 +112,11 @@ pub(crate) fn diff_by_lines(expected: &str, actual: &str) -> String {
     let mut expected_counts: HashMap<&str, usize> = HashMap::new();
     let mut actual_counts: HashMap<&str, usize> = HashMap::new();
 
-    for line in expected.lines() {
+    // Filter out padded empty code lines
+    for line in expected.lines().filter(|l| l.trim() != "|") {
         *expected_counts.entry(line).or_insert(0) += 1;
     }
-    for line in actual.lines() {
+    for line in actual.lines().filter(|l| l.trim() != "|") {
         *actual_counts.entry(line).or_insert(0) += 1;
     }
 
diff --git a/src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs b/src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs
index 608c660..9116b38 100644
--- a/src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs
+++ b/src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs
@@ -1,7 +1,9 @@
 use std::path::PathBuf;
 
-use clap::Parser;
+use anyhow::anyhow;
+use clap::{ArgAction, Parser};
 use llvm_bitcode_linker::{Optimization, Session, Target};
+use tracing::level_filters::LevelFilter;
 
 #[derive(Debug, Parser)]
 /// Linker for embedded code without any system dependencies
@@ -46,13 +48,29 @@ pub struct Args {
     /// The optimization level
     #[arg(short = 'O', value_enum, default_value = "0")]
     optimization: Optimization,
+
+    /// Increase linker diagnostic verbosity (-v = info, -vv = debug)
+    #[arg(short = 'v', long = "verbose", action = ArgAction::Count)]
+    verbose: u8,
 }
 
 fn main() -> anyhow::Result<()> {
-    tracing_subscriber::FmtSubscriber::builder().with_max_level(tracing::Level::DEBUG).init();
-
     let args = Args::parse();
 
+    let max_tracing_level = match args.verbose {
+        0 => LevelFilter::OFF,
+        1 => LevelFilter::INFO,
+        _ => LevelFilter::TRACE,
+    };
+
+    tracing_subscriber::FmtSubscriber::builder()
+        .with_max_level(max_tracing_level)
+        .with_target(false)
+        .without_time()
+        .with_level(false)
+        .with_ansi(false)
+        .init();
+
     let mut linker = Session::new(args.target, args.target_cpu, args.target_feature, args.output);
 
     linker.add_exported_symbols(args.export_symbol);
@@ -61,5 +79,11 @@ fn main() -> anyhow::Result<()> {
         linker.add_file(rlib);
     }
 
-    linker.lto(args.optimization, args.debug)
+    let hint = if max_tracing_level < LevelFilter::ERROR {
+        "Pass `-v` to llvm-bitcode-linker for additional diagnostic output."
+    } else {
+        ""
+    };
+
+    linker.lto(args.optimization, args.debug).map_err(|err| anyhow!("{err}\n{hint}"))
 }
diff --git a/src/tools/miri/tests/pass/shims/fs.rs b/src/tools/miri/tests/pass/shims/fs.rs
index cb1088f..f7298a9 100644
--- a/src/tools/miri/tests/pass/shims/fs.rs
+++ b/src/tools/miri/tests/pass/shims/fs.rs
@@ -410,8 +410,7 @@ fn test_pread_pwrite() {
     assert_eq!(&buf1, b"  m");
 }
 
-// Miri does not support the way this is implemented on Solaris
-// (https://github.com/rust-lang/miri/issues/5038).
+// Solaris does not support per-handle file locking.
 #[cfg(not(target_os = "solaris"))]
 fn test_flock() {
     let bytes = b"Hello, World!\n";
diff --git a/src/tools/rust-analyzer/.github/workflows/ci.yaml b/src/tools/rust-analyzer/.github/workflows/ci.yaml
index b9427e1..ca9e971 100644
--- a/src/tools/rust-analyzer/.github/workflows/ci.yaml
+++ b/src/tools/rust-analyzer/.github/workflows/ci.yaml
@@ -56,7 +56,7 @@
       - name: Install Rust toolchain
         run: |
           RUSTC_VERSION=$(cat rust-version)
-          rustup-toolchain-install-master ${RUSTC_VERSION} -c cargo -c rust-src -c rustfmt
+          rustup-toolchain-install-master ${RUSTC_VERSION} -c cargo -c rust-src -c rustfmt -c rustc-dev -c llvm-tools
           rustup default ${RUSTC_VERSION}
 
       # Emulate a nightly toolchain, because the toolchain installed above does not have "nightly"
@@ -69,10 +69,10 @@
         run: echo "::add-matcher::.github/rust.json"
 
       - name: Test
-        run: cargo test --features sysroot-abi -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
+        run: cargo test --features in-rust-tree -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
 
       - name: Check salsa dependency
-        run: "! (cargo tree -p proc-macro-srv-cli | grep -q salsa)"
+        run: "! (cargo tree -p proc-macro-srv-cli -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -i salsa)"
 
   rust:
     if: github.repository == 'rust-lang/rust-analyzer'
diff --git a/src/tools/rust-analyzer/.github/workflows/release.yaml b/src/tools/rust-analyzer/.github/workflows/release.yaml
index ef61e39..f682937 100644
--- a/src/tools/rust-analyzer/.github/workflows/release.yaml
+++ b/src/tools/rust-analyzer/.github/workflows/release.yaml
@@ -29,36 +29,44 @@
           - os: windows-latest
             target: x86_64-pc-windows-msvc
             code-target: win32-x64
+            allocator: mimalloc
             pgo: clap-rs/clap@v4.5.36
           - os: windows-latest
             target: i686-pc-windows-msvc
+            allocator: mimalloc
             pgo: clap-rs/clap@v4.5.36
           - os: windows-latest
             target: aarch64-pc-windows-msvc
             code-target: win32-arm64
+            allocator: mimalloc
           - os: ubuntu-latest
             target: x86_64-unknown-linux-gnu
             # Use a container with glibc 2.28
             # Zig is not used because it doesn't work with PGO
             container: quay.io/pypa/manylinux_2_28_x86_64
             code-target: linux-x64
+            allocator: system
             pgo: clap-rs/clap@v4.5.36
           - os: ubuntu-24.04-arm
             target: aarch64-unknown-linux-gnu
             container: quay.io/pypa/manylinux_2_28_aarch64
             code-target: linux-arm64
+            allocator: system
             pgo: clap-rs/clap@v4.5.36
           - os: ubuntu-latest
             target: arm-unknown-linux-gnueabihf
             zig_target: arm-unknown-linux-gnueabihf.2.28
             code-target: linux-armhf
+            allocator: system
           - os: macos-14
             target: x86_64-apple-darwin
             code-target: darwin-x64
+            allocator: system
             pgo: clap-rs/clap@v4.5.36
           - os: macos-14
             target: aarch64-apple-darwin
             code-target: darwin-arm64
+            allocator: system
             pgo: clap-rs/clap@v4.5.36
 
     name: dist (${{ matrix.target }})
@@ -67,6 +75,7 @@
 
     env:
       RA_TARGET: ${{ matrix.target }}
+      ALLOCATOR_FLAG: ${{ matrix.allocator != 'system' && format('--{0}', matrix.allocator) || '' }}
 
     steps:
       - name: Checkout repository
@@ -102,11 +111,11 @@
 
       - name: Dist (plain)
         if: ${{ !matrix.zig_target }}
-        run: cargo xtask dist --client-patch-version ${{ github.run_number }} ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
+        run: cargo xtask dist --client-patch-version ${{ github.run_number }} ${{ env.ALLOCATOR_FLAG }} ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
 
       - name: Dist (using zigbuild)
         if: ${{ matrix.zig_target }}
-        run: RA_TARGET=${{ matrix.zig_target}} cargo xtask dist --client-patch-version ${{ github.run_number }} --zig ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
+        run: RA_TARGET=${{ matrix.zig_target}} cargo xtask dist --client-patch-version ${{ github.run_number }} --zig ${{ env.ALLOCATOR_FLAG }} ${{ matrix.pgo && format('--pgo {0}', matrix.pgo) || ''}}
 
       - run: npm ci
         working-directory: editors/code
diff --git a/src/tools/rust-analyzer/.github/workflows/rustdoc.yaml b/src/tools/rust-analyzer/.github/workflows/rustdoc.yaml
index c5588a29f..7039f78 100644
--- a/src/tools/rust-analyzer/.github/workflows/rustdoc.yaml
+++ b/src/tools/rust-analyzer/.github/workflows/rustdoc.yaml
@@ -31,7 +31,7 @@
 
       - name: Deploy Docs
         if: github.event_name == 'push' && github.repository == 'rust-lang/rust-analyzer' && github.ref == 'refs/heads/master'
-        uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
+        uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
         with:
           github_token: ${{ secrets.GITHUB_TOKEN }}
           publish_branch: gh-pages
diff --git a/src/tools/rust-analyzer/AI_POLICY.md b/src/tools/rust-analyzer/AI_POLICY.md
new file mode 100644
index 0000000..f5912a3
--- /dev/null
+++ b/src/tools/rust-analyzer/AI_POLICY.md
@@ -0,0 +1,28 @@
+We allow using AI (i.e., LLMs) as tools for contributing to rust-analyzer.
+However, you remain responsible for any code you publish and we are responsible for any code we merge and release.
+We hold a high bar for all contributions to our projects.
+
+**AI should not be used to generate comments when communicating with maintainers**.
+We expect comments on our projects to be written by humans.
+We may hide any comments that we believe are AI generated.
+
+If you are opening an issue, we expect you to describe the problem in your own words.
+
+If you are opening a pull request, we expect you to be able to explain the proposed changes in your own words. This includes the pull request body and responses to questions.
+**Do not copy responses from the AI when replying to questions from maintainers.**
+
+Due to the foundational nature of our projects, we require a human in the loop who understands the work produced by AI.
+**We do not allow autonomous agents to be used to open pull requests or issues to our projects**.
+We will close any pull requests that we believe were created autonomously.
+
+If you wish to include context from an interaction with AI in your comments, it must be in a quote block (e.g., using `>`) and disclosed as such.
+It must be accompanied by human commentary explaining the relevance and implications of the context.
+Do not share long snippets.
+
+We understand that AI is useful when communicating as a non-native English speaker.
+If you are using AI to edit your comments for this purpose, please take the time to ensure it reflects your own voice and ideas.
+If using AI for translation, we recommend writing in your native language and including the AI translation in a quote block.
+
+This policy was adapted from [uv's AI policy].
+
+[uv's AI policy]: https://github.com/astral-sh/.github/blob/c5187e200db51bfe11d56e13053d29bd3793fdd8/AI_POLICY.md
diff --git a/src/tools/rust-analyzer/CONTRIBUTING.md b/src/tools/rust-analyzer/CONTRIBUTING.md
index e6ab3d7..b6a2210 100644
--- a/src/tools/rust-analyzer/CONTRIBUTING.md
+++ b/src/tools/rust-analyzer/CONTRIBUTING.md
@@ -34,10 +34,8 @@
 maintenance capacity). If there already is a feature issue open but it is not clear whether it is
 considered accepted feel free to just drop a comment and ask!
 
-## Use of AI tools
+## Use of AI
 
-AI tool use is not discouraged on the rust-analyzer codebase, as long as it meets our quality standards.
-We kindly ask you to disclose usage of AI tools in your contributions.
-If you used them without disclosing it, we may reject your contribution on that basis alone due to the assumption that you have, most likely, not reviewed your own submission (so why should we?).
+All use of AI in contributions must follow the [AI Policy](./AI_POLICY.md).
 
-We may still reject AI-assisted contributions if we deem the quality of the contribution to be unsatisfactory as to reduce impact on the team's review budget.
+Contributions not following the AI Policy will be closed.
diff --git a/src/tools/rust-analyzer/Cargo.lock b/src/tools/rust-analyzer/Cargo.lock
index cbbeef0..5e39dfe 100644
--- a/src/tools/rust-analyzer/Cargo.lock
+++ b/src/tools/rust-analyzer/Cargo.lock
@@ -4,9 +4,9 @@
 
 [[package]]
 name = "addr2line"
-version = "0.24.2"
+version = "0.25.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
+checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
 dependencies = [
  "gimli",
 ]
@@ -40,15 +40,15 @@
 
 [[package]]
 name = "anstyle"
-version = "1.0.11"
+version = "1.0.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
 
 [[package]]
 name = "anyhow"
-version = "1.0.100"
+version = "1.0.102"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
+checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
 
 [[package]]
 name = "arbitrary"
@@ -76,23 +76,23 @@
 
 [[package]]
 name = "autocfg"
-version = "1.5.0"
+version = "1.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
 
 [[package]]
 name = "backtrace"
-version = "0.3.75"
+version = "0.3.76"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002"
+checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
 dependencies = [
  "addr2line",
  "cfg-if",
  "libc",
  "miniz_oxide",
- "object",
+ "object 0.37.3",
  "rustc-demangle",
- "windows-targets 0.52.6",
+ "windows-link",
 ]
 
 [[package]]
@@ -105,7 +105,7 @@
  "intern",
  "la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "query-group-macro",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "salsa",
  "salsa-macros",
  "semver",
@@ -145,16 +145,26 @@
 
 [[package]]
 name = "bitflags"
-version = "2.9.4"
+version = "2.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
+checksum = "84d7ced0ae9557296835c32bf1b1e02b44c746701f898460fb000d7eaa84f00a"
+
+[[package]]
+name = "block2"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
+dependencies = [
+ "objc2",
+]
 
 [[package]]
 name = "borsh"
-version = "1.5.7"
+version = "1.6.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce"
+checksum = "cfd1e3f8955a5d7de9fab72fc8373fade9fb8a703968cb200ae3dc6cf08e185a"
 dependencies = [
+ "bytes",
  "cfg_aliases",
 ]
 
@@ -166,9 +176,9 @@
 
 [[package]]
 name = "bumpalo"
-version = "3.19.0"
+version = "3.20.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
 
 [[package]]
 name = "byteorder"
@@ -177,6 +187,12 @@
 checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
 
 [[package]]
+name = "bytes"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
+
+[[package]]
 name = "camino"
 version = "1.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -187,25 +203,26 @@
 
 [[package]]
 name = "cargo-platform"
-version = "0.3.1"
+version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "122ec45a44b270afd1402f351b782c676b173e3c3fb28d86ff7ebfb4d86a4ee4"
+checksum = "dd0061da739915fae12ea00e16397555ed4371a6bb285431aab930f61b0aa4ba"
 dependencies = [
  "serde",
+ "serde_core",
 ]
 
 [[package]]
 name = "cargo_metadata"
-version = "0.23.0"
+version = "0.23.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "981a6f317983eec002839b90fae7411a85621410ae591a9cab2ecf5cb5744873"
+checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9"
 dependencies = [
  "camino",
  "cargo-platform",
  "semver",
  "serde",
  "serde_json",
- "thiserror 2.0.16",
+ "thiserror 2.0.18",
 ]
 
 [[package]]
@@ -216,9 +233,9 @@
 
 [[package]]
 name = "cc"
-version = "1.2.38"
+version = "1.2.63"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80f41ae168f955c12fb8960b057d70d0ca153fb83182b57d86380443527be7e9"
+checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f"
 dependencies = [
  "find-msvc-tools",
  "shlex",
@@ -233,7 +250,7 @@
  "expect-test",
  "intern",
  "oorandom",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "syntax",
  "syntax-bridge",
  "tracing",
@@ -242,9 +259,9 @@
 
 [[package]]
 name = "cfg-if"
-version = "1.0.3"
+version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
 
 [[package]]
 name = "cfg_aliases"
@@ -281,18 +298,18 @@
 
 [[package]]
 name = "clap"
-version = "4.5.48"
+version = "4.6.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae"
+checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"
 dependencies = [
  "clap_builder",
 ]
 
 [[package]]
 name = "clap_builder"
-version = "4.5.48"
+version = "4.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9"
+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
 dependencies = [
  "anstyle",
  "clap_lex",
@@ -300,9 +317,9 @@
 
 [[package]]
 name = "clap_lex"
-version = "0.7.5"
+version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
 
 [[package]]
 name = "cobs"
@@ -310,7 +327,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1"
 dependencies = [
- "thiserror 2.0.16",
+ "thiserror 2.0.18",
 ]
 
 [[package]]
@@ -321,9 +338,9 @@
 
 [[package]]
 name = "cov-mark"
-version = "2.1.0"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f1d92727879fb4f24cec33a35e3bff74035541326cbc12ad44ba8886d1927b0"
+checksum = "90863d8442510cddf7f46618c4f92413774635771a3e80830c8b30d183420b14"
 
 [[package]]
 name = "crc32fast"
@@ -424,20 +441,20 @@
 
 [[package]]
 name = "ctrlc"
-version = "3.5.0"
+version = "3.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "881c5d0a13b2f1498e2306e82cbada78390e152d4b1378fb28a84f4dcd0dc4f3"
+checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162"
 dependencies = [
- "dispatch",
+ "dispatch2",
  "nix",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
 name = "dashmap"
-version = "6.1.0"
+version = "6.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
+checksum = "e6361d5c062261c78a176addb82d4c821ae42bed6089de0e12603cd25de2059c"
 dependencies = [
  "cfg-if",
  "crossbeam-utils",
@@ -449,9 +466,9 @@
 
 [[package]]
 name = "deranged"
-version = "0.5.3"
+version = "0.5.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc"
+checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
 dependencies = [
  "powerfmt",
 ]
@@ -512,20 +529,26 @@
  "libc",
  "option-ext",
  "redox_users",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
-name = "dispatch"
-version = "0.2.0"
+name = "dispatch2"
+version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
+checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
+dependencies = [
+ "bitflags 2.12.1",
+ "block2",
+ "libc",
+ "objc2",
+]
 
 [[package]]
 name = "displaydoc"
-version = "0.2.5"
+version = "0.2.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
+checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -534,9 +557,9 @@
 
 [[package]]
 name = "dissimilar"
-version = "1.0.10"
+version = "1.0.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921"
+checksum = "aeda16ab4059c5fd2a83f2b9c9e9c981327b18aa8e3b313f7e6563799d4f093e"
 
 [[package]]
 name = "dot"
@@ -556,9 +579,9 @@
 
 [[package]]
 name = "either"
-version = "1.15.0"
+version = "1.16.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
+checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
 
 [[package]]
 name = "embedded-io"
@@ -574,9 +597,9 @@
 
 [[package]]
 name = "ena"
-version = "0.14.3"
+version = "0.14.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5"
+checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1"
 dependencies = [
  "log",
 ]
@@ -594,7 +617,7 @@
 checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
 dependencies = [
  "libc",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
@@ -609,15 +632,15 @@
 
 [[package]]
 name = "fastrand"
-version = "2.3.0"
+version = "2.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
+checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
 
 [[package]]
 name = "find-msvc-tools"
-version = "0.1.2"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959"
+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
 
 [[package]]
 name = "fixedbitset"
@@ -627,9 +650,9 @@
 
 [[package]]
 name = "flate2"
-version = "1.1.2"
+version = "1.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
+checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
 dependencies = [
  "crc32fast",
  "miniz_oxide",
@@ -678,10 +701,34 @@
 checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a"
 
 [[package]]
-name = "getrandom"
-version = "0.2.16"
+name = "futures-core"
+version = "0.3.32"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
+checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
+
+[[package]]
+name = "futures-task"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
+
+[[package]]
+name = "futures-util"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "pin-project-lite",
+ "slab",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
 dependencies = [
  "cfg-if",
  "libc",
@@ -696,15 +743,28 @@
 dependencies = [
  "cfg-if",
  "libc",
- "r-efi",
+ "r-efi 5.3.0",
  "wasip2",
 ]
 
 [[package]]
-name = "gimli"
-version = "0.31.1"
+name = "getrandom"
+version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
+checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 6.0.0",
+ "wasip2",
+ "wasip3",
+]
+
+[[package]]
+name = "gimli"
+version = "0.32.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
 
 [[package]]
 name = "half"
@@ -738,22 +798,23 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
 dependencies = [
- "allocator-api2",
- "equivalent",
  "foldhash 0.1.5",
 ]
 
 [[package]]
 name = "hashbrown"
-version = "0.16.0"
+version = "0.16.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
+dependencies = [
+ "foldhash 0.2.0",
+]
 
 [[package]]
 name = "hashbrown"
-version = "0.17.0"
+version = "0.17.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
 dependencies = [
  "allocator-api2",
  "equivalent",
@@ -762,11 +823,11 @@
 
 [[package]]
 name = "hashlink"
-version = "0.10.0"
+version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
+checksum = "ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230"
 dependencies = [
- "hashbrown 0.15.5",
+ "hashbrown 0.16.1",
 ]
 
 [[package]]
@@ -784,6 +845,12 @@
 ]
 
 [[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
+[[package]]
 name = "hermit-abi"
 version = "0.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -805,7 +872,7 @@
  "itertools 0.14.0",
  "la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "ra-ap-rustc_type_ir",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "serde_json",
  "smallvec",
  "span",
@@ -827,7 +894,7 @@
 dependencies = [
  "arrayvec",
  "base-db",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "cfg",
  "cov-mark",
  "drop_bomb",
@@ -842,7 +909,7 @@
  "query-group-macro",
  "ra-ap-rustc_abi",
  "ra-ap-rustc_parse_format",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "rustc_apfloat",
  "salsa",
  "salsa-macros",
@@ -873,7 +940,7 @@
  "mbe",
  "parser",
  "query-group-macro",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "salsa",
  "salsa-macros",
  "smallvec",
@@ -893,7 +960,7 @@
 dependencies = [
  "arrayvec",
  "base-db",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "cov-mark",
  "either",
  "ena",
@@ -915,7 +982,7 @@
  "ra-ap-rustc_next_trait_solver",
  "ra-ap-rustc_pattern_analysis",
  "ra-ap-rustc_type_ir",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "rustc_apfloat",
  "salsa",
  "salsa-macros",
@@ -941,17 +1008,18 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
 dependencies = [
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
 name = "icu_collections"
-version = "2.0.0"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47"
+checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
 dependencies = [
  "displaydoc",
  "potential_utf",
+ "utf8_iter",
  "yoke",
  "zerofrom",
  "zerovec",
@@ -959,9 +1027,9 @@
 
 [[package]]
 name = "icu_locale_core"
-version = "2.0.0"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a"
+checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
 dependencies = [
  "displaydoc",
  "litemap",
@@ -972,11 +1040,10 @@
 
 [[package]]
 name = "icu_normalizer"
-version = "2.0.0"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979"
+checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
 dependencies = [
- "displaydoc",
  "icu_collections",
  "icu_normalizer_data",
  "icu_properties",
@@ -987,42 +1054,38 @@
 
 [[package]]
 name = "icu_normalizer_data"
-version = "2.0.0"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3"
+checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
 
 [[package]]
 name = "icu_properties"
-version = "2.0.1"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b"
+checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
 dependencies = [
- "displaydoc",
  "icu_collections",
  "icu_locale_core",
  "icu_properties_data",
  "icu_provider",
- "potential_utf",
  "zerotrie",
  "zerovec",
 ]
 
 [[package]]
 name = "icu_properties_data"
-version = "2.0.1"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632"
+checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
 
 [[package]]
 name = "icu_provider"
-version = "2.0.0"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af"
+checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
 dependencies = [
  "displaydoc",
  "icu_locale_core",
- "stable_deref_trait",
- "tinystr",
  "writeable",
  "yoke",
  "zerofrom",
@@ -1031,6 +1094,12 @@
 ]
 
 [[package]]
+name = "id-arena"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
+
+[[package]]
 name = "ide"
 version = "0.0.0"
 dependencies = [
@@ -1109,7 +1178,7 @@
 dependencies = [
  "arrayvec",
  "base-db",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "cov-mark",
  "crossbeam-channel",
  "either",
@@ -1124,7 +1193,7 @@
  "parser",
  "profile",
  "rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "salsa",
  "salsa-macros",
  "smallvec",
@@ -1187,9 +1256,9 @@
 
 [[package]]
 name = "idna_adapter"
-version = "1.2.1"
+version = "1.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
 dependencies = [
  "icu_normalizer",
  "icu_properties",
@@ -1197,23 +1266,23 @@
 
 [[package]]
 name = "indexmap"
-version = "2.11.4"
+version = "2.14.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5"
+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
 dependencies = [
  "equivalent",
- "hashbrown 0.16.0",
+ "hashbrown 0.17.1",
  "serde",
  "serde_core",
 ]
 
 [[package]]
 name = "inotify"
-version = "0.11.0"
+version = "0.11.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3"
+checksum = "533e68a5842e734946fe159fb03fc9bbbb254f590dd0d8ad321ae5ff7beca2c1"
 dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "inotify-sys",
  "libc",
 ]
@@ -1235,15 +1304,15 @@
  "dashmap",
  "hashbrown 0.14.5",
  "rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "triomphe",
 ]
 
 [[package]]
 name = "intrusive-collections"
-version = "0.9.7"
+version = "0.10.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86"
+checksum = "80e165935eba36cb526af8389effd2005a741adcbb6ed32106cc68e3f7b92960"
 dependencies = [
  "memoffset",
 ]
@@ -1277,9 +1346,9 @@
 
 [[package]]
 name = "itoa"
-version = "1.0.15"
+version = "1.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
 
 [[package]]
 name = "jod-thread"
@@ -1289,19 +1358,21 @@
 
 [[package]]
 name = "js-sys"
-version = "0.3.82"
+version = "0.3.99"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
+checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11"
 dependencies = [
+ "cfg-if",
+ "futures-util",
  "once_cell",
  "wasm-bindgen",
 ]
 
 [[package]]
 name = "kqueue"
-version = "1.1.1"
+version = "1.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a"
+checksum = "273c0752728918e0ac4976f2b275b6fefb9ecd400585dec929419f3844cd87b5"
 dependencies = [
  "kqueue-sys",
  "libc",
@@ -1309,11 +1380,11 @@
 
 [[package]]
 name = "kqueue-sys"
-version = "1.0.4"
+version = "1.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b"
+checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087"
 dependencies = [
- "bitflags 1.3.2",
+ "bitflags 2.12.1",
  "libc",
 ]
 
@@ -1334,10 +1405,16 @@
 checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
 
 [[package]]
-name = "libc"
-version = "0.2.175"
+name = "leb128fmt"
+version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
+checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
+
+[[package]]
+name = "libc"
+version = "0.2.186"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
 
 [[package]]
 name = "libloading"
@@ -1346,26 +1423,24 @@
 checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
 dependencies = [
  "cfg-if",
- "windows-link 0.2.0",
+ "windows-link",
 ]
 
 [[package]]
 name = "libmimalloc-sys"
-version = "0.1.44"
+version = "0.1.49"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870"
+checksum = "6a45a52f43e1c16f667ccfe4dd8c85b7f7c204fd5e3bf46c5b0db9a5c3c0b8e9"
 dependencies = [
  "cc",
- "libc",
 ]
 
 [[package]]
 name = "libredox"
-version = "0.1.10"
+version = "0.1.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
+checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3"
 dependencies = [
- "bitflags 2.9.4",
  "libc",
 ]
 
@@ -1390,15 +1465,15 @@
 
 [[package]]
 name = "linux-raw-sys"
-version = "0.11.0"
+version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
 
 [[package]]
 name = "litemap"
-version = "0.8.0"
+version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
+checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
 
 [[package]]
 name = "load-cargo"
@@ -1421,19 +1496,18 @@
 
 [[package]]
 name = "lock_api"
-version = "0.4.13"
+version = "0.4.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
 dependencies = [
- "autocfg",
  "scopeguard",
 ]
 
 [[package]]
 name = "log"
-version = "0.4.28"
+version = "0.4.31"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
+checksum = "113b30b4cd05f7c06868fdb2854f66a7b9fece9a48425351cd532e810d74024f"
 
 [[package]]
 name = "lsp-server"
@@ -1444,7 +1518,7 @@
  "ctrlc",
  "log",
  "lsp-types",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "serde",
  "serde_derive",
  "serde_json",
@@ -1492,13 +1566,13 @@
 version = "0.0.0"
 dependencies = [
  "arrayvec",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "cov-mark",
  "expect-test",
  "intern",
  "parser",
  "ra-ap-rustc_lexer",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "salsa",
  "smallvec",
  "span",
@@ -1511,15 +1585,15 @@
 
 [[package]]
 name = "memchr"
-version = "2.7.6"
+version = "2.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
+checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
 
 [[package]]
 name = "memmap2"
-version = "0.9.8"
+version = "0.9.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "843a98750cd611cc2965a8213b53b43e715f13c37a9e096c6408e69990961db7"
+checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3"
 dependencies = [
  "libc",
 ]
@@ -1535,9 +1609,9 @@
 
 [[package]]
 name = "mimalloc"
-version = "0.1.48"
+version = "0.1.52"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8"
+checksum = "2d4139bb28d14ad1facf21d5eb8825051b326e172d216b39f6d31df53cc97862"
 dependencies = [
  "libmimalloc-sys",
 ]
@@ -1549,6 +1623,7 @@
 checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
 dependencies = [
  "adler2",
+ "simd-adler32",
 ]
 
 [[package]]
@@ -1559,14 +1634,14 @@
 
 [[package]]
 name = "mio"
-version = "1.1.0"
+version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873"
+checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
 dependencies = [
  "libc",
  "log",
  "wasi",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
@@ -1575,16 +1650,16 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08"
 dependencies = [
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
 name = "nix"
-version = "0.30.1"
+version = "0.31.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
+checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
 dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "cfg-if",
  "cfg_aliases",
  "libc",
@@ -1602,7 +1677,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3"
 dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "fsevent-sys",
  "inotify",
  "kqueue",
@@ -1616,9 +1691,12 @@
 
 [[package]]
 name = "notify-types"
-version = "2.0.0"
+version = "2.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d"
+checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a"
+dependencies = [
+ "bitflags 2.12.1",
+]
 
 [[package]]
 name = "nu-ansi-term"
@@ -1626,14 +1704,14 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
 dependencies = [
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
 name = "num-conv"
-version = "0.2.0"
+version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"
+checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
 
 [[package]]
 name = "num-traits"
@@ -1664,6 +1742,21 @@
 ]
 
 [[package]]
+name = "objc2"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f"
+dependencies = [
+ "objc2-encode",
+]
+
+[[package]]
+name = "objc2-encode"
+version = "4.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
+
+[[package]]
 name = "object"
 version = "0.36.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1673,10 +1766,19 @@
 ]
 
 [[package]]
-name = "once_cell"
-version = "1.21.3"
+name = "object"
+version = "0.37.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
 
 [[package]]
 name = "oorandom"
@@ -1692,9 +1794,9 @@
 
 [[package]]
 name = "parking_lot"
-version = "0.12.4"
+version = "0.12.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
 dependencies = [
  "lock_api",
  "parking_lot_core",
@@ -1702,15 +1804,15 @@
 
 [[package]]
 name = "parking_lot_core"
-version = "0.9.11"
+version = "0.9.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
 dependencies = [
  "cfg-if",
  "libc",
  "redox_syscall",
  "smallvec",
- "windows-targets 0.52.6",
+ "windows-link",
 ]
 
 [[package]]
@@ -1721,10 +1823,10 @@
  "edition",
  "expect-test",
  "ra-ap-rustc_lexer",
- "rustc-literal-escaper 0.0.4",
+ "rustc-literal-escaper",
  "stdx",
  "tracing",
- "winnow",
+ "winnow 0.7.15",
 ]
 
 [[package]]
@@ -1767,9 +1869,9 @@
 
 [[package]]
 name = "petgraph"
-version = "0.8.2"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54acf3a685220b533e437e264e4d932cfbdc4cc7ec0cd232ed73c08d03b8a7ca"
+checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
 dependencies = [
  "fixedbitset",
  "hashbrown 0.15.5",
@@ -1778,9 +1880,9 @@
 
 [[package]]
 name = "pin-project-lite"
-version = "0.2.16"
+version = "0.2.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
 
 [[package]]
 name = "plotters"
@@ -1812,9 +1914,9 @@
 
 [[package]]
 name = "portable-atomic"
-version = "1.11.1"
+version = "1.13.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
+checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
 
 [[package]]
 name = "postcard"
@@ -1831,9 +1933,9 @@
 
 [[package]]
 name = "potential_utf"
-version = "0.1.3"
+version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a"
+checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
 dependencies = [
  "zerovec",
 ]
@@ -1854,6 +1956,16 @@
 ]
 
 [[package]]
+name = "prettyplease"
+version = "0.2.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
+dependencies = [
+ "proc-macro2",
+ "syn",
+]
+
+[[package]]
 name = "proc-macro-api"
 version = "0.0.0"
 dependencies = [
@@ -1863,7 +1975,7 @@
  "postcard",
  "proc-macro-srv",
  "rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "semver",
  "serde",
  "serde_derive",
@@ -1884,10 +1996,9 @@
  "libloading",
  "line-index 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "memmap2",
- "object",
+ "object 0.36.7",
  "paths",
  "proc-macro-test",
- "ra-ap-rustc_lexer",
  "span",
  "temp-dir",
 ]
@@ -1916,18 +2027,18 @@
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.101"
+version = "1.0.106"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
 dependencies = [
  "unicode-ident",
 ]
 
 [[package]]
 name = "process-wrap"
-version = "8.2.1"
+version = "9.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3ef4f2f0422f23a82ec9f628ea2acd12871c81a9362b02c43c1aa86acfc3ba1"
+checksum = "2e842efad9119158434d193c6682e2ebee4b44d6ad801d7b349623b3f57cdf55"
 dependencies = [
  "indexmap",
  "nix",
@@ -1939,11 +2050,10 @@
 name = "profile"
 version = "0.0.0"
 dependencies = [
- "cfg-if",
  "libc",
  "perf-event",
  "tikv-jemalloc-ctl",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
@@ -1959,7 +2069,7 @@
  "itertools 0.14.0",
  "la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "paths",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "semver",
  "serde",
  "serde_derive",
@@ -1975,13 +2085,13 @@
 
 [[package]]
 name = "proptest"
-version = "1.9.0"
+version = "1.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40"
+checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744"
 dependencies = [
  "bit-set",
  "bit-vec",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "num-traits",
  "rand",
  "rand_chacha",
@@ -2018,7 +2128,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
 dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "memchr",
  "unicase",
 ]
@@ -2052,9 +2162,9 @@
 
 [[package]]
 name = "quote"
-version = "1.0.40"
+version = "1.0.45"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
 dependencies = [
  "proc-macro2",
 ]
@@ -2066,12 +2176,18 @@
 checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
 
 [[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
 name = "ra-ap-rustc_abi"
 version = "0.165.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2f25a779e21ca3bba6795193b16508c8ab159f96ee4b07349893fd272065b525"
 dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "ra-ap-rustc_hashes",
  "ra-ap-rustc_index",
  "tracing",
@@ -2143,7 +2259,7 @@
 checksum = "4a737f844bdef8ac5ab54dadf2f34704b4d06beef9236d71080bb34db697220b"
 dependencies = [
  "ra-ap-rustc_lexer",
- "rustc-literal-escaper 0.0.7",
+ "rustc-literal-escaper",
 ]
 
 [[package]]
@@ -2153,7 +2269,7 @@
 checksum = "6de3d4c7d6078cce3c40c55717b8b15002a80b9fa8849faea496a365324861b4"
 dependencies = [
  "ra-ap-rustc_index",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "rustc_apfloat",
  "smallvec",
  "tracing",
@@ -2166,7 +2282,7 @@
 checksum = "8c5d9a4d3e7bee7313599bc6d794037247ac0165f03857379cf4fc3097199e05"
 dependencies = [
  "arrayvec",
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "derive-where",
  "ena",
  "indexmap",
@@ -2174,7 +2290,7 @@
  "ra-ap-rustc_ast_ir",
  "ra-ap-rustc_index",
  "ra-ap-rustc_type_ir_macros",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "smallvec",
  "thin-vec",
  "tracing",
@@ -2194,9 +2310,9 @@
 
 [[package]]
 name = "rand"
-version = "0.9.3"
+version = "0.9.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ec095654a25171c2124e9e3393a930bddbffdc939556c914957a4c3e0a87166"
+checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
 dependencies = [
  "rand_chacha",
  "rand_core",
@@ -2214,9 +2330,9 @@
 
 [[package]]
 name = "rand_core"
-version = "0.9.3"
+version = "0.9.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
 dependencies = [
  "getrandom 0.3.4",
 ]
@@ -2232,9 +2348,9 @@
 
 [[package]]
 name = "rayon"
-version = "1.11.0"
+version = "1.12.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
+checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
 dependencies = [
  "either",
  "rayon-core",
@@ -2252,11 +2368,11 @@
 
 [[package]]
 name = "redox_syscall"
-version = "0.5.17"
+version = "0.5.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
 dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
 ]
 
 [[package]]
@@ -2265,16 +2381,16 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
 dependencies = [
- "getrandom 0.2.16",
+ "getrandom 0.2.17",
  "libredox",
- "thiserror 2.0.16",
+ "thiserror 2.0.18",
 ]
 
 [[package]]
 name = "regex"
-version = "1.12.2"
+version = "1.12.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
+checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -2284,9 +2400,9 @@
 
 [[package]]
 name = "regex-automata"
-version = "0.4.13"
+version = "0.4.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -2295,9 +2411,9 @@
 
 [[package]]
 name = "regex-syntax"
-version = "0.8.8"
+version = "0.8.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
+checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
 
 [[package]]
 name = "rowan"
@@ -2351,7 +2467,7 @@
  "project-model",
  "ra-ap-rustc_type_ir",
  "rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "scip",
  "semver",
  "serde",
@@ -2374,16 +2490,16 @@
  "vfs",
  "vfs-notify",
  "walkdir",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
  "xflags",
  "xshell",
 ]
 
 [[package]]
 name = "rustc-demangle"
-version = "0.1.26"
+version = "0.1.27"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
+checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d"
 
 [[package]]
 name = "rustc-hash"
@@ -2393,15 +2509,9 @@
 
 [[package]]
 name = "rustc-hash"
-version = "2.1.1"
+version = "2.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
-
-[[package]]
-name = "rustc-literal-escaper"
-version = "0.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab03008eb631b703dd16978282ae36c73282e7922fe101a4bd072a40ecea7b8b"
+checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
 
 [[package]]
 name = "rustc-literal-escaper"
@@ -2421,7 +2531,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "486c2179b4796f65bfe2ee33679acf0927ac83ecf583ad6c91c3b4570911b9ad"
 dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "smallvec",
 ]
 
@@ -2436,15 +2546,15 @@
 
 [[package]]
 name = "rustix"
-version = "1.1.2"
+version = "1.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"
+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
 dependencies = [
- "bitflags 2.9.4",
+ "bitflags 2.12.1",
  "errno",
  "libc",
  "linux-raw-sys",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
@@ -2466,21 +2576,15 @@
 ]
 
 [[package]]
-name = "ryu"
-version = "1.0.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
-
-[[package]]
 name = "salsa"
-version = "0.26.2"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4612ff789805e65c87e9b38cb749a293212a615af065bed8a2001086801498c3"
+checksum = "adfc1e32b8d1a486e3a45a5480fb5dca7912f49262a8916a67378064da4fe1ab"
 dependencies = [
  "boxcar",
  "crossbeam-queue",
  "crossbeam-utils",
- "hashbrown 0.17.0",
+ "hashbrown 0.17.1",
  "hashlink",
  "indexmap",
  "intrusive-collections",
@@ -2488,7 +2592,7 @@
  "parking_lot",
  "portable-atomic",
  "rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "salsa-macro-rules",
  "salsa-macros",
  "smallvec",
@@ -2499,15 +2603,15 @@
 
 [[package]]
 name = "salsa-macro-rules"
-version = "0.26.2"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58e354cbac6939b9b09cd9c11fb419a53e64b4a0f755d929f56a09f4cc752e41"
+checksum = "67dad477a3e3a484a7c2311c1d25160fb270214981be24022de7de8a206a3300"
 
 [[package]]
 name = "salsa-macros"
-version = "0.26.2"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3067861075c2b80608f84ad49fb88f2c7610b94cdf8b4201e79ddee87f8980c8"
+checksum = "943f70e101fb3bd599960e79e719e70d85142730e5b45f3269246086ed218562"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -2541,9 +2645,9 @@
 
 [[package]]
 name = "semver"
-version = "1.0.27"
+version = "1.0.28"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
 dependencies = [
  "serde",
  "serde_core",
@@ -2551,9 +2655,9 @@
 
 [[package]]
 name = "serde"
-version = "1.0.226"
+version = "1.0.228"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
 dependencies = [
  "serde_core",
  "serde_derive",
@@ -2561,18 +2665,18 @@
 
 [[package]]
 name = "serde_core"
-version = "1.0.226"
+version = "1.0.228"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
 dependencies = [
  "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.226"
+version = "1.0.228"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -2581,16 +2685,16 @@
 
 [[package]]
 name = "serde_json"
-version = "1.0.145"
+version = "1.0.150"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
+checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
 dependencies = [
  "indexmap",
  "itoa",
  "memchr",
- "ryu",
  "serde",
  "serde_core",
+ "zmij",
 ]
 
 [[package]]
@@ -2606,9 +2710,9 @@
 
 [[package]]
 name = "serde_spanned"
-version = "1.0.3"
+version = "1.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392"
+checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
 dependencies = [
  "serde_core",
 ]
@@ -2633,9 +2737,21 @@
 
 [[package]]
 name = "shlex"
-version = "1.3.0"
+version = "2.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
+
+[[package]]
+name = "simd-adler32"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
+
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
 
 [[package]]
 name = "smallvec"
@@ -2645,16 +2761,6 @@
 
 [[package]]
 name = "smol_str"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9676b89cd56310a87b93dec47b11af744f34d5fc9f367b829474eec0a891350d"
-dependencies = [
- "borsh",
- "serde",
-]
-
-[[package]]
-name = "smol_str"
 version = "0.3.6"
 dependencies = [
  "arbitrary",
@@ -2668,12 +2774,22 @@
 ]
 
 [[package]]
+name = "smol_str"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523"
+dependencies = [
+ "borsh",
+ "serde_core",
+]
+
+[[package]]
 name = "span"
 version = "0.0.0"
 dependencies = [
- "hashbrown 0.14.5",
+ "hashbrown 0.17.1",
  "la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "salsa",
  "stdx",
  "syntax",
@@ -2692,9 +2808,9 @@
 
 [[package]]
 name = "stable_deref_trait"
-version = "1.2.0"
+version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
 
 [[package]]
 name = "static_assertions"
@@ -2714,14 +2830,14 @@
  "libc",
  "miow",
  "tracing",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
 name = "syn"
-version = "2.0.106"
+version = "2.0.117"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
+checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -2749,11 +2865,11 @@
  "parser",
  "rayon",
  "rowan",
- "rustc-hash 2.1.1",
- "rustc-literal-escaper 0.0.4",
+ "rustc-hash 2.1.2",
+ "rustc-literal-escaper",
  "rustc_apfloat",
  "smallvec",
- "smol_str 0.3.2",
+ "smol_str 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "stdx",
  "test-utils",
  "tracing",
@@ -2767,7 +2883,7 @@
  "expect-test",
  "intern",
  "parser",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "span",
  "stdx",
  "syntax",
@@ -2777,21 +2893,21 @@
 
 [[package]]
 name = "temp-dir"
-version = "0.1.16"
+version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83176759e9416cf81ee66cb6508dbfe9c96f20b8b56265a39917551c23c70964"
+checksum = "016ef9739649996fcc983b9c588fe3d557cf216d4d98503ce1b057ab5a66d689"
 
 [[package]]
 name = "tempfile"
-version = "3.23.0"
+version = "3.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
 dependencies = [
  "fastrand",
- "getrandom 0.3.4",
+ "getrandom 0.4.2",
  "once_cell",
  "rustix",
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
@@ -2823,7 +2939,7 @@
  "dissimilar",
  "paths",
  "profile",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "stdx",
  "text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2845,9 +2961,9 @@
 
 [[package]]
 name = "thin-vec"
-version = "0.2.16"
+version = "0.2.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "259cdf8ed4e4aca6f1e9d011e10bd53f524a2d0637d7b28450f6c64ac298c4c6"
+checksum = "b0f7e269b48f0a7dd0146680fa24b50cc67fc0373f086a5b2f99bd084639b482"
 
 [[package]]
 name = "thiserror"
@@ -2860,11 +2976,11 @@
 
 [[package]]
 name = "thiserror"
-version = "2.0.16"
+version = "2.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
 dependencies = [
- "thiserror-impl 2.0.16",
+ "thiserror-impl 2.0.18",
 ]
 
 [[package]]
@@ -2880,9 +2996,9 @@
 
 [[package]]
 name = "thiserror-impl"
-version = "2.0.16"
+version = "2.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -2970,9 +3086,9 @@
 
 [[package]]
 name = "tinystr"
-version = "0.8.1"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b"
+checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
 dependencies = [
  "displaydoc",
  "zerovec",
@@ -2990,9 +3106,9 @@
 
 [[package]]
 name = "toml"
-version = "0.9.8"
+version = "1.1.2+spec-1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8"
+checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee"
 dependencies = [
  "indexmap",
  "serde_core",
@@ -3000,32 +3116,32 @@
  "toml_datetime",
  "toml_parser",
  "toml_writer",
- "winnow",
+ "winnow 1.0.3",
 ]
 
 [[package]]
 name = "toml_datetime"
-version = "0.7.3"
+version = "1.1.1+spec-1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
+checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
 dependencies = [
  "serde_core",
 ]
 
 [[package]]
 name = "toml_parser"
-version = "1.0.4"
+version = "1.1.2+spec-1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
+checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
 dependencies = [
- "winnow",
+ "winnow 1.0.3",
 ]
 
 [[package]]
 name = "toml_writer"
-version = "1.0.4"
+version = "1.1.1+spec-1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2"
+checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db"
 
 [[package]]
 name = "toolchain"
@@ -3037,9 +3153,9 @@
 
 [[package]]
 name = "tracing"
-version = "0.1.41"
+version = "0.1.44"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
 dependencies = [
  "pin-project-lite",
  "tracing-attributes",
@@ -3048,9 +3164,9 @@
 
 [[package]]
 name = "tracing-attributes"
-version = "0.1.30"
+version = "0.1.31"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3059,9 +3175,9 @@
 
 [[package]]
 name = "tracing-core"
-version = "0.1.34"
+version = "0.1.36"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
 dependencies = [
  "once_cell",
  "valuable",
@@ -3080,9 +3196,9 @@
 
 [[package]]
 name = "tracing-subscriber"
-version = "0.3.20"
+version = "0.3.23"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
+checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
 dependencies = [
  "sharded-slab",
  "thread_local",
@@ -3093,9 +3209,9 @@
 
 [[package]]
 name = "tracing-tree"
-version = "0.4.0"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f459ca79f1b0d5f71c54ddfde6debfc59c8b6eeb46808ae492077f739dc7b49c"
+checksum = "ac87aa03b6a4d5a7e4810d1a80c19601dbe0f8a837e9177f23af721c7ba7beec"
 dependencies = [
  "nu-ansi-term",
  "tracing-core",
@@ -3105,9 +3221,9 @@
 
 [[package]]
 name = "triomphe"
-version = "0.1.14"
+version = "0.1.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85"
+checksum = "dd69c5aa8f924c7519d6372789a74eac5b94fb0f8fcf0d4a97eb0bfc3e785f39"
 
 [[package]]
 name = "tt"
@@ -3117,7 +3233,7 @@
  "indexmap",
  "intern",
  "ra-ap-rustc_lexer",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "span",
  "stdx",
  "text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3161,9 +3277,9 @@
 
 [[package]]
 name = "unicase"
-version = "2.8.1"
+version = "2.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
+checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
 
 [[package]]
 name = "unicode-ident"
@@ -3178,15 +3294,22 @@
 checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"
 
 [[package]]
-name = "url"
-version = "2.5.7"
+name = "unicode-xid"
+version = "0.2.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
+
+[[package]]
+name = "url"
+version = "2.5.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
 dependencies = [
  "form_urlencoded",
  "idna",
  "percent-encoding",
  "serde",
+ "serde_derive",
 ]
 
 [[package]]
@@ -3210,7 +3333,7 @@
  "indexmap",
  "nohash-hasher",
  "paths",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "stdx",
  "tracing",
 ]
@@ -3223,7 +3346,7 @@
  "notify",
  "paths",
  "rayon",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
  "stdx",
  "tracing",
  "vfs",
@@ -3257,18 +3380,27 @@
 
 [[package]]
 name = "wasip2"
-version = "1.0.1+wasi-0.2.4"
+version = "1.0.3+wasi-0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
+checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"
 dependencies = [
- "wit-bindgen",
+ "wit-bindgen 0.57.1",
+]
+
+[[package]]
+name = "wasip3"
+version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
+dependencies = [
+ "wit-bindgen 0.51.0",
 ]
 
 [[package]]
 name = "wasm-bindgen"
-version = "0.2.105"
+version = "0.2.122"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
+checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409"
 dependencies = [
  "cfg-if",
  "once_cell",
@@ -3279,9 +3411,9 @@
 
 [[package]]
 name = "wasm-bindgen-macro"
-version = "0.2.105"
+version = "0.2.122"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
+checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6"
 dependencies = [
  "quote",
  "wasm-bindgen-macro-support",
@@ -3289,9 +3421,9 @@
 
 [[package]]
 name = "wasm-bindgen-macro-support"
-version = "0.2.105"
+version = "0.2.122"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
+checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e"
 dependencies = [
  "bumpalo",
  "proc-macro2",
@@ -3302,18 +3434,52 @@
 
 [[package]]
 name = "wasm-bindgen-shared"
-version = "0.2.105"
+version = "0.2.122"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
+checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437"
 dependencies = [
  "unicode-ident",
 ]
 
 [[package]]
-name = "web-sys"
-version = "0.3.82"
+name = "wasm-encoder"
+version = "0.244.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
+checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
+dependencies = [
+ "leb128fmt",
+ "wasmparser",
+]
+
+[[package]]
+name = "wasm-metadata"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
+dependencies = [
+ "anyhow",
+ "indexmap",
+ "wasm-encoder",
+ "wasmparser",
+]
+
+[[package]]
+name = "wasmparser"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
+dependencies = [
+ "bitflags 2.12.1",
+ "hashbrown 0.15.5",
+ "indexmap",
+ "semver",
+]
+
+[[package]]
+name = "web-sys"
+version = "0.3.99"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d621441cfc37b84979402712047321980c178f299193a3589d05b99e8763436"
 dependencies = [
  "js-sys",
  "wasm-bindgen",
@@ -3325,60 +3491,59 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
 dependencies = [
- "windows-sys 0.61.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
 name = "windows"
-version = "0.61.3"
+version = "0.62.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
+checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
 dependencies = [
  "windows-collections",
  "windows-core",
  "windows-future",
- "windows-link 0.1.3",
  "windows-numerics",
 ]
 
 [[package]]
 name = "windows-collections"
-version = "0.2.0"
+version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
+checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
 dependencies = [
  "windows-core",
 ]
 
 [[package]]
 name = "windows-core"
-version = "0.61.2"
+version = "0.62.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
+checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
 dependencies = [
  "windows-implement",
  "windows-interface",
- "windows-link 0.1.3",
+ "windows-link",
  "windows-result",
  "windows-strings",
 ]
 
 [[package]]
 name = "windows-future"
-version = "0.2.1"
+version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
+checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
 dependencies = [
  "windows-core",
- "windows-link 0.1.3",
+ "windows-link",
  "windows-threading",
 ]
 
 [[package]]
 name = "windows-implement"
-version = "0.60.0"
+version = "0.60.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
+checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3387,9 +3552,9 @@
 
 [[package]]
 name = "windows-interface"
-version = "0.59.1"
+version = "0.59.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
+checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3398,42 +3563,36 @@
 
 [[package]]
 name = "windows-link"
-version = "0.1.3"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
-
-[[package]]
-name = "windows-link"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
 
 [[package]]
 name = "windows-numerics"
-version = "0.2.0"
+version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
+checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
 dependencies = [
  "windows-core",
- "windows-link 0.1.3",
+ "windows-link",
 ]
 
 [[package]]
 name = "windows-result"
-version = "0.3.4"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
 dependencies = [
- "windows-link 0.1.3",
+ "windows-link",
 ]
 
 [[package]]
 name = "windows-strings"
-version = "0.4.2"
+version = "0.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
 dependencies = [
- "windows-link 0.1.3",
+ "windows-link",
 ]
 
 [[package]]
@@ -3442,167 +3601,197 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
 dependencies = [
- "windows-targets 0.53.3",
+ "windows-targets",
 ]
 
 [[package]]
 name = "windows-sys"
-version = "0.61.0"
+version = "0.61.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
 dependencies = [
- "windows-link 0.2.0",
+ "windows-link",
 ]
 
 [[package]]
 name = "windows-targets"
-version = "0.52.6"
+version = "0.53.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
 dependencies = [
- "windows_aarch64_gnullvm 0.52.6",
- "windows_aarch64_msvc 0.52.6",
- "windows_i686_gnu 0.52.6",
- "windows_i686_gnullvm 0.52.6",
- "windows_i686_msvc 0.52.6",
- "windows_x86_64_gnu 0.52.6",
- "windows_x86_64_gnullvm 0.52.6",
- "windows_x86_64_msvc 0.52.6",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.53.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
-dependencies = [
- "windows-link 0.1.3",
- "windows_aarch64_gnullvm 0.53.0",
- "windows_aarch64_msvc 0.53.0",
- "windows_i686_gnu 0.53.0",
- "windows_i686_gnullvm 0.53.0",
- "windows_i686_msvc 0.53.0",
- "windows_x86_64_gnu 0.53.0",
- "windows_x86_64_gnullvm 0.53.0",
- "windows_x86_64_msvc 0.53.0",
+ "windows-link",
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
 ]
 
 [[package]]
 name = "windows-threading"
-version = "0.1.0"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
+checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
 dependencies = [
- "windows-link 0.1.3",
+ "windows-link",
 ]
 
 [[package]]
 name = "windows_aarch64_gnullvm"
-version = "0.52.6"
+version = "0.53.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
-
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
+checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
 
 [[package]]
 name = "windows_aarch64_msvc"
-version = "0.52.6"
+version = "0.53.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
+checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
 
 [[package]]
 name = "windows_i686_gnu"
-version = "0.52.6"
+version = "0.53.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
+checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
 
 [[package]]
 name = "windows_i686_gnullvm"
-version = "0.52.6"
+version = "0.53.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
-
-[[package]]
-name = "windows_i686_gnullvm"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
+checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
 
 [[package]]
 name = "windows_i686_msvc"
-version = "0.52.6"
+version = "0.53.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
+checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
 
 [[package]]
 name = "windows_x86_64_gnu"
-version = "0.52.6"
+version = "0.53.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
-
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
+checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
 
 [[package]]
 name = "windows_x86_64_gnullvm"
-version = "0.52.6"
+version = "0.53.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
-
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
+checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
 
 [[package]]
 name = "windows_x86_64_msvc"
-version = "0.52.6"
+version = "0.53.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
+checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
 
 [[package]]
 name = "winnow"
-version = "0.7.13"
+version = "0.7.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
+
+[[package]]
+name = "winnow"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1"
 
 [[package]]
 name = "wit-bindgen"
-version = "0.46.0"
+version = "0.51.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
+checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
+dependencies = [
+ "wit-bindgen-rust-macro",
+]
+
+[[package]]
+name = "wit-bindgen"
+version = "0.57.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
+
+[[package]]
+name = "wit-bindgen-core"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
+dependencies = [
+ "anyhow",
+ "heck",
+ "wit-parser",
+]
+
+[[package]]
+name = "wit-bindgen-rust"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
+dependencies = [
+ "anyhow",
+ "heck",
+ "indexmap",
+ "prettyplease",
+ "syn",
+ "wasm-metadata",
+ "wit-bindgen-core",
+ "wit-component",
+]
+
+[[package]]
+name = "wit-bindgen-rust-macro"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
+dependencies = [
+ "anyhow",
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wit-bindgen-core",
+ "wit-bindgen-rust",
+]
+
+[[package]]
+name = "wit-component"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
+dependencies = [
+ "anyhow",
+ "bitflags 2.12.1",
+ "indexmap",
+ "log",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "wasm-encoder",
+ "wasm-metadata",
+ "wasmparser",
+ "wit-parser",
+]
+
+[[package]]
+name = "wit-parser"
+version = "0.244.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
+dependencies = [
+ "anyhow",
+ "id-arena",
+ "indexmap",
+ "log",
+ "semver",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "unicode-xid",
+ "wasmparser",
+]
 
 [[package]]
 name = "write-json"
@@ -3612,9 +3801,9 @@
 
 [[package]]
 name = "writeable"
-version = "0.6.1"
+version = "0.6.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
+checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
 
 [[package]]
 name = "xflags"
@@ -3668,11 +3857,10 @@
 
 [[package]]
 name = "yoke"
-version = "0.8.0"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc"
+checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
 dependencies = [
- "serde",
  "stable_deref_trait",
  "yoke-derive",
  "zerofrom",
@@ -3680,9 +3868,9 @@
 
 [[package]]
 name = "yoke-derive"
-version = "0.8.0"
+version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6"
+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3692,18 +3880,18 @@
 
 [[package]]
 name = "zerocopy"
-version = "0.8.27"
+version = "0.8.50"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
+checksum = "3b065d4f0e55f82fae73202e189638116a87c55ab6b8e6c2721e13dd9d854ad1"
 dependencies = [
  "zerocopy-derive",
 ]
 
 [[package]]
 name = "zerocopy-derive"
-version = "0.8.27"
+version = "0.8.50"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
+checksum = "0b631b19d36a892ab55420c92dbc83ccd79274f25be714855d3074aa71cab639"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3712,18 +3900,18 @@
 
 [[package]]
 name = "zerofrom"
-version = "0.1.6"
+version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
 dependencies = [
  "zerofrom-derive",
 ]
 
 [[package]]
 name = "zerofrom-derive"
-version = "0.1.6"
+version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3733,9 +3921,9 @@
 
 [[package]]
 name = "zerotrie"
-version = "0.2.2"
+version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595"
+checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
 dependencies = [
  "displaydoc",
  "yoke",
@@ -3744,9 +3932,9 @@
 
 [[package]]
 name = "zerovec"
-version = "0.11.4"
+version = "0.11.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b"
+checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
 dependencies = [
  "yoke",
  "zerofrom",
@@ -3755,9 +3943,9 @@
 
 [[package]]
 name = "zerovec-derive"
-version = "0.11.1"
+version = "0.11.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f"
+checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3777,3 +3965,9 @@
  "memchr",
  "time",
 ]
+
+[[package]]
+name = "zmij"
+version = "1.0.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
diff --git a/src/tools/rust-analyzer/Cargo.toml b/src/tools/rust-analyzer/Cargo.toml
index a08b2e4..37e5dbb 100644
--- a/src/tools/rust-analyzer/Cargo.toml
+++ b/src/tools/rust-analyzer/Cargo.toml
@@ -128,35 +128,35 @@
     "pe",
 ] }
 postcard = { version = "1.1.3", features = ["alloc"] }
-process-wrap = { version = "8.2.1", features = ["std"] }
+process-wrap = { version = "9.1.0", features = ["std"] }
 pulldown-cmark-to-cmark = "10.0.4"
 pulldown-cmark = { version = "0.9.6", default-features = false }
 rayon = "1.10.0"
 rowan = "=0.15.18"
 # Ideally we'd not enable the macros feature but unfortunately the `tracked` attribute does not work
 # on impls without it
-salsa = { version = "0.26.2", default-features = false, features = [
+salsa = { version = "0.27.0", default-features = false, features = [
     "rayon",
     "salsa_unstable",
     "macros",
     "inventory",
 ] }
-salsa-macros = "0.26.2"
+salsa-macros = "0.27.0"
 semver = "1.0.26"
 serde = { version = "1.0.219" }
 serde_derive = { version = "1.0.219" }
 serde_json = "1.0.140"
 rustc-hash = "2.1.1"
-rustc-literal-escaper = "0.0.4"
+rustc-literal-escaper = "0.0.7"
 smallvec = { version = "1.15.1", features = [
     "const_new",
     "union",
     "const_generics",
 ] }
 smol_str = "0.3.2"
-temp-dir = "0.1.16"
+temp-dir = "0.2.0"
 text-size = "1.1.1"
-toml = "0.9.8"
+toml = "1.1.2"
 tracing = { version = "0.1.41", default-features = false, features = ["std"] }
 tracing-tree = "0.4.0"
 tracing-subscriber = { version = "0.3.20", default-features = false, features = [
@@ -172,14 +172,13 @@
 xshell = "0.2.7"
 thin-vec = "0.2.16"
 petgraph = { version = "0.8.2", default-features = false }
-
-# We need to freeze the version of the crate, as the raw-api feature is considered unstable
-dashmap = { version = "=6.1.0", features = ["raw-api", "inline"] }
-# We need to freeze the version of the crate, as it needs to match with dashmap
-hashbrown = { version = "0.14.*", features = [
+hashbrown = { version = "0.17.0", features = [
     "inline-more",
 ], default-features = false }
 
+# We need to freeze the version of the crate, as the raw-api feature is considered unstable
+dashmap = { version = "=6.2.1", features = ["raw-api", "inline"] }
+
 [workspace.lints.rust]
 # remember to update RUSTFLAGS in ci.yml if you add something here
 
diff --git a/src/tools/rust-analyzer/crates/base-db/src/lib.rs b/src/tools/rust-analyzer/crates/base-db/src/lib.rs
index a209a0e..a681ac7 100644
--- a/src/tools/rust-analyzer/crates/base-db/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/base-db/src/lib.rs
@@ -7,6 +7,7 @@
 
 pub use salsa;
 pub use salsa_macros;
+use span::TextSize;
 
 // FIXME: Rename this crate, base db is non descriptive
 mod change;
@@ -49,6 +50,7 @@ macro_rules! impl_intern_key {
         #[salsa_macros::interned(no_lifetime, revisions = usize::MAX)]
         #[derive(PartialOrd, Ord)]
         pub struct $id {
+            #[returns(ref)]
             pub loc: $loc,
         }
 
@@ -168,16 +170,32 @@ pub fn set_source_root_with_durability(
         };
     }
 
-    pub fn file_source_root(&self, id: vfs::FileId) -> FileSourceRootInput {
+    pub fn file_source_root(
+        &self,
+        db: &dyn SourceDatabase,
+        id: vfs::FileId,
+    ) -> FileSourceRootInput {
         let file_source_root = match self.file_source_roots.get(&id) {
             Some(file_source_root) => file_source_root,
             None => panic!(
-                "Unable to get `FileSourceRootInput` with `vfs::FileId` ({id:?}); this is a bug",
+                "Unable to get `FileSourceRootInput` with `vfs::FileId` ({id:?}, path: {}); this is a bug",
+                self.path_for_file(db, id)
+                    .map_or_else(|| "<unknown>".to_owned(), |path| path.to_string()),
             ),
         };
         *file_source_root
     }
 
+    fn path_for_file(&self, db: &dyn SourceDatabase, id: vfs::FileId) -> Option<vfs::VfsPath> {
+        for source_root in &*self.source_roots {
+            let source_root = *source_root.value();
+            if let Some(path) = source_root.source_root(db).path_for_file(&id) {
+                return Some(path.clone());
+            }
+        }
+        None
+    }
+
     pub fn set_file_source_root_with_durability(
         &self,
         db: &mut dyn SourceDatabase,
@@ -280,6 +298,8 @@ fn resolve_path(&self, path: AnchoredPath<'_>) -> Option<FileId> {
     fn crates_map(&self) -> Arc<CratesMap>;
 
     fn nonce_and_revision(&self) -> (Nonce, salsa::Revision);
+
+    fn line_column(&self, file: FileId, offset: TextSize) -> Result<(u32, u32), ()>;
 }
 
 static NEXT_NONCE: AtomicUsize = AtomicUsize::new(0);
diff --git a/src/tools/rust-analyzer/crates/cfg/src/lib.rs b/src/tools/rust-analyzer/crates/cfg/src/lib.rs
index 3e3d67c..5923849 100644
--- a/src/tools/rust-analyzer/crates/cfg/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/cfg/src/lib.rs
@@ -222,7 +222,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
             for (i, atom) in self.disable.iter().enumerate() {
                 let sep = match i {
                     0 => "",
-                    _ if i == self.enable.len() - 1 => " and ",
+                    _ if i == self.disable.len() - 1 => " and ",
                     _ => ", ",
                 };
                 f.write_str(sep)?;
diff --git a/src/tools/rust-analyzer/crates/cfg/src/tests.rs b/src/tools/rust-analyzer/crates/cfg/src/tests.rs
index bfc9220..45cba04 100644
--- a/src/tools/rust-analyzer/crates/cfg/src/tests.rs
+++ b/src/tools/rust-analyzer/crates/cfg/src/tests.rs
@@ -194,6 +194,10 @@ fn hints() {
 
     check_enable_hints("#![cfg(test)]", &opts, &[]);
     check_enable_hints("#![cfg(not(test))]", &opts, &["disable test"]);
+
+    opts.insert_atom(Symbol::intern("a"));
+    opts.insert_atom(Symbol::intern("b"));
+    check_enable_hints("#![cfg(all(not(a), not(b)))]", &opts, &["disable a and b"]);
 }
 
 /// Tests that we don't suggest hints for cfgs that express an inconsistent formula.
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/db.rs b/src/tools/rust-analyzer/crates/hir-def/src/db.rs
index 11e5c54..1776b7c 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/db.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/db.rs
@@ -7,8 +7,7 @@
 use triomphe::Arc;
 
 use crate::{
-    AssocItemId, AttrDefId, Macro2Loc, MacroExpander, MacroId, MacroRulesLoc, MacroRulesLocFlags,
-    TraitId,
+    AssocItemId, AttrDefId, MacroExpander, MacroId, MacroRulesLocFlags, TraitId,
     attrs::AttrFlags,
     item_tree::{ItemTree, file_item_tree},
     nameres::crate_def_map,
@@ -76,12 +75,13 @@ fn macro_def(db: &dyn DefDatabase, id: MacroId) -> MacroDefId {
             MacroExpander::BuiltInAttr(it) => MacroDefKind::BuiltInAttr(in_file, it),
             MacroExpander::BuiltInDerive(it) => MacroDefKind::BuiltInDerive(in_file, it),
             MacroExpander::BuiltInEager(it) => MacroDefKind::BuiltInEager(in_file, it),
+            MacroExpander::UnimplementedBuiltIn => MacroDefKind::UnimplementedBuiltIn(in_file),
         }
     };
 
     match id {
         MacroId::Macro2Id(it) => {
-            let loc: Macro2Loc = it.lookup(db);
+            let loc = it.lookup(db);
 
             MacroDefId {
                 krate: loc.container.krate(db),
@@ -92,7 +92,7 @@ fn macro_def(db: &dyn DefDatabase, id: MacroId) -> MacroDefId {
             }
         }
         MacroId::MacroRulesId(it) => {
-            let loc: MacroRulesLoc = it.lookup(db);
+            let loc = it.lookup(db);
 
             MacroDefId {
                 krate: loc.container.krate(db),
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs
index 4dc7267..6df95e1 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs
@@ -332,6 +332,7 @@ pub enum ExpressionStoreDiagnostics {
     AwaitOutsideOfAsync { node: InFile<AstPtr<ast::AwaitExpr>>, location: String },
     UndeclaredLabel { node: InFile<AstPtr<ast::Lifetime>>, name: Name },
     PatternArgInExternFn { node: InFile<AstPtr<ast::Pat>> },
+    FruInDestructuringAssignment { node: InFile<AstPtr<ast::Expr>> },
 }
 
 impl ExpressionStoreBuilder {
@@ -616,7 +617,7 @@ pub fn visit_pat_children(&self, pat_id: PatId, mut visitor: impl StoreVisitor)
                 visitor.on_expr_opt(*end);
             }
             Pat::Lit(expr) | Pat::ConstBlock(expr) | Pat::Expr(expr) => visitor.on_expr(*expr),
-            Pat::Path(_) | Pat::Wild | Pat::Missing | Pat::Rest => {}
+            Pat::Path(_) | Pat::Wild | Pat::Missing | Pat::Rest | Pat::NotNull => {}
             &Pat::Bind { subpat, id: _ } => visitor.on_pat_opt(subpat),
             Pat::Or(args) | Pat::Tuple { args, ellipsis: _ } => visitor.on_pats(args),
             Pat::TupleStruct { args, ellipsis: _, path } => {
@@ -719,7 +720,7 @@ pub fn visit_expr_children(&self, expr_id: ExprId, mut visitor: impl StoreVisito
                 }
                 visitor.on_expr_opt(*tail);
             }
-            Expr::Loop { body, label: _ } => visitor.on_expr(*body),
+            Expr::Loop { body, label: _, source: _ } => visitor.on_expr(*body),
             Expr::Call { callee, args } => {
                 visitor.on_expr(*callee);
                 visitor.on_exprs(args);
@@ -794,6 +795,7 @@ pub fn visit_expr_children(&self, expr_id: ExprId, mut visitor: impl StoreVisito
                 visitor.on_pat(target);
                 visitor.on_expr(value);
             }
+            Expr::IncludeBytes => {}
         }
     }
 
@@ -855,6 +857,10 @@ fn on_pat(&mut self, pat: PatId) {
     pub fn visit_type_ref_children(&self, type_ref: TypeRefId, mut visitor: impl StoreVisitor) {
         match &self[type_ref] {
             TypeRef::Never | TypeRef::Placeholder | TypeRef::TypeParam(_) | TypeRef::Error => {}
+            &TypeRef::PatternType(ty, pat) => {
+                visitor.on_type(ty);
+                visitor.on_pat(pat)
+            }
             TypeRef::Tuple(types) => visitor.on_types(types),
             TypeRef::Path(path) => visitor.on_path(path),
             TypeRef::RawPtr(inner, _) | TypeRef::Slice(inner) => visitor.on_type(*inner),
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/body.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/body.rs
index 2fb47e5..01423d5 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/body.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/body.rs
@@ -9,7 +9,7 @@
 use triomphe::Arc;
 
 use crate::{
-    DefWithBodyId, HasModule,
+    DefWithBodyId, ExpressionStoreOwnerId, HasModule,
     db::DefDatabase,
     expr_store::{
         ExpressionStore, ExpressionStoreSourceMap, SelfParamPtr, lower::lower_body, pretty,
@@ -160,12 +160,12 @@ pub fn pretty_print_expr(
     pub fn pretty_print_pat(
         &self,
         db: &dyn DefDatabase,
-        owner: DefWithBodyId,
+        owner: ExpressionStoreOwnerId,
         pat: PatId,
         oneline: bool,
         edition: Edition,
     ) -> String {
-        pretty::print_pat_hir(db, self, owner.into(), pat, oneline, edition)
+        pretty::print_pat_hir(db, self, owner, pat, oneline, edition)
     }
 }
 
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs
index 8818096..3094e08 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs
@@ -35,8 +35,8 @@
 use tt::TextRange;
 
 use crate::{
-    AdtId, BlockId, BlockLoc, DefWithBodyId, FunctionId, GenericDefId, ImplId, ItemContainerId,
-    MacroId, ModuleDefId, ModuleId, TraitId, TypeAliasId, UnresolvedMacro,
+    AdtId, BlockId, BlockLoc, ConstId, DefWithBodyId, FunctionId, GenericDefId, ImplId,
+    ItemContainerId, MacroId, ModuleDefId, ModuleId, TraitId, TypeAliasId, UnresolvedMacro,
     attrs::AttrFlags,
     db::DefDatabase,
     expr_store::{
@@ -49,9 +49,9 @@
     },
     hir::{
         Array, Binding, BindingAnnotation, BindingId, BindingProblems, CaptureBy, ClosureKind,
-        CoroutineKind, CoroutineSource, Expr, ExprId, Item, Label, LabelId, Literal, MatchArm,
-        Movability, OffsetOf, Pat, PatId, RecordFieldPat, RecordLitField, RecordSpread, Statement,
-        generics::GenericParams,
+        CoroutineKind, CoroutineSource, Expr, ExprId, Item, Label, LabelId, Literal, LoopSource,
+        MatchArm, Movability, OffsetOf, Pat, PatId, RecordFieldPat, RecordLitField, RecordSpread,
+        Statement, generics::GenericParams,
     },
     item_scope::BuiltinShadowMode,
     item_tree::FieldsShape,
@@ -204,7 +204,7 @@ pub(crate) fn lower_type_ref(
     (store, source_map, type_ref)
 }
 
-pub(crate) fn lower_generic_params(
+pub fn lower_generic_params(
     db: &dyn DefDatabase,
     module: ModuleId,
     def: GenericDefId,
@@ -719,6 +719,10 @@ fn lower_abi(abi: ast::Abi) -> ExternAbi {
             ast::Type::DynTraitType(inner) => TypeRef::DynTrait(
                 self.type_bounds_from_ast(inner.type_bound_list(), impl_trait_lower_fn),
             ),
+            ast::Type::PatternType(inner) => TypeRef::PatternType(
+                self.lower_type_ref_opt(inner.ty(), impl_trait_lower_fn),
+                self.collect_ty_pat_opt(inner.pat()),
+            ),
             ast::Type::MacroType(mt) => match mt.macro_call() {
                 Some(mcall) => {
                     let macro_ptr = AstPtr::new(&mcall);
@@ -1347,7 +1351,7 @@ fn maybe_collect_expr(&mut self, expr: ast::Expr) -> Option<ExprId> {
                     (self.hygiene_id_for(label.syntax().text_range()), self.collect_label(label))
                 });
                 let body = self.collect_labelled_block_opt(label, e.loop_body());
-                self.alloc_expr(Expr::Loop { body, label: label.map(|it| it.1) }, syntax_ptr)
+                self.alloc_expr(Expr::Loop { body, label: label.map(|it| it.1), source: LoopSource::Loop }, syntax_ptr)
             }
             ast::Expr::WhileExpr(e) => self.collect_while_loop(syntax_ptr, e),
             ast::Expr::ForExpr(e) => self.collect_for_loop(syntax_ptr, e),
@@ -1744,6 +1748,7 @@ fn maybe_collect_expr(&mut self, expr: ast::Expr) -> Option<ExprId> {
                 self.alloc_expr(Expr::OffsetOf(OffsetOf { container, fields }), syntax_ptr)
             }
             ast::Expr::FormatArgsExpr(f) => self.collect_format_args(f, syntax_ptr),
+            ast::Expr::IncludeBytesExpr(_) => self.alloc_expr(Expr::IncludeBytes, syntax_ptr)
         })
     }
 
@@ -1890,9 +1895,13 @@ fn maybe_collect_expr_as_pat(&mut self, expr: &ast::Expr) -> Option<PatId> {
                 };
                 let record_field_list = e.record_expr_field_list()?;
                 let ellipsis = record_field_list.dotdot_token().is_some();
-                // We wanted to emit an error here if `record_field_list.spread().is_some()`,
-                // but that's already a syntax error in rustc, so we decided not to.
-                // See https://github.com/rust-lang/rust-analyzer/pull/22206#discussion_r3156097370
+                if let Some(spread) = record_field_list.spread() {
+                    self.store.diagnostics.push(
+                        ExpressionStoreDiagnostics::FruInDestructuringAssignment {
+                            node: self.expander.in_file(AstPtr::new(&spread)),
+                        },
+                    );
+                }
                 let args = record_field_list
                     .fields()
                     .filter_map(|f| {
@@ -2125,7 +2134,10 @@ fn collect_while_loop(&mut self, syntax_ptr: AstPtr<ast::Expr>, e: ast::WhileExp
             Expr::If { condition, then_branch: body, else_branch: Some(break_expr) },
             syntax_ptr,
         );
-        self.alloc_expr(Expr::Loop { body: if_expr, label: label.map(|it| it.1) }, syntax_ptr)
+        self.alloc_expr(
+            Expr::Loop { body: if_expr, label: label.map(|it| it.1), source: LoopSource::While },
+            syntax_ptr,
+        )
     }
 
     /// Desugar `ast::ForExpr` from: `[opt_ident]: for <pat> in <head> <body>` into:
@@ -2151,16 +2163,21 @@ fn collect_for_loop(&mut self, syntax_ptr: AstPtr<ast::Expr>, e: ast::ForExpr) -
         ) else {
             return self.missing_expr();
         };
-        let head = self.collect_expr_opt(e.iterable());
-        let into_iter_fn_expr = self.alloc_expr(Expr::Path(into_iter_fn), syntax_ptr);
-        let iterator = self.alloc_expr(
+        let iterable = e.iterable();
+        let syntax_ptr_iterable = iterable.as_ref().map_or(syntax_ptr, AstPtr::new);
+        let loop_body = e.loop_body().map(|it| it.into());
+        let head = self.collect_expr_opt(iterable);
+        let into_iter_fn_expr =
+            self.alloc_expr_desugared_with_ptr(Expr::Path(into_iter_fn), syntax_ptr_iterable);
+        let iterator = self.alloc_expr_desugared_with_ptr(
             Expr::Call { callee: into_iter_fn_expr, args: Box::new([head]) },
-            syntax_ptr,
+            syntax_ptr_iterable,
         );
         let none_arm = MatchArm {
             pat: self.alloc_pat_desugared(Pat::Path(option_none)),
             guard: None,
-            expr: self.alloc_expr(Expr::Break { expr: None, label: None }, syntax_ptr),
+            expr: self
+                .alloc_expr_desugared_with_ptr(Expr::Break { expr: None, label: None }, syntax_ptr),
         };
         let some_pat = Pat::TupleStruct {
             path: option_some,
@@ -2173,26 +2190,26 @@ fn collect_for_loop(&mut self, syntax_ptr: AstPtr<ast::Expr>, e: ast::ForExpr) -
         let some_arm = MatchArm {
             pat: self.alloc_pat_desugared(some_pat),
             guard: None,
-            expr: self.with_opt_labeled_rib(label, |this| {
-                this.collect_expr_opt(e.loop_body().map(|it| it.into()))
-            }),
+            expr: self.with_opt_labeled_rib(label, |this| this.collect_expr_opt(loop_body)),
         };
         let iter_name = self.generate_new_name();
-        let iter_expr = self.alloc_expr(Expr::Path(Path::from(iter_name.clone())), syntax_ptr);
-        let iter_expr_mut = self.alloc_expr(
+        let iter_expr = self
+            .alloc_expr_desugared_with_ptr(Expr::Path(Path::from(iter_name.clone())), syntax_ptr);
+        let iter_expr_mut = self.alloc_expr_desugared_with_ptr(
             Expr::Ref { expr: iter_expr, rawness: Rawness::Ref, mutability: Mutability::Mut },
             syntax_ptr,
         );
-        let iter_next_fn_expr = self.alloc_expr(Expr::Path(iter_next_fn), syntax_ptr);
-        let iter_next_expr = self.alloc_expr(
+        let iter_next_fn_expr =
+            self.alloc_expr_desugared_with_ptr(Expr::Path(iter_next_fn), syntax_ptr);
+        let iter_next_expr = self.alloc_expr_desugared_with_ptr(
             Expr::Call { callee: iter_next_fn_expr, args: Box::new([iter_expr_mut]) },
             syntax_ptr,
         );
-        let loop_inner = self.alloc_expr(
+        let loop_inner = self.alloc_expr_desugared_with_ptr(
             Expr::Match { expr: iter_next_expr, arms: Box::new([none_arm, some_arm]) },
             syntax_ptr,
         );
-        let loop_inner = self.alloc_expr(
+        let loop_inner = self.alloc_expr_desugared_with_ptr(
             Expr::Block {
                 id: None,
                 statements: Box::default(),
@@ -2201,8 +2218,14 @@ fn collect_for_loop(&mut self, syntax_ptr: AstPtr<ast::Expr>, e: ast::ForExpr) -
             },
             syntax_ptr,
         );
-        let loop_outer = self
-            .alloc_expr(Expr::Loop { body: loop_inner, label: label.map(|it| it.1) }, syntax_ptr);
+        let loop_outer = self.alloc_expr_desugared_with_ptr(
+            Expr::Loop {
+                body: loop_inner,
+                label: label.map(|it| it.1),
+                source: LoopSource::ForLoop,
+            },
+            syntax_ptr,
+        );
         let iter_binding =
             self.alloc_binding(iter_name, BindingAnnotation::Mutable, HygieneId::ROOT);
         let iter_pat = self.alloc_pat_desugared(Pat::Bind { id: iter_binding, subpat: None });
@@ -2562,9 +2585,9 @@ fn collect_labelled_block_opt(
     }
 
     fn collect_extern_fn_param(&mut self, pat: Option<ast::Pat>) -> PatId {
-        // `extern` functions cannot have pattern-matched parameters, and furthermore, the identifiers
-        // in their parameters are always interpreted as bindings, even if in a normal function they
-        // won't be, because they would refer to a path pattern.
+        // parameters of functions in `extern` blocks can only be simple identifiers and wildcards.
+        // Furthermore, the identifiers in their parameters are always interpreted as bindings, even
+        // if in a normal function they won't be, because they would refer to a path pattern.
         let Some(pat) = pat else { return self.missing_pat() };
 
         match &pat {
@@ -2580,6 +2603,7 @@ fn collect_extern_fn_param(&mut self, pat: Option<ast::Pat>) -> PatId {
                 self.add_definition_to_binding(binding, pat);
                 pat
             }
+            ast::Pat::WildcardPat(_) => self.alloc_pat(Pat::Wild, AstPtr::new(&pat)),
             _ => {
                 self.store.diagnostics.push(ExpressionStoreDiagnostics::PatternArgInExternFn {
                     node: self.expander.in_file(AstPtr::new(&pat)),
@@ -2782,6 +2806,7 @@ fn collect_pat(&mut self, pat: ast::Pat, binding_list: &mut BindingList) -> PatI
                 let inner = self.collect_pat_opt(inner.pat(), binding_list);
                 Pat::Deref { inner }
             }
+            ast::Pat::NotNull(_) => Pat::NotNull,
             ast::Pat::ConstBlockPat(const_block_pat) => {
                 if let Some(block) = const_block_pat.block_expr() {
                     let expr_id = self.with_label_rib(RibKind::Constant, |this| {
@@ -2907,6 +2932,114 @@ fn collect_pat_possibly_rest(
         }
     }
 
+    fn collect_ty_pat_opt(&mut self, pat: Option<ast::Pat>) -> PatId {
+        match pat {
+            Some(pat) => self.collect_ty_pat(pat),
+            None => self.missing_pat(),
+        }
+    }
+
+    fn collect_ty_pat(&mut self, pat: ast::Pat) -> PatId {
+        let ptr = AstPtr::new(&pat);
+        match pat {
+            ast::Pat::NotNull(_) => self.alloc_pat(Pat::NotNull, ptr),
+            ast::Pat::OrPat(pat) => {
+                let pat = pat.pats().map(|pat| self.collect_ty_pat(pat)).collect();
+                self.alloc_pat(Pat::Or(pat), ptr)
+            }
+            ast::Pat::RangePat(range_pat) => {
+                let start = range_pat
+                    .start()
+                    .map(|pat| {
+                        self.with_fresh_binding_expr_root(|this| this.lower_ty_pat_range_side(pat))
+                    })
+                    .unwrap_or_else(|| self.lower_ty_pat_range_end(self.lang_items().RangeMin));
+                let end = range_pat
+                    .end()
+                    .map(|pat| match range_pat.op_kind() {
+                        Some(ast::RangeOp::Inclusive) | None => self
+                            .with_fresh_binding_expr_root(|this| this.lower_ty_pat_range_side(pat)),
+                        Some(ast::RangeOp::Exclusive) => self.lower_excluded_range_end(pat),
+                    })
+                    .unwrap_or_else(|| self.lower_ty_pat_range_end(self.lang_items().RangeMax));
+                self.alloc_pat(
+                    Pat::Range {
+                        start: Some(start),
+                        end: Some(end),
+                        range_type: ast::RangeOp::Inclusive,
+                    },
+                    ptr,
+                )
+            }
+            ast::Pat::MacroPat(pat) => {
+                let Some(call) = pat.macro_call() else { return self.missing_pat() };
+                let ptr = AstPtr::new(&call);
+                self.collect_macro_call(call, ptr, true, |this, pat| this.collect_ty_pat_opt(pat))
+            }
+            _ => {
+                // FIXME: Emit an error.
+                self.alloc_pat(Pat::Missing, ptr)
+            }
+        }
+    }
+
+    fn lower_ty_pat_range_side(&mut self, pat: ast::Pat) -> ExprId {
+        let ptr = AstPtr::new(&pat);
+        match &pat {
+            ast::Pat::LiteralPat(it) => {
+                let Some((literal, _)) = pat_literal_to_hir(it) else { return self.missing_expr() };
+                self.alloc_expr_from_pat(Expr::Literal(literal), ptr)
+            }
+            ast::Pat::ConstBlockPat(it) => {
+                if let Some(block) = it.block_expr() {
+                    let expr_id = self.with_label_rib(RibKind::Constant, |this| {
+                        this.with_binding_owner(|this| this.collect_block(block))
+                    });
+                    self.alloc_expr_from_pat(Expr::Const(expr_id), ptr)
+                } else {
+                    self.missing_expr()
+                }
+            }
+            ast::Pat::PathPat(it) => {
+                let path = it
+                    .path()
+                    .and_then(|path| self.lower_path(path, &mut Self::impl_trait_error_allocator));
+                self.alloc_expr_from_pat(path.map(Expr::Path).unwrap_or(Expr::Missing), ptr)
+            }
+            ast::Pat::IdentPat(it) if it.is_simple_ident() => {
+                let name = it.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing);
+                self.alloc_expr_from_pat(Expr::Path(name.into()), ptr)
+            }
+            _ => self.missing_expr(), // FIXME: Emit an error.
+        }
+    }
+
+    /// When a range has no end specified (`1..` or `1..=`) or no start specified (`..5` or `..=5`),
+    /// we instead use a constant of the MAX/MIN of the type.
+    /// This way the type system does not have to handle the lack of a start/end.
+    fn lower_ty_pat_range_end(&mut self, lang_item: Option<ConstId>) -> ExprId {
+        self.with_fresh_binding_expr_root(|this| {
+            this.alloc_expr_desugared(
+                this.lang_path(lang_item).map(Expr::Path).unwrap_or(Expr::Missing),
+            )
+        })
+    }
+
+    /// Lowers the range end of an exclusive range (`2..5`) to an inclusive range 2..=(5 - 1).
+    /// This way the type system doesn't have to handle the distinction between inclusive/exclusive ranges.
+    fn lower_excluded_range_end(&mut self, pat: ast::Pat) -> ExprId {
+        self.with_fresh_binding_expr_root(|this| {
+            let excluded_end = this.lower_ty_pat_range_side(pat);
+            let range_sub_path =
+                this.lang_path(this.lang_items().RangeSub).map(Expr::Path).unwrap_or(Expr::Missing);
+            let range_sub_path = this.alloc_expr_desugared(range_sub_path);
+            this.alloc_expr_desugared(Expr::Call {
+                callee: range_sub_path,
+                args: Box::new([excluded_end]),
+            })
+        })
+    }
+
     // endregion: patterns
 
     /// Returns `false` (and emits diagnostics) when `owner` if `#[cfg]`d out, and `true` when
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs
index 34cedbd..25e5711 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs
@@ -14,7 +14,7 @@
 use syntax::ast::{HasName, RangeOp};
 
 use crate::{
-    AdtId, DefWithBodyId, FunctionId, GenericDefId, StructId, TypeParamId, VariantId,
+    AdtId, DefWithBodyId, FunctionId, GenericDefId, MacroId, StructId, TypeParamId, VariantId,
     attrs::AttrFlags,
     expr_store::path::{GenericArg, GenericArgs},
     hir::{
@@ -537,6 +537,7 @@ fn print_expr_in(&mut self, prec: Option<ast::prec::ExprPrecedence>, expr: ExprI
             Expr::Missing => w!(self, "�"),
             Expr::Underscore => w!(self, "_"),
             Expr::InlineAsm(_) => w!(self, "builtin#asm(_)"),
+            Expr::IncludeBytes => w!(self, "include_bytes!(_)"),
             Expr::OffsetOf(offset_of) => {
                 w!(self, "builtin#offset_of(");
                 self.print_type_ref(offset_of.container);
@@ -567,7 +568,7 @@ fn print_expr_in(&mut self, prec: Option<ast::prec::ExprPrecedence>, expr: ExprI
                 w!(self, " = ");
                 self.print_expr_in(prec, *expr);
             }
-            Expr::Loop { body, label } => {
+            Expr::Loop { body, label, source: _ } => {
                 if let Some(lbl) = label {
                     w!(self, "{}: ", self.store[*lbl].name.display(self.db, self.edition));
                 }
@@ -906,6 +907,7 @@ fn print_pat(&mut self, pat: PatId) {
             Pat::Missing => w!(self, "�"),
             Pat::Rest => w!(self, ".."),
             Pat::Wild => w!(self, "_"),
+            Pat::NotNull => w!(self, "!null"),
             Pat::Tuple { args, ellipsis } => {
                 w!(self, "(");
                 for (i, pat) in args.iter().enumerate() {
@@ -1134,6 +1136,10 @@ macro_rules! write_name {
                 LangItemTarget::TypeAliasId(it) => write_name!(it),
                 LangItemTarget::TraitId(it) => write_name!(it),
                 LangItemTarget::EnumVariantId(it) => write_name!(it),
+                LangItemTarget::ConstId(it) => write_name!(it),
+                LangItemTarget::MacroId(MacroId::Macro2Id(it)) => write_name!(it),
+                LangItemTarget::MacroId(MacroId::MacroRulesId(it)) => write_name!(it),
+                LangItemTarget::MacroId(MacroId::ProcMacroId(it)) => write_name!(it),
             }
 
             if let Some(s) = s {
@@ -1346,6 +1352,11 @@ pub(crate) fn print_type_ref(&mut self, type_ref: TypeRefId) {
                 w!(self, "dyn ");
                 self.print_type_bounds(bounds);
             }
+            TypeRef::PatternType(ty, pat) => {
+                self.print_type_ref(*ty);
+                w!(self, " is ");
+                self.print_pat(*pat);
+            }
         }
     }
 
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/scope.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/scope.rs
index ddb8285..7a2c8dc 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/scope.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/scope.rs
@@ -350,7 +350,7 @@ fn compute_expr_scopes(
         Expr::Unsafe { id, statements, tail } => {
             handle_block(*id, statements, *tail, None, scopes, scope, const_scope);
         }
-        Expr::Loop { body: body_expr, label } => {
+        Expr::Loop { body: body_expr, label, source: _ } => {
             let mut scope = scopes.new_labeled_scope(*scope, make_label(*label));
             compute_expr_scopes(scopes, *body_expr, &mut scope, const_scope);
         }
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/tests/body/block.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/tests/body/block.rs
index 71fcced..906c483 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/tests/body/block.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/tests/body/block.rs
@@ -199,6 +199,11 @@ fn f() {
                         4401,
                     ),
                 ),
+                containing_module_inside_def_map: None,
+                name_or_empty: Name {
+                    symbol: "",
+                    ctx: (),
+                },
             }"#]],
     );
 }
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/find_path.rs b/src/tools/rust-analyzer/crates/hir-def/src/find_path.rs
index 2a1b7f7..6aaf8a6 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/find_path.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/find_path.rs
@@ -142,9 +142,7 @@ fn find_path_inner(ctx: &FindPathCtx<'_>, item: ItemInNs, max_len: usize) -> Opt
         // - if the item is an enum variant, refer to it via the enum
         let loc = variant.lookup(ctx.db);
         if let Some(mut path) = find_path_inner(ctx, ItemInNs::Types(loc.parent.into()), max_len) {
-            path.push_segment(
-                loc.parent.enum_variants(ctx.db).variants[loc.index as usize].1.clone(),
-            );
+            path.push_segment(loc.name.clone());
             return Some(path);
         }
         // If this doesn't work, it seems we have no way of referring to the
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/hir.rs b/src/tools/rust-analyzer/crates/hir-def/src/hir.rs
index 6eba859..a800569 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/hir.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/hir.rs
@@ -224,6 +224,7 @@ pub enum Expr {
     Loop {
         body: ExprId,
         label: Option<LabelId>,
+        source: LoopSource,
     },
     Call {
         callee: ExprId,
@@ -322,6 +323,7 @@ pub enum Expr {
     Underscore,
     OffsetOf(OffsetOf),
     InlineAsm(InlineAsm),
+    IncludeBytes,
 }
 
 impl Expr {
@@ -343,7 +345,8 @@ pub fn precedence(&self) -> ast::prec::ExprPrecedence {
             | Expr::RecordLit { .. }
             | Expr::Tuple { .. }
             | Expr::OffsetOf(_)
-            | Expr::Underscore => ExprPrecedence::Unambiguous,
+            | Expr::Underscore
+            | Expr::IncludeBytes => ExprPrecedence::Unambiguous,
 
             Expr::Await { .. }
             | Expr::Call { .. }
@@ -389,6 +392,17 @@ pub fn precedence(&self) -> ast::prec::ExprPrecedence {
     }
 }
 
+/// The loop type that yielded an `Expr::Loop`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum LoopSource {
+    /// A `loop { .. }` loop.
+    Loop,
+    /// A `while _ { .. }` loop.
+    While,
+    /// A `for _ in _ { .. }` loop.
+    ForLoop,
+}
+
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct OffsetOf {
     pub container: TypeRefId,
@@ -717,6 +731,7 @@ pub enum Pat {
     Deref {
         inner: PatId,
     },
+    NotNull,
     ConstBlock(ExprId),
     /// An expression inside a pattern. That can only occur inside assignments.
     ///
@@ -734,7 +749,8 @@ pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) {
             | Pat::Wild
             | Pat::Missing
             | Pat::Rest
-            | Pat::Expr(_) => {}
+            | Pat::Expr(_)
+            | Pat::NotNull => {}
             Pat::Bind { subpat, .. } => {
                 subpat.iter().copied().for_each(f);
             }
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 43e29c1..6cd8377 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
@@ -9,7 +9,7 @@
 use crate::{
     LifetimeParamId, TypeParamId,
     expr_store::{ExpressionStore, path::Path},
-    hir::ExprId,
+    hir::{ExprId, PatId},
 };
 
 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
@@ -139,6 +139,7 @@ pub enum TypeRef {
     ImplTrait(ThinVec<TypeBound>),
     DynTrait(ThinVec<TypeBound>),
     TypeParam(TypeParamId),
+    PatternType(TypeRefId, PatId),
     Error,
 }
 
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs b/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs
index ba077b1..f8be211 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs
@@ -12,7 +12,7 @@
 use stdx::format_to;
 
 use crate::{
-    AssocItemId, AttrDefId, Complete, FxIndexMap, ModuleDefId, ModuleId, TraitId,
+    AdtId, AssocItemId, AttrDefId, Complete, EnumId, FxIndexMap, ModuleDefId, ModuleId, TraitId,
     attrs::AttrFlags,
     db::DefDatabase,
     item_scope::{ImportOrExternCrate, ItemInNs},
@@ -208,7 +208,8 @@ fn collect_import_map(db: &dyn DefDatabase, krate: Crate) -> ImportMapIndex {
                         complete: do_not_complete,
                     };
 
-                    if let Some(ModuleDefId::TraitId(tr)) = item.as_module_def_id() {
+                    let module_def = item.as_module_def_id();
+                    if let Some(ModuleDefId::TraitId(tr)) = module_def {
                         Self::collect_trait_assoc_items(
                             db,
                             &mut map,
@@ -216,6 +217,8 @@ fn collect_import_map(db: &dyn DefDatabase, krate: Crate) -> ImportMapIndex {
                             matches!(item, ItemInNs::Types(_)),
                             &import_info,
                         );
+                    } else if let Some(ModuleDefId::AdtId(AdtId::EnumId(enum_))) = module_def {
+                        Self::collect_enum_variants(db, &mut map, enum_, &import_info);
                     }
 
                     let (infos, _) =
@@ -224,7 +227,7 @@ fn collect_import_map(db: &dyn DefDatabase, krate: Crate) -> ImportMapIndex {
                     infos.push(import_info);
 
                     // If we've just added a module, descend into it.
-                    if let Some(ModuleDefId::ModuleId(mod_id)) = item.as_module_def_id() {
+                    if let Some(ModuleDefId::ModuleId(mod_id)) = module_def {
                         worklist.push(mod_id);
                     }
                 }
@@ -234,6 +237,33 @@ fn collect_import_map(db: &dyn DefDatabase, krate: Crate) -> ImportMapIndex {
         map
     }
 
+    fn collect_enum_variants(
+        db: &dyn DefDatabase,
+        map: &mut ImportMapIndex,
+        enum_: EnumId,
+        enum_import_info: &ImportInfo,
+    ) {
+        let _p = tracing::info_span!("collect_enum_variants").entered();
+        for (variant_name, &(variant, _)) in &enum_.enum_variants(db).variants {
+            let attr_id = variant.into();
+            let attrs = AttrFlags::query(db, attr_id);
+            let do_not_complete = Complete::extract(false, attrs);
+            let variant_info = ImportInfo {
+                container: enum_import_info.container,
+                name: variant_name.clone(),
+                is_doc_hidden: attrs.contains(AttrFlags::IS_DOC_HIDDEN),
+                is_unstable: attrs.contains(AttrFlags::IS_UNSTABLE),
+                complete: do_not_complete,
+            };
+
+            let (infos, _) = map
+                .entry(ItemInNs::Types(variant.into()))
+                .or_insert_with(|| (SmallVec::new(), IsTraitAssocItem::No));
+            infos.reserve_exact(1);
+            infos.push(variant_info);
+        }
+    }
+
     fn collect_trait_assoc_items(
         db: &dyn DefDatabase,
         map: &mut ImportMapIndex,
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs
index c2cbb9e..04dfdb7 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs
@@ -7,7 +7,7 @@
 use stdx::impl_from;
 
 use crate::{
-    AdtId, AssocItemId, AttrDefId, Crate, EnumId, EnumVariantId, FunctionId, ImplId,
+    AdtId, AssocItemId, AttrDefId, ConstId, Crate, EnumId, EnumVariantId, FunctionId, ImplId,
     ItemContainerId, MacroId, ModuleDefId, StaticId, StructId, TraitId, TypeAliasId, UnionId,
     attrs::AttrFlags,
     db::DefDatabase,
@@ -25,10 +25,12 @@ pub enum LangItemTarget {
     TypeAliasId(TypeAliasId),
     TraitId(TraitId),
     EnumVariantId(EnumVariantId),
+    ConstId(ConstId),
+    MacroId(MacroId),
 }
 
 impl_from!(
-    EnumId, FunctionId, ImplId, StaticId, StructId, UnionId, TypeAliasId, TraitId, EnumVariantId for LangItemTarget
+    EnumId, FunctionId, ImplId, StaticId, StructId, UnionId, TypeAliasId, TraitId, EnumVariantId, ConstId, MacroId for LangItemTarget
 );
 
 /// Salsa query. This will look for lang items in a specific crate.
@@ -51,7 +53,7 @@ pub fn crate_lang_items(db: &dyn DefDatabase, krate: Crate) -> Option<Box<LangIt
                 match assoc {
                     AssocItemId::FunctionId(f) => lang_items.collect_lang_item(db, f),
                     AssocItemId::TypeAliasId(t) => lang_items.collect_lang_item(db, t),
-                    AssocItemId::ConstId(_) => (),
+                    AssocItemId::ConstId(c) => lang_items.collect_lang_item(db, c),
                 }
             }
         }
@@ -68,13 +70,13 @@ pub fn crate_lang_items(db: &dyn DefDatabase, krate: Crate) -> Option<Box<LangIt
                             AssocItemId::TypeAliasId(alias) => {
                                 lang_items.collect_lang_item(db, alias)
                             }
-                            AssocItemId::ConstId(_) => {}
+                            AssocItemId::ConstId(c) => lang_items.collect_lang_item(db, c),
                         }
                     });
                 }
                 ModuleDefId::AdtId(AdtId::EnumId(e)) => {
                     lang_items.collect_lang_item(db, e);
-                    e.enum_variants(db).variants.iter().for_each(|&(id, _, _)| {
+                    e.enum_variants(db).variants.values().for_each(|&(id, _)| {
                         lang_items.collect_lang_item(db, id);
                     });
                 }
@@ -93,6 +95,7 @@ pub fn crate_lang_items(db: &dyn DefDatabase, krate: Crate) -> Option<Box<LangIt
                 ModuleDefId::TypeAliasId(t) => {
                     lang_items.collect_lang_item(db, t);
                 }
+                ModuleDefId::ConstId(c) => lang_items.collect_lang_item(db, c),
                 _ => {}
             }
         }
@@ -274,7 +277,6 @@ fn resolve_manually(&mut self, db: &dyn DefDatabase) {
             (self.BitXorAssign, &mut self.BitXorAssign_bitxor_assign, sym::bitxor_assign),
             (self.BitOrAssign, &mut self.BitOrAssign_bitor_assign, sym::bitor_assign),
             (self.BitAndAssign, &mut self.BitAndAssign_bitand_assign, sym::bitand_assign),
-            (self.Drop, &mut self.Drop_drop, sym::drop),
             (self.Debug, &mut self.Debug_fmt, sym::fmt),
             (self.Deref, &mut self.Deref_deref, sym::deref),
             (self.DerefMut, &mut self.DerefMut_deref_mut, sym::deref_mut),
@@ -305,6 +307,13 @@ fn resolve_manually(&mut self, db: &dyn DefDatabase) {
             );
             Some(())
         })();
+        (|| {
+            methods(
+                self.Drop?,
+                &mut [(&mut self.Drop_drop, sym::drop), (&mut self.Drop_pin_drop, sym::pin_drop)],
+            );
+            Some(())
+        })();
     }
 }
 
@@ -395,11 +404,15 @@ fn fill_non_lang_core_items(&mut self, db: &dyn DefDatabase, core_def_map: &DefM
         }
 
         #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+        #[allow(non_camel_case_types)]
         pub enum LangItemEnum {
             $(
                 $(#[$attr])*
                 $lang_item,
             )*
+            $( $non_lang_trait, )*
+            $( $non_lang_macro_field, )*
+            $( $resolve_manually, )*
         }
 
         impl LangItemEnum {
@@ -407,6 +420,9 @@ impl LangItemEnum {
             pub fn from_lang_items(self, lang_items: &LangItems) -> Option<LangItemTarget> {
                 match self {
                     $( LangItemEnum::$lang_item => lang_items.$lang_item.map(Into::into), )*
+                    $( LangItemEnum::$non_lang_trait => lang_items.$non_lang_trait.map(Into::into), )*
+                    $( LangItemEnum::$non_lang_macro_field => lang_items.$non_lang_macro_field.map(Into::into), )*
+                    $( LangItemEnum::$resolve_manually => lang_items.$resolve_manually.map(Into::into), )*
                 }
             }
 
@@ -646,6 +662,10 @@ pub fn from_symbol(symbol: &Symbol) -> Option<Self> {
     FieldBase,               sym::field_base,          TypeAliasId;
     FieldType,               sym::field_type,          TypeAliasId;
 
+    RangeMin,                sym::RangeMin,            ConstId;
+    RangeMax,                sym::RangeMax,            ConstId;
+    RangeSub,                sym::RangeSub,            FunctionId;
+
     @non_lang_core_traits:
     core::default, Default;
     core::fmt, Debug;
@@ -710,6 +730,7 @@ pub fn from_symbol(symbol: &Symbol) -> Option<Self> {
     PartialOrd_ge,                 FunctionId;
     PartialOrd_gt,                 FunctionId;
     Drop_drop,                     FunctionId;
+    Drop_pin_drop,                     FunctionId;
     Debug_fmt,                     FunctionId;
     Deref_deref,                   FunctionId;
     DerefMut_deref_mut,            FunctionId;
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 3aaf8910..2172e24 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/lib.rs
@@ -48,7 +48,7 @@
 pub mod import_map;
 pub mod visibility;
 
-use intern::Interned;
+use intern::{Interned, sym};
 use rustc_abi::ExternAbi;
 use thin_vec::ThinVec;
 
@@ -298,7 +298,7 @@ pub fn enum_variants(self, db: &dyn DefDatabase) -> &EnumVariants {
     pub fn enum_variants_with_diagnostics(
         self,
         db: &dyn DefDatabase,
-    ) -> &(EnumVariants, Option<ThinVec<InactiveEnumVariantCode>>) {
+    ) -> &(EnumVariants, ThinVec<InactiveEnumVariantCode>) {
         EnumVariants::of(db, self)
     }
 }
@@ -367,20 +367,35 @@ pub fn abi(self, db: &dyn DefDatabase) -> ExternAbi {
     }
 }
 
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
 pub struct EnumVariantLoc {
     pub id: AstId<ast::Variant>,
     pub parent: EnumId,
-    pub index: u32,
+    pub name: Name,
 }
 impl_intern!(EnumVariantId, EnumVariantLoc);
 impl_loc!(EnumVariantLoc, id: Variant, parent: EnumId);
 
+impl EnumVariantLoc {
+    pub fn index(&self, db: &dyn DefDatabase) -> usize {
+        self.parent
+            .enum_variants(db)
+            .variants
+            .get_full(&self.name)
+            .expect("parent enum should include this variant")
+            .0
+    }
+}
+
 impl EnumVariantId {
     pub fn fields(self, db: &dyn DefDatabase) -> &VariantFields {
         VariantFields::of(db, self.into())
     }
 
+    pub fn index(self, db: &dyn DefDatabase) -> usize {
+        self.loc(db).index(db)
+    }
+
     pub fn fields_with_source_map(
         self,
         db: &dyn DefDatabase,
@@ -427,6 +442,7 @@ pub enum MacroExpander {
     BuiltInAttr(BuiltinAttrExpander),
     BuiltInDerive(BuiltinDeriveExpander),
     BuiltInEager(EagerExpander),
+    UnimplementedBuiltIn,
 }
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -457,6 +473,11 @@ pub struct ModuleIdLt<'db> {
     /// `BlockId` of that block expression. If `None`, this module is part of the crate-level
     /// `DefMap` of `krate`.
     pub block: Option<BlockId>,
+    /// The parent module of this module, or `None` if this is the root module inside the def
+    /// map (including for block def maps).
+    pub containing_module_inside_def_map: Option<ModuleIdLt<'db>>,
+    /// The name of this module, or [`sym::__empty`] for the root module.
+    name_or_empty: Name,
 }
 pub type ModuleId = ModuleIdLt<'static>;
 
@@ -502,21 +523,23 @@ pub fn crate_def_map(self, db: &dyn DefDatabase) -> &DefMap {
     }
 
     pub fn name(self, db: &dyn DefDatabase) -> Option<Name> {
-        let def_map = self.def_map(db);
-        let parent = def_map[self].parent?;
-        def_map[parent].children.iter().find_map(|(name, module_id)| {
-            if *module_id == self { Some(name.clone()) } else { None }
-        })
+        let name = self.name_or_empty(db);
+        if *name.symbol() == sym::__empty { None } else { Some(name) }
     }
 
     /// Returns the module containing `self`, either the parent `mod`, or the module (or block) containing
     /// the block, if `self` corresponds to a block expression.
     pub fn containing_module(self, db: &dyn DefDatabase) -> Option<ModuleId> {
-        self.def_map(db).containing_module(self)
+        self.containing_module_inside_def_map(db)
+            .or_else(|| self.block(db).map(|block| block.loc(db).module))
+            .map(|module| {
+                // SAFETY: Not sure.
+                unsafe { module.to_static() }
+            })
     }
 
     pub fn is_block_module(self, db: &dyn DefDatabase) -> bool {
-        self.block(db).is_some() && self.def_map(db).root_module_id() == self
+        self.block(db).is_some() && self.containing_module_inside_def_map(db).is_none()
     }
 }
 
@@ -837,6 +860,12 @@ fn from(id: VariantId) -> Self {
     }
 }
 
+impl From<ImplId> for ExpressionStoreOwnerId {
+    fn from(id: ImplId) -> Self {
+        ExpressionStoreOwnerId::Signature(id.into())
+    }
+}
+
 impl GenericDefId {
     pub fn file_id_and_params_of(
         self,
@@ -988,6 +1017,14 @@ pub enum VariantId {
 impl_from!(EnumVariantId, StructId, UnionId for VariantId);
 
 impl VariantId {
+    pub fn from_non_enum(adt_id: AdtId) -> Option<Self> {
+        Some(match adt_id {
+            AdtId::StructId(struct_id) => struct_id.into(),
+            AdtId::UnionId(union_id) => union_id.into(),
+            AdtId::EnumId(_) => return None,
+        })
+    }
+
     pub fn fields(self, db: &dyn DefDatabase) -> &VariantFields {
         VariantFields::of(db, self)
     }
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/nameres.rs b/src/tools/rust-analyzer/crates/hir-def/src/nameres.rs
index 88e3408..0c7e7a3 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/nameres.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/nameres.rs
@@ -66,7 +66,7 @@
     EditionedFileId, ErasedAstId, HirFileId, InFile, MacroCallId, mod_path::ModPath, name::Name,
     proc_macro::ProcMacroKind,
 };
-use intern::Symbol;
+use intern::{Symbol, sym};
 use itertools::Itertools;
 use rustc_hash::FxHashMap;
 use span::{Edition, FileAstId, FileId, ROOT_ERASED_FILE_AST_ID};
@@ -427,7 +427,7 @@ pub(crate) fn crate_local_def_map(db: &dyn DefDatabase, crate_id: Crate) -> DefM
 
 #[salsa_macros::tracked(returns(ref))]
 pub fn block_def_map(db: &dyn DefDatabase, block_id: BlockId) -> DefMap {
-    let BlockLoc { ast_id, module } = block_id.lookup(db);
+    let BlockLoc { ast_id, module } = *block_id.lookup(db);
 
     let visibility = Visibility::Module(module, VisibilityExplicitness::Implicit);
     let module_data =
@@ -465,7 +465,16 @@ fn empty(
         block: Option<BlockInfo>,
     ) -> DefMap {
         let mut modules = ModulesMap::new();
-        let root = unsafe { ModuleIdLt::new(db, krate, block.map(|it| it.block)).to_static() };
+        let root = unsafe {
+            ModuleIdLt::new(
+                db,
+                krate,
+                block.map(|it| it.block),
+                None,
+                Name::new_symbol_root(sym::__empty),
+            )
+            .to_static()
+        };
         modules.insert(root, module_data);
 
         DefMap {
@@ -841,6 +850,7 @@ pub(crate) fn macro_styles_from_id(db: &dyn DefDatabase, macro_id: MacroId) -> M
         MacroExpander::BuiltIn(_) | MacroExpander::BuiltInEager(_) => MacroCallStyles::FN_LIKE,
         MacroExpander::BuiltInAttr(_) => MacroCallStyles::ATTR,
         MacroExpander::BuiltInDerive(_) => MacroCallStyles::DERIVE,
+        MacroExpander::UnimplementedBuiltIn => MacroCallStyles::all(), // Unknown.
     }
 }
 
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/nameres/assoc.rs b/src/tools/rust-analyzer/crates/hir-def/src/nameres/assoc.rs
index b1d5547..7b5b39c 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/nameres/assoc.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/nameres/assoc.rs
@@ -50,7 +50,7 @@ pub fn query_with_diagnostics(
         db: &dyn DefDatabase,
         tr: TraitId,
     ) -> (TraitItems, DefDiagnostics) {
-        let ItemLoc { container: module_id, id: ast_id } = tr.lookup(db);
+        let ItemLoc { container: module_id, id: ast_id } = *tr.lookup(db);
         let ast_id_map = db.ast_id_map(ast_id.file_id);
         let source = ast_id.with_value(ast_id_map.get(ast_id.value)).to_node(db);
         if source.eq_token().is_some() {
@@ -115,7 +115,7 @@ impl ImplItems {
     #[salsa::tracked(returns(ref))]
     pub fn of(db: &dyn DefDatabase, id: ImplId) -> (ImplItems, DefDiagnostics) {
         let _p = tracing::info_span!("impl_items_with_diagnostics_query").entered();
-        let ItemLoc { container: module_id, id: ast_id } = id.lookup(db);
+        let ItemLoc { container: module_id, id: ast_id } = *id.lookup(db);
 
         let collector =
             AssocItemCollector::new(db, module_id, ItemContainerId::ImplId(id), ast_id.file_id);
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs b/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs
index 5ef51db..a916cda 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs
@@ -1027,7 +1027,7 @@ fn record_resolved_import(&mut self, directive: &ImportDirective) {
                             .enum_variants(self.db)
                             .variants
                             .iter()
-                            .map(|&(variant, ref name, _)| {
+                            .map(|(name, &(variant, _))| {
                                 let res = PerNs::both(variant.into(), variant.into(), vis, None);
                                 (Some(name.clone()), res)
                             })
@@ -2428,6 +2428,8 @@ fn push_child_module(
                 self.def_collector.db,
                 self.def_collector.def_map.krate,
                 self.def_collector.def_map.block_id(),
+                Some(self.module_id),
+                name.clone(),
             )
             .to_static()
         };
@@ -2560,7 +2562,7 @@ fn collect_macro_rules(&mut self, ast_id: ItemTreeAstId<MacroRules>, module: Mod
                         .def_map
                         .diagnostics
                         .push(DefDiagnostic::unimplemented_builtin_macro(self.module_id, f_ast_id));
-                    return;
+                    MacroExpander::UnimplementedBuiltIn
                 }
             }
         } else {
@@ -2639,7 +2641,7 @@ fn collect_macro_def(&mut self, ast_id: ItemTreeAstId<Macro2>, module: ModuleId)
                     .def_map
                     .diagnostics
                     .push(DefDiagnostic::unimplemented_builtin_macro(self.module_id, f_ast_id));
-                return;
+                MacroExpander::UnimplementedBuiltIn
             }
         } else {
             // Case 2: normal `macro`
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/nameres/path_resolution.rs b/src/tools/rust-analyzer/crates/hir-def/src/nameres/path_resolution.rs
index cf33cec..54fd30f 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/nameres/path_resolution.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/nameres/path_resolution.rs
@@ -519,12 +519,8 @@ fn resolve_remaining_segments<'a>(
                     // enum variant
                     cov_mark::hit!(can_import_enum_variant);
 
-                    let res = e
-                        .enum_variants(db)
-                        .variants
-                        .iter()
-                        .find(|(_, name, _)| name == segment)
-                        .map(|&(variant, _, shape)| match shape {
+                    let res = e.enum_variants(db).variants.get(segment).map(|&(variant, shape)| {
+                        match shape {
                             FieldsShape::Record => {
                                 PerNs::types(variant.into(), Visibility::Public, None)
                             }
@@ -534,7 +530,8 @@ fn resolve_remaining_segments<'a>(
                                 Visibility::Public,
                                 None,
                             ),
-                        });
+                        }
+                    });
                     // FIXME: Need to filter visibility here and below? Not sure.
                     return match res {
                         Some(res) => {
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/resolver.rs b/src/tools/rust-analyzer/crates/hir-def/src/resolver.rs
index 8320221..c16ad9b 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/resolver.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/resolver.rs
@@ -194,7 +194,9 @@ pub fn resolve_path_in_type_ns_with_prefix_info(
                     LangItemTarget::TraitId(it) => TypeNs::TraitId(it),
                     LangItemTarget::FunctionId(_)
                     | LangItemTarget::ImplId(_)
-                    | LangItemTarget::StaticId(_) => return None,
+                    | LangItemTarget::StaticId(_)
+                    | LangItemTarget::ConstId(_)
+                    | LangItemTarget::MacroId(_) => return None,
                 };
                 return Some((
                     type_ns,
@@ -337,11 +339,13 @@ pub fn resolve_path_in_value_ns_with_prefix_info(
                         LangItemTarget::StaticId(it) => ValueNs::StaticId(it),
                         LangItemTarget::StructId(it) => ValueNs::StructId(it),
                         LangItemTarget::EnumVariantId(it) => ValueNs::EnumVariantId(it),
+                        LangItemTarget::ConstId(it) => ValueNs::ConstId(it),
                         LangItemTarget::UnionId(_)
                         | LangItemTarget::ImplId(_)
                         | LangItemTarget::TypeAliasId(_)
                         | LangItemTarget::TraitId(_)
-                        | LangItemTarget::EnumId(_) => return None,
+                        | LangItemTarget::EnumId(_)
+                        | LangItemTarget::MacroId(_) => return None,
                     }),
                     ResolvePathResultPrefixInfo::default(),
                 ));
@@ -356,7 +360,9 @@ pub fn resolve_path_in_value_ns_with_prefix_info(
                     LangItemTarget::TraitId(it) => TypeNs::TraitId(it),
                     LangItemTarget::FunctionId(_)
                     | LangItemTarget::ImplId(_)
-                    | LangItemTarget::StaticId(_) => return None,
+                    | LangItemTarget::StaticId(_)
+                    | LangItemTarget::ConstId(_)
+                    | LangItemTarget::MacroId(_) => return None,
                 };
                 // Remaining segments start from 0 because lang paths have no segments other than the remaining.
                 return Some((
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/signatures.rs b/src/tools/rust-analyzer/crates/hir-def/src/signatures.rs
index e58befa..e9307a1 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/signatures.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/signatures.rs
@@ -1,6 +1,6 @@
 //! Item signature IR definitions
 
-use std::{cell::LazyCell, ops::Not as _};
+use std::cell::LazyCell;
 
 use bitflags::bitflags;
 use cfg::{CfgExpr, CfgOptions};
@@ -19,8 +19,9 @@
 use triomphe::Arc;
 
 use crate::{
-    ConstId, EnumId, EnumVariantId, EnumVariantLoc, ExternBlockId, FunctionId, HasModule, ImplId,
-    ItemContainerId, ModuleId, StaticId, StructId, TraitId, TypeAliasId, UnionId, VariantId,
+    ConstId, EnumId, EnumVariantId, EnumVariantLoc, ExternBlockId, FunctionId, FxIndexMap,
+    HasModule, ImplId, ItemContainerId, ModuleId, StaticId, StructId, TraitId, TypeAliasId,
+    UnionId, VariantId,
     attrs::AttrFlags,
     db::DefDatabase,
     expr_store::{
@@ -1055,7 +1056,7 @@ pub struct InactiveEnumVariantCode {
 
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct EnumVariants {
-    pub variants: Box<[(EnumVariantId, Name, FieldsShape)]>,
+    pub variants: FxIndexMap<Name, (EnumVariantId, FieldsShape)>,
 }
 
 #[salsa::tracked]
@@ -1064,30 +1065,31 @@ impl EnumVariants {
     pub(crate) fn of(
         db: &dyn DefDatabase,
         e: EnumId,
-    ) -> (EnumVariants, Option<ThinVec<InactiveEnumVariantCode>>) {
+    ) -> (EnumVariants, ThinVec<InactiveEnumVariantCode>) {
         let loc = e.lookup(db);
         let source = loc.source(db);
         let ast_id_map = db.ast_id_map(source.file_id);
 
         let mut diagnostics = ThinVec::new();
         let cfg_options = loc.container.krate(db).cfg_options(db);
-        let mut index = 0;
         let Some(variants) = source.value.variant_list() else {
-            return (EnumVariants { variants: Box::default() }, None);
+            return (EnumVariants { variants: FxIndexMap::default() }, ThinVec::new());
         };
-        let variants = variants
+        let mut variants = variants
             .variants()
             .filter_map(|variant| {
                 let ast_id = ast_id_map.ast_id(&variant);
                 match AttrFlags::is_cfg_enabled_for(&variant, cfg_options) {
                     Ok(()) => {
-                        let enum_variant =
-                            EnumVariantLoc { id: source.with_value(ast_id), parent: e, index }
-                                .intern(db);
-                        index += 1;
                         let name = as_name_opt(variant.name());
+                        let enum_variant = EnumVariantLoc {
+                            id: source.with_value(ast_id),
+                            parent: e,
+                            name: name.clone(),
+                        }
+                        .intern(db);
                         let shape = adt_shape(variant.kind());
-                        Some((enum_variant, name, shape))
+                        Some((name, (enum_variant, shape)))
                     }
                     Err(cfg) => {
                         diagnostics.push(InactiveEnumVariantCode {
@@ -1099,34 +1101,38 @@ pub(crate) fn of(
                     }
                 }
             })
-            .collect();
+            .collect::<FxIndexMap<_, _>>();
+        variants.shrink_to_fit();
+        diagnostics.shrink_to_fit();
 
-        (EnumVariants { variants }, diagnostics.is_empty().not().then_some(diagnostics))
+        (EnumVariants { variants }, diagnostics)
     }
 }
 
 impl EnumVariants {
     pub fn variant(&self, name: &Name) -> Option<EnumVariantId> {
-        self.variants.iter().find_map(|(v, n, _)| if n == name { Some(*v) } else { None })
+        self.variants.get(name).map(|&(id, _)| id)
     }
 
     pub fn variant_name_by_id(&self, variant_id: EnumVariantId) -> Option<Name> {
         self.variants
             .iter()
-            .find_map(|(id, name, _)| if *id == variant_id { Some(name.clone()) } else { None })
+            .find_map(|(name, (id, _))| if *id == variant_id { Some(name.clone()) } else { None })
     }
 
     // [Adopted from rustc](https://github.com/rust-lang/rust/blob/bd53aa3bf7a24a70d763182303bd75e5fc51a9af/compiler/rustc_middle/src/ty/adt.rs#L446-L448)
     pub fn is_payload_free(&self, db: &dyn DefDatabase) -> bool {
-        self.variants.iter().all(|&(v, _, _)| {
+        self.variants.values().all(|&(v, shape)| {
             // The condition check order is slightly modified from rustc
             // to improve performance by early returning with relatively fast checks
-            let variant = v.fields(db);
-            if !variant.fields().is_empty() {
-                return false;
-            }
+
             // The outer if condition is whether this variant has const ctor or not
-            if !matches!(variant.shape, FieldsShape::Unit) {
+            if !matches!(shape, FieldsShape::Unit) {
+                let variant = v.fields(db);
+                if !variant.fields().is_empty() {
+                    return false;
+                }
+
                 let body = Body::of(db, v.into());
                 // A variant with explicit discriminant
                 if !matches!(body[body.root_expr()], crate::hir::Expr::Missing) {
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/test_db.rs b/src/tools/rust-analyzer/crates/hir-def/src/test_db.rs
index b854d2a..e3fd456 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/test_db.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/test_db.rs
@@ -122,7 +122,7 @@ fn set_source_root_with_durability(
     }
 
     fn file_source_root(&self, id: base_db::FileId) -> FileSourceRootInput {
-        self.files.file_source_root(id)
+        self.files.file_source_root(self, id)
     }
 
     fn set_file_source_root_with_durability(
@@ -142,6 +142,10 @@ fn crates_map(&self) -> Arc<CratesMap> {
     fn nonce_and_revision(&self) -> (Nonce, salsa::Revision) {
         (self.nonce, salsa::plumbing::ZalsaDatabase::zalsa(self).current_revision())
     }
+
+    fn line_column(&self, _file: FileId, _offset: syntax::TextSize) -> Result<(u32, u32), ()> {
+        Err(())
+    }
 }
 
 impl TestDB {
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs b/src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs
index 8b031e3..c4da558 100644
--- a/src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs
+++ b/src/tools/rust-analyzer/crates/hir-expand/src/builtin/derive_macro.rs
@@ -22,7 +22,7 @@
 use syntax::{
     ast::{
         self, AstNode, FieldList, HasAttrs, HasGenericArgs, HasGenericParams, HasModuleItem,
-        HasName, HasTypeBounds, make,
+        HasName, HasTypeBounds,
     },
     syntax_editor::{GetOrCreateWhereClause, SyntaxEditor},
 };
@@ -1435,6 +1435,7 @@ fn substitute_type_in_bound(
         param_name: &str,
         replacement: &str,
     ) -> bool {
+        let make = editor.make();
         return match ty {
             ast::Type::ArrayType(ty) => ty
                 .ty()
@@ -1462,8 +1463,8 @@ fn substitute_type_in_bound(
                 if path.as_single_name_ref().is_some_and(|name| name.text() == param_name) {
                     editor.replace(
                         path.syntax(),
-                        make::path_from_segments(
-                            [make::path_segment(make::name_ref(replacement))],
+                        make.path_from_segments(
+                            [make.path_segment(make.name_ref(replacement))],
                             false,
                         )
                         .syntax(),
@@ -1494,6 +1495,9 @@ fn substitute_type_in_bound(
             ast::Type::TupleType(ty) => any_long(ty.fields(), |ty| {
                 substitute_type_in_bound(editor, ty, param_name, replacement)
             }),
+            ast::Type::PatternType(ty) => ty
+                .ty()
+                .is_some_and(|ty| substitute_type_in_bound(editor, ty, param_name, replacement)),
             ast::Type::InferType(_) | ast::Type::MacroType(_) | ast::Type::NeverType(_) => false,
         };
 
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs b/src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs
index eb7175c..e12cdef 100644
--- a/src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs
+++ b/src/tools/rust-analyzer/crates/hir-expand/src/builtin/fn_macro.rs
@@ -137,6 +137,7 @@ pub fn find_builtin_macro(
     (const_format_args, ConstFormatArgs) => format_args_expand,
     (format_args_nl, FormatArgsNl) => format_args_nl_expand,
     (quote, Quote) => quote_expand,
+    (pattern_type, PatternType) => pattern_type_expand,
 
     EagerExpander:
     (compile_error, CompileError) => compile_error_expand,
@@ -851,17 +852,9 @@ fn include_bytes_expand(
     span: Span,
 ) -> ExpandResult<tt::TopSubtree> {
     // FIXME: actually read the file here if the user asked for macro expansion
-    let underscore = sym::underscore;
-    let zero = tt::Literal {
-        text_and_suffix: sym::_0_u8,
-        span,
-        kind: tt::LitKind::Integer,
-        suffix_len: 3,
-    };
-    // We don't use a real length since we can't know the file length, so we use an underscore
-    // to infer it.
+    let pound = mk_pound(span);
     let res = quote! {span =>
-        &[#zero; #underscore]
+        builtin #pound include_bytes
     };
     ExpandResult::ok(res)
 }
@@ -994,3 +987,15 @@ fn unescape_str(s: &str) -> Cow<'_, str> {
         Cow::Borrowed(s)
     }
 }
+
+fn pattern_type_expand(
+    _db: &dyn ExpandDatabase,
+    _arg_id: MacroCallId,
+    tt: &tt::TopSubtree,
+    call_site: Span,
+) -> ExpandResult<tt::TopSubtree> {
+    let mut tt = tt.clone();
+    tt.set_top_subtree_delimiter_kind(tt::DelimiterKind::Invisible);
+    let pound = mk_pound(call_site);
+    ExpandResult::ok(quote! {call_site => builtin #pound pattern_type ( #tt ) })
+}
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/db.rs b/src/tools/rust-analyzer/crates/hir-expand/src/db.rs
index beae6e8..5131156 100644
--- a/src/tools/rust-analyzer/crates/hir-expand/src/db.rs
+++ b/src/tools/rust-analyzer/crates/hir-expand/src/db.rs
@@ -43,6 +43,7 @@ pub enum TokenExpander<'db> {
     BuiltInAttr(BuiltinAttrExpander),
     /// `derive(Copy)` and such.
     BuiltInDerive(BuiltinDeriveExpander),
+    UnimplementedBuiltIn,
     /// The thing we love the most here in rust-analyzer -- procedural macros.
     ProcMacro(CustomProcMacroExpander),
 }
@@ -149,8 +150,8 @@ fn syntax_context(db: &dyn ExpandDatabase, file: HirFileId, edition: Edition) ->
     match file {
         HirFileId::FileId(_) => SyntaxContext::root(edition),
         HirFileId::MacroFile(m) => {
-            let kind = m.loc(db).kind;
-            db.macro_arg_considering_derives(m, &kind).2.ctx
+            let kind = &m.loc(db).kind;
+            db.macro_arg_considering_derives(m, kind).2.ctx
         }
     }
 }
@@ -311,6 +312,7 @@ pub fn expand_speculative(
             it.expand(db, actual_macro_call, &tt, span).map_err(Into::into)
         }
         MacroDefKind::BuiltInAttr(_, it) => it.expand(db, actual_macro_call, &tt, span),
+        MacroDefKind::UnimplementedBuiltIn(_) => expand_unimplemented_builtin_macro(span),
     };
 
     let expand_to = loc.expand_to();
@@ -335,6 +337,13 @@ pub fn expand_speculative(
     Some((node.syntax_node(), token))
 }
 
+fn expand_unimplemented_builtin_macro(span: Span) -> ExpandResult<tt::TopSubtree> {
+    ExpandResult::new(
+        tt::TopSubtree::empty(tt::DelimSpan::from_single(span)),
+        ExpandError::other(span, "this built-in macro is not implemented"),
+    )
+}
+
 #[salsa::tracked(lru = 1024, returns(ref))]
 fn ast_id_map(db: &dyn ExpandDatabase, file_id: HirFileId) -> AstIdMap {
     AstIdMap::from_source(&db.parse_or_expand(file_id))
@@ -396,7 +405,7 @@ pub(crate) fn parse_with_map(
 /// This resolves the [MacroCallId] to check if it is a derive macro if so get the [macro_arg] for the derive.
 /// Other wise return the [macro_arg] for the macro_call_id.
 ///
-/// This is not connected to the database so it does not cached the result. However, the inner [macro_arg] query is
+/// This is not connected to the database so it does not cache the result. However, the inner [macro_arg] query is
 #[allow(deprecated)] // we are macro_arg_considering_derives
 fn macro_arg_considering_derives<'db>(
     db: &'db dyn ExpandDatabase,
@@ -538,15 +547,16 @@ fn macro_expander(db: &'db dyn ExpandDatabase, id: MacroDefId) -> TokenExpander<
             MacroDefKind::BuiltInDerive(_, expander) => TokenExpander::BuiltInDerive(expander),
             MacroDefKind::BuiltInEager(_, expander) => TokenExpander::BuiltInEager(expander),
             MacroDefKind::ProcMacro(_, expander, _) => TokenExpander::ProcMacro(expander),
+            MacroDefKind::UnimplementedBuiltIn(_) => TokenExpander::UnimplementedBuiltIn,
         }
     }
 }
 
-fn macro_expand(
-    db: &dyn ExpandDatabase,
+fn macro_expand<'db>(
+    db: &'db dyn ExpandDatabase,
     macro_call_id: MacroCallId,
-    loc: MacroCallLoc,
-) -> ExpandResult<(Cow<'_, tt::TopSubtree>, MatchedArmIndex)> {
+    loc: &MacroCallLoc,
+) -> ExpandResult<(Cow<'db, tt::TopSubtree>, MatchedArmIndex)> {
     let _p = tracing::info_span!("macro_expand").entered();
 
     let (ExpandResult { value: (tt, matched_arm), err }, span) = match loc.def.kind {
@@ -572,6 +582,9 @@ fn macro_expand(
                 MacroDefKind::BuiltInDerive(_, it) => {
                     it.expand(db, macro_call_id, arg, span).map_err(Into::into).zip_val(None)
                 }
+                MacroDefKind::UnimplementedBuiltIn(_) => {
+                    expand_unimplemented_builtin_macro(span).zip_val(None)
+                }
                 MacroDefKind::BuiltInEager(_, it) => {
                     // This might look a bit odd, but we do not expand the inputs to eager macros here.
                     // Eager macros inputs are expanded, well, eagerly when we collect the macro calls.
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/eager.rs b/src/tools/rust-analyzer/crates/hir-expand/src/eager.rs
index a19f587..f8a5608 100644
--- a/src/tools/rust-analyzer/crates/hir-expand/src/eager.rs
+++ b/src/tools/rust-analyzer/crates/hir-expand/src/eager.rs
@@ -246,7 +246,8 @@ fn eager_macro_recur(
             | MacroDefKind::BuiltIn(..)
             | MacroDefKind::BuiltInAttr(..)
             | MacroDefKind::BuiltInDerive(..)
-            | MacroDefKind::ProcMacro(..) => {
+            | MacroDefKind::ProcMacro(..)
+            | MacroDefKind::UnimplementedBuiltIn(..) => {
                 let ExpandResult { value: (parse, tm), err } = lazy_expand(
                     db,
                     &def,
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs b/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs
index 0850d61..9c5714b 100644
--- a/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs
@@ -81,7 +81,7 @@ fn intern(self, db: &Self::Database) -> Self::ID {
         impl $crate::Lookup for $id {
             type Database = dyn $db;
             type Data = $loc;
-            fn lookup(&self, db: &Self::Database) -> Self::Data {
+            fn lookup<'db>(&self, db: &'db Self::Database) -> &'db Self::Data {
                 self.loc(db)
             }
         }
@@ -98,7 +98,7 @@ pub trait Intern {
 pub trait Lookup {
     type Database: ?Sized;
     type Data;
-    fn lookup(&self, db: &Self::Database) -> Self::Data;
+    fn lookup<'db>(&self, db: &'db Self::Database) -> &'db Self::Data;
 }
 
 impl_intern_lookup!(ExpandDatabase, MacroCallId, MacroCallLoc);
@@ -249,6 +249,7 @@ pub enum MacroDefKind {
     BuiltInAttr(AstId<ast::Macro>, BuiltinAttrExpander),
     BuiltInDerive(AstId<ast::Macro>, BuiltinDeriveExpander),
     BuiltInEager(AstId<ast::Macro>, EagerExpander),
+    UnimplementedBuiltIn(AstId<ast::Macro>),
     ProcMacro(AstId<ast::Fn>, CustomProcMacroExpander, ProcMacroKind),
 }
 
@@ -265,7 +266,8 @@ pub fn erased_ast_id(&self) -> ErasedAstId {
             | MacroDefKind::BuiltInAttr(id, _)
             | MacroDefKind::BuiltInDerive(id, _)
             | MacroDefKind::BuiltInEager(id, _)
-            | MacroDefKind::Declarative(id, ..) => id.erase(),
+            | MacroDefKind::Declarative(id, ..)
+            | MacroDefKind::UnimplementedBuiltIn(id) => id.erase(),
         }
     }
 }
@@ -500,6 +502,7 @@ pub fn kind(self, db: &dyn ExpandDatabase) -> MacroKind {
             MacroDefKind::ProcMacro(_, _, ProcMacroKind::Attr) => MacroKind::Attr,
             MacroDefKind::ProcMacro(_, _, ProcMacroKind::Bang) => MacroKind::ProcMacro,
             MacroDefKind::BuiltInAttr(..) => MacroKind::AttrBuiltIn,
+            MacroDefKind::UnimplementedBuiltIn(..) => MacroKind::Declarative,
         }
     }
 
@@ -551,7 +554,8 @@ pub fn definition_range(&self, db: &dyn ExpandDatabase) -> InFile<TextRange> {
             | MacroDefKind::BuiltIn(id, _)
             | MacroDefKind::BuiltInAttr(id, _)
             | MacroDefKind::BuiltInDerive(id, _)
-            | MacroDefKind::BuiltInEager(id, _) => {
+            | MacroDefKind::BuiltInEager(id, _)
+            | MacroDefKind::UnimplementedBuiltIn(id) => {
                 id.with_value(db.ast_id_map(id.file_id).get(id.value).text_range())
             }
             MacroDefKind::ProcMacro(id, _, _) => {
@@ -567,7 +571,8 @@ pub fn ast_id(&self) -> Either<AstId<ast::Macro>, AstId<ast::Fn>> {
             | MacroDefKind::BuiltIn(id, _)
             | MacroDefKind::BuiltInAttr(id, _)
             | MacroDefKind::BuiltInDerive(id, _)
-            | MacroDefKind::BuiltInEager(id, _) => Either::Left(id),
+            | MacroDefKind::BuiltInEager(id, _)
+            | MacroDefKind::UnimplementedBuiltIn(id) => Either::Left(id),
         }
     }
 
@@ -577,9 +582,9 @@ pub fn is_proc_macro(&self) -> bool {
 
     pub fn is_attribute(&self) -> bool {
         match self.kind {
-            MacroDefKind::BuiltInAttr(..) | MacroDefKind::ProcMacro(_, _, ProcMacroKind::Attr) => {
-                true
-            }
+            MacroDefKind::BuiltInAttr(..)
+            | MacroDefKind::ProcMacro(_, _, ProcMacroKind::Attr)
+            | MacroDefKind::UnimplementedBuiltIn(_) => true,
             MacroDefKind::Declarative(_, styles) => styles.contains(MacroCallStyles::ATTR),
             _ => false,
         }
@@ -588,7 +593,8 @@ pub fn is_attribute(&self) -> bool {
     pub fn is_derive(&self) -> bool {
         match self.kind {
             MacroDefKind::BuiltInDerive(..)
-            | MacroDefKind::ProcMacro(_, _, ProcMacroKind::CustomDerive) => true,
+            | MacroDefKind::ProcMacro(_, _, ProcMacroKind::CustomDerive)
+            | MacroDefKind::UnimplementedBuiltIn(_) => true,
             MacroDefKind::Declarative(_, styles) => styles.contains(MacroCallStyles::DERIVE),
             _ => false,
         }
@@ -601,6 +607,7 @@ pub fn is_fn_like(&self) -> bool {
                 | MacroDefKind::ProcMacro(_, _, ProcMacroKind::Bang)
                 | MacroDefKind::BuiltInEager(..)
                 | MacroDefKind::Declarative(..)
+                | MacroDefKind::UnimplementedBuiltIn(_)
         )
     }
 
@@ -714,24 +721,27 @@ pub fn erased_ast_id(&self) -> ErasedFileAstId {
     /// - fn_like! {}, it spans the path and token tree
     /// - #\[derive], it spans the `#[derive(...)]` attribute and the annotated item
     /// - #\[attr], it spans the `#[attr(...)]` attribute and the annotated item
-    pub fn original_call_range_with_input(self, db: &dyn ExpandDatabase) -> FileRange {
-        let mut kind = self;
+    pub fn original_call_range_with_input(&self, db: &dyn ExpandDatabase) -> FileRange {
+        let get_range = |kind: &_| match kind {
+            MacroCallKind::FnLike { ast_id, .. } => ast_id.erase(),
+            MacroCallKind::Derive { ast_id, .. } => ast_id.erase(),
+            MacroCallKind::Attr { ast_id, .. } => ast_id.erase(),
+        };
+
+        let mut ast_id = get_range(self);
+        let mut file_id = self.file_id();
         let file_id = loop {
-            match kind.file_id() {
+            match file_id {
                 HirFileId::MacroFile(file) => {
-                    kind = file.loc(db).kind;
+                    let kind = &file.loc(db).kind;
+                    ast_id = get_range(kind);
+                    file_id = kind.file_id();
                 }
                 HirFileId::FileId(file_id) => break file_id,
             }
         };
 
-        let range = match kind {
-            MacroCallKind::FnLike { ast_id, .. } => ast_id.to_ptr(db).text_range(),
-            MacroCallKind::Derive { ast_id, .. } => ast_id.to_ptr(db).text_range(),
-            MacroCallKind::Attr { ast_id, .. } => ast_id.to_ptr(db).text_range(),
-        };
-
-        FileRange { range, file_id }
+        FileRange { range: ast_id.to_ptr(db).text_range(), file_id }
     }
 
     /// Returns the original file range that best describes the location of this macro call.
@@ -739,18 +749,8 @@ pub fn original_call_range_with_input(self, db: &dyn ExpandDatabase) -> FileRang
     /// Here we try to roughly match what rustc does to improve diagnostics: fn-like macros
     /// get the macro path (rustc shows the whole `ast::MacroCall`), attribute macros get the
     /// attribute's range, and derives get only the specific derive that is being referred to.
-    pub fn original_call_range(self, db: &dyn ExpandDatabase, krate: Crate) -> FileRange {
-        let mut kind = self;
-        let file_id = loop {
-            match kind.file_id() {
-                HirFileId::MacroFile(file) => {
-                    kind = file.loc(db).kind;
-                }
-                HirFileId::FileId(file_id) => break file_id,
-            }
-        };
-
-        let range = match kind {
+    pub fn original_call_range(&self, db: &dyn ExpandDatabase, krate: Crate) -> FileRange {
+        let get_range = |kind: &_| match kind {
             MacroCallKind::FnLike { ast_id, .. } => {
                 let node = ast_id.to_node(db);
                 node.path()
@@ -761,11 +761,24 @@ pub fn original_call_range(self, db: &dyn ExpandDatabase, krate: Crate) -> FileR
             }
             MacroCallKind::Derive { ast_id, derive_attr_index, .. } => {
                 // FIXME: should be the range of the macro name, not the whole derive
-                derive_attr_index.find_attr_range(db, krate, ast_id).1.syntax().text_range()
+                derive_attr_index.find_attr_range(db, krate, *ast_id).1.syntax().text_range()
             }
             // FIXME: handle `cfg_attr`
             MacroCallKind::Attr { ast_id, censored_attr_ids: attr_ids, .. } => {
-                attr_ids.invoc_attr().find_attr_range(db, krate, ast_id).1.syntax().text_range()
+                attr_ids.invoc_attr().find_attr_range(db, krate, *ast_id).1.syntax().text_range()
+            }
+        };
+
+        let mut range = get_range(self);
+        let mut file_id = self.file_id();
+        let file_id = loop {
+            match file_id {
+                HirFileId::MacroFile(file) => {
+                    let kind = &file.loc(db).kind;
+                    range = get_range(kind);
+                    file_id = kind.file_id();
+                }
+                HirFileId::FileId(file_id) => break file_id,
             }
         };
 
@@ -797,7 +810,7 @@ pub struct ExpansionInfo<'db> {
     arg: InFile<Option<SyntaxNode>>,
     exp_map: &'db ExpansionSpanMap,
     arg_map: SpanMap<'db>,
-    loc: MacroCallLoc,
+    loc: &'db MacroCallLoc,
 }
 
 impl<'db> ExpansionInfo<'db> {
@@ -1056,6 +1069,7 @@ pub fn from_call_site(call: &ast::MacroCall) -> ExpandTo {
 #[salsa_macros::interned(no_lifetime, debug, revisions = usize::MAX)]
 #[doc(alias = "MacroFileId")]
 pub struct MacroCallId {
+    #[returns(ref)]
     pub loc: MacroCallLoc,
 }
 
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/name.rs b/src/tools/rust-analyzer/crates/hir-expand/src/name.rs
index 3ddc305..b511bc3 100644
--- a/src/tools/rust-analyzer/crates/hir-expand/src/name.rs
+++ b/src/tools/rust-analyzer/crates/hir-expand/src/name.rs
@@ -201,10 +201,15 @@ pub fn symbol(&self) -> &Symbol {
 
     #[inline]
     pub fn is_generated(&self) -> bool {
-        self.as_str().starts_with("<ra@gennew>")
+        is_generated(self.as_str())
     }
 }
 
+#[inline]
+pub fn is_generated(name: &str) -> bool {
+    name.starts_with("<ra@gennew>")
+}
+
 struct Display<'a> {
     name: &'a Name,
     edition: Edition,
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/prettify_macro_expansion_.rs b/src/tools/rust-analyzer/crates/hir-expand/src/prettify_macro_expansion_.rs
index 79e6f0f..687bd1a 100644
--- a/src/tools/rust-analyzer/crates/hir-expand/src/prettify_macro_expansion_.rs
+++ b/src/tools/rust-analyzer/crates/hir-expand/src/prettify_macro_expansion_.rs
@@ -2,8 +2,7 @@
 
 use base_db::Crate;
 use rustc_hash::FxHashMap;
-use syntax::NodeOrToken;
-use syntax::{SyntaxNode, ast::make};
+use syntax::SyntaxNode;
 
 use crate::{db::ExpandDatabase, span_map::ExpansionSpanMap};
 
@@ -22,7 +21,7 @@ pub fn prettify_macro_expansion(
     let mut syntax_ctx_id_to_dollar_crate_replacement = FxHashMap::default();
     syntax_bridge::prettify_macro_expansion::prettify_macro_expansion(
         syn,
-        &mut |dollar_crate| {
+        &mut |dollar_crate, make| {
             let ctx = span_map.span_at(dollar_crate.text_range().start() + span_offset).ctx;
             let replacement =
                 syntax_ctx_id_to_dollar_crate_replacement.entry(ctx).or_insert_with(|| {
@@ -38,13 +37,13 @@ pub fn prettify_macro_expansion(
                     // is inserted, and also understandable to the user.
                     // Lastly, if nothing else found, resort to leaving `$crate`.
                     if target_crate_id == macro_def_crate {
-                        make::tokens::crate_kw()
+                        make.token(syntax::SyntaxKind::CRATE_KW)
                     } else if let Some(dep) =
                         target_crate.dependencies.iter().find(|dep| dep.crate_id == macro_def_crate)
                     {
-                        make::tokens::ident(dep.name.as_str())
+                        make.ident(dep.name.as_str())
                     } else if let Some(crate_name) = &macro_def_crate.extra_data(db).display_name {
-                        make::tokens::ident(crate_name.crate_name().as_str())
+                        make.ident(crate_name.crate_name().as_str())
                     } else {
                         dollar_crate.clone()
                     }
@@ -53,12 +52,7 @@ pub fn prettify_macro_expansion(
                 // The parent may have many children, and looking for the token may yield incorrect results.
                 return None;
             }
-            // We need to `clone_subtree()` but rowan doesn't provide such operation for tokens.
-            let parent = replacement.parent().unwrap().clone_subtree().clone_for_update();
-            parent
-                .children_with_tokens()
-                .filter_map(NodeOrToken::into_token)
-                .find(|it| it.kind() == replacement.kind())
+            Some(replacement.clone())
         },
         |_| (),
     )
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/builtin_derive.rs b/src/tools/rust-analyzer/crates/hir-ty/src/builtin_derive.rs
index fe60fbc..65a9105 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/builtin_derive.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/builtin_derive.rs
@@ -17,12 +17,11 @@
 };
 
 use crate::{
-    GenericPredicates,
+    FieldType, GenericPredicates,
     db::HirDatabase,
     next_solver::{
         AliasTy, Clause, Clauses, DbInterner, EarlyBinder, GenericArgs, ParamEnv,
-        StoredEarlyBinder, StoredTy, TraitRef, Ty, TyKind, Unnormalized, fold::fold_tys,
-        generics::Generics,
+        StoredEarlyBinder, TraitRef, Ty, TyKind, Unnormalized, fold::fold_tys, generics::Generics,
     },
 };
 
@@ -193,7 +192,7 @@ pub fn predicates(db: &dyn HirDatabase, impl_: BuiltinDeriveImplId) -> GenericPr
             else {
                 // Malformed derive.
                 return GenericPredicates::from_explicit_own_predicates(StoredEarlyBinder::bind(
-                    Clauses::default().store(),
+                    Clauses::empty(interner).store(),
                 ));
             };
             let duplicated_bounds =
@@ -305,7 +304,7 @@ fn simple_trait_predicates<'db>(
             loc.trait_,
         ),
         AdtId::EnumId(id) => {
-            for &(variant_id, _, _) in &id.enum_variants(interner.db).variants {
+            for &(variant_id, _) in id.enum_variants(interner.db).variants.values() {
                 extend_assoc_type_bounds(
                     interner,
                     &mut assoc_type_bounds,
@@ -333,7 +332,7 @@ fn simple_trait_predicates<'db>(
 fn extend_assoc_type_bounds<'db>(
     interner: DbInterner<'db>,
     assoc_type_bounds: &mut Vec<Clause<'db>>,
-    fields: &ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>,
+    fields: &ArenaMap<LocalFieldId, FieldType>,
     trait_id: TraitId,
     trait_: BuiltinDeriveImplTrait,
 ) {
@@ -365,7 +364,7 @@ fn visit_ty(&mut self, t: Ty<'db>) -> Self::Result {
 
     let mut visitor = ProjectionFinder { interner, assoc_type_bounds, trait_id, trait_ };
     for (_, field) in fields.iter() {
-        field.get().instantiate_identity().skip_norm_wip().visit_with(&mut visitor);
+        field.ty().instantiate_identity().skip_norm_wip().visit_with(&mut visitor);
     }
 }
 
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 e1d6cec..d6580d3 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs
@@ -5,7 +5,7 @@
 
 use base_db::Crate;
 use hir_def::{
-    ConstId, EnumVariantId, ExpressionStoreOwnerId, GenericDefId, HasModule, StaticId,
+    ConstId, EnumVariantId, ExpressionStoreOwnerId, HasModule, StaticId,
     attrs::AttrFlags,
     expr_store::{Body, ExpressionStore, HygieneId, path::Path},
     hir::{Expr, ExprId, Literal},
@@ -23,6 +23,7 @@
     db::{AnonConstId, AnonConstLoc, GeneralConstId, HirDatabase},
     display::DisplayTarget,
     generics::Generics,
+    lower::LoweringMode,
     mir::{MirEvalError, MirLowerError, pad16},
     next_solver::{
         Allocation, Const, ConstKind, Consts, DbInterner, DefaultAny, GenericArgs, ParamConst,
@@ -303,7 +304,9 @@ pub(crate) enum CreateConstError<'db> {
     UsedForbiddenParam,
     ResolveToNonConst,
     DoesNotResolve,
+    ConstHasGenerics,
     UnderscoreExpr,
+    AnonConstInterningDisabled,
     TypeMismatch {
         #[expect(unused, reason = "will need this for diagnostics")]
         actual: Ty<'db>,
@@ -321,9 +324,11 @@ pub(crate) fn path_to_const<'a, 'db>(
     let resolution = resolver
         .resolve_path_in_value_ns_fully(db, path, HygieneId::ROOT)
         .ok_or(CreateConstError::DoesNotResolve)?;
+    let no_generics = |def| crate::generics::generics(db, def).has_no_params();
     let konst = match resolution {
-        ValueNs::ConstId(id) => GeneralConstId::ConstId(id),
+        ValueNs::ConstId(id) if no_generics(id.into()) => GeneralConstId::ConstId(id),
         ValueNs::StaticId(id) => GeneralConstId::StaticId(id),
+        ValueNs::ConstId(_) => return Err(CreateConstError::ConstHasGenerics),
         ValueNs::GenericParam(param) => {
             let index = generics().type_or_const_param_idx(param.into());
             if forbid_params_after.is_some_and(|forbid_after| index >= forbid_after) {
@@ -352,6 +357,7 @@ pub(crate) fn create_anon_const<'a, 'db>(
     expected_ty: Ty<'db>,
     generics: &dyn Fn() -> &'a Generics<'db>,
     create_var: Option<&mut dyn FnMut(Span) -> Const<'db>>,
+    lowering_mode: LoweringMode,
     forbid_params_after: Option<u32>,
 ) -> Result<Const<'db>, CreateConstError<'db>> {
     match &store[expr] {
@@ -363,11 +369,18 @@ pub(crate) fn create_anon_const<'a, 'db>(
         Expr::Path(path)
             if let konst =
                 path_to_const(interner.db, resolver, generics, forbid_params_after, path)
-                && !matches!(konst, Err(CreateConstError::DoesNotResolve)) =>
+                && !matches!(
+                    konst,
+                    Err(CreateConstError::DoesNotResolve | CreateConstError::ConstHasGenerics)
+                ) =>
         {
             konst
         }
         _ => {
+            let Some(token) = lowering_mode.allow_tracked_structs() else {
+                return Err(CreateConstError::AnonConstInterningDisabled);
+            };
+
             let allow_using_generic_params = forbid_params_after.is_none();
             let konst = AnonConstId::new(
                 interner.db,
@@ -377,6 +390,7 @@ pub(crate) fn create_anon_const<'a, 'db>(
                     ty: StoredEarlyBinder::bind(expected_ty.store()),
                     allow_using_generic_params,
                 },
+                token,
             );
             let args = if allow_using_generic_params {
                 GenericArgs::identity_for_item(interner, owner.generic_def(interner.db).into())
@@ -400,12 +414,10 @@ pub(crate) fn const_eval_discriminant_variant(
     let body = Body::of(db, def);
     let loc = variant_id.lookup(db);
     if matches!(body[body.root_expr()], Expr::Missing) {
-        let prev_idx = loc.index.checked_sub(1);
+        let prev_idx = loc.index(db).checked_sub(1);
         let value = match prev_idx {
             Some(prev_idx) => {
-                1 + db.const_eval_discriminant(
-                    loc.parent.enum_variants(db).variants[prev_idx as usize].0,
-                )?
+                1 + db.const_eval_discriminant(loc.parent.enum_variants(db).variants[prev_idx].0)?
             }
             _ => 0,
         };
@@ -418,8 +430,11 @@ pub(crate) fn const_eval_discriminant_variant(
     let mir_body = db.monomorphized_mir_body(
         def.into(),
         GenericArgs::empty(interner).store(),
-        ParamEnvAndCrate { param_env: db.trait_environment(def.into()), krate: def.krate(db) }
-            .store(),
+        ParamEnvAndCrate {
+            param_env: db.trait_environment(def.generic_def(db)),
+            krate: def.krate(db),
+        }
+        .store(),
     )?;
     let c = interpret_mir(db, mir_body, false, None)?.0?;
     let c = if is_signed { allocation_as_isize(c) } else { allocation_as_usize(c) as i128 };
@@ -455,12 +470,8 @@ pub(crate) fn const_eval_query(
         let body = db.monomorphized_mir_body(
             def.into(),
             subst,
-            ParamEnvAndCrate {
-                param_env: db
-                    .trait_environment(ExpressionStoreOwnerId::from(GenericDefId::from(def))),
-                krate: def.krate(db),
-            }
-            .store(),
+            ParamEnvAndCrate { param_env: db.trait_environment(def.into()), krate: def.krate(db) }
+                .store(),
         )?;
         let c = interpret_mir(db, body, false, trait_env.as_ref().map(|env| env.as_ref()))?.0?;
         Ok(c.store())
@@ -499,7 +510,7 @@ pub(crate) fn anon_const_eval_query(
             def.into(),
             subst,
             ParamEnvAndCrate {
-                param_env: db.trait_environment(def.loc(db).owner),
+                param_env: db.trait_environment(def.loc(db).owner.generic_def(db)),
                 krate: def.krate(db),
             }
             .store(),
@@ -537,12 +548,8 @@ pub(crate) fn const_eval_static_query(
         let body = db.monomorphized_mir_body(
             def.into(),
             GenericArgs::empty(interner).store(),
-            ParamEnvAndCrate {
-                param_env: db
-                    .trait_environment(ExpressionStoreOwnerId::from(GenericDefId::from(def))),
-                krate: def.krate(db),
-            }
-            .store(),
+            ParamEnvAndCrate { param_env: db.trait_environment(def.into()), krate: def.krate(db) }
+                .store(),
         )?;
         let c = interpret_mir(db, body, false, None)?.0?;
         Ok(c.store())
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs b/src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs
index f158661..5421b97 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs
@@ -287,6 +287,9 @@ fn floating_point_casts() {
     check_number(r#"const GOAL: i8 = (0./0.) as i8"#, 0);
     check_number(r#"const GOAL: i8 = (1./0.) as i8"#, 127);
     check_number(r#"const GOAL: i8 = (-1./0.) as i8"#, -128);
+    check_number(r#"const GOAL: u8 = (1./0.) as u8"#, 255);
+    check_number(r#"const GOAL: u8 = 256.0f32 as u8"#, 255);
+    check_number(r#"const GOAL: u16 = 1e10f32 as u16"#, 65535);
     check_number(r#"const GOAL: i64 = 1e18f64 as f32 as i64"#, 999999984306749440);
 }
 
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/db.rs b/src/tools/rust-analyzer/crates/hir-ty/src/db.rs
index c24a5b9..baf8bbd 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/db.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/db.rs
@@ -22,12 +22,12 @@
 use triomphe::Arc;
 
 use crate::{
-    GenericDefaultsRef, GenericPredicates, ImplTraitId, InferBodyId, TyDefId, TyLoweringResult,
-    ValueTyDefId,
+    FieldType, GenericDefaultsRef, GenericPredicates, ImplTraitId, InferBodyId, TyDefId,
+    TyLoweringResult, ValueTyDefId,
     consteval::ConstEvalError,
     dyn_compatibility::DynCompatibilityViolation,
     layout::{Layout, LayoutError},
-    lower::{GenericDefaults, TypeAliasBounds},
+    lower::{GenericDefaults, TrackedStructToken, TypeAliasBounds},
     mir::{BorrowckResult, MirBody, MirLowerError},
     next_solver::{
         Allocation, Clause, EarlyBinder, GenericArgs, ParamEnv, PolyFnSig, StoredClauses,
@@ -225,11 +225,11 @@ fn impl_trait_with_diagnostics(
     fn field_types_with_diagnostics(
         &self,
         var: VariantId,
-    ) -> &TyLoweringResult<ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>>;
+    ) -> &TyLoweringResult<ArenaMap<LocalFieldId, FieldType>>;
 
     #[salsa::invoke(crate::lower::field_types_query)]
     #[salsa::transparent]
-    fn field_types(&self, var: VariantId) -> &ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>;
+    fn field_types(&self, var: VariantId) -> &ArenaMap<LocalFieldId, FieldType>;
 
     #[salsa::invoke(crate::lower::callable_item_signature)]
     #[salsa::transparent]
@@ -247,7 +247,7 @@ fn callable_item_signature_with_diagnostics(
 
     #[salsa::invoke(crate::lower::trait_environment)]
     #[salsa::transparent]
-    fn trait_environment<'db>(&'db self, def: ExpressionStoreOwnerId) -> ParamEnv<'db>;
+    fn trait_environment<'db>(&'db self, def: GenericDefId) -> ParamEnv<'db>;
 
     #[salsa::invoke(crate::lower::generic_defaults_with_diagnostics)]
     #[salsa::transparent]
@@ -421,13 +421,20 @@ pub struct AnonConstLoc {
     pub(crate) allow_using_generic_params: bool,
 }
 
-#[salsa_macros::interned(debug, no_lifetime, revisions = usize::MAX)]
+#[salsa_macros::interned(debug, no_lifetime, revisions = usize::MAX, constructor = new_)]
 #[derive(PartialOrd, Ord)]
 pub struct AnonConstId {
     #[returns(ref)]
     pub loc: AnonConstLoc,
 }
 
+impl AnonConstId {
+    pub(crate) fn new(db: &dyn DefDatabase, loc: AnonConstLoc, token: TrackedStructToken) -> Self {
+        _ = token;
+        AnonConstId::new_(db, loc)
+    }
+}
+
 impl HasModule for AnonConstId {
     fn module(&self, db: &dyn DefDatabase) -> ModuleId {
         self.loc(db).owner.module(db)
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/decl_check.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/decl_check.rs
index 76fbb66..ace3616 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/decl_check.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/decl_check.rs
@@ -504,15 +504,15 @@ fn validate_enum(&mut self, enum_id: EnumId) {
     fn validate_enum_variants(&mut self, enum_id: EnumId) {
         let data = enum_id.enum_variants(self.db);
 
-        for (variant_id, _, _) in data.variants.iter() {
+        for (variant_id, _) in data.variants.values() {
             self.validate_enum_variant_fields(*variant_id);
         }
 
         let edition = self.edition(enum_id);
         let mut enum_variants_replacements = data
             .variants
-            .iter()
-            .filter_map(|(_, name, _)| {
+            .keys()
+            .filter_map(|name| {
                 to_camel_case(&name.display_no_db(edition).to_smolstr()).map(|new_name| {
                     Replacement {
                         current_name: name.clone(),
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs
index 760ebd2..be4de11 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs
@@ -83,7 +83,7 @@ pub fn collect(
         let _p = tracing::info_span!("BodyValidationDiagnostic::collect").entered();
         let infer = InferenceResult::of(db, owner);
         let body = Body::of(db, owner);
-        let env = db.trait_environment(owner.into());
+        let env = db.trait_environment(owner.generic_def(db));
         let interner = DbInterner::new_with(db, owner.krate(db));
         let infcx =
             interner.infer_ctxt().build(TypingMode::typeck_for_body(interner, owner.into()));
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs
index 8356329..14bff65 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs
@@ -330,13 +330,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result<(), HirDisplayError>
                     match variant {
                         VariantId::EnumVariantId(v) => {
                             let loc = v.lookup(f.db);
-                            write!(
-                                f,
-                                "{}",
-                                loc.parent.enum_variants(f.db).variants[loc.index as usize]
-                                    .1
-                                    .display(f.db, f.edition())
-                            )?;
+                            write!(f, "{}", loc.name.display(f.db, f.edition()))?;
                         }
                         VariantId::StructId(s) => write!(
                             f,
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
index 46959aa..5994ca2 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs
@@ -49,8 +49,7 @@ pub(crate) enum Void {}
 impl EnumVariantContiguousIndex {
     fn from_enum_variant_id(db: &dyn HirDatabase, target_evid: EnumVariantId) -> Self {
         // Find the index of this variant in the list of variants.
-        use hir_def::Lookup;
-        let i = target_evid.lookup(db).index as usize;
+        let i = target_evid.index(db);
         EnumVariantContiguousIndex(i)
     }
 
@@ -149,7 +148,7 @@ fn list_variant_fields(
         let fields_len = variant.fields(self.db).fields().len() as u32;
 
         (0..fields_len).map(|idx| LocalFieldId::from_raw(idx.into())).map(move |fid| {
-            let ty = field_tys[fid].get().instantiate(self.infcx.interner, substs).skip_norm_wip();
+            let ty = field_tys[fid].ty().instantiate(self.infcx.interner, substs).skip_norm_wip();
             let ty = self
                 .infcx
                 .at(&ObligationCause::dummy(), self.env)
@@ -438,7 +437,7 @@ fn ctors_for_ty(
                             ConstructorSet::NoConstructors
                         } else {
                             let mut variants = IndexVec::with_capacity(enum_data.variants.len());
-                            for &(variant, _, _) in enum_data.variants.iter() {
+                            for &(variant, _) in enum_data.variants.values() {
                                 let is_uninhabited = is_enum_variant_uninhabited_from(
                                     cx.infcx, variant, subst, cx.module, self.env,
                                 );
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs
index c37a194..3c69c6a 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs
@@ -255,9 +255,8 @@ fn walk_pat(&mut self, current: PatId) {
                 | Pat::Box { .. }
                 | Pat::Deref { .. }
                 | Pat::Expr(..)
-                | Pat::ConstBlock(..) => {
-                    self.on_unsafe_op(current.into(), UnsafetyReason::UnionField)
-                }
+                | Pat::ConstBlock(..)
+                | Pat::NotNull => self.on_unsafe_op(current.into(), UnsafetyReason::UnionField),
                 // `Or` only wraps other patterns, and `Missing`/`Wild` do not constitute a read.
                 Pat::Missing | Pat::Rest | Pat::Wild | Pat::Or(_) => {}
             }
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 bc726b6..ab290aa 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
@@ -15,7 +15,7 @@
     expr_store::{ExpressionStore, path::Path},
     find_path::{self, PrefixKind},
     hir::{
-        ClosureKind as HirClosureKind, CoroutineKind,
+        ClosureKind as HirClosureKind, CoroutineKind, PatId,
         generics::{GenericParams, TypeOrConstParamData, TypeParamProvenance, WherePredicate},
     },
     item_scope::ItemInNs,
@@ -51,7 +51,7 @@
 use stdx::never;
 
 use crate::{
-    CallableDefId, ImplTraitId, MemoryMap, ParamEnvAndCrate, consteval,
+    CallableDefId, FieldType, ImplTraitId, MemoryMap, ParamEnvAndCrate, consteval,
     db::{GeneralConstId, HirDatabase},
     generics::{ProvenanceSplit, generics},
     layout::Layout,
@@ -60,8 +60,8 @@
     next_solver::{
         AliasTy, Allocation, Clause, ClauseKind, Const, ConstKind, DbInterner,
         ExistentialPredicate, FnSig, GenericArg, GenericArgKind, GenericArgs, ParamEnv, PolyFnSig,
-        Region, StoredEarlyBinder, StoredTy, Term, TermId, TermKind, TraitPredicate, TraitRef, Ty,
-        TyKind, TypingMode, Unnormalized, ValTree,
+        Region, Term, TermId, TermKind, TraitPredicate, TraitRef, Ty, TyKind, TypingMode,
+        Unnormalized, ValTree,
         abi::Safety,
         infer::{DbInternerInferExt, traits::ObligationCause},
     },
@@ -780,7 +780,7 @@ fn render_const_scalar<'db>(
     memory_map: &MemoryMap<'db>,
     ty: Ty<'db>,
 ) -> Result {
-    let param_env = ParamEnv::empty();
+    let param_env = ParamEnv::empty(f.interner);
     let infcx = f.interner.infer_ctxt().build(TypingMode::PostAnalysis);
     let ty = infcx.at(&ObligationCause::dummy(), param_env).deeply_normalize(ty).unwrap_or(ty);
     render_const_scalar_inner(f, b, memory_map, ty, param_env)
@@ -968,9 +968,7 @@ fn render_const_scalar_inner<'db>(
                         s.fields(f.db),
                         f,
                         field_types,
-                        f.db.trait_environment(ExpressionStoreOwnerId::from(GenericDefId::from(
-                            def,
-                        ))),
+                        f.db.trait_environment(def.into()),
                         &layout,
                         args,
                         b,
@@ -990,21 +988,13 @@ fn render_const_scalar_inner<'db>(
                         return f.write_str("<failed-to-detect-variant>");
                     };
                     let loc = var_id.lookup(f.db);
-                    write!(
-                        f,
-                        "{}",
-                        loc.parent.enum_variants(f.db).variants[loc.index as usize]
-                            .1
-                            .display(f.db, f.edition())
-                    )?;
+                    write!(f, "{}", loc.name.display(f.db, f.edition()))?;
                     let field_types = f.db.field_types(var_id.into());
                     render_variant_after_name(
                         var_id.fields(f.db),
                         f,
                         field_types,
-                        f.db.trait_environment(ExpressionStoreOwnerId::from(GenericDefId::from(
-                            def,
-                        ))),
+                        f.db.trait_environment(def.into()),
                         var_layout,
                         args,
                         b,
@@ -1065,7 +1055,7 @@ fn render_const_scalar_from_valtree<'db>(
     ty: Ty<'db>,
     valtree: ValTree<'db>,
 ) -> Result {
-    let param_env = ParamEnv::empty();
+    let param_env = ParamEnv::empty(f.interner);
     let infcx = f.interner.infer_ctxt().build(TypingMode::PostAnalysis);
     let ty = infcx.at(&ObligationCause::dummy(), param_env).deeply_normalize(ty).unwrap_or(ty);
     render_const_scalar_from_valtree_inner(f, ty, valtree, param_env)
@@ -1208,7 +1198,7 @@ fn render_const_scalar_from_valtree_inner<'db>(
 fn render_variant_after_name<'db>(
     data: &VariantFields,
     f: &mut HirFormatter<'_, 'db>,
-    field_types: &'db ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>,
+    field_types: &'db ArenaMap<LocalFieldId, FieldType>,
     param_env: ParamEnv<'db>,
     layout: &Layout,
     args: GenericArgs<'db>,
@@ -1220,7 +1210,7 @@ fn render_variant_after_name<'db>(
         FieldsShape::Record | FieldsShape::Tuple => {
             let render_field = |f: &mut HirFormatter<'_, 'db>, id: LocalFieldId| {
                 let offset = layout.fields.offset(u32::from(id.into_raw()) as usize).bytes_usize();
-                let ty = field_types[id].get().instantiate(f.interner, args).skip_norm_wip();
+                let ty = field_types[id].ty().instantiate(f.interner, args).skip_norm_wip();
                 let Ok(layout) = f.db.layout_of_ty(ty.store(), param_env.store()) else {
                     return f.write_str("<layout-error>");
                 };
@@ -1362,13 +1352,7 @@ fn hir_fmt(&self, f @ &mut HirFormatter { db, .. }: &mut HirFormatter<'_, 'db>)
                     }
                     CallableDefId::EnumVariantId(e) => {
                         let loc = e.lookup(db);
-                        write!(
-                            f,
-                            "{}",
-                            loc.parent.enum_variants(db).variants[loc.index as usize]
-                                .1
-                                .display(db, f.edition())
-                        )?
+                        write!(f, "{}", loc.name.display(db, f.edition()))?
                     }
                 };
                 f.end_location_link();
@@ -2362,39 +2346,58 @@ pub fn write_visibility<'db>(
 }
 
 pub trait HirDisplayWithExpressionStore<'db> {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Result;
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        owner: ExpressionStoreOwnerId,
+        store: &ExpressionStore,
+    ) -> Result;
 }
 
 impl<'db, T: ?Sized + HirDisplayWithExpressionStore<'db>> HirDisplayWithExpressionStore<'db>
     for &'_ T
 {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Result {
-        T::hir_fmt(&**self, f, store)
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        owner: ExpressionStoreOwnerId,
+        store: &ExpressionStore,
+    ) -> Result {
+        T::hir_fmt(&**self, f, owner, store)
     }
 }
 
 pub fn hir_display_with_store<'a, 'db, T: HirDisplayWithExpressionStore<'db> + 'a>(
     value: T,
+    owner: ExpressionStoreOwnerId,
     store: &'a ExpressionStore,
 ) -> impl HirDisplay<'db> + 'a {
-    ExpressionStoreAdapter(value, store)
+    ExpressionStoreAdapter(value, owner, store)
 }
 
-struct ExpressionStoreAdapter<'a, T>(T, &'a ExpressionStore);
+struct ExpressionStoreAdapter<'a, T>(T, ExpressionStoreOwnerId, &'a ExpressionStore);
 
 impl<'a, T> ExpressionStoreAdapter<'a, T> {
-    fn wrap(store: &'a ExpressionStore) -> impl Fn(T) -> ExpressionStoreAdapter<'a, T> {
-        move |value| ExpressionStoreAdapter(value, store)
+    fn wrap(
+        owner: ExpressionStoreOwnerId,
+        store: &'a ExpressionStore,
+    ) -> impl Fn(T) -> ExpressionStoreAdapter<'a, T> {
+        move |value| ExpressionStoreAdapter(value, owner, store)
     }
 }
 
 impl<'db, T: HirDisplayWithExpressionStore<'db>> HirDisplay<'db> for ExpressionStoreAdapter<'_, T> {
     fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
-        T::hir_fmt(&self.0, f, self.1)
+        T::hir_fmt(&self.0, f, self.1, self.2)
     }
 }
 impl<'db> HirDisplayWithExpressionStore<'db> for LifetimeRefId {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Result {
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        _owner: ExpressionStoreOwnerId,
+        store: &ExpressionStore,
+    ) -> Result {
         match &store[*self] {
             LifetimeRef::Named(name) => write!(f, "{}", name.display(f.db, f.edition())),
             LifetimeRef::Static => write!(f, "'static"),
@@ -2413,7 +2416,12 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
 }
 
 impl<'db> HirDisplayWithExpressionStore<'db> for TypeRefId {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Result {
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        owner: ExpressionStoreOwnerId,
+        store: &ExpressionStore,
+    ) -> Result {
         match &store[*self] {
             TypeRef::Never => write!(f, "!")?,
             TypeRef::TypeParam(param) => {
@@ -2438,7 +2446,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                                     }
                                     _ => None,
                                 })
-                                .map(ExpressionStoreAdapter::wrap(store)),
+                                .map(ExpressionStoreAdapter::wrap(owner, store)),
                             " + ",
                         )?;
                     }
@@ -2447,20 +2455,20 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
             TypeRef::Placeholder => write!(f, "_")?,
             TypeRef::Tuple(elems) => {
                 write!(f, "(")?;
-                f.write_joined(elems.iter().map(ExpressionStoreAdapter::wrap(store)), ", ")?;
+                f.write_joined(elems.iter().map(ExpressionStoreAdapter::wrap(owner, store)), ", ")?;
                 if elems.len() == 1 {
                     write!(f, ",")?;
                 }
                 write!(f, ")")?;
             }
-            TypeRef::Path(path) => path.hir_fmt(f, store)?,
+            TypeRef::Path(path) => path.hir_fmt(f, owner, store)?,
             TypeRef::RawPtr(inner, mutability) => {
                 let mutability = match mutability {
                     hir_def::type_ref::Mutability::Shared => "*const ",
                     hir_def::type_ref::Mutability::Mut => "*mut ",
                 };
                 write!(f, "{mutability}")?;
-                inner.hir_fmt(f, store)?;
+                inner.hir_fmt(f, owner, store)?;
             }
             TypeRef::Reference(ref_) => {
                 let mutability = match ref_.mutability {
@@ -2469,22 +2477,22 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                 };
                 write!(f, "&")?;
                 if let Some(lifetime) = &ref_.lifetime {
-                    lifetime.hir_fmt(f, store)?;
+                    lifetime.hir_fmt(f, owner, store)?;
                     write!(f, " ")?;
                 }
                 write!(f, "{mutability}")?;
-                ref_.ty.hir_fmt(f, store)?;
+                ref_.ty.hir_fmt(f, owner, store)?;
             }
             TypeRef::Array(array) => {
                 write!(f, "[")?;
-                array.ty.hir_fmt(f, store)?;
+                array.ty.hir_fmt(f, owner, store)?;
                 write!(f, "; ")?;
-                array.len.hir_fmt(f, store)?;
+                array.len.hir_fmt(f, owner, store)?;
                 write!(f, "]")?;
             }
             TypeRef::Slice(inner) => {
                 write!(f, "[")?;
-                inner.hir_fmt(f, store)?;
+                inner.hir_fmt(f, owner, store)?;
                 write!(f, "]")?;
             }
             TypeRef::Fn(fn_) => {
@@ -2504,7 +2512,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                             write!(f, "{}: ", name.display(f.db, f.edition()))?;
                         }
 
-                        param_type.hir_fmt(f, store)?;
+                        param_type.hir_fmt(f, owner, store)?;
 
                         if index != function_parameters.len() - 1 {
                             write!(f, ", ")?;
@@ -2518,18 +2526,29 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                         TypeRef::Tuple(tup) if tup.is_empty() => {}
                         _ => {
                             write!(f, " -> ")?;
-                            return_type.hir_fmt(f, store)?;
+                            return_type.hir_fmt(f, owner, store)?;
                         }
                     }
                 }
             }
             TypeRef::ImplTrait(bounds) => {
                 write!(f, "impl ")?;
-                f.write_joined(bounds.iter().map(ExpressionStoreAdapter::wrap(store)), " + ")?;
+                f.write_joined(
+                    bounds.iter().map(ExpressionStoreAdapter::wrap(owner, store)),
+                    " + ",
+                )?;
             }
             TypeRef::DynTrait(bounds) => {
                 write!(f, "dyn ")?;
-                f.write_joined(bounds.iter().map(ExpressionStoreAdapter::wrap(store)), " + ")?;
+                f.write_joined(
+                    bounds.iter().map(ExpressionStoreAdapter::wrap(owner, store)),
+                    " + ",
+                )?;
+            }
+            TypeRef::PatternType(ty, pat) => {
+                ty.hir_fmt(f, owner, store)?;
+                write!(f, " is ")?;
+                pat.hir_fmt(f, owner, store)?;
             }
             TypeRef::Error => write!(f, "{{error}}")?,
         }
@@ -2538,7 +2557,12 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
 }
 
 impl<'db> HirDisplayWithExpressionStore<'db> for ConstRef {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, _store: &ExpressionStore) -> Result {
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        _owner: ExpressionStoreOwnerId,
+        _store: &ExpressionStore,
+    ) -> Result {
         // FIXME
         write!(f, "{{const}}")?;
 
@@ -2546,17 +2570,45 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, _store: &ExpressionStore) -> Re
     }
 }
 
+impl<'db> HirDisplayWithExpressionStore<'db> for PatId {
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        owner: ExpressionStoreOwnerId,
+        store: &ExpressionStore,
+    ) -> Result {
+        write!(
+            f,
+            "{}",
+            hir_def::expr_store::pretty::print_pat_hir(
+                f.db,
+                store,
+                owner,
+                *self,
+                false,
+                f.edition()
+            )
+        )?;
+        Ok(())
+    }
+}
+
 impl<'db> HirDisplayWithExpressionStore<'db> for TypeBound {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Result {
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        owner: ExpressionStoreOwnerId,
+        store: &ExpressionStore,
+    ) -> Result {
         match self {
             &TypeBound::Path(path, modifier) => {
                 match modifier {
                     TraitBoundModifier::None => (),
                     TraitBoundModifier::Maybe => write!(f, "?")?,
                 }
-                store[path].hir_fmt(f, store)
+                store[path].hir_fmt(f, owner, store)
             }
-            TypeBound::Lifetime(lifetime) => lifetime.hir_fmt(f, store),
+            TypeBound::Lifetime(lifetime) => lifetime.hir_fmt(f, owner, store),
             TypeBound::ForLifetime(lifetimes, path) => {
                 let edition = f.edition();
                 write!(
@@ -2564,7 +2616,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                     "for<{}> ",
                     lifetimes.iter().map(|it| it.display(f.db, edition)).format(", ")
                 )?;
-                store[*path].hir_fmt(f, store)
+                store[*path].hir_fmt(f, owner, store)
             }
             TypeBound::Use(args) => {
                 write!(f, "use<")?;
@@ -2572,7 +2624,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                 let last = args.len().saturating_sub(1);
                 for (idx, arg) in args.iter().enumerate() {
                     match arg {
-                        UseArgRef::Lifetime(lt) => lt.hir_fmt(f, store)?,
+                        UseArgRef::Lifetime(lt) => lt.hir_fmt(f, owner, store)?,
                         UseArgRef::Name(n) => write!(f, "{}", n.display(f.db, edition))?,
                     }
                     if idx != last {
@@ -2587,11 +2639,16 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
 }
 
 impl<'db> HirDisplayWithExpressionStore<'db> for Path {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Result {
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        owner: ExpressionStoreOwnerId,
+        store: &ExpressionStore,
+    ) -> Result {
         match (self.type_anchor(), self.kind()) {
             (Some(anchor), _) => {
                 write!(f, "<")?;
-                anchor.hir_fmt(f, store)?;
+                anchor.hir_fmt(f, owner, store)?;
                 write!(f, ">")?;
             }
             (_, PathKind::Plain) => {}
@@ -2634,7 +2691,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
         });
         if let Some(ty) = trait_self_ty {
             write!(f, "<")?;
-            ty.hir_fmt(f, store)?;
+            ty.hir_fmt(f, owner, store)?;
             write!(f, " as ")?;
             // Now format the path of the trait...
         }
@@ -2664,17 +2721,17 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                         if let Some(v) = tuple {
                             if v.len() == 1 {
                                 write!(f, "(")?;
-                                v[0].hir_fmt(f, store)?;
+                                v[0].hir_fmt(f, owner, store)?;
                                 write!(f, ")")?;
                             } else {
-                                generic_args.args[0].hir_fmt(f, store)?;
+                                generic_args.args[0].hir_fmt(f, owner, store)?;
                             }
                         }
                         if let Some(ret) = generic_args.bindings[0].type_ref
                             && !matches!(&store[ret], TypeRef::Tuple(v) if v.is_empty())
                         {
                             write!(f, " -> ")?;
-                            ret.hir_fmt(f, store)?;
+                            ret.hir_fmt(f, owner, store)?;
                         }
                     }
                     hir_def::expr_store::path::GenericArgsParentheses::No => {
@@ -2687,7 +2744,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                             } else {
                                 write!(f, ", ")?;
                             }
-                            arg.hir_fmt(f, store)?;
+                            arg.hir_fmt(f, owner, store)?;
                         }
                         for binding in generic_args.bindings.iter() {
                             if first {
@@ -2700,7 +2757,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                             match &binding.type_ref {
                                 Some(ty) => {
                                     write!(f, " = ")?;
-                                    ty.hir_fmt(f, store)?
+                                    ty.hir_fmt(f, owner, store)?
                                 }
                                 None => {
                                     write!(f, ": ")?;
@@ -2708,7 +2765,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
                                         binding
                                             .bounds
                                             .iter()
-                                            .map(ExpressionStoreAdapter::wrap(store)),
+                                            .map(ExpressionStoreAdapter::wrap(owner, store)),
                                         " + ",
                                     )?;
                                 }
@@ -2735,14 +2792,21 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Res
 }
 
 impl<'db> HirDisplayWithExpressionStore<'db> for hir_def::expr_store::path::GenericArg {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>, store: &ExpressionStore) -> Result {
+    fn hir_fmt(
+        &self,
+        f: &mut HirFormatter<'_, 'db>,
+        owner: ExpressionStoreOwnerId,
+        store: &ExpressionStore,
+    ) -> Result {
         match self {
-            hir_def::expr_store::path::GenericArg::Type(ty) => ty.hir_fmt(f, store),
+            hir_def::expr_store::path::GenericArg::Type(ty) => ty.hir_fmt(f, owner, store),
             hir_def::expr_store::path::GenericArg::Const(_c) => {
                 // write!(f, "{}", c.display(f.db, f.edition()))
                 write!(f, "<expr>")
             }
-            hir_def::expr_store::path::GenericArg::Lifetime(lifetime) => lifetime.hir_fmt(f, store),
+            hir_def::expr_store::path::GenericArg::Lifetime(lifetime) => {
+                lifetime.hir_fmt(f, owner, store)
+            }
         }
     }
 }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/drop.rs b/src/tools/rust-analyzer/crates/hir-ty/src/drop.rs
index 61e6720..08860e1 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/drop.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/drop.rs
@@ -6,7 +6,6 @@
 };
 use rustc_hash::FxHashSet;
 use rustc_type_ir::inherent::{AdtDef, GenericArgs as _, IntoKind};
-use stdx::never;
 
 use crate::{
     consteval,
@@ -84,10 +83,10 @@ fn has_drop_glue_impl<'db>(
                     }
                     db.field_types(id.into())
                         .iter()
-                        .map(|(_, field_ty)| {
+                        .map(|(_, field)| {
                             has_drop_glue_impl(
                                 infcx,
-                                field_ty.get().instantiate(infcx.interner, subst).skip_norm_wip(),
+                                field.ty().instantiate(infcx.interner, subst).skip_norm_wip(),
                                 env,
                                 visited,
                             )
@@ -100,17 +99,14 @@ fn has_drop_glue_impl<'db>(
                 AdtId::EnumId(id) => id
                     .enum_variants(db)
                     .variants
-                    .iter()
-                    .map(|&(variant, _, _)| {
+                    .values()
+                    .map(|&(variant, _)| {
                         db.field_types(variant.into())
                             .iter()
-                            .map(|(_, field_ty)| {
+                            .map(|(_, field)| {
                                 has_drop_glue_impl(
                                     infcx,
-                                    field_ty
-                                        .get()
-                                        .instantiate(infcx.interner, subst)
-                                        .skip_norm_wip(),
+                                    field.ty().instantiate(infcx.interner, subst).skip_norm_wip(),
                                     env,
                                     visited,
                                 )
@@ -177,9 +173,7 @@ fn has_drop_glue_impl<'db>(
             }
         }
         TyKind::Infer(..) => unreachable!("inference vars shouldn't exist out of inference"),
-        TyKind::Pat(..) | TyKind::UnsafeBinder(..) => {
-            never!("we do not handle pattern and unsafe binder types");
-            DropGlue::None
-        }
+        TyKind::Pat(ty, _) => has_drop_glue_impl(infcx, ty, env, visited),
+        TyKind::UnsafeBinder(ty) => has_drop_glue_impl(infcx, ty.skip_binder(), env, visited),
     }
 }
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 39ffb91..616701f 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs
@@ -91,7 +91,8 @@
         unify::resolve_completely::WriteBackCtxt,
     },
     lower::{
-        ImplTraitIdx, ImplTraitLoweringMode, LifetimeElisionKind, diagnostics::TyLoweringDiagnostic,
+        ImplTraitIdx, ImplTraitLoweringMode, LifetimeElisionKind, LoweringMode,
+        diagnostics::TyLoweringDiagnostic,
     },
     method_resolution::CandidateId,
     next_solver::{
@@ -116,13 +117,14 @@
 
 /// The entry point of type inference.
 fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> InferenceResult {
-    infer_query_with_inspect(db, def, None)
+    infer_query_with_inspect(db, def, None, LoweringMode::Analysis)
 }
 
 pub fn infer_query_with_inspect<'db>(
     db: &'db dyn HirDatabase,
     def: DefWithBodyId,
     inspect: Option<ObligationInspector<'db>>,
+    lowering_mode: LoweringMode,
 ) -> InferenceResult {
     let _p = tracing::info_span!("infer_query").entered();
     let resolver = def.resolver(db);
@@ -135,6 +137,7 @@ pub fn infer_query_with_inspect<'db>(
         &body.store,
         resolver,
         true,
+        lowering_mode,
     );
 
     if let Some(inspect) = inspect {
@@ -202,6 +205,7 @@ fn infer_anon_const_query(db: &dyn HirDatabase, def: AnonConstId) -> InferenceRe
         store,
         resolver,
         loc.allow_using_generic_params,
+        LoweringMode::Analysis,
     );
 
     ctx.infer_expr(
@@ -297,11 +301,19 @@ pub enum InferenceDiagnostic {
         #[type_visitable(ignore)]
         has_rest: bool,
     },
+    ArrayPatternWithoutFixedLength {
+        #[type_visitable(ignore)]
+        pat: PatId,
+    },
     ExpectedArrayOrSlicePat {
         #[type_visitable(ignore)]
         pat: PatId,
         found: StoredTy,
     },
+    InvalidRangePatType {
+        #[type_visitable(ignore)]
+        pat: PatId,
+    },
     DuplicateField {
         #[type_visitable(ignore)]
         field: ExprOrPatId,
@@ -361,6 +373,12 @@ pub enum InferenceDiagnostic {
         #[type_visitable(ignore)]
         expr: ExprId,
     },
+    NonExhaustiveRecordPat {
+        #[type_visitable(ignore)]
+        pat: PatId,
+        #[type_visitable(ignore)]
+        variant: VariantId,
+    },
     FunctionalRecordUpdateOnNonStruct {
         #[type_visitable(ignore)]
         base_expr: ExprId,
@@ -386,6 +404,21 @@ pub enum InferenceDiagnostic {
         call_expr: ExprId,
         found: StoredTy,
     },
+    CannotBeDereferenced {
+        #[type_visitable(ignore)]
+        expr: ExprId,
+        found: StoredTy,
+    },
+    CannotImplicitlyDerefTraitObject {
+        #[type_visitable(ignore)]
+        pat: PatId,
+        found: StoredTy,
+    },
+    CannotIndexInto {
+        #[type_visitable(ignore)]
+        expr: ExprId,
+        found: StoredTy,
+    },
     TypedHole {
         #[type_visitable(ignore)]
         expr: ExprId,
@@ -428,6 +461,10 @@ pub enum InferenceDiagnostic {
         #[type_visitable(ignore)]
         def: GenericDefId,
     },
+    MethodCallIllegalSizedBound {
+        #[type_visitable(ignore)]
+        call_expr: ExprId,
+    },
     MethodCallIncorrectGenericsOrder {
         #[type_visitable(ignore)]
         expr: ExprId,
@@ -459,6 +496,20 @@ pub enum InferenceDiagnostic {
         found: StoredTy,
     },
     SolverDiagnostic(SolverDiagnostic),
+    ExplicitDropMethodUse {
+        #[type_visitable(ignore)]
+        kind: ExplicitDropMethodUseKind,
+    },
+    MutableRefBinding {
+        #[type_visitable(ignore)]
+        pat: PatId,
+    },
+}
+
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum ExplicitDropMethodUseKind {
+    MethodCall(ExprId),
+    Path(ExprOrPatId),
 }
 
 /// Represents coercing a value to a different type of value.
@@ -1189,6 +1240,7 @@ pub(crate) struct InferenceContext<'body, 'db> {
     pub(crate) store_owner: ExpressionStoreOwnerId,
     pub(crate) generic_def: GenericDefId,
     pub(crate) store: &'body ExpressionStore,
+    pub(crate) lowering_mode: LoweringMode,
     /// Generally you should not resolve things via this resolver. Instead create a TyLoweringContext
     /// and resolve the path via its methods. This will ensure proper error reporting.
     pub(crate) resolver: Resolver<'db>,
@@ -1288,8 +1340,9 @@ fn new(
         store: &'body ExpressionStore,
         resolver: Resolver<'db>,
         allow_using_generic_params: bool,
+        lowering_mode: LoweringMode,
     ) -> Self {
-        let trait_env = db.trait_environment(store_owner);
+        let trait_env = db.trait_environment(generic_def);
         let table = unify::InferenceTable::new(db, trait_env, resolver.krate(), store_owner);
         let types = crate::next_solver::default_types(db);
         InferenceContext {
@@ -1322,6 +1375,7 @@ fn new(
             vars_emitted_type_must_be_known_for: FxHashSet::default(),
             deferred_call_resolutions: FxHashMap::default(),
             defined_anon_consts: RefCell::new(ThinVec::new()),
+            lowering_mode,
         }
     }
 
@@ -1922,6 +1976,7 @@ pub(crate) fn create_body_anon_const(
             expected_ty,
             &|| self.generics(),
             Some(&mut |span| self.table.next_const_var(span)),
+            self.lowering_mode,
             (!(allow_using_generic_params && self.allow_using_generic_params)).then_some(0),
         );
 
@@ -1999,7 +2054,7 @@ fn struct_tail_with_normalize(
                             .field_types(struct_id.into())
                             .values()
                             .next_back()
-                            .map(|it| it.get())
+                            .map(|it| it.ty())
                         {
                             Some(field) => {
                                 ty = field.instantiate(self.interner(), substs).skip_norm_wip();
@@ -2438,8 +2493,8 @@ fn resolve_variant(
                 };
                 let args =
                     path_ctx.substs_from_path_segment(it.into(), true, None, false, node.into());
+                let interner = path_ctx.interner();
                 drop(ctx);
-                let interner = DbInterner::conjure();
                 let ty = self.db.ty(it.into()).instantiate(interner, args).skip_norm_wip();
                 let ty = self.insert_type_vars(ty);
 
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs
index 93aed34..da996cc 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs
@@ -541,7 +541,7 @@ fn pointer_kind<'db>(
             let struct_data = id.fields(ctx.db);
             if let Some((last_field, _)) = struct_data.fields().iter().last() {
                 let last_field_ty = ctx.db.field_types(id.into())[last_field]
-                    .get()
+                    .ty()
                     .instantiate(ctx.interner(), subst)
                     .skip_norm_wip();
                 pointer_kind(expr, last_field_ty, ctx)
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs
index deafff6..34f9508 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/closure/analysis/expr_use_visitor.rs
@@ -692,6 +692,8 @@ pub(crate) fn walk_expr(&mut self, expr: ExprId) -> Result {
                     self.consume_expr(rhs)?;
                 }
             }
+
+            Expr::IncludeBytes => {}
         }
         Ok(())
     }
@@ -772,7 +774,7 @@ fn walk_struct_expr(&mut self, fields: &[RecordLitField], spread: RecordSpread)
                             with_expr.into(),
                             with_place.clone(),
                             adt_field_types[f_index]
-                                .get()
+                                .ty()
                                 .instantiate(self.cx.interner(), args)
                                 .skip_norm_wip(),
                             ProjectionKind::Field {
@@ -1023,6 +1025,7 @@ fn walk_pat(&mut self, discr_place: PlaceWithOrigin, pat: PatId, has_guard: bool
                 | Pat::Tuple { .. }
                 | Pat::Wild
                 | Pat::Missing
+                | Pat::NotNull
                 | Pat::Rest => {
                     // If the PatKind is Or, Box, Ref, Guard, or Tuple, the relevant accesses
                     // are made later as these patterns contains subpatterns.
@@ -1473,7 +1476,7 @@ fn cat_deref(
     fn variant_index_for_adt(&self, pat_id: PatId) -> Result<(u32, VariantId)> {
         let variant = self.cx.result.variant_resolution_for_pat(pat_id).ok_or(ErrorGuaranteed)?;
         let variant_idx = match variant {
-            VariantId::EnumVariantId(variant) => variant.loc(self.cx.db).index,
+            VariantId::EnumVariantId(variant) => variant.index(self.cx.db) as u32,
             VariantId::StructId(_) | VariantId::UnionId(_) => 0,
         };
         Ok((variant_idx, variant))
@@ -1696,6 +1699,7 @@ fn cat_pattern<F>(
             | Pat::Range { .. }
             | Pat::Missing
             | Pat::Rest
+            | Pat::NotNull
             | Pat::Wild => {
                 // always ok
             }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs
index 0675b5e..5f752da 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs
@@ -8,7 +8,8 @@
     expr_store::path::{GenericArgs as HirGenericArgs, Path},
     hir::{
         Array, AsmOperand, AsmOptions, BinaryOp, BindingAnnotation, Expr, ExprId, ExprOrPatId,
-        InlineAsmKind, LabelId, Pat, PatId, RecordLitField, RecordSpread, Statement, UnaryOp,
+        InlineAsmKind, LabelId, LoopSource, Pat, PatId, RecordLitField, RecordSpread, Statement,
+        UnaryOp,
     },
     resolver::ValueNs,
     signatures::VariantFields,
@@ -201,6 +202,7 @@ fn pat_guaranteed_to_constitute_read_for_never(&self, pat: PatId) -> bool {
             | Pat::Slice { .. }
             | Pat::ConstBlock(_)
             | Pat::Record { .. }
+            | Pat::NotNull
             | Pat::Missing => true,
             Pat::Expr(_) => unreachable!(
                 "we don't call pat_guaranteed_to_constitute_read_for_never() with assignments"
@@ -267,7 +269,8 @@ fn is_syntactic_place_expr(&self, expr: ExprId) -> bool {
             | Expr::Box { .. }
             | Expr::RecordLit { .. }
             | Expr::Yeet { .. }
-            | Expr::Missing => false,
+            | Expr::Missing
+            | Expr::IncludeBytes => false,
         }
     }
 
@@ -305,7 +308,7 @@ fn infer_expr_coerce_never(
             }
         } else {
             if let Some(expected_ty) = expected.only_has_type(&mut self.table) {
-                _ = self.demand_eqtype(expr.into(), ty, expected_ty);
+                _ = self.demand_eqtype(expr.into(), expected_ty, ty);
             }
             ty
         }
@@ -400,24 +403,29 @@ pub(super) fn infer_expr_inner(
                 })
                 .1
             }
-            &Expr::Loop { body, label } => {
-                let ty = expected.coercion_target_type(&mut self.table, tgt_expr.into());
+            &Expr::Loop { body, label, source } => {
+                let coerce = match source {
+                    // you can only use break with a value from a normal `loop { }`
+                    LoopSource::Loop => {
+                        Some(expected.coercion_target_type(&mut self.table, body.into()))
+                    }
+                    LoopSource::While | LoopSource::ForLoop => None,
+                };
                 let (breaks, ()) =
-                    self.with_breakable_ctx(BreakableKind::Loop, Some(ty), label, |this| {
-                        this.infer_expr(
+                    self.with_breakable_ctx(BreakableKind::Loop, coerce, label, |this| {
+                        this.infer_expr_suptype_coerce_never(
                             body,
                             &Expectation::HasType(this.types.types.unit),
                             ExprIsRead::Yes,
                         );
                     });
 
-                match breaks {
-                    Some(breaks) => {
-                        self.diverges = Diverges::Maybe;
-                        breaks
-                    }
-                    None => self.types.types.never,
+                if breaks.may_break {
+                    self.diverges = Diverges::Maybe;
+                } else {
+                    self.diverges = Diverges::Always;
                 }
+                breaks.coerce.map(|c| c.complete(self)).unwrap_or(self.types.types.unit)
             }
             Expr::Closure { body, args, ret_type, arg_types, closure_kind, capture_by: _ } => self
                 .infer_closure(
@@ -728,8 +736,13 @@ pub(super) fn infer_expr_inner(
                         self.table.select_obligations_where_possible();
                         trait_element_ty
                     }
-                    // FIXME: Report an error.
-                    None => self.types.types.error,
+                    None => {
+                        self.push_diagnostic(InferenceDiagnostic::CannotIndexInto {
+                            expr: tgt_expr,
+                            found: base_t.store(),
+                        });
+                        self.types.types.error
+                    }
                 }
             }
             Expr::Tuple { exprs, .. } => {
@@ -881,6 +894,11 @@ pub(super) fn infer_expr_inner(
                     self.types.types.unit
                 }
             }
+            Expr::IncludeBytes => {
+                let len = self.table.next_const_var(Span::Dummy);
+                let arr = Ty::new_array_with_const_len(self.interner(), self.types.types.u8, len);
+                Ty::new_ref(self.interner(), self.types.regions.statik, arr, Mutability::Not)
+            }
         };
         let ty = self.insert_type_vars_shallow(ty);
         self.write_expr_ty(tgt_expr, ty);
@@ -1043,14 +1061,14 @@ fn check_record_expr_fields(
                     });
                 }
 
-                variant_field_tys[i].get().instantiate(interner, args).skip_norm_wip()
+                variant_field_tys[i].ty().instantiate(interner, args).skip_norm_wip()
             } else {
                 if let Some(field_idx) = seen_fields.get(&name) {
                     self.push_diagnostic(InferenceDiagnostic::DuplicateField {
                         field: field.expr.into(),
                         variant,
                     });
-                    variant_field_tys[*field_idx].get().instantiate(interner, args).skip_norm_wip()
+                    variant_field_tys[*field_idx].ty().instantiate(interner, args).skip_norm_wip()
                 } else {
                     self.push_diagnostic(InferenceDiagnostic::NoSuchField {
                         field: field.expr.into(),
@@ -1106,12 +1124,12 @@ fn check_record_expr_fields(
                         // type we expect from the expectation value.
                         for (field_idx, field) in variant_fields.fields().iter() {
                             let fru_ty = variant_field_tys[field_idx]
-                                .get()
+                                .ty()
                                 .instantiate(interner, fresh_args)
                                 .skip_norm_wip();
                             if remaining_fields.remove(&field.name).is_some() {
                                 let target_ty = variant_field_tys[field_idx]
-                                    .get()
+                                    .ty()
                                     .instantiate(interner, args)
                                     .skip_norm_wip();
                                 let cause = ObligationCause::new(expr);
@@ -1294,7 +1312,10 @@ fn infer_unop_expr(
                 if let Some(ty) = self.lookup_derefing(expr, oprnd, oprnd_t) {
                     oprnd_t = ty;
                 } else {
-                    // FIXME: Report an error.
+                    self.push_diagnostic(InferenceDiagnostic::CannotBeDereferenced {
+                        expr,
+                        found: oprnd_t.store(),
+                    });
                     oprnd_t = self.types.types.error;
                 }
             }
@@ -1490,10 +1511,11 @@ fn infer_block(
         label: Option<LabelId>,
         expected: &Expectation<'db>,
     ) -> Ty<'db> {
+        let prev_diverges = self.diverges;
         let coerce_ty = expected.coercion_target_type(&mut self.table, expr.into());
         let g = self.resolver.update_to_inner_scope(self.db, self.store_owner, expr);
 
-        let (break_ty, ty) =
+        let (ctxt, tail_expr_ty) =
             self.with_breakable_ctx(BreakableKind::Block, Some(coerce_ty), label, |this| {
                 for stmt in statements {
                     match stmt {
@@ -1561,42 +1583,54 @@ fn infer_block(
                     }
                 }
 
-                // FIXME: This should make use of the breakable CoerceMany
-                if let Some(expr) = tail {
-                    this.infer_expr_coerce(expr, expected, ExprIsRead::Yes)
-                } else {
-                    // Citing rustc: if there is no explicit tail expression,
-                    // that is typically equivalent to a tail expression
-                    // of `()` -- except if the block diverges. In that
-                    // case, there is no value supplied from the tail
-                    // expression (assuming there are no other breaks,
-                    // this implies that the type of the block will be
-                    // `!`).
-                    if this.diverges.is_always() {
-                        // we don't even make an attempt at coercion
-                        this.table.new_maybe_never_var(expr.into())
-                    } else if let Some(t) = expected.only_has_type(&mut this.table) {
-                        if this
-                            .coerce(
-                                expr,
-                                this.types.types.unit,
-                                t,
-                                AllowTwoPhase::No,
-                                ExprIsRead::Yes,
-                            )
-                            .is_err()
-                        {
-                            this.emit_type_mismatch(expr.into(), t, this.types.types.unit);
-                        }
-                        t
-                    } else {
-                        this.types.types.unit
-                    }
-                }
+                // check the tail expression **without** holding the
+                // `enclosing_breakables` lock below.
+                tail.map(|expr| (expr, this.infer_expr_inner(expr, expected, ExprIsRead::Yes)))
             });
+
+        let mut coerce = ctxt.coerce.unwrap();
+        if let Some((tail_expr, tail_expr_ty)) = tail_expr_ty {
+            let cause = ObligationCause::new(tail_expr);
+            coerce.coerce_inner(
+                self,
+                &cause,
+                tail_expr,
+                tail_expr_ty,
+                false,
+                false,
+                ExprIsRead::Yes,
+            );
+        } else {
+            // Subtle: if there is no explicit tail expression,
+            // that is typically equivalent to a tail expression
+            // of `()` -- except if the block diverges. In that
+            // case, there is no value supplied from the tail
+            // expression (assuming there are no other breaks,
+            // this implies that the type of the block will be
+            // `!`).
+            //
+            // #41425 -- label the implicit `()` as being the
+            // "found type" here, rather than the "expected type".
+            if !self.diverges.is_always() {
+                coerce.coerce_forced_unit(
+                    self,
+                    expr,
+                    &ObligationCause::new(expr),
+                    false,
+                    ExprIsRead::Yes,
+                );
+            }
+        }
+
+        if ctxt.may_break {
+            // If we can break from the block, then the block's exit is always reachable
+            // (... as long as the entry is reachable) - regardless of the tail of the block.
+            self.diverges = prev_diverges;
+        }
+
         self.resolver.reset_to_guard(g);
 
-        break_ty.unwrap_or(ty)
+        coerce.complete(self)
     }
 
     fn lookup_field(
@@ -1650,7 +1684,7 @@ fn lookup_field(
                 return None;
             }
             let ty = self.db.field_types(field_id.parent)[field_id.local_id]
-                .get()
+                .ty()
                 .instantiate(interner, parameters)
                 .skip_norm_wip();
             Some((Either::Left(field_id), ty))
@@ -1669,7 +1703,7 @@ fn lookup_field(
                 let adjustments =
                     self.table.register_infer_ok(autoderef.adjust_steps_as_infer_ok());
                 let ty = self.db.field_types(field_id.parent)[field_id.local_id]
-                    .get()
+                    .ty()
                     .instantiate(self.interner(), subst)
                     .skip_norm_wip();
                 let ty = self.process_remote_user_written_ty(ty);
@@ -2169,13 +2203,13 @@ pub(super) fn with_breakable_ctx<T>(
         ty: Option<Ty<'db>>,
         label: Option<LabelId>,
         cb: impl FnOnce(&mut Self) -> T,
-    ) -> (Option<Ty<'db>>, T) {
+    ) -> (BreakableContext<'db>, T) {
         self.breakables.push({
             BreakableContext { kind, may_break: false, coerce: ty.map(CoerceMany::new), label }
         });
         let res = cb(self);
         let ctx = self.breakables.pop().expect("breakable stack broken");
-        (if ctx.may_break { ctx.coerce.map(|ctx| ctx.complete(self)) } else { None }, res)
+        (ctx, res)
     }
 }
 
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs
index c3b5326..4fa1b71a 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/mutability.rs
@@ -160,7 +160,7 @@ fn infer_mut_expr_without_adjust(&mut self, tgt_expr: ExprId, mutability: Mutabi
             | Expr::Range { rhs: Some(expr), lhs: None, range_type: _ }
             | Expr::Await { expr }
             | Expr::Box { expr }
-            | Expr::Loop { body: expr, label: _ }
+            | Expr::Loop { body: expr, label: _, source: _ }
             | Expr::Cast { expr, type_ref: _ } => {
                 self.infer_mut_expr(*expr, Mutability::Not);
             }
@@ -197,7 +197,8 @@ fn infer_mut_expr_without_adjust(&mut self, tgt_expr: ExprId, mutability: Mutabi
             | Expr::Literal(_)
             | Expr::Path(_)
             | Expr::Continue { .. }
-            | Expr::Underscore => (),
+            | Expr::Underscore
+            | Expr::IncludeBytes => (),
         }
     }
 
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs
index f214386..915da94 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs
@@ -448,7 +448,7 @@ fn infer_pat_inner(
                 )
             }
             Pat::Missing => self.types.types.error,
-            Pat::Wild | Pat::Rest => expected,
+            Pat::Wild | Pat::Rest | Pat::NotNull => expected,
             // We allow any type here; we ensure that the type is uninhabited during match checking.
             // Pat::Never => expected,
             Pat::Path(_) => {
@@ -662,6 +662,8 @@ fn calc_adjust_mode(
             Pat::Ref { .. }
             // No need to do anything on a missing pattern.
             | Pat::Missing
+            // No need to do anything on a `NotNull` pattern, they are only allowed in type contexts.
+            | Pat::NotNull
             // A `_`/`..` pattern works with any expected type, so there's no need to do anything.
             | Pat::Wild | Pat::Rest
             // Bindings also work with whatever the expected type is,
@@ -843,7 +845,7 @@ fn infer_range_pat(
         if let (Some((true, ..)), _) | (_, Some((true, ..))) = (lhs, rhs) {
             // There exists a side that didn't meet our criteria that the end-point
             // be of a numeric or char type, as checked in `calc_side` above.
-            // FIXME: Emit an error.
+            self.push_diagnostic(InferenceDiagnostic::InvalidRangePatType { pat });
             return self.types.types.error;
         }
 
@@ -891,14 +893,14 @@ fn infer_bind_pat(
         let user_bind_annot = BindingMode::from_annotation(binding_data.mode);
         let bm = match user_bind_annot {
             BindingMode(ByRef::No, Mutability::Mut) if let ByRef::Yes(_) = def_br => {
-                // Only mention the experimental `mut_ref` feature if if we're in edition 2024 and
+                // Only mention the experimental `mut_ref` feature if we're in edition 2024 and
                 // using other experimental matching features compatible with it.
                 if self.edition.at_least_2024()
                     && (self.features.ref_pat_eat_one_layer_2024
                         || self.features.ref_pat_eat_one_layer_2024_structural)
                 {
                     if !self.features.mut_ref {
-                        // FIXME: Emit an error: binding cannot be both mutable and by-reference.
+                        self.push_diagnostic(InferenceDiagnostic::MutableRefBinding { pat });
                     }
 
                     BindingMode(def_br, Mutability::Mut)
@@ -957,22 +959,23 @@ fn infer_bind_pat(
         local_ty
     }
 
-    fn check_dereferenceable(&self, expected: Ty<'db>, inner: PatId) -> Result<(), ()> {
+    fn check_dereferenceable(
+        &mut self,
+        expected: Ty<'db>,
+        pat: PatId,
+        inner: PatId,
+    ) -> Result<(), ()> {
         if let Pat::Bind { .. } = self.store[inner]
             && let Some(pointee_ty) = self.shallow_resolve(expected).builtin_deref(true)
             && let TyKind::Dynamic(..) = pointee_ty.kind()
         {
             // This is "x = dyn SomeTrait" being reduced from
             // "let &x = &dyn SomeTrait" or "let box x = Box<dyn SomeTrait>", an error.
-            // FIXME: Emit an error. rustc emits this message:
-            const _CANNOT_IMPLICITLY_DEREF_POINTER_TRAIT_OBJ: &str = "\
-This error indicates that a pointer to a trait type cannot be implicitly dereferenced by a \
-pattern. Every trait defines a type, but because the size of trait implementors isn't fixed, \
-this type has no compile-time size. Therefore, all accesses to trait types must be through \
-pointers. If you encounter this error you should try to avoid dereferencing the pointer.
-
-You can read more about trait objects in the Trait Objects section of the Reference: \
-https://doc.rust-lang.org/reference/types.html#trait-objects";
+            self.push_diagnostic(InferenceDiagnostic::CannotImplicitlyDerefTraitObject {
+                pat,
+                found: expected.store(),
+            });
+            return Err(());
         }
         Ok(())
     }
@@ -1071,7 +1074,7 @@ fn infer_tuple_struct_pat(
             for (i, &subpat) in subpats.iter().enumerate_and_adjust(variant_fields.len(), ddpos) {
                 let field_id = LocalFieldId::from_raw(la_arena::RawIdx::from_u32(i as u32));
                 let field_ty =
-                    variant_field_tys[field_id].get().instantiate(interner, args).skip_norm_wip();
+                    variant_field_tys[field_id].ty().instantiate(interner, args).skip_norm_wip();
                 self.infer_pat(subpat, field_ty, pat_info);
             }
             if let Err(()) = had_err {
@@ -1090,7 +1093,7 @@ fn infer_tuple_struct_pat(
             for (i, &pat) in subpats.iter().enumerate() {
                 let field_id = LocalFieldId::from_raw(la_arena::RawIdx::from_u32(i as u32));
                 let expected = match variant_field_tys.get(field_id) {
-                    Some(field_ty) => field_ty.get().instantiate(interner, args).skip_norm_wip(),
+                    Some(field_ty) => field_ty.ty().instantiate(interner, args).skip_norm_wip(),
                     None => self.types.types.error,
                 };
                 self.infer_pat(pat, expected, pat_info);
@@ -1155,7 +1158,7 @@ fn infer_tuple_pat(
     fn check_record_pat_fields(
         &mut self,
         adt_ty: Ty<'db>,
-        _pat: PatId,
+        pat: PatId,
         variant: VariantId,
         fields: &[RecordFieldPat],
         has_rest_pat: bool,
@@ -1205,7 +1208,7 @@ fn check_record_pat_fields(
                         });
                     }
 
-                    variant_field_tys[field_idx].get().instantiate(interner, args).skip_norm_wip()
+                    variant_field_tys[field_idx].ty().instantiate(interner, args).skip_norm_wip()
                 }
                 None => {
                     inexistent_fields.push(field);
@@ -1233,7 +1236,7 @@ fn check_record_pat_fields(
         // Require `..` if struct has non_exhaustive attribute.
         let non_exhaustive = self.has_applicable_non_exhaustive(variant.into());
         if non_exhaustive && !has_rest_pat {
-            // FIXME: Emit an error.
+            self.push_diagnostic(InferenceDiagnostic::NonExhaustiveRecordPat { pat, variant });
         }
 
         // Report an error if an incorrect number of fields was specified.
@@ -1258,7 +1261,7 @@ fn infer_box_pat(
     ) -> Ty<'db> {
         let interner = self.interner();
         let (box_ty, inner_ty) = self
-            .check_dereferenceable(expected, inner)
+            .check_dereferenceable(expected, pat, inner)
             .map(|()| {
                 // Here, `demand::subtype` is good enough, but I don't
                 // think any errors can be introduced by using `demand::eqtype`.
@@ -1471,7 +1474,7 @@ fn infer_ref_pat(
             }
         }
 
-        let (ref_ty, inner_ty) = match self.check_dereferenceable(expected, inner) {
+        let (ref_ty, inner_ty) = match self.check_dereferenceable(expected, pat, inner) {
             Ok(()) => {
                 // `demand::subtype` would be good enough, but using `eqtype` turns
                 // out to be equally general. See (note_1) for details.
@@ -1699,7 +1702,7 @@ fn check_array_pat_len(
             // We have a variable-length pattern and don't know the array length.
             // This happens if we have e.g.,
             // `let [a, b, ..] = arr` where `arr: [T; N]` where `const N: usize`.
-            // FIXME: Emit an error: cannot pattern-match on an array without a fixed length.
+            self.push_diagnostic(InferenceDiagnostic::ArrayPatternWithoutFixedLength { pat });
         };
 
         // If we get here, we must have emitted an error.
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 704f15c..0ec72ed 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
@@ -11,7 +11,7 @@
 use stdx::never;
 
 use crate::{
-    InferenceDiagnostic, Span, ValueTyDefId,
+    ExplicitDropMethodUseKind, InferenceDiagnostic, Span, ValueTyDefId,
     infer::{
         InferenceTyLoweringVarsCtx, diagnostics::InferenceTyLoweringContext as TyLoweringContext,
     },
@@ -33,6 +33,14 @@ pub(super) fn infer_path(
     ) -> Option<(ValueNs, Ty<'db>)> {
         let (value, self_subst) = self.resolve_value_path_inner(path, id, false)?;
 
+        if let ValueNs::FunctionId(f) = value
+            && self.lang_items.Drop_drop.is_some_and(|drop_fn| drop_fn == f)
+        {
+            self.push_diagnostic(InferenceDiagnostic::ExplicitDropMethodUse {
+                kind: ExplicitDropMethodUseKind::Path(id),
+            });
+        }
+
         let (value_def, generic_def, substs) =
             match self.resolve_value_path(path, id, value, self_subst)? {
                 ValuePathResolution::GenericDef(value_def, generic_def, substs) => {
@@ -183,7 +191,30 @@ pub(super) fn resolve_value_path_inner(
             match value_or_partial {
                 ResolveValueResult::ValueNs(it) => {
                     drop_ctx(ctx, no_diagnostics);
-                    (it, None)
+
+                    let args = if let Path::LangItem(..) = path {
+                        let def_and_container = match it {
+                            ValueNs::ConstId(it) => Some((it.into(), it.loc(self.db).container)),
+                            ValueNs::FunctionId(it) => Some((it.into(), it.loc(self.db).container)),
+                            _ => None,
+                        };
+                        let def_and_container =
+                            def_and_container.and_then(|(def, container)| match container {
+                                ItemContainerId::ImplId(it) => Some((def, it.into())),
+                                ItemContainerId::TraitId(it) => Some((def, it.into())),
+                                ItemContainerId::ExternBlockId(_)
+                                | ItemContainerId::ModuleId(_) => None,
+                            });
+                        def_and_container.map(|(def, container)| {
+                            let args = self.infcx().fresh_args_for_item(id.into(), container);
+                            self.write_assoc_resolution(id, def, args);
+                            args
+                        })
+                    } else {
+                        None
+                    };
+
+                    (it, args)
                 }
                 ResolveValueResult::Partial(def, remaining_index) => {
                     // there may be more intermediate segments between the resolved one and
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs
index f9ad76b..4c80871 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs
@@ -577,7 +577,10 @@ pub(crate) fn resolve_diagnostics(mut self) -> (ThinVec<InferenceDiagnostic>, bo
             diagnostics.retain_mut(|diagnostic| {
                 self.resolve_completely(diagnostic);
 
-                if let InferenceDiagnostic::ExpectedFunction { found: ty, .. }
+                if let InferenceDiagnostic::CannotBeDereferenced { found: ty, .. }
+                | InferenceDiagnostic::CannotImplicitlyDerefTraitObject { found: ty, .. }
+                | InferenceDiagnostic::CannotIndexInto { found: ty, .. }
+                | InferenceDiagnostic::ExpectedFunction { found: ty, .. }
                 | InferenceDiagnostic::ExpectedArrayOrSlicePat { found: ty, .. }
                 | InferenceDiagnostic::UnresolvedField { receiver: ty, .. }
                 | InferenceDiagnostic::UnresolvedMethodCall { receiver: ty, .. } = diagnostic
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/inhabitedness.rs b/src/tools/rust-analyzer/crates/hir-ty/src/inhabitedness.rs
index 0070d14..bca91d0 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/inhabitedness.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/inhabitedness.rs
@@ -125,7 +125,7 @@ fn visit_adt(
             AdtId::EnumId(e) => {
                 let enum_data = e.enum_variants(self.db());
 
-                for &(variant, _, _) in enum_data.variants.iter() {
+                for &(variant, _) in enum_data.variants.values() {
                     let variant_inhabitedness = self.visit_variant(variant.into(), subst);
                     match variant_inhabitedness {
                         Break(VisiblyUninhabited) => (),
@@ -157,7 +157,7 @@ fn visit_variant(
         };
 
         for (fid, _) in fields.iter() {
-            self.visit_field(field_vis.as_ref().map(|it| it[fid]), &field_tys[fid].get(), subst)?;
+            self.visit_field(field_vis.as_ref().map(|it| it[fid]), &field_tys[fid].ty(), subst)?;
         }
         CONTINUE_OPAQUELY_INHABITED
     }
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 3e56907..ed47755 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs
@@ -10,12 +10,12 @@
 use la_arena::{Idx, RawIdx};
 
 use rustc_abi::{
-    AddressSpace, Float, Integer, LayoutCalculator, Primitive, ReprOptions, Scalar, StructKind,
-    TargetDataLayout, WrappingRange,
+    AddressSpace, BackendRepr, FieldsShape, Float, Integer, LayoutCalculator, Niche, Primitive,
+    ReprOptions, Scalar, Size, StructKind, TargetDataLayout, WrappingRange,
 };
 use rustc_index::IndexVec;
 use rustc_type_ir::{
-    FloatTy, IntTy, UintTy,
+    FloatTy, IntTy, TypeVisitableExt as _, UintTy,
     inherent::{GenericArgs as _, IntoKind},
 };
 use triomphe::Arc;
@@ -25,7 +25,8 @@
     consteval::try_const_usize,
     db::HirDatabase,
     next_solver::{
-        DbInterner, GenericArgs, StoredTy, Ty, TyKind, TypingMode,
+        Const, ConstKind, DbInterner, GenericArgs, PatternKind, StoredTy, Ty, TyKind, TypingMode,
+        ValueConst,
         infer::{DbInternerInferExt, traits::ObligationCause},
     },
     traits::StoredParamEnvAndCrate,
@@ -37,6 +38,9 @@
 pub(crate) mod adt;
 pub(crate) mod target;
 
+#[cfg(test)]
+mod tests;
+
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub struct RustcEnumVariantIdx(pub usize);
 
@@ -144,7 +148,7 @@ fn layout_of_simd_ty<'db>(
     let mut fields = fields.iter();
     let Some(TyKind::Array(e_ty, e_len)) =
         fields.next().filter(|_| fields.next().is_none()).map(|f| {
-            (*f.1).get().instantiate(DbInterner::new_no_crate(db), args).skip_norm_wip().kind()
+            (*f.1).ty().instantiate(DbInterner::new_no_crate(db), args).skip_norm_wip().kind()
         })
     else {
         return Err(LayoutError::InvalidSimdType);
@@ -341,12 +345,149 @@ pub fn layout_of_ty_query(
             return db
                 .layout_of_ty(args.as_coroutine_closure().tupled_upvars_ty().store(), trait_env);
         }
-
         TyKind::CoroutineWitness(_, _) => {
             return Err(LayoutError::NotImplemented);
         }
 
-        TyKind::Pat(_, _) | TyKind::UnsafeBinder(_) => {
+        TyKind::Pat(ty, pat) => {
+            let mut layout = (*db.layout_of_ty(ty.store(), trait_env.clone())?).clone();
+            match pat.kind() {
+                PatternKind::Range { start, end } => {
+                    if let BackendRepr::Scalar(scalar) = &mut layout.backend_repr {
+                        scalar.valid_range_mut().start = extract_const_value(start)?
+                            .try_to_bits(db, trait_env.as_ref())
+                            .ok_or(LayoutError::Unknown)?;
+
+                        scalar.valid_range_mut().end = extract_const_value(end)?
+                            .try_to_bits(db, trait_env.as_ref())
+                            .ok_or(LayoutError::Unknown)?;
+
+                        // FIXME(pattern_types): create implied bounds from pattern types in signatures
+                        // that require that the range end is >= the range start so that we can't hit
+                        // this error anymore without first having hit a trait solver error.
+                        // Very fuzzy on the details here, but pattern types are an internal impl detail,
+                        // so we can just go with this for now
+                        if scalar.is_signed() {
+                            let range = scalar.valid_range_mut();
+                            let start = layout.size.sign_extend(range.start);
+                            let end = layout.size.sign_extend(range.end);
+                            if end < start {
+                                return Err(LayoutError::HasErrorType);
+                            }
+                        } else {
+                            let range = scalar.valid_range_mut();
+                            if range.end < range.start {
+                                return Err(LayoutError::HasErrorType);
+                            }
+                        };
+
+                        let niche = Niche {
+                            offset: Size::ZERO,
+                            value: scalar.primitive(),
+                            valid_range: scalar.valid_range(target),
+                        };
+
+                        layout.largest_niche = Some(niche);
+                    } else {
+                        panic!("pattern type with range but not scalar layout: {ty:?}, {layout:?}")
+                    }
+                }
+                PatternKind::NotNull => {
+                    if let BackendRepr::Scalar(scalar) | BackendRepr::ScalarPair(scalar, _) =
+                        &mut layout.backend_repr
+                    {
+                        scalar.valid_range_mut().start = 1;
+                        let niche = Niche {
+                            offset: Size::ZERO,
+                            value: scalar.primitive(),
+                            valid_range: scalar.valid_range(target),
+                        };
+
+                        layout.largest_niche = Some(niche);
+                    } else {
+                        panic!(
+                            "pattern type with `!null` pattern but not scalar/pair layout: {ty:?}, {layout:?}"
+                        )
+                    }
+                }
+
+                PatternKind::Or(variants) => match variants[0].kind() {
+                    PatternKind::Range { .. } => {
+                        if let BackendRepr::Scalar(scalar) = &mut layout.backend_repr {
+                            let variants: Result<Vec<_>, _> = variants
+                                .iter()
+                                .map(|pat| match pat.kind() {
+                                    PatternKind::Range { start, end } => Ok::<_, LayoutError>((
+                                        extract_const_value(start)?
+                                            .try_to_bits(db, trait_env.as_ref())
+                                            .ok_or(LayoutError::Unknown)?,
+                                        extract_const_value(end)?
+                                            .try_to_bits(db, trait_env.as_ref())
+                                            .ok_or(LayoutError::Unknown)?,
+                                    )),
+                                    PatternKind::NotNull | PatternKind::Or(_) => {
+                                        Err(LayoutError::Unknown)
+                                    }
+                                })
+                                .collect();
+                            let mut variants = variants?;
+                            if !scalar.is_signed() {
+                                return Err(LayoutError::HasErrorType);
+                            }
+                            variants.sort();
+                            if variants.len() != 2 {
+                                return Err(LayoutError::HasErrorType);
+                            }
+
+                            // first is the one starting at the signed in range min
+                            let mut first = variants[0];
+                            let mut second = variants[1];
+                            if second.0
+                                == layout.size.truncate(layout.size.signed_int_min() as u128)
+                            {
+                                (second, first) = (first, second);
+                            }
+
+                            if layout.size.sign_extend(first.1) >= layout.size.sign_extend(second.0)
+                            {
+                                return Err(LayoutError::HasErrorType);
+                            }
+                            if layout.size.signed_int_max() as u128 != second.1 {
+                                return Err(LayoutError::HasErrorType);
+                            }
+
+                            // Now generate a wrapping range (which aren't allowed in surface syntax).
+                            scalar.valid_range_mut().start = second.0;
+                            scalar.valid_range_mut().end = first.1;
+
+                            let niche = Niche {
+                                offset: Size::ZERO,
+                                value: scalar.primitive(),
+                                valid_range: scalar.valid_range(target),
+                            };
+
+                            layout.largest_niche = Some(niche);
+                        } else {
+                            panic!(
+                                "pattern type with range but not scalar layout: {ty:?}, {layout:?}"
+                            )
+                        }
+                    }
+                    PatternKind::NotNull => panic!("or patterns can't contain `!null` patterns"),
+                    PatternKind::Or(..) => panic!("patterns cannot have nested or patterns"),
+                },
+            }
+            // Pattern types contain their base as their sole field.
+            // This allows the rest of the compiler to process pattern types just like
+            // single field transparent Adts, and only the parts of the compiler that
+            // specifically care about pattern types will have to handle it.
+            layout.fields = FieldsShape::Arbitrary {
+                offsets: [Size::ZERO].into_iter().collect(),
+                in_memory_order: [RustcFieldIdx::new(0)].into_iter().collect(),
+            };
+            layout
+        }
+        TyKind::UnsafeBinder(_) => {
             return Err(LayoutError::NotImplemented);
         }
 
@@ -371,6 +512,25 @@ pub(crate) fn layout_of_ty_cycle_result(
     Err(LayoutError::RecursiveTypeWithoutIndirection)
 }
 
+fn extract_const_value<'db>(ct: Const<'db>) -> Result<ValueConst<'db>, LayoutError> {
+    match ct.kind() {
+        ConstKind::Value(cv) => Ok(cv),
+        ConstKind::Param(_)
+        | ConstKind::Expr(_)
+        | ConstKind::Unevaluated(_)
+        | ConstKind::Infer(_)
+        | ConstKind::Bound(..)
+        | ConstKind::Placeholder(_) => {
+            if ct.has_param() {
+                Err(LayoutError::HasPlaceholder)
+            } else {
+                Err(LayoutError::Unknown)
+            }
+        }
+        ConstKind::Error(_) => Err(LayoutError::HasErrorConst),
+    }
+}
+
 fn struct_tail_erasing_lifetimes<'a>(db: &'a dyn HirDatabase, pointee: Ty<'a>) -> Ty<'a> {
     match pointee.kind() {
         TyKind::Adt(def, args) => {
@@ -405,12 +565,9 @@ fn field_ty<'a>(
     fd: LocalFieldId,
     args: GenericArgs<'a>,
 ) -> Ty<'a> {
-    db.field_types(def)[fd].get().instantiate(DbInterner::new_no_crate(db), args).skip_norm_wip()
+    db.field_types(def)[fd].ty().instantiate(DbInterner::new_no_crate(db), args).skip_norm_wip()
 }
 
 fn scalar_unit(dl: &TargetDataLayout, value: Primitive) -> Scalar {
     Scalar::Initialized { value, valid_range: WrappingRange::full(value.size(dl)) }
 }
-
-#[cfg(test)]
-mod tests;
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs b/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs
index b7e1697..22dd53c 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs
@@ -60,8 +60,8 @@ pub fn layout_of_adt_query(
             let variants = e.enum_variants(db);
             let r = variants
                 .variants
-                .iter()
-                .map(|&(v, _, _)| handle_variant(v.into(), v.fields(db)))
+                .values()
+                .map(|&(v, _)| handle_variant(v.into(), v.fields(db)))
                 .collect::<Result<SmallVec<_>, _>>()?;
             (r, AttrFlags::repr(db, e.into()).unwrap_or_default(), false)
         }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs b/src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs
index bc18f05..b9ee38c 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs
@@ -1,7 +1,7 @@
 use base_db::target::TargetData;
 use either::Either;
 use hir_def::{
-    DefWithBodyId, ExpressionStoreOwnerId, GenericDefId, HasModule,
+    DefWithBodyId, HasModule,
     expr_store::Body,
     signatures::{
         EnumSignature, FunctionSignature, StructSignature, TypeAliasSignature, UnionSignature,
@@ -92,13 +92,10 @@ fn eval_goal(
             ),
             Either::Right(ty_id) => db.ty(ty_id.into()).instantiate_identity().skip_norm_wip(),
         };
-        let param_env = db.trait_environment(
-            match adt_or_type_alias_id {
-                Either::Left(adt) => hir_def::GenericDefId::AdtId(adt),
-                Either::Right(ty) => hir_def::GenericDefId::TypeAliasId(ty),
-            }
-            .into(),
-        );
+        let param_env = db.trait_environment(match adt_or_type_alias_id {
+            Either::Left(adt) => hir_def::GenericDefId::AdtId(adt),
+            Either::Right(ty) => hir_def::GenericDefId::TypeAliasId(ty),
+        });
         let krate = match adt_or_type_alias_id {
             Either::Left(it) => it.krate(&db),
             Either::Right(it) => it.krate(&db),
@@ -145,8 +142,7 @@ fn eval_expr(
             .0;
         let infer = InferenceResult::of(&db, DefWithBodyId::from(function_id));
         let goal_ty = infer.type_of_binding[b].clone();
-        let param_env =
-            db.trait_environment(ExpressionStoreOwnerId::from(GenericDefId::from(function_id)));
+        let param_env = db.trait_environment(function_id.into());
         let krate = function_id.krate(&db);
         db.layout_of_ty(goal_ty, ParamEnvAndCrate { param_env, krate }.store())
     })
@@ -182,6 +178,7 @@ fn check_fail(#[rust_analyzer::rust_fixture] ra_fixture: &str, e: LayoutError) {
     assert_eq!(r, Err(e));
 }
 
+#[rust_analyzer::macro_style(braces)]
 macro_rules! size_and_align {
     (minicore: $($x:tt),*;$($t:tt)*) => {
         {
@@ -444,6 +441,7 @@ fn unwrap_fut<T>(inp: impl Future<Output = T>) -> Poll<T> {
             // but rustc actually runs this code.
             let pinned = pin!(inp);
             struct EmptyWaker;
+            #[expect(clippy::manual_noop_waker, reason = "we don't have access to std here")]
             impl Wake for EmptyWaker {
                 fn wake(self: Arc<Self>) {
                 }
@@ -529,13 +527,29 @@ fn tuple_ptr_with_dst_tail() {
 }
 
 #[test]
-#[ignore = "FIXME: We need to have proper pattern types"]
 fn non_zero_and_non_null() {
     size_and_align! {
         minicore: non_zero, non_null, option;
         use core::{num::NonZeroU8, ptr::NonNull};
         struct Goal(Option<NonZeroU8>, Option<NonNull<i32>>);
     }
+    check_size_and_align(
+        r#"
+    const END: usize = 10;
+    struct Goal(core::pattern_type!(usize is 0..=END));
+        "#,
+        "//- minicore: pat\n",
+        8,
+        8,
+    );
+    check_size_and_align(
+        r#"
+pub struct Goal(core::pattern_type!(i32 is ..0 | 1..));
+    "#,
+        "//- minicore: pat\n",
+        4,
+        4,
+    );
 }
 
 #[test]
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs b/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs
index 91e3b85..cc48ba0 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs
@@ -104,14 +104,15 @@
 
 pub use autoderef::autoderef;
 pub use infer::{
-    Adjust, Adjustment, AutoBorrow, BindingMode, ByRef, InferenceDiagnostic, InferenceResult,
-    InferenceTyDiagnosticSource, OverloadedDeref, PointerCast, cast::CastError, could_coerce,
-    could_unify, could_unify_deeply, infer_query_with_inspect,
+    Adjust, Adjustment, AutoBorrow, BindingMode, ByRef, ExplicitDropMethodUseKind,
+    InferenceDiagnostic, InferenceResult, InferenceTyDiagnosticSource, OverloadedDeref,
+    PointerCast, cast::CastError, could_coerce, could_unify, could_unify_deeply,
+    infer_query_with_inspect,
 };
 pub use lower::{
-    GenericDefaults, GenericDefaultsRef, GenericPredicates, ImplTraits, LifetimeElisionKind,
-    TyDefId, TyLoweringContext, TyLoweringInferVarsCtx, TyLoweringResult, ValueTyDefId,
-    diagnostics::*,
+    FieldType, GenericDefaults, GenericDefaultsRef, GenericPredicates, ImplTraits,
+    LifetimeElisionKind, LoweringMode, TyDefId, TyLoweringContext, TyLoweringInferVarsCtx,
+    TyLoweringResult, ValueTyDefId, diagnostics::*,
 };
 pub use next_solver::interner::{attach_db, attach_db_allow_change, with_attached_db};
 pub use target_feature::TargetFeatures;
@@ -384,7 +385,7 @@ pub fn associated_type_shorthand_candidates(
     let mut dedup_map = FxHashSet::default();
     let param_ty = Ty::new_param(interner, param, type_or_const_param_idx(db, param.into()));
     // We use the ParamEnv and not the predicates because the ParamEnv elaborates bounds.
-    let param_env = db.trait_environment(ExpressionStoreOwnerId::from(def));
+    let param_env = db.trait_environment(def);
     for clause in param_env.clauses {
         let ClauseKind::Trait(trait_clause) = clause.kind().skip_binder() else { continue };
         if trait_clause.self_ty() != param_ty {
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 5b0bcd2..fae63dd 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
@@ -18,9 +18,12 @@
     TypeAliasId, TypeOrConstParamId, TypeParamId, UnionId, VariantId,
     builtin_type::BuiltinType,
     expr_store::{ExpressionStore, path::Path},
-    hir::generics::{
-        GenericParamDataRef, GenericParams, LocalTypeOrConstParamId, TypeOrConstParamData,
-        TypeParamProvenance, WherePredicate,
+    hir::{
+        ExprId, PatId,
+        generics::{
+            GenericParamDataRef, GenericParams, LocalTypeOrConstParamId, TypeOrConstParamData,
+            TypeParamProvenance, WherePredicate,
+        },
     },
     item_tree::FieldsShape,
     lang_item::LangItems,
@@ -52,7 +55,7 @@
 use tracing::debug;
 
 use crate::{
-    ImplTraitId, Span, TyLoweringDiagnostic, TyLoweringDiagnosticKind,
+    ImplTraitId, Span, TyLoweringDiagnostic,
     consteval::{create_anon_const, path_to_const},
     db::{AnonConstId, GeneralConstId, HirDatabase, InternedOpaqueTyId},
     generics::{Generics, SingleGenerics, generics},
@@ -60,10 +63,10 @@
     next_solver::{
         AliasTy, Binder, BoundExistentialPredicates, Clause, ClauseKind, Clauses, Const, ConstKind,
         DbInterner, DefaultAny, EarlyBinder, EarlyParamRegion, ErrorGuaranteed, FnSigKind,
-        FxIndexMap, GenericArg, GenericArgs, ParamConst, ParamEnv, PolyFnSig, Predicate, Region,
-        StoredClauses, StoredEarlyBinder, StoredGenericArg, StoredGenericArgs, StoredPolyFnSig,
-        StoredTraitRef, StoredTy, TraitPredicate, TraitRef, Ty, Tys, Unnormalized, abi::Safety,
-        util::BottomUpFolder,
+        FxIndexMap, GenericArg, GenericArgs, ParamConst, ParamEnv, PatList, Pattern, PolyFnSig,
+        Predicate, Region, StoredClauses, StoredConst, StoredEarlyBinder, StoredGenericArg,
+        StoredGenericArgs, StoredPolyFnSig, StoredTraitRef, StoredTy, TraitPredicate, TraitRef, Ty,
+        Tys, Unnormalized, abi::Safety, util::BottomUpFolder,
     },
 };
 
@@ -196,9 +199,36 @@ fn as_table(&mut self) -> Option<&mut InferenceTable<'db>> {
     }
 }
 
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum LoweringMode {
+    Analysis,
+    Ide,
+}
+
+pub(crate) use self::tracked_struct_token::TrackedStructToken;
+mod tracked_struct_token {
+    use super::LoweringMode;
+
+    /// A token that is required to construct tracked structs.
+    /// This exists to prevent one from accidentally creating a tracked struct outside of a query which may happen for some codepaths.
+    pub(crate) struct TrackedStructToken {
+        // #[non_exhaustive] doesn't work for us here, we want it module focused.
+        _private: (),
+    }
+
+    impl LoweringMode {
+        pub(crate) fn allow_tracked_structs(self) -> Option<TrackedStructToken> {
+            match self {
+                LoweringMode::Analysis => Some(TrackedStructToken { _private: () }),
+                LoweringMode::Ide => None,
+            }
+        }
+    }
+}
+
 pub struct TyLoweringContext<'db, 'a> {
     pub db: &'db dyn HirDatabase,
-    interner: DbInterner<'db>,
+    pub(crate) interner: DbInterner<'db>,
     types: &'db crate::next_solver::DefaultAny<'db>,
     lang_items: &'db LangItems,
     resolver: &'a Resolver<'db>,
@@ -208,6 +238,7 @@ pub struct TyLoweringContext<'db, 'a> {
     generics: &'a OnceCell<Generics<'db>>,
     in_binders: DebruijnIndex,
     impl_trait_mode: ImplTraitLoweringState,
+    interning_mode: LoweringMode,
     /// Tracks types with explicit `?Sized` bounds.
     pub(crate) unsized_types: FxHashSet<Ty<'db>>,
     pub(crate) diagnostics: ThinVec<TyLoweringDiagnostic>,
@@ -244,6 +275,7 @@ pub fn new(
             store,
             in_binders,
             impl_trait_mode,
+            interning_mode: LoweringMode::Analysis,
             unsized_types: FxHashSet::default(),
             diagnostics: ThinVec::new(),
             lifetime_elision,
@@ -258,6 +290,11 @@ pub(crate) fn set_lifetime_elision(&mut self, lifetime_elision: LifetimeElisionK
         self.lifetime_elision = lifetime_elision;
     }
 
+    pub(crate) fn with_interning_mode(mut self, interning_mode: LoweringMode) -> Self {
+        self.interning_mode = interning_mode;
+        self
+    }
+
     pub(crate) fn with_debruijn<T>(
         &mut self,
         debruijn: DebruijnIndex,
@@ -299,8 +336,14 @@ pub fn with_infer_vars_behavior(
         self
     }
 
-    pub(crate) fn push_diagnostic(&mut self, type_ref: TypeRefId, kind: TyLoweringDiagnosticKind) {
-        self.diagnostics.push(TyLoweringDiagnostic { source: type_ref, kind });
+    pub(crate) fn push_diagnostic(&mut self, diagnostic: TyLoweringDiagnostic) {
+        self.diagnostics.push(diagnostic);
+    }
+
+    fn push_infer_vars_not_allowed(&mut self, span: Span) {
+        if !span.is_dummy() {
+            self.push_diagnostic(TyLoweringDiagnostic::InferVarsNotAllowed { source: span });
+        }
     }
 
     #[track_caller]
@@ -312,7 +355,7 @@ fn next_ty_var(&mut self, span: Span) -> Ty<'db> {
         match &mut self.infer_vars {
             Some(infer_vars) => infer_vars.next_ty_var(span),
             None => {
-                // FIXME: Emit an error: no infer vars allowed here.
+                self.push_infer_vars_not_allowed(span);
                 self.types.types.error
             }
         }
@@ -322,7 +365,7 @@ fn next_const_var(&mut self, span: Span) -> Const<'db> {
         match &mut self.infer_vars {
             Some(infer_vars) => infer_vars.next_const_var(span),
             None => {
-                // FIXME: Emit an error: no infer vars allowed here.
+                self.push_infer_vars_not_allowed(span);
                 self.types.consts.error
             }
         }
@@ -332,7 +375,7 @@ fn next_region_var(&mut self, span: Span) -> Region<'db> {
         match &mut self.infer_vars {
             Some(infer_vars) => infer_vars.next_region_var(span),
             None => {
-                // FIXME: Emit an error: no infer vars allowed here.
+                self.push_infer_vars_not_allowed(span);
                 self.types.regions.error
             }
         }
@@ -357,6 +400,14 @@ pub fn lower_ty(&mut self, type_ref: TypeRefId) -> Ty<'db> {
     }
 
     pub(crate) fn lower_const(&mut self, const_ref: ConstRef, const_type: Ty<'db>) -> Const<'db> {
+        self.lower_expr_as_const(const_ref.expr, const_type)
+    }
+
+    pub(crate) fn lower_expr_as_const(
+        &mut self,
+        expr_id: ExprId,
+        const_type: Ty<'db>,
+    ) -> Const<'db> {
         #[expect(clippy::manual_map, reason = "a `map()` here generates a borrowck error")]
         let create_var = match &mut self.infer_vars {
             Some(infer_vars) => Some(
@@ -368,11 +419,12 @@ pub(crate) fn lower_const(&mut self, const_ref: ConstRef, const_type: Ty<'db>) -
             self.interner,
             self.def,
             self.store,
-            const_ref.expr,
+            expr_id,
             self.resolver,
             const_type,
             &|| self.generics.get_or_init(|| generics(self.db, self.generic_def)),
             create_var,
+            self.interning_mode,
             self.forbid_params_after,
         );
 
@@ -528,11 +580,43 @@ pub fn lower_ty_ext(&mut self, type_ref_id: TypeRefId) -> (Ty<'db>, Option<TypeN
                     }
                 }
             }
+            &TypeRef::PatternType(ty, pat) => {
+                let ty = self.lower_ty(ty);
+                let Some(pat) = self.lower_pattern_type(pat, ty) else {
+                    return (self.types.types.error, res);
+                };
+                Ty::new_pat(self.interner, ty, pat)
+            }
             TypeRef::Error => self.types.types.error,
         };
         (ty, res)
     }
 
+    fn lower_pattern_type(&mut self, pat: PatId, ty: Ty<'db>) -> Option<Pattern<'db>> {
+        let pat_kind = match self.store[pat] {
+            hir_def::hir::Pat::Range { start: Some(start), end: Some(end), range_type: _ } => {
+                rustc_type_ir::PatternKind::Range {
+                    start: self.lower_expr_as_const(start, ty),
+                    end: self.lower_expr_as_const(end, ty),
+                }
+            }
+            hir_def::hir::Pat::NotNull => rustc_type_ir::PatternKind::NotNull,
+            hir_def::hir::Pat::Or(ref pats) => rustc_type_ir::PatternKind::Or(
+                PatList::new_from_iter(
+                    self.interner,
+                    pats.iter().map(|&pat| self.lower_pattern_type(pat, ty).ok_or(())),
+                )
+                .ok()?,
+            ),
+            hir_def::hir::Pat::Missing => return None,
+            _ => {
+                never!("pattern type can only be Range, NotNull or Or");
+                return None;
+            }
+        };
+        Some(Pattern::new(self.interner, pat_kind))
+    }
+
     fn lower_fn_ptr(&mut self, fn_: &FnType) -> Ty<'db> {
         let interner = self.interner;
         let (params, ret_ty) = fn_.split_params_and_ret();
@@ -591,7 +675,10 @@ fn on_path_diagnostic_callback<'b>(type_ref: TypeRefId) -> PathDiagnosticCallbac
             data: Either::Left(PathDiagnosticCallbackData(type_ref)),
             callback: |data, this, diag| {
                 let type_ref = data.as_ref().left().unwrap().0;
-                this.push_diagnostic(type_ref, TyLoweringDiagnosticKind::PathDiagnostic(diag))
+                this.push_diagnostic(TyLoweringDiagnostic::PathDiagnostic {
+                    source: type_ref,
+                    diag,
+                })
             },
         }
     }
@@ -1651,16 +1738,34 @@ fn const_param_types_with_diagnostics_cycle_result(
 pub(crate) fn field_types_query(
     db: &dyn HirDatabase,
     variant_id: VariantId,
-) -> &ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>> {
+) -> &ArenaMap<LocalFieldId, FieldType> {
     &field_types_with_diagnostics(db, variant_id).value
 }
 
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub struct FieldType {
+    ty: StoredEarlyBinder<StoredTy>,
+    default: Option<StoredEarlyBinder<StoredConst>>,
+}
+
+impl FieldType {
+    #[inline]
+    pub fn ty<'db>(&self) -> EarlyBinder<'db, Ty<'db>> {
+        self.ty.get()
+    }
+
+    #[inline]
+    pub fn default<'db>(&self) -> Option<EarlyBinder<'db, Const<'db>>> {
+        self.default.as_ref().map(|default| default.get_with(|it| it.as_ref()))
+    }
+}
+
 /// Build the type of all specific fields of a struct or enum variant.
 #[salsa::tracked(returns(ref))]
 pub(crate) fn field_types_with_diagnostics(
     db: &dyn HirDatabase,
     variant_id: VariantId,
-) -> TyLoweringResult<ArenaMap<LocalFieldId, StoredEarlyBinder<StoredTy>>> {
+) -> TyLoweringResult<ArenaMap<LocalFieldId, FieldType>> {
     let var_data = variant_id.fields(db);
     let fields = var_data.fields();
     if fields.is_empty() {
@@ -1684,7 +1789,15 @@ pub(crate) fn field_types_with_diagnostics(
         LifetimeElisionKind::AnonymousReportError,
     );
     for (field_id, field_data) in var_data.fields().iter() {
-        res.insert(field_id, StoredEarlyBinder::bind(ctx.lower_ty(field_data.type_ref).store()));
+        let ty = ctx.lower_ty(field_data.type_ref);
+        let default = field_data.default_value.map(|default| ctx.lower_const(default, ty));
+        res.insert(
+            field_id,
+            FieldType {
+                ty: StoredEarlyBinder::bind(ty.store()),
+                default: default.map(|default| StoredEarlyBinder::bind(default.store())),
+            },
+        );
     }
     TyLoweringResult::from_ctx(res, ctx)
 }
@@ -2072,12 +2185,12 @@ pub fn query_with_diagnostics(
 
 /// A cycle can occur from malformed code.
 fn generic_predicates_cycle_result(
-    _db: &dyn HirDatabase,
+    db: &dyn HirDatabase,
     _: salsa::Id,
     _def: GenericDefId,
 ) -> TyLoweringResult<GenericPredicates> {
     TyLoweringResult::empty(GenericPredicates::from_explicit_own_predicates(
-        StoredEarlyBinder::bind(Clauses::default().store()),
+        StoredEarlyBinder::bind(Clauses::empty(DbInterner::new_no_crate(db)).store()),
     ))
 }
 
@@ -2086,7 +2199,7 @@ impl GenericPredicates {
     pub fn empty() -> &'static GenericPredicates {
         static EMPTY: OnceLock<GenericPredicates> = OnceLock::new();
         EMPTY.get_or_init(|| GenericPredicates {
-            predicates: StoredEarlyBinder::bind(Clauses::default().store()),
+            predicates: StoredEarlyBinder::bind(Clauses::new_from_slice(&[]).store()),
             has_trait_implied_predicate: false,
             parent_explicit_self_predicates_start: 0,
             own_predicates_start: 0,
@@ -2197,12 +2310,7 @@ pub(crate) fn param_env_from_predicates<'db>(
     ParamEnv { clauses }
 }
 
-pub(crate) fn trait_environment<'db>(
-    db: &'db dyn HirDatabase,
-    def: ExpressionStoreOwnerId,
-) -> ParamEnv<'db> {
-    let def = def.generic_def(db);
-
+pub(crate) fn trait_environment<'db>(db: &'db dyn HirDatabase, def: GenericDefId) -> ParamEnv<'db> {
     return ParamEnv { clauses: trait_environment_query(db, def).as_ref() };
 
     #[salsa::tracked(returns(ref))]
@@ -2590,7 +2698,7 @@ fn fn_sig_for_struct_constructor(
     def: StructId,
 ) -> StoredEarlyBinder<StoredPolyFnSig> {
     let field_tys = db.field_types(def.into());
-    let params = field_tys.iter().map(|(_, ty)| ty.get().skip_binder());
+    let params = field_tys.iter().map(|(_, field)| field.ty().skip_binder());
     let ret = type_for_adt(db, def.into()).skip_binder();
 
     let inputs_and_output =
@@ -2606,7 +2714,7 @@ fn fn_sig_for_enum_variant_constructor(
     def: EnumVariantId,
 ) -> StoredEarlyBinder<StoredPolyFnSig> {
     let field_tys = db.field_types(def.into());
-    let params = field_tys.iter().map(|(_, ty)| ty.get().skip_binder());
+    let params = field_tys.iter().map(|(_, field)| field.ty().skip_binder());
     let parent = def.lookup(db).parent;
     let ret = type_for_adt(db, parent.into()).skip_binder();
 
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/lower/diagnostics.rs b/src/tools/rust-analyzer/crates/hir-ty/src/lower/diagnostics.rs
index 2565fb4..35ee99c 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/lower/diagnostics.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/lower/diagnostics.rs
@@ -1,17 +1,13 @@
 //! This files contains the declaration of diagnostics kinds for ty and path lowering.
 
-use hir_def::type_ref::TypeRefId;
-use hir_def::{GenericDefId, GenericParamId};
+use hir_def::{GenericDefId, GenericParamId, type_ref::TypeRefId};
+
+use crate::Span;
 
 #[derive(Debug, PartialEq, Eq, Clone)]
-pub struct TyLoweringDiagnostic {
-    pub source: TypeRefId,
-    pub kind: TyLoweringDiagnosticKind,
-}
-
-#[derive(Debug, PartialEq, Eq, Clone)]
-pub enum TyLoweringDiagnosticKind {
-    PathDiagnostic(PathLoweringDiagnostic),
+pub enum TyLoweringDiagnostic {
+    PathDiagnostic { source: TypeRefId, diag: PathLoweringDiagnostic },
+    InferVarsNotAllowed { source: Span },
 }
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs b/src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs
index ff9718a..6633215 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/lower/path.rs
@@ -994,6 +994,10 @@ pub(super) fn assoc_type_bindings_from_type_bound<'c>(
             })
         })
     }
+
+    pub(crate) fn interner(&self) -> DbInterner<'db> {
+        self.ctx.interner
+    }
 }
 
 /// A const that were parsed like a type.
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs b/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs
index 5e90e37..9e0188f 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs
@@ -35,7 +35,7 @@
 use triomphe::Arc;
 
 use crate::{
-    Span, all_super_traits,
+    InferenceDiagnostic, Span, all_super_traits,
     db::HirDatabase,
     infer::{InferenceContext, unify::InferenceTable},
     lower::GenericPredicates,
@@ -148,7 +148,7 @@ pub(crate) fn lookup_method_including_private(
         debug!("result = {:?}", result);
 
         if result.illegal_sized_bound {
-            // FIXME: Report an error.
+            self.push_diagnostic(InferenceDiagnostic::MethodCallIllegalSizedBound { call_expr });
         }
 
         self.write_expr_adj(receiver, result.adjustments);
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/confirm.rs b/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/confirm.rs
index c425e69..d960a65 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/confirm.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/confirm.rs
@@ -18,7 +18,7 @@
     Adjust, Adjustment, AutoBorrow, IncorrectGenericsLenKind, InferenceDiagnostic,
     LifetimeElisionKind, PointerCast, Span,
     db::HirDatabase,
-    infer::{AllowTwoPhase, AutoBorrowMutability, InferenceContext},
+    infer::{AllowTwoPhase, AutoBorrowMutability, ExplicitDropMethodUseKind, InferenceContext},
     lower::{
         GenericPredicates,
         path::{GenericArgsLowerer, TypeLikeConst, substs_from_args_and_bindings},
@@ -582,7 +582,9 @@ fn predicates_require_illegal_sized_bound(
     fn check_for_illegal_method_calls(&self) {
         // Disallow calls to the method `drop` defined in the `Drop` trait.
         if self.ctx.lang_items.Drop_drop.is_some_and(|drop_fn| drop_fn == self.candidate) {
-            // FIXME: Report an error.
+            self.ctx.push_diagnostic(InferenceDiagnostic::ExplicitDropMethodUse {
+                kind: ExplicitDropMethodUseKind::MethodCall(self.call_expr),
+            });
         }
     }
 
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/probe.rs b/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/probe.rs
index 4b2f0cf..84edb51 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/probe.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution/probe.rs
@@ -3,6 +3,7 @@
 
 use std::{cell::RefCell, convert::Infallible, ops::ControlFlow};
 
+use base_db::FxIndexMap;
 use hir_def::{
     AssocItemId, FunctionId, GenericParamId, ImplId, ItemContainerId, TraitId,
     hir::generics::GenericParams,
@@ -10,7 +11,7 @@
 };
 use hir_expand::name::Name;
 use rustc_ast_ir::Mutability;
-use rustc_hash::{FxHashMap, FxHashSet};
+use rustc_hash::FxHashSet;
 use rustc_type_ir::{
     InferTy, TypeVisitableExt, Upcast, Variance,
     elaborate::{self, supertrait_def_ids},
@@ -719,7 +720,7 @@ fn choose(this: ProbeContext<'_, 'db, Self>) -> Self::FinalChoice {
 
 #[derive(Debug)]
 struct ProbeAllChoice<'db> {
-    candidates: RefCell<FxHashMap<CandidateId, CandidateWithPrivate<'db>>>,
+    candidates: RefCell<FxIndexMap<CandidateId, CandidateWithPrivate<'db>>>,
     considering_visible_candidates: bool,
 }
 
@@ -1294,6 +1295,15 @@ fn pick_all_method(&mut self) -> ControlFlow<Choice::Choice> {
                     return ControlFlow::Break(by_value_pick);
                 }
 
+                if self.mode == Mode::Path {
+                    // Don't autoref in path mode.
+                    // rustc doesn't do that and it's not a big deal as non-autorefd methods take priority
+                    // and if an autorefd one is selected, we'll register the `NonAutorefdT: Trait` obligation
+                    // (which will fail) anyway. But it does have an impact when probing for all methods,
+                    // which is something we need to stay accurate.
+                    return ControlFlow::Continue(());
+                }
+
                 let autoref_pick = self.pick_autorefd_method(
                     step,
                     self_ty,
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs
index 5f61b1d..d004e3b 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir.rs
@@ -1,29 +1,31 @@
 //! MIR definitions and implementation
 
-use std::{collections::hash_map::Entry, fmt::Display, iter};
+use std::{fmt::Display, iter};
 
-use base_db::Crate;
-use either::Either;
 use hir_def::{
-    FieldId, StaticId, TupleFieldId, UnionId, VariantId,
+    FieldId, LocalFieldId, StaticId, UnionId, VariantId,
     hir::{BindingId, Expr, ExprId, Ordering, PatId},
 };
+use intern::{InternedSlice, InternedSliceRef, impl_slice_internable};
 use la_arena::{Arena, ArenaMap, Idx, RawIdx};
+use macros::{TypeFoldable, TypeVisitable};
 use rustc_ast_ir::Mutability;
 use rustc_hash::FxHashMap;
-use rustc_type_ir::inherent::{GenericArgs as _, IntoKind, Ty as _};
+use rustc_type_ir::{
+    CollectAndApply, GenericTypeVisitable,
+    inherent::{GenericArgs as _, IntoKind, Ty as _},
+};
 use smallvec::{SmallVec, smallvec};
-use stdx::{impl_from, never};
+use stdx::impl_from;
 
 use crate::{
     CallableDefId, InferBodyId, InferenceResult, MemoryMap,
-    consteval::usize_const,
     db::{HirDatabase, InternedClosureId},
-    display::{DisplayTarget, HirDisplay},
     infer::PointerCast,
     next_solver::{
         Allocation, AllocationData, DbInterner, ErrorGuaranteed, GenericArgs, ParamEnv,
         StoredAllocation, StoredConst, StoredGenericArgs, StoredTy, Ty, TyKind,
+        impl_stored_interned_slice,
         infer::{InferCtxt, traits::ObligationCause},
         obligation_ctxt::ObligationCtxt,
     },
@@ -47,8 +49,6 @@
     monomorphized_mir_body_for_closure_query, monomorphized_mir_body_query,
 };
 
-use super::consteval::try_const_usize;
-
 pub type BasicBlockId = Idx<BasicBlock>;
 pub type LocalId = Idx<Local>;
 
@@ -56,7 +56,7 @@ fn return_slot() -> LocalId {
     LocalId::from_raw(RawIdx::from(0))
 }
 
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
 pub struct Local {
     pub ty: StoredTy,
 }
@@ -145,212 +145,192 @@ fn from_fn(
     }
 }
 
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+/// The index of a field (whether of a struct/enum variant, tuple, or closure).
+/// For a struct/enum it converts from and to the LocalFieldId, for a tuple or closure it's simply the index.
+#[derive(Copy, Clone, PartialEq, Eq, Hash, salsa::Update, PartialOrd, Ord, Debug)]
+pub struct FieldIndex(pub u32);
+
+impl FieldIndex {
+    pub fn to_local_field_id(self) -> LocalFieldId {
+        LocalFieldId::from_raw(RawIdx::from_u32(self.0))
+    }
+}
+
+impl From<LocalFieldId> for FieldIndex {
+    fn from(value: LocalFieldId) -> Self {
+        FieldIndex(value.into_raw().into_u32())
+    }
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
 pub enum ProjectionElem<V: PartialEq> {
     Deref,
-    Field(Either<FieldId, TupleFieldId>),
-    // FIXME: get rid of this, and use FieldId for tuples and closures
-    ClosureField(usize),
+    /// A field (e.g., `f` in `_1.f`).
+    Field(FieldIndex),
+    /// Index into a slice/array.
     Index(V),
-    ConstantIndex { offset: u64, from_end: bool },
-    Subslice { from: u64, to: u64 },
-    //Downcast(Option<Symbol>, VariantIdx),
-    OpaqueCast(StoredTy),
+    /// These indices are generated by slice patterns.
+    ConstantIndex {
+        offset: u64,
+        from_end: bool,
+    },
+    /// These indices are generated by slice patterns.
+    Subslice {
+        from: u64,
+        to: u64,
+    },
+    /// "Downcast" to a variant of an enum or a coroutine.
+    Downcast(VariantId),
 }
 
 impl<V: PartialEq> ProjectionElem<V> {
-    pub fn projected_ty<'db>(
-        &self,
-        infcx: &InferCtxt<'db>,
-        env: ParamEnv<'db>,
-        mut base: Ty<'db>,
-        krate: Crate,
-    ) -> Ty<'db> {
-        let interner = infcx.interner;
-        let db = interner.db;
-
-        // we only bail on mir building when there are type mismatches
-        // but error types may pop up resulting in us still attempting to build the mir
-        // so just propagate the error type
-        if base.is_ty_error() {
-            return Ty::new_error(interner, ErrorGuaranteed);
-        }
-
-        if matches!(base.kind(), TyKind::Alias(..)) {
-            let mut ocx = ObligationCtxt::new(infcx);
-            match ocx.structurally_normalize_ty(&ObligationCause::dummy(), env, base) {
-                Ok(it) => base = it,
-                Err(_) => return Ty::new_error(interner, ErrorGuaranteed),
-            }
-        }
-
+    pub fn map<V2: PartialEq>(self, v: impl FnOnce(V) -> V2) -> ProjectionElem<V2> {
         match self {
-            ProjectionElem::Deref => match base.kind() {
-                TyKind::RawPtr(inner, _) | TyKind::Ref(_, inner, _) => inner,
-                TyKind::Adt(adt_def, subst) if adt_def.is_box() => subst.type_at(0),
-                _ => {
-                    never!(
-                        "Overloaded deref on type {} is not a projection",
-                        base.display(db, DisplayTarget::from_crate(db, krate))
-                    );
-                    Ty::new_error(interner, ErrorGuaranteed)
-                }
-            },
-            ProjectionElem::Field(Either::Left(f)) => match base.kind() {
-                TyKind::Adt(_, subst) => db.field_types(f.parent)[f.local_id]
-                    .get()
-                    .instantiate(interner, subst)
-                    .skip_norm_wip(),
-                ty => {
-                    never!("Only adt has field, found {:?}", ty);
-                    Ty::new_error(interner, ErrorGuaranteed)
-                }
-            },
-            ProjectionElem::Field(Either::Right(f)) => match base.kind() {
-                TyKind::Tuple(subst) => {
-                    subst.as_slice().get(f.index as usize).copied().unwrap_or_else(|| {
-                        never!("Out of bound tuple field");
-                        Ty::new_error(interner, ErrorGuaranteed)
-                    })
-                }
-                ty => {
-                    never!("Only tuple has tuple field: {:?}", ty);
-                    Ty::new_error(interner, ErrorGuaranteed)
-                }
-            },
-            ProjectionElem::ClosureField(f) => match base.kind() {
-                TyKind::Closure(_, args) => args.as_closure().tupled_upvars_ty().tuple_fields()[*f],
-                _ => {
-                    never!("Only closure has closure field");
-                    Ty::new_error(interner, ErrorGuaranteed)
-                }
-            },
-            ProjectionElem::ConstantIndex { .. } | ProjectionElem::Index(_) => match base.kind() {
-                TyKind::Array(inner, _) | TyKind::Slice(inner) => inner,
-                _ => {
-                    never!("Overloaded index is not a projection");
-                    Ty::new_error(interner, ErrorGuaranteed)
-                }
-            },
-            &ProjectionElem::Subslice { from, to } => match base.kind() {
-                TyKind::Array(inner, c) => {
-                    let next_c = usize_const(
-                        db,
-                        match try_const_usize(db, c) {
-                            None => None,
-                            Some(x) => x.checked_sub(u128::from(from + to)),
-                        },
-                        krate,
-                    );
-                    Ty::new_array_with_const_len(interner, inner, next_c)
-                }
-                TyKind::Slice(_) => base,
-                _ => {
-                    never!("Subslice projection should only happen on slice and array");
-                    Ty::new_error(interner, ErrorGuaranteed)
-                }
-            },
-            ProjectionElem::OpaqueCast(_) => {
-                never!("We don't emit these yet");
-                Ty::new_error(interner, ErrorGuaranteed)
+            ProjectionElem::Deref => ProjectionElem::Deref,
+            ProjectionElem::Field(field_index) => ProjectionElem::Field(field_index),
+            ProjectionElem::Index(idx) => ProjectionElem::Index(v(idx)),
+            ProjectionElem::ConstantIndex { offset, from_end } => {
+                ProjectionElem::ConstantIndex { offset, from_end }
             }
+            ProjectionElem::Subslice { from, to } => ProjectionElem::Subslice { from, to },
+            ProjectionElem::Downcast(variant_id) => ProjectionElem::Downcast(variant_id),
         }
     }
+
+    pub fn try_map<V2: PartialEq>(
+        self,
+        v: impl FnOnce(V) -> Option<V2>,
+    ) -> Option<ProjectionElem<V2>> {
+        Some(match self {
+            ProjectionElem::Deref => ProjectionElem::Deref,
+            ProjectionElem::Field(field_index) => ProjectionElem::Field(field_index),
+            ProjectionElem::Index(idx) => ProjectionElem::Index(v(idx)?),
+            ProjectionElem::ConstantIndex { offset, from_end } => {
+                ProjectionElem::ConstantIndex { offset, from_end }
+            }
+            ProjectionElem::Subslice { from, to } => ProjectionElem::Subslice { from, to },
+            ProjectionElem::Downcast(variant_id) => ProjectionElem::Downcast(variant_id),
+        })
+    }
 }
 
 type PlaceElem = ProjectionElem<LocalId>;
 
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
-pub struct ProjectionId(u32);
-
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub struct ProjectionStore {
-    id_to_proj: FxHashMap<ProjectionId, Box<[PlaceElem]>>,
-    proj_to_id: FxHashMap<Box<[PlaceElem]>, ProjectionId>,
+impl<W: crate::next_solver::WorldExposer> GenericTypeVisitable<W> for PlaceElem {
+    fn generic_visit_with(&self, _: &mut W) {}
 }
 
-impl Default for ProjectionStore {
-    fn default() -> Self {
-        let mut this = Self { id_to_proj: Default::default(), proj_to_id: Default::default() };
-        // Ensure that [] will get the id 0 which is used in `ProjectionId::Empty`
-        this.intern(Box::new([]));
-        this
+impl_slice_internable!(gc; ProjectionStorage, (), PlaceElem);
+impl_stored_interned_slice!(ProjectionStorage, Projection, StoredProjection);
+
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
+pub struct Projection<'db> {
+    interned: InternedSliceRef<'db, ProjectionStorage>,
+}
+
+impl<'db> std::fmt::Debug for Projection<'db> {
+    fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        (*self).as_slice().fmt(fmt)
     }
 }
 
-impl ProjectionStore {
-    pub fn shrink_to_fit(&mut self) {
-        self.id_to_proj.shrink_to_fit();
-        self.proj_to_id.shrink_to_fit();
+impl<'db> Projection<'db> {
+    pub fn new_from_iter<I, T>(args: I) -> T::Output
+    where
+        I: IntoIterator<Item = T>,
+        T: CollectAndApply<PlaceElem, Self>,
+    {
+        CollectAndApply::collect_and_apply(args.into_iter(), Self::new_from_slice)
     }
 
-    pub fn intern_if_exist(&self, projection: &[PlaceElem]) -> Option<ProjectionId> {
-        self.proj_to_id.get(projection).copied()
+    #[inline]
+    pub fn new_from_slice(slice: &[PlaceElem]) -> Self {
+        Self { interned: InternedSlice::from_header_and_slice((), slice) }
     }
 
-    pub fn intern(&mut self, projection: Box<[PlaceElem]>) -> ProjectionId {
-        let new_id = ProjectionId(self.proj_to_id.len() as u32);
-        match self.proj_to_id.entry(projection) {
-            Entry::Occupied(id) => *id.get(),
-            Entry::Vacant(e) => {
-                let key_clone = e.key().clone();
-                e.insert(new_id);
-                self.id_to_proj.insert(new_id, key_clone);
-                new_id
-            }
-        }
+    #[inline]
+    pub fn as_slice(self) -> &'db [PlaceElem] {
+        &self.interned.get().slice
+    }
+
+    pub fn project(self, projection: PlaceElem) -> Projection<'db> {
+        Projection::new_from_iter(self.as_slice().iter().copied().chain([projection]))
     }
 }
 
-impl ProjectionId {
-    pub const EMPTY: ProjectionId = ProjectionId(0);
+impl<'db> std::ops::Deref for Projection<'db> {
+    type Target = [PlaceElem];
 
-    pub fn is_empty(self) -> bool {
-        self == ProjectionId::EMPTY
-    }
-
-    pub fn lookup(self, store: &ProjectionStore) -> &[PlaceElem] {
-        store.id_to_proj.get(&self).unwrap()
-    }
-
-    pub fn project(self, projection: PlaceElem, store: &mut ProjectionStore) -> ProjectionId {
-        let mut current = self.lookup(store).to_vec();
-        current.push(projection);
-        store.intern(current.into())
+    fn deref(&self) -> &Self::Target {
+        self.as_slice()
     }
 }
 
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+impl StoredProjection {
+    // FIXME: rename to as_slice
+    pub fn lookup(&self) -> &[PlaceElem] {
+        self.as_ref().as_slice()
+    }
+
+    pub fn is_empty(&self) -> bool {
+        self.lookup().is_empty()
+    }
+}
+
+// FIXME: would be nicer to rename PlaceRef -> Place, Place -> StoredPlace, but I didn't want to blow up the diff
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct PlaceRef<'db> {
+    pub local: LocalId,
+    pub projection: Projection<'db>,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
 pub struct Place {
     pub local: LocalId,
-    pub projection: ProjectionId,
+    pub projection: StoredProjection,
 }
 
 impl Place {
-    fn is_parent(&self, child: &Place, store: &ProjectionStore) -> bool {
-        self.local == child.local
-            && child.projection.lookup(store).starts_with(self.projection.lookup(store))
-    }
-
-    /// The place itself is not included
-    fn iterate_over_parents<'a>(
-        &'a self,
-        store: &'a ProjectionStore,
-    ) -> impl Iterator<Item = Place> + 'a {
-        let projection = self.projection.lookup(store);
-        (0..projection.len()).map(|x| &projection[0..x]).filter_map(move |x| {
-            Some(Place { local: self.local, projection: store.intern_if_exist(x)? })
-        })
-    }
-
-    fn project(&self, projection: PlaceElem, store: &mut ProjectionStore) -> Place {
-        Place { local: self.local, projection: self.projection.project(projection, store) }
+    pub fn as_ref<'db>(&self) -> PlaceRef<'db> {
+        PlaceRef { local: self.local, projection: self.projection.as_ref() }
     }
 }
 
-impl From<LocalId> for Place {
+impl<'db> PlaceRef<'db> {
+    fn is_parent(&self, child: PlaceRef<'db>) -> bool {
+        self.local == child.local
+            && child.projection.as_slice().starts_with(self.projection.as_slice())
+    }
+
+    /// The place itself is not included
+    fn iterate_over_parents<'a>(&'a self) -> impl Iterator<Item = PlaceRef<'db>> + 'a {
+        let projection = self.projection.as_slice();
+        (0..projection.len()).map(move |x| PlaceRef {
+            local: self.local,
+            projection: Projection::new_from_slice(&projection[0..x]),
+        })
+    }
+
+    fn project(&self, projection: PlaceElem) -> PlaceRef<'db> {
+        PlaceRef { local: self.local, projection: self.projection.project(projection) }
+    }
+
+    pub fn store(&self) -> Place {
+        Place { local: self.local, projection: self.projection.store() }
+    }
+    pub fn ty(&self, body: &MirBody, infcx: &InferCtxt<'db>, env: ParamEnv<'db>) -> PlaceTy<'db> {
+        PlaceTy::from_ty(body.locals[self.local].ty.as_ref()).multi_projection_ty(
+            infcx,
+            env,
+            self.projection.as_slice(),
+        )
+    }
+}
+
+impl<'db> From<LocalId> for PlaceRef<'db> {
     fn from(local: LocalId) -> Self {
-        Self { local, projection: ProjectionId::EMPTY }
+        let empty: &[PlaceElem] = &[];
+        PlaceRef { local, projection: Projection::new_from_slice(empty) }
     }
 }
 
@@ -1081,7 +1061,6 @@ pub struct BasicBlock {
 
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct MirBody {
-    pub projection_store: ProjectionStore,
     pub basic_blocks: Arena<BasicBlock>,
     pub locals: Arena<Local>,
     pub start_block: BasicBlockId,
@@ -1099,15 +1078,11 @@ pub fn local_to_binding_map(&self) -> ArenaMap<LocalId, BindingId> {
         self.binding_locals.iter().map(|(it, y)| (*y, it)).collect()
     }
 
-    fn walk_places(&mut self, mut f: impl FnMut(&mut Place, &mut ProjectionStore)) {
-        fn for_operand(
-            op: &mut Operand,
-            f: &mut impl FnMut(&mut Place, &mut ProjectionStore),
-            store: &mut ProjectionStore,
-        ) {
+    fn walk_places(&mut self, mut f: impl FnMut(&mut Place)) {
+        fn for_operand(op: &mut Operand, f: &mut impl FnMut(&mut Place)) {
             match &mut op.kind {
                 OperandKind::Copy(p) | OperandKind::Move(p) => {
-                    f(p, store);
+                    f(p);
                 }
                 OperandKind::Constant { .. }
                 | OperandKind::Static(_)
@@ -1118,25 +1093,25 @@ fn for_operand(
             for statement in &mut block.statements {
                 match &mut statement.kind {
                     StatementKind::Assign(p, r) => {
-                        f(p, &mut self.projection_store);
+                        f(p);
                         match r {
                             Rvalue::ShallowInitBoxWithAlloc(_) => (),
                             Rvalue::ShallowInitBox(o, _)
                             | Rvalue::UnaryOp(_, o)
                             | Rvalue::Cast(_, o, _)
                             | Rvalue::Repeat(o, _)
-                            | Rvalue::Use(o) => for_operand(o, &mut f, &mut self.projection_store),
+                            | Rvalue::Use(o) => for_operand(o, &mut f),
                             Rvalue::CopyForDeref(p)
                             | Rvalue::Discriminant(p)
                             | Rvalue::Len(p)
-                            | Rvalue::Ref(_, p) => f(p, &mut self.projection_store),
+                            | Rvalue::Ref(_, p) => f(p),
                             Rvalue::CheckedBinaryOp(_, o1, o2) => {
-                                for_operand(o1, &mut f, &mut self.projection_store);
-                                for_operand(o2, &mut f, &mut self.projection_store);
+                                for_operand(o1, &mut f);
+                                for_operand(o2, &mut f);
                             }
                             Rvalue::Aggregate(_, ops) => {
                                 for op in ops.iter_mut() {
-                                    for_operand(op, &mut f, &mut self.projection_store);
+                                    for_operand(op, &mut f);
                                 }
                             }
                             Rvalue::ThreadLocalRef(n)
@@ -1145,9 +1120,7 @@ fn for_operand(
                             | Rvalue::NullaryOp(n) => match *n {},
                         }
                     }
-                    StatementKind::FakeRead(p) | StatementKind::Deinit(p) => {
-                        f(p, &mut self.projection_store)
-                    }
+                    StatementKind::FakeRead(p) | StatementKind::Deinit(p) => f(p),
                     StatementKind::StorageLive(_)
                     | StatementKind::StorageDead(_)
                     | StatementKind::Nop => (),
@@ -1155,9 +1128,7 @@ fn for_operand(
             }
             match &mut block.terminator {
                 Some(x) => match &mut x.kind {
-                    TerminatorKind::SwitchInt { discr, .. } => {
-                        for_operand(discr, &mut f, &mut self.projection_store)
-                    }
+                    TerminatorKind::SwitchInt { discr, .. } => for_operand(discr, &mut f),
                     TerminatorKind::FalseEdge { .. }
                     | TerminatorKind::FalseUnwind { .. }
                     | TerminatorKind::Goto { .. }
@@ -1167,24 +1138,23 @@ fn for_operand(
                     | TerminatorKind::Return
                     | TerminatorKind::Unreachable => (),
                     TerminatorKind::Drop { place, .. } => {
-                        f(place, &mut self.projection_store);
+                        f(place);
                     }
                     TerminatorKind::DropAndReplace { place, value, .. } => {
-                        f(place, &mut self.projection_store);
-                        for_operand(value, &mut f, &mut self.projection_store);
+                        f(place);
+                        for_operand(value, &mut f);
                     }
                     TerminatorKind::Call { func, args, destination, .. } => {
-                        for_operand(func, &mut f, &mut self.projection_store);
-                        args.iter_mut()
-                            .for_each(|x| for_operand(x, &mut f, &mut self.projection_store));
-                        f(destination, &mut self.projection_store);
+                        for_operand(func, &mut f);
+                        args.iter_mut().for_each(|x| for_operand(x, &mut f));
+                        f(destination);
                     }
                     TerminatorKind::Assert { cond, .. } => {
-                        for_operand(cond, &mut f, &mut self.projection_store);
+                        for_operand(cond, &mut f);
                     }
                     TerminatorKind::Yield { value, resume_arg, .. } => {
-                        for_operand(value, &mut f, &mut self.projection_store);
-                        f(resume_arg, &mut self.projection_store);
+                        for_operand(value, &mut f);
+                        f(resume_arg);
                     }
                 },
                 None => (),
@@ -1202,9 +1172,7 @@ fn shrink_to_fit(&mut self) {
             upvar_locals,
             param_locals,
             closures,
-            projection_store,
         } = self;
-        projection_store.shrink_to_fit();
         basic_blocks.shrink_to_fit();
         locals.shrink_to_fit();
         binding_locals.shrink_to_fit();
@@ -1233,3 +1201,157 @@ fn from(value: &ExprId) -> Self {
         (*value).into()
     }
 }
+
+impl<'tcx> PlaceRef<'tcx> {
+    /// If this place represents a local variable like `_X` with no
+    /// projections, return `Some(_X)`.
+    #[inline]
+    pub fn as_local(&self) -> Option<LocalId> {
+        match *self {
+            PlaceRef { local, projection } if projection.as_slice().is_empty() => Some(local),
+            _ => None,
+        }
+    }
+}
+
+/// To determine the type of a place, we need to keep track of the variant that has been downcast to, in order to find the correct fields.
+/// This type does that.
+#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, Hash, PartialEq, Eq)]
+pub struct PlaceTy<'db> {
+    pub ty: Ty<'db>,
+    /// Downcast to a particular variant of an enum or a coroutine, if included.
+    #[type_foldable(identity)]
+    #[type_visitable(ignore)]
+    pub variant_id: Option<VariantId>,
+}
+
+impl<'db> PlaceTy<'db> {
+    #[inline]
+    pub fn from_ty(ty: Ty<'db>) -> PlaceTy<'db> {
+        PlaceTy { ty, variant_id: None }
+    }
+
+    pub fn multi_projection_ty(
+        self,
+        infcx: &InferCtxt<'db>,
+        env: ParamEnv<'db>,
+        elems: &[PlaceElem],
+    ) -> PlaceTy<'db> {
+        elems.iter().fold(self, |place_ty, elem| place_ty.projection_ty(infcx, elem, env))
+    }
+
+    fn field_ty(
+        infcx: &InferCtxt<'db>,
+        self_ty: Ty<'db>,
+        variant: Option<VariantId>,
+        f: FieldIndex,
+    ) -> Ty<'db> {
+        if let Some(variant_id) = variant {
+            match self_ty.kind() {
+                TyKind::Adt(adt_def, args) if adt_def.is_enum() => {
+                    infcx.interner.db().field_types(variant_id)[f.to_local_field_id()]
+                        .ty()
+                        .instantiate(infcx.interner, args)
+                        .skip_norm_wip()
+                }
+                // FIXME TyKind::Coroutine...
+                _ => panic!("can't downcast non-adt non-coroutine type: {self_ty:?}"),
+            }
+        } else {
+            match self_ty.kind() {
+                TyKind::Adt(adt_def, args) if !adt_def.is_enum() => {
+                    let variant_id = VariantId::from_non_enum(adt_def.def_id()).unwrap();
+                    infcx.interner.db().field_types(variant_id)[f.to_local_field_id()]
+                        .ty()
+                        .instantiate(infcx.interner, args)
+                        .skip_norm_wip()
+                }
+                TyKind::Closure(_, args) => {
+                    args.as_closure().tupled_upvars_ty().tuple_fields()[f.0 as usize]
+                }
+                // FIXME TyKind::Coroutine / TyKind::CoroutineClosure...
+                TyKind::Tuple(tys) => tys
+                    .get(f.0 as usize)
+                    .cloned()
+                    .unwrap_or_else(|| panic!("field {f:?} out of range: {self_ty:?}")),
+                _ => panic!("can't project out of {self_ty:?}"),
+            }
+        }
+    }
+
+    /// Convenience wrapper around `projection_ty_core` for `PlaceElem`.
+    pub fn projection_ty<V: ::std::fmt::Debug + PartialEq>(
+        self,
+        infcx: &InferCtxt<'db>,
+        elem: &ProjectionElem<V>,
+        env: ParamEnv<'db>,
+    ) -> PlaceTy<'db> {
+        self.projection_ty_core(
+            infcx.interner,
+            elem,
+            |ty| {
+                if matches!(ty.kind(), TyKind::Alias(..)) {
+                    let mut ocx = ObligationCtxt::new(infcx);
+                    match ocx.structurally_normalize_ty(&ObligationCause::dummy(), env, ty) {
+                        Ok(it) => it,
+                        Err(_) => Ty::new_error(infcx.interner, ErrorGuaranteed),
+                    }
+                } else {
+                    ty
+                }
+            },
+            |self_ty, variant, field_id| Self::field_ty(infcx, self_ty, variant, field_id),
+        )
+    }
+
+    /// `place_ty.projection_ty_core(tcx, elem, |...| { ... })`
+    /// projects `place_ty` onto `elem`, returning the appropriate
+    /// `Ty` or downcast variant corresponding to that projection.
+    /// The `handle_field` callback must map a `FieldIndex` to its `Ty`
+    pub fn projection_ty_core<V: PartialEq + ::std::fmt::Debug>(
+        self,
+        tcx: DbInterner<'db>,
+        elem: &ProjectionElem<V>,
+        mut structurally_normalize: impl FnMut(Ty<'db>) -> Ty<'db>,
+        mut handle_field: impl FnMut(Ty<'db>, Option<VariantId>, FieldIndex /*, T*/) -> Ty<'db>,
+    ) -> PlaceTy<'db> {
+        // we only bail on mir building when there are type mismatches
+        // but error types may pop up resulting in us still attempting to build the mir
+        // so just propagate the error type
+        if self.ty.is_ty_error() {
+            return PlaceTy::from_ty(Ty::new_error(tcx, ErrorGuaranteed));
+        }
+        if self.variant_id.is_some() && !matches!(elem, ProjectionElem::Field(..)) {
+            panic!("cannot use non field projection on downcasted place")
+        }
+        match *elem {
+            ProjectionElem::Deref => {
+                let ty = structurally_normalize(self.ty).builtin_deref(true).unwrap_or_else(|| {
+                    panic!("deref projection of non-dereferenceable ty {:?}", self)
+                });
+                PlaceTy::from_ty(ty)
+            }
+            ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } => {
+                PlaceTy::from_ty(structurally_normalize(self.ty).builtin_index().unwrap())
+            }
+            ProjectionElem::Subslice { from, to /*, from_end*/ } => {
+                PlaceTy::from_ty(match structurally_normalize(self.ty).kind() {
+                    TyKind::Slice(..) => self.ty,
+                    TyKind::Array(inner, _) /*if !from_end*/ => Ty::new_array_opt(tcx, inner, to.checked_sub(from).map(|x| x.into())),
+                    // TyKind::Array(inner, size) if from_end => {
+                    //     let size = size
+                    //         .try_to_target_usize(tcx)
+                    //         .expect("expected subslice projection on fixed-size array");
+                    //     let len = size - from - to;
+                    //     Ty::new_array(tcx, *inner, len)
+                    // }
+                    _ => panic!("cannot subslice non-array type: `{:?}`", self),
+                })
+            }
+            ProjectionElem::Downcast(index) => PlaceTy { ty: self.ty, variant_id: Some(index) },
+            ProjectionElem::Field(f) => {
+                PlaceTy::from_ty(handle_field(structurally_normalize(self.ty), self.variant_id, f))
+            }
+        }
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs
index 940bc57..c5367f6 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs
@@ -16,9 +16,9 @@
     closure_analysis::ProjectionKind as HirProjectionKind,
     db::{HirDatabase, InternedClosureId},
     display::DisplayTarget,
-    mir::OperandKind,
+    mir::{OperandKind, PlaceTy},
     next_solver::{
-        DbInterner, ParamEnv, StoredTy, Ty, TypingMode,
+        DbInterner, ParamEnv, StoredTy, TypingMode,
         infer::{DbInternerInferExt, InferCtxt},
     },
 };
@@ -141,7 +141,7 @@ pub fn borrowck_query(
     let _p = tracing::info_span!("borrowck_query").entered();
     let module = def.module(db);
     let interner = DbInterner::new_with(db, module.krate(db));
-    let env = db.trait_environment(def.expression_store_owner(db));
+    let env = db.trait_environment(def.generic_def(db));
     // This calculates opaques defining scope which is a bit costly therefore is put outside `all_mir_bodies()`.
     let typing_mode = TypingMode::borrowck(interner, def.into());
     let res = all_mir_bodies(
@@ -195,21 +195,21 @@ fn moved_out_of_ref<'db>(
 ) -> Vec<MovedOutOfRef> {
     let db = infcx.interner.db;
     let mut result = vec![];
-    let mut for_operand = |op: &Operand, span: MirSpan| match op.kind {
+    let mut for_operand = |op: &Operand, span: MirSpan| match &op.kind {
         OperandKind::Copy(p) | OperandKind::Move(p) => {
-            let mut ty: Ty<'db> = body.locals[p.local].ty.as_ref();
+            let mut ty = PlaceTy::from_ty(body.locals[p.local].ty.as_ref());
             let mut is_dereference_of_ref = false;
-            for proj in p.projection.lookup(&body.projection_store) {
-                if *proj == ProjectionElem::Deref && ty.as_reference().is_some() {
+            for proj in p.projection.lookup() {
+                if *proj == ProjectionElem::Deref && ty.ty.as_reference().is_some() {
                     is_dereference_of_ref = true;
                 }
-                ty = proj.projected_ty(infcx, env, ty, body.owner.module(db).krate(db));
+                ty = ty.projection_ty(infcx, proj, env);
             }
             if is_dereference_of_ref
-                && !infcx.type_is_copy_modulo_regions(env, ty)
-                && !ty.references_non_lt_error()
+                && !infcx.type_is_copy_modulo_regions(env, ty.ty)
+                && !ty.ty.references_non_lt_error()
             {
-                result.push(MovedOutOfRef { span: op.span.unwrap_or(span), ty: ty.store() });
+                result.push(MovedOutOfRef { span: op.span.unwrap_or(span), ty: ty.ty.store() });
             }
         }
         OperandKind::Constant { .. } | OperandKind::Static(_) | OperandKind::Allocation { .. } => {}
@@ -290,12 +290,9 @@ fn partially_moved<'db>(
 ) -> Vec<PartiallyMoved> {
     let db = infcx.interner.db;
     let mut result = vec![];
-    let mut for_operand = |op: &Operand, span: MirSpan| match op.kind {
+    let mut for_operand = |op: &Operand, span: MirSpan| match &op.kind {
         OperandKind::Copy(p) | OperandKind::Move(p) => {
-            let mut ty: Ty<'db> = body.locals[p.local].ty.as_ref();
-            for proj in p.projection.lookup(&body.projection_store) {
-                ty = proj.projected_ty(infcx, env, ty, body.owner.module(db).krate(db));
-            }
+            let ty = p.as_ref().ty(body, infcx, env).ty;
             if !infcx.type_is_copy_modulo_regions(env, ty) && !ty.references_non_lt_error() {
                 result.push(PartiallyMoved { span, ty: ty.store(), local: p.local });
             }
@@ -427,23 +424,21 @@ fn place_case<'db>(
     body: &MirBody,
     lvalue: &Place,
 ) -> ProjectionCase {
-    let db = infcx.interner.db;
     let mut is_part_of = false;
-    let mut ty = body.locals[lvalue.local].ty.as_ref();
-    for proj in lvalue.projection.lookup(&body.projection_store).iter() {
+    let mut ty = PlaceTy::from_ty(body.locals[lvalue.local].ty.as_ref());
+    for proj in lvalue.projection.lookup().iter() {
         match proj {
-            ProjectionElem::Deref if ty.as_adt().is_none() => return ProjectionCase::Indirect, // It's indirect in case of reference and raw
+            ProjectionElem::Deref if ty.ty.as_adt().is_none() => return ProjectionCase::Indirect, // It's indirect in case of reference and raw
             ProjectionElem::Deref // It's direct in case of `Box<T>`
             | ProjectionElem::ConstantIndex { .. }
             | ProjectionElem::Subslice { .. }
             | ProjectionElem::Field(_)
-            | ProjectionElem::ClosureField(_)
             | ProjectionElem::Index(_) => {
                 is_part_of = true;
             }
-            ProjectionElem::OpaqueCast(_) => (),
+            ProjectionElem::Downcast(_) => (),
         }
-        ty = proj.projected_ty(infcx, env, ty, body.owner.module(db).krate(db));
+        ty = ty.projection_ty(infcx, proj, env);
     }
     if is_part_of { ProjectionCase::DirectPart } else { ProjectionCase::Direct }
 }
@@ -470,7 +465,7 @@ fn dfs(
             for statement in &block.statements {
                 match &statement.kind {
                     StatementKind::Assign(p, _) => {
-                        if p.projection.lookup(&body.projection_store).is_empty() && p.local == l {
+                        if p.projection.is_empty() && p.local == l {
                             is_ever_initialized = true;
                         }
                     }
@@ -508,9 +503,7 @@ fn dfs(
                 | TerminatorKind::Return
                 | TerminatorKind::Unreachable => (),
                 TerminatorKind::Call { target, cleanup, destination, .. } => {
-                    if destination.projection.lookup(&body.projection_store).is_empty()
-                        && destination.local == l
-                    {
+                    if destination.projection.is_empty() && destination.local == l {
                         is_ever_initialized = true;
                     }
                     target.iter().chain(cleanup).for_each(|&it| process(it, is_ever_initialized));
@@ -566,7 +559,7 @@ fn record_usage(local: LocalId, result: &mut ArenaMap<LocalId, MutabilityReason>
 }
 
 fn record_usage_for_operand(arg: &Operand, result: &mut ArenaMap<LocalId, MutabilityReason>) {
-    if let OperandKind::Copy(p) | OperandKind::Move(p) = arg.kind {
+    if let OperandKind::Copy(p) | OperandKind::Move(p) = &arg.kind {
         record_usage(p.local, result);
     }
 }
@@ -674,7 +667,7 @@ fn mutability_of_locals<'db>(
                 for arg in args.iter() {
                     record_usage_for_operand(arg, &mut result);
                 }
-                if destination.projection.lookup(&body.projection_store).is_empty() {
+                if destination.projection.is_empty() {
                     if ever_init_map.get(destination.local).copied().unwrap_or_default() {
                         push_mut_span(destination.local, terminator.span, &mut result);
                     } 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 3372f6e..eb0e4c6 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
@@ -56,8 +56,8 @@
 
 use super::{
     AggregateKind, BasicBlockId, BinOp, CastKind, LocalId, MirBody, MirLowerError, MirSpan,
-    Operand, OperandKind, Place, PlaceElem, ProjectionElem, ProjectionStore, Rvalue, StatementKind,
-    TerminatorKind, UnOp, return_slot,
+    Operand, OperandKind, Place, PlaceElem, PlaceRef, PlaceTy, ProjectionElem, Rvalue,
+    StatementKind, TerminatorKind, UnOp, return_slot,
 };
 
 mod shim;
@@ -187,7 +187,7 @@ pub struct Evaluator<'a, 'db> {
     stdout: Vec<u8>,
     stderr: Vec<u8>,
     layout_cache: RefCell<FxHashMap<Ty<'db>, Arc<Layout>>>,
-    projected_ty_cache: RefCell<FxHashMap<(Ty<'db>, PlaceElem), Ty<'db>>>,
+    projected_ty_cache: RefCell<FxHashMap<(PlaceTy<'db>, PlaceElem), PlaceTy<'db>>>,
     not_special_fn_cache: RefCell<FxHashSet<FunctionId>>,
     mir_or_dyn_index_cache: RefCell<FxHashMap<(FunctionId, GenericArgs<'db>), MirOrDynIndex<'a>>>,
     /// Constantly dropping and creating `Locals` is very costly. We store
@@ -567,26 +567,26 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 type Result<'db, T> = std::result::Result<T, MirEvalError>;
 
 #[derive(Debug, Default)]
-struct DropFlags {
-    need_drop: FxHashSet<Place>,
+struct DropFlags<'db> {
+    need_drop: FxHashSet<PlaceRef<'db>>,
 }
 
-impl DropFlags {
-    fn add_place(&mut self, p: Place, store: &ProjectionStore) {
-        if p.iterate_over_parents(store).any(|it| self.need_drop.contains(&it)) {
+impl<'db> DropFlags<'db> {
+    fn add_place(&mut self, p: PlaceRef<'db>) {
+        if p.iterate_over_parents().any(|it| self.need_drop.contains(&it)) {
             return;
         }
-        self.need_drop.retain(|it| !p.is_parent(it, store));
+        self.need_drop.retain(|it| !p.is_parent(*it));
         self.need_drop.insert(p);
     }
 
-    fn remove_place(&mut self, p: &Place, store: &ProjectionStore) -> bool {
+    fn remove_place(&mut self, p: PlaceRef<'db>) -> bool {
         // FIXME: replace parents with parts
-        if let Some(parent) = p.iterate_over_parents(store).find(|it| self.need_drop.contains(it)) {
+        if let Some(parent) = p.iterate_over_parents().find(|it| self.need_drop.contains(it)) {
             self.need_drop.remove(&parent);
             return true;
         }
-        self.need_drop.remove(p)
+        self.need_drop.remove(&p)
     }
 
     fn clear(&mut self) {
@@ -598,7 +598,7 @@ fn clear(&mut self) {
 struct Locals<'a> {
     ptr: ArenaMap<LocalId, Interval>,
     body: &'a MirBody,
-    drop_flags: DropFlags,
+    drop_flags: DropFlags<'a>,
 }
 
 pub struct MirOutput {
@@ -685,7 +685,7 @@ pub fn new(
             db,
             random_state: oorandom::Rand64::new(0),
             param_env: trait_env.unwrap_or_else(|| ParamEnvAndCrate {
-                param_env: db.trait_environment(owner.expression_store_owner(db)),
+                param_env: db.trait_environment(owner.generic_def(db)),
                 krate: crate_id,
             }),
             crate_id,
@@ -738,13 +738,13 @@ fn ptr_size(&self) -> usize {
         self.cached_ptr_size
     }
 
-    fn projected_ty(&self, ty: Ty<'db>, proj: PlaceElem) -> Ty<'db> {
+    fn projected_ty(&self, ty: PlaceTy<'db>, proj: PlaceElem) -> PlaceTy<'db> {
         let pair = (ty, proj);
         if let Some(r) = self.projected_ty_cache.borrow().get(&pair) {
             return *r;
         }
         let (ty, proj) = pair;
-        let r = proj.projected_ty(&self.infcx, self.param_env.param_env, ty, self.crate_id);
+        let r = ty.projection_ty(&self.infcx, &proj, self.param_env.param_env);
         self.projected_ty_cache.borrow_mut().insert((ty, proj), r);
         r
     }
@@ -755,14 +755,14 @@ fn place_addr_and_ty_and_metadata<'b>(
         locals: &'b Locals<'a>,
     ) -> Result<'db, (Address, Ty<'db>, Option<IntervalOrOwned>)> {
         let mut addr = locals.ptr[p.local].addr;
-        let mut ty: Ty<'db> = locals.body.locals[p.local].ty.as_ref();
+        let mut ty = PlaceTy::from_ty(locals.body.locals[p.local].ty.as_ref());
         let mut metadata: Option<IntervalOrOwned> = None; // locals are always sized
-        for proj in p.projection.lookup(&locals.body.projection_store) {
+        for proj in p.projection.lookup() {
             let prev_ty = ty;
-            ty = self.projected_ty(ty, proj.clone());
+            ty = self.projected_ty(ty, *proj);
             match proj {
                 ProjectionElem::Deref => {
-                    metadata = if self.size_align_of(ty, locals)?.is_none() {
+                    metadata = if self.size_align_of(ty.ty, locals)?.is_none() {
                         Some(
                             Interval { addr: addr.offset(self.ptr_size()), size: self.ptr_size() }
                                 .into(),
@@ -780,12 +780,12 @@ fn place_addr_and_ty_and_metadata<'b>(
                     );
                     metadata = None; // Result of index is always sized
                     let ty_size =
-                        self.size_of_sized(ty, locals, "array inner type should be sized")?;
+                        self.size_of_sized(ty.ty, locals, "array inner type should be sized")?;
                     addr = addr.offset(ty_size * offset);
                 }
                 &ProjectionElem::ConstantIndex { from_end, offset } => {
                     let offset = if from_end {
-                        let len = match prev_ty.kind() {
+                        let len = match prev_ty.ty.kind() {
                             TyKind::Array(_, c) => match try_const_usize(self.db, c) {
                                 Some(it) => it as u64,
                                 None => {
@@ -804,11 +804,11 @@ fn place_addr_and_ty_and_metadata<'b>(
                     };
                     metadata = None; // Result of index is always sized
                     let ty_size =
-                        self.size_of_sized(ty, locals, "array inner type should be sized")?;
+                        self.size_of_sized(ty.ty, locals, "array inner type should be sized")?;
                     addr = addr.offset(ty_size * offset);
                 }
                 &ProjectionElem::Subslice { from, to } => {
-                    let inner_ty = match ty.kind() {
+                    let inner_ty = match ty.ty.kind() {
                         TyKind::Array(inner, _) | TyKind::Slice(inner) => inner,
                         _ => Ty::new_error(self.interner(), ErrorGuaranteed),
                     };
@@ -825,26 +825,14 @@ fn place_addr_and_ty_and_metadata<'b>(
                         self.size_of_sized(inner_ty, locals, "array inner type should be sized")?;
                     addr = addr.offset(ty_size * (from as usize));
                 }
-                &ProjectionElem::ClosureField(f) => {
-                    let layout = self.layout(prev_ty)?;
-                    let offset = layout.fields.offset(f).bytes_usize();
-                    addr = addr.offset(offset);
-                    metadata = None;
-                }
-                ProjectionElem::Field(Either::Right(f)) => {
-                    let layout = self.layout(prev_ty)?;
-                    let offset = layout.fields.offset(f.index as usize).bytes_usize();
-                    addr = addr.offset(offset);
-                    metadata = None; // tuple field is always sized FIXME: This is wrong, the tail can be unsized
-                }
-                ProjectionElem::Field(Either::Left(f)) => {
-                    let layout = self.layout(prev_ty)?;
+                ProjectionElem::Field(f) => {
+                    let layout = self.layout(prev_ty.ty)?;
                     let variant_layout = match &layout.variants {
                         Variants::Single { .. } | Variants::Empty => &layout,
                         Variants::Multiple { variants, .. } => {
-                            &variants[match f.parent {
-                                hir_def::VariantId::EnumVariantId(it) => {
-                                    RustcEnumVariantIdx(it.lookup(self.db).index as usize)
+                            &variants[match prev_ty.variant_id {
+                                Some(hir_def::VariantId::EnumVariantId(it)) => {
+                                    RustcEnumVariantIdx(it.index(self.db))
                                 }
                                 _ => {
                                     return Err(MirEvalError::InternalError(
@@ -854,20 +842,19 @@ fn place_addr_and_ty_and_metadata<'b>(
                             }]
                         }
                     };
-                    let offset = variant_layout
-                        .fields
-                        .offset(u32::from(f.local_id.into_raw()) as usize)
-                        .bytes_usize();
+                    let offset = variant_layout.fields.offset(f.0 as usize).bytes_usize();
                     addr = addr.offset(offset);
                     // Unsized field metadata is equal to the metadata of the struct
-                    if self.size_align_of(ty, locals)?.is_some() {
+                    if self.size_align_of(ty.ty, locals)?.is_some() {
                         metadata = None;
                     }
                 }
-                ProjectionElem::OpaqueCast(_) => not_supported!("opaque cast"),
+                ProjectionElem::Downcast(_) => {
+                    // no runtime effect
+                }
             }
         }
-        Ok((addr, ty, metadata))
+        Ok((addr, ty.ty, metadata))
     }
 
     fn layout(&self, ty: Ty<'db>) -> Result<'db, Arc<Layout>> {
@@ -955,7 +942,7 @@ fn interpret_mir(
                                 let addr = self.place_addr(l, locals)?;
                                 let result = self.eval_rvalue(r, locals)?;
                                 self.copy_from_interval_or_owned(addr, result)?;
-                                locals.drop_flags.add_place(*l, &locals.body.projection_store);
+                                locals.drop_flags.add_place(l.as_ref());
                             }
                             StatementKind::Deinit(_) => not_supported!("de-init statement"),
                             StatementKind::StorageLive(_)
@@ -1008,9 +995,7 @@ fn interpret_mir(
                                 )?,
                                 it => not_supported!("unknown function type {it:?}"),
                             };
-                            locals
-                                .drop_flags
-                                .add_place(*destination, &locals.body.projection_store);
+                            locals.drop_flags.add_place(destination.as_ref());
                             if let Some(stack_frame) = stack_frame {
                                 self.code_stack.push(my_stack_frame);
                                 current_block_idx = stack_frame.locals.body.start_block;
@@ -1091,7 +1076,7 @@ fn fill_locals_for_body(
     ) -> Result<'db, ()> {
         let mut remain_args = body.param_locals.len();
         for ((l, interval), value) in locals.ptr.iter().skip(1).zip(args) {
-            locals.drop_flags.add_place(l.into(), &locals.body.projection_store);
+            locals.drop_flags.add_place(l.into());
             match value {
                 IntervalOrOwned::Owned(value) => interval.write_from_bytes(self, &value)?,
                 IntervalOrOwned::Borrowed(value) => interval.write_from_interval(self, value)?,
@@ -1594,7 +1579,7 @@ fn eval_rvalue(&mut self, r: &Rvalue, locals: &mut Locals<'a>) -> Result<'db, In
                         let max = 1i128 << (dest_bits - 1);
                         (max - 1, -max)
                     } else {
-                        (1i128 << dest_bits, 0)
+                        ((1i128 << dest_bits) - 1, 0)
                     };
                     let value = (value as i128).min(max).max(min);
                     let result = value.to_le_bytes();
@@ -1709,15 +1694,19 @@ fn coerce_unsized_look_through_fields<T>(
         if let Some(it) = goal(kind) {
             return Ok(it);
         }
-        if let TyKind::Adt(adt_ef, subst) = kind
-            && let AdtId::StructId(struct_id) = adt_ef.def_id()
-        {
-            let field_types = self.db.field_types(struct_id.into());
-            if let Some(ty) =
-                field_types.iter().last().map(|it| it.1.get().instantiate(self.interner(), subst))
-            {
-                return self.coerce_unsized_look_through_fields(ty.skip_norm_wip(), goal);
+        match kind {
+            TyKind::Adt(adt_ef, subst) if let AdtId::StructId(struct_id) = adt_ef.def_id() => {
+                let field_types = self.db.field_types(struct_id.into());
+                if let Some(ty) = field_types
+                    .iter()
+                    .last()
+                    .map(|it| it.1.ty().instantiate(self.interner(), subst))
+                {
+                    return self.coerce_unsized_look_through_fields(ty.skip_norm_wip(), goal);
+                }
             }
+            TyKind::Pat(ty, _) => return self.coerce_unsized_look_through_fields(ty, goal),
+            _ => (),
         }
         Err(MirEvalError::CoerceUnsizedError(ty.store()))
     }
@@ -1792,11 +1781,11 @@ fn unsizing_ptr_from_addr(
                         not_supported!("unsizing struct without field");
                     };
                     let target_last_field = self.db.field_types(id.into())[last_field]
-                        .get()
+                        .ty()
                         .instantiate(self.interner(), target_subst)
                         .skip_norm_wip();
                     let current_last_field = self.db.field_types(id.into())[last_field]
-                        .get()
+                        .ty()
                         .instantiate(self.interner(), current_subst)
                         .skip_norm_wip();
                     return self.unsizing_ptr_from_addr(
@@ -1837,8 +1826,7 @@ fn layout_of_variant(
                     _ => not_supported!("multi variant layout for non-enums"),
                 };
                 let mut discriminant = self.const_eval_discriminant(enum_variant_id)?;
-                let lookup = enum_variant_id.lookup(self.db);
-                let rustc_enum_variant_idx = RustcEnumVariantIdx(lookup.index as usize);
+                let rustc_enum_variant_idx = RustcEnumVariantIdx(enum_variant_id.index(self.db));
                 let variant_layout = variants[rustc_enum_variant_idx].clone();
                 let have_tag = match tag_encoding {
                     TagEncoding::Direct => true,
@@ -1912,7 +1900,7 @@ fn construct_with_layout(
     fn eval_operand(&mut self, it: &Operand, locals: &mut Locals<'a>) -> Result<'db, Interval> {
         Ok(match &it.kind {
             OperandKind::Copy(p) | OperandKind::Move(p) => {
-                locals.drop_flags.remove_place(p, &locals.body.projection_store);
+                locals.drop_flags.remove_place(p.as_ref());
                 self.eval_place(p, locals)?
             }
             OperandKind::Static(st) => {
@@ -2439,7 +2427,7 @@ fn rec<'a, 'db: 'a>(
                                 .offset(u32::from(f.into_raw()) as usize)
                                 .bytes_usize();
                             let ty = field_types[f]
-                                .get()
+                                .ty()
                                 .instantiate(this.interner(), subst)
                                 .skip_norm_wip();
                             let size = this.layout(ty)?.size.bytes_usize();
@@ -2468,7 +2456,7 @@ fn rec<'a, 'db: 'a>(
                                 let offset =
                                     l.fields.offset(u32::from(f.into_raw()) as usize).bytes_usize();
                                 let ty = field_types[f]
-                                    .get()
+                                    .ty()
                                     .instantiate(this.interner(), subst)
                                     .skip_norm_wip();
                                 let size = this.layout(ty)?.size.bytes_usize();
@@ -2554,9 +2542,9 @@ fn patch_addresses(
             }
             TyKind::Adt(id, args) => match id.def_id() {
                 AdtId::StructId(s) => {
-                    for (i, (_, ty)) in self.db.field_types(s.into()).iter().enumerate() {
+                    for (i, (_, field)) in self.db.field_types(s.into()).iter().enumerate() {
                         let offset = layout.fields.offset(i).bytes_usize();
-                        let ty = ty.get().instantiate(self.interner(), args).skip_norm_wip();
+                        let ty = field.ty().instantiate(self.interner(), args).skip_norm_wip();
                         self.patch_addresses(
                             patch_map,
                             ty_of_bytes,
@@ -2575,9 +2563,9 @@ fn patch_addresses(
                         self.read_memory(addr, layout.size.bytes_usize())?,
                         e,
                     ) {
-                        for (i, (_, ty)) in self.db.field_types(ev.into()).iter().enumerate() {
+                        for (i, (_, field)) in self.db.field_types(ev.into()).iter().enumerate() {
                             let offset = layout.fields.offset(i).bytes_usize();
-                            let ty = ty.get().instantiate(self.interner(), args).skip_norm_wip();
+                            let ty = field.ty().instantiate(self.interner(), args).skip_norm_wip();
                             self.patch_addresses(
                                 patch_map,
                                 ty_of_bytes,
@@ -3033,7 +3021,7 @@ fn drop_place(
         span: MirSpan,
     ) -> Result<'db, ()> {
         let (addr, ty, metadata) = self.place_addr_and_ty_and_metadata(place, locals)?;
-        if !locals.drop_flags.remove_place(place, &locals.body.projection_store) {
+        if !locals.drop_flags.remove_place(place.as_ref()) {
             return Ok(());
         }
         let metadata = match metadata {
@@ -3092,7 +3080,7 @@ fn run_drop_glue_deep(
                                         .bytes_usize();
                                     let addr = addr.offset(offset);
                                     let ty = field_types[field]
-                                        .get()
+                                        .ty()
                                         .instantiate(self.interner(), subst)
                                         .skip_norm_wip();
                                     self.run_drop_glue_deep(ty, locals, addr, &[], span)?;
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs
index b4a5aa8..b59d6c1 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs
@@ -1369,7 +1369,7 @@ fn size_align_of_unsized(
                     .next_back()
                     .unwrap()
                     .1
-                    .get()
+                    .ty()
                     .instantiate(self.interner(), subst)
                     .skip_norm_wip();
                 let sized_part_size =
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs
index 074c5a9..a9d0bee 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim/simd.rs
@@ -20,7 +20,7 @@ fn detect_simd_ty(&self, ty: Ty<'db>) -> Result<'db, (usize, Ty<'db>)> {
                                 not_supported!("simd type with no field");
                             };
                             let field_ty = self.db.field_types(id.into())[first_field]
-                                .get()
+                                .ty()
                                 .instantiate(self.interner(), subst)
                                 .skip_norm_wip();
                             return Ok((fields.len(), field_ty));
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 6bf966c..0e94a5b 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
@@ -1,4 +1,4 @@
-use hir_def::{GenericDefId, HasModule, signatures::FunctionSignature};
+use hir_def::{HasModule, signatures::FunctionSignature};
 use hir_expand::EditionedFileId;
 use span::Edition;
 use syntax::{TextRange, TextSize};
@@ -41,7 +41,7 @@ fn eval_main(db: &TestDB, file_id: EditionedFileId) -> Result<(String, String),
                 func_id.into(),
                 GenericArgs::empty(interner).store(),
                 crate::ParamEnvAndCrate {
-                    param_env: db.trait_environment(GenericDefId::from(func_id).into()),
+                    param_env: db.trait_environment(func_id.into()),
                     krate: func_id.krate(db),
                 }
                 .store(),
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs
index 3852db9..4359a1a 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs
@@ -5,11 +5,11 @@
 use base_db::Crate;
 use hir_def::{
     AdtId, DefWithBodyId, EnumVariantId, ExpressionStoreOwnerId, GenericParamId, HasModule,
-    ItemContainerId, LocalFieldId, Lookup, TraitId, TupleId,
+    ItemContainerId, LocalFieldId, Lookup, TraitId,
     expr_store::{Body, ExpressionStore, HygieneId, path::Path},
     hir::{
         ArithOp, Array, BinaryOp, BindingAnnotation, BindingId, ClosureKind, ExprId, ExprOrPatId,
-        LabelId, Literal, MatchArm, Pat, PatId, RecordFieldPat, RecordLitField, RecordSpread,
+        LabelId, Literal, MatchArm, Pat, PatId, RecordLitField, RecordSpread,
         generics::GenericParams,
     },
     item_tree::FieldsShape,
@@ -19,7 +19,7 @@
 };
 use hir_expand::name::Name;
 use itertools::{EitherOrBoth, Itertools};
-use la_arena::ArenaMap;
+use la_arena::{ArenaMap, RawIdx};
 use rustc_apfloat::Float;
 use rustc_hash::FxHashMap;
 use rustc_type_ir::inherent::{Const as _, GenericArgs as _, IntoKind, Ty as _};
@@ -43,11 +43,11 @@
     layout::LayoutError,
     method_resolution::CandidateId,
     mir::{
-        AggregateKind, Arena, BasicBlock, BasicBlockId, BinOp, BorrowKind, CastKind, Either, Expr,
-        FieldId, GenericArgs, Idx, InferenceResult, Local, LocalId, MemoryMap, MirBody, MirSpan,
-        Mutability, Operand, Place, PlaceElem, PointerCast, ProjectionElem, ProjectionStore,
-        RawIdx, Rvalue, Statement, StatementKind, SwitchTargets, Terminator, TerminatorKind,
-        TupleFieldId, Ty, UnOp, VariantId, return_slot,
+        AggregateKind, Arena, BasicBlock, BasicBlockId, BinOp, BorrowKind, CastKind, Expr,
+        FieldIndex, GenericArgs, Idx, InferenceResult, Local, LocalId, MemoryMap, MirBody, MirSpan,
+        Mutability, Operand, Place, PlaceElem, PointerCast, Projection, ProjectionElem, Rvalue,
+        Statement, StatementKind, SwitchTargets, Terminator, TerminatorKind, Ty, UnOp, VariantId,
+        return_slot,
     },
     next_solver::{
         Const, DbInterner, ParamConst, ParamEnv, Region, StoredGenericArgs, StoredTy, TyKind,
@@ -57,7 +57,7 @@
     },
 };
 
-use super::OperandKind;
+use super::{OperandKind, PlaceRef};
 
 mod as_place;
 mod pattern_matching;
@@ -276,10 +276,11 @@ fn unresolved_path(
         db: &dyn HirDatabase,
         p: &Path,
         display_target: DisplayTarget,
+        owner: ExpressionStoreOwnerId,
         store: &ExpressionStore,
     ) -> Self {
         Self::UnresolvedName(
-            hir_display_with_store(p, store).display(db, display_target).to_string(),
+            hir_display_with_store(p, owner, store).display(db, display_target).to_string(),
         )
     }
 }
@@ -302,7 +303,6 @@ fn new(
         let locals = Arena::new();
         let binding_locals: ArenaMap<BindingId, LocalId> = ArenaMap::new();
         let mir = MirBody {
-            projection_store: ProjectionStore::default(),
             basic_blocks,
             locals,
             start_block,
@@ -313,8 +313,8 @@ fn new(
             closures: vec![],
         };
         let store_owner = owner.expression_store_owner(db);
-        let resolver = store_owner.resolver(db);
-        let env = db.trait_environment(store_owner);
+        let resolver = owner.resolver(db);
+        let env = db.trait_environment(owner.generic_def(db));
         let interner = DbInterner::new_with(db, resolver.krate());
         // FIXME(next-solver): Is `non_body_analysis()` correct here? Don't we want to reveal opaque types defined by this body?
         let infcx = interner.infer_ctxt().build(TypingMode::non_body_analysis());
@@ -370,13 +370,16 @@ fn lower_expr_to_some_operand(
         let Some((p, current)) = self.lower_expr_as_place(current, expr_id, true)? else {
             return Ok(None);
         };
-        Ok(Some((Operand { kind: OperandKind::Copy(p), span: Some(expr_id.into()) }, current)))
+        Ok(Some((
+            Operand { kind: OperandKind::Copy(p.store()), span: Some(expr_id.into()) },
+            current,
+        )))
     }
 
     fn lower_expr_to_place_with_adjust(
         &mut self,
         expr_id: ExprId,
-        place: Place,
+        place: PlaceRef<'db>,
         current: BasicBlockId,
         adjustments: &[Adjustment],
     ) -> Result<'db, Option<BasicBlockId>> {
@@ -395,7 +398,7 @@ fn lower_expr_to_place_with_adjust(
                     self.push_assignment(
                         current,
                         place,
-                        Operand { kind: OperandKind::Copy(p), span: None }.into(),
+                        Operand { kind: OperandKind::Copy(p.store()), span: None }.into(),
                         expr_id.into(),
                     );
                     Ok(Some(current))
@@ -421,7 +424,7 @@ fn lower_expr_to_place_with_adjust(
                         place,
                         Rvalue::Cast(
                             CastKind::PointerCoercion(*cast),
-                            Operand { kind: OperandKind::Copy(p), span: None },
+                            Operand { kind: OperandKind::Copy(p.store()), span: None },
                             last.target.clone(),
                         ),
                         expr_id.into(),
@@ -436,7 +439,7 @@ fn lower_expr_to_place_with_adjust(
     fn lower_expr_to_place_with_borrow_adjust(
         &mut self,
         expr_id: ExprId,
-        place: Place,
+        place: PlaceRef<'db>,
         current: BasicBlockId,
         rest: &[Adjustment],
         m: Mutability,
@@ -447,14 +450,14 @@ fn lower_expr_to_place_with_borrow_adjust(
             return Ok(None);
         };
         let bk = BorrowKind::from_rustc_mutability(m);
-        self.push_assignment(current, place, Rvalue::Ref(bk, p), expr_id.into());
+        self.push_assignment(current, place, Rvalue::Ref(bk, p.store()), expr_id.into());
         Ok(Some(current))
     }
 
     fn lower_expr_to_place(
         &mut self,
         expr_id: ExprId,
-        place: Place,
+        place: PlaceRef<'db>,
         prev_block: BasicBlockId,
     ) -> Result<'db, Option<BasicBlockId>> {
         if let Some(adjustments) = self.infer.expr_adjustments.get(&expr_id) {
@@ -466,7 +469,7 @@ fn lower_expr_to_place(
     fn lower_expr_to_place_without_adjust(
         &mut self,
         expr_id: ExprId,
-        place: Place,
+        place: PlaceRef<'db>,
         mut current: BasicBlockId,
     ) -> Result<'db, Option<BasicBlockId>> {
         match &self.store[expr_id] {
@@ -517,6 +520,7 @@ fn lower_expr_to_place_without_adjust(
                                     self.db,
                                     p,
                                     DisplayTarget::from_crate(self.db, self.krate()),
+                                    self.owner.expression_store_owner(self.db),
                                     self.store,
                                 )
                             })?;
@@ -533,7 +537,7 @@ fn lower_expr_to_place_without_adjust(
                         self.push_assignment(
                             current,
                             place,
-                            Operand { kind: OperandKind::Copy(temp), span: None }.into(),
+                            Operand { kind: OperandKind::Copy(temp.store()), span: None }.into(),
                             expr_id.into(),
                         );
                         Ok(Some(current))
@@ -667,7 +671,7 @@ fn lower_expr_to_place_without_adjust(
                     self.lower_block_to_place(statements, current, *tail, place, expr_id.into())
                 }
             }
-            Expr::Loop { body, label } => {
+            Expr::Loop { body, label, source: _ } => {
                 self.lower_loop(current, place, *label, expr_id.into(), |this, begin| {
                     let scope = this.push_drop_scope();
                     if let Some((_, mut current)) = this.lower_expr_as_place(begin, *body, true)? {
@@ -829,7 +833,9 @@ fn lower_expr_to_place_without_adjust(
                             .as_ref()
                             .ok_or(MirLowerError::BreakWithoutLoop)?,
                     };
-                    let Some(c) = self.lower_expr_to_place(expr, loop_data.place, current)? else {
+                    let Some(c) =
+                        self.lower_expr_to_place(expr, loop_data.place.as_ref(), current)?
+                    else {
                         return Ok(None);
                     };
                     current = c;
@@ -884,10 +890,12 @@ fn lower_expr_to_place_without_adjust(
                 };
                 let variant_id =
                     self.infer.variant_resolution_for_expr(expr_id).ok_or_else(|| {
-                        MirLowerError::UnresolvedName(
-                            hir_display_with_store(path, self.store)
-                                .display(self.db, self.display_target())
-                                .to_string(),
+                        MirLowerError::unresolved_path(
+                            self.db,
+                            path,
+                            self.display_target(),
+                            self.owner.expression_store_owner(self.db),
+                            self.store,
                         )
                     })?;
                 let subst = match self.expr_ty_without_adjust(expr_id).kind() {
@@ -911,25 +919,27 @@ fn lower_expr_to_place_without_adjust(
                         let rvalue = Rvalue::Aggregate(
                             AggregateKind::Adt(variant_id, subst.store()),
                             match spread_place {
-                                Some(sp) => operands
+                                Some(sp) if let VariantId::StructId(_) = variant_id => operands
                                     .into_iter()
                                     .enumerate()
                                     .map(|(i, it)| match it {
                                         Some(it) => it,
                                         None => {
-                                            let p = sp.project(
-                                                ProjectionElem::Field(Either::Left(FieldId {
-                                                    parent: variant_id,
-                                                    local_id: LocalFieldId::from_raw(RawIdx::from(
-                                                        i as u32,
-                                                    )),
-                                                })),
-                                                &mut self.result.projection_store,
-                                            );
-                                            Operand { kind: OperandKind::Copy(p), span: None }
+                                            let p = sp.project(ProjectionElem::Field(FieldIndex(
+                                                i as u32,
+                                            )));
+                                            Operand {
+                                                kind: OperandKind::Copy(p.store()),
+                                                span: None,
+                                            }
                                         }
                                     })
                                     .collect(),
+                                Some(_) => {
+                                    return Err(MirLowerError::TypeError(
+                                        "functional record update syntax requires a struct",
+                                    ));
+                                }
                                 None => operands.into_iter().collect::<Option<_>>().ok_or(
                                     MirLowerError::TypeError("missing field in record literal"),
                                 )?,
@@ -938,19 +948,13 @@ fn lower_expr_to_place_without_adjust(
                         self.push_assignment(current, place, rvalue, expr_id.into());
                         Ok(Some(current))
                     }
-                    VariantId::UnionId(union_id) => {
+                    VariantId::UnionId(_union_id) => {
                         let [RecordLitField { name, expr }] = fields.as_ref() else {
                             not_supported!("Union record literal with more than one field");
                         };
                         let local_id =
                             variant_fields.field(name).ok_or(MirLowerError::UnresolvedField)?;
-                        let place = place.project(
-                            PlaceElem::Field(Either::Left(FieldId {
-                                parent: union_id.into(),
-                                local_id,
-                            })),
-                            &mut self.result.projection_store,
-                        );
+                        let place = place.project(PlaceElem::Field(local_id.into()));
                         self.lower_expr_to_place(*expr, place, current)
                     }
                 }
@@ -997,7 +1001,7 @@ fn lower_expr_to_place_without_adjust(
                     return Ok(None);
                 };
                 let bk = BorrowKind::from_hir_mutability(*mutability);
-                self.push_assignment(current, place, Rvalue::Ref(bk, p), expr_id.into());
+                self.push_assignment(current, place, Rvalue::Ref(bk, p.store()), expr_id.into());
                 Ok(Some(current))
             }
             Expr::Box { expr } => {
@@ -1012,7 +1016,7 @@ fn lower_expr_to_place_without_adjust(
                 else {
                     return Ok(None);
                 };
-                let p = place.project(ProjectionElem::Deref, &mut self.result.projection_store);
+                let p = place.project(ProjectionElem::Deref);
                 self.push_assignment(current, p, operand.into(), expr_id.into());
                 Ok(Some(current))
             }
@@ -1027,7 +1031,7 @@ fn lower_expr_to_place_without_adjust(
                 self.push_assignment(
                     current,
                     place,
-                    Operand { kind: OperandKind::Copy(p), span: None }.into(),
+                    Operand { kind: OperandKind::Copy(p.store()), span: None }.into(),
                     expr_id.into(),
                 );
                 Ok(Some(current))
@@ -1120,7 +1124,7 @@ fn lower_expr_to_place_without_adjust(
                     };
                     let r_value = Rvalue::CheckedBinaryOp(
                         op.into(),
-                        Operand { kind: OperandKind::Copy(lhs_place), span: None },
+                        Operand { kind: OperandKind::Copy(lhs_place.store()), span: None },
                         rhs_op,
                     );
                     self.push_assignment(current, lhs_place, r_value, expr_id.into());
@@ -1269,16 +1273,16 @@ fn lower_expr_to_place_without_adjust(
                     };
                     Ok(Place {
                         local: this.binding_local(local)?,
-                        projection: this
-                            .result
-                            .projection_store
-                            .intern(convert_closure_capture_projections(self.db, place).collect()),
+                        projection: Projection::new_from_iter(convert_closure_capture_projections(
+                            self.db, place,
+                        ))
+                        .store(),
                     })
                 };
 
                 for (place, _, sources) in &closure_data.fake_reads {
                     let p = convert_place(self, place)?;
-                    self.push_fake_read(current, p, span(sources));
+                    self.push_fake_read(current, p.as_ref(), span(sources));
                 }
 
                 let captures = closure_data.min_captures.values().flatten();
@@ -1290,14 +1294,15 @@ fn lower_expr_to_place_without_adjust(
                             let tmp_ty = capture.captured_ty(self.db);
                             // FIXME: Handle more than one span.
                             let capture_span = span(&capture.info.sources);
-                            let tmp: Place = self.temp(tmp_ty, current, capture_span)?.into();
+                            let tmp = self.temp(tmp_ty, current, capture_span)?.into();
                             self.push_assignment(
                                 current,
                                 tmp,
                                 Rvalue::Ref(BorrowKind::from_hir(bk), p),
                                 capture_span,
                             );
-                            operands.push(Operand { kind: OperandKind::Move(tmp), span: None });
+                            operands
+                                .push(Operand { kind: OperandKind::Move(tmp.store()), span: None });
                         }
                         UpvarCapture::ByValue => {
                             operands.push(Operand { kind: OperandKind::Move(p), span: None })
@@ -1389,27 +1394,28 @@ fn lower_expr_to_place_without_adjust(
                 Ok(Some(current))
             }
             Expr::Underscore => Ok(Some(current)),
+            Expr::IncludeBytes => not_supported!("include_bytes!()"),
         }
     }
 
-    fn push_field_projection(&mut self, place: &mut Place, expr_id: ExprId) -> Result<'db, ()> {
+    fn push_field_projection(
+        &mut self,
+        place: &mut PlaceRef<'db>,
+        expr_id: ExprId,
+    ) -> Result<'db, ()> {
         if let Expr::Field { expr, name } = &self.store[expr_id] {
             if let TyKind::Tuple(..) = self.expr_ty_after_adjustments(*expr).kind() {
                 let index =
                     name.as_tuple_index().ok_or(MirLowerError::TypeError("named field on tuple"))?
                         as u32;
-                *place = place.project(
-                    ProjectionElem::Field(Either::Right(TupleFieldId {
-                        tuple: TupleId(!0), // dummy as its unused
-                        index,
-                    })),
-                    &mut self.result.projection_store,
-                )
+                *place = place.project(ProjectionElem::Field(FieldIndex(index)))
             } else {
-                let field =
-                    self.infer.field_resolution(expr_id).ok_or(MirLowerError::UnresolvedField)?;
-                *place =
-                    place.project(ProjectionElem::Field(field), &mut self.result.projection_store);
+                let field = self
+                    .infer
+                    .field_resolution(expr_id)
+                    .ok_or(MirLowerError::UnresolvedField)?
+                    .either(|f| f.local_id.into(), |t| FieldIndex(t.index));
+                *place = place.project(ProjectionElem::Field(field));
             }
         } else {
             not_supported!("")
@@ -1432,6 +1438,7 @@ fn lower_literal_or_const_to_operand(
                         self.db,
                         c,
                         DisplayTarget::from_crate(db, owner.krate(db)),
+                        self.owner.expression_store_owner(self.db),
                         self.store,
                     )
                 };
@@ -1523,7 +1530,7 @@ fn lower_const(
         &mut self,
         const_id: GeneralConstId,
         prev_block: BasicBlockId,
-        place: Place,
+        place: PlaceRef<'db>,
         subst: GenericArgs<'db>,
         span: MirSpan,
     ) -> Result<'db, ()> {
@@ -1556,7 +1563,7 @@ fn lower_const_to_operand(
     fn write_bytes_to_place(
         &mut self,
         prev_block: BasicBlockId,
-        place: Place,
+        place: PlaceRef<'db>,
         cv: Box<[u8]>,
         ty: Ty<'db>,
         span: MirSpan,
@@ -1569,7 +1576,7 @@ fn lower_enum_variant(
         &mut self,
         variant_id: EnumVariantId,
         prev_block: BasicBlockId,
-        place: Place,
+        place: PlaceRef<'db>,
         ty: Ty<'db>,
         fields: Box<[Operand]>,
         span: MirSpan,
@@ -1591,7 +1598,7 @@ fn lower_call_and_args(
         &mut self,
         func: Operand,
         args: impl Iterator<Item = ExprId>,
-        place: Place,
+        place: PlaceRef<'db>,
         mut current: BasicBlockId,
         is_uninhabited: bool,
         span: MirSpan,
@@ -1616,7 +1623,7 @@ fn lower_call(
         &mut self,
         func: Operand,
         args: Box<[Operand]>,
-        place: Place,
+        place: PlaceRef<'db>,
         current: BasicBlockId,
         is_uninhabited: bool,
         span: MirSpan,
@@ -1627,7 +1634,7 @@ fn lower_call(
             TerminatorKind::Call {
                 func,
                 args,
-                destination: place,
+                destination: place.store(),
                 target: b,
                 cleanup: None,
                 from_hir_call: true,
@@ -1667,31 +1674,31 @@ fn push_statement(&mut self, block: BasicBlockId, statement: Statement) {
         self.result.basic_blocks[block].statements.push(statement);
     }
 
-    fn push_fake_read(&mut self, block: BasicBlockId, p: Place, span: MirSpan) {
-        self.push_statement(block, StatementKind::FakeRead(p).with_span(span));
+    fn push_fake_read(&mut self, block: BasicBlockId, p: PlaceRef<'db>, span: MirSpan) {
+        self.push_statement(block, StatementKind::FakeRead(p.store()).with_span(span));
     }
 
     fn push_assignment(
         &mut self,
         block: BasicBlockId,
-        place: Place,
+        place: PlaceRef<'db>,
         rvalue: Rvalue,
         span: MirSpan,
     ) {
-        self.push_statement(block, StatementKind::Assign(place, rvalue).with_span(span));
+        self.push_statement(block, StatementKind::Assign(place.store(), rvalue).with_span(span));
     }
 
-    fn discr_temp_place(&mut self, current: BasicBlockId) -> Place {
+    fn discr_temp_place(&mut self, current: BasicBlockId) -> PlaceRef<'db> {
         match &self.discr_temp {
-            Some(it) => *it,
+            Some(it) => it.as_ref(),
             None => {
                 // FIXME: rustc's ty is dependent on the adt type, maybe we need to do that as well
                 let discr_ty = Ty::new_int(self.interner(), rustc_type_ir::IntTy::I128);
-                let tmp: Place = self
+                let tmp: PlaceRef<'_> = self
                     .temp(discr_ty, current, MirSpan::Unknown)
                     .expect("discr_ty is never unsized")
                     .into();
-                self.discr_temp = Some(tmp);
+                self.discr_temp = Some(tmp.store());
                 tmp
             }
         }
@@ -1700,7 +1707,7 @@ fn discr_temp_place(&mut self, current: BasicBlockId) -> Place {
     fn lower_loop(
         &mut self,
         prev_block: BasicBlockId,
-        place: Place,
+        place: PlaceRef<'db>,
         label: Option<LabelId>,
         span: MirSpan,
         f: impl FnOnce(&mut MirLowerCtx<'_, 'db>, BasicBlockId) -> Result<'db, ()>,
@@ -1709,7 +1716,7 @@ fn lower_loop(
         let prev = self.current_loop_blocks.replace(LoopBlocks {
             begin,
             end: None,
-            place,
+            place: place.store(),
             drop_scope_index: self.drop_scopes.len(),
         });
         let prev_label = if let Some(label) = label {
@@ -1811,7 +1818,7 @@ fn lower_block_to_place(
         statements: &[hir_def::hir::Statement],
         mut current: BasicBlockId,
         tail: Option<ExprId>,
-        place: Place,
+        place: PlaceRef<'db>,
         span: MirSpan,
     ) -> Result<'db, Option<Idx<BasicBlock>>> {
         let scope = self.push_drop_scope();
@@ -2063,7 +2070,11 @@ fn emit_drop_and_storage_dead_for_scope(
                 let prev = std::mem::replace(current, self.new_basic_block());
                 self.set_terminator(
                     prev,
-                    TerminatorKind::Drop { place: l.into(), target: *current, unwind: None },
+                    TerminatorKind::Drop {
+                        place: PlaceRef::from(l).store(),
+                        target: *current,
+                        unwind: None,
+                    },
                     span,
                 );
             }
@@ -2073,35 +2084,18 @@ fn emit_drop_and_storage_dead_for_scope(
 }
 
 fn convert_closure_capture_projections(
-    db: &dyn HirDatabase,
+    _db: &dyn HirDatabase,
     place: &HirPlace,
 ) -> impl Iterator<Item = PlaceElem> {
     place.projections.iter().enumerate().map(|(i, proj)| match proj.kind {
         HirProjectionKind::Deref => ProjectionElem::Deref,
-        HirProjectionKind::Field { field_idx, variant_idx } => {
+        HirProjectionKind::Field { field_idx, variant_idx: _ } => {
             let ty = place.ty_before_projection(i);
             match ty.kind() {
-                TyKind::Tuple(_) => {
-                    ProjectionElem::Field(Either::Right(TupleFieldId {
-                        tuple: TupleId(!0), // Dummy as it's unused
-                        index: field_idx,
-                    }))
-                }
-                TyKind::Adt(adt_def, _) => {
+                TyKind::Tuple(_) => ProjectionElem::Field(FieldIndex(field_idx)),
+                TyKind::Adt(_, _) => {
                     let local_field_id = LocalFieldId::from_raw(RawIdx::from_u32(field_idx));
-                    let field = match adt_def.def_id() {
-                        AdtId::StructId(id) => {
-                            FieldId { parent: id.into(), local_id: local_field_id }
-                        }
-                        AdtId::UnionId(id) => {
-                            FieldId { parent: id.into(), local_id: local_field_id }
-                        }
-                        AdtId::EnumId(id) => {
-                            let variant = id.enum_variants(db).variants[variant_idx as usize].0;
-                            FieldId { parent: variant.into(), local_id: local_field_id }
-                        }
-                    };
-                    ProjectionElem::Field(Either::Left(field))
+                    ProjectionElem::Field(local_field_id.into())
                 }
                 _ => panic!("unexpected type"),
             }
@@ -2194,18 +2188,21 @@ pub fn mir_body_for_closure_query<'db>(
         if is_by_ref_closure {
             projections.push(ProjectionElem::Deref);
         }
-        projections.push(ProjectionElem::ClosureField(capture_idx));
+        projections.push(ProjectionElem::Field(FieldIndex(capture_idx as u32)));
         let capture_param_place = Place {
             local: closure_local,
-            projection: ctx.result.projection_store.intern(projections.into_boxed_slice()),
+            projection: Projection::new_from_slice(&projections).store(),
         };
-        let capture_local_place = Place {
-            local: capture_local,
-            projection: ctx.result.projection_store.intern(Box::new([])),
-        };
+        let capture_local_place =
+            Place { local: capture_local, projection: Projection::new_from_slice(&[]).store() };
         let capture_local_rvalue =
             Rvalue::Use(Operand { kind: OperandKind::Move(capture_param_place), span: None });
-        ctx.push_assignment(current, capture_local_place, capture_local_rvalue, MirSpan::Unknown);
+        ctx.push_assignment(
+            current,
+            capture_local_place.as_ref(),
+            capture_local_rvalue,
+            MirSpan::Unknown,
+        );
 
         let local = capture.captured_local();
         let local = ctx.binding_local(local)?;
@@ -2223,10 +2220,9 @@ pub fn mir_body_for_closure_query<'db>(
         let current = ctx.pop_drop_scope_assert_finished(current, root.into())?;
         ctx.set_terminator(current, TerminatorKind::Return, (*root).into());
     }
-
     let mut err = None;
-    ctx.result.walk_places(|mir_place, store| {
-        let mir_projections = mir_place.projection.lookup(store);
+    ctx.result.walk_places(|mir_place| {
+        let mir_projections = mir_place.projection.lookup();
         if let Some(hir_places) = upvar_map.get(&mir_place.local) {
             let projections = hir_places.iter().find_map(|hir_place| {
                 let iter = mir_projections
@@ -2262,18 +2258,17 @@ pub fn mir_body_for_closure_query<'db>(
             match projections {
                 Some((skip_projections_up_to, (hir_place, upvar_local))) => {
                     mir_place.local = *upvar_local;
-                    let mut result_projections = Vec::with_capacity(
-                        usize::from(hir_place.is_by_ref())
-                            + (mir_projections.len() - skip_projections_up_to),
-                    );
-                    if hir_place.is_by_ref() {
-                        result_projections.push(ProjectionElem::Deref);
-                    }
-                    result_projections
-                        .extend(mir_projections[skip_projections_up_to..].iter().cloned());
-                    mir_place.projection = store.intern(result_projections.into());
+                    let maybe_deref: &[PlaceElem] =
+                        if hir_place.is_by_ref() { &[ProjectionElem::Deref] } else { &[] };
+                    mir_place.projection = Projection::new_from_iter(
+                        maybe_deref
+                            .iter()
+                            .copied()
+                            .chain(mir_projections[skip_projections_up_to..].iter().copied()),
+                    )
+                    .store();
                 }
-                None => err = Some(*mir_place),
+                None => err = Some(mir_place.clone()),
             }
         }
     });
@@ -2309,10 +2304,7 @@ pub fn mir_body_query<'db>(db: &'db dyn HirDatabase, def: InferBodyId) -> Result
             .to_string(),
         InferBodyId::DefWithBodyId(DefWithBodyId::VariantId(it)) => {
             let loc = it.lookup(db);
-            loc.parent.enum_variants(db).variants[loc.index as usize]
-                .1
-                .display(db, edition)
-                .to_string()
+            loc.name.display(db, edition).to_string()
         }
         InferBodyId::AnonConstId(_) => "{const}".to_owned(),
     };
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/as_place.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/as_place.rs
index 2ed7aed..71014eb 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/as_place.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/as_place.rs
@@ -1,7 +1,7 @@
 //! MIR lowering for places
 
 use hir_def::FunctionId;
-use rustc_type_ir::inherent::{Region as _, Ty as _};
+use rustc_type_ir::inherent::Region as _;
 
 use super::*;
 use crate::{
@@ -14,15 +14,14 @@ fn lower_expr_to_some_place_without_adjust(
         &mut self,
         expr_id: ExprId,
         prev_block: BasicBlockId,
-    ) -> Result<'db, Option<(Place, BasicBlockId)>> {
+    ) -> Result<'db, Option<(PlaceRef<'db>, BasicBlockId)>> {
         let ty = self.expr_ty_without_adjust(expr_id);
-        let place = self.temp(ty, prev_block, expr_id.into())?;
-        let Some(current) =
-            self.lower_expr_to_place_without_adjust(expr_id, place.into(), prev_block)?
+        let place = self.temp(ty, prev_block, expr_id.into())?.into();
+        let Some(current) = self.lower_expr_to_place_without_adjust(expr_id, place, prev_block)?
         else {
             return Ok(None);
         };
-        Ok(Some((place.into(), current)))
+        Ok(Some((place, current)))
     }
 
     fn lower_expr_to_some_place_with_adjust(
@@ -30,18 +29,18 @@ fn lower_expr_to_some_place_with_adjust(
         expr_id: ExprId,
         prev_block: BasicBlockId,
         adjustments: &[Adjustment],
-    ) -> Result<'db, Option<(Place, BasicBlockId)>> {
+    ) -> Result<'db, Option<(PlaceRef<'db>, BasicBlockId)>> {
         let ty = adjustments
             .last()
             .map(|it| it.target.as_ref())
             .unwrap_or_else(|| self.expr_ty_without_adjust(expr_id));
-        let place = self.temp(ty, prev_block, expr_id.into())?;
+        let place = self.temp(ty, prev_block, expr_id.into())?.into();
         let Some(current) =
-            self.lower_expr_to_place_with_adjust(expr_id, place.into(), prev_block, adjustments)?
+            self.lower_expr_to_place_with_adjust(expr_id, place, prev_block, adjustments)?
         else {
             return Ok(None);
         };
-        Ok(Some((place.into(), current)))
+        Ok(Some((place, current)))
     }
 
     pub(super) fn lower_expr_as_place_with_adjust(
@@ -50,7 +49,7 @@ pub(super) fn lower_expr_as_place_with_adjust(
         expr_id: ExprId,
         upgrade_rvalue: bool,
         adjustments: &[Adjustment],
-    ) -> Result<'db, Option<(Place, BasicBlockId)>> {
+    ) -> Result<'db, Option<(PlaceRef<'db>, BasicBlockId)>> {
         let try_rvalue = |this: &mut MirLowerCtx<'_, 'db>| {
             if !upgrade_rvalue {
                 return Err(MirLowerError::MutatingRvalue);
@@ -69,7 +68,7 @@ pub(super) fn lower_expr_as_place_with_adjust(
                     else {
                         return Ok(None);
                     };
-                    it.0 = it.0.project(ProjectionElem::Deref, &mut self.result.projection_store);
+                    it.0 = it.0.project(ProjectionElem::Deref);
                     Ok(Some(it))
                 }
                 Adjust::Deref(Some(od)) => {
@@ -108,7 +107,7 @@ pub(super) fn lower_expr_as_place(
         current: BasicBlockId,
         expr_id: ExprId,
         upgrade_rvalue: bool,
-    ) -> Result<'db, Option<(Place, BasicBlockId)>> {
+    ) -> Result<'db, Option<(PlaceRef<'db>, BasicBlockId)>> {
         match self.infer.expr_adjustments.get(&expr_id) {
             Some(a) => self.lower_expr_as_place_with_adjust(current, expr_id, upgrade_rvalue, a),
             None => self.lower_expr_as_place_without_adjust(current, expr_id, upgrade_rvalue),
@@ -120,7 +119,7 @@ pub(super) fn lower_expr_as_place_without_adjust(
         current: BasicBlockId,
         expr_id: ExprId,
         upgrade_rvalue: bool,
-    ) -> Result<'db, Option<(Place, BasicBlockId)>> {
+    ) -> Result<'db, Option<(PlaceRef<'db>, BasicBlockId)>> {
         let try_rvalue = |this: &mut MirLowerCtx<'_, 'db>| {
             if !upgrade_rvalue {
                 return Err(MirLowerError::MutatingRvalue);
@@ -149,17 +148,14 @@ pub(super) fn lower_expr_as_place_without_adjust(
                             ty,
                             Mutability::Not,
                         );
-                        let temp: Place = self.temp(ref_ty, current, expr_id.into())?.into();
+                        let temp = self.temp(ref_ty, current, expr_id.into())?.into();
                         self.push_assignment(
                             current,
                             temp,
                             Operand { kind: OperandKind::Static(s), span: None }.into(),
                             expr_id.into(),
                         );
-                        Ok(Some((
-                            temp.project(ProjectionElem::Deref, &mut self.result.projection_store),
-                            current,
-                        )))
+                        Ok(Some((temp.project(ProjectionElem::Deref), current)))
                     }
                     _ => try_rvalue(self),
                 }
@@ -193,7 +189,7 @@ pub(super) fn lower_expr_as_place_without_adjust(
                 let Some((mut r, current)) = self.lower_expr_as_place(current, *expr, true)? else {
                     return Ok(None);
                 };
-                r = r.project(ProjectionElem::Deref, &mut self.result.projection_store);
+                r = r.project(ProjectionElem::Deref);
                 Ok(Some((r, current)))
             }
             Expr::UnaryOp { .. } => try_rvalue(self),
@@ -256,8 +252,7 @@ pub(super) fn lower_expr_as_place_without_adjust(
                 else {
                     return Ok(None);
                 };
-                p_base = p_base
-                    .project(ProjectionElem::Index(l_index), &mut self.result.projection_store);
+                p_base = p_base.project(ProjectionElem::Index(l_index));
                 Ok(Some((p_base, current)))
             }
             _ => try_rvalue(self),
@@ -267,20 +262,20 @@ pub(super) fn lower_expr_as_place_without_adjust(
     fn lower_overloaded_index(
         &mut self,
         current: BasicBlockId,
-        place: Place,
+        place: PlaceRef<'db>,
         base_ty: Ty<'db>,
         result_ty: Ty<'db>,
         index_operand: Operand,
         span: MirSpan,
         index_fn: (FunctionId, GenericArgs<'db>),
-    ) -> Result<'db, Option<(Place, BasicBlockId)>> {
+    ) -> Result<'db, Option<(PlaceRef<'db>, BasicBlockId)>> {
         let mutability = match base_ty.as_reference() {
             Some((_, _, mutability)) => mutability,
             None => Mutability::Not,
         };
         let result_ref =
             Ty::new_ref(self.interner(), Region::error(self.interner()), result_ty, mutability);
-        let mut result: Place = self.temp(result_ref, current, span)?.into();
+        let mut result = self.temp(result_ref, current, span)?.into();
         let index_fn_op = Operand::const_zst(Ty::new_fn_def(
             self.interner(),
             CallableDefId::FunctionId(index_fn.0).into(),
@@ -288,7 +283,10 @@ fn lower_overloaded_index(
         ));
         let Some(current) = self.lower_call(
             index_fn_op,
-            Box::new([Operand { kind: OperandKind::Copy(place), span: None }, index_operand]),
+            Box::new([
+                Operand { kind: OperandKind::Copy(place.store()), span: None },
+                index_operand,
+            ]),
             result,
             current,
             false,
@@ -297,19 +295,19 @@ fn lower_overloaded_index(
         else {
             return Ok(None);
         };
-        result = result.project(ProjectionElem::Deref, &mut self.result.projection_store);
+        result = result.project(ProjectionElem::Deref);
         Ok(Some((result, current)))
     }
 
     fn lower_overloaded_deref(
         &mut self,
         current: BasicBlockId,
-        place: Place,
+        place: PlaceRef<'db>,
         source_ty: Ty<'db>,
         target_ty: Ty<'db>,
         span: MirSpan,
         mutability: bool,
-    ) -> Result<'db, Option<(Place, BasicBlockId)>> {
+    ) -> Result<'db, Option<(PlaceRef<'db>, BasicBlockId)>> {
         let lang_items = self.lang_items();
         let (mutability, deref_fn, borrow_kind) = if !mutability {
             (Mutability::Not, lang_items.Deref_deref, BorrowKind::Shared)
@@ -323,18 +321,18 @@ fn lower_overloaded_deref(
         let error_region = Region::error(self.interner());
         let ty_ref = Ty::new_ref(self.interner(), error_region, source_ty, mutability);
         let target_ty_ref = Ty::new_ref(self.interner(), error_region, target_ty, mutability);
-        let ref_place: Place = self.temp(ty_ref, current, span)?.into();
-        self.push_assignment(current, ref_place, Rvalue::Ref(borrow_kind, place), span);
+        let ref_place = self.temp(ty_ref, current, span)?.into();
+        self.push_assignment(current, ref_place, Rvalue::Ref(borrow_kind, place.store()), span);
         let deref_fn = deref_fn.ok_or(MirLowerError::LangItemNotFound)?;
         let deref_fn_op = Operand::const_zst(Ty::new_fn_def(
             self.interner(),
             CallableDefId::FunctionId(deref_fn).into(),
             GenericArgs::new_from_slice(&[source_ty.into()]),
         ));
-        let mut result: Place = self.temp(target_ty_ref, current, span)?.into();
+        let mut result = self.temp(target_ty_ref, current, span)?.into();
         let Some(current) = self.lower_call(
             deref_fn_op,
-            Box::new([Operand { kind: OperandKind::Copy(ref_place), span: None }]),
+            Box::new([Operand { kind: OperandKind::Copy(ref_place.store()), span: None }]),
             result,
             current,
             false,
@@ -343,7 +341,7 @@ fn lower_overloaded_deref(
         else {
             return Ok(None);
         };
-        result = result.project(ProjectionElem::Deref, &mut self.result.projection_store);
+        result = result.project(ProjectionElem::Deref);
         Ok(Some((result, current)))
     }
 }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
index c924c5b..f273a82 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower/pattern_matching.rs
@@ -1,17 +1,19 @@
 //! MIR lowering for patterns
 
-use hir_def::{hir::ExprId, signatures::VariantFields};
+use hir_def::{
+    hir::{ExprId, RecordFieldPat},
+    signatures::VariantFields,
+};
 use rustc_type_ir::inherent::{IntoKind, Ty as _};
 
 use crate::{
     BindingMode, ByRef,
     mir::{
-        LocalId, MutBorrowKind, Operand, OperandKind,
+        FieldIndex, LocalId, MutBorrowKind, Operand, OperandKind, PlaceRef, Projection,
         lower::{
-            BasicBlockId, BinOp, BindingId, BorrowKind, Either, Expr, FieldId, Idx, MemoryMap,
-            MirLowerCtx, MirLowerError, MirSpan, Pat, PatId, Place, PlaceElem, ProjectionElem,
-            RecordFieldPat, ResolveValueResult, Result, Rvalue, SwitchTargets, TerminatorKind,
-            TupleFieldId, TupleId, Ty, TyKind, ValueNs, VariantId,
+            BasicBlockId, BinOp, BindingId, BorrowKind, Expr, Idx, MemoryMap, MirLowerCtx,
+            MirLowerError, MirSpan, Pat, PatId, PlaceElem, ProjectionElem, ResolveValueResult,
+            Result, Rvalue, SwitchTargets, TerminatorKind, Ty, TyKind, ValueNs, VariantId,
         },
     },
 };
@@ -65,7 +67,7 @@ pub(super) fn pattern_match(
         &mut self,
         current: BasicBlockId,
         current_else: Option<BasicBlockId>,
-        cond_place: Place,
+        cond_place: PlaceRef<'db>,
         pattern: PatId,
     ) -> Result<'db, (BasicBlockId, Option<BasicBlockId>)> {
         let (current, current_else) = self.pattern_match_inner(
@@ -88,7 +90,7 @@ pub(super) fn pattern_match(
     pub(super) fn pattern_match_assignment(
         &mut self,
         current: BasicBlockId,
-        value: Place,
+        value: PlaceRef<'db>,
         pattern: PatId,
     ) -> Result<'db, BasicBlockId> {
         let (current, _) =
@@ -116,23 +118,23 @@ fn pattern_match_inner(
         &mut self,
         mut current: BasicBlockId,
         mut current_else: Option<BasicBlockId>,
-        mut cond_place: Place,
+        mut cond_place: PlaceRef<'db>,
         pattern: PatId,
         mode: MatchingMode,
     ) -> Result<'db, (BasicBlockId, Option<BasicBlockId>)> {
         let cnt = self.infer.pat_adjustments.get(&pattern).map(|x| x.len()).unwrap_or_default();
-        cond_place.projection = self.result.projection_store.intern(
+        cond_place.projection = Projection::new_from_iter(
             cond_place
                 .projection
-                .lookup(&self.result.projection_store)
+                .as_slice()
                 .iter()
                 .cloned()
-                .chain((0..cnt).map(|_| ProjectionElem::Deref))
-                .collect::<Vec<_>>()
-                .into(),
+                .chain((0..cnt).map(|_| ProjectionElem::Deref)),
         );
         Ok(match &self.store[pattern] {
-            Pat::Missing | Pat::Rest => return Err(MirLowerError::IncompletePattern),
+            Pat::Missing | Pat::Rest | Pat::NotNull => {
+                return Err(MirLowerError::IncompletePattern);
+            }
             Pat::Wild => (current, current_else),
             Pat::Tuple { args, ellipsis } => {
                 let subst = match self.infer.pat_ty(pattern).kind() {
@@ -148,12 +150,7 @@ fn pattern_match_inner(
                     current_else,
                     args,
                     *ellipsis,
-                    (0..subst.len()).map(|i| {
-                        PlaceElem::Field(Either::Right(TupleFieldId {
-                            tuple: TupleId(!0), // Dummy as it is unused
-                            index: i as u32,
-                        }))
-                    }),
+                    (0..subst.len()).map(|i| PlaceElem::Field(FieldIndex(i as u32))),
                     &cond_place,
                     mode,
                 )?
@@ -213,7 +210,7 @@ fn pattern_match_inner(
                         self.lower_literal_or_const_to_operand(self.infer.pat_ty(pattern), l)?;
                     let else_target = *current_else.get_or_insert_with(|| self.new_basic_block());
                     let next = self.new_basic_block();
-                    let discr: Place =
+                    let discr =
                         self.temp(Ty::new_bool(self.interner()), current, pattern.into())?.into();
                     self.push_assignment(
                         current,
@@ -221,11 +218,11 @@ fn pattern_match_inner(
                         Rvalue::CheckedBinaryOp(
                             binop,
                             lv,
-                            Operand { kind: OperandKind::Copy(cond_place), span: None },
+                            Operand { kind: OperandKind::Copy(cond_place.store()), span: None },
                         ),
                         pattern.into(),
                     );
-                    let discr = Operand { kind: OperandKind::Copy(discr), span: None };
+                    let discr = Operand { kind: OperandKind::Copy(discr.store()), span: None };
                     self.set_terminator(
                         current,
                         TerminatorKind::SwitchInt {
@@ -261,13 +258,13 @@ fn pattern_match_inner(
                     // emit runtime length check for slice
                     if let TyKind::Slice(_) = pat_ty.kind() {
                         let pattern_len = prefix.len() + suffix.len();
-                        let place_len: Place = self
+                        let place_len = self
                             .temp(Ty::new_usize(self.interner()), current, pattern.into())?
                             .into();
                         self.push_assignment(
                             current,
                             place_len,
-                            Rvalue::Len(cond_place),
+                            Rvalue::Len(cond_place.store()),
                             pattern.into(),
                         );
                         let else_target =
@@ -278,7 +275,7 @@ fn pattern_match_inner(
                                 current,
                                 TerminatorKind::SwitchInt {
                                     discr: Operand {
-                                        kind: OperandKind::Copy(place_len),
+                                        kind: OperandKind::Copy(place_len.store()),
                                         span: None,
                                     },
                                     targets: SwitchTargets::static_if(
@@ -295,7 +292,7 @@ fn pattern_match_inner(
                                 MemoryMap::default(),
                                 Ty::new_usize(self.interner()),
                             );
-                            let discr: Place = self
+                            let discr = self
                                 .temp(Ty::new_bool(self.interner()), current, pattern.into())?
                                 .into();
                             self.push_assignment(
@@ -304,11 +301,15 @@ fn pattern_match_inner(
                                 Rvalue::CheckedBinaryOp(
                                     BinOp::Le,
                                     c,
-                                    Operand { kind: OperandKind::Copy(place_len), span: None },
+                                    Operand {
+                                        kind: OperandKind::Copy(place_len.store()),
+                                        span: None,
+                                    },
                                 ),
                                 pattern.into(),
                             );
-                            let discr = Operand { kind: OperandKind::Copy(discr), span: None };
+                            let discr =
+                                Operand { kind: OperandKind::Copy(discr.store()), span: None };
                             self.set_terminator(
                                 current,
                                 TerminatorKind::SwitchInt {
@@ -322,10 +323,10 @@ fn pattern_match_inner(
                     }
                 }
                 for (i, &pat) in prefix.iter().enumerate() {
-                    let next_place = cond_place.project(
-                        ProjectionElem::ConstantIndex { offset: i as u64, from_end: false },
-                        &mut self.result.projection_store,
-                    );
+                    let next_place = cond_place.project(ProjectionElem::ConstantIndex {
+                        offset: i as u64,
+                        from_end: false,
+                    });
                     (current, current_else) =
                         self.pattern_match_inner(current, current_else, next_place, pat, mode)?;
                 }
@@ -333,13 +334,10 @@ fn pattern_match_inner(
                     && mode != MatchingMode::Check
                     && let Pat::Bind { id, subpat: _ } = self.store[slice]
                 {
-                    let next_place = cond_place.project(
-                        ProjectionElem::Subslice {
-                            from: prefix.len() as u64,
-                            to: suffix.len() as u64,
-                        },
-                        &mut self.result.projection_store,
-                    );
+                    let next_place = cond_place.project(ProjectionElem::Subslice {
+                        from: prefix.len() as u64,
+                        to: suffix.len() as u64,
+                    });
                     let mode = self.infer.binding_modes[slice];
                     (current, current_else) = self.pattern_match_binding(
                         id,
@@ -351,10 +349,10 @@ fn pattern_match_inner(
                     )?;
                 }
                 for (i, &pat) in suffix.iter().enumerate() {
-                    let next_place = cond_place.project(
-                        ProjectionElem::ConstantIndex { offset: i as u64, from_end: true },
-                        &mut self.result.projection_store,
-                    );
+                    let next_place = cond_place.project(ProjectionElem::ConstantIndex {
+                        offset: i as u64,
+                        from_end: true,
+                    });
                     (current, current_else) =
                         self.pattern_match_inner(current, current_else, next_place, pat, mode)?;
                 }
@@ -376,6 +374,7 @@ fn pattern_match_inner(
                             self.db,
                             p,
                             self.display_target(),
+                            self.owner.expression_store_owner(self.db),
                             self.store,
                         )
                     };
@@ -417,19 +416,19 @@ fn pattern_match_inner(
                         }
                         not_supported!("path in pattern position that is not const or variant")
                     };
-                    let tmp: Place =
+                    let tmp =
                         self.temp(self.infer.pat_ty(pattern), current, pattern.into())?.into();
                     let span = pattern.into();
                     self.lower_const(c.into(), current, tmp, subst, span)?;
-                    let tmp2: Place =
+                    let tmp2 =
                         self.temp(Ty::new_bool(self.interner()), current, pattern.into())?.into();
                     self.push_assignment(
                         current,
                         tmp2,
                         Rvalue::CheckedBinaryOp(
                             BinOp::Eq,
-                            Operand { kind: OperandKind::Copy(tmp), span: None },
-                            Operand { kind: OperandKind::Copy(cond_place), span: None },
+                            Operand { kind: OperandKind::Copy(tmp.store()), span: None },
+                            Operand { kind: OperandKind::Copy(cond_place.store()), span: None },
                         ),
                         span,
                     );
@@ -438,7 +437,7 @@ fn pattern_match_inner(
                     self.set_terminator(
                         current,
                         TerminatorKind::SwitchInt {
-                            discr: Operand { kind: OperandKind::Copy(tmp2), span: None },
+                            discr: Operand { kind: OperandKind::Copy(tmp2.store()), span: None },
                             targets: SwitchTargets::static_if(1, next, else_target),
                         },
                         span,
@@ -491,8 +490,7 @@ fn pattern_match_inner(
                 )?
             }
             Pat::Ref { pat, mutability: _ } => {
-                let cond_place =
-                    cond_place.project(ProjectionElem::Deref, &mut self.result.projection_store);
+                let cond_place = cond_place.project(ProjectionElem::Deref);
                 self.pattern_match_inner(current, current_else, cond_place, *pat, mode)?
             }
             &Pat::Expr(expr) => {
@@ -507,7 +505,7 @@ fn pattern_match_inner(
                 self.push_assignment(
                     current,
                     lhs_place,
-                    Operand { kind: OperandKind::Copy(cond_place), span: None }.into(),
+                    Operand { kind: OperandKind::Copy(cond_place.store()), span: None }.into(),
                     expr.into(),
                 );
                 (current, current_else)
@@ -522,7 +520,7 @@ fn pattern_match_binding(
         &mut self,
         id: BindingId,
         mode: BindingMode,
-        cond_place: Place,
+        cond_place: PlaceRef<'db>,
         span: MirSpan,
         current: BasicBlockId,
         current_else: Option<BasicBlockId>,
@@ -538,7 +536,7 @@ fn push_match_assignment(
         current: BasicBlockId,
         target_place: LocalId,
         mode: BindingMode,
-        cond_place: Place,
+        cond_place: PlaceRef<'db>,
         span: MirSpan,
     ) {
         self.push_assignment(
@@ -546,14 +544,15 @@ fn push_match_assignment(
             target_place.into(),
             match mode {
                 BindingMode(ByRef::No, _) => {
-                    Operand { kind: OperandKind::Copy(cond_place), span: None }.into()
+                    Operand { kind: OperandKind::Copy(cond_place.store()), span: None }.into()
                 }
                 BindingMode(ByRef::Yes(rustc_ast_ir::Mutability::Not), _) => {
-                    Rvalue::Ref(BorrowKind::Shared, cond_place)
+                    Rvalue::Ref(BorrowKind::Shared, cond_place.store())
                 }
-                BindingMode(ByRef::Yes(rustc_ast_ir::Mutability::Mut), _) => {
-                    Rvalue::Ref(BorrowKind::Mut { kind: MutBorrowKind::Default }, cond_place)
-                }
+                BindingMode(ByRef::Yes(rustc_ast_ir::Mutability::Mut), _) => Rvalue::Ref(
+                    BorrowKind::Mut { kind: MutBorrowKind::Default },
+                    cond_place.store(),
+                ),
             },
             span,
         );
@@ -564,24 +563,23 @@ fn pattern_match_const(
         current_else: Option<BasicBlockId>,
         current: BasicBlockId,
         c: Operand,
-        cond_place: Place,
+        cond_place: PlaceRef<'db>,
         pattern: Idx<Pat>,
     ) -> Result<'db, (BasicBlockId, Option<BasicBlockId>)> {
         let then_target = self.new_basic_block();
         let else_target = current_else.unwrap_or_else(|| self.new_basic_block());
-        let discr: Place =
-            self.temp(Ty::new_bool(self.interner()), current, pattern.into())?.into();
+        let discr = self.temp(Ty::new_bool(self.interner()), current, pattern.into())?.into();
         self.push_assignment(
             current,
             discr,
             Rvalue::CheckedBinaryOp(
                 BinOp::Eq,
                 c,
-                Operand { kind: OperandKind::Copy(cond_place), span: None },
+                Operand { kind: OperandKind::Copy(cond_place.store()), span: None },
             ),
             pattern.into(),
         );
-        let discr = Operand { kind: OperandKind::Copy(discr), span: None };
+        let discr = Operand { kind: OperandKind::Copy(discr.store()), span: None };
         self.set_terminator(
             current,
             TerminatorKind::SwitchInt {
@@ -595,7 +593,7 @@ fn pattern_match_const(
 
     fn pattern_matching_variant(
         &mut self,
-        cond_place: Place,
+        cond_place: PlaceRef<'db>,
         variant: VariantId,
         mut current: BasicBlockId,
         span: MirSpan,
@@ -608,13 +606,18 @@ fn pattern_matching_variant(
                 if mode == MatchingMode::Check {
                     let e = self.const_eval_discriminant(v)? as u128;
                     let tmp = self.discr_temp_place(current);
-                    self.push_assignment(current, tmp, Rvalue::Discriminant(cond_place), span);
+                    self.push_assignment(
+                        current,
+                        tmp,
+                        Rvalue::Discriminant(cond_place.store()),
+                        span,
+                    );
                     let next = self.new_basic_block();
                     let else_target = current_else.get_or_insert_with(|| self.new_basic_block());
                     self.set_terminator(
                         current,
                         TerminatorKind::SwitchInt {
-                            discr: Operand { kind: OperandKind::Copy(tmp), span: None },
+                            discr: Operand { kind: OperandKind::Copy(tmp.store()), span: None },
                             targets: SwitchTargets::static_if(e, next, *else_target),
                         },
                         span,
@@ -653,9 +656,14 @@ fn pattern_matching_variant_fields(
         v: VariantId,
         current: BasicBlockId,
         current_else: Option<BasicBlockId>,
-        cond_place: &Place,
+        cond_place: &PlaceRef<'db>,
         mode: MatchingMode,
     ) -> Result<'db, (BasicBlockId, Option<BasicBlockId>)> {
+        let downcast_place = if matches!(v, VariantId::EnumVariantId(_)) {
+            cond_place.project(ProjectionElem::Downcast(v))
+        } else {
+            *cond_place
+        };
         Ok(match shape {
             AdtPatternShape::Record { args } => {
                 let it = args
@@ -663,28 +671,26 @@ fn pattern_matching_variant_fields(
                     .map(|x| {
                         let field_id =
                             variant_data.field(&x.name).ok_or(MirLowerError::UnresolvedField)?;
-                        Ok((
-                            PlaceElem::Field(Either::Left(FieldId {
-                                parent: v,
-                                local_id: field_id,
-                            })),
-                            x.pat,
-                        ))
+                        Ok((PlaceElem::Field(field_id.into()), x.pat))
                     })
                     .collect::<Result<'db, Vec<_>>>()?;
-                self.pattern_match_adt(current, current_else, it.into_iter(), cond_place, mode)?
+                self.pattern_match_adt(
+                    current,
+                    current_else,
+                    it.into_iter(),
+                    &downcast_place,
+                    mode,
+                )?
             }
             AdtPatternShape::Tuple { args, ellipsis } => {
-                let fields = variant_data.fields().iter().map(|(x, _)| {
-                    PlaceElem::Field(Either::Left(FieldId { parent: v, local_id: x }))
-                });
+                let fields = variant_data.fields().iter().map(|(x, _)| PlaceElem::Field(x.into()));
                 self.pattern_match_tuple_like(
                     current,
                     current_else,
                     args,
                     ellipsis,
                     fields,
-                    cond_place,
+                    &downcast_place,
                     mode,
                 )?
             }
@@ -697,11 +703,11 @@ fn pattern_match_adt(
         mut current: BasicBlockId,
         mut current_else: Option<BasicBlockId>,
         args: impl Iterator<Item = (PlaceElem, PatId)>,
-        cond_place: &Place,
+        cond_place: &PlaceRef<'db>,
         mode: MatchingMode,
     ) -> Result<'db, (BasicBlockId, Option<BasicBlockId>)> {
         for (proj, arg) in args {
-            let cond_place = cond_place.project(proj, &mut self.result.projection_store);
+            let cond_place = cond_place.project(proj);
             (current, current_else) =
                 self.pattern_match_inner(current, current_else, cond_place, arg, mode)?;
         }
@@ -715,7 +721,7 @@ fn pattern_match_tuple_like(
         args: &[PatId],
         ellipsis: Option<u32>,
         fields: impl DoubleEndedIterator<Item = PlaceElem> + Clone,
-        cond_place: &Place,
+        cond_place: &PlaceRef<'db>,
         mode: MatchingMode,
     ) -> Result<'db, (BasicBlockId, Option<BasicBlockId>)> {
         let (al, ar) = args.split_at(ellipsis.map_or(args.len(), |it| it as usize));
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/pretty.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/pretty.rs
index 777cf17..3e41454 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/pretty.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/pretty.rs
@@ -5,20 +5,22 @@
     mem,
 };
 
-use either::Either;
 use hir_def::{
+    HasModule, VariantId,
     expr_store::ExpressionStore,
     hir::BindingId,
     signatures::{ConstSignature, EnumSignature, FunctionSignature, StaticSignature},
 };
 use hir_expand::{Lookup, name::Name};
 use la_arena::ArenaMap;
+use rustc_type_ir::inherent::IntoKind;
 
 use crate::{
     InferBodyId,
     db::{HirDatabase, InternedClosureId},
     display::{ClosureStyle, DisplayTarget, HirDisplay},
-    mir::{PlaceElem, ProjectionElem, StatementKind, TerminatorKind},
+    mir::{PlaceElem, PlaceTy, ProjectionElem, StatementKind, TerminatorKind},
+    next_solver::{DbInterner, TyKind, infer::DbInternerInferExt},
 };
 
 use super::{
@@ -330,36 +332,57 @@ fn f<'db>(this: &mut MirPrettyCtx<'_, 'db>, local: LocalId, projections: &[Place
                     f(this, local, head);
                     w!(this, ")");
                 }
-                ProjectionElem::Field(Either::Left(field)) => {
-                    let variant_fields = field.parent.fields(this.db);
-                    let name = &variant_fields.fields()[field.local_id].name;
-                    match field.parent {
-                        hir_def::VariantId::EnumVariantId(e) => {
-                            w!(this, "(");
-                            f(this, local, head);
-                            let loc = e.lookup(this.db);
-                            w!(
-                                this,
-                                " as {}).{}",
-                                loc.parent.enum_variants(this.db).variants[loc.index as usize]
-                                    .1
-                                    .display(this.db, this.display_target.edition),
-                                name.display(this.db, this.display_target.edition)
-                            );
-                        }
-                        hir_def::VariantId::StructId(_) | hir_def::VariantId::UnionId(_) => {
-                            f(this, local, head);
-                            w!(this, ".{}", name.display(this.db, this.display_target.edition));
-                        }
+                ProjectionElem::Downcast(variant_id) => match variant_id {
+                    hir_def::VariantId::EnumVariantId(e) => {
+                        w!(this, "(");
+                        f(this, local, head);
+                        let loc = e.lookup(this.db);
+                        w!(this, " as {})", loc.name.display(this.db, this.display_target.edition),);
                     }
-                }
-                ProjectionElem::Field(Either::Right(field)) => {
+                    _ => {
+                        f(this, local, head);
+                        w!(this, ".{:?}", last);
+                    }
+                },
+                ProjectionElem::Field(field) => {
                     f(this, local, head);
-                    w!(this, ".{}", field.index);
-                }
-                ProjectionElem::ClosureField(it) => {
-                    f(this, local, head);
-                    w!(this, ".{}", it);
+
+                    // we need to get the base type to decide how to display the field / get the field name
+                    let infcx = DbInterner::new_with(this.db, this.body.owner.krate(this.db))
+                        .infer_ctxt()
+                        .build(rustc_type_ir::TypingMode::PostAnalysis);
+                    let env = this.db.trait_environment(this.body.owner.generic_def(this.db));
+                    let place_ty = PlaceTy::from_ty(this.body.locals[local].ty.as_ref())
+                        .multi_projection_ty(&infcx, env, projections);
+                    if let Some(variant_id) = place_ty.variant_id {
+                        let variant_fields = variant_id.fields(this.db);
+                        w!(
+                            this,
+                            ".{}",
+                            variant_fields.fields()[field.to_local_field_id()]
+                                .name
+                                .display(this.db, this.display_target.edition)
+                        );
+                    } else {
+                        match place_ty.ty.kind() {
+                            TyKind::Adt(adt_def, _) if !adt_def.is_enum() => {
+                                let variant_id =
+                                    VariantId::from_non_enum(adt_def.def_id()).unwrap();
+                                let fields = variant_id.fields(this.db);
+                                w!(
+                                    this,
+                                    ".{}",
+                                    fields.fields()[field.to_local_field_id()]
+                                        .name
+                                        .display(this.db, this.display_target.edition)
+                                );
+                            }
+                            TyKind::Tuple(_) | TyKind::Closure(..) => w!(this, ".{}", field.0),
+                            _ => {
+                                w!(this, ".{:?}", last);
+                            }
+                        }
+                    };
                 }
                 ProjectionElem::Index(l) => {
                     f(this, local, head);
@@ -375,7 +398,7 @@ fn f<'db>(this: &mut MirPrettyCtx<'_, 'db>, local: LocalId, projections: &[Place
                 }
             }
         }
-        f(self, p.local, p.projection.lookup(&self.body.projection_store));
+        f(self, p.local, p.projection.lookup());
     }
 
     fn operand(&mut self, r: &Operand) {
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver.rs
index 47b4b1d..f0d33ad 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver.rs
@@ -120,6 +120,7 @@ pub struct DefaultEmpty<'db> {
     pub clauses: Clauses<'db>,
     pub region_assumptions: RegionAssumptions<'db>,
     pub consts: Consts<'db>,
+    pub projection: crate::mir::Projection<'db>,
 }
 
 pub struct DefaultAny<'db> {
@@ -237,6 +238,12 @@ pub fn default_types<'a, 'db>(db: &'db dyn HirDatabase) -> &'a DefaultAny<'db> {
             let ty = ManuallyDrop::new(ty.store());
             ty.as_ref()
         };
+        let create_projection = |slice| {
+            let it = crate::mir::Projection::new_from_slice(slice);
+            // We need to increase the refcount (forever), so that the types won't be freed.
+            let it = ManuallyDrop::new(it.store());
+            it.as_ref()
+        };
 
         let str = create_ty(TyKind::Str);
         let statik = create_region(RegionKind::ReStatic);
@@ -303,6 +310,7 @@ pub fn default_types<'a, 'db>(db: &'db dyn HirDatabase) -> &'a DefaultAny<'db> {
                 clauses: create_clauses(&[]),
                 region_assumptions: create_region_assumptions(&[]),
                 consts: create_consts(&[]),
+                projection: create_projection(&[]),
             },
             one_invariant: create_variances_of(&[rustc_type_ir::Variance::Invariant]),
             one_covariant: create_variances_of(&[rustc_type_ir::Variance::Covariant]),
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/consts/valtree.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/consts/valtree.rs
index b856ee5..bef2386 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/consts/valtree.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/consts/valtree.rs
@@ -8,6 +8,7 @@
 
 use crate::{
     MemoryMap, ParamEnvAndCrate, consteval,
+    db::HirDatabase,
     mir::pad16,
     next_solver::{Const, Consts, TyKind, WorldExposer},
 };
@@ -32,6 +33,34 @@ pub fn new(ty: Ty<'db>, kind: ValTreeKind<'db>) -> Self {
         let value = ValTree::new(kind);
         ValueConst { ty, value }
     }
+
+    /// Attempts to convert to a `ValTreeKind::Leaf` value.
+    pub fn try_to_leaf(self) -> Option<ScalarInt> {
+        match self.value.inner() {
+            ValTreeKind::Leaf(s) => Some(*s),
+            ValTreeKind::Branch(_) => None,
+        }
+    }
+
+    /// Attempts to extract the raw bits from the constant.
+    ///
+    /// Fails if the value can't be represented as bits (e.g. because it is a reference
+    /// or an aggregate).
+    #[inline]
+    pub fn try_to_bits(
+        self,
+        db: &'db dyn HirDatabase,
+        param_env: ParamEnvAndCrate<'db>,
+    ) -> Option<u128> {
+        let (TyKind::Bool | TyKind::Char | TyKind::Uint(_) | TyKind::Int(_) | TyKind::Float(_)) =
+            self.ty.kind()
+        else {
+            return None;
+        };
+        let scalar = self.try_to_leaf()?;
+        let size = db.layout_of_ty(self.ty.store(), param_env.store()).ok()?.size;
+        Some(scalar.to_bits(size))
+    }
 }
 
 pub(super) fn allocation_to_const<'db>(
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs
index 839bdf1..6b6dd54 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs
@@ -1,7 +1,6 @@
 //! Infer context the next-trait-solver.
 
 use std::cell::{Cell, RefCell};
-use std::fmt;
 use std::ops::Range;
 use std::sync::Arc;
 
@@ -308,32 +307,6 @@ pub enum BoundRegionConversionTime {
     AssocTypeProjection(SolverDefId),
 }
 
-#[derive(Copy, Clone, Debug)]
-pub struct FixupError {
-    unresolved: TyOrConstInferVar,
-}
-
-impl fmt::Display for FixupError {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        use TyOrConstInferVar::*;
-
-        match self.unresolved {
-            TyInt(_) => write!(
-                f,
-                "cannot determine the type of this integer; \
-                 add a suffix to specify the type explicitly"
-            ),
-            TyFloat(_) => write!(
-                f,
-                "cannot determine the type of this number; \
-                 add a suffix to specify the type explicitly"
-            ),
-            Ty(_) => write!(f, "unconstrained type"),
-            Const(_) => write!(f, "unconstrained const value"),
-        }
-    }
-}
-
 /// See the `region_obligations` field for more information.
 #[derive(Clone, Debug)]
 pub struct TypeOutlivesConstraint<'db> {
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/traits.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/traits.rs
index 4584b35..362689a 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/traits.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/traits.rs
@@ -161,11 +161,11 @@ impl<'db> PredicateObligation<'db> {
     /// Flips the polarity of the inner predicate.
     ///
     /// Given `T: Trait` predicate it returns `T: !Trait` and given `T: !Trait` returns `T: Trait`.
-    pub fn flip_polarity(&self, _interner: DbInterner<'db>) -> Option<PredicateObligation<'db>> {
+    pub fn flip_polarity(&self, interner: DbInterner<'db>) -> Option<PredicateObligation<'db>> {
         Some(PredicateObligation {
             cause: self.cause,
             param_env: self.param_env,
-            predicate: self.predicate.flip_polarity()?,
+            predicate: self.predicate.flip_polarity(interner)?,
             recursion_depth: self.recursion_depth,
         })
     }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs
index b3d31dd..b466fe0 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs
@@ -330,6 +330,7 @@ unsafe impl Sync for DbInterner<'_> {}
 
 impl<'db> DbInterner<'db> {
     // FIXME(next-solver): remove this method
+    #[doc(hidden)]
     pub fn conjure() -> DbInterner<'db> {
         // Here we can not reinit the cache since we do that when we attach the db.
         crate::with_attached_db(|db| DbInterner {
@@ -588,7 +589,7 @@ fn struct_tail_ty(
         let id: VariantId = struct_id.into();
         let field_types = interner.db().field_types(id);
 
-        field_types.iter().last().map(|f| f.1.get())
+        field_types.iter().last().map(|f| f.1.ty())
     }
 
     fn all_field_tys(
@@ -598,7 +599,7 @@ fn all_field_tys(
         let db = interner.db();
         // FIXME: this is disabled just to match the behavior with chalk right now
         let _field_tys = |id: VariantId| {
-            db.field_types(id).iter().map(|(_, ty)| ty.get().skip_binder()).collect::<Vec<_>>()
+            db.field_types(id).iter().map(|(_, ty)| ty.ty().skip_binder()).collect::<Vec<_>>()
         };
         let field_tys = |_id: VariantId| vec![];
         let tys: Vec<_> = match self.def_id() {
@@ -607,8 +608,8 @@ fn all_field_tys(
             hir_def::AdtId::EnumId(id) => id
                 .enum_variants(db)
                 .variants
-                .iter()
-                .flat_map(|&(variant_id, _, _)| field_tys(variant_id.into()))
+                .values()
+                .flat_map(|&(variant_id, _)| field_tys(variant_id.into()))
                 .collect(),
         };
 
@@ -1881,7 +1882,7 @@ fn unsizing_params_for_adt(self, id: Self::AdtId) -> Self::UnsizingParams {
 
         let field_types = self.db().field_types(variant);
         let mut unsizing_params = DenseBitSet::new_empty(num_params);
-        let ty = field_types[tail_field.0].get();
+        let ty = field_types[tail_field.0].ty();
         for arg in ty.instantiate_identity().skip_norm_wip().walk() {
             if let Some(i) = maybe_unsizing_param_idx(arg) {
                 unsizing_params.insert(i);
@@ -1891,7 +1892,7 @@ fn unsizing_params_for_adt(self, id: Self::AdtId) -> Self::UnsizingParams {
         // Ensure none of the other fields mention the parameters used
         // in unsizing.
         for field in prefix_fields {
-            for arg in field_types[field.0].get().instantiate_identity().skip_norm_wip().walk() {
+            for arg in field_types[field.0].ty().instantiate_identity().skip_norm_wip().walk() {
                 if let Some(i) = maybe_unsizing_param_idx(arg) {
                     unsizing_params.remove(i);
                 }
@@ -2581,6 +2582,7 @@ pub unsafe fn collect_ty_garbage() {
     gc.add_slice_storage::<super::predicate::BoundExistentialPredicatesStorage>();
     gc.add_slice_storage::<super::region::RegionAssumptionsStorage>();
     gc.add_slice_storage::<super::ty::TysStorage>();
+    gc.add_slice_storage::<crate::mir::ProjectionStorage>();
 
     // SAFETY:
     //  - By our precondition, there are no unrecorded types.
@@ -2645,4 +2647,5 @@ fn visit_slice(header: &[<Self as ::intern::SliceInternable>::SliceType], gc: &m
     super::region::RegionAssumptionsStorage,
     super::ty::TysStorage,
     super::consts::ConstsStorage,
+    crate::mir::ProjectionStorage,
 );
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/predicate.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/predicate.rs
index 30738de..cf492e6 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/predicate.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/predicate.rs
@@ -229,7 +229,7 @@ pub fn inner(&self) -> &WithCachedTypeInfo<Binder<'db, PredicateKind<'db>>> {
     /// Flips the polarity of a Predicate.
     ///
     /// Given `T: Trait` predicate it returns `T: !Trait` and given `T: !Trait` returns `T: Trait`.
-    pub fn flip_polarity(self) -> Option<Predicate<'db>> {
+    pub fn flip_polarity(self, interner: DbInterner<'db>) -> Option<Predicate<'db>> {
         let kind = self
             .kind()
             .map_bound(|kind| match kind {
@@ -245,7 +245,7 @@ pub fn flip_polarity(self) -> Option<Predicate<'db>> {
             })
             .transpose()?;
 
-        Some(Predicate::new(DbInterner::conjure(), kind))
+        Some(Predicate::new(interner, kind))
     }
 }
 
@@ -355,13 +355,6 @@ fn as_slice(&self) -> &[Self::Item] {
     }
 }
 
-impl<'db> Default for Clauses<'db> {
-    #[inline]
-    fn default() -> Self {
-        Clauses::empty(DbInterner::conjure())
-    }
-}
-
 impl<'db> rustc_type_ir::inherent::Clauses<DbInterner<'db>> for Clauses<'db> {}
 
 impl<'db> rustc_type_ir::TypeSuperFoldable<DbInterner<'db>> for Clauses<'db> {
@@ -444,8 +437,8 @@ pub struct ParamEnv<'db> {
 }
 
 impl<'db> ParamEnv<'db> {
-    pub fn empty() -> Self {
-        ParamEnv { clauses: Clauses::empty(DbInterner::conjure()) }
+    pub fn empty(interner: DbInterner<'db>) -> Self {
+        ParamEnv { clauses: Clauses::empty(interner) }
     }
 
     pub fn clauses(self) -> Clauses<'db> {
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/ty.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/ty.rs
index c43e04b..fe31d44 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/ty.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/ty.rs
@@ -196,6 +196,16 @@ pub fn new_array(interner: DbInterner<'db>, ty: Ty<'db>, n: u128) -> Ty<'db> {
         )
     }
 
+    pub fn new_array_opt(interner: DbInterner<'db>, ty: Ty<'db>, n: Option<u128>) -> Ty<'db> {
+        Ty::new(
+            interner,
+            TyKind::Array(
+                ty,
+                crate::consteval::usize_const(interner.db, n, interner.expect_crate()),
+            ),
+        )
+    }
+
     fn new_generic_adt(interner: DbInterner<'db>, adt_id: AdtId, ty_param: Ty<'db>) -> Ty<'db> {
         let args = GenericArgs::fill_with_defaults(
             interner,
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/opaques.rs b/src/tools/rust-analyzer/crates/hir-ty/src/opaques.rs
index 4244b1b..dfd1fd9 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/opaques.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/opaques.rs
@@ -1,8 +1,8 @@
 //! Handling of opaque types, detection of defining scope and hidden type.
 
 use hir_def::{
-    AssocItemId, AssocItemLoc, DefWithBodyId, ExpressionStoreOwnerId, FunctionId, GenericDefId,
-    HasModule, ItemContainerId, TypeAliasId, signatures::ImplSignature,
+    AssocItemId, AssocItemLoc, DefWithBodyId, FunctionId, HasModule, ItemContainerId, TypeAliasId,
+    signatures::ImplSignature,
 };
 use hir_expand::name::Name;
 use la_arena::ArenaMap;
@@ -129,10 +129,9 @@ pub(crate) fn tait_hidden_types(
     let infcx = interner.infer_ctxt().build(TypingMode::non_body_analysis());
     let mut ocx = ObligationCtxt::new(&infcx);
     let cause = ObligationCause::dummy();
-    let param_env =
-        db.trait_environment(ExpressionStoreOwnerId::from(GenericDefId::from(type_alias)));
+    let param_env = db.trait_environment(type_alias.into());
 
-    let defining_bodies = tait_defining_bodies(db, &loc);
+    let defining_bodies = tait_defining_bodies(db, loc);
 
     let mut result = ArenaMap::with_capacity(taits_count);
     for defining_body in defining_bodies {
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/representability.rs b/src/tools/rust-analyzer/crates/hir-ty/src/representability.rs
index 0b7dc4d..828af20 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/representability.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/representability.rs
@@ -29,7 +29,7 @@ pub(crate) fn representability(db: &dyn HirDatabase, id: AdtId) -> Representabil
         AdtId::StructId(id) => variant_representability(db, id.into()),
         AdtId::UnionId(id) => variant_representability(db, id.into()),
         AdtId::EnumId(id) => {
-            for &(variant, ..) in &id.enum_variants(db).variants {
+            for &(variant, ..) in id.enum_variants(db).variants.values() {
                 rtry!(variant_representability(db, variant.into()));
             }
             Representability::Representable
@@ -47,7 +47,7 @@ pub(crate) fn representability_cycle(
 
 fn variant_representability(db: &dyn HirDatabase, id: VariantId) -> Representability {
     for ty in db.field_types(id).values() {
-        rtry!(representability_ty(db, ty.get().instantiate_identity().skip_norm_wip()));
+        rtry!(representability_ty(db, ty.ty().instantiate_identity().skip_norm_wip()));
     }
     Representability::Representable
 }
@@ -96,7 +96,7 @@ fn params_in_repr(db: &dyn HirDatabase, def_id: AdtId) -> Box<[bool]> {
         for field in db.field_types(variant).values() {
             params_in_repr_ty(
                 db,
-                field.get().instantiate_identity().skip_norm_wip(),
+                field.ty().instantiate_identity().skip_norm_wip(),
                 &mut params_in_repr,
             );
         }
@@ -105,7 +105,7 @@ fn params_in_repr(db: &dyn HirDatabase, def_id: AdtId) -> Box<[bool]> {
         AdtId::StructId(def_id) => handle_variant(def_id.into()),
         AdtId::UnionId(def_id) => handle_variant(def_id.into()),
         AdtId::EnumId(def_id) => {
-            for &(variant, ..) in &def_id.enum_variants(db).variants {
+            for &(variant, ..) in def_id.enum_variants(db).variants.values() {
                 handle_variant(variant.into());
             }
         }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/specialization.rs b/src/tools/rust-analyzer/crates/hir-ty/src/specialization.rs
index 467b598..2d206fe 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/specialization.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/specialization.rs
@@ -1,9 +1,6 @@
 //! Impl specialization related things
 
-use hir_def::{
-    ExpressionStoreOwnerId, GenericDefId, HasModule, ImplId, signatures::ImplSignature,
-    unstable_features::UnstableFeatures,
-};
+use hir_def::{HasModule, ImplId, signatures::ImplSignature, unstable_features::UnstableFeatures};
 use tracing::debug;
 
 use crate::{
@@ -48,9 +45,7 @@ fn specializes_query(
     specializing_impl_def_id: ImplId,
     parent_impl_def_id: ImplId,
 ) -> bool {
-    let trait_env = db.trait_environment(ExpressionStoreOwnerId::from(GenericDefId::from(
-        specializing_impl_def_id,
-    )));
+    let trait_env = db.trait_environment(specializing_impl_def_id.into());
     let interner = DbInterner::new_with(db, specializing_impl_def_id.krate(db));
 
     let specializing_impl_signature = ImplSignature::of(db, specializing_impl_def_id);
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/test_db.rs b/src/tools/rust-analyzer/crates/hir-ty/src/test_db.rs
index e19e26e..3dee592 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/test_db.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/test_db.rs
@@ -112,7 +112,7 @@ fn set_source_root_with_durability(
     }
 
     fn file_source_root(&self, id: base_db::FileId) -> FileSourceRootInput {
-        self.files.file_source_root(id)
+        self.files.file_source_root(self, id)
     }
 
     fn set_file_source_root_with_durability(
@@ -132,6 +132,10 @@ fn crates_map(&self) -> Arc<CratesMap> {
     fn nonce_and_revision(&self) -> (Nonce, salsa::Revision) {
         (self.nonce, salsa::plumbing::ZalsaDatabase::zalsa(self).current_revision())
     }
+
+    fn line_column(&self, _file: FileId, _offset: syntax::TextSize) -> Result<(u32, u32), ()> {
+        Err(())
+    }
 }
 
 #[salsa_macros::db]
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests.rs
index d259ce7..ce4eff7 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests.rs
@@ -460,7 +460,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
                         AdtId::EnumId(id) => variants.extend(
                             id.enum_variants(&db)
                                 .variants
-                                .iter()
+                                .values()
                                 .map(|&(variant, ..)| (variant.into(), krate)),
                         ),
                     }
@@ -600,7 +600,7 @@ fn visit_scope(
                     visit_body(db, body, cb);
                 }
                 ModuleDefId::AdtId(AdtId::EnumId(it)) => {
-                    it.enum_variants(db).variants.iter().for_each(|&(it, _, _)| {
+                    it.enum_variants(db).variants.values().for_each(|&(it, _)| {
                         let body = Body::of(db, it.into());
                         cb(it.into());
                         visit_body(db, body, cb);
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/macros.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/macros.rs
index 28a688d..c0da6cf 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/macros.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/macros.rs
@@ -194,10 +194,8 @@ fn spam() {
             !0..6 '1isize': isize
             !0..6 '1isize': isize
             !0..6 '1isize': isize
-            39..442 '{     ...!(); }': {unknown}
+            39..442 '{     ...!(); }': !
             73..94 'spam!(...am!())': {unknown}
-            100..119 'for _ ...!() {}': fn into_iter<isize>(isize) -> <isize as IntoIterator>::IntoIter
-            100..119 'for _ ...!() {}': <isize as IntoIterator>::IntoIter
             100..119 'for _ ...!() {}': !
             100..119 'for _ ...!() {}': {unknown}
             100..119 'for _ ...!() {}': &'? mut {unknown}
@@ -208,6 +206,8 @@ fn spam() {
             100..119 'for _ ...!() {}': ()
             100..119 'for _ ...!() {}': ()
             104..105 '_': {unknown}
+            109..116 'spam!()': fn into_iter<isize>(isize) -> <isize as IntoIterator>::IntoIter
+            109..116 'spam!()': <isize as IntoIterator>::IntoIter
             117..119 '{}': ()
             124..134 '|| spam!()': impl Fn() -> isize
             140..156 'while ...!() {}': !
@@ -288,10 +288,8 @@ fn spam() {
             !0..6 '1isize': isize
             !0..6 '1isize': isize
             !0..6 '1isize': isize
-            53..456 '{     ...!(); }': {unknown}
+            53..456 '{     ...!(); }': !
             87..108 'spam!(...am!())': {unknown}
-            114..133 'for _ ...!() {}': fn into_iter<isize>(isize) -> <isize as IntoIterator>::IntoIter
-            114..133 'for _ ...!() {}': <isize as IntoIterator>::IntoIter
             114..133 'for _ ...!() {}': !
             114..133 'for _ ...!() {}': {unknown}
             114..133 'for _ ...!() {}': &'? mut {unknown}
@@ -302,6 +300,8 @@ fn spam() {
             114..133 'for _ ...!() {}': ()
             114..133 'for _ ...!() {}': ()
             118..119 '_': {unknown}
+            123..130 'spam!()': fn into_iter<isize>(isize) -> <isize as IntoIterator>::IntoIter
+            123..130 'spam!()': <isize as IntoIterator>::IntoIter
             131..133 '{}': ()
             138..148 '|| spam!()': impl Fn() -> isize
             154..170 'while ...!() {}': !
@@ -1493,7 +1493,7 @@ fn main() {
             !0..136 'builti...tack))': ()
             !0..449 'builti...urn),)': !
             10..1236 '{     ...   } }': ()
-            16..1234 'unsafe...     }': ()
+            16..1234 'unsafe...     }': !
             37..40 'foo': i32
             43..44 '1': i32
             58..63 'mut o': i32
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/method_resolution.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/method_resolution.rs
index 4291c9b..2084c01 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/method_resolution.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/method_resolution.rs
@@ -1715,8 +1715,8 @@ fn f<S: Sized, T, U: ?Sized>() {
             95..103 'u32::foo': fn foo<u32>() -> u8
             109..115 'S::foo': fn foo<S>() -> u8
             121..127 'T::foo': fn foo<T>() -> u8
-            133..139 'U::foo': fn foo<U>() -> u8
-            145..157 '<[u32]>::foo': fn foo<[u32]>() -> u8
+            133..139 'U::foo': {unknown}
+            145..157 '<[u32]>::foo': {unknown}
         "#]],
     );
 }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/never_type.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/never_type.rs
index 91273cd..fd21286 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/never_type.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/never_type.rs
@@ -262,42 +262,42 @@ fn test6() {
             let x: u32 = { let y: u32 = { loop {}; }; };
         }
         ",
-        expect![[r"
-            11..39 '{     ...urn; }': ()
+        expect![[r#"
+            11..39 '{     ...urn; }': !
             21..22 'x': u32
             30..36 'return': !
-            51..84 '{     ...; }; }': ()
+            51..84 '{     ...; }; }': !
             61..62 'x': u32
-            70..81 '{ return; }': u32
+            70..81 '{ return; }': !
             72..78 'return': !
-            96..125 '{     ... {}; }': ()
+            96..125 '{     ... {}; }': !
             106..107 'x': u32
             115..122 'loop {}': !
             120..122 '{}': ()
-            137..170 '{     ...} }; }': ()
+            137..170 '{     ...} }; }': !
             147..148 'x': u32
             156..167 '{ loop {} }': u32
             158..165 'loop {}': !
             163..165 '{}': ()
-            182..246 '{     ...} }; }': ()
+            182..246 '{     ...} }; }': !
             192..193 'x': u32
             201..243 '{ if t...}; } }': u32
             203..241 'if tru... {}; }': u32
             206..210 'true': bool
-            211..223 '{ loop {}; }': u32
+            211..223 '{ loop {}; }': !
             213..220 'loop {}': !
             218..220 '{}': ()
-            229..241 '{ loop {}; }': u32
+            229..241 '{ loop {}; }': !
             231..238 'loop {}': !
             236..238 '{}': ()
-            258..310 '{     ...; }; }': ()
+            258..310 '{     ...; }; }': !
             268..269 'x': u32
-            277..307 '{ let ...; }; }': u32
+            277..307 '{ let ...; }; }': !
             283..284 'y': u32
-            292..304 '{ loop {}; }': u32
+            292..304 '{ loop {}; }': !
             294..301 'loop {}': !
             299..301 '{}': ()
-        "]],
+        "#]],
     );
 }
 
@@ -312,7 +312,7 @@ fn test1() {
         }
         "#,
         expect![[r#"
-            11..84 '{     ..." }; }': ()
+            11..84 '{     ..." }; }': !
             54..55 'x': u32
             63..81 '{ loop...foo" }': u32
             65..72 'loop {}': !
@@ -355,14 +355,12 @@ fn test3() {
             54..55 'x': u32
             63..82 '{ loop...k; } }': u32
             65..80 'loop { break; }': u32
-            70..80 '{ break; }': ()
+            70..80 '{ break; }': !
             72..77 'break': !
             72..77: expected u32, got ()
             97..343 '{     ...; }; }': ()
             140..141 'x': u32
             149..175 '{ for ...; }; }': u32
-            151..172 'for a ...eak; }': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
-            151..172 'for a ...eak; }': <{unknown} as IntoIterator>::IntoIter
             151..172 'for a ...eak; }': !
             151..172 'for a ...eak; }': {unknown}
             151..172 'for a ...eak; }': &'? mut {unknown}
@@ -374,12 +372,12 @@ fn test3() {
             151..172 'for a ...eak; }': ()
             155..156 'a': {unknown}
             160..161 'b': {unknown}
-            162..172 '{ break; }': ()
+            160..161 'b': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
+            160..161 'b': <{unknown} as IntoIterator>::IntoIter
+            162..172 '{ break; }': !
             164..169 'break': !
             226..227 'x': u32
             235..253 '{ for ... {}; }': u32
-            237..250 'for a in b {}': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
-            237..250 'for a in b {}': <{unknown} as IntoIterator>::IntoIter
             237..250 'for a in b {}': !
             237..250 'for a in b {}': {unknown}
             237..250 'for a in b {}': &'? mut {unknown}
@@ -391,11 +389,11 @@ fn test3() {
             237..250 'for a in b {}': ()
             241..242 'a': {unknown}
             246..247 'b': {unknown}
+            246..247 'b': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
+            246..247 'b': <{unknown} as IntoIterator>::IntoIter
             248..250 '{}': ()
             304..305 'x': u32
             313..340 '{ for ...; }; }': u32
-            315..337 'for a ...urn; }': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
-            315..337 'for a ...urn; }': <{unknown} as IntoIterator>::IntoIter
             315..337 'for a ...urn; }': !
             315..337 'for a ...urn; }': {unknown}
             315..337 'for a ...urn; }': &'? mut {unknown}
@@ -407,7 +405,9 @@ fn test3() {
             315..337 'for a ...urn; }': ()
             319..320 'a': {unknown}
             324..325 'b': {unknown}
-            326..337 '{ return; }': ()
+            324..325 'b': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
+            324..325 'b': <{unknown} as IntoIterator>::IntoIter
+            326..337 '{ return; }': !
             328..334 'return': !
             149..175: expected u32, got ()
             235..253: expected u32, got ()
@@ -419,7 +419,7 @@ fn test3() {
             409..430 'while ...eak; }': ()
             409..430 'while ...eak; }': ()
             415..419 'true': bool
-            420..430 '{ break; }': ()
+            420..430 '{ break; }': !
             422..427 'break': !
             537..538 'x': u32
             546..564 '{ whil... {}; }': u32
@@ -434,7 +434,7 @@ fn test3() {
             626..648 'while ...urn; }': ()
             626..648 'while ...urn; }': ()
             632..636 'true': bool
-            637..648 '{ return; }': ()
+            637..648 '{ return; }': !
             639..645 'return': !
             407..433: expected u32, got ()
             546..564: expected u32, got ()
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/patterns.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/patterns.rs
index e719f43..a6e8649 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/patterns.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/patterns.rs
@@ -47,8 +47,6 @@ fn test(x: &i32) {
             82..94 '(1, "hello")': (i32, &'? str)
             83..84 '1': i32
             86..93 '"hello"': &'static str
-            101..150 'for (e...     }': fn into_iter<[(i32, i32); 1]>([(i32, i32); 1]) -> <[(i32, i32); 1] as IntoIterator>::IntoIter
-            101..150 'for (e...     }': IntoIter<(i32, i32), 1>
             101..150 'for (e...     }': !
             101..150 'for (e...     }': IntoIter<(i32, i32), 1>
             101..150 'for (e...     }': &'? mut IntoIter<(i32, i32), 1>
@@ -62,6 +60,8 @@ fn test(x: &i32) {
             106..107 'e': i32
             109..110 'f': i32
             115..123 '[(0, 1)]': [(i32, i32); 1]
+            115..123 '[(0, 1)]': fn into_iter<[(i32, i32); 1]>([(i32, i32); 1]) -> <[(i32, i32); 1] as IntoIterator>::IntoIter
+            115..123 '[(0, 1)]': IntoIter<(i32, i32), 1>
             116..122 '(0, 1)': (i32, i32)
             117..118 '0': i32
             120..121 '1': i32
@@ -606,7 +606,7 @@ fn test() {
         }
         "#,
         expect![[r#"
-            75..217 '{     ...     }': ()
+            75..217 '{     ...     }': !
             85..210 'match ...     }': ()
             92..99 'loop {}': !
             97..99 '{}': ()
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs
index 5a90e70..2240408 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs
@@ -270,8 +270,6 @@ fn extra_compiler_flags() {
         "#,
         expect![[r#"
             26..322 '{     ...   } }': ()
-            32..320 'for co...     }': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
-            32..320 'for co...     }': <{unknown} as IntoIterator>::IntoIter
             32..320 'for co...     }': !
             32..320 'for co...     }': {unknown}
             32..320 'for co...     }': &'? mut {unknown}
@@ -281,27 +279,29 @@ fn extra_compiler_flags() {
             32..320 'for co...     }': ()
             32..320 'for co...     }': ()
             32..320 'for co...     }': ()
-            36..43 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            36..43 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
             47..60 'doesnt_matter': {unknown}
+            47..60 'doesnt_matter': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
+            47..60 'doesnt_matter': <{unknown} as IntoIterator>::IntoIter
             61..320 '{     ...     }': ()
-            75..79 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            82..166 'if doe...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            75..79 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            82..166 'if doe...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
             85..98 'doesnt_matter': bool
             99..128 '{     ...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
             113..118 'first': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            134..166 '{     ...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            148..156 '&content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            149..156 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            181..188 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            191..313 'if ICE...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            134..166 '{     ...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            148..156 '&content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            149..156 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            181..188 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            191..313 'if ICE...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
             194..231 'ICE_RE..._VALUE': {unknown}
             194..247 'ICE_RE...&name)': bool
-            241..246 '&name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            242..246 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            248..276 '{     ...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            262..266 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            282..313 '{     ...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
-            296..303 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            241..246 '&name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            242..246 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            248..276 '{     ...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            262..266 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            282..313 '{     ...     }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+            296..303 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
         "#]],
     );
 }
@@ -416,7 +416,7 @@ fn end<W: Write>() {
             120..215 '{     ...     }': ()
             130..133 'end': fn end<{unknown}>()
             130..135 'end()': ()
-            164..209 '{     ...     }': ()
+            164..209 '{     ...     }': !
             182..184 '_x': !
             191..198 'loop {}': !
             196..198 '{}': ()
@@ -631,7 +631,7 @@ fn internal_into_boxed(self) -> Self::Output {
             65..69 'self': Self
             267..271 'self': Self
             466..470 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
-            488..522 '{     ...     }': {unknown}
+            488..522 '{     ...     }': ()
             498..502 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
             498..508 'self.order': O
             498..515 'self.o...into()': dyn QueryFragment<DB> + 'static
@@ -1059,7 +1059,7 @@ fn no_actual_tail(){
             216..227 '{ "third" }': ()
             218..225 '"third"': &'static str
             293..357 '{     ...] 15 }': ()
-            299..311 '{ "fourth" }': &'static str
+            299..311 '{ "fourth" }': &'? str
             301..309 '"fourth"': &'static str
         "#]],
     )
@@ -1261,8 +1261,6 @@ fn test() {
         "#,
         expect![[r#"
             10..68 '{     ...   } }': ()
-            16..66 'for _ ...     }': fn into_iter<()>(()) -> <() as IntoIterator>::IntoIter
-            16..66 'for _ ...     }': <() as IntoIterator>::IntoIter
             16..66 'for _ ...     }': !
             16..66 'for _ ...     }': {unknown}
             16..66 'for _ ...     }': &'? mut {unknown}
@@ -1274,6 +1272,8 @@ fn test() {
             16..66 'for _ ...     }': ()
             20..21 '_': {unknown}
             25..39 '{ let x = 0; }': ()
+            25..39 '{ let x = 0; }': fn into_iter<()>(()) -> <() as IntoIterator>::IntoIter
+            25..39 '{ let x = 0; }': <() as IntoIterator>::IntoIter
             31..32 'x': i32
             35..36 '0': i32
             40..66 '{     ...     }': ()
@@ -2238,7 +2238,7 @@ trait Foo {}
 async fn f<A, B, C>() -> Bar {}
 "#,
         expect![[r#"
-            64..66 '{}': impl Foo + ?Sized
+            64..66 '{}': ()
         "#]],
     );
 }
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression/new_solver.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression/new_solver.rs
index 33a12fc..c77b20f 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression/new_solver.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression/new_solver.rs
@@ -357,7 +357,7 @@ fn test<T, U>(t: T)
 "#,
         expect![[r#"
             182..183 't': T
-            230..280 '{     ... {}; }': ()
+            230..280 '{     ... {}; }': !
             240..241 't': <T as DimMax<U>>::Output
             270..277 'loop {}': !
             275..277 '{}': ()
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/simple.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/simple.rs
index c0b8d93..b54ed08 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/simple.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/simple.rs
@@ -135,7 +135,7 @@ fn test(a: u32, b: isize, c: !, d: &str) {
             16..17 'b': isize
             26..27 'c': !
             32..33 'd': &'? str
-            41..120 '{     ...f32; }': ()
+            41..120 '{     ...f32; }': !
             47..48 'a': u32
             54..55 'b': isize
             61..62 'c': !
@@ -1018,14 +1018,14 @@ fn foo() {
             28..32 'true': bool
             33..50 '{     ...     }': i32
             43..44 '1': i32
-            56..79 '{     ...     }': i32
+            56..79 '{     ...     }': !
             66..72 'return': !
             89..92 '_x2': i32
             95..148 'if tru...     }': i32
             98..102 'true': bool
             103..120 '{     ...     }': i32
             113..114 '2': i32
-            126..148 '{     ...     }': !
+            126..148 '{     ...     }': i32
             136..142 'return': !
             158..161 '_x3': i32
             164..246 'match ...     }': i32
@@ -1034,7 +1034,7 @@ fn foo() {
             185..189 'true': bool
             193..194 '3': i32
             204..205 '_': bool
-            209..240 '{     ...     }': i32
+            209..240 '{     ...     }': !
             223..229 'return': !
             256..259 '_x4': i32
             262..319 'match ...     }': i32
@@ -1939,7 +1939,7 @@ fn foo() -> u32 {
             16..58 '{     ...; }; }': u32
             26..27 'x': impl Fn() -> usize
             30..55 '|| -> ...n 1; }': impl Fn() -> usize
-            42..55 '{ return 1; }': usize
+            42..55 '{ return 1; }': !
             44..52 'return 1': !
             51..52 '1': usize
         "#]],
@@ -1958,7 +1958,7 @@ fn foo() -> u32 {
             16..47 '{     ...; }; }': u32
             26..27 'x': impl Fn()
             30..44 '|| { return; }': impl Fn()
-            33..44 '{ return; }': ()
+            33..44 '{ return; }': !
             35..41 'return': !
         "#]],
     );
@@ -2434,10 +2434,10 @@ fn test() {
             59..168 '{     ...  }; }': ()
             69..70 'x': Option<bool>
             73..165 'loop {...     }': Option<bool>
-            78..165 '{     ...     }': ()
+            78..165 '{     ...     }': !
             88..132 'if fal...     }': ()
             91..96 'false': bool
-            97..132 '{     ...     }': ()
+            97..132 '{     ...     }': !
             111..121 'break None': !
             117..121 'None': Option<bool>
             142..158 'break ...(true)': !
@@ -2470,7 +2470,7 @@ fn test() {
             78..133 '{     ...     }': ()
             88..127 'if fal...     }': ()
             91..96 'false': bool
-            97..127 '{     ...     }': ()
+            97..127 '{     ...     }': !
             111..116 'break': !
         "#]],
     );
@@ -2500,24 +2500,24 @@ fn foo() {
             19..21 '_x': impl Fn() -> bool
             24..332 '|| 'ou...     }': impl Fn() -> bool
             27..332 ''outer...     }': bool
-            40..332 '{     ...     }': ()
+            40..332 '{     ...     }': !
             54..59 'inner': i8
             62..300 ''inner...     }': i8
-            75..300 '{     ...     }': ()
+            75..300 '{     ...     }': !
             93..94 'i': bool
             97..113 'Defaul...efault': {unknown}
             97..115 'Defaul...ault()': bool
             129..269 'if (br...     }': ()
             133..147 'break 'outer i': !
             146..147 'i': bool
-            149..208 '{     ...     }': ()
+            149..208 '{     ...     }': !
             167..193 'loop {...5i8; }': !
-            172..193 '{ brea...5i8; }': ()
+            172..193 '{ brea...5i8; }': !
             174..190 'break ...er 5i8': !
             187..190 '5i8': i8
             214..269 'if tru...     }': ()
             217..221 'true': bool
-            222..269 '{     ...     }': ()
+            222..269 '{     ...     }': !
             240..254 'break 'inner 6': !
             253..254 '6': i8
             282..289 'break 7': !
@@ -2566,12 +2566,12 @@ fn foo() {
             140..270 'if (br...     }': ()
             144..158 'break 'outer i': !
             157..158 'i': bool
-            160..209 '{     ...     }': ()
+            160..209 '{     ...     }': !
             178..194 'break ...er 5i8': !
             191..194 '5i8': i8
             215..270 'if tru...     }': ()
             218..222 'true': bool
-            223..270 '{     ...     }': ()
+            223..270 '{     ...     }': !
             241..255 'break 'inner 6': !
             254..255 '6': i8
             283..313 'break ... { 0 }': !
@@ -2666,7 +2666,7 @@ fn test() {
         }
         "#,
         expect![[r#"
-            99..319 '{     ...32); }': ()
+            99..319 '{     ...32); }': !
             109..110 'x': Thing<!>
             113..133 'Thing ...p {} }': Thing<!>
             124..131 'loop {}': !
@@ -3254,9 +3254,9 @@ fn main() {
         expect![[r#"
             104..108 'self': &'? Box<T>
             188..192 'self': &'a Box<Foo<T>>
-            218..220 '{}': &'a T
+            218..220 '{}': &'? T
             242..246 'self': &'a Box<Foo<T>>
-            275..277 '{}': &'a Foo<T>
+            275..277 '{}': &'? Foo<T>
             297..301 'self': Box<Foo<T>>
             322..324 '{}': Foo<T>
             338..559 '{     ...r(); }': ()
@@ -4305,3 +4305,21 @@ enum Enum {
         "#]],
     );
 }
+
+#[test]
+fn labelled_block_break() {
+    check_types(
+        r#"
+//- minicore: option
+fn foo() {
+    'a: {
+        if false {
+            break 'a Some(1);
+        }
+        None
+     // ^^^^ Option<i32>
+    };
+}
+    "#,
+    );
+}
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs
index ea978cd..85c93ab 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/traits.rs
@@ -1490,7 +1490,7 @@ fn test(x: Box<dyn Trait<u64>>, y: &dyn Trait<u64>) {
         expect![[r#"
             29..33 'self': &'? Self
             54..58 'self': &'? Self
-            206..208 '{}': Box<dyn Trait<u64> + 'static>
+            206..208 '{}': Box<dyn Trait<u64> + '?>
             218..219 'x': Box<dyn Trait<u64> + 'static>
             242..243 'y': &'? (dyn Trait<u64> + 'static)
             262..379 '{     ...2(); }': ()
@@ -1571,7 +1571,7 @@ fn test(x: Trait, y: &Trait) -> u64 {
 }"#,
         expect![[r#"
             26..30 'self': &'? Self
-            60..62 '{}': dyn Trait + 'static
+            60..62 '{}': dyn Trait + '?
             72..73 'x': dyn Trait + 'static
             82..83 'y': &'? (dyn Trait + 'static)
             100..175 '{     ...o(); }': u64
@@ -1712,7 +1712,7 @@ fn test<T: Trait<Type = u32>>(x: T, y: impl Trait<Type = i64>) {
 }"#,
         expect![[r#"
             81..82 't': T
-            109..111 '{}': <T as Trait>::Type
+            109..111 '{}': ()
             143..144 't': T
             154..156 '{}': U
             186..187 't': T
@@ -3027,13 +3027,13 @@ fn test() {
             140..146 'IsCopy': IsCopy
             140..153 'IsCopy.test()': bool
             159..166 'NotCopy': NotCopy
-            159..173 'NotCopy.test()': bool
+            159..173 'NotCopy.test()': {unknown}
             179..195 '(IsCop...sCopy)': (IsCopy, IsCopy)
             179..202 '(IsCop...test()': bool
             180..186 'IsCopy': IsCopy
             188..194 'IsCopy': IsCopy
             208..225 '(IsCop...tCopy)': (IsCopy, NotCopy)
-            208..232 '(IsCop...test()': bool
+            208..232 '(IsCop...test()': {unknown}
             209..215 'IsCopy': IsCopy
             217..224 'NotCopy': NotCopy
         "#]],
@@ -3126,7 +3126,7 @@ fn test() {
             79..194 '{     ...ized }': ()
             85..88 '1u8': u8
             85..95 '1u8.test()': bool
-            101..116 '(*"foo").test()': bool
+            101..116 '(*"foo").test()': {unknown}
             102..108 '*"foo"': str
             103..108 '"foo"': &'static str
             135..145 '(1u8, 1u8)': (u8, u8)
@@ -3134,7 +3134,7 @@ fn test() {
             136..139 '1u8': u8
             141..144 '1u8': u8
             158..171 '(1u8, *"foo")': (u8, str)
-            158..178 '(1u8, ...test()': bool
+            158..178 '(1u8, ...test()': {unknown}
             159..162 '1u8': u8
             164..170 '*"foo"': str
             165..170 '"foo"': &'static str
@@ -4069,7 +4069,7 @@ fn f<F: Foo>() {
             212..295 '{     ...ZED; }': ()
             218..239 'F::Exp..._SIZED': Yes
             245..266 'F::Imp..._SIZED': Yes
-            272..292 'F::Rel..._SIZED': Yes
+            272..292 'F::Rel..._SIZED': {unknown}
         "#]],
     );
 }
@@ -5018,7 +5018,7 @@ fn deserialize_abs_pathbuf<'de, D>(de: D) -> D::Error
 "#,
         expect![[r#"
             84..86 'de': D
-            135..138 '{ }': <D as Deserializer<'de>>::Error
+            135..138 '{ }': ()
         "#]],
     );
 }
@@ -5083,7 +5083,7 @@ fn next(&mut self) -> Option<I::Item> {
     let _ = iter.into_iter();
 }"#,
         expect![[r#"
-            10..313 '{     ...r(); }': ()
+            10..313 '{     ...r(); }': !
             223..227 'iter': Box<dyn Iterator<Item = &'? [u8]> + 'static>
             273..280 'loop {}': !
             278..280 '{}': ()
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/traits.rs b/src/tools/rust-analyzer/crates/hir-ty/src/traits.rs
index 9582f2c..4c76ae9 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/traits.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/traits.rs
@@ -1,12 +1,15 @@
 //! Trait solving using next trait solver.
 
-use std::hash::Hash;
+use std::{cell::OnceCell, hash::Hash};
 
 use base_db::Crate;
 use hir_def::{
-    AdtId, AssocItemId, HasModule, ImplId, Lookup, TraitId,
+    AdtId, AssocItemId, ExpressionStoreOwnerId, GenericDefId, HasModule, ImplId, Lookup, TraitId,
+    expr_store::ExpressionStore,
+    hir::generics::WherePredicate,
     lang_item::LangItems,
     nameres::DefMap,
+    resolver::Resolver,
     signatures::{
         ConstFlags, ConstSignature, EnumFlags, EnumSignature, FnFlags, FunctionSignature,
         StructFlags, StructSignature, TraitFlags, TraitSignature, TypeAliasFlags,
@@ -16,17 +19,20 @@
 use hir_expand::name::Name;
 use intern::sym;
 use rustc_type_ir::{
-    TypingMode,
+    TypeVisitableExt, TypingMode,
     inherent::{BoundExistentialPredicates, IntoKind},
 };
 
 use crate::{
-    Span,
+    LifetimeElisionKind, Span, TyLoweringContext,
     db::HirDatabase,
+    generics::Generics,
+    lower::LoweringMode,
     next_solver::{
         DbInterner, GenericArgs, ParamEnv, StoredClauses, Ty, TyKind,
         infer::{
             DbInternerInferExt, InferCtxt,
+            select::EvaluationResult,
             traits::{Obligation, ObligationCause},
         },
         obligation_ctxt::ObligationCtxt,
@@ -121,7 +127,7 @@ pub fn implements_trait_unique<'db>(
     env: ParamEnvAndCrate<'db>,
     trait_: TraitId,
 ) -> bool {
-    implements_trait_unique_impl(db, env, trait_, &mut |infcx| {
+    implements_trait_unique_with_infcx(db, env, trait_, &mut |infcx| {
         infcx.fill_rest_fresh_args(Span::Dummy, trait_.into(), [ty.into()])
     })
 }
@@ -133,10 +139,10 @@ pub fn implements_trait_unique_with_args<'db>(
     trait_: TraitId,
     args: GenericArgs<'db>,
 ) -> bool {
-    implements_trait_unique_impl(db, env, trait_, &mut |_| args)
+    implements_trait_unique_with_infcx(db, env, trait_, &mut |_| args)
 }
 
-fn implements_trait_unique_impl<'db>(
+pub fn implements_trait_unique_with_infcx<'db>(
     db: &'db dyn HirDatabase,
     env: ParamEnvAndCrate<'db>,
     trait_: TraitId,
@@ -153,6 +159,90 @@ fn implements_trait_unique_impl<'db>(
     infcx.predicate_must_hold_modulo_regions(&obligation)
 }
 
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum WherePredicateEvaluation {
+    Holds,
+    NotProven,
+    HasErrors,
+    NoObligations,
+}
+
+/// This should not be used in `hir-ty`, only in `hir`.
+/// This is exposed to allow the IDE to evaluate arbitrary predicates.
+pub fn where_predicate_must_hold<'db>(
+    db: &'db dyn HirDatabase,
+    resolver: &Resolver<'db>,
+    store: &ExpressionStore,
+    def: ExpressionStoreOwnerId,
+    generic_def: GenericDefId,
+    env: ParamEnvAndCrate<'db>,
+    predicate: &WherePredicate,
+) -> WherePredicateEvaluation {
+    let interner = DbInterner::new_with(db, env.krate);
+    let infcx = interner.infer_ctxt().build(TypingMode::PostAnalysis);
+    let generics = OnceCell::<Generics<'db>>::new();
+    let mut ctx = TyLoweringContext::new(
+        db,
+        resolver,
+        store,
+        def,
+        generic_def,
+        &generics,
+        LifetimeElisionKind::Infer,
+    )
+    .with_interning_mode(LoweringMode::Ide);
+    let clauses =
+        ctx.lower_where_predicate(predicate, false).map(|(clause, _)| clause).collect::<Vec<_>>();
+
+    if !ctx.diagnostics.is_empty()
+        || clauses.iter().any(|clause| clause.as_predicate().references_error())
+    {
+        return WherePredicateEvaluation::HasErrors;
+    }
+
+    if clauses.is_empty() {
+        return if ctx.unsized_types.is_empty() {
+            WherePredicateEvaluation::HasErrors
+        } else {
+            WherePredicateEvaluation::NoObligations
+        };
+    }
+
+    let result = infcx.probe(|snapshot| {
+        let mut ocx = ObligationCtxt::new(&infcx);
+        for clause in clauses {
+            let obligation = Obligation::new(
+                interner,
+                ObligationCause::dummy(),
+                env.param_env,
+                clause.as_predicate(),
+            );
+            ocx.register_obligation(obligation);
+        }
+
+        let mut result = EvaluationResult::EvaluatedToOk;
+        for error in ocx.evaluate_obligations_error_on_ambiguity() {
+            if error.is_true_error() {
+                return EvaluationResult::EvaluatedToErr;
+            }
+            result = result.max(EvaluationResult::EvaluatedToAmbig);
+        }
+        if infcx.opaque_types_added_in_snapshot(snapshot) {
+            result.max(EvaluationResult::EvaluatedToOkModuloOpaqueTypes)
+        } else if infcx.region_constraints_added_in_snapshot(snapshot) {
+            result.max(EvaluationResult::EvaluatedToOkModuloRegions)
+        } else {
+            result
+        }
+    });
+
+    if result.must_apply_modulo_regions() {
+        WherePredicateEvaluation::Holds
+    } else {
+        WherePredicateEvaluation::NotProven
+    }
+}
+
 pub fn is_inherent_impl_coherent(db: &dyn HirDatabase, def_map: &DefMap, impl_id: ImplId) -> bool {
     let self_ty = db.impl_self_ty(impl_id).instantiate_identity().skip_norm_wip();
     let self_ty = self_ty.kind();
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/variance.rs b/src/tools/rust-analyzer/crates/hir-ty/src/variance.rs
index 7eee78b..0a95416 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/variance.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/variance.rs
@@ -25,8 +25,8 @@
     db::HirDatabase,
     generics::{Generics, generics},
     next_solver::{
-        Const, ConstKind, DbInterner, ExistentialPredicate, GenericArgKind, GenericArgs, Region,
-        RegionKind, StoredVariancesOf, TermKind, Ty, TyKind, VariancesOf,
+        Const, ConstKind, DbInterner, ExistentialPredicate, GenericArgKind, GenericArgs, Pattern,
+        PatternKind, Region, RegionKind, StoredVariancesOf, TermKind, Ty, TyKind, VariancesOf,
     },
 };
 
@@ -126,7 +126,7 @@ fn solve(mut self) -> Box<[Variance]> {
                 let mut add_constraints_from_variant = |variant| {
                     for (_, field) in db.field_types(variant).iter() {
                         self.add_constraints_from_ty(
-                            field.get().instantiate_identity().skip_norm_wip(),
+                            field.ty().instantiate_identity().skip_norm_wip(),
                             Variance::Covariant,
                         );
                     }
@@ -135,7 +135,7 @@ fn solve(mut self) -> Box<[Variance]> {
                     AdtId::StructId(s) => add_constraints_from_variant(VariantId::StructId(s)),
                     AdtId::UnionId(u) => add_constraints_from_variant(VariantId::UnionId(u)),
                     AdtId::EnumId(e) => {
-                        e.enum_variants(db).variants.iter().for_each(|&(variant, _, _)| {
+                        e.enum_variants(db).variants.values().for_each(|&(variant, _)| {
                             add_constraints_from_variant(VariantId::EnumVariantId(variant))
                         });
                     }
@@ -249,17 +249,35 @@ fn add_constraints_from_ty(&mut self, ty: Ty<'db>, variance: Variance) {
                 // we encounter this when walking the trait references for object
                 // types, where we use Error as the Self type
             }
+            TyKind::Pat(typ, pat) => {
+                self.add_constraints_from_pat(pat);
+                self.add_constraints_from_ty(typ, variance);
+            }
             TyKind::Bound(..) => {}
             TyKind::CoroutineWitness(..)
             | TyKind::Placeholder(..)
             | TyKind::Infer(..)
-            | TyKind::UnsafeBinder(..)
-            | TyKind::Pat(..) => {
+            | TyKind::UnsafeBinder(..) => {
                 never!("unexpected type encountered in variance inference: {:?}", ty)
             }
         }
     }
 
+    fn add_constraints_from_pat(&mut self, pat: Pattern<'db>) {
+        match pat.kind() {
+            PatternKind::Range { start, end } => {
+                self.add_constraints_from_const(start);
+                self.add_constraints_from_const(end);
+            }
+            PatternKind::NotNull => {}
+            PatternKind::Or(patterns) => {
+                for pat in patterns {
+                    self.add_constraints_from_pat(pat)
+                }
+            }
+        }
+    }
+
     fn add_constraints_from_invariant_args(&mut self, args: GenericArgs<'db>) {
         for k in args.iter() {
             match k.kind() {
diff --git a/src/tools/rust-analyzer/crates/hir/src/attrs.rs b/src/tools/rust-analyzer/crates/hir/src/attrs.rs
index f9cf05e..9a61885 100644
--- a/src/tools/rust-analyzer/crates/hir/src/attrs.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/attrs.rs
@@ -26,8 +26,8 @@
 
 use crate::{
     Adt, AsAssocItem, AssocItem, BuiltinType, Const, ConstParam, DocLinkDef, Enum, EnumVariant,
-    ExternCrateDecl, Field, Function, GenericParam, HasCrate, Impl, LangItem, LifetimeParam, Macro,
-    Module, ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, Variant,
+    ExternCrateDecl, Field, Function, GenericParam, Impl, LangItem, LifetimeParam, Macro, Module,
+    ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, Variant,
 };
 
 #[derive(Debug, Clone, Copy)]
@@ -487,27 +487,28 @@ fn resolve_impl_trait_item<'db>(
     ns: Option<Namespace>,
 ) -> Option<DocLinkDef> {
     let krate = ty.krate(db);
-    let environment = crate::param_env_from_resolver(db, &resolver);
+    let param_env = ty.param_env(db);
     let traits_in_scope = resolver.traits_in_scope(db);
 
     // `ty.iterate_path_candidates()` require a scope, which is not available when resolving
     // attributes here. Use path resolution directly instead.
     //
     // FIXME: resolve type aliases (which are not yielded by iterate_path_candidates)
-    let interner = DbInterner::new_with(db, environment.krate);
+    let interner = DbInterner::new_with(db, param_env.krate);
     let infcx = interner.infer_ctxt().build(TypingMode::PostAnalysis);
     let features = resolver.top_level_def_map().features();
     let ctx = MethodResolutionContext {
         infcx: &infcx,
         resolver: &resolver,
-        param_env: environment.param_env,
+        param_env: param_env.param_env,
         traits_in_scope: &traits_in_scope,
-        edition: krate.edition(db),
+        edition: krate.data(db).edition,
         features,
         call_span: hir_ty::Span::Dummy,
         receiver_span: hir_ty::Span::Dummy,
     };
-    let resolution = ctx.probe_for_name(method_resolution::Mode::Path, name.clone(), ty.ty);
+    let resolution =
+        ctx.probe_for_name(method_resolution::Mode::Path, name.clone(), ty.ty.skip_binder());
     let resolution = match resolution {
         Ok(resolution) => resolution.item,
         Err(MethodError::PrivateMatch(resolution)) => resolution.item,
diff --git a/src/tools/rust-analyzer/crates/hir/src/diagnostics.rs b/src/tools/rust-analyzer/crates/hir/src/diagnostics.rs
index a044f24..ed073cb 100644
--- a/src/tools/rust-analyzer/crates/hir/src/diagnostics.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/diagnostics.rs
@@ -11,16 +11,17 @@
         ExprOrPatPtr, ExpressionStoreSourceMap, hir_assoc_type_binding_to_ast,
         hir_generic_arg_to_ast, hir_segment_to_ast_segment,
     },
-    hir::ExprOrPatId,
+    hir::{ExprId, ExprOrPatId, PatId},
+    type_ref::TypeRefId,
 };
 use hir_expand::{HirFileId, InFile, mod_path::ModPath, name::Name};
 use hir_ty::{
-    CastError, InferenceDiagnostic, InferenceTyDiagnosticSource, ParamEnvAndCrate,
-    PathGenericsSource, PathLoweringDiagnostic, TyLoweringDiagnostic, TyLoweringDiagnosticKind,
+    CastError, ExplicitDropMethodUseKind, InferenceDiagnostic, InferenceTyDiagnosticSource,
+    PathGenericsSource, PathLoweringDiagnostic, TyLoweringDiagnostic,
     db::HirDatabase,
     diagnostics::{BodyValidationDiagnostic, UnsafetyReason},
     display::{DisplayTarget, HirDisplay},
-    next_solver::DbInterner,
+    next_solver::{DbInterner, EarlyBinder},
     solver_errors::SolverDiagnosticKind,
 };
 use stdx::{impl_from, never};
@@ -31,7 +32,7 @@
 };
 use triomphe::Arc;
 
-use crate::{AssocItem, Field, Function, GenericDef, Local, Trait, Type, Variant};
+use crate::{AssocItem, Field, Function, GenericDef, Local, Trait, Type, TypeOwnerId, Variant};
 
 pub use hir_def::VariantId;
 pub use hir_ty::{
@@ -100,11 +101,17 @@ fn from(d: $diag $(<$lt>)?) -> $AnyDiagnostic<$db> {
 }
 
 diagnostics![AnyDiagnostic<'db> ->
+    ArrayPatternWithoutFixedLength,
     AwaitOutsideOfAsync,
     BreakOutsideOfLoop,
+    CannotBeDereferenced<'db>,
+    CannotImplicitlyDerefTraitObject<'db>,
+    CannotIndexInto<'db>,
     CastToUnsized<'db>,
     ExpectedArrayOrSlicePat<'db>,
     ExpectedFunction<'db>,
+    ExplicitDropMethodUse,
+    FruInDestructuringAssignment,
     FunctionalRecordUpdateOnNonStruct,
     GenericDefaultRefersToSelf,
     InactiveCode,
@@ -112,22 +119,27 @@ fn from(d: $diag $(<$lt>)?) -> $AnyDiagnostic<$db> {
     IncorrectCase,
     IncorrectGenericsLen,
     IncorrectGenericsOrder,
+    InferVarsNotAllowed,
     InvalidCast<'db>,
     InvalidDeriveTarget,
     InvalidLhsOfAssignment,
+    InvalidRangePatType,
     MacroDefError,
     MacroError,
     MacroExpansionParseError,
     MalformedDerive,
+    MethodCallIllegalSizedBound,
     MismatchedArgCount,
     MismatchedTupleStructPatArgCount,
     MissingFields,
     MissingMatchArms,
     MissingUnsafe,
     MovedOutOfRef<'db>,
+    MutableRefBinding,
     NeedMut,
     NonExhaustiveLet,
     NonExhaustiveRecordExpr,
+    NonExhaustiveRecordPat,
     NoSuchField,
     MismatchedArrayPatLen,
     DuplicateField,
@@ -298,18 +310,56 @@ pub struct MismatchedArrayPatLen {
 }
 
 #[derive(Debug)]
+pub struct ArrayPatternWithoutFixedLength {
+    pub pat: InFile<ExprOrPatPtr>,
+}
+
+#[derive(Debug)]
 pub struct ExpectedArrayOrSlicePat<'db> {
     pub pat: InFile<ExprOrPatPtr>,
     pub found: Type<'db>,
 }
 
 #[derive(Debug)]
+pub struct InvalidRangePatType {
+    pub pat: InFile<ExprOrPatPtr>,
+}
+
+#[derive(Debug)]
 pub struct ExpectedFunction<'db> {
     pub call: InFile<ExprOrPatPtr>,
     pub found: Type<'db>,
 }
 
 #[derive(Debug)]
+pub struct CannotBeDereferenced<'db> {
+    pub expr: InFile<ExprOrPatPtr>,
+    pub found: Type<'db>,
+}
+
+#[derive(Debug)]
+pub struct CannotImplicitlyDerefTraitObject<'db> {
+    pub pat: InFile<ExprOrPatPtr>,
+    pub found: Type<'db>,
+}
+
+#[derive(Debug)]
+pub struct CannotIndexInto<'db> {
+    pub expr: InFile<ExprOrPatPtr>,
+    pub found: Type<'db>,
+}
+
+#[derive(Debug)]
+pub struct ExplicitDropMethodUse {
+    pub expr_or_path: Either<InFile<AstPtr<ast::MethodCallExpr>>, InFile<AstPtr<ast::Path>>>,
+}
+
+#[derive(Debug)]
+pub struct FruInDestructuringAssignment {
+    pub node: InFile<AstPtr<ast::Expr>>,
+}
+
+#[derive(Debug)]
 pub struct FunctionalRecordUpdateOnNonStruct {
     pub base_expr: InFile<ExprOrPatPtr>,
 }
@@ -401,6 +451,12 @@ pub struct NonExhaustiveRecordExpr {
 }
 
 #[derive(Debug)]
+pub struct NonExhaustiveRecordPat {
+    pub pat: InFile<ExprOrPatPtr>,
+    pub variant: Variant,
+}
+
+#[derive(Debug)]
 pub struct TypeMismatch<'db> {
     pub expr_or_pat: InFile<ExprOrPatPtr>,
     pub expected: Type<'db>,
@@ -511,6 +567,11 @@ pub struct BadRtn {
 }
 
 #[derive(Debug)]
+pub struct InferVarsNotAllowed {
+    pub node: InFile<SyntaxNodePtr>,
+}
+
+#[derive(Debug)]
 pub struct IncorrectGenericsLen {
     /// Points at the name if there are no generics.
     pub generics_or_segment: InFile<AstPtr<Either<ast::GenericArgList, ast::NameRef>>>,
@@ -583,6 +644,11 @@ pub struct InvalidLhsOfAssignment {
 }
 
 #[derive(Debug)]
+pub struct MethodCallIllegalSizedBound {
+    pub call_expr: InFile<ExprOrPatPtr>,
+}
+
+#[derive(Debug)]
 pub struct PatternArgInExternFn {
     pub node: InFile<AstPtr<ast::Pat>>,
 }
@@ -594,6 +660,11 @@ pub struct UnimplementedTrait<'db> {
     pub root_trait_predicate: Option<crate::TraitPredicate<'db>>,
 }
 
+#[derive(Debug)]
+pub struct MutableRefBinding {
+    pub pat: InFile<ExprOrPatPtr>,
+}
+
 impl<'db> AnyDiagnostic<'db> {
     pub(crate) fn body_validation_diagnostic(
         db: &'db dyn HirDatabase,
@@ -733,42 +804,16 @@ pub(crate) fn inference_diagnostic(
         d: &'db InferenceDiagnostic,
         source_map: &hir_def::expr_store::BodySourceMap,
         sig_map: &hir_def::expr_store::ExpressionStoreSourceMap,
-        env: ParamEnvAndCrate<'db>,
+        type_owner: TypeOwnerId,
     ) -> Option<AnyDiagnostic<'db>> {
-        let expr_syntax = |expr| {
-            source_map
-                .expr_syntax(expr)
-                .inspect_err(|_| stdx::never!("inference diagnostic in desugared expr"))
-                .ok()
-        };
-        let pat_syntax = |pat| {
-            source_map
-                .pat_syntax(pat)
-                .inspect_err(|_| stdx::never!("inference diagnostic in desugared pattern"))
-                .ok()
-        };
-        let type_syntax = |pat| {
-            source_map
-                .type_syntax(pat)
-                .inspect_err(|_| stdx::never!("inference diagnostic in desugared type"))
-                .ok()
-        };
+        let expr_syntax = |expr| Self::expr_syntax(expr, source_map);
+        let pat_syntax = |pat| Self::pat_syntax(pat, source_map);
         let expr_or_pat_syntax = |id| match id {
             ExprOrPatId::ExprId(expr) => expr_syntax(expr),
             ExprOrPatId::PatId(pat) => pat_syntax(pat),
         };
-        let span_syntax = |span| match span {
-            hir_ty::Span::ExprId(idx) => expr_syntax(idx).map(|it| it.upcast()),
-            hir_ty::Span::PatId(idx) => pat_syntax(idx).map(|it| it.upcast()),
-            hir_ty::Span::TypeRefId(idx) => type_syntax(idx).map(|it| it.upcast()),
-            hir_ty::Span::BindingId(idx) => {
-                pat_syntax(source_map.patterns_for_binding(idx)[0]).map(|it| it.upcast())
-            }
-            hir_ty::Span::Dummy => {
-                never!("should never create a diagnostic for dummy spans");
-                None
-            }
-        };
+        let new_ty = |ty| Type { owner: type_owner, ty: EarlyBinder::bind(ty) };
+        let span_syntax = |span| Self::span_syntax(span, source_map);
         Some(match d {
             &InferenceDiagnostic::NoSuchField { field: expr, private, variant } => {
                 let expr_or_pat = match expr {
@@ -784,9 +829,21 @@ pub(crate) fn inference_diagnostic(
                 let pat = pat_syntax(pat)?.map(Into::into);
                 MismatchedArrayPatLen { pat, expected, found, has_rest }.into()
             }
+            &InferenceDiagnostic::ArrayPatternWithoutFixedLength { pat } => {
+                let pat = pat_syntax(pat)?.map(Into::into);
+                ArrayPatternWithoutFixedLength { pat }.into()
+            }
             InferenceDiagnostic::ExpectedArrayOrSlicePat { pat, found } => {
                 let pat = pat_syntax(*pat)?.map(Into::into);
-                ExpectedArrayOrSlicePat { pat, found: Type::new(db, def, found.as_ref()) }.into()
+                ExpectedArrayOrSlicePat {
+                    pat,
+                    found: Type { owner: type_owner, ty: EarlyBinder::bind(found.as_ref()) },
+                }
+                .into()
+            }
+            &InferenceDiagnostic::InvalidRangePatType { pat } => {
+                let pat = pat_syntax(pat)?.map(Into::into);
+                InvalidRangePatType { pat }.into()
             }
             &InferenceDiagnostic::DuplicateField { field: expr, variant } => {
                 let expr_or_pat = match expr {
@@ -812,8 +869,7 @@ pub(crate) fn inference_diagnostic(
             }
             InferenceDiagnostic::ExpectedFunction { call_expr, found } => {
                 let call_expr = expr_syntax(*call_expr)?;
-                ExpectedFunction { call: call_expr, found: Type::new(db, def, found.as_ref()) }
-                    .into()
+                ExpectedFunction { call: call_expr, found: new_ty(found.as_ref()) }.into()
             }
             InferenceDiagnostic::UnresolvedField {
                 expr,
@@ -825,7 +881,7 @@ pub(crate) fn inference_diagnostic(
                 UnresolvedField {
                     expr,
                     name: name.clone(),
-                    receiver: Type::new(db, def, receiver.as_ref()),
+                    receiver: new_ty(receiver.as_ref()),
                     method_with_same_name_exists: *method_with_same_name_exists,
                 }
                 .into()
@@ -841,10 +897,10 @@ pub(crate) fn inference_diagnostic(
                 UnresolvedMethodCall {
                     expr,
                     name: name.clone(),
-                    receiver: Type::new(db, def, receiver.as_ref()),
+                    receiver: new_ty(receiver.as_ref()),
                     field_with_same_name: field_with_same_name
                         .as_ref()
-                        .map(|ty| Type::new(db, def, ty.as_ref())),
+                        .map(|ty| new_ty(ty.as_ref())),
                     assoc_func_with_same_name: assoc_func_with_same_name.map(Into::into),
                 }
                 .into()
@@ -872,12 +928,16 @@ pub(crate) fn inference_diagnostic(
             &InferenceDiagnostic::NonExhaustiveRecordExpr { expr } => {
                 NonExhaustiveRecordExpr { expr: expr_syntax(expr)? }.into()
             }
+            &InferenceDiagnostic::NonExhaustiveRecordPat { pat, variant } => {
+                let pat = pat_syntax(pat)?.map(Into::into);
+                NonExhaustiveRecordPat { pat, variant: variant.into() }.into()
+            }
             &InferenceDiagnostic::FunctionalRecordUpdateOnNonStruct { base_expr } => {
                 FunctionalRecordUpdateOnNonStruct { base_expr: expr_syntax(base_expr)? }.into()
             }
             InferenceDiagnostic::TypedHole { expr, expected } => {
                 let expr = expr_syntax(*expr)?;
-                TypedHole { expr, expected: Type::new(db, def, expected.as_ref()) }.into()
+                TypedHole { expr, expected: new_ty(expected.as_ref()) }.into()
             }
             &InferenceDiagnostic::MismatchedTupleStructPatArgCount { pat, expected, found } => {
                 let InFile { file_id, value } = pat_syntax(pat)?;
@@ -888,14 +948,26 @@ pub(crate) fn inference_diagnostic(
             }
             InferenceDiagnostic::CastToUnsized { expr, cast_ty } => {
                 let expr = expr_syntax(*expr)?;
-                CastToUnsized { expr, cast_ty: Type::new(db, def, cast_ty.as_ref()) }.into()
+                CastToUnsized { expr, cast_ty: new_ty(cast_ty.as_ref()) }.into()
             }
             InferenceDiagnostic::InvalidCast { expr, error, expr_ty, cast_ty } => {
                 let expr = expr_syntax(*expr)?;
-                let expr_ty = Type::new(db, def, expr_ty.as_ref());
-                let cast_ty = Type::new(db, def, cast_ty.as_ref());
+                let expr_ty = new_ty(expr_ty.as_ref());
+                let cast_ty = new_ty(cast_ty.as_ref());
                 InvalidCast { expr, error: *error, expr_ty, cast_ty }.into()
             }
+            InferenceDiagnostic::CannotBeDereferenced { expr, found } => {
+                let expr = expr_syntax(*expr)?;
+                CannotBeDereferenced { expr, found: new_ty(found.as_ref()) }.into()
+            }
+            InferenceDiagnostic::CannotImplicitlyDerefTraitObject { pat, found } => {
+                let pat = pat_syntax(*pat)?.map(Into::into);
+                CannotImplicitlyDerefTraitObject { pat, found: new_ty(found.as_ref()) }.into()
+            }
+            InferenceDiagnostic::CannotIndexInto { expr, found } => {
+                let expr = expr_syntax(*expr)?;
+                CannotIndexInto { expr, found: new_ty(found.as_ref()) }.into()
+            }
             InferenceDiagnostic::TyDiagnostic { source, diag } => {
                 let source_map = match source {
                     InferenceTyDiagnosticSource::Body => source_map,
@@ -963,13 +1035,13 @@ pub(crate) fn inference_diagnostic(
                 let lhs = expr_syntax(lhs)?;
                 InvalidLhsOfAssignment { lhs }.into()
             }
+            &InferenceDiagnostic::MethodCallIllegalSizedBound { call_expr } => {
+                MethodCallIllegalSizedBound { call_expr: expr_syntax(call_expr)? }.into()
+            }
             &InferenceDiagnostic::TypeMustBeKnown { at_point, ref top_term } => {
                 let at_point = span_syntax(at_point)?;
                 let top_term = top_term.as_ref().map(|top_term| match top_term.as_ref().kind() {
-                    rustc_type_ir::GenericArgKind::Type(ty) => Either::Left(Type {
-                        ty,
-                        env: crate::body_param_env_from_has_crate(db, def),
-                    }),
+                    rustc_type_ir::GenericArgKind::Type(ty) => Either::Left(new_ty(ty)),
                     // FIXME: Printing the const to string is definitely not the correct thing to do here.
                     rustc_type_ir::GenericArgKind::Const(konst) => Either::Right(
                         konst.display(db, DisplayTarget::from_crate(db, def.krate(db))).to_string(),
@@ -988,14 +1060,37 @@ pub(crate) fn inference_diagnostic(
                 let expr_or_pat = expr_or_pat_syntax(*node)?;
                 TypeMismatch {
                     expr_or_pat,
-                    expected: Type { env, ty: expected.as_ref() },
-                    actual: Type { env, ty: found.as_ref() },
+                    expected: Type { owner: type_owner, ty: EarlyBinder::bind(expected.as_ref()) },
+                    actual: Type { owner: type_owner, ty: EarlyBinder::bind(found.as_ref()) },
                 }
                 .into()
             }
             InferenceDiagnostic::SolverDiagnostic(d) => {
                 let span = span_syntax(d.span)?;
-                Self::solver_diagnostic(db, &d.kind, span, env)?
+                Self::solver_diagnostic(db, &d.kind, span, type_owner)?
+            }
+            InferenceDiagnostic::ExplicitDropMethodUse { kind } => {
+                let expr_or_path = match kind {
+                    ExplicitDropMethodUseKind::MethodCall(expr) => {
+                        let expr = expr_syntax(*expr)?;
+                        let expr = expr.with_value(expr.value.cast::<ast::MethodCallExpr>()?);
+                        Either::Left(expr)
+                    }
+                    ExplicitDropMethodUseKind::Path(path_expr_id) => {
+                        let syntax = expr_or_pat_syntax(*path_expr_id)?;
+                        let file_id = syntax.file_id;
+                        let syntax =
+                            syntax.with_value(syntax.value.cast::<ast::PathExpr>()?).to_node(db);
+                        let path = syntax.path()?;
+                        let path = InFile::new(file_id, AstPtr::new(&path));
+                        Either::Right(path)
+                    }
+                };
+                ExplicitDropMethodUse { expr_or_path }.into()
+            }
+            InferenceDiagnostic::MutableRefBinding { pat } => {
+                let pat = pat_syntax(*pat)?.map(Into::into);
+                MutableRefBinding { pat }.into()
             }
         })
     }
@@ -1004,16 +1099,21 @@ fn solver_diagnostic(
         db: &'db dyn HirDatabase,
         d: &'db SolverDiagnosticKind,
         span: SpanSyntax,
-        env: ParamEnvAndCrate<'db>,
+        type_owner: TypeOwnerId,
     ) -> Option<AnyDiagnostic<'db>> {
         let interner = DbInterner::new_no_crate(db);
         Some(match d {
             SolverDiagnosticKind::TraitUnimplemented { trait_predicate, root_trait_predicate } => {
-                let trait_predicate =
-                    crate::TraitPredicate { inner: trait_predicate.get(interner), env };
+                let trait_predicate = crate::TraitPredicate {
+                    inner: trait_predicate.get(interner),
+                    owner: type_owner,
+                };
                 let root_trait_predicate =
                     root_trait_predicate.as_ref().map(|root_trait_predicate| {
-                        crate::TraitPredicate { inner: root_trait_predicate.get(interner), env }
+                        crate::TraitPredicate {
+                            inner: root_trait_predicate.get(interner),
+                            owner: type_owner,
+                        }
                     });
                 UnimplementedTrait { span, trait_predicate, root_trait_predicate }.into()
             }
@@ -1118,21 +1218,73 @@ fn path_diagnostic(
         })
     }
 
+    fn expr_syntax(
+        expr: ExprId,
+        source_map: &ExpressionStoreSourceMap,
+    ) -> Option<InFile<ExprOrPatPtr>> {
+        source_map
+            .expr_syntax(expr)
+            .inspect_err(|_| stdx::never!("inference diagnostic in desugared expr"))
+            .ok()
+    }
+
+    fn pat_syntax(
+        pat: PatId,
+        source_map: &ExpressionStoreSourceMap,
+    ) -> Option<InFile<ExprOrPatPtr>> {
+        source_map
+            .pat_syntax(pat)
+            .inspect_err(|_| stdx::never!("inference diagnostic in desugared pattern"))
+            .ok()
+    }
+
+    fn type_syntax(
+        type_ref: TypeRefId,
+        source_map: &ExpressionStoreSourceMap,
+    ) -> Option<InFile<AstPtr<ast::Type>>> {
+        source_map
+            .type_syntax(type_ref)
+            .inspect_err(|_| stdx::never!("inference diagnostic in desugared type"))
+            .ok()
+    }
+
+    fn span_syntax(
+        span: hir_ty::Span,
+        source_map: &ExpressionStoreSourceMap,
+    ) -> Option<InFile<AstPtr<SpanAst>>> {
+        Some(match span {
+            hir_ty::Span::ExprId(idx) => Self::expr_syntax(idx, source_map)?.map(|it| it.upcast()),
+            hir_ty::Span::PatId(idx) => Self::pat_syntax(idx, source_map)?.map(|it| it.upcast()),
+            hir_ty::Span::TypeRefId(idx) => {
+                Self::type_syntax(idx, source_map)?.map(|it| it.upcast())
+            }
+            hir_ty::Span::BindingId(idx) => {
+                let &pat = source_map.patterns_for_binding(idx).first()?;
+                Self::pat_syntax(pat, source_map)?.map(|it| it.upcast())
+            }
+            hir_ty::Span::Dummy => {
+                never!("should never create a diagnostic for dummy spans");
+                return None;
+            }
+        })
+    }
+
     pub(crate) fn ty_diagnostic(
         diag: &TyLoweringDiagnostic,
         source_map: &ExpressionStoreSourceMap,
         db: &'db dyn HirDatabase,
     ) -> Option<AnyDiagnostic<'db>> {
-        let Ok(source) = source_map.type_syntax(diag.source) else {
-            stdx::never!("error on synthetic type syntax");
-            return None;
-        };
-        let syntax = || source.value.to_node(&db.parse_or_expand(source.file_id));
-        Some(match &diag.kind {
-            TyLoweringDiagnosticKind::PathDiagnostic(diag) => {
-                let ast::Type::PathType(syntax) = syntax() else { return None };
+        Some(match diag {
+            TyLoweringDiagnostic::PathDiagnostic { source, diag } => {
+                let source = Self::type_syntax(*source, source_map)?;
+                let syntax = source.value.to_node(&db.parse_or_expand(source.file_id));
+                let ast::Type::PathType(syntax) = syntax else { return None };
                 Self::path_diagnostic(diag, source.with_value(syntax.path()?))?
             }
+            TyLoweringDiagnostic::InferVarsNotAllowed { source } => {
+                let source = Self::span_syntax(*source, source_map)?;
+                InferVarsNotAllowed { node: source.map(Into::into) }.into()
+            }
         })
     }
 }
diff --git a/src/tools/rust-analyzer/crates/hir/src/display.rs b/src/tools/rust-analyzer/crates/hir/src/display.rs
index a71851e..ed18482 100644
--- a/src/tools/rust-analyzer/crates/hir/src/display.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/display.rs
@@ -2,7 +2,8 @@
 
 use either::Either;
 use hir_def::{
-    AdtId, BuiltinDeriveImplId, FunctionId, GenericDefId, ImplId, ItemContainerId,
+    AdtId, BuiltinDeriveImplId, DefWithBodyId, ExpressionStoreOwnerId, FunctionId, GenericDefId,
+    ImplId, ItemContainerId,
     builtin_derive::BuiltinDeriveImplMethod,
     expr_store::{Body, ExpressionStore},
     hir::generics::{GenericParams, TypeOrConstParamData, TypeParamProvenance, WherePredicate},
@@ -32,7 +33,7 @@
     Adt, AnyFunctionId, AsAssocItem, AssocItem, AssocItemContainer, Const, ConstParam, Crate, Enum,
     EnumVariant, ExternCrateDecl, Field, Function, GenericParam, HasCrate, HasVisibility, Impl,
     LifetimeParam, Macro, Module, SelfParam, Static, Struct, StructKind, Trait, TraitPredicate,
-    TraitRef, TupleField, Type, TypeAlias, TypeNs, TypeOrConstParam, TypeParam, Union,
+    TraitRef, TupleField, Type, TypeAlias, TypeOrConstParam, TypeParam, Union,
 };
 
 fn write_builtin_derive_impl_method<'db>(
@@ -102,8 +103,11 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
                 if f.show_container_bounds() && !params.is_empty() {
                     write_trait_header(trait_.into(), f)?;
                     f.write_char('\n')?;
-                    has_disaplayable_predicates(f.db, params, params_store)
-                        .then_some((params, params_store))
+                    has_disaplayable_predicates(f.db, params, params_store).then_some((
+                        params,
+                        trait_.into(),
+                        params_store,
+                    ))
                 } else {
                     None
                 }
@@ -113,8 +117,11 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
                 if f.show_container_bounds() && !params.is_empty() {
                     write_impl_header(impl_, f)?;
                     f.write_char('\n')?;
-                    has_disaplayable_predicates(f.db, params, params_store)
-                        .then_some((params, params_store))
+                    has_disaplayable_predicates(f.db, params, params_store).then_some((
+                        params,
+                        impl_.into(),
+                        params_store,
+                    ))
                 } else {
                     None
                 }
@@ -125,7 +132,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
         // Write signature of the function
 
         let has_written_where = write_function(f, id)?;
-        if let Some((container_params, container_params_store)) = container_params {
+        if let Some((container_params, owner, container_params_store)) = container_params {
             if !has_written_where {
                 f.write_str("\nwhere")?;
             }
@@ -135,7 +142,12 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
                 _ => unreachable!(),
             };
             write!(f, "\n    // Bounds from {container_name}:",)?;
-            write_where_predicates(container_params, container_params_store, f)?;
+            write_where_predicates(
+                container_params,
+                ExpressionStoreOwnerId::Signature(owner),
+                container_params_store,
+                f,
+            )?;
         }
         Ok(())
     }
@@ -197,6 +209,7 @@ fn write_function<'db>(f: &mut HirFormatter<'_, 'db>, func_id: FunctionId) -> Re
     let comma = if too_long_param { ",\n    " } else { ", " };
     // FIXME: Use resolved `param.ty` once we no longer discard lifetimes
     let body = Body::of(db, func_id.into());
+    let owner = DefWithBodyId::FunctionId(func_id).into();
     for (type_ref, param) in data.params.iter().zip(func.assoc_fn_params(db)).skip(skip_self) {
         if !first {
             f.write_str(comma)?;
@@ -205,11 +218,11 @@ fn write_function<'db>(f: &mut HirFormatter<'_, 'db>, func_id: FunctionId) -> Re
         }
 
         let pat_id = body.params[param.idx - body.self_param().is_some() as usize];
-        let pat_str = body.pretty_print_pat(db, func_id.into(), pat_id, true, f.edition());
+        let pat_str = body.pretty_print_pat(db, owner, pat_id, true, f.edition());
         f.write_str(&pat_str)?;
 
         f.write_str(": ")?;
-        type_ref.hir_fmt(f, &data.store)?;
+        type_ref.hir_fmt(f, owner, &data.store)?;
     }
 
     if data.is_varargs() {
@@ -258,7 +271,7 @@ fn write_function<'db>(f: &mut HirFormatter<'_, 'db>, func_id: FunctionId) -> Re
             TypeRef::Tuple(tup) if tup.is_empty() => {}
             _ => {
                 f.write_str(" -> ")?;
-                ret_type.hir_fmt(f, &data.store)?;
+                ret_type.hir_fmt(f, owner, &data.store)?;
             }
         }
     }
@@ -278,7 +291,8 @@ fn write_impl_header<'db>(impl_: ImplId, f: &mut HirFormatter<'_, 'db>) -> Resul
     let impl_data = ImplSignature::of(db, impl_);
     if let Some(target_trait) = &impl_data.target_trait {
         f.write_char(' ')?;
-        hir_display_with_store(&impl_data.store[target_trait.path], &impl_data.store).hir_fmt(f)?;
+        hir_display_with_store(&impl_data.store[target_trait.path], impl_.into(), &impl_data.store)
+            .hir_fmt(f)?;
         f.write_str(" for")?;
     }
 
@@ -306,13 +320,14 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
         };
         let data = FunctionSignature::of(f.db, func);
         let param = *data.params.first().unwrap();
+        let owner = ExpressionStoreOwnerId::Body(func.into());
         match &data.store[param] {
             TypeRef::Path(p) if p.is_self_type() => f.write_str("self"),
             TypeRef::Reference(ref_) if matches!(&data.store[ref_.ty], TypeRef::Path(p) if p.is_self_type()) =>
             {
                 f.write_char('&')?;
                 if let Some(lifetime) = &ref_.lifetime {
-                    lifetime.hir_fmt(f, &data.store)?;
+                    lifetime.hir_fmt(f, owner, &data.store)?;
                     f.write_char(' ')?;
                 }
                 if let hir_def::type_ref::Mutability::Mut = ref_.mutability {
@@ -322,7 +337,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
             }
             _ => {
                 f.write_str("self: ")?;
-                param.hir_fmt(f, &data.store)
+                param.hir_fmt(f, owner, &data.store)
             }
         }
     }
@@ -517,7 +532,11 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
                         f.write_str(", ")?;
                     }
                     // Enum variant fields must be pub.
-                    field.type_ref.hir_fmt(f, &data.store)?;
+                    field.type_ref.hir_fmt(
+                        f,
+                        ExpressionStoreOwnerId::VariantFields(self.id.into()),
+                        &data.store,
+                    )?;
                 }
                 f.write_char(')')?;
             }
@@ -533,13 +552,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
 
 impl<'db> HirDisplay<'db> for Type<'db> {
     fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
-        self.ty.hir_fmt(f)
-    }
-}
-
-impl<'db> HirDisplay<'db> for TypeNs<'db> {
-    fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
-        self.ty.hir_fmt(f)
+        self.ty.skip_binder().hir_fmt(f)
     }
 }
 
@@ -579,7 +592,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
         let params = GenericParams::of(f.db, self.id.parent());
         let param_data = &params[self.id.local_id()];
         let krate = self.id.parent().krate(f.db).id;
-        let ty = self.ty(f.db).ty;
+        let ty = self.ty(f.db).ty.skip_binder();
         let predicates = GenericPredicates::query_all(f.db, self.id.parent());
         let predicates = predicates
             .iter_identity()
@@ -666,6 +679,7 @@ fn write_generic_params_or_args<'db>(
     include_defaults: bool,
 ) -> Result {
     let (params, store) = GenericParams::with_store(f.db, def);
+    let owner = def.into();
     if params.iter_lt().next().is_none()
         && params.iter_type_or_consts().all(|it| it.1.const_param().is_none())
         && params
@@ -701,17 +715,17 @@ fn write_generic_params_or_args<'db>(
                     write!(f, "{}", name.display(f.db, f.edition()))?;
                     if include_defaults && let Some(default) = &ty.default {
                         f.write_str(" = ")?;
-                        default.hir_fmt(f, store)?;
+                        default.hir_fmt(f, owner, store)?;
                     }
                 }
                 TypeOrConstParamData::ConstParamData(c) => {
                     delim(f)?;
                     write!(f, "const {}: ", name.display(f.db, f.edition()))?;
-                    c.ty.hir_fmt(f, store)?;
+                    c.ty.hir_fmt(f, owner, store)?;
 
                     if include_defaults && let Some(default) = &c.default {
                         f.write_str(" = ")?;
-                        default.hir_fmt(f, store)?;
+                        default.hir_fmt(f, owner, store)?;
                     }
                 }
             }
@@ -729,7 +743,7 @@ fn write_where_clause<'db>(def: GenericDefId, f: &mut HirFormatter<'_, 'db>) ->
     }
 
     f.write_str("\nwhere")?;
-    write_where_predicates(params, store, f)?;
+    write_where_predicates(params, def.into(), store, f)?;
 
     Ok(true)
 }
@@ -752,6 +766,7 @@ fn has_disaplayable_predicates(
 
 fn write_where_predicates<'db>(
     params: &GenericParams,
+    owner: ExpressionStoreOwnerId,
     store: &ExpressionStore,
     f: &mut HirFormatter<'_, 'db>,
 ) -> Result {
@@ -783,29 +798,31 @@ fn write_where_predicates<'db>(
         f.write_str("\n    ")?;
         match pred {
             TypeBound { target, bound } => {
-                target.hir_fmt(f, store)?;
+                target.hir_fmt(f, owner, store)?;
                 f.write_str(": ")?;
-                bound.hir_fmt(f, store)?;
+                bound.hir_fmt(f, owner, store)?;
             }
             Lifetime { target, bound } => {
-                target.hir_fmt(f, store)?;
+                target.hir_fmt(f, owner, store)?;
                 write!(f, ": ")?;
-                bound.hir_fmt(f, store)?;
+                bound.hir_fmt(f, owner, store)?;
             }
             ForLifetime { lifetimes, target, bound } => {
                 let lifetimes = lifetimes.iter().map(|it| it.display(f.db, f.edition())).join(", ");
                 write!(f, "for<{lifetimes}> ")?;
-                target.hir_fmt(f, store)?;
+                target.hir_fmt(f, owner, store)?;
                 f.write_str(": ")?;
-                bound.hir_fmt(f, store)?;
+                bound.hir_fmt(f, owner, store)?;
             }
         }
 
         while let Some(nxt) = iter.next_if(|nxt| check_same_target(pred, nxt)) {
             f.write_str(" + ")?;
             match nxt {
-                TypeBound { bound, .. } | ForLifetime { bound, .. } => bound.hir_fmt(f, store)?,
-                Lifetime { bound, .. } => bound.hir_fmt(f, store)?,
+                TypeBound { bound, .. } | ForLifetime { bound, .. } => {
+                    bound.hir_fmt(f, owner, store)?
+                }
+                Lifetime { bound, .. } => bound.hir_fmt(f, owner, store)?,
             }
         }
         f.write_str(",")?;
@@ -830,7 +847,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
             Some(name) => write!(f, "{}: ", name.display(f.db, f.edition()))?,
             None => f.write_str("_: ")?,
         }
-        data.type_ref.hir_fmt(f, &data.store)?;
+        data.type_ref.hir_fmt(f, ExpressionStoreOwnerId::Signature(self.id.into()), &data.store)?;
         Ok(())
     }
 }
@@ -844,7 +861,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
             f.write_str("mut ")?;
         }
         write!(f, "{}: ", data.name.display(f.db, f.edition()))?;
-        data.type_ref.hir_fmt(f, &data.store)?;
+        data.type_ref.hir_fmt(f, ExpressionStoreOwnerId::Signature(self.id.into()), &data.store)?;
         Ok(())
     }
 }
@@ -925,13 +942,19 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
         if !data.bounds.is_empty() {
             f.write_str(": ")?;
             f.write_joined(
-                data.bounds.iter().map(|bound| hir_display_with_store(bound, &data.store)),
+                data.bounds.iter().map(|bound| {
+                    hir_display_with_store(
+                        bound,
+                        ExpressionStoreOwnerId::Signature(self.id.into()),
+                        &data.store,
+                    )
+                }),
                 " + ",
             )?;
         }
         if let Some(ty) = data.ty {
             f.write_str(" = ")?;
-            ty.hir_fmt(f, &data.store)?;
+            ty.hir_fmt(f, ExpressionStoreOwnerId::Signature(self.id.into()), &data.store)?;
         }
         write_where_clause(def_id, f)?;
         Ok(())
diff --git a/src/tools/rust-analyzer/crates/hir/src/lib.rs b/src/tools/rust-analyzer/crates/hir/src/lib.rs
index 63b834a..f676a70 100644
--- a/src/tools/rust-analyzer/crates/hir/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/lib.rs
@@ -39,7 +39,8 @@
 pub use hir_def::ModuleId;
 
 use std::{
-    fmt,
+    borrow::Borrow,
+    fmt, iter,
     mem::discriminant,
     ops::{ControlFlow, Not},
 };
@@ -93,19 +94,17 @@
     method_resolution::{self, InherentImpls, MethodResolutionContext},
     mir::interpret_mir,
     next_solver::{
-        AliasTy, AnyImplId, ClauseKind, ConstKind, DbInterner, EarlyBinder, EarlyParamRegion,
-        ErrorGuaranteed, GenericArg, GenericArgs, ParamConst, ParamEnv, PolyFnSig, Region,
-        RegionKind, SolverDefId, Ty, TyKind, TypingMode,
+        AliasTy, AnyImplId, ClauseKind, DbInterner, EarlyBinder, ErrorGuaranteed, GenericArg,
+        GenericArgs, ParamEnv, PolyFnSig, Region, SolverDefId, Ty, TyKind, TypingMode,
         infer::{DbInternerInferExt, InferCtxt},
     },
     traits::{self, is_inherent_impl_coherent, structurally_normalize_ty},
 };
 use itertools::Itertools;
-use rustc_hash::FxHashSet;
+use rustc_hash::{FxHashMap, FxHashSet};
 use rustc_type_ir::{
-    AliasTyKind, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeSuperVisitable, TypeVisitable,
-    TypeVisitor, fast_reject,
-    inherent::{GenericArgs as _, IntoKind, SliceLike, Term as _, Ty as _},
+    AliasTyKind, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, fast_reject,
+    inherent::{AdtDef as _, GenericArgs as _, IntoKind, SliceLike, Term as _, Ty as _},
 };
 use span::{AstIdNode, Edition, FileId};
 use stdx::{format_to, impl_from, never};
@@ -118,6 +117,38 @@
 
 use crate::db::{DefDatabase, HirDatabase};
 
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum PredicateEvaluationStatus {
+    Holds,
+    NotProven,
+    Invalid,
+    Unsupported,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct PredicateEvaluationResult {
+    pub status: PredicateEvaluationStatus,
+    pub message: String,
+}
+
+impl PredicateEvaluationResult {
+    pub fn holds(message: impl Into<String>) -> Self {
+        Self { status: PredicateEvaluationStatus::Holds, message: message.into() }
+    }
+
+    pub fn not_proven(message: impl Into<String>) -> Self {
+        Self { status: PredicateEvaluationStatus::NotProven, message: message.into() }
+    }
+
+    pub fn invalid(message: impl Into<String>) -> Self {
+        Self { status: PredicateEvaluationStatus::Invalid, message: message.into() }
+    }
+
+    pub fn unsupported(message: impl Into<String>) -> Self {
+        Self { status: PredicateEvaluationStatus::Unsupported, message: message.into() }
+    }
+}
+
 pub use crate::{
     attrs::{AttrsWithOwner, HasAttrs, resolve_doc_path_on},
     diagnostics::*,
@@ -165,7 +196,7 @@
         },
         inert_attr_macro::AttributeTemplate,
         mod_path::{ModPath, PathKind, tool_path},
-        name::Name,
+        name::{self, Name},
         prettify_macro_expansion,
         proc_macro::{ProcMacros, ProcMacrosBuilder},
         tt,
@@ -183,6 +214,7 @@
         mir::{MirEvalError, MirLowerError},
         next_solver::abi::Safety,
         next_solver::{clear_tls_solver_cache, collect_ty_garbage},
+        setup_tracing,
     },
     // FIXME: These are needed for import assets, properly encapsulate them.
     hir_ty::{method_resolution::TraitImpls, next_solver::SimplifiedType},
@@ -198,6 +230,7 @@
         name::AsName,
         span_map::{ExpansionSpanMap, RealSpanMap, SpanMap},
     },
+    hir_ty::next_solver,
 };
 
 /// hir::Crate describes a single crate. It's the main interface with which
@@ -781,22 +814,20 @@ pub fn diagnostics<'db>(
                             let (variants, diagnostics) = e.id.enum_variants_with_diagnostics(db);
                             let file = e.id.lookup(db).id.file_id;
                             let ast_id_map = db.ast_id_map(file);
-                            if let Some(diagnostics) = &diagnostics {
-                                for diag in diagnostics.iter() {
-                                    acc.push(
-                                        InactiveCode {
-                                            node: InFile::new(
-                                                file,
-                                                ast_id_map.get(diag.ast_id).syntax_node_ptr(),
-                                            ),
-                                            cfg: diag.cfg.clone(),
-                                            opts: diag.opts.clone(),
-                                        }
-                                        .into(),
-                                    );
-                                }
+                            for diag in diagnostics {
+                                acc.push(
+                                    InactiveCode {
+                                        node: InFile::new(
+                                            file,
+                                            ast_id_map.get(diag.ast_id).syntax_node_ptr(),
+                                        ),
+                                        cfg: diag.cfg.clone(),
+                                        opts: diag.opts.clone(),
+                                    }
+                                    .into(),
+                                );
                             }
-                            for &(v, _, _) in &variants.variants {
+                            for &(v, _) in variants.variants.values() {
                                 let source_map = &v.fields_with_source_map(db).1;
                                 push_ty_diagnostics(
                                     db,
@@ -946,14 +977,17 @@ pub fn diagnostics<'db>(
                     .collect();
 
                 if !missing.is_empty() {
+                    let env = ParamEnvAndCrate {
+                        param_env: db.trait_environment(GenericDefId::from(impl_id)),
+                        krate: self.id.krate(db),
+                    };
                     let self_ty = db.impl_self_ty(impl_id).instantiate_identity().skip_norm_wip();
-                    let self_ty = structurally_normalize_ty(
-                        &infcx,
-                        self_ty,
-                        db.trait_environment(GenericDefId::from(impl_id).into()),
-                    );
+                    let self_ty = structurally_normalize_ty(&infcx, self_ty, env.param_env);
+                    let tail_ty = struct_tail_raw(db, interner, self_ty, |ty| {
+                        structurally_normalize_ty(&infcx, ty, env.param_env)
+                    });
                     let self_ty_is_guaranteed_unsized = matches!(
-                        self_ty.kind(),
+                        tail_ty.kind(),
                         TyKind::Dynamic(..) | TyKind::Slice(..) | TyKind::Str
                     );
                     if self_ty_is_guaranteed_unsized {
@@ -1332,24 +1366,6 @@ pub struct Field {
     pub(crate) id: LocalFieldId,
 }
 
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
-pub struct InstantiatedField<'db> {
-    pub(crate) inner: Field,
-    pub(crate) args: GenericArgs<'db>,
-}
-
-impl<'db> InstantiatedField<'db> {
-    /// Returns the type as in the signature of the struct.
-    pub fn ty(&self, db: &'db dyn HirDatabase) -> TypeNs<'db> {
-        let interner = DbInterner::new_no_crate(db);
-
-        let var_id = self.inner.parent.into();
-        let field = db.field_types(var_id)[self.inner.id].get();
-        let ty = field.instantiate(interner, self.args).skip_norm_wip();
-        TypeNs::new(db, var_id, ty)
-    }
-}
-
 #[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)]
 pub struct TupleField {
     pub owner: InferBodyId,
@@ -1370,7 +1386,7 @@ pub fn ty<'db>(&self, db: &'db dyn HirDatabase) -> Type<'db> {
             .get(self.index as usize)
             .copied()
             .unwrap_or_else(|| Ty::new_error(interner, ErrorGuaranteed));
-        Type { env: body_param_env_from_has_crate(db, self.owner.expression_store_owner(db)), ty }
+        Type::new_body(db, self.owner.expression_store_owner(db), ty)
     }
 }
 
@@ -1420,46 +1436,14 @@ pub fn index(&self) -> usize {
 
     /// Returns the type as in the signature of the struct. Only use this in the
     /// context of the field definition.
-    pub fn ty<'db>(&self, db: &'db dyn HirDatabase) -> TypeNs<'db> {
+    pub fn ty<'db>(&self, db: &'db dyn HirDatabase) -> Type<'db> {
         let var_id = self.parent.into();
-        let ty = db.field_types(var_id)[self.id].get().skip_binder();
-        TypeNs::new(db, var_id, ty)
-    }
-
-    // FIXME: Find better API to also handle const generics
-    pub fn ty_with_args<'db>(
-        &self,
-        db: &'db dyn HirDatabase,
-        generics: impl Iterator<Item = Type<'db>>,
-    ) -> Type<'db> {
-        let var_id = self.parent.into();
-        let def_id: AdtId = match self.parent {
-            Variant::Struct(it) => it.id.into(),
-            Variant::Union(it) => it.id.into(),
-            Variant::EnumVariant(it) => it.parent_enum(db).id.into(),
-        };
-        let interner = DbInterner::new_no_crate(db);
-        let args = generic_args_from_tys(interner, def_id.into(), generics.map(|ty| ty.ty));
-        let ty = db.field_types(var_id)[self.id].get().instantiate(interner, args).skip_norm_wip();
-        Type::new(db, var_id, ty)
+        let ty = db.field_types(var_id)[self.id].ty().instantiate_identity().skip_norm_wip();
+        Type::new(var_id.adt_id(db).into(), ty)
     }
 
     pub fn layout<'db>(&self, db: &'db dyn HirDatabase) -> Result<Layout<'db>, LayoutError> {
-        db.layout_of_ty(
-            self.ty(db).ty.store(),
-            param_env_from_has_crate(
-                db,
-                match hir_def::VariantId::from(self.parent) {
-                    hir_def::VariantId::EnumVariantId(id) => {
-                        GenericDefId::AdtId(id.lookup(db).parent.into())
-                    }
-                    hir_def::VariantId::StructId(id) => GenericDefId::AdtId(id.into()),
-                    hir_def::VariantId::UnionId(id) => GenericDefId::AdtId(id.into()),
-                },
-            )
-            .store(),
-        )
-        .map(|layout| Layout(layout, db.target_data_layout(self.krate(db).into()).unwrap()))
+        self.ty(db).layout(db)
     }
 
     pub fn parent_def(&self, _db: &dyn HirDatabase) -> Variant {
@@ -1504,10 +1488,6 @@ pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
         Type::from_def(db, self.id)
     }
 
-    pub fn ty_params(self, db: &dyn HirDatabase) -> Type<'_> {
-        Type::from_def_params(db, self.id)
-    }
-
     pub fn constructor_ty(self, db: &dyn HirDatabase) -> Type<'_> {
         Type::from_value_def(db, self.id)
     }
@@ -1531,11 +1511,6 @@ fn variant_fields(self, db: &dyn HirDatabase) -> &VariantFields {
     pub fn is_unstable(self, db: &dyn HirDatabase) -> bool {
         AttrFlags::query(db, self.id.into()).contains(AttrFlags::IS_UNSTABLE)
     }
-
-    pub fn instantiate_infer<'db>(self, infer_ctxt: &InferCtxt<'db>) -> InstantiatedStruct<'db> {
-        let args = infer_ctxt.fresh_args_for_item(hir_ty::Span::Dummy, self.id.into());
-        InstantiatedStruct { inner: self, args }
-    }
 }
 
 impl HasVisibility for Struct {
@@ -1547,34 +1522,6 @@ fn visibility(&self, db: &dyn HirDatabase) -> Visibility {
 }
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
-pub struct InstantiatedStruct<'db> {
-    pub(crate) inner: Struct,
-    pub(crate) args: GenericArgs<'db>,
-}
-
-impl<'db> InstantiatedStruct<'db> {
-    pub fn fields(self, db: &dyn HirDatabase) -> Vec<InstantiatedField<'db>> {
-        self.inner
-            .id
-            .fields(db)
-            .fields()
-            .iter()
-            .map(|(id, _)| InstantiatedField {
-                inner: Field { parent: self.inner.into(), id },
-                args: self.args,
-            })
-            .collect()
-    }
-
-    pub fn ty(self, db: &'db dyn HirDatabase) -> TypeNs<'db> {
-        let interner = DbInterner::new_no_crate(db);
-
-        let ty = db.ty(self.inner.id.into());
-        TypeNs::new(db, self.inner.id, ty.instantiate(interner, self.args).skip_norm_wip())
-    }
-}
-
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub struct Union {
     pub(crate) id: UnionId,
 }
@@ -1592,10 +1539,6 @@ pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
         Type::from_def(db, self.id)
     }
 
-    pub fn ty_params(self, db: &dyn HirDatabase) -> Type<'_> {
-        Type::from_def_params(db, self.id)
-    }
-
     pub fn constructor_ty(self, db: &dyn HirDatabase) -> Type<'_> {
         Type::from_value_def(db, self.id)
     }
@@ -1644,7 +1587,7 @@ pub fn name(self, db: &dyn HirDatabase) -> Name {
     }
 
     pub fn variants(self, db: &dyn HirDatabase) -> Vec<EnumVariant> {
-        self.id.enum_variants(db).variants.iter().map(|&(id, _, _)| EnumVariant { id }).collect()
+        self.id.enum_variants(db).variants.values().map(|&(id, _)| EnumVariant { id }).collect()
     }
 
     pub fn num_variants(self, db: &dyn HirDatabase) -> usize {
@@ -1659,15 +1602,11 @@ pub fn ty<'db>(self, db: &'db dyn HirDatabase) -> Type<'db> {
         Type::from_def(db, self.id)
     }
 
-    pub fn ty_params<'db>(self, db: &'db dyn HirDatabase) -> Type<'db> {
-        Type::from_def_params(db, self.id)
-    }
-
     /// The type of the enum variant bodies.
     pub fn variant_body_ty<'db>(self, db: &'db dyn HirDatabase) -> Type<'db> {
         let interner = DbInterner::new_no_crate(db);
-        Type::new_for_crate(
-            self.id.lookup(db).container.krate(db),
+        Type::no_params(
+            Type::builtin_type_crate(db),
             match EnumSignature::variant_body_type(db, self.id) {
                 layout::IntegerType::Pointer(sign) => match sign {
                     true => Ty::new_int(interner, rustc_type_ir::IntTy::Isize),
@@ -1722,27 +1661,6 @@ fn visibility(&self, db: &dyn HirDatabase) -> Visibility {
 }
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
-pub struct InstantiatedEnum<'db> {
-    pub(crate) inner: Enum,
-    pub(crate) args: GenericArgs<'db>,
-}
-
-impl<'db> InstantiatedEnum<'db> {
-    pub fn ty(self, db: &'db dyn HirDatabase) -> TypeNs<'db> {
-        let interner = DbInterner::new_no_crate(db);
-
-        let ty = db.ty(self.inner.id.into());
-        TypeNs::new(db, self.inner.id, ty.instantiate(interner, self.args).skip_norm_wip())
-    }
-}
-
-impl From<&EnumVariant> for DefWithBodyId {
-    fn from(&v: &EnumVariant) -> Self {
-        DefWithBodyId::VariantId(v.into())
-    }
-}
-
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub struct EnumVariant {
     pub(crate) id: EnumVariantId,
 }
@@ -1761,9 +1679,7 @@ pub fn constructor_ty(self, db: &dyn HirDatabase) -> Type<'_> {
     }
 
     pub fn name(self, db: &dyn HirDatabase) -> Name {
-        let lookup = self.id.lookup(db);
-        let enum_ = lookup.parent;
-        enum_.enum_variants(db).variants[lookup.index as usize].1.clone()
+        self.id.lookup(db).name.clone()
     }
 
     pub fn fields(self, db: &dyn HirDatabase) -> Vec<Field> {
@@ -1798,7 +1714,7 @@ pub fn layout<'db>(&self, db: &'db dyn HirDatabase) -> Result<Layout<'db>, Layou
             layout::Variants::Multiple { variants, .. } => Layout(
                 {
                     let lookup = self.id.lookup(db);
-                    let rustc_enum_variant_idx = RustcEnumVariantIdx(lookup.index as usize);
+                    let rustc_enum_variant_idx = RustcEnumVariantIdx(lookup.index(db));
                     Arc::new(variants[rustc_enum_variant_idx].clone())
                 },
                 db.target_data_layout(parent_enum.krate(db).into()).unwrap(),
@@ -1810,40 +1726,6 @@ pub fn layout<'db>(&self, db: &'db dyn HirDatabase) -> Result<Layout<'db>, Layou
     pub fn is_unstable(self, db: &dyn HirDatabase) -> bool {
         AttrFlags::query(db, self.id.into()).contains(AttrFlags::IS_UNSTABLE)
     }
-
-    pub fn instantiate_infer<'db>(self, infer_ctxt: &InferCtxt<'db>) -> InstantiatedVariant<'db> {
-        let args = infer_ctxt.fresh_args_for_item(
-            hir_ty::Span::Dummy,
-            self.parent_enum(infer_ctxt.interner.db()).id.into(),
-        );
-        InstantiatedVariant { inner: self, args }
-    }
-}
-
-// FIXME: Rename to `EnumVariant`
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
-pub struct InstantiatedVariant<'db> {
-    pub(crate) inner: EnumVariant,
-    pub(crate) args: GenericArgs<'db>,
-}
-
-impl<'db> InstantiatedVariant<'db> {
-    pub fn parent_enum(self, db: &dyn HirDatabase) -> InstantiatedEnum<'db> {
-        InstantiatedEnum { inner: self.inner.id.lookup(db).parent.into(), args: self.args }
-    }
-
-    pub fn fields(self, db: &dyn HirDatabase) -> Vec<InstantiatedField<'db>> {
-        self.inner
-            .id
-            .fields(db)
-            .fields()
-            .iter()
-            .map(|(id, _)| InstantiatedField {
-                inner: Field { parent: self.inner.into(), id },
-                args: self.args,
-            })
-            .collect()
-    }
 }
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -1892,23 +1774,6 @@ pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
         Type::from_def(db, id)
     }
 
-    /// Turns this ADT into a type with the given type parameters. This isn't
-    /// the greatest API, FIXME find a better one.
-    pub fn ty_with_args<'db>(
-        self,
-        db: &'db dyn HirDatabase,
-        args: impl IntoIterator<Item = Type<'db>>,
-    ) -> Type<'db> {
-        let id = AdtId::from(self);
-        let interner = DbInterner::new_no_crate(db);
-        let ty = Ty::new_adt(
-            interner,
-            id,
-            generic_args_from_tys(interner, id.into(), args.into_iter().map(|ty| ty.ty)),
-        );
-        Type::new(db, id, ty)
-    }
-
     pub fn module(self, db: &dyn HirDatabase) -> Module {
         match self {
             Adt::Struct(s) => s.module(db),
@@ -2016,8 +1881,7 @@ pub fn owner(self, db: &dyn HirDatabase) -> ExpressionStoreOwner {
 
     pub fn ty<'db>(self, db: &'db dyn HirDatabase) -> Type<'db> {
         let loc = self.id.loc(db);
-        let env = body_param_env_from_has_crate(db, loc.owner);
-        Type { env, ty: loc.ty.get().instantiate_identity().skip_norm_wip() }
+        Type { owner: self.id.into(), ty: loc.ty.get() }
     }
 
     pub fn eval(self, db: &dyn HirDatabase) -> Result<EvaluatedConst<'_>, ConstEvalError> {
@@ -2127,7 +1991,7 @@ fn id(&self) -> Option<DefWithBodyId> {
             },
             DefWithBody::Static(it) => it.id.into(),
             DefWithBody::Const(it) => it.id.into(),
-            DefWithBody::EnumVariant(it) => it.into(),
+            DefWithBody::EnumVariant(it) => it.id.into(),
         })
     }
 
@@ -2167,8 +2031,6 @@ pub fn diagnostics<'db>(
         let Ok(id) = self.try_into() else {
             return;
         };
-        let krate = self.module(db).id.krate(db);
-        let env = body_param_env_from_has_crate(db, id);
 
         let (body, source_map) = Body::with_source_map(db, id);
         let sig_source_map = match self {
@@ -2191,6 +2053,7 @@ pub fn diagnostics<'db>(
         expr_store_diagnostics(db, acc, source_map);
 
         let infer = InferenceResult::of(db, id);
+        let type_owner = id.generic_def(db).into();
         for d in infer.diagnostics() {
             acc.extend(AnyDiagnostic::inference_diagnostic(
                 db,
@@ -2198,7 +2061,7 @@ pub fn diagnostics<'db>(
                 d,
                 source_map,
                 sig_source_map,
-                env,
+                type_owner,
             ));
         }
 
@@ -2267,8 +2130,11 @@ pub fn diagnostics<'db>(
                         mir::MirSpan::Unknown => continue,
                     };
                     acc.push(
-                        MovedOutOfRef { ty: Type::new_for_crate(krate, moof.ty.as_ref()), span }
-                            .into(),
+                        MovedOutOfRef {
+                            ty: Type { owner: type_owner, ty: EarlyBinder::bind(moof.ty.as_ref()) },
+                            span,
+                        }
+                        .into(),
                     )
                 }
                 let mol = &borrowck_result.mutability_of_locals;
@@ -2365,9 +2231,9 @@ pub fn expression_types<'db>(
     ) -> impl Iterator<Item = Type<'db>> {
         self.id().into_iter().flat_map(move |def_id| {
             let infer = InferenceResult::of(db, def_id);
-            let resolver = def_id.resolver(db);
+            let def_id = def_id.generic_def(db);
 
-            infer.expression_types().map(move |(_, ty)| Type::new_with_resolver(db, &resolver, ty))
+            infer.expression_types().map(move |(_, ty)| Type::new(def_id, ty))
         })
     }
 
@@ -2375,9 +2241,9 @@ pub fn expression_types<'db>(
     pub fn pattern_types<'db>(self, db: &'db dyn HirDatabase) -> impl Iterator<Item = Type<'db>> {
         self.id().into_iter().flat_map(move |def_id| {
             let infer = InferenceResult::of(db, def_id);
-            let resolver = def_id.resolver(db);
+            let def_id = def_id.generic_def(db);
 
-            infer.pattern_types().map(move |(_, ty)| Type::new_with_resolver(db, &resolver, ty))
+            infer.pattern_types().map(move |(_, ty)| Type::new(def_id, ty))
         })
     }
 
@@ -2385,9 +2251,9 @@ pub fn pattern_types<'db>(self, db: &'db dyn HirDatabase) -> impl Iterator<Item
     pub fn binding_types<'db>(self, db: &'db dyn HirDatabase) -> impl Iterator<Item = Type<'db>> {
         self.id().into_iter().flat_map(move |def_id| {
             let infer = InferenceResult::of(db, def_id);
-            let resolver = def_id.resolver(db);
+            let def_id = def_id.generic_def(db);
 
-            infer.binding_types().map(move |(_, ty)| Type::new_with_resolver(db, &resolver, ty))
+            infer.binding_types().map(move |(_, ty)| Type::new(def_id, ty))
         })
     }
 }
@@ -2420,6 +2286,9 @@ fn expr_store_diagnostics<'db>(
             ExpressionStoreDiagnostics::PatternArgInExternFn { node } => {
                 PatternArgInExternFn { node: *node }.into()
             }
+            ExpressionStoreDiagnostics::FruInDestructuringAssignment { node } => {
+                FruInDestructuringAssignment { node: *node }.into()
+            }
         });
     }
 
@@ -2446,6 +2315,14 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 }
 
 impl Function {
+    pub fn lang(db: &dyn HirDatabase, krate: Crate, lang_item: LangItem) -> Option<Function> {
+        let lang_items = hir_def::lang_item::lang_items(db, krate.id);
+        match lang_item.from_lang_items(lang_items)? {
+            LangItemTarget::FunctionId(it) => Some(it.into()),
+            _ => None,
+        }
+    }
+
     pub fn module(self, db: &dyn HirDatabase) -> Module {
         match self.id {
             AnyFunctionId::FunctionId(id) => id.module(db).into(),
@@ -2468,12 +2345,9 @@ pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
             AnyFunctionId::BuiltinDeriveImplMethod { method, impl_ } => {
                 // Get the type for the trait function, as we can't get the type for the impl function
                 // because it has not `CallableDefId`.
-                let krate = impl_.module(db).krate(db);
-                let interner = DbInterner::new_with(db, krate);
-                let param_env = hir_ty::builtin_derive::param_env(interner, impl_);
-                let env = ParamEnvAndCrate { param_env, krate };
+                // FIXME: This does not account for replacing `Self`. Do we really need that?
                 let Some(trait_method) = method.trait_method(db, impl_) else {
-                    return Type { env, ty: Ty::new_error(interner, ErrorGuaranteed) };
+                    return Type::unknown();
                 };
                 Function::from(trait_method).ty(db)
             }
@@ -2483,160 +2357,36 @@ pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
     pub fn fn_ptr_type(self, db: &dyn HirDatabase) -> Type<'_> {
         match self.id {
             AnyFunctionId::FunctionId(id) => {
-                let resolver = id.resolver(db);
                 let interner = DbInterner::new_no_crate(db);
-                // FIXME: This shouldn't be `instantiate_identity()`, we shouldn't leak `TyKind::Param`s.
                 let callable_sig =
                     db.callable_item_signature(id.into()).instantiate_identity().skip_norm_wip();
                 let ty = Ty::new_fn_ptr(interner, callable_sig);
-                Type::new_with_resolver_inner(db, &resolver, ty)
+                Type::new(id.into(), ty)
             }
             AnyFunctionId::BuiltinDeriveImplMethod { method, impl_ } => {
-                struct ParamsShifter<'db> {
-                    interner: DbInterner<'db>,
-                    shift_by: i32,
-                }
-
-                impl<'db> TypeFolder<DbInterner<'db>> for ParamsShifter<'db> {
-                    fn cx(&self) -> DbInterner<'db> {
-                        self.interner
-                    }
-
-                    fn fold_ty(&mut self, ty: Ty<'db>) -> Ty<'db> {
-                        if let TyKind::Param(param) = ty.kind() {
-                            Ty::new_param(
-                                self.interner,
-                                param.id,
-                                param.index.checked_add_signed(self.shift_by).unwrap(),
-                            )
-                        } else {
-                            ty.super_fold_with(self)
-                        }
-                    }
-
-                    fn fold_const(
-                        &mut self,
-                        ct: hir_ty::next_solver::Const<'db>,
-                    ) -> hir_ty::next_solver::Const<'db> {
-                        if let ConstKind::Param(param) = ct.kind() {
-                            hir_ty::next_solver::Const::new_param(
-                                self.interner,
-                                ParamConst {
-                                    id: param.id,
-                                    index: param.index.checked_add_signed(self.shift_by).unwrap(),
-                                },
-                            )
-                        } else {
-                            ct.super_fold_with(self)
-                        }
-                    }
-
-                    fn fold_region(&mut self, r: Region<'db>) -> Region<'db> {
-                        if let RegionKind::ReEarlyParam(param) = r.kind() {
-                            Region::new_early_param(
-                                self.interner,
-                                EarlyParamRegion {
-                                    id: param.id,
-                                    index: param.index.checked_add_signed(self.shift_by).unwrap(),
-                                },
-                            )
-                        } else {
-                            r
-                        }
-                    }
-                }
-
                 // Get the type for the trait function, as we can't get the type for the impl function
                 // because it has not `CallableDefId`.
-                let krate = impl_.module(db).krate(db);
-                let interner = DbInterner::new_with(db, krate);
-                let param_env = hir_ty::builtin_derive::param_env(interner, impl_);
-                let env = ParamEnvAndCrate { param_env, krate };
+                // FIXME: This does not account for replacing `Self`. Do we really need that?
                 let Some(trait_method) = method.trait_method(db, impl_) else {
-                    return Type { env, ty: Ty::new_error(interner, ErrorGuaranteed) };
+                    return Type::unknown();
                 };
-                // The procedure works as follows: the method may have additional generic parameters (e.g. `Hash::hash()`),
-                // and we want them to be params of the impl method as well. So we start with the trait method identity
-                // args and extract from them the trait method own args. In parallel, we retrieve the impl trait ref.
-                // Now we can put our args as [...impl_trait_ref.args, ...trait_method_own_args], but we have one problem:
-                // the args in `trait_method_own_args` use indices appropriate for the trait method, which are not necessarily
-                // good for the impl method. So we shift them by `impl_generics_len - trait_generics_len`, which is essentially
-                // `impl_generics_len - impl_trait_ref.args.len()`.
-                let trait_method_fn_ptr = Ty::new_fn_ptr(
-                    interner,
-                    db.callable_item_signature(trait_method.into())
-                        .instantiate_identity()
-                        .skip_norm_wip(),
-                );
-                let impl_trait_ref = hir_ty::builtin_derive::impl_trait(interner, impl_)
-                    .instantiate_identity()
-                    .skip_norm_wip();
-                let trait_method_args =
-                    GenericArgs::identity_for_item(interner, trait_method.into());
-                let trait_method_own_args = GenericArgs::new_from_iter(
-                    interner,
-                    trait_method_args.iter().skip(impl_trait_ref.args.len()),
-                );
-                let impl_params_count = hir_ty::builtin_derive::generic_params_count(db, impl_);
-                let shift_args_by = impl_params_count as i32 - impl_trait_ref.args.len() as i32;
-                let shifted_trait_method_own_args = trait_method_own_args
-                    .fold_with(&mut ParamsShifter { interner, shift_by: shift_args_by });
-                let impl_method_args = GenericArgs::new_from_iter(
-                    interner,
-                    impl_trait_ref.args.iter().chain(shifted_trait_method_own_args),
-                );
-                let impl_method_fn_ptr = EarlyBinder::bind(trait_method_fn_ptr)
-                    .instantiate(interner, impl_method_args)
-                    .skip_norm_wip();
-                Type { env, ty: impl_method_fn_ptr }
+                Function::from(trait_method).fn_ptr_type(db)
             }
         }
     }
 
-    fn fn_sig<'db>(self, db: &'db dyn HirDatabase) -> (ParamEnvAndCrate<'db>, PolyFnSig<'db>) {
+    fn fn_sig<'db>(self, db: &'db dyn HirDatabase) -> (TypeOwnerId, PolyFnSig<'db>) {
         let fn_ptr = self.fn_ptr_type(db);
-        let TyKind::FnPtr(sig_tys, hdr) = fn_ptr.ty.kind() else {
+        let TyKind::FnPtr(sig_tys, hdr) = fn_ptr.ty.skip_binder().kind() else {
             unreachable!();
         };
-        (fn_ptr.env, sig_tys.with(hdr))
+        (fn_ptr.owner, sig_tys.with(hdr))
     }
 
-    // FIXME: Find a better API to express all combinations here, perhaps we should have `PreInstantiationType`?
-
     /// Get this function's return type
     pub fn ret_type(self, db: &dyn HirDatabase) -> Type<'_> {
-        let (env, sig) = self.fn_sig(db);
-        Type { env, ty: sig.skip_binder().output() }
-    }
-
-    // FIXME: Find better API to also handle const generics
-    pub fn ret_type_with_args<'db>(
-        self,
-        db: &'db dyn HirDatabase,
-        generics: impl Iterator<Item = Type<'db>>,
-    ) -> Type<'db> {
-        let ret_type = self.ret_type(db);
-        let interner = DbInterner::new_no_crate(db);
-        let args = self.adapt_generic_args(interner, generics);
-        ret_type.derived(EarlyBinder::bind(ret_type.ty).instantiate(interner, args).skip_norm_wip())
-    }
-
-    fn adapt_generic_args<'db>(
-        self,
-        interner: DbInterner<'db>,
-        generics: impl Iterator<Item = Type<'db>>,
-    ) -> GenericArgs<'db> {
-        let generics = generics.map(|ty| ty.ty);
-        match self.id {
-            AnyFunctionId::FunctionId(id) => generic_args_from_tys(interner, id.into(), generics),
-            AnyFunctionId::BuiltinDeriveImplMethod { impl_, .. } => {
-                let impl_args = GenericArgs::identity_for_item(interner, impl_.into());
-                GenericArgs::new_from_iter(
-                    interner,
-                    impl_args.iter().chain(generics.map(Into::into)),
-                )
-            }
-        }
+        let (owner, sig) = self.fn_sig(db);
+        Type { owner, ty: EarlyBinder::bind(sig.skip_binder().output()) }
     }
 
     pub fn async_ret_type<'db>(self, db: &'db dyn HirDatabase) -> Option<Type<'db>> {
@@ -2646,15 +2396,13 @@ pub fn async_ret_type<'db>(self, db: &'db dyn HirDatabase) -> Option<Type<'db>>
         if !self.is_async(db) {
             return None;
         }
-        let resolver = id.resolver(db);
-        // FIXME: This shouldn't be `instantiate_identity()`, we shouldn't leak `TyKind::Param`s.
         let ret_ty =
             db.callable_item_signature(id.into()).instantiate_identity().skip_binder().output();
         for pred in ret_ty.impl_trait_bounds(db).into_iter().flatten() {
             if let ClauseKind::Projection(projection) = pred.kind().skip_binder()
                 && let Some(output_ty) = projection.term.as_type()
             {
-                return Type::new_with_resolver_inner(db, &resolver, output_ty).into();
+                return Some(Type::new(id.into(), output_ty));
             }
         }
         None
@@ -2680,7 +2428,7 @@ pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam> {
     }
 
     pub fn assoc_fn_params(self, db: &dyn HirDatabase) -> Vec<Param<'_>> {
-        let (env, sig) = self.fn_sig(db);
+        let (owner, sig) = self.fn_sig(db);
         let func = match self.id {
             AnyFunctionId::FunctionId(id) => Callee::Def(CallableDefId::FunctionId(id)),
             AnyFunctionId::BuiltinDeriveImplMethod { method, impl_ } => {
@@ -2691,7 +2439,11 @@ pub fn assoc_fn_params(self, db: &dyn HirDatabase) -> Vec<Param<'_>> {
             .inputs()
             .iter()
             .enumerate()
-            .map(|(idx, &ty)| Param { func: func.clone(), ty: Type { env, ty }, idx })
+            .map(|(idx, &ty)| Param {
+                func: func.clone(),
+                ty: Type { owner, ty: EarlyBinder::bind(ty) },
+                idx,
+            })
             .collect()
     }
 
@@ -2717,28 +2469,6 @@ pub fn params_without_self(self, db: &dyn HirDatabase) -> Vec<Param<'_>> {
         params
     }
 
-    // FIXME: Find better API to also handle const generics
-    pub fn params_without_self_with_args<'db>(
-        self,
-        db: &'db dyn HirDatabase,
-        generics: impl Iterator<Item = Type<'db>>,
-    ) -> Vec<Param<'db>> {
-        let interner = DbInterner::new_no_crate(db);
-        let args = self.adapt_generic_args(interner, generics);
-        let params = self.params_without_self(db);
-        params
-            .into_iter()
-            .map(|param| Param {
-                func: param.func,
-                idx: param.idx,
-                ty: Type {
-                    env: param.ty.env,
-                    ty: EarlyBinder::bind(param.ty.ty).instantiate(interner, args).skip_norm_wip(),
-                },
-            })
-            .collect()
-    }
-
     pub fn is_const(self, db: &dyn HirDatabase) -> bool {
         match self.id {
             AnyFunctionId::FunctionId(id) => FunctionSignature::of(db, id).is_const(),
@@ -2753,6 +2483,13 @@ pub fn is_async(self, db: &dyn HirDatabase) -> bool {
         }
     }
 
+    pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool {
+        match self.id {
+            AnyFunctionId::FunctionId(id) => FunctionSignature::of(db, id).is_unsafe(),
+            AnyFunctionId::BuiltinDeriveImplMethod { .. } => false,
+        }
+    }
+
     pub fn is_varargs(self, db: &dyn HirDatabase) -> bool {
         match self.id {
             AnyFunctionId::FunctionId(id) => FunctionSignature::of(db, id).is_varargs(),
@@ -2913,7 +2650,7 @@ pub fn eval(
             id.into(),
             GenericArgs::empty(interner).store(),
             ParamEnvAndCrate {
-                param_env: db.trait_environment(GenericDefId::from(id).into()),
+                param_env: db.trait_environment(id.into()),
                 krate: id.module(db).krate(db),
             }
             .store(),
@@ -3085,20 +2822,8 @@ pub fn parent_fn(&self) -> Function {
     }
 
     pub fn ty<'db>(&self, db: &'db dyn HirDatabase) -> Type<'db> {
-        let (env, sig) = self.func.fn_sig(db);
-        Type { env, ty: sig.skip_binder().inputs()[0] }
-    }
-
-    // FIXME: Find better API to also handle const generics
-    pub fn ty_with_args<'db>(
-        &self,
-        db: &'db dyn HirDatabase,
-        generics: impl Iterator<Item = Type<'db>>,
-    ) -> Type<'db> {
-        let interner = DbInterner::new_no_crate(db);
-        let args = self.func.adapt_generic_args(interner, generics);
-        let Type { env, ty } = self.ty(db);
-        Type { env, ty: EarlyBinder::bind(ty).instantiate(interner, args).skip_norm_wip() }
+        let (owner, sig) = self.func.fn_sig(db);
+        Type { owner, ty: EarlyBinder::bind(sig.skip_binder().inputs()[0]) }
     }
 }
 
@@ -3430,10 +3155,6 @@ pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
         Type::from_def(db, self.id)
     }
 
-    pub fn ty_params(self, db: &dyn HirDatabase) -> Type<'_> {
-        Type::from_def_params(db, self.id)
-    }
-
     pub fn name(self, db: &dyn HirDatabase) -> Name {
         TypeAliasSignature::of(db, self.id).name.clone()
     }
@@ -3482,10 +3203,13 @@ pub fn i32() -> BuiltinType {
         }
     }
 
+    pub fn bool() -> BuiltinType {
+        BuiltinType { inner: hir_def::builtin_type::BuiltinType::Bool }
+    }
+
     pub fn ty<'db>(self, db: &'db dyn HirDatabase) -> Type<'db> {
-        let core = Crate::core(db).map(|core| core.id).unwrap_or_else(|| all_crates(db)[0]);
         let interner = DbInterner::new_no_crate(db);
-        Type::new_for_crate(core, Ty::from_builtin_type(interner, self.inner))
+        Type::no_params(Type::builtin_type_crate(db), Ty::from_builtin_type(interner, self.inner))
     }
 
     pub fn name(self) -> Name {
@@ -3598,6 +3322,7 @@ pub fn kind(&self, db: &dyn HirDatabase) -> MacroKind {
                 }
                 MacroExpander::BuiltInAttr(_) => MacroKind::AttrBuiltIn,
                 MacroExpander::BuiltInDerive(_) => MacroKind::DeriveBuiltIn,
+                MacroExpander::UnimplementedBuiltIn => MacroKind::Declarative,
             },
             MacroId::MacroRulesId(it) => match it.lookup(db).expander {
                 MacroExpander::Declarative { .. } => MacroKind::Declarative,
@@ -3606,6 +3331,7 @@ pub fn kind(&self, db: &dyn HirDatabase) -> MacroKind {
                 }
                 MacroExpander::BuiltInAttr(_) => MacroKind::AttrBuiltIn,
                 MacroExpander::BuiltInDerive(_) => MacroKind::DeriveBuiltIn,
+                MacroExpander::UnimplementedBuiltIn => MacroKind::Declarative,
             },
             MacroId::ProcMacroId(it) => match it.lookup(db).kind {
                 ProcMacroKind::CustomDerive => MacroKind::Derive,
@@ -4278,23 +4004,19 @@ pub fn description(self) -> &'static str {
 // We cannot call this `Substitution` unfortunately...
 #[derive(Debug)]
 pub struct GenericSubstitution<'db> {
+    owner: TypeOwnerId,
     def: GenericDefId,
     subst: GenericArgs<'db>,
-    env: ParamEnvAndCrate<'db>,
 }
 
 impl<'db> GenericSubstitution<'db> {
-    fn new(def: GenericDefId, subst: GenericArgs<'db>, env: ParamEnvAndCrate<'db>) -> Self {
-        Self { def, subst, env }
+    fn new(def: GenericDefId, subst: GenericArgs<'db>, owner: TypeOwnerId) -> Self {
+        Self { owner, def, subst }
     }
 
-    fn new_from_fn(
-        def: Function,
-        subst: GenericArgs<'db>,
-        env: ParamEnvAndCrate<'db>,
-    ) -> Option<Self> {
+    fn new_from_fn(def: Function, subst: GenericArgs<'db>, owner: TypeOwnerId) -> Option<Self> {
         match def.id {
-            AnyFunctionId::FunctionId(def) => Some(Self::new(def.into(), subst, env)),
+            AnyFunctionId::FunctionId(def) => Some(Self::new(def.into(), subst, owner)),
             AnyFunctionId::BuiltinDeriveImplMethod { .. } => None,
         }
     }
@@ -4341,7 +4063,12 @@ pub fn types(&self, db: &'db dyn HirDatabase) -> Vec<(Symbol, Type<'db>)> {
             .zip(type_params);
         container_params
             .chain(self_params)
-            .filter_map(|(ty, name)| Some((name?.symbol().clone(), Type { ty, env: self.env })))
+            .filter_map(|(ty, name)| {
+                Some((
+                    name?.symbol().clone(),
+                    Type { ty: EarlyBinder::bind(ty), owner: self.owner },
+                ))
+            })
             .collect()
     }
 }
@@ -4454,7 +4181,7 @@ pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
         let def = self.parent;
         let infer = InferenceResult::of(db, self.parent_infer);
         let ty = infer.binding_ty(self.binding_id);
-        Type::new(db, def, ty)
+        Type::new_body(db, def, ty)
     }
 
     /// All definitions for this local. Example: `let (a$0, _) | (_, a$0) = it;`
@@ -4754,18 +4481,17 @@ pub fn is_implicit(self, db: &dyn HirDatabase) -> bool {
     }
 
     pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
-        let resolver = self.id.parent().resolver(db);
         let interner = DbInterner::new_no_crate(db);
         let index = hir_ty::type_or_const_param_idx(db, self.id.into());
         let ty = Ty::new_param(interner, self.id, index);
-        Type::new_with_resolver_inner(db, &resolver, ty)
+        Type::new(self.id.parent(), ty)
     }
 
     /// FIXME: this only lists trait bounds from the item defining the type
     /// parameter, not additional bounds that might be added e.g. by a method if
     /// the parameter comes from an impl!
     pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> {
-        let self_ty = self.ty(db).ty;
+        let self_ty = self.ty(db).ty.instantiate_identity().skip_norm_wip();
         GenericPredicates::query_explicit(db, self.id.parent())
             .iter_identity()
             .filter_map(|pred| match &pred.kind().skip_binder() {
@@ -4779,10 +4505,9 @@ pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> {
 
     pub fn default(self, db: &dyn HirDatabase) -> Option<Type<'_>> {
         let ty = generic_arg_from_param(db, self.id.into())?;
-        let resolver = self.id.parent().resolver(db);
         match ty.kind() {
             rustc_type_ir::GenericArgKind::Type(it) if !it.is_ty_error() => {
-                Some(Type::new_with_resolver_inner(db, &resolver, it))
+                Some(Type::new(self.id.parent(), it))
             }
             _ => None,
         }
@@ -4843,7 +4568,7 @@ pub fn parent(self, _db: &dyn HirDatabase) -> GenericDef {
     }
 
     pub fn ty(self, db: &dyn HirDatabase) -> Type<'_> {
-        Type::new(db, self.id.parent(), db.const_param_ty(self.id))
+        Type::new(self.id.parent(), db.const_param_ty(self.id))
     }
 
     pub fn default(self, db: &dyn HirDatabase, display_target: DisplayTarget) -> Option<String> {
@@ -4965,21 +4690,26 @@ pub fn all_in_module(db: &dyn HirDatabase, module: Module) -> Vec<Impl> {
     /// blanket impls, and only does a shallow type constructor check. In fact, this should've probably been on `Adt`
     /// etc., and not on `Type`. If you would want to create a precise list of all impls applying to a type,
     /// you would need to include blanket impls, and try to prove to predicates for each candidate.
-    pub fn all_for_type<'db>(db: &'db dyn HirDatabase, Type { ty, env }: Type<'db>) -> Vec<Impl> {
+    pub fn all_for_type<'db>(db: &'db dyn HirDatabase, ty: Type<'db>) -> Vec<Impl> {
         let mut result = Vec::new();
         let interner = DbInterner::new_no_crate(db);
-        let Some(simplified_ty) =
-            fast_reject::simplify_type(interner, ty, fast_reject::TreatParams::AsRigid)
-        else {
+        let Some(simplified_ty) = fast_reject::simplify_type(
+            interner,
+            ty.ty.skip_binder(),
+            fast_reject::TreatParams::AsRigid,
+        ) else {
             return Vec::new();
         };
         let mut extend_with_impls = |impls: Either<&[ImplId], &[BuiltinDeriveImplId]>| match impls {
             Either::Left(impls) => result.extend(impls.iter().copied().map(Impl::from)),
             Either::Right(impls) => result.extend(impls.iter().copied().map(Impl::from)),
         };
-        method_resolution::with_incoherent_inherent_impls(db, env.krate, &simplified_ty, |impls| {
-            extend_with_impls(Either::Left(impls))
-        });
+        method_resolution::with_incoherent_inherent_impls(
+            db,
+            ty.krate(db),
+            &simplified_ty,
+            |impls| extend_with_impls(Either::Left(impls)),
+        );
         if let Some(module) = method_resolution::simplified_type_module(db, &simplified_ty) {
             InherentImpls::for_each_crate_and_block(
                 db,
@@ -4987,7 +4717,7 @@ pub fn all_for_type<'db>(db: &'db dyn HirDatabase, Type { ty, env }: Type<'db>)
                 module.block(db),
                 &mut |impls| extend_with_impls(Either::Left(impls.for_self_ty(&simplified_ty))),
             );
-            std::iter::successors(module.block(db), |block| block.loc(db).module.block(db))
+            iter::successors(module.block(db), |block| block.loc(db).module.block(db))
                 .filter_map(|block| TraitImpls::for_block(db, block).as_deref())
                 .for_each(|impls| impls.for_self_ty(&simplified_ty, &mut extend_with_impls));
             for &krate in &*all_crates(db) {
@@ -5042,21 +4772,16 @@ pub fn trait_ref(self, db: &dyn HirDatabase) -> Option<TraitRef<'_>> {
         match self.id {
             AnyImplId::ImplId(id) => {
                 let trait_ref = db.impl_trait(id)?.instantiate_identity().skip_norm_wip();
-                let resolver = id.resolver(db);
-                Some(TraitRef::new_with_resolver(db, &resolver, trait_ref))
+                Some(TraitRef::new(id.into(), trait_ref))
             }
             AnyImplId::BuiltinDeriveImplId(id) => {
                 let loc = id.loc(db);
                 let krate = loc.module(db).krate(db);
                 let interner = DbInterner::new_with(db, krate);
-                let env = ParamEnvAndCrate {
-                    param_env: hir_ty::builtin_derive::param_env(interner, id),
-                    krate,
-                };
                 let trait_ref = hir_ty::builtin_derive::impl_trait(interner, id)
                     .instantiate_identity()
                     .skip_norm_wip();
-                Some(TraitRef { env, trait_ref })
+                Some(TraitRef { owner: TypeOwnerId::BuiltinDeriveImplId(id), trait_ref })
             }
         }
     }
@@ -5064,24 +4789,16 @@ pub fn trait_ref(self, db: &dyn HirDatabase) -> Option<TraitRef<'_>> {
     pub fn self_ty(self, db: &dyn HirDatabase) -> Type<'_> {
         match self.id {
             AnyImplId::ImplId(id) => {
-                let resolver = id.resolver(db);
-                // FIXME: This shouldn't be `instantiate_identity()`, we shouldn't leak `TyKind::Param`s.
                 let ty = db.impl_self_ty(id).instantiate_identity().skip_norm_wip();
-                Type::new_with_resolver_inner(db, &resolver, ty)
+                Type::new(id.into(), ty)
             }
             AnyImplId::BuiltinDeriveImplId(id) => {
                 let loc = id.loc(db);
                 let krate = loc.module(db).krate(db);
                 let interner = DbInterner::new_with(db, krate);
-                let env = ParamEnvAndCrate {
-                    param_env: hir_ty::builtin_derive::param_env(interner, id),
-                    krate,
-                };
-                let ty = hir_ty::builtin_derive::impl_trait(interner, id)
-                    .instantiate_identity()
-                    .skip_norm_wip()
-                    .self_ty();
-                Type { env, ty }
+                let ty =
+                    hir_ty::builtin_derive::impl_trait(interner, id).map_bound(|it| it.self_ty());
+                Type { owner: TypeOwnerId::BuiltinDeriveImplId(id), ty }
             }
         }
     }
@@ -5143,38 +4860,33 @@ fn all_macro_calls(&self, db: &dyn HirDatabase) -> Box<[(AstId<ast::Item>, Macro
 
 #[derive(Clone, PartialEq, Eq, Debug, Hash)]
 pub struct TraitRef<'db> {
-    env: ParamEnvAndCrate<'db>,
+    owner: TypeOwnerId,
     trait_ref: hir_ty::next_solver::TraitRef<'db>,
 }
 
 impl<'db> TraitRef<'db> {
-    pub(crate) fn new_with_resolver(
-        db: &'db dyn HirDatabase,
-        resolver: &Resolver<'_>,
-        trait_ref: hir_ty::next_solver::TraitRef<'db>,
-    ) -> Self {
-        let env = param_env_from_resolver(db, resolver);
-        TraitRef { env, trait_ref }
+    fn new(owner: GenericDefId, trait_ref: hir_ty::next_solver::TraitRef<'db>) -> Self {
+        Self { owner: TypeOwnerId::GenericDefId(owner), trait_ref }
     }
 
     pub fn trait_(&self) -> Trait {
         Trait { id: self.trait_ref.def_id.0 }
     }
 
-    pub fn self_ty(&self) -> TypeNs<'_> {
+    pub fn self_ty(&self) -> Type<'_> {
         let ty = self.trait_ref.self_ty();
-        TypeNs { env: self.env, ty }
+        Type { owner: self.owner, ty: EarlyBinder::bind(ty) }
     }
 
     /// Returns `idx`-th argument of this trait reference if it is a type argument. Note that the
     /// first argument is the `Self` type.
-    pub fn get_type_argument(&self, idx: usize) -> Option<TypeNs<'db>> {
+    pub fn get_type_argument(&self, idx: usize) -> Option<Type<'db>> {
         self.trait_ref
             .args
             .as_slice()
             .get(idx)
             .and_then(|arg| arg.ty())
-            .map(|ty| TypeNs { env: self.env, ty })
+            .map(|ty| Type { owner: self.owner, ty: EarlyBinder::bind(ty) })
     }
 }
 
@@ -5186,6 +4898,7 @@ enum AnyClosureId {
 
 #[derive(Clone, Debug, PartialEq, Eq, Hash)]
 pub struct Closure<'db> {
+    owner: TypeOwnerId,
     id: AnyClosureId,
     subst: GenericArgs<'db>,
 }
@@ -5223,12 +4936,11 @@ pub fn captured_items(&self, db: &'db dyn HirDatabase) -> Vec<ClosureCapture<'db
         let InternedClosure { owner: infer_owner, expr: closure, .. } = closure;
         let infer = InferenceResult::of(db, infer_owner);
         let owner = infer_owner.expression_store_owner(db);
-        let param_env = body_param_env_from_has_crate(db, owner);
         infer.closures_data[&closure]
             .min_captures
             .values()
             .flatten()
-            .map(|capture| ClosureCapture { owner, infer_owner, closure, capture, param_env })
+            .map(|capture| ClosureCapture { owner, infer_owner, closure, capture })
             .collect()
     }
 
@@ -5319,7 +5031,6 @@ pub struct ClosureCapture<'db> {
     infer_owner: InferBodyId,
     closure: ExprId,
     capture: &'db hir_ty::closure_analysis::CapturedPlace,
-    param_env: ParamEnvAndCrate<'db>,
 }
 
 impl<'db> ClosureCapture<'db> {
@@ -5427,14 +5138,14 @@ pub fn display_place_source_code(&self, db: &dyn HirDatabase, edition: Edition)
         result
     }
 
-    pub fn ty(&self, _db: &'db dyn HirDatabase) -> Type<'db> {
-        Type { env: self.param_env, ty: self.capture.place.ty() }
+    pub fn ty(&self, db: &'db dyn HirDatabase) -> Type<'db> {
+        Type::new_body(db, self.owner, self.capture.place.ty())
     }
 
     /// The type that is stored in the closure, which is different from [`Self::ty()`], representing
     /// the place's type, when the capture is by ref.
     pub fn captured_ty(&self, db: &'db dyn HirDatabase) -> Type<'db> {
-        Type { env: self.param_env, ty: self.capture.captured_ty(db) }
+        Type::new_body(db, self.owner, self.capture.captured_ty(db))
     }
 }
 
@@ -5510,69 +5221,143 @@ pub fn is_ref(&self) -> bool {
     }
 }
 
-#[derive(Clone, PartialEq, Eq, Debug, Hash)]
-pub struct Type<'db> {
-    env: ParamEnvAndCrate<'db>,
-    ty: Ty<'db>,
+#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
+enum TypeOwnerId {
+    GenericDefId(GenericDefId),
+    BuiltinDeriveImplId(BuiltinDeriveImplId),
+    AnonConstId(AnonConstId),
+    // FIXME: What do when we unify two different crates? Currently we just randomly keep one.
+    NoParams(base_db::Crate),
+}
+impl_from!(GenericDefId, BuiltinDeriveImplId, AnonConstId for TypeOwnerId);
+
+impl TypeOwnerId {
+    fn unify(self, other: Self) -> Option<Self> {
+        match (self, other) {
+            (TypeOwnerId::NoParams(_), owner) => Some(owner),
+            (owner, TypeOwnerId::NoParams(_)) => Some(owner),
+            (_, _) => {
+                if self == other {
+                    Some(self)
+                } else {
+                    None
+                }
+            }
+        }
+    }
+
+    #[track_caller]
+    fn must_unify(self, other: Self) -> Self {
+        self.unify(other).expect("failed to unify type owners")
+    }
+
+    fn can_rebase_into(
+        self,
+        db: &dyn HirDatabase,
+        rebase_into: Self,
+        self_ty: EarlyBinder<'_, Ty<'_>>,
+    ) -> bool {
+        if self == rebase_into || !self_ty.skip_binder().has_param() {
+            return true;
+        }
+        let self_def = match self {
+            TypeOwnerId::GenericDefId(def) => def,
+            TypeOwnerId::BuiltinDeriveImplId(_) | TypeOwnerId::AnonConstId(_) => return false,
+            TypeOwnerId::NoParams(_) => return true,
+        };
+        let self_def = match self_def {
+            GenericDefId::ImplId(def) => ItemContainerId::ImplId(def),
+            GenericDefId::TraitId(def) => ItemContainerId::TraitId(def),
+            GenericDefId::AdtId(_)
+            | GenericDefId::ConstId(_)
+            | GenericDefId::FunctionId(_)
+            | GenericDefId::StaticId(_)
+            | GenericDefId::TypeAliasId(_) => return false,
+        };
+        let rebase_into_def = match rebase_into {
+            TypeOwnerId::GenericDefId(def) => def,
+            TypeOwnerId::BuiltinDeriveImplId(_)
+            | TypeOwnerId::AnonConstId(_)
+            | TypeOwnerId::NoParams(_) => return false,
+        };
+        let rebase_into_parent = match rebase_into_def {
+            GenericDefId::ConstId(def) => def.loc(db).container,
+            GenericDefId::FunctionId(def) => def.loc(db).container,
+            GenericDefId::TypeAliasId(def) => def.loc(db).container,
+            GenericDefId::AdtId(_)
+            | GenericDefId::ImplId(_)
+            | GenericDefId::StaticId(_)
+            | GenericDefId::TraitId(_) => return false,
+        };
+        self_def == rebase_into_parent
+    }
 }
 
+/// Note: A [`Type`] remembers its origin. Trying to do anything (except comparing)
+/// with types of different origins will cause errors or panics. Instead, use the `instantiate` methods.
+#[derive(Clone, Debug)]
+pub struct Type<'db> {
+    owner: TypeOwnerId,
+    ty: EarlyBinder<'db, Ty<'db>>,
+}
+
+impl<'db> std::hash::Hash for Type<'db> {
+    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
+        // Do not hash the owner as different owners can compare the same.
+        // self.owner.hash(state);
+        self.ty.hash(state);
+    }
+}
+
+impl<'db> PartialEq for Type<'db> {
+    fn eq(&self, other: &Self) -> bool {
+        if self.ty != other.ty {
+            return false;
+        }
+        hir_ty::with_attached_db(|db| {
+            self.owner.can_rebase_into(db, other.owner, self.ty)
+                || other.owner.can_rebase_into(db, self.owner, other.ty)
+        })
+    }
+}
+
+impl<'db> Eq for Type<'db> {}
+
 impl<'db> Type<'db> {
-    pub(crate) fn new_with_resolver(
-        db: &'db dyn HirDatabase,
-        resolver: &Resolver<'_>,
-        ty: Ty<'db>,
-    ) -> Self {
-        Type::new_with_resolver_inner(db, resolver, ty)
+    fn new(owner: GenericDefId, ty: Ty<'db>) -> Self {
+        Type { owner: TypeOwnerId::GenericDefId(owner), ty: EarlyBinder::bind(ty) }
     }
 
-    pub(crate) fn new_with_resolver_inner(
-        db: &'db dyn HirDatabase,
-        resolver: &Resolver<'_>,
-        ty: Ty<'db>,
-    ) -> Self {
-        let environment = param_env_from_resolver(db, resolver);
-        Type { env: environment, ty }
+    fn new_body(db: &dyn HirDatabase, owner: ExpressionStoreOwnerId, ty: Ty<'db>) -> Self {
+        Self::new(owner.generic_def(db), ty)
     }
 
-    pub(crate) fn new_for_crate(krate: base_db::Crate, ty: Ty<'db>) -> Self {
-        Type { env: empty_param_env(krate), ty }
+    fn no_params(krate: base_db::Crate, ty: Ty<'db>) -> Self {
+        Type { owner: TypeOwnerId::NoParams(krate), ty: EarlyBinder::bind(ty) }
     }
 
-    fn new(db: &'db dyn HirDatabase, lexical_env: impl HasResolver, ty: Ty<'db>) -> Self {
-        let resolver = lexical_env.resolver(db);
-        let environment = param_env_from_resolver(db, &resolver);
-        Type { env: environment, ty }
+    fn builtin_type_crate(db: &'db dyn HirDatabase) -> base_db::Crate {
+        // It doesn't really matter.
+        all_crates(db)[0]
     }
 
-    fn from_def(db: &'db dyn HirDatabase, def: impl Into<TyDefId> + HasResolver) -> Self {
-        let interner = DbInterner::new_no_crate(db);
-        let ty = db.ty(def.into());
-        let def = match def.into() {
-            TyDefId::AdtId(it) => GenericDefId::AdtId(it),
-            TyDefId::TypeAliasId(it) => GenericDefId::TypeAliasId(it),
-            TyDefId::BuiltinType(_) => {
-                return Type::new(db, def, ty.skip_binder());
-            }
+    fn from_def(db: &'db dyn HirDatabase, def: impl Into<TyDefId>) -> Self {
+        let def = def.into();
+        let ty = db.ty(def);
+        let owner = match def {
+            TyDefId::AdtId(it) => TypeOwnerId::GenericDefId(GenericDefId::AdtId(it)),
+            TyDefId::TypeAliasId(it) => TypeOwnerId::GenericDefId(GenericDefId::TypeAliasId(it)),
+            TyDefId::BuiltinType(_) => TypeOwnerId::NoParams(Self::builtin_type_crate(db)),
         };
-        let args = GenericArgs::error_for_item(interner, def.into());
-        Type::new(db, def, ty.instantiate(interner, args).skip_norm_wip())
+        Type { owner, ty }
     }
 
-    // FIXME: We shouldn't leak `TyKind::Param`s.
-    fn from_def_params(db: &'db dyn HirDatabase, def: impl Into<TyDefId> + HasResolver) -> Self {
-        let ty = db.ty(def.into());
-        Type::new(db, def, ty.instantiate_identity().skip_norm_wip())
-    }
-
-    fn from_value_def(
-        db: &'db dyn HirDatabase,
-        def: impl Into<ValueTyDefId> + HasResolver,
-    ) -> Self {
-        let interner = DbInterner::new_no_crate(db);
-        let Some(ty) = db.value_ty(def.into()) else {
-            return Type::new(db, def, Ty::new_error(interner, ErrorGuaranteed));
+    fn from_value_def(db: &'db dyn HirDatabase, def: impl Into<ValueTyDefId>) -> Self {
+        let def = def.into();
+        let Some(ty) = db.value_ty(def) else {
+            return Type::unknown();
         };
-        let def = match def.into() {
+        let def = match def {
             ValueTyDefId::ConstId(it) => GenericDefId::ConstId(it),
             ValueTyDefId::FunctionId(it) => GenericDefId::FunctionId(it),
             ValueTyDefId::StructId(it) => GenericDefId::AdtId(AdtId::StructId(it)),
@@ -5580,52 +5365,192 @@ fn from_value_def(
             ValueTyDefId::EnumVariantId(it) => {
                 GenericDefId::AdtId(AdtId::EnumId(it.lookup(db).parent))
             }
-            ValueTyDefId::StaticId(_) => {
-                return Type::new(db, def, ty.skip_binder());
+            ValueTyDefId::StaticId(it) => {
+                return Type::no_params(hir_def::HasModule::krate(&it, db), ty.skip_binder());
             }
         };
-        let args = GenericArgs::error_for_item(interner, def.into());
-        Type::new(db, def, ty.instantiate(interner, args).skip_norm_wip())
+        Type::new(def, ty.instantiate_identity().skip_norm_wip())
     }
 
-    pub fn new_slice(ty: Self) -> Self {
+    /// Replace any generic parameters with error types.
+    pub fn instantiate_with_errors(&self) -> Self {
         let interner = DbInterner::conjure();
-        Type { env: ty.env, ty: Ty::new_slice(interner, ty.ty) }
+        let krate = self.krate(interner.db());
+        let args = match self.owner {
+            TypeOwnerId::GenericDefId(def) => GenericArgs::error_for_item(interner, def.into()),
+            TypeOwnerId::BuiltinDeriveImplId(def) => {
+                GenericArgs::error_for_item(interner, def.into())
+            }
+            TypeOwnerId::AnonConstId(def) => GenericArgs::error_for_item(interner, def.into()),
+            TypeOwnerId::NoParams(_) => GenericArgs::empty(interner),
+        };
+        Type::no_params(krate, self.ty.instantiate(interner, args).skip_norm_wip())
     }
 
-    pub fn new_tuple(krate: base_db::Crate, tys: &[Self]) -> Self {
-        let tys = tys.iter().map(|it| it.ty);
+    // FIXME: Find some way with const params, maybe even lifetimes?
+    pub fn instantiate(&self, args: impl IntoIterator<Item: Borrow<Type<'db>>>) -> Type<'db> {
         let interner = DbInterner::conjure();
-        Type { env: empty_param_env(krate), ty: Ty::new_tup_from_iter(interner, tys) }
+        let (args, owner) = match self.owner {
+            TypeOwnerId::GenericDefId(def) => generic_args_from_tys(interner, def.into(), args),
+            TypeOwnerId::BuiltinDeriveImplId(def) => {
+                generic_args_from_tys(interner, def.into(), args)
+            }
+            TypeOwnerId::AnonConstId(def) => generic_args_from_tys(interner, def.into(), args),
+            TypeOwnerId::NoParams(krate) => {
+                (GenericArgs::empty(interner), TypeOwnerId::NoParams(krate))
+            }
+        };
+        Type { owner, ty: EarlyBinder::bind(self.ty.instantiate(interner, args).skip_norm_wip()) }
+    }
+
+    /// Instantiates multiple types with infer vars, keeping the same infer vars for the same owners.
+    fn instantiate_many_with_infer(
+        tys: impl IntoIterator<Item: Borrow<Type<'db>>>,
+        infcx: &InferCtxt<'db>,
+    ) -> impl Iterator<Item = Ty<'db>> {
+        let mut var_for_param = FxHashMap::default();
+        tys.into_iter().map(move |ty| {
+            let ty = ty.borrow();
+            let owner = match ty.owner {
+                TypeOwnerId::GenericDefId(def) => def.into(),
+                TypeOwnerId::BuiltinDeriveImplId(def) => def.into(),
+                TypeOwnerId::AnonConstId(def) => def.into(),
+                TypeOwnerId::NoParams(_) => return ty.ty.skip_binder(),
+            };
+            let args = GenericArgs::for_item(infcx.interner, owner, |_, param, _| {
+                *var_for_param
+                    .entry(param)
+                    .or_insert_with(|| infcx.var_for_def(param, hir_ty::Span::Dummy))
+            });
+
+            ty.ty.instantiate(infcx.interner, args).skip_norm_wip()
+        })
+    }
+
+    /// Tries to put this type as-is in the context of `rebase_into`. This will return `Some(_)` if:
+    ///
+    ///  - The type does not reference generic parameters, or
+    ///  - `rebase_into` is in the context of a child of our context (for example, a function in an impl).
+    pub fn try_rebase_into(
+        &self,
+        db: &'db dyn HirDatabase,
+        rebase_into: &Type<'db>,
+    ) -> Option<Self> {
+        if self.owner.can_rebase_into(db, rebase_into.owner, self.ty) {
+            Some(Type { owner: rebase_into.owner, ty: self.ty })
+        } else {
+            None
+        }
+    }
+
+    /// If `self` can be rebased into `rebase_into`, returns that. Otherwise, instantiates `self` with errors
+    /// and returns that.
+    pub fn rebase_into_or_error(
+        &self,
+        db: &'db dyn HirDatabase,
+        rebase_into: &Type<'db>,
+    ) -> Type<'db> {
+        self.try_rebase_into(db, rebase_into).unwrap_or_else(|| self.instantiate_with_errors())
+    }
+
+    pub fn try_rebase_into_owner(
+        &self,
+        db: &'db dyn HirDatabase,
+        new_owner: GenericDef,
+    ) -> Option<Self> {
+        let new_owner = new_owner.id()?.into();
+        if self.owner.can_rebase_into(db, new_owner, self.ty) {
+            Some(Type { owner: new_owner, ty: self.ty })
+        } else {
+            None
+        }
+    }
+
+    pub fn rebase_into_owner_or_error(
+        &self,
+        db: &'db dyn HirDatabase,
+        new_owner: GenericDef,
+    ) -> Self {
+        self.try_rebase_into_owner(db, new_owner).unwrap_or_else(|| self.instantiate_with_errors())
+    }
+
+    pub fn unknown() -> Self {
+        let interner = DbInterner::conjure();
+        Type::no_params(
+            Self::builtin_type_crate(interner.db()),
+            Ty::new_error(interner, ErrorGuaranteed),
+        )
+    }
+
+    pub fn new_slice(db: &'db dyn HirDatabase, ty: Self) -> Self {
+        let interner = DbInterner::new_no_crate(db);
+        Type { owner: ty.owner, ty: ty.ty.map_bound(|ty| Ty::new_slice(interner, ty)) }
+    }
+
+    pub fn new_tuple(
+        db: &'db dyn HirDatabase,
+        tys: impl IntoIterator<Item: Borrow<Type<'db>>>,
+    ) -> Self {
+        let interner = DbInterner::new_no_crate(db);
+        let mut owner = None::<TypeOwnerId>;
+        let ty = EarlyBinder::bind(Ty::new_tup_from_iter(
+            interner,
+            tys.into_iter().map(|ty| {
+                let ty = ty.borrow();
+
+                match &mut owner {
+                    Some(owner) => *owner = owner.must_unify(ty.owner),
+                    None => owner = Some(ty.owner),
+                }
+
+                ty.ty.skip_binder()
+            }),
+        ));
+        let owner =
+            owner.unwrap_or_else(|| TypeOwnerId::NoParams(Self::builtin_type_crate(interner.db())));
+        Type { owner, ty }
+    }
+
+    pub fn new_unit() -> Self {
+        let interner = DbInterner::conjure();
+        Type::no_params(Self::builtin_type_crate(interner.db()), Ty::new_unit(interner))
     }
 
     pub fn is_unit(&self) -> bool {
-        self.ty.is_unit()
+        self.ty.skip_binder().is_unit()
     }
 
     pub fn is_bool(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Bool)
+        matches!(self.ty.skip_binder().kind(), TyKind::Bool)
     }
 
     pub fn is_str(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Str)
+        matches!(self.ty.skip_binder().kind(), TyKind::Str)
     }
 
     pub fn is_never(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Never)
+        matches!(self.ty.skip_binder().kind(), TyKind::Never)
     }
 
     pub fn is_mutable_reference(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Ref(.., hir_ty::next_solver::Mutability::Mut))
+        matches!(
+            self.ty.skip_binder().kind(),
+            TyKind::Ref(.., hir_ty::next_solver::Mutability::Mut)
+        )
     }
 
     pub fn is_reference(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Ref(..))
+        matches!(self.ty.skip_binder().kind(), TyKind::Ref(..))
     }
 
     pub fn contains_reference(&self, db: &'db dyn HirDatabase) -> bool {
         let interner = DbInterner::new_no_crate(db);
-        return self.ty.visit_with(&mut Visitor { interner }).is_break();
+        return self
+            .ty
+            .instantiate_identity()
+            .skip_norm_wip()
+            .visit_with(&mut Visitor { interner })
+            .is_break();
 
         fn is_phantom_data(db: &dyn HirDatabase, adt_id: AdtId) -> bool {
             match adt_id {
@@ -5664,7 +5589,7 @@ fn visit_ty(&mut self, ty: Ty<'db>) -> Self::Result {
                                     .iter()
                                     .map(|(idx, _)| {
                                         field_types[idx]
-                                            .get()
+                                            .ty()
                                             .instantiate(self.interner, args)
                                             .skip_norm_wip()
                                     })
@@ -5681,8 +5606,8 @@ fn visit_ty(&mut self, ty: Ty<'db>) -> Self::Result {
                             AdtId::EnumId(id) => id
                                 .enum_variants(self.interner.db())
                                 .variants
-                                .iter()
-                                .map(|&(variant_id, _, _)| variant_id_to_fields(variant_id.into()))
+                                .values()
+                                .map(|&(variant_id, _)| variant_id_to_fields(variant_id.into()))
                                 .collect(),
                             AdtId::UnionId(id) => {
                                 vec![variant_id_to_fields(id.into())]
@@ -5703,89 +5628,129 @@ fn visit_ty(&mut self, ty: Ty<'db>) -> Self::Result {
     }
 
     pub fn as_reference(&self) -> Option<(Type<'db>, Mutability)> {
-        let TyKind::Ref(_lt, ty, m) = self.ty.kind() else { return None };
+        let TyKind::Ref(_lt, ty, m) = self.ty.skip_binder().kind() else { return None };
         let m = Mutability::from_mutable(matches!(m, hir_ty::next_solver::Mutability::Mut));
         Some((self.derived(ty), m))
     }
 
-    pub fn add_reference(&self, mutability: Mutability) -> Self {
-        let interner = DbInterner::conjure();
+    pub fn as_reference_inner(&self) -> Option<Type<'db>> {
+        self.as_reference().map(|(inner, _)| inner)
+    }
+
+    pub fn add_reference(&self, db: &'db dyn HirDatabase, mutability: Mutability) -> Self {
+        let interner = DbInterner::new_no_crate(db);
         let ty_mutability = match mutability {
             Mutability::Shared => hir_ty::next_solver::Mutability::Not,
             Mutability::Mut => hir_ty::next_solver::Mutability::Mut,
         };
-        self.derived(Ty::new_ref(interner, Region::error(interner), self.ty, ty_mutability))
+        self.derived(Ty::new_ref(
+            interner,
+            Region::error(interner),
+            self.ty.skip_binder(),
+            ty_mutability,
+        ))
     }
 
     pub fn is_slice(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Slice(..))
+        matches!(self.ty.skip_binder().kind(), TyKind::Slice(..))
     }
 
     pub fn is_usize(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Uint(rustc_type_ir::UintTy::Usize))
+        matches!(self.ty.skip_binder().kind(), TyKind::Uint(rustc_type_ir::UintTy::Usize))
     }
 
     pub fn is_float(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Float(_))
+        matches!(self.ty.skip_binder().kind(), TyKind::Float(_))
     }
 
     pub fn is_char(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Char)
+        matches!(self.ty.skip_binder().kind(), TyKind::Char)
     }
 
     pub fn is_int_or_uint(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Int(_) | TyKind::Uint(_))
+        matches!(self.ty.skip_binder().kind(), TyKind::Int(_) | TyKind::Uint(_))
     }
 
     pub fn is_scalar(&self) -> bool {
         matches!(
-            self.ty.kind(),
+            self.ty.skip_binder().kind(),
             TyKind::Bool | TyKind::Char | TyKind::Int(_) | TyKind::Uint(_) | TyKind::Float(_)
         )
     }
 
     pub fn is_tuple(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Tuple(..))
-    }
-
-    pub fn remove_ref(&self) -> Option<Type<'db>> {
-        match self.ty.kind() {
-            TyKind::Ref(_, ty, _) => Some(self.derived(ty)),
-            _ => None,
-        }
+        matches!(self.ty.skip_binder().kind(), TyKind::Tuple(..))
     }
 
     pub fn as_slice(&self) -> Option<Type<'db>> {
-        match self.ty.kind() {
+        match self.ty.skip_binder().kind() {
             TyKind::Slice(ty) => Some(self.derived(ty)),
             _ => None,
         }
     }
 
     pub fn strip_references(&self) -> Self {
-        self.derived(self.ty.strip_references())
+        self.derived(self.ty.skip_binder().strip_references())
     }
 
     // FIXME: This is the same as `remove_ref()`, remove one of these methods.
     pub fn strip_reference(&self) -> Self {
-        self.derived(self.ty.strip_reference())
+        self.derived(self.ty.skip_binder().strip_reference())
     }
 
     pub fn is_unknown(&self) -> bool {
-        self.ty.is_ty_error()
+        self.ty.skip_binder().is_ty_error()
+    }
+
+    fn krate(&self, db: &'db dyn HirDatabase) -> base_db::Crate {
+        match self.owner {
+            TypeOwnerId::GenericDefId(def) => hir_def::HasModule::krate(&def, db),
+            TypeOwnerId::BuiltinDeriveImplId(def) => {
+                hir_def::HasModule::krate(&def.loc(db).adt, db)
+            }
+            TypeOwnerId::AnonConstId(def) => hir_def::HasModule::krate(&def, db),
+            TypeOwnerId::NoParams(krate) => krate,
+        }
+    }
+
+    fn param_env(&self, db: &'db dyn HirDatabase) -> ParamEnvAndCrate<'db> {
+        let interner = DbInterner::new_no_crate(db);
+        let krate = self.krate(db);
+        match self.owner {
+            TypeOwnerId::GenericDefId(def) => {
+                ParamEnvAndCrate { param_env: db.trait_environment(def), krate }
+            }
+            TypeOwnerId::BuiltinDeriveImplId(def) => ParamEnvAndCrate {
+                param_env: hir_ty::builtin_derive::param_env(interner, def),
+                krate,
+            },
+            TypeOwnerId::AnonConstId(def) => ParamEnvAndCrate {
+                param_env: db.trait_environment(def.loc(db).owner.generic_def(db)),
+                krate,
+            },
+            TypeOwnerId::NoParams(_) => {
+                ParamEnvAndCrate { param_env: ParamEnv::empty(interner), krate }
+            }
+        }
     }
 
     /// Checks that particular type `ty` implements `std::future::IntoFuture` or
     /// `std::future::Future` and returns the `Output` associated type.
     /// This function is used in `.await` syntax completion.
     pub fn into_future_output(&self, db: &'db dyn HirDatabase) -> Option<Type<'db>> {
-        let lang_items = hir_def::lang_item::lang_items(db, self.env.krate);
+        let env = self.param_env(db);
+        let lang_items = hir_def::lang_item::lang_items(db, env.krate);
         let (trait_, output_assoc_type) = lang_items
             .IntoFuture
             .zip(lang_items.IntoFutureOutput)
             .or(lang_items.Future.zip(lang_items.FutureOutput))?;
 
-        if !traits::implements_trait_unique(self.ty, db, self.env, trait_) {
+        if !traits::implements_trait_unique(
+            self.ty.instantiate_identity().skip_norm_wip(),
+            db,
+            env,
+            trait_,
+        ) {
             return None;
         }
 
@@ -5794,32 +5759,46 @@ pub fn into_future_output(&self, db: &'db dyn HirDatabase) -> Option<Type<'db>>
 
     /// This does **not** resolve `IntoFuture`, only `Future`.
     pub fn future_output(self, db: &'db dyn HirDatabase) -> Option<Type<'db>> {
-        let lang_items = hir_def::lang_item::lang_items(db, self.env.krate);
+        let krate = self.krate(db);
+        let lang_items = hir_def::lang_item::lang_items(db, krate);
         let future_output = lang_items.FutureOutput?;
         self.normalize_trait_assoc_type(db, &[], future_output.into())
     }
 
     /// This does **not** resolve `IntoIterator`, only `Iterator`.
     pub fn iterator_item(self, db: &'db dyn HirDatabase) -> Option<Type<'db>> {
-        let lang_items = hir_def::lang_item::lang_items(db, self.env.krate);
+        let krate = self.krate(db);
+        let lang_items = hir_def::lang_item::lang_items(db, krate);
         let iterator_item = lang_items.IteratorItem?;
         self.normalize_trait_assoc_type(db, &[], iterator_item.into())
     }
 
     pub fn impls_iterator(self, db: &'db dyn HirDatabase) -> bool {
-        let lang_items = hir_def::lang_item::lang_items(db, self.env.krate);
+        let env = self.param_env(db);
+        let lang_items = hir_def::lang_item::lang_items(db, env.krate);
         let Some(iterator_trait) = lang_items.Iterator else {
             return false;
         };
-        traits::implements_trait_unique(self.ty, db, self.env, iterator_trait)
+        traits::implements_trait_unique(
+            self.ty.instantiate_identity().skip_norm_wip(),
+            db,
+            env,
+            iterator_trait,
+        )
     }
 
     /// Resolves the projection `<Self as IntoIterator>::IntoIter` and returns the resulting type
     pub fn into_iterator_iter(self, db: &'db dyn HirDatabase) -> Option<Type<'db>> {
-        let lang_items = hir_def::lang_item::lang_items(db, self.env.krate);
+        let env = self.param_env(db);
+        let lang_items = hir_def::lang_item::lang_items(db, env.krate);
         let trait_ = lang_items.IntoIterator?;
 
-        if !traits::implements_trait_unique(self.ty, db, self.env, trait_) {
+        if !traits::implements_trait_unique(
+            self.ty.instantiate_identity().skip_norm_wip(),
+            db,
+            env,
+            trait_,
+        ) {
             return None;
         }
 
@@ -5832,24 +5811,63 @@ pub fn into_iterator_iter(self, db: &'db dyn HirDatabase) -> Option<Type<'db>> {
     /// This function can be used to check if a particular type is callable, since FnOnce is a
     /// supertrait of Fn and FnMut, so all callable types implements at least FnOnce.
     pub fn impls_fnonce(&self, db: &'db dyn HirDatabase) -> bool {
-        let lang_items = hir_def::lang_item::lang_items(db, self.env.krate);
+        let env = self.param_env(db);
+        let lang_items = hir_def::lang_item::lang_items(db, env.krate);
         let fnonce_trait = match lang_items.FnOnce {
             Some(it) => it,
             None => return false,
         };
 
-        traits::implements_trait_unique(self.ty, db, self.env, fnonce_trait)
+        traits::implements_trait_unique(
+            self.ty.instantiate_identity().skip_norm_wip(),
+            db,
+            env,
+            fnonce_trait,
+        )
     }
 
     // FIXME: Find better API that also handles const generics
     pub fn impls_trait(&self, db: &'db dyn HirDatabase, trait_: Trait, args: &[Type<'db>]) -> bool {
+        let env = self.param_env(db);
         let interner = DbInterner::new_no_crate(db);
-        let args = generic_args_from_tys(
-            interner,
-            trait_.id.into(),
-            std::iter::once(self.ty).chain(args.iter().map(|ty| ty.ty)),
-        );
-        traits::implements_trait_unique_with_args(db, self.env, trait_.id, args)
+        let (args, _owner) =
+            generic_args_from_tys(interner, trait_.id.into(), iter::once(self).chain(args));
+        traits::implements_trait_unique_with_args(db, env, trait_.id, args)
+    }
+
+    /// Unlike [`Type::impls_trait()`], which checks whether the type always implements the trait,
+    /// this check whether there are any generic args substitution for `args`` that will cause the
+    /// trait to be implemented.
+    ///
+    /// For example, suppose we're there's `struct Foo<T>` and we're checking `Foo<T>: Trait`.
+    /// `impls_trait()` will return true only if there is `impl<T> Trait for Foo<T>`, while this
+    /// method will also return true if there is only `impl Trait for Foo<i32>`.
+    ///
+    /// Note that you can of course instantiate `Foo<T>` with `<i32>` and then the checks will
+    /// be the same, but this check for *any* substitution.
+    ///
+    /// Unlike almost anything that takes more than one type, you *can* pass types from different origins
+    /// to this function.
+    pub fn has_any_impl(
+        &self,
+        db: &'db dyn HirDatabase,
+        trait_: Trait,
+        args: &[Type<'db>],
+    ) -> bool {
+        let interner = DbInterner::new_no_crate(db);
+        let env = ParamEnvAndCrate { param_env: ParamEnv::empty(interner), krate: self.krate(db) };
+        traits::implements_trait_unique_with_infcx(db, env, trait_.id, &mut |infcx| {
+            let mut args = Self::instantiate_many_with_infer(iter::once(self).chain(args), infcx);
+            GenericArgs::for_item(infcx.interner, trait_.id.into(), |_, param, _| {
+                if let GenericParamId::TypeParamId(_) = param
+                    && let Some(arg) = args.next()
+                {
+                    arg.into()
+                } else {
+                    infcx.var_for_def(param, hir_ty::Span::Dummy)
+                }
+            })
+        })
     }
 
     pub fn normalize_trait_assoc_type(
@@ -5858,12 +5876,10 @@ pub fn normalize_trait_assoc_type(
         args: &[Type<'db>],
         alias: TypeAlias,
     ) -> Option<Type<'db>> {
-        let interner = DbInterner::new_with(db, self.env.krate);
-        let args = generic_args_from_tys(
-            interner,
-            alias.id.into(),
-            std::iter::once(self.ty).chain(args.iter().map(|ty| ty.ty)),
-        );
+        let env = self.param_env(db);
+        let interner = DbInterner::new_with(db, env.krate);
+        let (args, owner) =
+            generic_args_from_tys(interner, alias.id.into(), iter::once(self).chain(args));
         // FIXME: We don't handle GATs yet.
         let projection = Ty::new_alias(
             interner,
@@ -5875,12 +5891,13 @@ pub fn normalize_trait_assoc_type(
         );
 
         let infcx = interner.infer_ctxt().build(TypingMode::PostAnalysis);
-        let ty = structurally_normalize_ty(&infcx, projection, self.env.param_env);
-        if ty.is_ty_error() { None } else { Some(self.derived(ty)) }
+        let ty = structurally_normalize_ty(&infcx, projection, env.param_env);
+        if ty.is_ty_error() { None } else { Some(Type { owner, ty: EarlyBinder::bind(ty) }) }
     }
 
     pub fn is_copy(&self, db: &'db dyn HirDatabase) -> bool {
-        let lang_items = hir_def::lang_item::lang_items(db, self.env.krate);
+        let env = self.param_env(db);
+        let lang_items = hir_def::lang_item::lang_items(db, env.krate);
         let Some(copy_trait) = lang_items.Copy else {
             return false;
         };
@@ -5889,7 +5906,7 @@ pub fn is_copy(&self, db: &'db dyn HirDatabase) -> bool {
 
     pub fn as_callable(&self, db: &'db dyn HirDatabase) -> Option<Callable<'db>> {
         let interner = DbInterner::new_no_crate(db);
-        let callee = match self.ty.kind() {
+        let callee = match self.ty.skip_binder().kind() {
             TyKind::Closure(id, subst) => Callee::Closure(id.0, subst),
             TyKind::CoroutineClosure(id, subst) => Callee::CoroutineClosure(id.0, subst),
             TyKind::FnPtr(..) => Callee::FnPtr,
@@ -5897,7 +5914,9 @@ pub fn as_callable(&self, db: &'db dyn HirDatabase) -> Option<Callable<'db>> {
             // This will happen when it implements fn or fn mut, since we add an autoborrow adjustment
             TyKind::Ref(_, inner_ty, _) => return self.derived(inner_ty).as_callable(db),
             _ => {
-                let (fn_trait, sig) = hir_ty::callable_sig_from_fn_trait(self.ty, self.env, db)?;
+                let env = self.param_env(db);
+                let (fn_trait, sig) =
+                    hir_ty::callable_sig_from_fn_trait(self.ty.skip_binder(), env, db)?;
                 return Some(Callable {
                     ty: self.clone(),
                     sig,
@@ -5907,74 +5926,77 @@ pub fn as_callable(&self, db: &'db dyn HirDatabase) -> Option<Callable<'db>> {
             }
         };
 
-        let sig = self.ty.callable_sig(interner)?;
+        let sig = self.ty.skip_binder().callable_sig(interner)?;
         Some(Callable { ty: self.clone(), sig, callee, is_bound_method: false })
     }
 
     pub fn is_closure(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Closure { .. })
+        matches!(self.ty.skip_binder().kind(), TyKind::Closure { .. })
     }
 
     pub fn as_closure(&self) -> Option<Closure<'db>> {
-        match self.ty.kind() {
+        match self.ty.skip_binder().kind() {
             TyKind::Closure(id, subst) => {
-                Some(Closure { id: AnyClosureId::ClosureId(id.0), subst })
+                Some(Closure { id: AnyClosureId::ClosureId(id.0), subst, owner: self.owner })
             }
-            TyKind::CoroutineClosure(id, subst) => {
-                Some(Closure { id: AnyClosureId::CoroutineClosureId(id.0), subst })
-            }
+            TyKind::CoroutineClosure(id, subst) => Some(Closure {
+                id: AnyClosureId::CoroutineClosureId(id.0),
+                subst,
+                owner: self.owner,
+            }),
             _ => None,
         }
     }
 
     pub fn is_fn(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::FnDef(..) | TyKind::FnPtr { .. })
+        matches!(self.ty.skip_binder().kind(), TyKind::FnDef(..) | TyKind::FnPtr { .. })
     }
 
     pub fn is_array(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::Array(..))
+        matches!(self.ty.skip_binder().kind(), TyKind::Array(..))
     }
 
-    pub fn is_packed(&self, db: &'db dyn HirDatabase) -> bool {
-        let adt_id = match self.ty.kind() {
-            TyKind::Adt(adt_def, ..) => adt_def.def_id(),
-            _ => return false,
-        };
-
-        let adt = adt_id.into();
-        match adt {
-            Adt::Struct(s) => s.repr(db).unwrap_or_default().pack.is_some(),
+    pub fn is_packed(&self, _db: &'db dyn HirDatabase) -> bool {
+        match self.ty.skip_binder().kind() {
+            TyKind::Adt(adt_def, ..) => adt_def.is_packed(),
             _ => false,
         }
     }
 
     pub fn is_raw_ptr(&self) -> bool {
-        matches!(self.ty.kind(), TyKind::RawPtr(..))
+        matches!(self.ty.skip_binder().kind(), TyKind::RawPtr(..))
     }
 
     pub fn is_mutable_raw_ptr(&self) -> bool {
         // Used outside of rust-analyzer (e.g. by `ra_ap_hir` consumers).
-        matches!(self.ty.kind(), TyKind::RawPtr(.., hir_ty::next_solver::Mutability::Mut))
+        matches!(
+            self.ty.skip_binder().kind(),
+            TyKind::RawPtr(.., hir_ty::next_solver::Mutability::Mut)
+        )
     }
 
     pub fn as_raw_ptr(&self) -> Option<(Type<'db>, Mutability)> {
         // Used outside of rust-analyzer (e.g. by `ra_ap_hir` consumers).
-        let TyKind::RawPtr(ty, m) = self.ty.kind() else { return None };
+        let TyKind::RawPtr(ty, m) = self.ty.skip_binder().kind() else { return None };
         let m = Mutability::from_mutable(matches!(m, hir_ty::next_solver::Mutability::Mut));
         Some((self.derived(ty), m))
     }
 
     pub fn remove_raw_ptr(&self) -> Option<Type<'db>> {
-        if let TyKind::RawPtr(ty, _) = self.ty.kind() { Some(self.derived(ty)) } else { None }
+        if let TyKind::RawPtr(ty, _) = self.ty.skip_binder().kind() {
+            Some(self.derived(ty))
+        } else {
+            None
+        }
     }
 
     pub fn contains_unknown(&self) -> bool {
-        self.ty.references_non_lt_error()
+        self.ty.skip_binder().references_non_lt_error()
     }
 
     pub fn fields(&self, db: &'db dyn HirDatabase) -> Vec<(Field, Self)> {
         let interner = DbInterner::new_no_crate(db);
-        let (variant_id, substs) = match self.ty.kind() {
+        let (variant_id, substs) = match self.ty.skip_binder().kind() {
             TyKind::Adt(adt_def, substs) => {
                 let id = match adt_def.def_id() {
                     AdtId::StructId(id) => id.into(),
@@ -5988,16 +6010,16 @@ pub fn fields(&self, db: &'db dyn HirDatabase) -> Vec<(Field, Self)> {
 
         db.field_types(variant_id)
             .iter()
-            .map(|(local_id, ty)| {
+            .map(|(local_id, field)| {
                 let def = Field { parent: variant_id.into(), id: local_id };
-                let ty = ty.get().instantiate(interner, substs).skip_norm_wip();
+                let ty = field.ty().instantiate(interner, substs).skip_norm_wip();
                 (def, self.derived(ty))
             })
             .collect()
     }
 
     pub fn tuple_fields(&self, _db: &'db dyn HirDatabase) -> Vec<Self> {
-        if let TyKind::Tuple(substs) = self.ty.kind() {
+        if let TyKind::Tuple(substs) = self.ty.skip_binder().kind() {
             substs.iter().map(|ty| self.derived(ty)).collect()
         } else {
             Vec::new()
@@ -6005,17 +6027,18 @@ pub fn tuple_fields(&self, _db: &'db dyn HirDatabase) -> Vec<Self> {
     }
 
     pub fn as_array(&self, db: &'db dyn HirDatabase) -> Option<(Self, usize)> {
-        if let TyKind::Array(ty, len) = self.ty.kind() {
+        if let TyKind::Array(ty, len) = self.ty.skip_binder().kind() {
             try_const_usize(db, len).map(|it| (self.derived(ty), it as usize))
         } else {
             None
         }
     }
 
-    pub fn fingerprint_for_trait_impl(&self) -> Option<SimplifiedType> {
+    // FIXME: We should probably remove this.
+    pub fn fingerprint_for_trait_impl(&self, db: &'db dyn HirDatabase) -> Option<SimplifiedType> {
         fast_reject::simplify_type(
-            DbInterner::conjure(),
-            self.ty,
+            DbInterner::new_no_crate(db),
+            self.ty.skip_binder(),
             fast_reject::TreatParams::AsRigid,
         )
     }
@@ -6031,9 +6054,10 @@ pub fn autoderef(
 
     fn autoderef_(&self, db: &'db dyn HirDatabase) -> impl Iterator<Item = Ty<'db>> {
         let interner = DbInterner::new_no_crate(db);
+        let env = self.param_env(db);
         // There should be no inference vars in types passed here
-        let canonical = hir_ty::replace_errors_with_variables(interner, &self.ty);
-        autoderef(db, self.env, canonical)
+        let canonical = hir_ty::replace_errors_with_variables(interner, &self.ty.skip_binder());
+        autoderef(db, env, canonical)
     }
 
     // This would be nicer if it just returned an iterator, but that runs into
@@ -6065,17 +6089,20 @@ fn iterate_assoc_items_dyn(
                 }
             }
         };
+        let krate = self.krate(db);
 
         let interner = DbInterner::new_no_crate(db);
-        let Some(simplified_type) =
-            fast_reject::simplify_type(interner, self.ty, fast_reject::TreatParams::AsRigid)
-        else {
+        let Some(simplified_type) = fast_reject::simplify_type(
+            interner,
+            self.ty.skip_binder(),
+            fast_reject::TreatParams::AsRigid,
+        ) else {
             return;
         };
 
         method_resolution::with_incoherent_inherent_impls(
             db,
-            self.env.krate,
+            krate,
             &simplified_type,
             &mut handle_impls,
         );
@@ -6111,12 +6138,12 @@ fn iterate_assoc_items_dyn(
     /// - "U"
     /// ```
     pub fn type_arguments(&self) -> impl Iterator<Item = Type<'db>> + '_ {
-        match self.ty.strip_references().kind() {
+        match self.ty.skip_binder().strip_references().kind() {
             TyKind::Adt(_, substs) => Either::Left(substs.types().map(move |ty| self.derived(ty))),
             TyKind::Tuple(substs) => {
                 Either::Right(Either::Left(substs.iter().map(move |ty| self.derived(ty))))
             }
-            _ => Either::Right(Either::Right(std::iter::empty())),
+            _ => Either::Right(Either::Right(iter::empty())),
         }
     }
 
@@ -6144,6 +6171,7 @@ pub fn type_and_const_arguments<'a>(
         display_target: DisplayTarget,
     ) -> impl Iterator<Item = SmolStr> + 'a {
         self.ty
+            .skip_binder()
             .strip_references()
             .as_adt()
             .into_iter()
@@ -6234,7 +6262,7 @@ fn with_method_resolution<R>(
         };
         let infcx = interner.infer_ctxt().build(typing_mode);
         let features = resolver.top_level_def_map().features();
-        let environment = param_env_from_resolver(db, resolver);
+        let environment = self.param_env(db);
         let ctx = MethodResolutionContext {
             infcx: &infcx,
             resolver,
@@ -6269,7 +6297,8 @@ pub fn iterate_method_candidates_split_inherent(
 
         self.with_method_resolution(db, scope.resolver(), traits_in_scope, |ctx| {
             // There should be no inference vars in types passed here
-            let canonical = hir_ty::replace_errors_with_variables(ctx.infcx.interner, &self.ty);
+            let canonical =
+                hir_ty::replace_errors_with_variables(ctx.infcx.interner, &self.ty.skip_binder());
             let (self_ty, _) = ctx.infcx.instantiate_canonical(hir_ty::Span::Dummy, &canonical);
 
             match name {
@@ -6377,7 +6406,8 @@ pub fn iterate_path_candidates_split_inherent(
 
         self.with_method_resolution(db, scope.resolver(), traits_in_scope, |ctx| {
             // There should be no inference vars in types passed here
-            let canonical = hir_ty::replace_errors_with_variables(ctx.infcx.interner, &self.ty);
+            let canonical =
+                hir_ty::replace_errors_with_variables(ctx.infcx.interner, &self.ty.skip_binder());
             let (self_ty, _) = ctx.infcx.instantiate_canonical(hir_ty::Span::Dummy, &canonical);
 
             match name {
@@ -6426,23 +6456,23 @@ pub fn iterate_path_candidates_split_inherent(
     }
 
     pub fn as_adt(&self) -> Option<Adt> {
-        let (adt, _subst) = self.ty.as_adt()?;
+        let (adt, _subst) = self.ty.skip_binder().as_adt()?;
         Some(adt.into())
     }
 
     /// Holes in the args can come from lifetime/const params.
     pub fn as_adt_with_args(&self) -> Option<(Adt, Vec<Option<Type<'db>>>)> {
-        let (adt, args) = self.ty.as_adt()?;
+        let (adt, args) = self.ty.skip_binder().as_adt()?;
         let args = args.iter().map(|arg| Some(self.derived(arg.ty()?))).collect();
         Some((adt.into(), args))
     }
 
     pub fn as_builtin(&self) -> Option<BuiltinType> {
-        self.ty.as_builtin().map(|inner| BuiltinType { inner })
+        self.ty.skip_binder().as_builtin().map(|inner| BuiltinType { inner })
     }
 
     pub fn as_dyn_trait(&self) -> Option<Trait> {
-        self.ty.dyn_trait().map(Into::into)
+        self.ty.skip_binder().dyn_trait().map(Into::into)
     }
 
     /// If a type can be represented as `dyn Trait`, returns all traits accessible via this type,
@@ -6461,11 +6491,11 @@ pub fn applicable_inherent_traits(
 
     pub fn env_traits(&self, db: &'db dyn HirDatabase) -> impl Iterator<Item = Trait> {
         let _p = tracing::info_span!("env_traits").entered();
+        let env = self.param_env(db);
         self.autoderef_(db)
             .filter(|ty| matches!(ty.kind(), TyKind::Param(_)))
-            .flat_map(|ty| {
-                self.env
-                    .param_env
+            .flat_map(move |ty| {
+                env.param_env
                     .clauses()
                     .iter()
                     .filter_map(move |pred| match pred.kind().skip_binder() {
@@ -6479,7 +6509,7 @@ pub fn env_traits(&self, db: &'db dyn HirDatabase) -> impl Iterator<Item = Trait
     }
 
     pub fn as_impl_traits(&self, db: &'db dyn HirDatabase) -> Option<impl Iterator<Item = Trait>> {
-        self.ty.impl_trait_bounds(db).map(|it| {
+        self.ty.skip_binder().impl_trait_bounds(db).map(|it| {
             it.into_iter().filter_map(|pred| match pred.kind().skip_binder() {
                 ClauseKind::Trait(trait_ref) => Some(Trait::from(trait_ref.def_id().0)),
                 _ => None,
@@ -6489,7 +6519,7 @@ pub fn as_impl_traits(&self, db: &'db dyn HirDatabase) -> Option<impl Iterator<I
 
     pub fn as_associated_type_parent_trait(&self, db: &'db dyn HirDatabase) -> Option<Trait> {
         let TyKind::Alias(AliasTy { kind: AliasTyKind::Projection { def_id }, .. }) =
-            self.ty.kind()
+            self.ty.skip_binder().kind()
         else {
             return None;
         };
@@ -6500,7 +6530,7 @@ pub fn as_associated_type_parent_trait(&self, db: &'db dyn HirDatabase) -> Optio
     }
 
     fn derived(&self, ty: Ty<'db>) -> Self {
-        Type { env: self.env, ty }
+        Type { owner: self.owner, ty: EarlyBinder::bind(ty) }
     }
 
     /// Visits every type, including generic arguments, in this type. `callback` is called with type
@@ -6508,7 +6538,7 @@ fn derived(&self, ty: Ty<'db>) -> Self {
     pub fn walk(&self, db: &'db dyn HirDatabase, callback: impl FnMut(Type<'db>)) {
         struct Visitor<'db, F> {
             db: &'db dyn HirDatabase,
-            env: ParamEnvAndCrate<'db>,
+            owner: TypeOwnerId,
             callback: F,
             visited: FxHashSet<Ty<'db>>,
         }
@@ -6523,7 +6553,7 @@ fn visit_ty(&mut self, ty: Ty<'db>) -> Self::Result {
                     return;
                 }
 
-                (self.callback)(Type { env: self.env, ty });
+                (self.callback)(Type { owner: self.owner, ty: EarlyBinder::bind(ty) });
 
                 if let Some(bounds) = ty.impl_trait_bounds(self.db) {
                     bounds.visit_with(self);
@@ -6533,17 +6563,23 @@ fn visit_ty(&mut self, ty: Ty<'db>) -> Self::Result {
             }
         }
 
-        let mut visitor = Visitor { db, env: self.env, callback, visited: FxHashSet::default() };
-        self.ty.visit_with(&mut visitor);
+        let mut visitor =
+            Visitor { db, owner: self.owner, callback, visited: FxHashSet::default() };
+        self.ty.skip_binder().visit_with(&mut visitor);
     }
     /// Check if type unifies with another type.
     ///
     /// Note that we consider placeholder types to unify with everything.
     /// For example `Option<T>` and `Option<U>` unify although there is unresolved goal `T = U`.
     pub fn could_unify_with(&self, db: &'db dyn HirDatabase, other: &Type<'db>) -> bool {
+        self.owner.must_unify(other.owner);
+        let env = self.param_env(db);
         let interner = DbInterner::new_no_crate(db);
-        let tys = hir_ty::replace_errors_with_variables(interner, &(self.ty, other.ty));
-        hir_ty::could_unify(db, self.env, &tys)
+        let tys = hir_ty::replace_errors_with_variables(
+            interner,
+            &(self.ty.skip_binder(), other.ty.skip_binder()),
+        );
+        hir_ty::could_unify(db, env, &tys)
     }
 
     /// Check if type unifies with another type eagerly making sure there are no unresolved goals.
@@ -6551,19 +6587,29 @@ pub fn could_unify_with(&self, db: &'db dyn HirDatabase, other: &Type<'db>) -> b
     /// This means that placeholder types are not considered to unify if there are any bounds set on
     /// them. For example `Option<T>` and `Option<U>` do not unify as we cannot show that `T = U`
     pub fn could_unify_with_deeply(&self, db: &'db dyn HirDatabase, other: &Type<'db>) -> bool {
+        self.owner.must_unify(other.owner);
+        let env = self.param_env(db);
         let interner = DbInterner::new_no_crate(db);
-        let tys = hir_ty::replace_errors_with_variables(interner, &(self.ty, other.ty));
-        hir_ty::could_unify_deeply(db, self.env, &tys)
+        let tys = hir_ty::replace_errors_with_variables(
+            interner,
+            &(self.ty.skip_binder(), other.ty.skip_binder()),
+        );
+        hir_ty::could_unify_deeply(db, env, &tys)
     }
 
     pub fn could_coerce_to(&self, db: &'db dyn HirDatabase, to: &Type<'db>) -> bool {
+        self.owner.must_unify(to.owner);
+        let env = self.param_env(db);
         let interner = DbInterner::new_no_crate(db);
-        let tys = hir_ty::replace_errors_with_variables(interner, &(self.ty, to.ty));
-        hir_ty::could_coerce(db, self.env, &tys)
+        let tys = hir_ty::replace_errors_with_variables(
+            interner,
+            &(self.ty.skip_binder(), to.ty.skip_binder()),
+        );
+        hir_ty::could_coerce(db, env, &tys)
     }
 
     pub fn as_type_param(&self, _db: &'db dyn HirDatabase) -> Option<TypeParam> {
-        match self.ty.kind() {
+        match self.ty.skip_binder().kind() {
             TyKind::Param(param) => Some(TypeParam { id: param.id }),
             _ => None,
         }
@@ -6571,60 +6617,23 @@ pub fn as_type_param(&self, _db: &'db dyn HirDatabase) -> Option<TypeParam> {
 
     /// Returns unique `GenericParam`s contained in this type.
     pub fn generic_params(&self, db: &'db dyn HirDatabase) -> FxHashSet<GenericParam> {
-        hir_ty::collect_params(&self.ty)
+        hir_ty::collect_params(&self.ty.skip_binder())
             .into_iter()
             .map(|id| TypeOrConstParam { id }.split(db).either_into())
             .collect()
     }
 
     pub fn layout(&self, db: &'db dyn HirDatabase) -> Result<Layout<'db>, LayoutError> {
-        db.layout_of_ty(self.ty.store(), self.env.store())
-            .map(|layout| Layout(layout, db.target_data_layout(self.env.krate).unwrap()))
+        let env = self.param_env(db);
+        db.layout_of_ty(self.ty.skip_binder().store(), env.store())
+            .map(|layout| Layout(layout, db.target_data_layout(env.krate).unwrap()))
     }
 
     pub fn drop_glue(&self, db: &'db dyn HirDatabase) -> DropGlue {
-        let interner = DbInterner::new_with(db, self.env.krate);
+        let env = self.param_env(db);
+        let interner = DbInterner::new_with(db, env.krate);
         let infcx = interner.infer_ctxt().build(TypingMode::PostAnalysis);
-        hir_ty::drop::has_drop_glue(&infcx, self.ty, self.env.param_env)
-    }
-}
-
-#[derive(Clone, PartialEq, Eq, Debug, Hash)]
-pub struct TypeNs<'db> {
-    env: ParamEnvAndCrate<'db>,
-    ty: Ty<'db>,
-}
-
-impl<'db> TypeNs<'db> {
-    fn new(db: &'db dyn HirDatabase, lexical_env: impl HasResolver, ty: Ty<'db>) -> Self {
-        let resolver = lexical_env.resolver(db);
-        let environment = param_env_from_resolver(db, &resolver);
-        TypeNs { env: environment, ty }
-    }
-
-    pub fn to_type(&self, _db: &'db dyn HirDatabase) -> Type<'db> {
-        Type { env: self.env, ty: self.ty }
-    }
-
-    // FIXME: Find better API that also handles const generics
-    pub fn impls_trait(&self, infcx: InferCtxt<'db>, trait_: Trait, args: &[TypeNs<'db>]) -> bool {
-        let args = GenericArgs::new_from_iter(
-            infcx.interner,
-            [self.ty].into_iter().chain(args.iter().map(|t| t.ty)).map(GenericArg::from),
-        );
-        let trait_ref =
-            hir_ty::next_solver::TraitRef::new_from_args(infcx.interner, trait_.id.into(), args);
-        let obligation = hir_ty::next_solver::infer::traits::Obligation::new(
-            infcx.interner,
-            hir_ty::next_solver::infer::traits::ObligationCause::dummy(),
-            self.env.param_env,
-            trait_ref,
-        );
-        infcx.predicate_must_hold_modulo_regions(&obligation)
-    }
-
-    pub fn is_bool(&self) -> bool {
-        matches!(self.ty.kind(), rustc_type_ir::TyKind::Bool)
+        hir_ty::drop::has_drop_glue(&infcx, self.ty.skip_binder(), env.param_env)
     }
 }
 
@@ -6689,12 +6698,16 @@ pub fn kind(&self) -> CallableKind<'db> {
             Callee::Def(CallableDefId::EnumVariantId(it)) => {
                 CallableKind::TupleEnumVariant(it.into())
             }
-            Callee::Closure(id, subst) => {
-                CallableKind::Closure(Closure { id: AnyClosureId::ClosureId(id), subst })
-            }
-            Callee::CoroutineClosure(id, subst) => {
-                CallableKind::Closure(Closure { id: AnyClosureId::CoroutineClosureId(id), subst })
-            }
+            Callee::Closure(id, subst) => CallableKind::Closure(Closure {
+                id: AnyClosureId::ClosureId(id),
+                subst,
+                owner: self.ty.owner,
+            }),
+            Callee::CoroutineClosure(id, subst) => CallableKind::Closure(Closure {
+                id: AnyClosureId::CoroutineClosureId(id),
+                subst,
+                owner: self.ty.owner,
+            }),
             Callee::FnPtr => CallableKind::FnPtr,
             Callee::FnImpl(fn_) => CallableKind::FnImpl(fn_.into()),
         }
@@ -6835,7 +6848,7 @@ pub fn largest_padding(
                 reverse_index
                     .into_iter()
                     .flatten()
-                    .chain(std::iter::once((0, self.0.size.bytes())))
+                    .chain(iter::once((0, self.0.size.bytes())))
                     .tuple_windows()
                     .filter_map(|((i, start), (_, end))| {
                         let size = field_size(i)?;
@@ -6993,7 +7006,7 @@ pub enum PredicatePolarity {
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct TraitPredicate<'db> {
     inner: hir_ty::next_solver::TraitPredicate<'db>,
-    env: ParamEnvAndCrate<'db>,
+    owner: TypeOwnerId,
 }
 
 impl<'db> TraitPredicate<'db> {
@@ -7005,7 +7018,7 @@ pub fn polarity(&self) -> PredicatePolarity {
     }
 
     pub fn trait_ref(&self) -> TraitRef<'db> {
-        TraitRef { env: self.env, trait_ref: self.inner.trait_ref }
+        TraitRef { owner: self.owner, trait_ref: self.inner.trait_ref }
     }
 }
 
@@ -7075,8 +7088,8 @@ fn krate(&self, db: &dyn HirDatabase) -> Crate {
 }
 
 impl HasCrate for Type<'_> {
-    fn krate(&self, _db: &dyn HirDatabase) -> Crate {
-        self.env.krate.into()
+    fn krate(&self, db: &dyn HirDatabase) -> Crate {
+        self.krate(db).into()
     }
 }
 
@@ -7395,21 +7408,33 @@ fn as_name_opt(name: Option<impl AsName>) -> Name {
     name.map_or_else(Name::missing, |name| name.as_name())
 }
 
+#[track_caller]
 fn generic_args_from_tys<'db>(
     interner: DbInterner<'db>,
     def_id: SolverDefId,
-    args: impl IntoIterator<Item = Ty<'db>>,
-) -> GenericArgs<'db> {
+    args: impl IntoIterator<Item: Borrow<Type<'db>>>,
+) -> (GenericArgs<'db>, TypeOwnerId) {
+    let mut owner = None::<TypeOwnerId>;
     let mut args = args.into_iter();
-    GenericArgs::for_item(interner, def_id, |_, id, _| {
+    let args = GenericArgs::for_item(interner, def_id, |_, id, _| {
         if matches!(id, GenericParamId::TypeParamId(_))
             && let Some(arg) = args.next()
         {
-            arg.into()
+            let arg = arg.borrow();
+
+            match &mut owner {
+                Some(owner) => *owner = owner.must_unify(arg.owner),
+                None => owner = Some(arg.owner),
+            }
+
+            arg.ty.skip_binder().into()
         } else {
             next_solver::GenericArg::error_from_id(interner, id)
         }
-    })
+    });
+    let owner =
+        owner.unwrap_or_else(|| TypeOwnerId::NoParams(Type::builtin_type_crate(interner.db())));
+    (args, owner)
 }
 
 fn has_non_default_type_params(db: &dyn HirDatabase, generic_def: GenericDefId) -> bool {
@@ -7425,46 +7450,58 @@ fn has_non_default_type_params(db: &dyn HirDatabase, generic_def: GenericDefId)
         })
 }
 
-fn param_env_from_resolver<'db>(
-    db: &'db dyn HirDatabase,
-    resolver: &Resolver<'_>,
-) -> ParamEnvAndCrate<'db> {
-    ParamEnvAndCrate {
-        param_env: resolver
-            .generic_def()
-            .map_or_else(ParamEnv::empty, |generic_def| db.trait_environment(generic_def.into())),
-        krate: resolver.krate(),
-    }
-}
-
 fn param_env_from_has_crate<'db>(
     db: &'db dyn HirDatabase,
     id: impl hir_def::HasModule + Into<GenericDefId> + Copy,
 ) -> ParamEnvAndCrate<'db> {
-    ParamEnvAndCrate { param_env: db.trait_environment(id.into().into()), krate: id.krate(db) }
-}
-
-fn body_param_env_from_has_crate<'db>(
-    db: &'db dyn HirDatabase,
-    id: impl hir_def::HasModule + Into<ExpressionStoreOwnerId> + Copy,
-) -> ParamEnvAndCrate<'db> {
     ParamEnvAndCrate { param_env: db.trait_environment(id.into()), krate: id.krate(db) }
 }
 
-fn empty_param_env<'db>(krate: base_db::Crate) -> ParamEnvAndCrate<'db> {
-    ParamEnvAndCrate { param_env: ParamEnv::empty(), krate }
-}
-
 // FIXME: We probably don't want to expose this.
 pub trait MacroCallIdExt {
-    fn loc(self, db: &dyn HirDatabase) -> hir_expand::MacroCallLoc;
+    fn loc(self, db: &dyn HirDatabase) -> &hir_expand::MacroCallLoc;
 }
 impl MacroCallIdExt for span::MacroCallId {
     #[inline]
-    fn loc(self, db: &dyn HirDatabase) -> hir_expand::MacroCallLoc {
+    fn loc(self, db: &dyn HirDatabase) -> &hir_expand::MacroCallLoc {
         hir_expand::MacroCallId::from(self).loc(db)
     }
 }
 
-pub use hir_ty::next_solver;
-pub use hir_ty::setup_tracing;
+// Like https://github.com/rust-lang/rust/blob/7c3c88f42ad444f4688b865591d84660be4ece2f/compiler/rustc_middle/src/ty/util.rs#L254-L310
+pub fn struct_tail_raw<'db>(
+    db: &'db dyn HirDatabase,
+    interner: DbInterner<'db>,
+    mut ty: Ty<'db>,
+    mut normalize: impl FnMut(Ty<'db>) -> Ty<'db>,
+) -> Ty<'db> {
+    let recursion_limit = 16;
+    for iteration in 0.. {
+        if iteration >= recursion_limit {
+            return Ty::new_error(interner, ErrorGuaranteed);
+        }
+        match ty.kind() {
+            TyKind::Adt(def, args) => {
+                let AdtId::StructId(def_id) = def.def_id() else { break };
+                let last_field = db.field_types(def_id.into()).iter().next_back();
+                match last_field {
+                    Some((_, field)) => {
+                        ty = normalize(field.ty().instantiate(interner, args).skip_norm_wip())
+                    }
+                    None => break,
+                }
+            }
+            TyKind::Tuple(tys) if let Some((&last_ty, _)) = tys.split_last() => {
+                ty = last_ty;
+            }
+            TyKind::Tuple(_) => break,
+            TyKind::Pat(inner, _) => {
+                ty = inner;
+            }
+            _ => {
+                break;
+            }
+        }
+    }
+    ty
+}
diff --git a/src/tools/rust-analyzer/crates/hir/src/semantics.rs b/src/tools/rust-analyzer/crates/hir/src/semantics.rs
index a1bbe47..dd4cc7b 100644
--- a/src/tools/rust-analyzer/crates/hir/src/semantics.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/semantics.rs
@@ -32,7 +32,7 @@
     name::AsName,
 };
 use hir_ty::{
-    InferBodyId, InferenceResult,
+    InferBodyId, InferenceResult, LoweringMode,
     db::AnonConstId,
     diagnostics::unsafe_operations,
     infer_query_with_inspect,
@@ -1088,7 +1088,12 @@ pub fn descend_token_into_include_expansion(
     /// That is, we strictly check if it lies inside the input of a macro call.
     pub fn is_inside_macro_call(&self, token @ InFile { value, .. }: InFile<&SyntaxToken>) -> bool {
         value.parent_ancestors().any(|ancestor| {
-            if ast::MacroCall::can_cast(ancestor.kind()) {
+            if let Some(macro_call) = ast::MacroCall::cast(ancestor.clone())
+                // If this is the *path* of a macro, it's not inside the call.
+                && macro_call.path().is_none_or(|path| {
+                    !path.syntax().text_range().contains_range(value.text_range())
+                })
+            {
                 return true;
             }
 
@@ -1323,7 +1328,7 @@ fn descend_into_macros_impl<T>(
                             .map(|(call_id, item)| {
                                 let item_range = item.syntax().text_range();
                                 let loc = call_id.loc(db);
-                                let text_range = match loc.kind {
+                                let text_range = match &loc.kind {
                                     hir_expand::MacroCallKind::Attr {
                                         censored_attr_ids: attr_ids,
                                         ..
@@ -1740,11 +1745,7 @@ pub fn expr_adjustments(&self, expr: &ast::Expr) -> Option<Vec<Adjustment<'db>>>
         analyzer.expr_adjustments(expr).map(|it| {
             it.iter()
                 .map(|adjust| {
-                    let target = Type::new_with_resolver(
-                        self.db,
-                        &analyzer.resolver,
-                        adjust.target.as_ref(),
-                    );
+                    let target = analyzer.ty(adjust.target.as_ref());
                     let kind = match adjust.kind {
                         hir_ty::Adjust::NeverToAny => Adjust::NeverToAny,
                         hir_ty::Adjust::Deref(Some(hir_ty::OverloadedDeref(m))) => {
@@ -1771,6 +1772,10 @@ pub fn expr_adjustments(&self, expr: &ast::Expr) -> Option<Vec<Adjustment<'db>>>
         })
     }
 
+    pub fn expr_is_diverging(&self, expr: &ast::Expr) -> bool {
+        (|| self.analyze(expr.syntax())?.expr_is_diverging(self.db, expr))().unwrap_or(false)
+    }
+
     pub fn type_of_expr(&self, expr: &ast::Expr) -> Option<TypeInfo<'db>> {
         self.analyze(expr.syntax())?
             .type_of_expr(self.db, expr)
@@ -1835,10 +1840,10 @@ pub fn resolve_trait_impl_method(
         let substs =
             hir_ty::next_solver::GenericArgs::for_item(interner, trait_.id.into(), |_, id, _| {
                 assert!(matches!(id, hir_def::GenericParamId::TypeParamId(_)), "expected a type");
-                subst.next().expect("too few subst").ty.into()
+                subst.next().expect("too few subst").ty.skip_binder().into()
             });
         assert!(subst.next().is_none(), "too many subst");
-        Some(match self.db.lookup_impl_method(env.env, func, substs).0 {
+        Some(match self.db.lookup_impl_method(env.param_env(self.db), func, substs).0 {
             Either::Left(it) => it.into(),
             Either::Right((impl_, method)) => {
                 Function { id: AnyFunctionId::BuiltinDeriveImplMethod { method, impl_ } }
@@ -1946,6 +1951,15 @@ pub fn resolve_record_pat_field_with_subst(
         self.analyze(field.syntax())?.resolve_record_pat_field(self.db, field)
     }
 
+    // FIXME: Remove this from https://github.com/rust-lang/rust-analyzer/pull/22449#discussion_r3299763452
+    pub fn resolve_tuple_struct_pat_fields(
+        &self,
+        tuple_struct_pat: &ast::TupleStructPat,
+    ) -> Option<Vec<(Field, Type<'db>)>> {
+        self.analyze(tuple_struct_pat.syntax())?
+            .resolve_tuple_struct_pat_fields(self.db, tuple_struct_pat)
+    }
+
     // FIXME: Replace this with `resolve_macro_call2`
     pub fn resolve_macro_call(&self, macro_call: &ast::MacroCall) -> Option<Macro> {
         let macro_call = self.find_file(macro_call.syntax()).with_value(macro_call);
@@ -2436,7 +2450,7 @@ pub fn impl_generated_from_derive(&self, impl_: Impl) -> Option<Adt> {
             AnyImplId::ImplId(id) => id,
             AnyImplId::BuiltinDeriveImplId(id) => return Some(id.loc(self.db).adt.into()),
         };
-        let source = hir_def::src::HasSource::ast_ptr(&id.loc(self.db), self.db);
+        let source = hir_def::src::HasSource::ast_ptr(id.loc(self.db), self.db);
         let mut file_id = source.file_id;
         let adt_ast_id = loop {
             let macro_call = file_id.macro_file()?;
@@ -2550,6 +2564,20 @@ pub fn locals_used(
         Some(locals)
     }
 
+    pub fn evaluate_where_clause_at(
+        &self,
+        node: &SyntaxNode,
+        offset: TextSize,
+        where_clause: ast::WhereClause,
+    ) -> crate::PredicateEvaluationResult {
+        let Some(analyzer) = self.analyze_with_offset_no_infer(node, offset) else {
+            return crate::PredicateEvaluationResult::unsupported(
+                "predicate evaluation is only supported in files that belong to a crate",
+            );
+        };
+        analyzer.evaluate_where_clause(self.db, where_clause)
+    }
+
     pub fn get_failed_obligations(&self, token: SyntaxToken) -> Option<String> {
         let node = token.parent()?;
         let node = self.find_file(&node);
@@ -2573,6 +2601,7 @@ pub fn get_failed_obligations(&self, token: SyntaxToken) -> Option<String> {
                             RESULT.with(|ctx| ctx.borrow_mut().push(data));
                         }
                     }),
+                    LoweringMode::Ide,
                 );
                 let data: Vec<ProofTreeData> =
                     RESULT.with(|data| data.borrow_mut().drain(..).collect());
diff --git a/src/tools/rust-analyzer/crates/hir/src/semantics/child_by_source.rs b/src/tools/rust-analyzer/crates/hir/src/semantics/child_by_source.rs
index babeb35..97c5a45 100644
--- a/src/tools/rust-analyzer/crates/hir/src/semantics/child_by_source.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/semantics/child_by_source.rs
@@ -202,7 +202,7 @@ fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap, file_id: Hi
 
         let ast_id_map = db.ast_id_map(loc.id.file_id);
 
-        self.enum_variants(db).variants.iter().for_each(|&(variant, _, _)| {
+        self.enum_variants(db).variants.values().for_each(|&(variant, _)| {
             res[keys::ENUM_VARIANT].insert(ast_id_map.get(variant.lookup(db).id.value), variant);
         });
         let (_, source_map) = EnumSignature::with_source_map(db, *self);
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 0618262..687f130 100644
--- a/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs
@@ -13,10 +13,10 @@
 use either::Either;
 use hir_def::{
     AdtId, AssocItemId, CallableDefId, ConstId, DefWithBodyId, ExpressionStoreOwnerId, FieldId,
-    FunctionId, GenericDefId, LocalFieldId, ModuleDefId, StructId, VariantId,
+    FunctionId, GenericDefId, HasModule, LocalFieldId, ModuleDefId, StructId, VariantId,
     expr_store::{
         Body, BodySourceMap, ExpressionStore, ExpressionStoreSourceMap, HygieneId,
-        lower::ExprCollector,
+        lower::{ExprCollector, lower_generic_params},
         path::Path,
         scope::{ExprScopes, ScopeId},
     },
@@ -41,10 +41,10 @@
     lang_items::lang_items_for_bin_op,
     method_resolution::{self, CandidateId},
     next_solver::{
-        AliasTy, DbInterner, DefaultAny, ErrorGuaranteed, GenericArgs, ParamEnv, Region, Ty,
-        TyKind, TypingMode, infer::DbInternerInferExt,
+        AliasTy, DbInterner, DefaultAny, EarlyBinder, ErrorGuaranteed, GenericArgs, ParamEnv,
+        Region, Ty, TyKind, TypingMode, infer::DbInternerInferExt,
     },
-    traits::structurally_normalize_ty,
+    traits::{WherePredicateEvaluation, structurally_normalize_ty, where_predicate_must_hold},
 };
 use intern::sym;
 use itertools::Itertools;
@@ -63,7 +63,8 @@
 use crate::{
     Adt, AnyFunctionId, AssocItem, BindingMode, BuiltinAttr, BuiltinType, Callable, Const,
     DeriveHelper, EnumVariant, Field, Function, GenericSubstitution, Local, Macro, ModuleDef,
-    SemanticsImpl, Static, Struct, ToolModule, Trait, TupleField, Type, TypeAlias,
+    PredicateEvaluationResult, SemanticsImpl, Static, Struct, ToolModule, Trait, TupleField, Type,
+    TypeAlias, TypeOwnerId,
     db::HirDatabase,
     semantics::{PathResolution, PathResolutionPerNs},
 };
@@ -75,6 +76,7 @@ pub(crate) struct SourceAnalyzer<'db> {
     pub(crate) file_id: HirFileId,
     pub(crate) resolver: Resolver<'db>,
     pub(crate) body_or_sig: Option<BodyOrSig<'db>>,
+    pub(crate) type_owner: TypeOwnerId,
     pub(crate) infer_body: Option<InferBodyId>,
 }
 
@@ -148,6 +150,7 @@ pub(crate) fn new_for_body_(
             resolver,
             body_or_sig: Some(BodyOrSig::Body { def, body, source_map, infer }),
             file_id,
+            type_owner: def.generic_def(db).into(),
             infer_body: Some(def.into()),
         }
     }
@@ -212,6 +215,7 @@ pub(crate) fn new_generic_def_(
             resolver,
             body_or_sig: Some(BodyOrSig::Sig { def, store, source_map, generics, infer }),
             file_id,
+            type_owner: def.into(),
             infer_body,
         }
     }
@@ -261,6 +265,7 @@ pub(crate) fn new_variant_body(
                 infer,
             }),
             file_id,
+            type_owner: GenericDefId::from(def.adt_id(db)).into(),
             infer_body,
         }
     }
@@ -269,7 +274,16 @@ pub(crate) fn new_for_resolver(
         resolver: Resolver<'db>,
         node: InFile<&SyntaxNode>,
     ) -> SourceAnalyzer<'db> {
-        SourceAnalyzer { resolver, body_or_sig: None, file_id: node.file_id, infer_body: None }
+        SourceAnalyzer {
+            type_owner: resolver
+                .generic_def()
+                .map(Into::into)
+                .unwrap_or_else(|| TypeOwnerId::NoParams(resolver.krate())),
+            resolver,
+            body_or_sig: None,
+            file_id: node.file_id,
+            infer_body: None,
+        }
     }
 
     fn owner(&self) -> Option<ExpressionStoreOwnerId> {
@@ -288,6 +302,10 @@ fn infer(&self) -> Option<&InferenceResult> {
         })
     }
 
+    pub(crate) fn ty(&self, ty: Ty<'db>) -> Type<'db> {
+        Type { owner: self.type_owner, ty: EarlyBinder::bind(ty) }
+    }
+
     pub(crate) fn def(
         &self,
     ) -> Option<(
@@ -330,13 +348,67 @@ fn param_and<'a>(&self, param_env: ParamEnv<'a>) -> ParamEnvAndCrate<'a> {
     }
 
     fn trait_environment(&self, db: &'db dyn HirDatabase) -> ParamEnvAndCrate<'db> {
-        self.param_and(self.body_or_sig.as_ref().map_or_else(ParamEnv::empty, |body_or_sig| {
-            match *body_or_sig {
-                BodyOrSig::Body { def, .. } => db.trait_environment(def.into()),
-                BodyOrSig::VariantFields { def, .. } => db.trait_environment(def.into()),
-                BodyOrSig::Sig { def, .. } => db.trait_environment(def.into()),
+        self.param_and(self.body_or_sig.as_ref().map_or_else(
+            || ParamEnv::empty(DbInterner::new_no_crate(db)),
+            |body_or_sig| {
+                let def = match *body_or_sig {
+                    BodyOrSig::Body { def, .. } => def.generic_def(db),
+                    BodyOrSig::VariantFields { def, .. } => match def {
+                        VariantId::EnumVariantId(def) => def.loc(db).parent.into(),
+                        VariantId::StructId(def) => def.into(),
+                        VariantId::UnionId(def) => def.into(),
+                    },
+                    BodyOrSig::Sig { def, .. } => def,
+                };
+                db.trait_environment(def)
+            },
+        ))
+    }
+
+    pub(crate) fn evaluate_where_clause(
+        &self,
+        db: &'db dyn HirDatabase,
+        where_clause: ast::WhereClause,
+    ) -> PredicateEvaluationResult {
+        let Some(owner) = self.owner() else {
+            // FIXME
+            return PredicateEvaluationResult::unsupported(
+                "predicate evaluation is only supported inside an item",
+            );
+        };
+        let generic_def = owner.generic_def(db);
+        let module = generic_def.module(db);
+        let (store, params, _) =
+            lower_generic_params(db, module, generic_def, self.file_id, None, Some(where_clause));
+        let predicates = params.where_predicates();
+        if predicates.is_empty() {
+            return PredicateEvaluationResult::holds("predicate does not impose any obligations");
+        }
+
+        let env = self.trait_environment(db);
+        for predicate in predicates {
+            match where_predicate_must_hold(
+                db,
+                &self.resolver,
+                &store,
+                owner,
+                generic_def,
+                env,
+                predicate,
+            ) {
+                WherePredicateEvaluation::Holds | WherePredicateEvaluation::NoObligations => {}
+                WherePredicateEvaluation::HasErrors => {
+                    return PredicateEvaluationResult::invalid(
+                        "predicate contains unresolved names or invalid type syntax",
+                    );
+                }
+                WherePredicateEvaluation::NotProven => {
+                    return PredicateEvaluationResult::not_proven("predicate is not known to hold");
+                }
             }
-        }))
+        }
+
+        PredicateEvaluationResult::holds("predicate holds")
     }
 
     pub(crate) fn expr_id(&self, expr: ast::Expr) -> Option<ExprOrPatId> {
@@ -418,12 +490,41 @@ fn next_region_var(&mut self, _span: hir_ty::Span) -> Region<'db> {
             }
         }
 
-        Some(Type::new_with_resolver(db, &self.resolver, ty))
+        Some(self.ty(ty))
+    }
+
+    pub(crate) fn expr_is_diverging(
+        &self,
+        _db: &'db dyn HirDatabase,
+        expr: &ast::Expr,
+    ) -> Option<bool> {
+        let expr_id = self.expr_id(expr.clone())?;
+        let store = self.store()?;
+        let infer = self.infer()?;
+        Some(self.expr_id_is_diverging(store, infer, expr_id))
+    }
+
+    fn expr_id_is_diverging(
+        &self,
+        store: &ExpressionStore,
+        infer: &InferenceResult,
+        expr_id: ExprOrPatId,
+    ) -> bool {
+        // FIXME: This is an approximation, perhaps we need to store a set of diverging exprs in inference?
+        if infer.type_of_expr_or_pat(expr_id).is_some_and(|ty| ty.is_never()) {
+            true
+        } else if let ExprOrPatId::ExprId(expr_id) = expr_id
+            && let Expr::Block { tail: Some(tail), .. } = store[expr_id]
+        {
+            self.expr_id_is_diverging(store, infer, tail.into())
+        } else {
+            false
+        }
     }
 
     pub(crate) fn type_of_expr(
         &self,
-        db: &'db dyn HirDatabase,
+        _db: &'db dyn HirDatabase,
         expr: &ast::Expr,
     ) -> Option<(Type<'db>, Option<Type<'db>>)> {
         let expr_id = self.expr_id(expr.clone())?;
@@ -433,13 +534,13 @@ pub(crate) fn type_of_expr(
             .and_then(|expr_id| infer.expr_adjustment(expr_id))
             .and_then(|adjusts| adjusts.last().map(|adjust| adjust.target.as_ref()));
         let ty = infer.expr_or_pat_ty(expr_id);
-        let mk_ty = |ty: Ty<'db>| Type::new_with_resolver(db, &self.resolver, ty);
+        let mk_ty = |ty: Ty<'db>| self.ty(ty);
         Some((mk_ty(ty), coerced.map(mk_ty)))
     }
 
     pub(crate) fn type_of_pat(
         &self,
-        db: &'db dyn HirDatabase,
+        _db: &'db dyn HirDatabase,
         pat: &ast::Pat,
     ) -> Option<(Type<'db>, Option<Type<'db>>)> {
         let expr_or_pat_id = self.pat_id(pat)?;
@@ -456,25 +557,25 @@ pub(crate) fn type_of_pat(
         };
 
         let ty = infer.expr_or_pat_ty(expr_or_pat_id);
-        let mk_ty = |ty: Ty<'db>| Type::new_with_resolver(db, &self.resolver, ty);
+        let mk_ty = |ty: Ty<'db>| self.ty(ty);
         Some((mk_ty(ty), coerced.map(mk_ty)))
     }
 
     pub(crate) fn type_of_binding_in_pat(
         &self,
-        db: &'db dyn HirDatabase,
+        _db: &'db dyn HirDatabase,
         pat: &ast::IdentPat,
     ) -> Option<Type<'db>> {
         let binding_id = self.binding_id_of_pat(pat)?;
         let infer = self.infer()?;
         let ty = infer.binding_ty(binding_id);
-        let mk_ty = |ty: Ty<'db>| Type::new_with_resolver(db, &self.resolver, ty);
+        let mk_ty = |ty: Ty<'db>| self.ty(ty);
         Some(mk_ty(ty))
     }
 
     pub(crate) fn type_of_self(
         &self,
-        db: &'db dyn HirDatabase,
+        _db: &'db dyn HirDatabase,
         _param: &ast::SelfParam,
     ) -> Option<Type<'db>> {
         let binding = match self.body_or_sig.as_ref()? {
@@ -482,7 +583,7 @@ pub(crate) fn type_of_self(
             BodyOrSig::Body { body, .. } => body.self_param()?,
         };
         let ty = self.infer()?.binding_ty(binding);
-        Some(Type::new_with_resolver(db, &self.resolver, ty))
+        Some(self.ty(ty))
     }
 
     pub(crate) fn binding_mode_of_pat(
@@ -504,7 +605,7 @@ pub(crate) fn binding_mode_of_pat(
     }
     pub(crate) fn pattern_adjustments(
         &self,
-        db: &'db dyn HirDatabase,
+        _db: &'db dyn HirDatabase,
         pat: &ast::Pat,
     ) -> Option<SmallVec<[Type<'db>; 1]>> {
         let pat_id = self.pat_id(pat)?;
@@ -513,7 +614,7 @@ pub(crate) fn pattern_adjustments(
             infer
                 .pat_adjustment(pat_id.as_pat()?)?
                 .iter()
-                .map(|adjust| Type::new_with_resolver(db, &self.resolver, adjust.source.as_ref()))
+                .map(|adjust| self.ty(adjust.source.as_ref()))
                 .collect(),
         )
     }
@@ -527,7 +628,7 @@ pub(crate) fn resolve_method_call_as_callable(
         let (func, args) = self.infer()?.method_resolution(expr_id)?;
         let interner = DbInterner::new_no_crate(db);
         let ty = db.value_ty(func.into())?.instantiate(interner, args).skip_norm_wip();
-        let ty = Type::new_with_resolver(db, &self.resolver, ty);
+        let ty = self.ty(ty);
         let mut res = ty.as_callable(db)?;
         res.is_bound_method = true;
         Some(res)
@@ -557,7 +658,7 @@ pub(crate) fn resolve_method_call_fallback(
                     self.resolve_impl_method_or_trait_def_with_subst(db, f_in_trait, substs);
                 Some((
                     Either::Left(fn_),
-                    GenericSubstitution::new_from_fn(fn_, subst, self.trait_environment(db)),
+                    GenericSubstitution::new_from_fn(fn_, subst, self.type_owner),
                 ))
             }
             None => {
@@ -592,12 +693,12 @@ fn field_subst(
         &self,
         field_expr: ExprId,
         infer: &InferenceResult,
-        db: &'db dyn HirDatabase,
+        _db: &'db dyn HirDatabase,
     ) -> Option<GenericSubstitution<'db>> {
         let body = self.store()?;
         if let Expr::Field { expr: object_expr, name: _ } = body[field_expr] {
             let (adt, subst) = infer.type_of_expr_with_adjust(object_expr)?.as_adt()?;
-            return Some(GenericSubstitution::new(adt.into(), subst, self.trait_environment(db)));
+            return Some(GenericSubstitution::new(adt.into(), subst, self.type_owner));
         }
         None
     }
@@ -628,10 +729,7 @@ pub(crate) fn resolve_field_fallback(
             },
             None => inference_result.method_resolution(expr_id).map(|(f, substs)| {
                 let (f, subst) = self.resolve_impl_method_or_trait_def_with_subst(db, f, substs);
-                (
-                    Either::Right(f),
-                    GenericSubstitution::new_from_fn(f, subst, self.trait_environment(db)),
-                )
+                (Either::Right(f), GenericSubstitution::new_from_fn(f, subst, self.type_owner))
             }),
         }
     }
@@ -721,7 +819,7 @@ pub(crate) fn resolve_await_to_poll(
             .map(Trait::from);
 
         if let Some(into_future_trait) = into_future_trait {
-            let type_ = Type::new_with_resolver(db, &self.resolver, ty);
+            let type_ = self.ty(ty);
             if type_.impls_trait(db, into_future_trait, &[]) {
                 let items = into_future_trait.items(db);
                 let into_future_type = items.into_iter().find_map(|item| match item {
@@ -733,7 +831,7 @@ pub(crate) fn resolve_await_to_poll(
                     _ => None,
                 })?;
                 let future_trait = type_.normalize_trait_assoc_type(db, &[], into_future_type)?;
-                ty = future_trait.ty;
+                ty = future_trait.ty.skip_binder();
             }
         }
 
@@ -876,14 +974,14 @@ pub(crate) fn resolve_record_field(
         let variant_data = variant.fields(db);
         let field = FieldId { parent: variant, local_id: variant_data.field(&local_name)? };
         let field_ty = (*db.field_types(variant).get(field.local_id)?)
-            .get()
+            .ty()
             .instantiate(interner, subst)
             .skip_norm_wip();
         Some((
             field.into(),
             local,
-            Type::new_with_resolver(db, &self.resolver, field_ty),
-            GenericSubstitution::new(adt.into(), subst, self.trait_environment(db)),
+            self.ty(field_ty),
+            GenericSubstitution::new(adt.into(), subst, self.type_owner),
         ))
     }
 
@@ -901,16 +999,38 @@ pub(crate) fn resolve_record_pat_field(
         let field = FieldId { parent: variant, local_id: variant_data.field(&field_name)? };
         let (adt, subst) = self.infer()?.pat_ty(pat_id.as_pat()?).as_adt()?;
         let field_ty = (*db.field_types(variant).get(field.local_id)?)
-            .get()
+            .ty()
             .instantiate(interner, subst)
             .skip_norm_wip();
         Some((
             field.into(),
-            Type::new_with_resolver(db, &self.resolver, field_ty),
-            GenericSubstitution::new(adt.into(), subst, self.trait_environment(db)),
+            self.ty(field_ty),
+            GenericSubstitution::new(adt.into(), subst, self.type_owner),
         ))
     }
 
+    pub(crate) fn resolve_tuple_struct_pat_fields(
+        &self,
+        db: &'db dyn HirDatabase,
+        tuple_struct_pat: &ast::TupleStructPat,
+    ) -> Option<Vec<(Field, Type<'db>)>> {
+        let interner = DbInterner::new_no_crate(db);
+        let pat_id = self.pat_id(&tuple_struct_pat.clone().into())?;
+        let variant_id = self.infer()?.variant_resolution_for_pat(pat_id.as_pat()?)?;
+        let (_adt, substs) = self.infer()?.pat_ty(pat_id.as_pat()?).as_adt()?;
+
+        Some(
+            db.field_types(variant_id)
+                .iter()
+                .map(|(local_id, field)| {
+                    let def = Field { parent: variant_id.into(), id: local_id };
+                    let ty = field.ty().instantiate(interner, substs).skip_norm_wip();
+                    (def, self.ty(ty))
+                })
+                .collect(),
+        )
+    }
+
     pub(crate) fn resolve_bind_pat_to_const(
         &self,
         db: &'db dyn HirDatabase,
@@ -962,15 +1082,15 @@ pub(crate) fn resolve_offset_of_field(
         let container = offset_of_expr.ty()?;
         let container = self.type_of_type(db, &container)?;
 
-        let trait_env = container.env;
+        let env = self.trait_environment(db);
 
-        let interner = DbInterner::new_with(db, trait_env.krate);
+        let interner = DbInterner::new_with(db, env.krate);
         let infcx = interner.infer_ctxt().build(TypingMode::PostAnalysis);
 
-        let mut container = Either::Right(container.ty);
+        let mut container = Either::Right(container.ty.skip_binder());
         for field_name in offset_of_expr.fields() {
             if let Either::Right(container) = &mut container {
-                *container = structurally_normalize_ty(&infcx, *container, trait_env.param_env);
+                *container = structurally_normalize_ty(&infcx, *container, env.param_env);
             }
             let handle_variants =
                 |variant: VariantId, subst: GenericArgs<'db>, container: &mut _| {
@@ -978,7 +1098,7 @@ pub(crate) fn resolve_offset_of_field(
                     let field = fields.field(&field_name.as_name())?;
                     let field_types = db.field_types(variant);
                     *container = Either::Right(
-                        field_types[field].get().instantiate(interner, subst).skip_norm_wip(),
+                        field_types[field].ty().instantiate(interner, subst).skip_norm_wip(),
                     );
                     let generic_def = match variant {
                         VariantId::EnumVariantId(it) => it.loc(db).parent.into(),
@@ -1017,7 +1137,10 @@ pub(crate) fn resolve_offset_of_field(
                 };
 
             if field_name.syntax().text_range() == name_ref.syntax().text_range() {
-                return Some((field_def, GenericSubstitution::new(generic_def, subst, trait_env)));
+                return Some((
+                    field_def,
+                    GenericSubstitution::new(generic_def, subst, self.type_owner),
+                ));
             }
         }
         never!("the `NameRef` is a child of the `OffsetOfExpr`, we should've visited it");
@@ -1045,7 +1168,7 @@ pub(crate) fn resolve_path(
                                     let subst = GenericSubstitution::new(
                                         f_in_trait.into(),
                                         subs,
-                                        self.trait_environment(db),
+                                        self.type_owner,
                                     );
                                     (AssocItem::Function(f_in_trait.into()), Some(subst))
                                 }
@@ -1058,14 +1181,14 @@ pub(crate) fn resolve_path(
                                         let subst = GenericSubstitution::new_from_fn(
                                             fn_,
                                             subst,
-                                            self.trait_environment(db),
+                                            self.type_owner,
                                         );
                                         (AssocItem::Function(fn_), subst)
                                     } else {
                                         let subst = GenericSubstitution::new(
                                             f_in_trait.into(),
                                             subs,
-                                            self.trait_environment(db),
+                                            self.type_owner,
                                         );
                                         (AssocItem::Function(f_in_trait.into()), Some(subst))
                                     }
@@ -1075,11 +1198,8 @@ pub(crate) fn resolve_path(
                         CandidateId::ConstId(const_id) => {
                             let (konst, subst) =
                                 self.resolve_impl_const_or_trait_def_with_subst(db, const_id, subs);
-                            let subst = GenericSubstitution::new(
-                                konst.into(),
-                                subst,
-                                self.trait_environment(db),
-                            );
+                            let subst =
+                                GenericSubstitution::new(konst.into(), subst, self.type_owner);
                             (AssocItem::Const(konst.into()), Some(subst))
                         }
                     };
@@ -1103,20 +1223,13 @@ pub(crate) fn resolve_path(
                         CandidateId::ConstId(const_id) => {
                             let (konst, subst) =
                                 self.resolve_impl_const_or_trait_def_with_subst(db, const_id, subs);
-                            let subst = GenericSubstitution::new(
-                                konst.into(),
-                                subst,
-                                self.trait_environment(db),
-                            );
+                            let subst =
+                                GenericSubstitution::new(konst.into(), subst, self.type_owner);
                             (AssocItemId::from(konst), subst)
                         }
                         CandidateId::FunctionId(function_id) => (
                             function_id.into(),
-                            GenericSubstitution::new(
-                                function_id.into(),
-                                subs,
-                                self.trait_environment(db),
-                            ),
+                            GenericSubstitution::new(function_id.into(), subs, self.type_owner),
                         ),
                     };
                     return Some((PathResolution::Def(AssocItem::from(assoc).into()), Some(subst)));
@@ -1320,12 +1433,11 @@ pub(crate) fn resolve_path(
                 } else {
                     return None;
                 };
-                let env = self.trait_environment(db);
                 let (subst, expected_resolution) = match ty.kind() {
                     TyKind::Adt(adt_def, subst) => {
                         let adt_id = adt_def.def_id();
                         (
-                            GenericSubstitution::new(adt_id.into(), subst, env),
+                            GenericSubstitution::new(adt_id.into(), subst, self.type_owner),
                             PathResolution::Def(ModuleDef::Adt(adt_id.into())),
                         )
                     }
@@ -1336,7 +1448,7 @@ pub(crate) fn resolve_path(
                     }) => {
                         let assoc_id = def_id.0;
                         (
-                            GenericSubstitution::new(assoc_id.into(), args, env),
+                            GenericSubstitution::new(assoc_id.into(), args, self.type_owner),
                             PathResolution::Def(ModuleDef::TypeAlias(assoc_id.into())),
                         )
                     }
@@ -1347,7 +1459,7 @@ pub(crate) fn resolve_path(
                             CallableDefId::EnumVariantId(_) => return None,
                         };
                         (
-                            GenericSubstitution::new(generic_def_id, subst, env),
+                            GenericSubstitution::new(generic_def_id, subst, self.type_owner),
                             PathResolution::Def(ModuleDefId::from(fn_id.0).into()),
                         )
                     }
@@ -1465,8 +1577,8 @@ fn missing_fields(
             .into_iter()
             .map(|local_id| {
                 let field = FieldId { parent: variant, local_id };
-                let ty = field_types[local_id].get().instantiate(interner, substs).skip_norm_wip();
-                (field.into(), Type::new_with_resolver_inner(db, &self.resolver, ty))
+                let ty = field_types[local_id].ty().instantiate(interner, substs).skip_norm_wip();
+                (field.into(), self.ty(ty))
             })
             .collect()
     }
@@ -1589,7 +1701,7 @@ fn resolve_impl_method_or_trait_def_with_subst(
         func: FunctionId,
         substs: GenericArgs<'db>,
     ) -> (Function, GenericArgs<'db>) {
-        let owner = match self.resolver.expression_store_owner() {
+        let owner = match self.resolver.generic_def() {
             Some(it) => it,
             None => return (func.into(), substs),
         };
@@ -1609,7 +1721,7 @@ fn resolve_impl_const_or_trait_def_with_subst(
         const_id: ConstId,
         subs: GenericArgs<'db>,
     ) -> (ConstId, GenericArgs<'db>) {
-        let owner = match self.resolver.expression_store_owner() {
+        let owner = match self.resolver.generic_def() {
             Some(it) => it,
             None => return (const_id, subs),
         };
diff --git a/src/tools/rust-analyzer/crates/hir/src/symbols.rs b/src/tools/rust-analyzer/crates/hir/src/symbols.rs
index ff56544..c4040c1 100644
--- a/src/tools/rust-analyzer/crates/hir/src/symbols.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/symbols.rs
@@ -190,8 +190,8 @@ fn collect_from_module(&mut self, module_id: ModuleId) {
                     let enum_name = Symbol::intern(EnumSignature::of(this.db, id).name.as_str());
                     this.with_container_name(Some(enum_name), |this| {
                         let variants = id.enum_variants(this.db);
-                        for (variant_id, variant_name, _) in &variants.variants {
-                            this.push_decl(*variant_id, variant_name, true, None);
+                        for (variant_name, (variant_id, _)) in &variants.variants {
+                            this.push_decl(*variant_id, variant_name, false, None);
                         }
                     });
                 }
@@ -401,7 +401,7 @@ fn collect_from_body(&mut self, body_id: impl Into<DefWithBodyId>, name: Option<
     fn collect_from_impl(&mut self, impl_id: ImplId) {
         let impl_data = ImplSignature::of(self.db, impl_id);
         let impl_name = Some(
-            hir_display_with_store(impl_data.self_ty, &impl_data.store)
+            hir_display_with_store(impl_data.self_ty, impl_id.into(), &impl_data.store)
                 .display(
                     self.db,
                     crate::Impl::from(impl_id).krate(self.db).to_display_target(self.db),
diff --git a/src/tools/rust-analyzer/crates/hir/src/term_search.rs b/src/tools/rust-analyzer/crates/hir/src/term_search.rs
index af2371d..1cc6766 100644
--- a/src/tools/rust-analyzer/crates/hir/src/term_search.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/term_search.rs
@@ -145,7 +145,7 @@ fn find_autoref(&mut self, db: &'db dyn HirDatabase, ty: &Type<'db>) -> Option<V
                 self.data
                     .iter()
                     .find(|(t, _)| {
-                        t.add_reference(Mutability::Shared).could_unify_with_deeply(db, ty)
+                        t.add_reference(db, Mutability::Shared).could_unify_with_deeply(db, ty)
                     })
                     .map(|(t, it)| {
                         it.exprs(t)
diff --git a/src/tools/rust-analyzer/crates/hir/src/term_search/expr.rs b/src/tools/rust-analyzer/crates/hir/src/term_search/expr.rs
index e3d0121..a824c8b 100644
--- a/src/tools/rust-analyzer/crates/hir/src/term_search/expr.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/term_search/expr.rs
@@ -310,21 +310,18 @@ pub fn ty(&self, db: &'db dyn HirDatabase) -> Type<'db> {
             Expr::Local(it) => it.ty(db),
             Expr::ConstParam(it) => it.ty(db),
             Expr::FamousType { ty, .. } => ty.clone(),
-            Expr::Function { func, generics, .. } => {
-                func.ret_type_with_args(db, generics.iter().cloned())
-            }
-            Expr::Method { func, generics, target, .. } => func.ret_type_with_args(
-                db,
-                target.ty(db).type_arguments().chain(generics.iter().cloned()),
-            ),
+            Expr::Function { func, generics, .. } => func.ret_type(db).instantiate(generics),
+            Expr::Method { func, generics, target, .. } => func
+                .ret_type(db)
+                .instantiate(target.ty(db).type_arguments().chain(generics.iter().cloned())),
             Expr::Variant { variant, generics, .. } => {
-                Adt::from(variant.parent_enum(db)).ty_with_args(db, generics.iter().cloned())
+                Adt::from(variant.parent_enum(db)).ty(db).instantiate(generics)
             }
             Expr::Struct { strukt, generics, .. } => {
-                Adt::from(*strukt).ty_with_args(db, generics.iter().cloned())
+                Adt::from(*strukt).ty(db).instantiate(generics)
             }
             Expr::Tuple { ty, .. } => ty.clone(),
-            Expr::Field { expr, field } => field.ty_with_args(db, expr.ty(db).type_arguments()),
+            Expr::Field { expr, field } => field.ty(db).instantiate(expr.ty(db).type_arguments()),
             Expr::Reference(it) => it.ty(db),
             Expr::Many(ty) => ty.clone(),
         }
diff --git a/src/tools/rust-analyzer/crates/hir/src/term_search/tactics.rs b/src/tools/rust-analyzer/crates/hir/src/term_search/tactics.rs
index 8700326..2b7f7da 100644
--- a/src/tools/rust-analyzer/crates/hir/src/term_search/tactics.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/term_search/tactics.rs
@@ -10,18 +10,13 @@
 
 use std::iter;
 
-use hir_ty::{
-    db::HirDatabase,
-    mir::BorrowKind,
-    next_solver::{DbInterner, Ty},
-};
+use hir_ty::{db::HirDatabase, mir::BorrowKind};
 use itertools::Itertools;
 use rustc_hash::FxHashSet;
-use rustc_type_ir::inherent::Ty as _;
 
 use crate::{
-    Adt, AssocItem, GenericDef, GenericParam, HasAttrs, HasVisibility, Impl, ModuleDef, ScopeDef,
-    Type, TypeParam, term_search::Expr,
+    Adt, AssocItem, BuiltinType, GenericDef, GenericParam, HasAttrs, HasVisibility, Impl,
+    ModuleDef, ScopeDef, Type, TypeParam, term_search::Expr,
 };
 
 use super::{LookupTable, NewTypesKey, TermSearchCtx};
@@ -87,7 +82,7 @@ pub(super) fn trivial<'a, 'lt, 'db, DB: HirDatabase>(
             return None;
         }
 
-        ty.could_unify_with_deeply(db, &ctx.goal).then_some(expr)
+        ty.instantiate_with_errors().could_unify_with_deeply(db, &ctx.goal).then_some(expr)
     })
 }
 
@@ -137,7 +132,7 @@ pub(super) fn assoc_const<'a, 'lt, 'db, DB: HirDatabase>(
 
             lookup.insert(ty.clone(), std::iter::once(expr.clone()));
 
-            ty.could_unify_with_deeply(db, &ctx.goal).then_some(expr)
+            ty.instantiate_with_errors().could_unify_with_deeply(db, &ctx.goal).then_some(expr)
         })
 }
 
@@ -202,7 +197,9 @@ pub(super) fn data_constructor<'a, 'lt, 'db, DB: HirDatabase>(
                 // Early exit if some param cannot be filled from lookup
                 let param_exprs: Vec<Vec<Expr<'_>>> = fields
                     .into_iter()
-                    .map(|field| lookup.find(db, &field.ty_with_args(db, generics.iter().cloned())))
+                    .map(|field| {
+                        lookup.find(db, &field.ty(db).instantiate(generics.iter().cloned()))
+                    })
                     .collect::<Option<_>>()?;
 
                 // Note that we need special case for 0 param constructors because of multi cartesian
@@ -252,7 +249,7 @@ pub(super) fn data_constructor<'a, 'lt, 'db, DB: HirDatabase>(
                             .fields(db)
                             .into_iter()
                             .map(|field| {
-                                lookup.find(db, &field.ty_with_args(db, generics.iter().cloned()))
+                                lookup.find(db, &field.ty(db).instantiate(generics.iter().cloned()))
                             })
                             .collect::<Option<_>>()?;
 
@@ -285,7 +282,9 @@ pub(super) fn data_constructor<'a, 'lt, 'db, DB: HirDatabase>(
             }
             Adt::Union(_) => None,
         })
-        .filter_map(|(ty, exprs)| ty.could_unify_with_deeply(db, &ctx.goal).then_some(exprs))
+        .filter_map(|(ty, exprs)| {
+            ty.instantiate_with_errors().could_unify_with_deeply(db, &ctx.goal).then_some(exprs)
+        })
         .flatten()
 }
 
@@ -364,7 +363,7 @@ pub(super) fn free_function<'a, 'lt, 'db, DB: HirDatabase>(
                             })
                             .collect::<Option<_>>()?;
 
-                        let ret_ty = it.ret_type_with_args(db, generics.iter().cloned());
+                        let ret_ty = it.ret_type(db).instantiate(generics.iter().cloned());
                         // Filter out private and unsafe functions
                         if !it.is_visible_from(db, module)
                             || it.is_unsafe_to_call(
@@ -381,10 +380,10 @@ pub(super) fn free_function<'a, 'lt, 'db, DB: HirDatabase>(
 
                         // Early exit if some param cannot be filled from lookup
                         let param_exprs: Vec<Vec<Expr<'_>>> = it
-                            .params_without_self_with_args(db, generics.iter().cloned())
+                            .params_without_self(db)
                             .into_iter()
                             .map(|field| {
-                                let ty = field.ty();
+                                let ty = &field.ty().instantiate(&generics);
                                 match ty.is_mutable_reference() {
                                     true => None,
                                     false => lookup.find_autoref(db, ty),
@@ -418,7 +417,9 @@ pub(super) fn free_function<'a, 'lt, 'db, DB: HirDatabase>(
             _ => None,
         })
         .flatten()
-        .filter_map(|(ty, exprs)| ty.could_unify_with_deeply(db, &ctx.goal).then_some(exprs))
+        .filter_map(|(ty, exprs)| {
+            ty.instantiate_with_errors().could_unify_with_deeply(db, &ctx.goal).then_some(exprs)
+        })
         .flatten()
 }
 
@@ -493,7 +494,7 @@ pub(super) fn impl_method<'a, 'lt, 'db, DB: HirDatabase>(
                 return None;
             }
 
-            let ret_ty = it.ret_type_with_args(db, ty.type_arguments());
+            let ret_ty = it.ret_type(db).instantiate(ty.type_arguments());
             // Filter out functions that return references
             if ctx.config.enable_borrowcheck && ret_ty.contains_reference(db) || ret_ty.is_raw_ptr()
             {
@@ -501,12 +502,12 @@ pub(super) fn impl_method<'a, 'lt, 'db, DB: HirDatabase>(
             }
 
             // Ignore functions that do not change the type
-            if ty.could_unify_with_deeply(db, &ret_ty) {
+            if ty.instantiate_with_errors().could_unify_with_deeply(db, &ret_ty) {
                 return None;
             }
 
             let self_ty =
-                it.self_param(db).expect("No self param").ty_with_args(db, ty.type_arguments());
+                it.self_param(db).expect("No self param").ty(db).instantiate(ty.type_arguments());
 
             // Ignore functions that have different self type
             if !self_ty.autoderef(db).any(|s_ty| ty == s_ty) {
@@ -517,9 +518,9 @@ pub(super) fn impl_method<'a, 'lt, 'db, DB: HirDatabase>(
 
             // Early exit if some param cannot be filled from lookup
             let param_exprs: Vec<Vec<Expr<'_>>> = it
-                .params_without_self_with_args(db, ty.type_arguments())
+                .params_without_self(db)
                 .into_iter()
-                .map(|field| lookup.find_autoref(db, field.ty()))
+                .map(|field| lookup.find_autoref(db, &field.ty().instantiate(ty.type_arguments())))
                 .collect::<Option<_>>()?;
 
             let generics: Vec<_> = ty.type_arguments().collect();
@@ -540,7 +541,9 @@ pub(super) fn impl_method<'a, 'lt, 'db, DB: HirDatabase>(
 
             Some((ret_ty, fn_exprs))
         })
-        .filter_map(|(ty, exprs)| ty.could_unify_with_deeply(db, &ctx.goal).then_some(exprs))
+        .filter_map(|(ty, exprs)| {
+            ty.instantiate_with_errors().could_unify_with_deeply(db, &ctx.goal).then_some(exprs)
+        })
         .flatten()
 }
 
@@ -581,7 +584,9 @@ pub(super) fn struct_projection<'a, 'lt, 'db, DB: HirDatabase>(
                 Some((filed_ty, exprs))
             })
         })
-        .filter_map(|(ty, exprs)| ty.could_unify_with_deeply(db, &ctx.goal).then_some(exprs))
+        .filter_map(|(ty, exprs)| {
+            ty.instantiate_with_errors().could_unify_with_deeply(db, &ctx.goal).then_some(exprs)
+        })
         .flatten()
 }
 
@@ -604,20 +609,18 @@ pub(super) fn famous_types<'a, 'lt, 'db, DB: HirDatabase>(
     lookup: &'lt mut LookupTable<'db>,
 ) -> impl Iterator<Item = Expr<'db>> + use<'a, 'db, 'lt, DB> {
     let db = ctx.sema.db;
-    let module = ctx.scope.module();
-    let interner = DbInterner::new_no_crate(db);
-    let bool_ty = Ty::new_bool(interner);
-    let unit_ty = Ty::new_unit(interner);
+    let bool_ty = BuiltinType::bool().ty(db);
+    let unit_ty = Type::new_unit();
     [
-        Expr::FamousType { ty: Type::new(db, module.id, bool_ty), value: "true" },
-        Expr::FamousType { ty: Type::new(db, module.id, bool_ty), value: "false" },
-        Expr::FamousType { ty: Type::new(db, module.id, unit_ty), value: "()" },
+        Expr::FamousType { ty: bool_ty.clone(), value: "true" },
+        Expr::FamousType { ty: bool_ty, value: "false" },
+        Expr::FamousType { ty: unit_ty, value: "()" },
     ]
     .into_iter()
     .inspect(|exprs| {
         lookup.insert(exprs.ty(db), std::iter::once(exprs.clone()));
     })
-    .filter(|expr| expr.ty(db).could_unify_with_deeply(db, &ctx.goal))
+    .filter(|expr| expr.ty(db).instantiate_with_errors().could_unify_with_deeply(db, &ctx.goal))
 }
 
 /// # Impl static method (without self type) tactic
@@ -691,7 +694,7 @@ pub(super) fn impl_static_method<'a, 'lt, 'db, DB: HirDatabase>(
                 return None;
             }
 
-            let ret_ty = it.ret_type_with_args(db, ty.type_arguments());
+            let ret_ty = it.ret_type(db).instantiate(ty.type_arguments());
             // Filter out functions that return references
             if ctx.config.enable_borrowcheck && ret_ty.contains_reference(db) || ret_ty.is_raw_ptr()
             {
@@ -700,9 +703,9 @@ pub(super) fn impl_static_method<'a, 'lt, 'db, DB: HirDatabase>(
 
             // Early exit if some param cannot be filled from lookup
             let param_exprs: Vec<Vec<Expr<'_>>> = it
-                .params_without_self_with_args(db, ty.type_arguments())
+                .params_without_self(db)
                 .into_iter()
-                .map(|field| lookup.find_autoref(db, field.ty()))
+                .map(|field| lookup.find_autoref(db, &field.ty().instantiate(ty.type_arguments())))
                 .collect::<Option<_>>()?;
 
             // Note that we need special case for 0 param constructors because of multi cartesian
@@ -722,7 +725,9 @@ pub(super) fn impl_static_method<'a, 'lt, 'db, DB: HirDatabase>(
 
             Some((ret_ty, fn_exprs))
         })
-        .filter_map(|(ty, exprs)| ty.could_unify_with_deeply(db, &ctx.goal).then_some(exprs))
+        .filter_map(|(ty, exprs)| {
+            ty.instantiate_with_errors().could_unify_with_deeply(db, &ctx.goal).then_some(exprs)
+        })
         .flatten()
 }
 
@@ -745,7 +750,6 @@ pub(super) fn make_tuple<'a, 'lt, 'db, DB: HirDatabase>(
     should_continue: &'a dyn std::ops::Fn() -> bool,
 ) -> impl Iterator<Item = Expr<'db>> + use<'a, 'db, 'lt, DB> {
     let db = ctx.sema.db;
-    let module = ctx.scope.module();
 
     lookup
         .types_wishlist()
@@ -774,7 +778,7 @@ pub(super) fn make_tuple<'a, 'lt, 'db, DB: HirDatabase>(
                 .filter(|_| should_continue())
                 .map(|params| {
                     let tys: Vec<Type<'_>> = params.iter().map(|it| it.ty(db)).collect();
-                    let tuple_ty = Type::new_tuple(module.krate(db).into(), &tys);
+                    let tuple_ty = Type::new_tuple(db, &tys);
 
                     let expr = Expr::Tuple { ty: tuple_ty.clone(), params };
                     lookup.insert(tuple_ty, iter::once(expr.clone()));
@@ -785,5 +789,10 @@ pub(super) fn make_tuple<'a, 'lt, 'db, DB: HirDatabase>(
             Some(exprs)
         })
         .flatten()
-        .filter_map(|expr| expr.ty(db).could_unify_with_deeply(db, &ctx.goal).then_some(expr))
+        .filter_map(|expr| {
+            expr.ty(db)
+                .instantiate_with_errors()
+                .could_unify_with_deeply(db, &ctx.goal)
+                .then_some(expr)
+        })
 }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_label_to_loop.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_label_to_loop.rs
index b2194ab..e7a2b13 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_label_to_loop.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_label_to_loop.rs
@@ -1,10 +1,8 @@
-use ide_db::{
-    source_change::SourceChangeBuilder, syntax_helpers::node_ext::for_each_break_and_continue_expr,
-};
+use ide_db::syntax_helpers::node_ext::for_each_break_and_continue_expr;
 use syntax::{
     SyntaxToken, T,
     ast::{self, AstNode, HasLoopBody},
-    syntax_editor::{Position, SyntaxEditor},
+    syntax_editor::{Position, SyntaxAnnotation, SyntaxEditor},
 };
 
 use crate::{AssistContext, AssistId, Assists};
@@ -24,8 +22,8 @@
 // ->
 // ```
 // fn main() {
-//     ${1:'l}: loop {
-//         break ${2:'l};
+//     ${0:'l}: loop {
+//         break ${0:'l};
 //         continue ${0:'l};
 //     }
 // }
@@ -53,8 +51,11 @@ pub(crate) fn add_label_to_loop(acc: &mut Assists, ctx: &AssistContext<'_, '_>)
             ];
             editor.insert_all(Position::before(&loop_kw), elements);
 
-            if let Some(cap) = ctx.config.snippet_cap {
-                editor.add_annotation(label.syntax(), builder.make_placeholder_snippet(cap));
+            let annotation =
+                ctx.config.snippet_cap.map(|cap| builder.make_placeholder_snippet(cap));
+
+            if let Some(annotation) = annotation {
+                editor.add_annotation(label.syntax(), annotation);
             }
 
             let loop_body = loop_expr.loop_body().and_then(|it| it.stmt_list());
@@ -64,13 +65,14 @@ pub(crate) fn add_label_to_loop(acc: &mut Assists, ctx: &AssistContext<'_, '_>)
                     ast::Expr::ContinueExpr(continue_expr) => continue_expr.continue_token(),
                     _ => return,
                 };
-                if let Some(token) = token {
-                    insert_label_after_token(&editor, &token, ctx, builder);
+                if let Some(token) = token
+                    && let Some(annotation) = annotation
+                {
+                    insert_label_after_token(&editor, &token, annotation);
                 }
             });
 
             builder.add_file_edits(ctx.vfs_file_id(), editor);
-            builder.rename();
         },
     )
 }
@@ -86,17 +88,14 @@ fn loop_token(loop_expr: &ast::AnyHasLoopBody) -> Option<syntax::SyntaxToken> {
 fn insert_label_after_token(
     editor: &SyntaxEditor,
     token: &SyntaxToken,
-    ctx: &AssistContext<'_, '_>,
-    builder: &mut SourceChangeBuilder,
+    annotation: SyntaxAnnotation,
 ) {
     let make = editor.make();
     let label = make.lifetime("'l");
     let elements = vec![make.whitespace(" ").into(), label.syntax().clone().into()];
     editor.insert_all(Position::after(token), elements);
 
-    if let Some(cap) = ctx.config.snippet_cap {
-        editor.add_annotation(label.syntax(), builder.make_placeholder_snippet(cap));
-    }
+    editor.add_annotation(label.syntax(), annotation);
 }
 
 #[cfg(test)]
@@ -118,8 +117,8 @@ fn main() {
 }"#,
             r#"
 fn main() {
-    ${1:'l}: loop {
-        break ${2:'l};
+    ${0:'l}: loop {
+        break ${0:'l};
         continue ${0:'l};
     }
 }"#,
@@ -139,8 +138,8 @@ fn main() {
 }"#,
             r#"
 fn main() {
-    ${1:'l}: while true {
-        break ${2:'l};
+    ${0:'l}: while true {
+        break ${0:'l};
         continue ${0:'l};
     }
 }"#,
@@ -160,8 +159,8 @@ fn main() {
 }"#,
             r#"
 fn main() {
-    ${1:'l}: for _ in 0..5 {
-        break ${2:'l};
+    ${0:'l}: for _ in 0..5 {
+        break ${0:'l};
         continue ${0:'l};
     }
 }"#,
@@ -185,8 +184,8 @@ fn main() {
 }"#,
             r#"
 fn main() {
-    ${1:'l}: loop {
-        break ${2:'l};
+    ${0:'l}: loop {
+        break ${0:'l};
         continue ${0:'l};
         loop {
             break;
@@ -217,8 +216,8 @@ fn main() {
     loop {
         break;
         continue;
-        ${1:'l}: loop {
-            break ${2:'l};
+        ${0:'l}: loop {
+            break ${0:'l};
             continue ${0:'l};
         }
     }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_impl_members.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_impl_members.rs
index efbe381..1e8fb51 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_impl_members.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_impl_members.rs
@@ -2641,4 +2641,67 @@ impl Trait for Struct {
         "#,
         );
     }
+
+    #[test]
+    fn drop_pin_drop() {
+        check_assist_not_applicable(
+            add_missing_impl_members,
+            r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+    fn drop(&mut self) {}
+}
+        "#,
+        );
+        check_assist_not_applicable(
+            add_missing_impl_members,
+            r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+    fn pin_drop(self: core::pin::Pin<&mut Self>) {}
+}
+        "#,
+        );
+
+        check_assist_not_applicable(
+            add_missing_default_members,
+            r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+    fn drop(&mut self) {}
+}
+        "#,
+        );
+        check_assist_not_applicable(
+            add_missing_default_members,
+            r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+    fn pin_drop(self: core::pin::Pin<&mut Self>) {}
+}
+        "#,
+        );
+
+        check_assist(
+            add_missing_impl_members,
+            r#"
+//- minicore: drop, pin
+struct Foo;
+impl Drop for Foo {$0
+}
+        "#,
+            r#"
+struct Foo;
+impl Drop for Foo {
+    fn drop(&mut self) {
+        ${0:todo!()}
+    }
+}
+        "#,
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_match_arms.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_match_arms.rs
index 667a1d7..632fe0d 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_match_arms.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_match_arms.rs
@@ -80,16 +80,25 @@ pub(crate) fn add_missing_match_arms(acc: &mut Assists, ctx: &AssistContext<'_,
     let module = scope.module();
     let cfg = ctx.config.find_path_config(ctx.sema.is_nightly(scope.krate()));
     let self_ty = if ctx.config.prefer_self_ty {
-        scope.expression_store_owner().and_then(|def| {
-            match def {
-                hir::ExpressionStoreOwner::Body(def_with_body) => {
-                    def_with_body.as_assoc_item(ctx.db())
+        scope
+            .expression_store_owner()
+            .and_then(|def| {
+                match def {
+                    hir::ExpressionStoreOwner::Body(def_with_body) => {
+                        def_with_body.as_assoc_item(ctx.db())
+                    }
+                    hir::ExpressionStoreOwner::Signature(def) => def.as_assoc_item(ctx.db()),
+                    hir::ExpressionStoreOwner::VariantFields(_) => None,
+                }?
+                .implementing_ty(ctx.db())
+            })
+            .map(|self_ty| {
+                if let Some(owner) = scope.generic_def() {
+                    self_ty.try_rebase_into_owner(ctx.db(), owner).unwrap()
+                } else {
+                    self_ty
                 }
-                hir::ExpressionStoreOwner::Signature(def) => def.as_assoc_item(ctx.db()),
-                hir::ExpressionStoreOwner::VariantFields(_) => None,
-            }?
-            .implementing_ty(ctx.db())
-        })
+            })
     } else {
         None
     };
@@ -613,7 +622,7 @@ fn build_pat(
                 hir::StructKind::Tuple => {
                     let mut name_generator = suggest_name::NameGenerator::default();
                     let pats = fields.into_iter().map(|f| {
-                        let name = name_generator.for_type(&f.ty(db).to_type(db), db, edition);
+                        let name = name_generator.for_type(&f.ty(db), db, edition);
                         match name {
                             Some(name) => make.ident_pat(false, false, make.name(&name)).into(),
                             None => make.wildcard_pat().into(),
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/auto_import.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/auto_import.rs
index ac0bae7..dd08247 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/auto_import.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/auto_import.rs
@@ -293,7 +293,7 @@ pub(crate) fn relevance_score(
         if let Some(ty) = ty {
             if ty == *expected {
                 score = 100000;
-            } else if ty.could_unify_with(ctx.db(), expected) {
+            } else if ty.could_unify_with(ctx.db(), &expected.instantiate_with_errors()) {
                 score = 10000;
             }
         }
@@ -2037,4 +2037,60 @@ fn baz() {
             "Import `foo::Ext` without `as _`",
         );
     }
+
+    #[test]
+    fn local_enum_variant() {
+        check_assist(
+            auto_import,
+            r#"
+mod foo {
+    pub enum ControlFlow {
+        Continue,
+    }
+}
+
+fn main() {
+    Continue$0;
+}
+        "#,
+            r#"
+use foo::ControlFlow::Continue;
+
+mod foo {
+    pub enum ControlFlow {
+        Continue,
+    }
+}
+
+fn main() {
+    Continue;
+}
+        "#,
+        );
+    }
+
+    #[test]
+    fn foreign_enum_variant() {
+        check_assist(
+            auto_import,
+            r#"
+//- /foo.rs crate:foo
+pub enum ControlFlow {
+    Continue,
+}
+
+//- /main.rs crate:main deps:foo
+fn main() {
+    Continue$0;
+}
+        "#,
+            r#"
+use foo::ControlFlow::Continue;
+
+fn main() {
+    Continue;
+}
+        "#,
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_let_else_to_match.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_let_else_to_match.rs
index 07e12f0..65c1c7c 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_let_else_to_match.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_let_else_to_match.rs
@@ -229,6 +229,7 @@ fn remove_mut_and_collect_idents(
         | ast::Pat::LiteralPat(_)
         | ast::Pat::PathPat(_)
         | ast::Pat::WildcardPat(_)
+        | ast::Pat::NotNull(_)
         | ast::Pat::ConstBlockPat(_) => pat.clone(),
         // don't support macro pat yet
         ast::Pat::MacroPat(_) => return None,
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_match_to_let_else.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_match_to_let_else.rs
index a93ab13..9dffdf3 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_match_to_let_else.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_match_to_let_else.rs
@@ -93,7 +93,7 @@ fn find_arms(
     let mut extracting = None;
     let mut diverging = None;
     for arm in arms {
-        if ctx.sema.type_of_expr(&arm.expr()?)?.original().is_never() {
+        if ctx.sema.expr_is_diverging(&arm.expr()?) {
             diverging = Some(arm);
         } else {
             extracting = Some(arm);
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/expand_rest_pattern.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/expand_rest_pattern.rs
index 4aa11b4..8ae322c 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/expand_rest_pattern.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/expand_rest_pattern.rs
@@ -137,13 +137,7 @@ fn expand_tuple_struct_rest_pattern(
                 pat.fields()
                     .take(prefix_count)
                     .chain(fields[prefix_count..fields.len() - suffix_count].iter().map(|f| {
-                        gen_unnamed_pat(
-                            ctx,
-                            make,
-                            &mut name_gen,
-                            &f.ty(ctx.db()).to_type(ctx.sema.db),
-                            f.index(),
-                        )
+                        gen_unnamed_pat(ctx, make, &mut name_gen, &f.ty(ctx.db()), f.index())
                     }))
                     .chain(pat.fields().skip(prefix_count + 1)),
             );
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs
index 44123dc..f8572dc 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_function.rs
@@ -21,7 +21,7 @@
 use syntax::{
     Edition, SyntaxElement,
     SyntaxKind::{self, COMMENT},
-    SyntaxNode, SyntaxToken, T, TextRange, TextSize, TokenAtOffset, WalkEvent,
+    SyntaxNode, T, TextRange, WalkEvent,
     ast::{
         self, AstNode, AstToken, HasAttrs, HasGenericParams, HasName,
         edit::{AstNodeEdit, IndentLevel},
@@ -103,7 +103,7 @@ pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext<'_, '_>) -
 
     let ret_ty = body.return_ty(ctx)?;
     let control_flow = body.external_control_flow(ctx, &container_info)?;
-    let ret_values = body.ret_values(ctx, node.parent().as_ref().unwrap_or(&node));
+    let ret_values = body.ret_values(ctx);
 
     let target_range = body.text_range();
 
@@ -968,13 +968,11 @@ fn return_ty<'db>(&self, ctx: &AssistContext<'_, 'db>) -> Option<RetType<'db>> {
     fn ret_values<'a>(
         &self,
         ctx: &'a AssistContext<'_, '_>,
-        parent: &SyntaxNode,
     ) -> impl Iterator<Item = OutlivedLocal> + 'a {
-        let parent = parent.clone();
         let range = self.text_range();
         locals_defined_in_body(&ctx.sema, self)
             .into_iter()
-            .filter_map(move |local| local_outlives_body(ctx, range, local, &parent))
+            .filter_map(move |local| local_outlives_body(ctx, range, local))
     }
 
     /// Analyses the function body for external control flow.
@@ -1174,15 +1172,11 @@ fn has_exclusive_usages(
     usages
         .iter()
         .filter(|reference| body.contains_range(reference.range))
-        .any(|reference| reference_is_exclusive(reference, body, ctx))
+        .any(|reference| reference_is_exclusive(reference, ctx))
 }
 
 /// checks if this reference requires `&mut` access inside node
-fn reference_is_exclusive(
-    reference: &FileReference,
-    node: &dyn HasTokenAtOffset,
-    ctx: &AssistContext<'_, '_>,
-) -> bool {
+fn reference_is_exclusive(reference: &FileReference, ctx: &AssistContext<'_, '_>) -> bool {
     // FIXME: this quite an incorrect way to go about doing this :-)
     // `FileReference` is an IDE-type --- it encapsulates data communicated to the human,
     // but doesn't necessary fully reflect all the intricacies of the underlying language semantics
@@ -1195,7 +1189,7 @@ fn reference_is_exclusive(
     }
 
     // we take `&mut` reference to variable: `&mut v`
-    let path = match path_element_of_reference(node, reference.range) {
+    let path = match path_element_of(reference) {
         Some(path) => path,
         None => return false,
     };
@@ -1203,13 +1197,8 @@ fn reference_is_exclusive(
     expr_require_exclusive_access(ctx, &path).unwrap_or(false)
 }
 
-/// checks if this expr requires `&mut` access, recurses on field access
+/// checks if this expr requires `&mut` access, recurses on field/index access
 fn expr_require_exclusive_access(ctx: &AssistContext<'_, '_>, expr: &ast::Expr) -> Option<bool> {
-    if let ast::Expr::MacroExpr(_) = expr {
-        // FIXME: expand macro and check output for mutable usages of the variable?
-        return None;
-    }
-
     let parent = expr.syntax().parent()?;
 
     if let Some(bin_expr) = ast::BinExpr::cast(parent.clone()) {
@@ -1231,73 +1220,33 @@ fn expr_require_exclusive_access(ctx: &AssistContext<'_, '_>, expr: &ast::Expr)
         return Some(matches!(access, hir::Access::Exclusive));
     }
 
-    if let Some(field) = ast::FieldExpr::cast(parent) {
+    if let Some(field) = ast::FieldExpr::cast(parent.clone()) {
         return expr_require_exclusive_access(ctx, &field.into());
     }
 
+    // `container[i].mut_method()` needs `&mut container` but WRITE is not set (no direct assignment).
+    if let Some(index_expr) = ast::IndexExpr::cast(parent)
+        && index_expr.base().is_some_and(|base| base.syntax() == expr.syntax())
+    {
+        return expr_require_exclusive_access(ctx, &index_expr.into());
+    }
+
     Some(false)
 }
 
-trait HasTokenAtOffset {
-    fn token_at_offset(&self, offset: TextSize) -> TokenAtOffset<SyntaxToken>;
-}
-
-impl HasTokenAtOffset for SyntaxNode {
-    fn token_at_offset(&self, offset: TextSize) -> TokenAtOffset<SyntaxToken> {
-        SyntaxNode::token_at_offset(self, offset)
-    }
-}
-
-impl HasTokenAtOffset for FunctionBody {
-    fn token_at_offset(&self, offset: TextSize) -> TokenAtOffset<SyntaxToken> {
-        match self {
-            FunctionBody::Expr(expr) => expr.syntax().token_at_offset(offset),
-            FunctionBody::Span { parent, text_range, .. } => {
-                match parent.syntax().token_at_offset(offset) {
-                    TokenAtOffset::None => TokenAtOffset::None,
-                    TokenAtOffset::Single(t) => {
-                        if text_range.contains_range(t.text_range()) {
-                            TokenAtOffset::Single(t)
-                        } else {
-                            TokenAtOffset::None
-                        }
-                    }
-                    TokenAtOffset::Between(a, b) => {
-                        match (
-                            text_range.contains_range(a.text_range()),
-                            text_range.contains_range(b.text_range()),
-                        ) {
-                            (true, true) => TokenAtOffset::Between(a, b),
-                            (true, false) => TokenAtOffset::Single(a),
-                            (false, true) => TokenAtOffset::Single(b),
-                            (false, false) => TokenAtOffset::None,
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
-
 /// find relevant `ast::Expr` for reference
 ///
 /// # Preconditions
 ///
 /// `node` must cover `reference`, that is `node.text_range().contains_range(reference.range)`
-fn path_element_of_reference(
-    node: &dyn HasTokenAtOffset,
-    reference_range: TextRange,
-) -> Option<ast::Expr> {
-    let token = node.token_at_offset(reference_range.start()).right_biased().or_else(|| {
-        stdx::never!(false, "cannot find token at variable usage: {:?}", reference_range);
-        None
-    })?;
-    let path = token.parent_ancestors().find_map(ast::Expr::cast).or_else(|| {
-        stdx::never!(false, "cannot find path parent of variable usage: {:?}", token);
+fn path_element_of(reference: &FileReference) -> Option<ast::Expr> {
+    let path = reference.name.syntax().ancestors().find_map(ast::Expr::cast).or_else(|| {
+        stdx::never!(false, "cannot find path parent of variable usage: {:?}", reference.name);
         None
     })?;
     stdx::always!(
-        matches!(path, ast::Expr::PathExpr(_) | ast::Expr::MacroExpr(_)),
+        matches!(path, ast::Expr::PathExpr(_))
+            || path.syntax().parent().and_then(ast::FormatArgsExpr::cast).is_some(),
         "unexpected expression type for variable usage: {:?}",
         path
     );
@@ -1327,14 +1276,13 @@ fn local_outlives_body(
     ctx: &AssistContext<'_, '_>,
     body_range: TextRange,
     local: Local,
-    parent: &SyntaxNode,
 ) -> Option<OutlivedLocal> {
     let usages = LocalUsages::find_local_usages(ctx, local);
     let mut has_mut_usages = false;
     let mut any_outlives = false;
     for usage in usages.iter() {
         if body_range.end() <= usage.range.start() {
-            has_mut_usages |= reference_is_exclusive(usage, parent, ctx);
+            has_mut_usages |= reference_is_exclusive(usage, ctx);
             any_outlives |= true;
             if has_mut_usages {
                 break; // no need to check more elements we have all the info we wanted
@@ -2093,12 +2041,11 @@ fn fix_param_usages(
     let mut usages_for_param: Vec<(&Param<'_>, Vec<ast::Expr>)> = Vec::new();
     let mut usages_for_self_param: Vec<ast::Expr> = Vec::new();
     let source_range = source_syntax.text_range();
-    let source_start = source_range.start();
+    let syntax_offset = source_range.start() - syntax.text_range().start();
 
     let reference_filter = |reference: &FileReference| {
         source_range.contains_range(reference.range).then_some(())?;
-        let local_range = reference.range - source_start;
-        path_element_of_reference(syntax, local_range)
+        path_element_of(reference)
     };
 
     if let Some(self_param) = to_this_param {
@@ -2119,10 +2066,20 @@ fn fix_param_usages(
     }
 
     let make = editor.make();
+    let to_original = |old: &SyntaxNode| {
+        ctx.sema
+            .original_range_opt(old)
+            .map(|orig| crate::utils::cover_edit_range(syntax, orig.range - syntax_offset))
+    };
+    let replace = |range, new: &SyntaxNode| {
+        editor.replace_all(range, vec![new.clone().into()]);
+    };
 
     for self_usage in usages_for_self_param {
-        let this_expr = make.expr_path(make.ident_path("this"));
-        editor.replace(self_usage.syntax(), this_expr.syntax());
+        if let Some(original) = to_original(self_usage.syntax()) {
+            let this_expr = make.expr_path(make.ident_path("this"));
+            replace(original, this_expr.syntax())
+        }
     }
     for (param, usages) in usages_for_param {
         for usage in usages {
@@ -2135,24 +2092,33 @@ fn fix_param_usages(
                     // do nothing
                 }
                 Some(ast::Expr::RefExpr(node))
-                    if param.kind() == ParamKind::MutRef && node.mut_token().is_some() =>
+                    if param.kind() == ParamKind::MutRef
+                        && node.mut_token().is_some()
+                        && let Some(original) = to_original(node.syntax()) =>
                 {
-                    editor.replace(
-                        node.syntax(),
+                    replace(
+                        original,
                         node.expr().expect("RefExpr::expr() cannot be None").syntax(),
                     );
                 }
                 Some(ast::Expr::RefExpr(node))
-                    if param.kind() == ParamKind::SharedRef && node.mut_token().is_none() =>
+                    if param.kind() == ParamKind::SharedRef
+                        && node.mut_token().is_none()
+                        && let Some(original) = to_original(node.syntax()) =>
                 {
-                    editor.replace(
-                        node.syntax(),
+                    replace(
+                        original,
                         node.expr().expect("RefExpr::expr() cannot be None").syntax(),
                     );
                 }
                 Some(_) | None => {
-                    let p = make.expr_prefix(T![*], usage.clone());
-                    editor.replace(usage.syntax(), p.syntax())
+                    if let Some(original) = to_original(usage.syntax())
+                        // ignore variable in format string
+                        && !matches!(usage, ast::Expr::Literal(_))
+                    {
+                        let p = make.expr_prefix(T![*], usage.clone());
+                        replace(original, p.syntax())
+                    }
                 }
             }
         }
@@ -3292,6 +3258,54 @@ fn foo() {
     }
 
     #[test]
+    fn mut_index_element_method_call() {
+        check_assist(
+            extract_function,
+            r#"
+//- minicore: index
+use core::ops::{Index, IndexMut};
+struct Container([S; 2]);
+struct S;
+impl S { fn mutate(&mut self) {} }
+impl Index<usize> for Container {
+    type Output = S;
+    fn index(&self, i: usize) -> &S { &self.0[i] }
+}
+impl IndexMut<usize> for Container {
+    fn index_mut(&mut self, i: usize) -> &mut S { &mut self.0[i] }
+}
+fn foo() {
+    let mut c = Container([S, S]);
+    $0c[0].mutate();$0
+    let _ = c;
+}
+"#,
+            r#"
+use core::ops::{Index, IndexMut};
+struct Container([S; 2]);
+struct S;
+impl S { fn mutate(&mut self) {} }
+impl Index<usize> for Container {
+    type Output = S;
+    fn index(&self, i: usize) -> &S { &self.0[i] }
+}
+impl IndexMut<usize> for Container {
+    fn index_mut(&mut self, i: usize) -> &mut S { &mut self.0[i] }
+}
+fn foo() {
+    let mut c = Container([S, S]);
+    fun_name(&mut c);
+    let _ = c;
+}
+
+fn $0fun_name(c: &mut Container) {
+    c[0].mutate();
+}
+"#,
+        );
+    }
+
+    #[test]
     fn mut_field_from_outer_scope() {
         check_assist(
             extract_function,
@@ -3520,6 +3534,61 @@ fn $0fun_name(n: &mut i32) {
     }
 
     #[test]
+    fn mut_param_because_of_mut_ref_in_macro() {
+        check_assist(
+            extract_function,
+            r#"
+macro_rules! refmut { ($e:expr) => { &mut $e }; }
+fn foo() {
+    let mut n = 1;
+    $0let v = refmut!(n);
+    *v += 1;$0
+    let k = n;
+}
+"#,
+            r#"
+macro_rules! refmut { ($e:expr) => { &mut $e }; }
+fn foo() {
+    let mut n = 1;
+    fun_name(&mut n);
+    let k = n;
+}
+
+fn $0fun_name(n: &mut i32) {
+    let v = refmut!(*n);
+    *v += 1;
+}
+"#,
+        );
+
+        check_assist(
+            extract_function,
+            r#"
+macro_rules! id { ($e:expr) => { $e }; }
+fn foo() {
+    let mut n = 1;
+    $0let v = id!(&mut n);
+    *v += 1;$0
+    let k = n;
+}
+"#,
+            r#"
+macro_rules! id { ($e:expr) => { $e }; }
+fn foo() {
+    let mut n = 1;
+    fun_name(&mut n);
+    let k = n;
+}
+
+fn $0fun_name(n: &mut i32) {
+    let v = id!(n);
+    *v += 1;
+}
+"#,
+        );
+    }
+
+    #[test]
     fn mut_param_by_value_because_of_mut_ref() {
         check_assist(
             extract_function,
@@ -6396,7 +6465,42 @@ fn main() {
 }
 
 fn $0fun_name(s: &Foo) {
-    *print!("{}{}", s, s);
+    print!("{}{}", *s, *s);
+}"#,
+        );
+
+        check_assist(
+            extract_function,
+            r#"
+//- minicore: fmt
+#[derive(Debug)]
+struct Foo(&'static str);
+
+impl Foo {
+    fn text(&self) -> &str { self.0 }
+}
+
+fn main() {
+    let s = Foo("");
+    $0print!("{s}{s}");$0
+    let _ = s.text() == "";
+}"#,
+            r#"
+#[derive(Debug)]
+struct Foo(&'static str);
+
+impl Foo {
+    fn text(&self) -> &str { self.0 }
+}
+
+fn main() {
+    let s = Foo("");
+    fun_name(&s);
+    let _ = s.text() == "";
+}
+
+fn $0fun_name(s: &Foo) {
+    print!("{s}{s}");
 }"#,
         );
     }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs
index 9e06a17..40eaed0 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_module.rs
@@ -733,6 +733,7 @@ macro_rules! check_item {
         Definition::Static(x) => check_item!(x),
         Definition::Trait(x) => check_item!(x),
         Definition::TypeAlias(x) => check_item!(x),
+        Definition::Macro(x) => check_item!(x),
         _ => {}
     }
 
@@ -1813,4 +1814,33 @@ fn foo(){}
 "#,
         )
     }
+
+    #[test]
+    fn test_extract_module_macro_call_import() {
+        check_assist(
+            extract_module,
+            r"
+macro_rules! my_macro {
+    () => {};
+}
+
+$0fn bar() {
+    my_macro!();
+}$0
+            ",
+            r"
+macro_rules! my_macro {
+    () => {};
+}
+
+mod modname {
+    use super::my_macro;
+
+    pub(crate) fn bar() {
+        my_macro!();
+    }
+}
+            ",
+        )
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
index 50ce8d9..5e6e74b 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -249,10 +249,6 @@ fn tag_generics_in_variant(ty: &ast::Type, generics: &mut [(ast::GenericParam, b
                     }
                 }
                 param if matches!(token.kind(), T![ident]) => {
-                    #[expect(
-                        clippy::collapsible_match,
-                        reason = "it won't compile since in the guard, `param` is immutable"
-                    )]
                     if match param {
                         ast::GenericParam::ConstParam(konst) => konst
                             .name()
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_variable.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_variable.rs
index d4a0490..e1b91c9 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_variable.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/extract_variable.rs
@@ -13,7 +13,10 @@
     syntax_editor::{Element, Position},
 };
 
-use crate::{AssistContext, AssistId, Assists, utils::is_body_const};
+use crate::{
+    AssistContext, AssistId, Assists,
+    utils::{cover_edit_range, is_body_const},
+};
 
 // Assist: extract_variable
 //
@@ -107,9 +110,7 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext<'_, '_>) -
             .skip_while(|it| !it.text_range().contains_range(range))
             .find_map(valid_target_expr(ctx))?;
         let original_range = ctx.sema.original_range(expr.syntax());
-        let (first, last) = extract_token_range_of(&node, original_range.range)?;
-        let to_extract = first.syntax_element()..=last.syntax_element();
-        (to_extract, expr)
+        (cover_edit_range(&node, original_range.range), expr)
     } else {
         let expr = node
             .descendants()
@@ -3004,4 +3005,26 @@ fn main() {
             "Extract into variable",
         );
     }
+
+    #[test]
+    fn regression_22441() {
+        check_assist_by_label(
+            extract_variable,
+            r#"
+//- minicore: option, write
+fn main() {
+    let maybe_str = Some("world");
+    write!((), "Hello, {}!", $0maybe_str.unwrap()$0);
+}
+"#,
+            r#"
+fn main() {
+    let maybe_str = Some("world");
+    let $0var_name = maybe_str.unwrap();
+    write!((), "Hello, {}!", var_name);
+}
+"#,
+            "Extract into variable",
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs
index 52df618..1617016 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs
@@ -1,4 +1,3 @@
-use hir::next_solver::{DbInterner, TypingMode};
 use ide_db::{RootDatabase, famous_defs::FamousDefs};
 use syntax::ast::{self, AstNode, HasName, edit::AstNodeEdit, syntax_factory::SyntaxFactory};
 use syntax::syntax_editor::Position;
@@ -159,16 +158,12 @@ fn existing_from_impl(
     let variant = sema.to_def(variant)?;
     let krate = variant.module(db).krate(db);
     let from_trait = FamousDefs(sema, krate).core_convert_From()?;
-    let interner = DbInterner::new_with(db, krate.base());
-    use hir::next_solver::infer::DbInternerInferExt;
-    let infcx = interner.infer_ctxt().build(TypingMode::non_body_analysis());
 
-    let variant = variant.instantiate_infer(&infcx);
     let enum_ = variant.parent_enum(sema.db);
     let field_ty = variant.fields(sema.db).first()?.ty(sema.db);
     let enum_ty = enum_.ty(sema.db);
     tracing::debug!(?enum_, ?field_ty, ?enum_ty);
-    enum_ty.impls_trait(infcx, from_trait, &[field_ty]).then_some(())
+    enum_ty.has_any_impl(db, from_trait, &[field_ty]).then_some(())
 }
 
 #[cfg(test)]
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_single_field_struct_from.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_single_field_struct_from.rs
index 4348dfa..d5629e2 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_single_field_struct_from.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_single_field_struct_from.rs
@@ -1,4 +1,3 @@
-use hir::next_solver::{DbInterner, TypingMode};
 use hir::{HasCrate, ModuleDef, Semantics};
 use ide_db::use_trivial_constructor::use_trivial_constructor_with_factory;
 use ide_db::{
@@ -233,15 +232,11 @@ fn from_impl_exists(
     let strukt = sema.to_def(strukt)?;
     let krate = strukt.krate(db);
     let from_trait = FamousDefs(sema, krate).core_convert_From()?;
-    let interner = DbInterner::new_with(db, krate.base());
-    use hir::next_solver::infer::DbInternerInferExt;
-    let infcx = interner.infer_ctxt().build(TypingMode::non_body_analysis());
 
-    let strukt = strukt.instantiate_infer(&infcx);
     let field_ty = strukt.fields(db).get(main_field_i)?.ty(db);
     let struct_ty = strukt.ty(db);
     tracing::debug!(?strukt, ?field_ty, ?struct_ty);
-    struct_ty.impls_trait(infcx, from_trait, &[field_ty]).then_some(())
+    struct_ty.has_any_impl(db, from_trait, &[field_ty]).then_some(())
 }
 
 #[cfg(test)]
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_trait_from_impl.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
index 2493ba6..12afd9a 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
@@ -1,5 +1,5 @@
 use crate::assist_context::{AssistContext, Assists};
-use ide_db::assists::AssistId;
+use ide_db::{assists::AssistId, defs::Definition, search::SearchScope};
 use syntax::{
     AstNode, AstToken, SyntaxKind, T,
     ast::{
@@ -114,10 +114,11 @@ pub(crate) fn generate_trait_from_impl(
 
             let editor = builder.make_editor(impl_ast.syntax());
             let make = editor.make();
+            let params = used_params(&impl_ast, make, ctx);
             let trait_ast = make.trait_(
                 false,
                 &trait_name(&impl_assoc_items, make).text(),
-                impl_ast.generic_param_list(),
+                params.clone(),
                 impl_ast.where_clause(),
                 trait_items,
             );
@@ -133,7 +134,7 @@ pub(crate) fn generate_trait_from_impl(
                 make.whitespace(" ").into(),
             ];
 
-            if let Some(params) = impl_ast.generic_param_list() {
+            if let Some(params) = params {
                 let gen_args = &params.to_generic_args(make);
                 elements.insert(1, gen_args.syntax().clone().into());
             }
@@ -167,6 +168,35 @@ pub(crate) fn generate_trait_from_impl(
     Some(())
 }
 
+fn used_params(
+    impl_ast: &ast::Impl,
+    make: &SyntaxFactory,
+    ctx: &AssistContext<'_, '_>,
+) -> Option<ast::GenericParamList> {
+    let impl_only_ranges = impl_ast
+        .assoc_item_list()
+        .into_iter()
+        .flat_map(|list| list.assoc_items())
+        .filter_map(|item| match item {
+            ast::AssocItem::Fn(f) => Some(f.body()?.syntax().text_range()),
+            _ => None,
+        })
+        .chain(impl_ast.self_ty().map(|it| it.syntax().text_range()))
+        .collect::<Vec<_>>();
+    let used_in_impl = |param: &ast::GenericParam| {
+        let Some(def) = ctx.sema.to_def(param) else { return true };
+        Definition::GenericParam(def)
+            .usages(&ctx.sema)
+            .in_scope(&SearchScope::single_file(ctx.file_id()))
+            .all()
+            .file_ranges()
+            .any(|it| !impl_only_ranges.iter().any(|range| range.contains_range(it.range)))
+    };
+    let params = impl_ast.generic_param_list()?;
+    let mut params = params.generic_params().filter(used_in_impl).peekable();
+    params.peek().is_some().then(|| make.generic_param_list(params))
+}
+
 fn trait_name(items: &ast::AssocItemList, make: &SyntaxFactory) -> ast::Name {
     let mut fn_names = items
         .assoc_items()
@@ -392,6 +422,87 @@ impl<const N: usize> NewTrait<N> for Foo<N> {
     }
 
     #[test]
+    fn test_impl_with_generics_only_used_in_trait() {
+        check_assist_no_snippet_cap(
+            generate_trait_from_impl,
+            r#"
+struct Foo<T, const N: usize>([T; N]);
+
+impl<T, const N: usize> F$0oo<T, N> {
+    fn spec_len(&self) -> usize {
+        N
+    }
+}
+            "#,
+            r#"
+struct Foo<T, const N: usize>([T; N]);
+
+trait SpecLen {
+    fn spec_len(&self) -> usize;
+}
+
+impl<T, const N: usize> SpecLen for Foo<T, N> {
+    fn spec_len(&self) -> usize {
+        N
+    }
+}
+            "#,
+        );
+
+        check_assist_no_snippet_cap(
+            generate_trait_from_impl,
+            r#"
+struct Foo<T, const N: usize>([T; N]);
+
+impl<T, const N: usize> F$0oo<T, N> {
+    fn spec_len(&self, other: [T; N]) -> usize {
+        0
+    }
+}
+            "#,
+            r#"
+struct Foo<T, const N: usize>([T; N]);
+
+trait SpecLen<T, const N: usize> {
+    fn spec_len(&self, other: [T; N]) -> usize;
+}
+
+impl<T, const N: usize> SpecLen<T, N> for Foo<T, N> {
+    fn spec_len(&self, other: [T; N]) -> usize {
+        0
+    }
+}
+            "#,
+        );
+
+        check_assist_no_snippet_cap(
+            generate_trait_from_impl,
+            r#"
+struct Foo<T, const N: usize>([T; N]);
+
+impl<T, const N: usize> F$0oo<T, N> where T: Copy {
+    fn spec_len(&self) -> usize {
+        0
+    }
+}
+            "#,
+            r#"
+struct Foo<T, const N: usize>([T; N]);
+
+trait SpecLen<T> where T: Copy {
+    fn spec_len(&self) -> usize;
+}
+
+impl<T, const N: usize> SpecLen<T> for Foo<T, N> where T: Copy {
+    fn spec_len(&self) -> usize {
+        0
+    }
+}
+            "#,
+        );
+    }
+
+    #[test]
     fn test_trait_items_should_not_have_vis() {
         check_assist_no_snippet_cap(
             generate_trait_from_impl,
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_call.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_call.rs
index af048c6..8897e59 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_call.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/inline_call.rs
@@ -7,7 +7,7 @@
     sym,
 };
 use ide_db::{
-    EditionedFileId, FileId, FxHashMap, RootDatabase,
+    EditionedFileId, FxHashMap, RootDatabase,
     base_db::Crate,
     defs::Definition,
     imports::insert_use::remove_use_tree_if_simple,
@@ -21,7 +21,7 @@
     ast::{
         self, HasArgList, HasGenericArgs, Pat, PathExpr,
         edit::{AstNodeEdit, IndentLevel},
-        make,
+        syntax_factory::SyntaxFactory,
     },
     syntax_editor::SyntaxEditor,
 };
@@ -79,7 +79,11 @@ pub(crate) fn inline_into_callers(acc: &mut Assists, ctx: &AssistContext<'_, '_>
 
     let function = ctx.sema.to_def(&ast_func)?;
 
-    let params = get_fn_params(ctx.sema.db, function, &param_list)?;
+    let def_file_editor = SyntaxEditor::new(ast_func.syntax().ancestors().last().unwrap()).0;
+    let params = get_fn_params(ctx.sema.db, function, &param_list, def_file_editor.make())?;
+
+    let mut file_editors = FxHashMap::default();
+    file_editors.insert(vfs_def_file, def_file_editor);
 
     let usages = Definition::Function(function).usages(&ctx.sema);
     if !usages.at_least_one() {
@@ -106,7 +110,6 @@ pub(crate) fn inline_into_callers(acc: &mut Assists, ctx: &AssistContext<'_, '_>
             let mut usages = usages.all();
             let current_file_usage = usages.references.remove(&def_file);
 
-            let mut file_editors: FxHashMap<FileId, SyntaxEditor> = FxHashMap::default();
             let mut remove_def = true;
             let mut inline_refs_for_file = |file_id: EditionedFileId, refs: Vec<FileReference>| {
                 let file_id = file_id.file_id(ctx.db());
@@ -170,10 +173,10 @@ pub(crate) fn inline_into_callers(acc: &mut Assists, ctx: &AssistContext<'_, '_>
                 None => builder.edit_file(vfs_def_file),
             }
             if remove_def {
-                let editor = file_editors
+                file_editors
                     .entry(vfs_def_file)
-                    .or_insert_with(|| builder.make_editor(ast_func.syntax()));
-                editor.delete(ast_func.syntax());
+                    .or_insert_with(|| builder.make_editor(ast_func.syntax()))
+                    .delete(ast_func.syntax());
             }
             for (file_id, editor) in file_editors {
                 builder.add_file_edits(file_id, editor);
@@ -251,7 +254,9 @@ pub(crate) fn inline_call(acc: &mut Assists, ctx: &AssistContext<'_, '_>) -> Opt
         cov_mark::hit!(inline_call_recursive);
         return None;
     }
-    let params = get_fn_params(ctx.sema.db, function, &param_list)?;
+    let syntax = call_info.node.syntax().clone();
+    let editor = SyntaxEditor::new(syntax.ancestors().last().unwrap()).0;
+    let params = get_fn_params(ctx.sema.db, function, &param_list, editor.make())?;
 
     if call_info.arguments.len() != params.len() {
         // Can't inline the function because they've passed the wrong number of
@@ -260,9 +265,7 @@ pub(crate) fn inline_call(acc: &mut Assists, ctx: &AssistContext<'_, '_>) -> Opt
         return None;
     }
 
-    let syntax = call_info.node.syntax().clone();
     acc.add(AssistId::refactor_inline("inline_call"), label, syntax.text_range(), |builder| {
-        let editor = builder.make_editor(call_info.node.syntax());
         let replacement =
             inline(&ctx.sema, file_id, function, &fn_body, &params, &call_info, &editor);
         editor.replace(call_info.node.syntax(), replacement.syntax());
@@ -311,6 +314,7 @@ fn get_fn_params<'db>(
     db: &'db dyn HirDatabase,
     function: hir::Function,
     param_list: &ast::ParamList,
+    make: &SyntaxFactory,
 ) -> Option<Vec<(ast::Pat, Option<ast::Type>, hir::Param<'db>)>> {
     let mut assoc_fn_params = function.assoc_fn_params(db).into_iter();
 
@@ -318,10 +322,10 @@ fn get_fn_params<'db>(
     if let Some(self_param) = param_list.self_param() {
         // Keep `ref` and `mut` and transform them into `&` and `mut` later
         params.push((
-            make::ident_pat(
+            make.ident_pat(
                 self_param.amp_token().is_some(),
                 self_param.mut_token().is_some(),
-                make::name("this"),
+                make.name("this"),
             )
             .into(),
             None,
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/qualify_path.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/qualify_path.rs
index cb48554..5e07d85 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/qualify_path.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/qualify_path.rs
@@ -52,8 +52,8 @@ pub(crate) fn qualify_path(acc: &mut Assists, ctx: &AssistContext<'_, '_>) -> Op
         ImportCandidate::Path(candidate) if !candidate.qualifier.is_empty() => {
             cov_mark::hit!(qualify_path_qualifier_start);
             let path = ast::Path::cast(syntax_under_caret.clone())?;
-            let (prev_segment, segment) = (path.qualifier()?.segment()?, path.segment()?);
-            QualifyCandidate::QualifierStart(segment, prev_segment.generic_arg_list())
+            let first_seg_generics = path.segments().next()?.generic_arg_list();
+            QualifyCandidate::QualifierStart(path, first_seg_generics)
         }
         ImportCandidate::Path(_) => {
             cov_mark::hit!(qualify_path_unqualified_name);
@@ -113,7 +113,7 @@ pub(crate) fn qualify_path(acc: &mut Assists, ctx: &AssistContext<'_, '_>) -> Op
     Some(())
 }
 pub(crate) enum QualifyCandidate<'db> {
-    QualifierStart(ast::PathSegment, Option<ast::GenericArgList>),
+    QualifierStart(ast::Path, Option<ast::GenericArgList>),
     UnqualifiedName(Option<ast::GenericArgList>),
     TraitAssocItem(ast::Path, ast::PathSegment),
     TraitMethod(&'db RootDatabase, ast::MethodCallExpr),
@@ -131,9 +131,11 @@ pub(crate) fn qualify(
     ) {
         let import = mod_path_to_ast_with_factory(editor.make(), import, edition);
         match self {
-            QualifyCandidate::QualifierStart(segment, generics) => {
+            QualifyCandidate::QualifierStart(path, generics) => {
                 let generics = generics.as_ref().map_or_else(String::new, ToString::to_string);
-                replacer(format!("{import}{generics}::{segment}"));
+                let suffix =
+                    path.segments().skip(1).map(|s| s.to_string()).collect::<Vec<_>>().join("::");
+                replacer(format!("{import}{generics}::{suffix}"));
             }
             QualifyCandidate::UnqualifiedName(generics) => {
                 let generics = generics.as_ref().map_or_else(String::new, ToString::to_string);
@@ -285,6 +287,76 @@ pub mod fmt {
     }
 
     #[test]
+    fn applicable_when_multiple_segments() {
+        check_assist(
+            qualify_path,
+            r#"
+    mod a { pub mod b { pub mod c { pub fn foo() {} } } }
+b::c::foo$0
+"#,
+            r#"
+    mod a { pub mod b { pub mod c { pub fn foo() {} } } }
+a::b::c::foo
+"#,
+        );
+        check_assist(
+            qualify_path,
+            r#"
+    mod a { pub mod b { pub mod c { pub fn foo() {} } } }
+b::c$0::foo
+"#,
+            r#"
+    mod a { pub mod b { pub mod c { pub fn foo() {} } } }
+a::b::c::foo
+"#,
+        );
+        check_assist(
+            qualify_path,
+            r#"
+    mod a { pub mod b { pub mod c { pub fn foo() {} } } }
+b$0::c::foo
+"#,
+            r#"
+    mod a { pub mod b { pub mod c { pub fn foo() {} } } }
+a::b::c::foo
+"#,
+        );
+    }
+
+    #[test]
+    fn applicable_when_multiple_segments_with_generics() {
+        check_assist(
+            qualify_path,
+            r#"
+mod a {
+    pub mod b {
+        pub struct TestStruct<T>(T);
+        impl<T> TestStruct<T> {
+            pub const TEST_CONST: u8 = 42;
+        }
+    }
+}
+fn main() {
+    b::TestStruct::<()>::TEST_CONST$0;
+}
+"#,
+            r#"
+mod a {
+    pub mod b {
+        pub struct TestStruct<T>(T);
+        impl<T> TestStruct<T> {
+            pub const TEST_CONST: u8 = 42;
+        }
+    }
+}
+fn main() {
+    a::b::TestStruct::<()>::TEST_CONST;
+}
+"#,
+        );
+    }
+
+    #[test]
     fn applicable_when_found_an_import() {
         check_assist(
             qualify_path,
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_if_let_with_match.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_if_let_with_match.rs
index aa3f917..ff2d054 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_if_let_with_match.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_if_let_with_match.rs
@@ -171,7 +171,7 @@ fn make_else_arm(
     let (pattern, expr) = if let Some(else_expr) = else_expr {
         let pattern = match conditionals {
             [(None, Some(_), _)] => make.literal_pat("false").into(),
-            [(Some(pat), _, _)] => match ctx
+            [(Some(pat), None, _)] => match ctx
                 .sema
                 .type_of_pat(pat)
                 .and_then(|ty| TryEnum::from_ty(&ctx.sema, &ty.adjusted()))
@@ -956,6 +956,31 @@ fn foo(x: Option<i32>) {
     }
 
     #[test]
+    fn special_case_option_with_guard() {
+        check_assist(
+            replace_if_let_with_match,
+            r#"
+//- minicore: option
+fn foo(x: Option<i32>) {
+    $0if let Some(x) = x && x != 4 {
+        println!("{}", x)
+    } else {
+        println!("none")
+    }
+}
+"#,
+            r#"
+fn foo(x: Option<i32>) {
+    match x {
+        Some(x) if x != 4 => println!("{}", x),
+        _ => println!("none"),
+    }
+}
+"#,
+        );
+    }
+
+    #[test]
     fn special_case_option_ref() {
         check_assist(
             replace_if_let_with_match,
@@ -1006,6 +1031,31 @@ fn foo(x: Option<i32>) {
     }
 
     #[test]
+    fn special_case_inverted_option_with_guard() {
+        check_assist(
+            replace_if_let_with_match,
+            r#"
+//- minicore: option
+fn foo(x: Option<i32>) {
+    $0if let None = x && other_cond {
+        println!("none")
+    } else {
+        println!("some")
+    }
+}
+"#,
+            r#"
+fn foo(x: Option<i32>) {
+    match x {
+        None if other_cond => println!("none"),
+        _ => println!("some"),
+    }
+}
+"#,
+        );
+    }
+
+    #[test]
     fn special_case_result() {
         check_assist(
             replace_if_let_with_match,
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_method_eager_lazy.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_method_eager_lazy.rs
index 7aa9a82..17ee859 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_method_eager_lazy.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_method_eager_lazy.rs
@@ -1,8 +1,8 @@
 use hir::Semantics;
-use ide_db::{RootDatabase, assists::AssistId, defs::Definition};
+use ide_db::{RootDatabase, assists::AssistId, defs::Definition, famous_defs::FamousDefs};
 use syntax::{
     AstNode,
-    ast::{self, Expr, HasArgList, make, syntax_factory::SyntaxFactory},
+    ast::{self, Expr, HasArgList, syntax_factory::SyntaxFactory},
 };
 
 use crate::{AssistContext, Assists, utils::wrap_paren_in_call};
@@ -64,9 +64,29 @@ pub(crate) fn replace_with_lazy_method(
         format!("Replace {method_name} with {method_name_lazy}"),
         call.syntax().text_range(),
         |builder| {
-            let closured = into_closure(&last_arg, &method_name_lazy);
-            builder.replace(method_name.syntax().text_range(), method_name_lazy);
-            builder.replace_ast(last_arg, closured);
+            let editor = builder.make_editor(call.syntax());
+            let add_param = match &*method_name_lazy {
+                "and_then" => true,
+                "or_else" | "unwrap_or_else" => FamousDefs(&ctx.sema, scope.krate())
+                    .core_result_Result()
+                    .is_some_and(|result| {
+                        result
+                            .ty(ctx.db())
+                            .instantiate_with_errors()
+                            .could_unify_with(ctx.db(), &receiver_ty)
+                    }),
+                _ => false,
+            };
+            let closured = into_closure(&last_arg, add_param, editor.make());
+            editor.replace(method_name.syntax(), editor.make().name(&method_name_lazy).syntax());
+            editor.replace(last_arg.syntax(), closured.syntax());
+            if let Some(cap) = ctx.config.snippet_cap
+                && let ast::Expr::ClosureExpr(closured) = closured
+                && let Some(param) = closured.param_list().and_then(|it| it.params().next())
+            {
+                editor.add_annotation(param.syntax(), builder.make_placeholder_snippet(cap));
+            }
+            builder.add_file_edits(ctx.vfs_file_id(), editor);
         },
     )
 }
@@ -83,7 +103,7 @@ fn lazy_method_name(name: &str) -> String {
     }
 }
 
-fn into_closure(param: &Expr, name_lazy: &str) -> Expr {
+fn into_closure(param: &Expr, add_param: bool, make: &SyntaxFactory) -> Expr {
     (|| {
         if let ast::Expr::CallExpr(call) = param {
             if call.arg_list()?.args().count() == 0 { Some(call.expr()?) } else { None }
@@ -92,9 +112,8 @@ fn into_closure(param: &Expr, name_lazy: &str) -> Expr {
         }
     })()
     .unwrap_or_else(|| {
-        let pats = (name_lazy == "and_then")
-            .then(|| make::untyped_param(make::ext::simple_ident_pat(make::name("it")).into()));
-        make::expr_closure(pats, param.clone()).into()
+        let pats = add_param.then(|| make.untyped_param(make.wildcard_pat().into()));
+        make.expr_closure(pats, param.clone()).into()
     })
 }
 
@@ -156,14 +175,16 @@ pub(crate) fn replace_with_eager_method(
         format!("Replace {method_name} with {method_name_eager}"),
         call.syntax().text_range(),
         |builder| {
-            builder.replace(method_name.syntax().text_range(), method_name_eager);
-            let called = into_call(&last_arg, &ctx.sema);
-            builder.replace_ast(last_arg, called);
+            let editor = builder.make_editor(call.syntax());
+            let called = into_call(&last_arg, &ctx.sema, editor.make());
+            editor.replace(method_name.syntax(), editor.make().name(method_name_eager).syntax());
+            editor.replace(last_arg.syntax(), called.syntax());
+            builder.add_file_edits(ctx.vfs_file_id(), editor);
         },
     )
 }
 
-fn into_call(param: &Expr, sema: &Semantics<'_, RootDatabase>) -> Expr {
+fn into_call(param: &Expr, sema: &Semantics<'_, RootDatabase>, make: &SyntaxFactory) -> Expr {
     (|| {
         if let ast::Expr::ClosureExpr(closure) = param {
             let mut params = closure.param_list()?.params();
@@ -183,8 +204,8 @@ fn into_call(param: &Expr, sema: &Semantics<'_, RootDatabase>) -> Expr {
         }
     })()
     .unwrap_or_else(|| {
-        let callable = wrap_paren_in_call(param.clone(), &SyntaxFactory::without_mappings());
-        make::expr_call(callable, make::arg_list(Vec::new())).into()
+        let callable = wrap_paren_in_call(param.clone(), make);
+        make.expr_call(callable, make.arg_list(Vec::new())).into()
     })
 }
 
@@ -213,7 +234,7 @@ fn replace_or_with_or_else_simple() {
         check_assist(
             replace_with_lazy_method,
             r#"
-//- minicore: option, fn
+//- minicore: option, result, fn
 fn foo() {
     let foo = Some(1);
     return foo.unwrap_$0or(2);
@@ -229,6 +250,26 @@ fn foo() {
     }
 
     #[test]
+    fn replace_or_with_or_else_with_parameter() {
+        check_assist(
+            replace_with_lazy_method,
+            r#"
+//- minicore: option, result, fn
+fn foo() {
+    let foo = Ok(1);
+    return foo.unwrap_$0or(2);
+}
+"#,
+            r#"
+fn foo() {
+    let foo = Ok(1);
+    return foo.unwrap_or_else(|${0:_}| 2);
+}
+"#,
+        )
+    }
+
+    #[test]
     fn replace_or_with_or_else_call() {
         check_assist(
             replace_with_lazy_method,
@@ -358,7 +399,7 @@ fn foo() {
             r#"
 fn foo() {
     let foo = Some("foo");
-    return foo.and_then(|it| Some("bar"));
+    return foo.and_then(|${0:_}| Some("bar"));
 }
 "#,
         )
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_return_type.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_return_type.rs
index f9c103a..032cc28 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_return_type.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/wrap_return_type.rs
@@ -92,7 +92,7 @@ pub(crate) fn wrap_return_type(acc: &mut Assists, ctx: &AssistContext<'_, '_>) -
                     };
                     let semantic_ty = ty_constructor
                         .map(|ty_constructor| {
-                            hir::Adt::from(ty_constructor).ty_with_args(ctx.db(), [ty.clone()])
+                            hir::Adt::from(ty_constructor).ty(ctx.db()).instantiate([ty.clone()])
                         })
                         .unwrap_or_else(|| ty.clone());
                     (ast_ty, semantic_ty)
@@ -256,7 +256,7 @@ fn wrapper_alias<'db>(
             );
 
             let new_ty =
-                hir::Adt::from(enum_ty).ty_with_args(ctx.db(), [semantic_ret_type.clone()]);
+                hir::Adt::from(enum_ty).ty(ctx.db()).instantiate([semantic_ret_type.clone()]);
 
             Some((make.ty_path(path), new_ty))
         })
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 d3ee35a..15572e5 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
@@ -204,8 +204,8 @@ fn main() {
 "#####,
         r#####"
 fn main() {
-    ${1:'l}: loop {
-        break ${2:'l};
+    ${0:'l}: loop {
+        break ${0:'l};
         continue ${0:'l};
     }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/utils.rs b/src/tools/rust-analyzer/crates/ide-assists/src/utils.rs
index 096f667..1b6c9a5 100644
--- a/src/tools/rust-analyzer/crates/ide-assists/src/utils.rs
+++ b/src/tools/rust-analyzer/crates/ide-assists/src/utils.rs
@@ -417,6 +417,7 @@ fn check_pat_variant_nested_or_literal_with_depth(
         | ast::Pat::PathPat(_)
         | ast::Pat::BoxPat(_)
         | ast::Pat::DerefPat(_)
+        | ast::Pat::NotNull(_)
         | ast::Pat::ConstBlockPat(_) => true,
 
         ast::Pat::IdentPat(ident_pat) => ident_pat.pat().is_some_and(|pat| {
@@ -841,8 +842,8 @@ pub(crate) fn convert_reference_type<'db>(
 }
 
 fn could_deref_to_target(ty: &hir::Type<'_>, target: &hir::Type<'_>, db: &dyn HirDatabase) -> bool {
-    let ty_ref = ty.add_reference(hir::Mutability::Shared);
-    let target_ref = target.add_reference(hir::Mutability::Shared);
+    let ty_ref = ty.add_reference(db, hir::Mutability::Shared);
+    let target_ref = target.add_reference(db, hir::Mutability::Shared);
     ty_ref.could_coerce_to(db, &target_ref)
 }
 
@@ -870,7 +871,7 @@ fn handle_as_ref_slice(
     famous_defs: &FamousDefs<'_, '_>,
 ) -> Option<(ReferenceConversionType, bool)> {
     let type_argument = ty.type_arguments().next()?;
-    let slice_type = hir::Type::new_slice(type_argument);
+    let slice_type = hir::Type::new_slice(db, type_argument);
 
     ty.impls_trait(db, famous_defs.core_convert_AsRef()?, slice::from_ref(&slice_type)).then_some((
         ReferenceConversionType::AsRefSlice,
@@ -1181,13 +1182,5 @@ pub(crate) fn is_never_block(
     sema: &Semantics<'_, RootDatabase>,
     block_expr: &ast::BlockExpr,
 ) -> bool {
-    if let Some(tail_expr) = block_expr.tail_expr() {
-        sema.type_of_expr(&tail_expr).is_some_and(|ty| ty.original.is_never())
-    } else if let Some(ast::Stmt::ExprStmt(expr_stmt)) = block_expr.statements().last()
-        && let Some(expr) = expr_stmt.expr()
-    {
-        sema.type_of_expr(&expr).is_some_and(|ty| ty.original.is_never())
-    } else {
-        false
-    }
+    sema.expr_is_diverging(&block_expr.clone().into())
 }
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions.rs
index f3190bb..20048ea 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/completions.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions.rs
@@ -199,10 +199,10 @@ pub(crate) fn add_keyword_snippet(
         item.add_to(self, ctx.db);
     }
 
-    pub(crate) fn add_expr(
+    pub(crate) fn add_expr<'db>(
         &mut self,
-        ctx: &CompletionContext<'_, '_>,
-        expr: &hir::term_search::Expr<'_>,
+        ctx: &CompletionContext<'_, 'db>,
+        expr: &hir::term_search::Expr<'db>,
     ) {
         if let Some(item) = render_expr(ctx, expr) {
             item.add_to(self, ctx.db)
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/dot.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/dot.rs
index 2cc2200..59c6c55 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/dot.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/dot.rs
@@ -1,9 +1,9 @@
 //! Completes references after dot (fields and method calls).
 
-use std::ops::ControlFlow;
+use std::{collections::hash_map, ops::ControlFlow};
 
-use hir::{Complete, Function, HasContainer, ItemContainer, MethodCandidateCallback};
-use ide_db::FxHashSet;
+use hir::{Complete, Function, HasContainer, ItemContainer, MethodCandidateCallback, Name};
+use ide_db::{FxHashMap, FxHashSet};
 use itertools::Either;
 use syntax::SmolStr;
 
@@ -93,7 +93,7 @@ pub(crate) fn complete_dot(
         // Does <&receiver_ty as IntoIterator>::IntoIter` exist? Assume `iter` is valid
         let iter = receiver_ty
             .autoderef(ctx.db)
-            .map(|ty| ty.strip_references().add_reference(hir::Mutability::Shared))
+            .map(|ty| ty.strip_references().add_reference(ctx.db, hir::Mutability::Shared))
             .find_map(|ty| ty.into_iterator_iter(ctx.db))
             .map(|ty| (ty, SmolStr::new_static("iter()")));
         // Does <receiver_ty as IntoIterator>::IntoIter` exist?
@@ -239,6 +239,9 @@ struct Callback<'a, 'db, F> {
         // duplicated, trait methods can. And it is still useful to show all of them (even when there
         // is also an inherent method, especially considering that it may be private, and filtered later).
         seen_methods: FxHashSet<Function>,
+        // However, duplicate inherent methods is usually meaningless
+        // https://github.com/rust-lang/rust-analyzer/issues/20773#issuecomment-4302781553
+        seen_inherent_methods: FxHashMap<Name, Function>,
     }
 
     impl<F> MethodCandidateCallback for Callback<'_, '_, F>
@@ -249,7 +252,21 @@ impl<F> MethodCandidateCallback for Callback<'_, '_, F>
         // `where` clauses or `dyn Trait`.
         fn on_inherent_method(&mut self, func: hir::Function) -> ControlFlow<()> {
             if func.self_param(self.ctx.db).is_some() && self.seen_methods.insert(func) {
-                (self.f)(func);
+                let same_name = self.seen_inherent_methods.entry(func.name(self.ctx.db));
+                let do_complete = match &same_name {
+                    hash_map::Entry::Vacant(_) => true,
+                    hash_map::Entry::Occupied(same_func) => {
+                        match self.ctx.is_visible(same_func.get()) {
+                            crate::context::Visible::Yes => false,
+                            crate::context::Visible::Editable => true,
+                            crate::context::Visible::No => true,
+                        }
+                    }
+                };
+                if do_complete {
+                    same_name.insert_entry(func);
+                    (self.f)(func);
+                }
             }
             ControlFlow::Continue(())
         }
@@ -277,7 +294,12 @@ fn on_trait_method(&mut self, func: hir::Function) -> ControlFlow<()> {
         &ctx.scope,
         traits_in_scope,
         None,
-        Callback { ctx, f, seen_methods: FxHashSet::default() },
+        Callback {
+            ctx,
+            f,
+            seen_methods: FxHashSet::default(),
+            seen_inherent_methods: FxHashMap::default(),
+        },
     );
 }
 
@@ -870,6 +892,86 @@ fn test(a: A) {
     }
 
     #[test]
+    fn test_inherent_method_no_same_name() {
+        check_no_kw(
+            r#"
+//- minicore: deref
+struct A {}
+struct B {}
+impl core::ops::Deref for A {
+    type Target = B;
+    fn deref(&self) -> &Self::Target { loop {} }
+}
+trait Foo { fn foo(&self) -> u32 {} }
+impl Foo for A {}
+impl Foo for B {}
+impl A { fn foo(&self) -> u8 {} }
+impl B { fn foo(&self) -> u16 {} }
+fn test(a: A) {
+    a.$0
+}
+"#,
+            expect![[r#"
+                me deref() (use core::ops::Deref) fn(&self) -> &<Self as Deref>::Target
+                me foo()                                                fn(&self) -> u8
+                me foo() (as Foo)                                      fn(&self) -> u32
+            "#]],
+        );
+
+        check_no_kw(
+            r#"
+//- minicore: deref
+//- /dep.rs crate:dep
+pub struct A {}
+pub struct B {}
+pub struct C {}
+pub struct D {}
+pub struct E {}
+pub struct F {}
+impl core::ops::Deref for A {
+    type Target = B;
+    fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::Deref for B {
+    type Target = C;
+    fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::Deref for C {
+    type Target = D;
+    fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::Deref for D {
+    type Target = E;
+    fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::Deref for E {
+    type Target = F;
+    fn deref(&self) -> &Self::Target { loop {} }
+}
+pub trait Foo { fn foo(&self) -> u32 {} }
+impl Foo for A {}
+impl Foo for B {}
+impl A { fn foo(&self) -> u8 {} }
+impl B { pub fn foo(&self) -> u16 {} }
+impl C { fn foo(&self) -> i8 {} }
+impl D { fn foo(&self) -> i16 {} }
+impl E { pub fn foo(&self) -> i32 {} }
+impl F { pub fn foo(&self) -> f32 {} }
+//- /main.rs crate:main deps:dep
+use dep::*;
+fn test(a: A) {
+    a.$0
+}
+"#,
+            expect![[r#"
+                me deref() (use core::ops::Deref) fn(&self) -> &<Self as Deref>::Target
+                me foo()                                               fn(&self) -> u16
+                me foo() (as Foo)                                      fn(&self) -> u32
+            "#]],
+        );
+    }
+
+    #[test]
     fn test_completion_works_in_consts() {
         check_no_kw(
             r#"
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs
index a2a4cba..8d90606 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs
@@ -182,6 +182,9 @@ pub(crate) fn complete_expr_path(
                         }
                         _ => return,
                     };
+                    // Note: this is not *required* here, we do it to also find methods that require
+                    // the type to be instantiated with specific types.
+                    let ty = ty.instantiate_with_errors();
 
                     if let Some(hir::Adt::Enum(e)) = ty.as_adt() {
                         cov_mark::hit!(completes_variant_through_alias);
@@ -317,12 +320,7 @@ pub(crate) fn complete_expr_path(
                 }
                 // synthetic names currently leak out as we lack synthetic hygiene, so filter them
                 // out here
-                ScopeDef::Local(_) =>
-                {
-                    #[expect(
-                        clippy::collapsible_match,
-                        reason = "this changes meaning, causing the next arm to be selected"
-                    )]
+                ScopeDef::Local(_) => {
                     if !name.as_str().starts_with('<') {
                         acc.add_path_resolution(ctx, path_ctx, name, def, doc_aliases)
                     }
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs
index 0cb39dd..540089c 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs
@@ -259,7 +259,7 @@ pub(crate) fn complete_postfix(
                     postfix_snippet(
                         "lete",
                         "let Ok else {}",
-                        format!("let Ok({placeholder}) = {receiver_text} else {{\n    $2\n}};\n$0"),
+                        format!("let Ok({placeholder}) = {receiver_text} else {{\n    $2\n}};$0"),
                     )
                     .add_to(acc, ctx.db);
 
@@ -281,9 +281,7 @@ pub(crate) fn complete_postfix(
                     postfix_snippet(
                         "lete",
                         "let Some else {}",
-                        format!(
-                            "let Some({placeholder}) = {receiver_text} else {{\n    $2\n}};\n$0"
-                        ),
+                        format!("let Some({placeholder}) = {receiver_text} else {{\n    $2\n}};$0"),
                     )
                     .add_to(acc, ctx.db);
 
@@ -1101,8 +1099,28 @@ fn main() {
     let bar = Some(true);
     let Some(${1:bar}) = bar else {
     $2
-};
-$0
+};$0
+}
+"#,
+        );
+
+        check_edit(
+            "lete",
+            r#"
+//- minicore: option
+fn main() {
+    let bar = Some(true);
+    bar.$0
+    other();
+}
+"#,
+            r#"
+fn main() {
+    let bar = Some(true);
+    let Some(${1:bar}) = bar else {
+    $2
+};$0
+    other();
 }
 "#,
         );
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/record.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/record.rs
index 1238a91..16e89bd 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/record.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/record.rs
@@ -1,7 +1,8 @@
 //! Complete fields in record literals and patterns.
 use ide_db::SymbolKind;
 use syntax::{
-    SmolStr,
+    SmolStr, T,
+    algo::next_non_trivia_token,
     ast::{self, Expr},
 };
 
@@ -28,11 +29,7 @@ pub(crate) fn complete_record_pattern_fields(
                     record_pat.record_pat_field_list().and_then(|fl| fl.fields().next()).is_some();
 
                 match were_fields_specified {
-                    false => un
-                        .fields(ctx.db)
-                        .into_iter()
-                        .map(|f| (f, f.ty(ctx.db).to_type(ctx.db)))
-                        .collect(),
+                    false => un.fields(ctx.db).into_iter().map(|f| (f, f.ty(ctx.db))).collect(),
                     true => return,
                 }
             }
@@ -60,11 +57,7 @@ pub(crate) fn complete_record_expr_fields(
                 record_expr.record_expr_field_list().and_then(|fl| fl.fields().next()).is_some();
 
             match were_fields_specified {
-                false => un
-                    .fields(ctx.db)
-                    .into_iter()
-                    .map(|f| (f, f.ty(ctx.db).to_type(ctx.db)))
-                    .collect(),
+                false => un.fields(ctx.db).into_iter().map(|f| (f, f.ty(ctx.db))).collect(),
                 true => return,
             }
         }
@@ -105,7 +98,9 @@ pub(crate) fn add_default_update(
     let impls_default_trait = default_trait
         .zip(ty)
         .is_some_and(|(default_trait, ty)| ty.original.impls_trait(ctx.db, default_trait, &[]));
-    if impls_default_trait {
+    let ends_of_record_list =
+        next_non_trivia_token(ctx.token.clone()).is_none_or(|it| it.kind() == T!['}']);
+    if impls_default_trait && ends_of_record_list {
         // FIXME: This should make use of scope_def like completions so we get all the other goodies
         // that is we should handle this like actually completing the default function
         let completion_text = "..Default::default()";
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/config.rs b/src/tools/rust-analyzer/crates/ide-completion/src/config.rs
index 21f624b..ac52c81 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/config.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/config.rs
@@ -44,6 +44,7 @@ pub struct CompletionConfig<'a> {
 pub enum AutoImportExclusionType {
     Always,
     Methods,
+    SubItems,
 }
 
 #[derive(Clone, Debug, PartialEq, Eq)]
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/context.rs b/src/tools/rust-analyzer/crates/ide-completion/src/context.rs
index f7fced3..f7bb143 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/context.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/context.rs
@@ -611,7 +611,7 @@ pub(crate) fn check_stability(&self, attrs: Option<&hir::AttrsWithOwner>) -> boo
         let Some(unstable_feature) = attrs.unstable_feature(self.db) else {
             return true;
         };
-        !INTERNAL_FEATURES.contains(&unstable_feature)
+        !is_internal_feature(&unstable_feature)
             || self.krate.is_unstable_feature_enabled(self.db, &unstable_feature)
     }
 
@@ -729,6 +729,13 @@ pub(crate) fn doc_aliases_in_scope(&self, scope_def: ScopeDef) -> Vec<SmolStr> {
             vec![]
         }
     }
+
+    pub(crate) fn rebase_ty(&self, ty: &hir::Type<'db>) -> hir::Type<'db> {
+        self.scope
+            .generic_def()
+            .and_then(|def| ty.try_rebase_into_owner(self.db, def))
+            .unwrap_or_else(|| ty.instantiate_with_errors())
+    }
 }
 
 // CompletionContext construction
@@ -848,8 +855,23 @@ pub(crate) fn new(
                     .map(|it| (it.into_module_def(), *kind))
             })
             .collect();
+        let exclude_subitems = exclude_flyimport
+            .iter()
+            .flat_map(|it| match it {
+                (ModuleDef::Module(module), AutoImportExclusionType::SubItems) => {
+                    module.scope(db, None)
+                }
+                _ => vec![],
+            })
+            .filter_map(|(_, def)| match def {
+                ScopeDef::ModuleDef(module_def) => Some(module_def),
+                _ => None,
+            })
+            .collect::<Vec<_>>();
         exclude_flyimport
             .extend(exclude_traits.iter().map(|&t| (t.into(), AutoImportExclusionType::Always)));
+        exclude_flyimport
+            .extend(exclude_subitems.into_iter().map(|it| (it, AutoImportExclusionType::Always)));
 
         // FIXME: This should be part of `CompletionAnalysis` / `expand_and_analyze`
         let complete_semicolon = if !config.add_semicolon_to_unit {
@@ -858,7 +880,13 @@ pub(crate) fn new(
             sema.token_ancestors_with_macros(token.clone()).find(|node| {
                 matches!(
                     node.kind(),
-                    BLOCK_EXPR | MATCH_ARM | CLOSURE_EXPR | ARG_LIST | PAREN_EXPR | ARRAY_EXPR
+                    BLOCK_EXPR
+                        | MATCH_ARM
+                        | CLOSURE_EXPR
+                        | ARG_LIST
+                        | PAREN_EXPR
+                        | ARRAY_EXPR
+                        | MATCH_EXPR
                 )
             })
         {
@@ -949,6 +977,7 @@ pub(crate) fn new(
     sym::eii_internals,
     sym::field_representing_type_raw,
     sym::intrinsics,
+    sym::core_intrinsics,
     sym::lang_items,
     sym::link_cfg,
     sym::more_maybe_bounds,
@@ -972,3 +1001,12 @@ pub(crate) fn new(
 
 static INTERNAL_FEATURES: LazyLock<FxHashSet<Symbol>> =
     LazyLock::new(|| INTERNAL_FEATURES_LIST.iter().cloned().collect());
+
+fn is_internal_feature(feature: &Symbol) -> bool {
+    if INTERNAL_FEATURES.contains(feature) {
+        return true;
+    }
+    // Libs features are internal if they end in `_internal` or `_internals`.
+    let feature = feature.as_str();
+    feature.ends_with("_internal") || feature.ends_with("_internals")
+}
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs b/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs
index faeb97f..b2ee94d 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs
@@ -641,13 +641,23 @@ fn expected_type_and_name<'db>(
             }
             for _ in refs_level..0 {
                 cov_mark::hit!(expected_type_fn_param_deref);
-                ty = ty.add_reference(hir::Mutability::Shared);
+                ty = ty.add_reference(sema.db, hir::Mutability::Shared);
             }
             ty
         }
         _ => ty,
     };
 
+    let mut generic_def = None;
+    let mut rebase_ty = {
+        let node = node.clone();
+        move |ty: hir::Type<'db>| {
+            let def = *generic_def
+                .get_or_insert_with(|| sema.scope(&node).and_then(|scope| scope.generic_def()));
+            def.and_then(|def| ty.try_rebase_into_owner(sema.db, def))
+                .unwrap_or_else(|| ty.instantiate_with_errors())
+        }
+    };
     let (ty, name) = loop {
         break match_ast! {
             match node {
@@ -791,26 +801,22 @@ fn expected_type_and_name<'db>(
                     (ty, None)
                 },
                 ast::TupleStructPat(it) => {
-                    let fields = it.path().and_then(|path| match sema.resolve_path(&path)? {
-                        hir::PathResolution::Def(hir::ModuleDef::Adt(adt)) => Some(adt.as_struct()?.fields(sema.db)),
-                        hir::PathResolution::Def(hir::ModuleDef::EnumVariant(variant)) => Some(variant.fields(sema.db)),
-                        _ => None,
-                    });
+                    let fields = sema.resolve_tuple_struct_pat_fields(&it);
                     let nr = it.fields().take_while(|it| it.syntax().text_range().end() <= token.text_range().start()).count();
-                    let ty = fields.and_then(|fields| Some(fields.get(nr)?.ty(sema.db).to_type(sema.db)));
+                    let ty = fields.and_then(|fields| Some(rebase_ty(fields.get(nr)?.1.clone())));
                     (ty, None)
                 },
                 ast::Fn(it) => {
                     cov_mark::hit!(expected_type_fn_ret_with_leading_char);
                     cov_mark::hit!(expected_type_fn_ret_without_leading_char);
                     let def = sema.to_def(&it);
-                    (def.map(|def| def.ret_type(sema.db)), None)
+                    (def.map(|def| rebase_ty(def.ret_type(sema.db))), None)
                 },
                 ast::ReturnExpr(it) => {
                     let fn_ = sema.ancestors_with_macros(it.syntax().clone())
                         .find_map(Either::<ast::Fn, ast::ClosureExpr>::cast);
                     let ty = fn_.and_then(|f| match f {
-                        Either::Left(f) => Some(sema.to_def(&f)?.ret_type(sema.db)),
+                        Either::Left(f) => Some(rebase_ty(sema.to_def(&f)?.ret_type(sema.db))),
                         Either::Right(f) => {
                             let ty = sema.type_of_expr(&f.into())?.original.as_callable(sema.db)?;
                             Some(ty.return_type())
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/context/tests.rs b/src/tools/rust-analyzer/crates/ide-completion/src/context/tests.rs
index 94d9049..1d1a55c 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/context/tests.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/context/tests.rs
@@ -329,6 +329,27 @@ fn foo(x: Foo) -> Foo {
 "#,
         expect![[r#"ty: u32, name: ?"#]],
     );
+
+    check_expected_type_and_name(
+        r#"
+//- minicore: option
+struct Foo<T>(T);
+fn foo(x: Foo<Option<i32>>) -> Foo {
+   match x { Foo($0) => () }
+}
+"#,
+        expect![[r#"ty: Option<i32>, name: ?"#]],
+    );
+    check_expected_type_and_name(
+        r#"
+//- minicore: option
+enum Foo<T> { Var(T) };
+fn foo(x: Foo<Option<i32>>) -> Foo {
+   match x { Foo::Var($0) => () }
+}
+"#,
+        expect![[r#"ty: Option<i32>, name: ?"#]],
+    );
 }
 
 #[test]
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/item.rs b/src/tools/rust-analyzer/crates/ide-completion/src/item.rs
index cfadec6..61281f8 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/item.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/item.rs
@@ -181,6 +181,9 @@ pub struct CompletionRelevance {
     /// }
     /// ```
     pub is_local: bool,
+    /// This is missing variant in the patterns.
+    /// Maybe this can also be used for struct fields.
+    pub is_missing: bool,
     /// Populated when the completion item comes from a trait (impl).
     pub trait_: Option<CompletionRelevanceTraitInfo>,
     /// This is set when an import is suggested in a use item whose name is already imported.
@@ -286,6 +289,7 @@ pub fn score(self) -> u32 {
             exact_name_match,
             type_match,
             is_local,
+            is_missing,
             is_name_already_imported,
             requires_import,
             is_private_editable,
@@ -300,16 +304,19 @@ pub fn score(self) -> u32 {
         // only applicable for completions within use items
         // lower rank for conflicting import names
         if is_name_already_imported {
-            score -= 1;
+            score -= 15;
         }
         // slightly prefer locals
         if is_local {
-            score += 1;
+            score += 2;
+        }
+        if is_missing {
+            score += 2;
         }
 
         // lower rank private things
         if !is_private_editable {
-            score += 1;
+            score += 10;
         }
 
         if let Some(trait_) = trait_ {
@@ -330,10 +337,10 @@ pub fn score(self) -> u32 {
 
         // lower rank for items that need an import
         if requires_import {
-            score -= 1;
+            score -= 12;
         }
         if exact_name_match {
-            score += 20;
+            score += 40;
         }
         match postfix_match {
             Some(CompletionRelevancePostfixMatch::Exact) => score += 100,
@@ -341,16 +348,26 @@ pub fn score(self) -> u32 {
             None => (),
         };
         score += match type_match {
-            Some(CompletionRelevanceTypeMatch::Exact) => 18,
-            Some(CompletionRelevanceTypeMatch::CouldUnify) => 5,
+            Some(CompletionRelevanceTypeMatch::Exact) => 35,
+            Some(CompletionRelevanceTypeMatch::CouldUnify) => 15,
             None => 0,
         };
         if let Some(function) = function {
-            let mut fn_score = match function.return_type {
-                CompletionRelevanceReturnType::DirectConstructor => 15,
-                CompletionRelevanceReturnType::Builder => 10,
-                CompletionRelevanceReturnType::Constructor => 5,
-                CompletionRelevanceReturnType::Other => 0u32,
+            let mut fn_score = if requires_import {
+                // Rank constructors that require imports lower than those who don't.
+                match function.return_type {
+                    CompletionRelevanceReturnType::DirectConstructor => 8,
+                    CompletionRelevanceReturnType::Builder => 5,
+                    CompletionRelevanceReturnType::Constructor => 3,
+                    CompletionRelevanceReturnType::Other => 0u32,
+                }
+            } else {
+                match function.return_type {
+                    CompletionRelevanceReturnType::DirectConstructor => 15,
+                    CompletionRelevanceReturnType::Builder => 10,
+                    CompletionRelevanceReturnType::Constructor => 5,
+                    CompletionRelevanceReturnType::Other => 0u32,
+                }
             };
 
             // When a fn is bumped due to return type:
@@ -368,12 +385,12 @@ pub fn score(self) -> u32 {
         };
 
         if has_local_inherent_impl {
-            score -= 5;
+            score -= 8;
         }
 
         // lower rank for deprecated items
         if is_deprecated {
-            score -= 5;
+            score -= 15;
         }
 
         score
@@ -824,15 +841,17 @@ fn relevance_score() {
                 is_private_editable: true,
                 ..default
             }],
-            vec![Cr {
-                trait_: Some(crate::item::CompletionRelevanceTraitInfo {
-                    notable_trait: false,
-                    is_op_method: true,
-                }),
-                ..default
-            }],
+            vec![
+                Cr {
+                    trait_: Some(crate::item::CompletionRelevanceTraitInfo {
+                        notable_trait: false,
+                        is_op_method: true,
+                    }),
+                    ..default
+                },
+                Cr { is_private_editable: true, ..default },
+            ],
             vec![Cr { postfix_match: Some(CompletionRelevancePostfixMatch::NonExact), ..default }],
-            vec![Cr { is_private_editable: true, ..default }],
             vec![default],
             vec![Cr { is_local: true, ..default }],
             vec![Cr { type_match: Some(CompletionRelevanceTypeMatch::CouldUnify), ..default }],
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 fbbdffe..e48847c 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/render.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/render.rs
@@ -71,7 +71,7 @@ fn snippet_cap(&self) -> Option<SnippetCap> {
         self.completion.config.snippet_cap
     }
 
-    fn db(&self) -> &'a RootDatabase {
+    fn db(&self) -> &'db RootDatabase {
         self.completion.db
     }
 
@@ -181,9 +181,9 @@ pub(crate) fn render_field(
 
         if !expected_fn_type
             && let Some(receiver) = &dot_access.receiver
-            && let Some(receiver) = ctx.completion.sema.original_ast_node(receiver.clone())
+            && let Some(receiver) = ctx.completion.sema.original_range_opt(receiver.syntax())
         {
-            builder.insert(receiver.syntax().text_range().start(), "(".to_owned());
+            builder.insert(receiver.range.start(), "(".to_owned());
             builder.insert(ctx.source_range().end(), ")".to_owned());
 
             let is_parens_needed = !matches!(dot_access.kind, DotAccessKind::Method);
@@ -198,10 +198,10 @@ pub(crate) fn render_field(
         item.insert_text(field_with_receiver(receiver.as_deref(), &escaped_name));
     }
     if let Some(receiver) = &dot_access.receiver
-        && let Some(original) = ctx.completion.sema.original_ast_node(receiver.clone())
+        && let Some(original) = ctx.completion.sema.original_range_opt(receiver.syntax())
         && let Some(ref_mode) = compute_ref_match(ctx.completion, ty)
     {
-        item.ref_match(ref_mode, original.syntax().text_range().start());
+        item.ref_match(ref_mode, original.range.start());
     }
     item.doc_aliases(ctx.doc_aliases);
     item.build(db)
@@ -294,9 +294,9 @@ pub(crate) fn render_resolution_with_import_pat(
     Some(render_resolution_pat(ctx, pattern_ctx, local_name, Some(import_edit), resolution))
 }
 
-pub(crate) fn render_expr(
-    ctx: &CompletionContext<'_, '_>,
-    expr: &hir::term_search::Expr<'_>,
+pub(crate) fn render_expr<'db>(
+    ctx: &CompletionContext<'_, 'db>,
+    expr: &hir::term_search::Expr<'db>,
 ) -> Option<Builder> {
     let mut i = 1;
     let mut snippet_formatter = |ty: &hir::Type<'_>| {
@@ -341,7 +341,7 @@ pub(crate) fn render_expr(
         "Autogenerated expression by term search",
     )));
     item.set_relevance(crate::CompletionRelevance {
-        type_match: compute_type_match(ctx, &expr.ty(ctx.db)),
+        type_match: compute_type_match(ctx, &ctx.rebase_ty(&expr.ty(ctx.db))),
         ..Default::default()
     });
     for trait_ in expr.traits_used(ctx.db) {
@@ -405,8 +405,8 @@ fn render_resolution_pat(
     }
 }
 
-fn render_resolution_path(
-    ctx: RenderContext<'_, '_>,
+fn render_resolution_path<'db>(
+    ctx: RenderContext<'_, 'db>,
     path_ctx: &PathCompletionCtx<'_>,
     local_name: hir::Name,
     import_to_add: Option<LocatedImport>,
@@ -471,18 +471,21 @@ fn render_resolution_path(
                 .insert_snippet(cap, ""); // set is snippet
         }
     }
-    let allow_module_path = matches!(path_ctx.kind, PathKind::Use) || !config.add_colons_to_module;
+    let allow_module_path = matches!(path_ctx.kind, PathKind::Use)
+        || completion.token.next_token().is_some_and(|it| it.kind() == syntax::T![::])
+        || !config.add_colons_to_module;
     if !allow_module_path && matches!(resolution, ScopeDef::ModuleDef(Module(_))) {
         insert_text = format_smolstr!("{insert_text}::");
         item.lookup_by(name.clone()).label(insert_text.clone());
     }
     adds_ret_type_arrow(completion, path_ctx, &mut item, insert_text.into());
 
-    let mut set_item_relevance = |ty: Type<'_>| {
+    let mut set_item_relevance = |ty: Type<'db>| {
         if !ty.is_unknown() {
             item.detail(ty.display(db, krate).to_string());
         }
 
+        let ty = completion.rebase_ty(&ty);
         item.set_relevance(CompletionRelevance {
             type_match: compute_type_match(completion, &ty),
             exact_name_match: compute_exact_name_match(completion, &name),
@@ -492,7 +495,13 @@ fn render_resolution_path(
             ..CompletionRelevance::default()
         });
 
-        path_ref_match(completion, path_ctx, &ty, &mut item);
+        match resolution {
+            ScopeDef::Local(_)
+            | ScopeDef::ModuleDef(ModuleDef::Const(_) | ModuleDef::Static(_)) => {
+                path_ref_match(completion, path_ctx, &ty, &mut item)
+            }
+            _ => (),
+        }
     };
 
     match resolution {
@@ -680,8 +689,8 @@ fn compute_type_match(
 
     // &mut ty -> &ty
     if completion_ty.is_mutable_reference()
-        && let Some(expected_type) = expected_type.remove_ref()
-        && let Some(completion_ty) = completion_ty.remove_ref()
+        && let Some((expected_type, _)) = expected_type.as_reference()
+        && let Some((completion_ty, _)) = completion_ty.as_reference()
     {
         return match_types(ctx, &expected_type, &completion_ty);
     }
@@ -709,18 +718,19 @@ fn compute_ref_match(
     ctx: &CompletionContext<'_, '_>,
     completion_ty: &hir::Type<'_>,
 ) -> Option<CompletionItemRefMode> {
-    let expected_type = ctx.expected_type.as_ref()?;
-    let expected_without_ref = expected_type.remove_ref();
-    let completion_without_ref = completion_ty.remove_ref();
-    if expected_type.could_unify_with(ctx.db, completion_ty) {
+    if compute_type_match(ctx, completion_ty).is_some() || completion_ty.is_unit() {
         return None;
     }
-    if let Some(expected_without_ref) = &expected_without_ref
+    let expected_type = ctx.expected_type.as_ref()?;
+    let expected_without_ref = expected_type.as_reference();
+    let completion_without_ref = completion_ty.as_reference();
+
+    if let Some((expected_without_ref, _)) = &expected_without_ref
         && (completion_without_ref.is_none()
             || completion_ty.could_unify_with(ctx.db, expected_without_ref))
         && completion_ty
             .autoderef(ctx.db)
-            .any(|ty| ty.could_unify_with(ctx.db, expected_without_ref))
+            .any(|ty| !ty.is_unknown() && ty.could_unify_with(ctx.db, expected_without_ref))
     {
         cov_mark::hit!(suggest_ref);
         let mutability = if expected_type.is_mutable_reference() {
@@ -731,7 +741,7 @@ fn compute_ref_match(
         return Some(CompletionItemRefMode::Reference(mutability));
     }
 
-    if let Some(completion_without_ref) = completion_without_ref
+    if let Some((completion_without_ref, _)) = completion_without_ref
         && completion_without_ref == *expected_type
         && completion_without_ref.is_copy(ctx.db)
     {
@@ -750,10 +760,10 @@ fn path_ref_match(
 ) {
     if let Some(original_path) = &path_ctx.original_path {
         // At least one char was typed by the user already, in that case look for the original path
-        if let Some(original_path) = completion.sema.original_ast_node(original_path.clone())
+        if let Some(original_path) = completion.sema.original_range_opt(original_path.syntax())
             && let Some(ref_mode) = compute_ref_match(completion, ty)
         {
-            item.ref_match(ref_mode, original_path.syntax().text_range().start());
+            item.ref_match(ref_mode, original_path.range.start());
         }
     } else {
         // completion requested on an empty identifier, there is no path here yet.
@@ -865,6 +875,7 @@ fn display_relevance(relevance: CompletionRelevance) -> String {
                 exact_name_match,
                 type_match,
                 is_local,
+                is_missing,
                 trait_,
                 is_name_already_imported: _,
                 requires_import,
@@ -880,6 +891,7 @@ fn display_relevance(relevance: CompletionRelevance) -> String {
                 (type_match == Some(CompletionRelevanceTypeMatch::CouldUnify), "type_could_unify"),
                 (exact_name_match, "name"),
                 (is_local, "local"),
+                (is_missing, "missing"),
                 (postfix_match == Some(CompletionRelevancePostfixMatch::Exact), "snippet"),
                 (trait_.is_some_and(|it| it.is_op_method), "op_method"),
                 (requires_import, "requires_import"),
@@ -944,9 +956,9 @@ fn main() {
 }
 "#,
             expect![[r#"
-                st dep::test_mod_b::Struct {…} dep::test_mod_b::Struct {  } [type_could_unify]
-                ex dep::test_mod_b::Struct {  }  [type_could_unify]
-                st Struct Struct [type_could_unify+requires_import]
+                st dep::test_mod_b::Struct {…} dep::test_mod_b::Struct {  } [type]
+                ex dep::test_mod_b::Struct {  }  [type]
+                st Struct Struct [type+requires_import]
                 md dep::  []
                 fn main() fn() []
                 fn test(…) fn(Struct) []
@@ -984,7 +996,7 @@ fn main() {
 }
 "#,
             expect![[r#"
-                un Union Union [type_could_unify+requires_import]
+                un Union Union [type+requires_import]
                 md dep::  []
                 fn main() fn() []
                 fn test(…) fn(Union) []
@@ -1020,9 +1032,9 @@ fn main() {
 }
 "#,
             expect![[r#"
-                ev dep::test_mod_b::Enum::variant dep::test_mod_b::Enum::variant [type_could_unify]
-                ex dep::test_mod_b::Enum::variant  [type_could_unify]
-                en Enum Enum [type_could_unify+requires_import]
+                ev dep::test_mod_b::Enum::variant dep::test_mod_b::Enum::variant [type]
+                ex dep::test_mod_b::Enum::variant  [type]
+                en Enum Enum [type+requires_import]
                 md dep::  []
                 fn main() fn() []
                 fn test(…) fn(Enum) []
@@ -1058,11 +1070,13 @@ fn main() {
 }
 "#,
             expect![[r#"
-                ev dep::test_mod_b::Enum::Variant dep::test_mod_b::Enum::Variant [type_could_unify]
-                ex dep::test_mod_b::Enum::Variant  [type_could_unify]
+                ev dep::test_mod_b::Enum::Variant dep::test_mod_b::Enum::Variant [type]
+                ex dep::test_mod_b::Enum::Variant  [type]
+                ev Variant Variant [type+requires_import]
                 md dep::  []
                 fn main() fn() []
                 fn test(…) fn(Enum) []
+                ev Variant Variant [requires_import]
             "#]],
         );
     }
@@ -1122,7 +1136,7 @@ fn main() {
 }
 "#,
             expect![[r#"
-                ct CONST i32 [type_could_unify+requires_import]
+                ct CONST i32 [type+requires_import]
                 md dep::  []
                 fn main() fn() []
                 fn test(…) fn(i32) []
@@ -1154,7 +1168,7 @@ fn main() {
 }
 "#,
             expect![[r#"
-                sc STATIC i32 [type_could_unify+requires_import]
+                sc STATIC i32 [type+requires_import]
                 md dep::  []
                 fn main() fn() []
                 fn test(…) fn(i32) []
@@ -1281,6 +1295,7 @@ fn main() { Foo::Fo$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1333,6 +1348,7 @@ fn main() { Foo::Fo$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1478,6 +1494,7 @@ fn main() { Foo::Fo$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1564,6 +1581,7 @@ fn main() { let _: m::Spam = S$0 }
                                 Exact,
                             ),
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1602,6 +1620,7 @@ fn main() { let _: m::Spam = S$0 }
                                 Exact,
                             ),
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1653,6 +1672,7 @@ fn main() { som$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1712,6 +1732,7 @@ fn main() { som$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1755,6 +1776,7 @@ fn main() { A$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1798,6 +1820,7 @@ fn main() { A$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1843,6 +1866,7 @@ fn main() { A::$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1879,6 +1903,7 @@ fn main() { A::$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1929,6 +1954,7 @@ fn main() { A$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -1972,6 +1998,7 @@ fn main() { A$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2012,6 +2039,7 @@ impl A$0
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2052,6 +2080,7 @@ fn main() { A$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2096,6 +2125,7 @@ fn main() { a$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2140,6 +2170,7 @@ fn main() { A { the$0 } }
                                 CouldUnify,
                             ),
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2195,6 +2226,7 @@ fn bar(self) { self.$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2288,6 +2320,7 @@ enum E {
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2360,6 +2393,7 @@ fn foo(s: S) { s.$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2580,6 +2614,7 @@ fn f() -> i32 {
                                 Exact,
                             ),
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2639,7 +2674,6 @@ fn go(world: &WorldSnapshot) { go(w$0) }
                 st WorldSnapshot {…} WorldSnapshot { _f: () } []
                 st &WorldSnapshot {…} [type]
                 st WorldSnapshot WorldSnapshot []
-                st &WorldSnapshot [type]
                 fn go(…) fn(&WorldSnapshot) []
             "#]],
         );
@@ -2687,6 +2721,7 @@ fn main() {
                             exact_name_match: false,
                             type_match: None,
                             is_local: true,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -2705,6 +2740,204 @@ fn main() {
     }
 
     #[test]
+    fn complete_ref_match_in_macro() {
+        check_kinds(
+            r#"
+macro_rules! id { ($($t:tt)*) => ($($t)*); }
+fn foo(data: &i32) {}
+fn main() {
+    let indent = 2i32;
+    id!(foo(i$0))
+}
+"#,
+            &[CompletionItemKind::SymbolKind(SymbolKind::Local)],
+            expect![[r#"
+                [
+                    CompletionItem {
+                        label: "indent",
+                        detail_left: None,
+                        detail_right: Some(
+                            "i32",
+                        ),
+                        source_range: 114..115,
+                        delete: 114..115,
+                        insert: "indent",
+                        kind: SymbolKind(
+                            Local,
+                        ),
+                        detail: "i32",
+                        relevance: CompletionRelevance {
+                            exact_name_match: false,
+                            type_match: None,
+                            is_local: true,
+                            is_missing: false,
+                            trait_: None,
+                            is_name_already_imported: false,
+                            requires_import: false,
+                            is_private_editable: false,
+                            postfix_match: None,
+                            function: None,
+                            is_skipping_completion: false,
+                            has_local_inherent_impl: false,
+                            is_deprecated: false,
+                        },
+                        ref_match: "&@114",
+                    },
+                ]
+            "#]],
+        );
+
+        check_kinds(
+            r#"
+macro_rules! id { ($($t:tt)*) => ($($t)*); }
+fn foo(data: &i32) {}
+fn indent() -> i32 { i32 }
+fn main() {
+    id!(foo(i$0))
+}
+"#,
+            &[CompletionItemKind::SymbolKind(SymbolKind::Function)],
+            expect![[r#"
+                [
+                    CompletionItem {
+                        label: "foo(…)",
+                        detail_left: None,
+                        detail_right: Some(
+                            "fn(&i32)",
+                        ),
+                        source_range: 118..119,
+                        delete: 118..119,
+                        insert: "foo(${1:data})$0",
+                        kind: SymbolKind(
+                            Function,
+                        ),
+                        lookup: "foo",
+                        detail: "fn(&i32)",
+                        trigger_call_info: true,
+                    },
+                    CompletionItem {
+                        label: "indent()",
+                        detail_left: None,
+                        detail_right: Some(
+                            "fn() -> i32",
+                        ),
+                        source_range: 118..119,
+                        delete: 118..119,
+                        insert: "indent()$0",
+                        kind: SymbolKind(
+                            Function,
+                        ),
+                        lookup: "indent",
+                        detail: "fn() -> i32",
+                        ref_match: "&@118",
+                    },
+                    CompletionItem {
+                        label: "main()",
+                        detail_left: None,
+                        detail_right: Some(
+                            "fn()",
+                        ),
+                        source_range: 118..119,
+                        delete: 118..119,
+                        insert: "main()$0",
+                        kind: SymbolKind(
+                            Function,
+                        ),
+                        lookup: "main",
+                        detail: "fn()",
+                    },
+                ]
+            "#]],
+        );
+
+        // FIXME: It is best to test `S.in` if speculative execution is implemented
+        check_kinds(
+            r#"
+macro_rules! id { ($($t:tt)*) => ($($t)*); }
+fn foo(data: &i32) {}
+struct S;
+impl S {fn indent(&self) -> i32 { i32 }}
+fn main() {
+    id!(foo(S.i$0))
+}
+"#,
+            &[CompletionItemKind::SymbolKind(SymbolKind::Method)],
+            expect![[r#"
+                [
+                    CompletionItem {
+                        label: "indent()",
+                        detail_left: None,
+                        detail_right: Some(
+                            "fn(&self) -> i32",
+                        ),
+                        source_range: 144..145,
+                        delete: 144..145,
+                        insert: "indent()$0",
+                        kind: SymbolKind(
+                            Method,
+                        ),
+                        lookup: "indent",
+                        detail: "fn(&self) -> i32",
+                        relevance: CompletionRelevance {
+                            exact_name_match: false,
+                            type_match: None,
+                            is_local: false,
+                            is_missing: false,
+                            trait_: None,
+                            is_name_already_imported: false,
+                            requires_import: false,
+                            is_private_editable: false,
+                            postfix_match: None,
+                            function: Some(
+                                CompletionRelevanceFn {
+                                    has_params: true,
+                                    has_self_param: true,
+                                    return_type: Other,
+                                },
+                            ),
+                            is_skipping_completion: false,
+                            has_local_inherent_impl: false,
+                            is_deprecated: false,
+                        },
+                        ref_match: "&@142",
+                    },
+                ]
+            "#]],
+        );
+
+        check_kinds(
+            r#"
+macro_rules! id { ($($t:tt)*) => ($($t)*); }
+fn foo(data: &i32) {}
+struct S { indent: i32 }
+fn main(s: S) {
+    id!(foo(s.i$0))
+}
+"#,
+            &[CompletionItemKind::SymbolKind(SymbolKind::Field)],
+            expect![[r#"
+                [
+                    CompletionItem {
+                        label: "indent",
+                        detail_left: None,
+                        detail_right: Some(
+                            "i32",
+                        ),
+                        source_range: 122..123,
+                        delete: 122..123,
+                        insert: "indent",
+                        kind: SymbolKind(
+                            Field,
+                        ),
+                        detail: "i32",
+                        ref_match: "&@120",
+                    },
+                ]
+            "#]],
+        );
+    }
+
+    #[test]
     fn too_many_arguments() {
         cov_mark::check!(too_many_arguments);
         check_relevance(
@@ -2825,6 +3058,37 @@ impl Foo$0
     }
 
     #[test]
+    fn score_patterns() {
+        check_relevance(
+            r#"
+struct Foo(Bar);
+struct Bar { field: i32 }
+fn go(Foo($0): Foo) {}
+"#,
+            expect![[r#"
+                bn Bar {…} Bar { field$1 }$0 [type]
+                st Bar  []
+                st Foo  []
+                bn Foo(…) Foo($1)$0 []
+            "#]],
+        );
+
+        check_relevance(
+            r#"
+struct Foo(Bar);
+enum Bar { Variant { field: i32 } }
+fn go(foo: Foo) { match foo { Foo($0) } }
+"#,
+            expect![[r#"
+                bn Bar::Variant {…} Bar::Variant { field$1 }$0 [type]
+                en Bar  []
+                st Foo  []
+                bn Foo(…) Foo($1)$0 []
+            "#]],
+        );
+    }
+
+    #[test]
     fn test_avoid_redundant_suggestion() {
         check_relevance(
             r#"
@@ -2865,7 +3129,6 @@ fn main() {
                 st S S []
                 st &mut S [type]
                 st S S []
-                st &mut S [type]
                 fn foo(…) fn(&mut S) []
                 fn main() fn() []
             "#]],
@@ -2879,6 +3142,7 @@ fn main() {
     foo(&mut $0);
 }
             "#,
+            // FIXME: There are many `S` here
             expect![[r#"
                 lc s S [type+name+local]
                 st S S [type]
@@ -2940,12 +3204,51 @@ fn main() {
                 st &mut S(…) [type]
                 lc ssss S<u32> [local]
                 lc &mut ssss [type+local]
-                st S S<{unknown}> []
-                st &mut S [type]
+                st S S<T> []
                 fn foo(…) fn(&mut S<T>) []
                 fn main() fn() []
             "#]],
         );
+        // Regression test https://github.com/rust-lang/rust-analyzer/issues/22324
+        check_relevance(
+            r#"
+//- minicore: deref
+struct S<T>(T);
+impl<T> core::ops::Deref for S<T> {
+    type Target = T;
+}
+fn foo<T>(s: &u32) {}
+fn main() {
+    let ssss = S();
+    foo($0);
+}
+            "#,
+            // FIXME: term_search exclude ssss.0 (field.ty().is_unknown())
+            expect![[r#"
+                ex ssss.0  [type_could_unify]
+                lc ssss S<{unknown}> [local]
+                st S S<T> []
+                md core::  []
+                fn foo(…) fn(&u32) []
+                fn main() fn() []
+            "#]],
+        );
+        check_relevance(
+            r#"
+//- minicore: deref
+fn foo<T>(s: &T) {}
+fn main() {
+    let ssss = &mut 2i32;
+    foo($0);
+}
+            "#,
+            expect![[r#"
+                lc ssss &mut i32 [type_could_unify+local]
+                md core::  []
+                fn foo(…) fn(&T) []
+                fn main() fn() []
+            "#]],
+        );
     }
 
     #[test]
@@ -3016,9 +3319,7 @@ fn main() {
                 lc t T [local]
                 lc &t [type+local]
                 st S S []
-                st &S [type]
                 st T T []
-                st &T [type]
                 md core::  []
                 fn foo(…) fn(&S) []
                 fn main() fn() []
@@ -3065,9 +3366,7 @@ fn main() {
                 lc t T [local]
                 lc &mut t [type+local]
                 st S S []
-                st &mut S [type]
                 st T T []
-                st &mut T [type]
                 md core::  []
                 fn foo(…) fn(&mut S) []
                 fn main() fn() []
@@ -3131,7 +3430,6 @@ fn bar(t: &Foo) {}
                 ev Foo::B Foo::B []
                 ev &Foo::B [type]
                 en Foo Foo []
-                en &Foo [type]
                 fn bar(…) fn(&Foo) []
                 fn foo() fn() []
             "#]],
@@ -3166,9 +3464,7 @@ fn main() {
                 st &S [type]
                 ex core::ops::Deref::deref(&bar())  [type_could_unify]
                 st S S []
-                st &S [type]
                 st T T []
-                st &T [type]
                 fn bar() fn() -> T []
                 fn &bar() [type]
                 md core::  []
@@ -3499,6 +3795,7 @@ fn foo(f: Foo) { let _: &u32 = f.b$0 }
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -3594,6 +3891,7 @@ fn foo() {
                                 Exact,
                             ),
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -3648,6 +3946,7 @@ fn main() {
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: None,
                             is_name_already_imported: false,
                             requires_import: false,
@@ -3690,14 +3989,14 @@ fn foo() {
 }
 "#,
             expect![[r#"
-                ev Foo::B Foo::B [type_could_unify]
-                ev Foo::A(…) Foo::A(T) [type_could_unify]
                 lc foo Foo<u32> [type+local]
                 ex Foo::B  [type]
                 ex foo  [type]
-                en Foo Foo<{unknown}> [type_could_unify]
+                ev Foo::B Foo::B [type_could_unify]
+                ev Foo::A(…) Foo::A(T) [type_could_unify]
+                en Foo Foo<T> [type_could_unify]
+                fn baz() fn() -> Foo<T> [type_could_unify]
                 fn bar() fn() -> Foo<u8> []
-                fn baz() fn() -> Foo<T> []
                 fn foo() fn() []
             "#]],
         );
@@ -3727,6 +4026,7 @@ fn main() {
             &[CompletionItemKind::Snippet, CompletionItemKind::SymbolKind(SymbolKind::Method)],
             expect![[r#"
                 sn not !expr [snippet]
+                me not() fn(self) -> <Self as Not>::Output [type_could_unify+requires_import]
                 sn box Box::new(expr) []
                 sn call function(expr) []
                 sn const const {} []
@@ -3740,7 +4040,6 @@ fn main() {
                 sn return return expr []
                 sn unsafe unsafe {} []
                 sn while while expr {} []
-                me not() fn(self) -> <Self as Not>::Output [requires_import]
             "#]],
         );
     }
@@ -3791,7 +4090,7 @@ enum Foo {
                 en Foo Foo []
                 st Other Other []
                 sp Self Foo []
-                st Vec<…> Vec<{unknown}> []
+                st Vec<…> Vec<T> []
             "#]],
         );
     }
@@ -4140,6 +4439,7 @@ fn main() {
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: Some(
                                 CompletionRelevanceTraitInfo {
                                     notable_trait: true,
@@ -4176,6 +4476,7 @@ fn main() {
                             exact_name_match: false,
                             type_match: None,
                             is_local: false,
+                            is_missing: false,
                             trait_: Some(
                                 CompletionRelevanceTraitInfo {
                                     notable_trait: true,
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs
index 97d5a25..4f70a90 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs
@@ -76,7 +76,7 @@ fn render(
         completion.edition,
     );
 
-    let ret_type = func.ret_type(db);
+    let ret_type = ctx.completion.rebase_ty(&func.ret_type(db));
     let assoc_item = func.as_assoc_item(db);
 
     let trait_info =
@@ -107,6 +107,7 @@ fn render(
 
     let function = assoc_item
         .and_then(|assoc_item| assoc_item.implementing_ty(db))
+        .map(|self_type| ctx.completion.rebase_ty(&self_type))
         .map(|self_type| compute_return_type_match(db, &ctx, self_type, &ret_type))
         .map(|return_type| CompletionRelevanceFn {
             has_params: has_self_param || func.num_params(db) > 0,
@@ -118,7 +119,7 @@ fn render(
         type_match: if has_call_parens || complete_call_parens.is_some() {
             compute_type_match(completion, &ret_type)
         } else {
-            compute_type_match(completion, &func.ty(db))
+            compute_type_match(completion, &ctx.completion.rebase_ty(&func.ty(db)))
         },
         exact_name_match: compute_exact_name_match(completion, &call),
         function,
@@ -132,10 +133,10 @@ fn render(
             super::path_ref_match(completion, path_ctx, &ret_type, &mut item);
         }
         FuncKind::Method(DotAccess { receiver: Some(receiver), .. }, _) => {
-            if let Some(original_expr) = completion.sema.original_ast_node(receiver.clone())
+            if let Some(original_expr) = completion.sema.original_range_opt(receiver.syntax())
                 && let Some(ref_mode) = compute_ref_match(completion, &ret_type)
             {
-                item.ref_match(ref_mode, original_expr.syntax().text_range().start());
+                item.ref_match(ref_mode, original_expr.range.start());
             }
         }
         _ => (),
@@ -287,7 +288,7 @@ pub(super) fn add_call_parens<'b>(
 }
 
 fn ref_of_param(ctx: &CompletionContext<'_, '_>, arg: &str, ty: &hir::Type<'_>) -> &'static str {
-    if let Some(derefed_ty) = ty.remove_ref() {
+    if let Some(derefed_ty) = ty.as_reference_inner() {
         for (name, local) in ctx.locals.iter().sorted_by_key(|&(k, _)| k.clone()) {
             if name.as_str() == arg {
                 return if local.ty(ctx.db) == derefed_ty {
@@ -952,4 +953,23 @@ fn bar() {
 "#,
         );
     }
+
+    #[test]
+    fn no_semicolon_in_match() {
+        check_edit(
+            r#"foo"#,
+            r#"
+fn foo() {}
+fn bar() {
+    match fo$0 {}
+}
+"#,
+            r#"
+fn foo() {}
+fn bar() {
+    match foo()$0 {}
+}
+"#,
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs
index 9e0cec6..943ff582 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs
@@ -127,7 +127,7 @@ fn render(
 
     item.set_documentation(thing.docs(db)).set_deprecated(thing.is_deprecated(&ctx));
 
-    let ty = thing.ty(db);
+    let ty = ctx.completion.rebase_ty(&thing.ty(db));
     item.set_relevance(CompletionRelevance {
         type_match: compute_type_match(ctx.completion, &ty),
         // function is a misnomer here, this is more about constructor information
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs
index 392ecbc..13a83eb 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs
@@ -103,21 +103,21 @@ pub(crate) fn render_variant_pat(
     ))
 }
 
-fn build_completion(
-    ctx: RenderContext<'_, '_>,
+fn build_completion<'db>(
+    ctx: RenderContext<'_, 'db>,
     label: SmolStr,
     lookup: SmolStr,
     pat: String,
     def: impl HasDocs,
-    adt_ty: hir::Type<'_>,
+    adt_ty: hir::Type<'db>,
     // Missing in context of match statement completions
     is_variant_missing: bool,
 ) -> CompletionItem {
     let mut relevance = ctx.completion_relevance();
+    let adt_ty = ctx.completion.rebase_ty(&adt_ty);
 
-    if is_variant_missing {
-        relevance.type_match = super::compute_type_match(ctx.completion, &adt_ty);
-    }
+    relevance.type_match = super::compute_type_match(ctx.completion, &adt_ty);
+    relevance.is_missing = is_variant_missing;
 
     let mut item = CompletionItem::new(
         CompletionItemKind::Binding,
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/variant.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/variant.rs
index f86af6c..8d1b885 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/render/variant.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/variant.rs
@@ -32,7 +32,7 @@ pub(crate) fn render_record_lit(
             if let Some(local) = ctx.locals.get(&field_name)
                 && local
                     .ty(ctx.db)
-                    .could_unify_with_deeply(ctx.db, &field.ty(ctx.db).to_type(ctx.db))
+                    .could_unify_with_deeply(ctx.db, &ctx.rebase_ty(&field.ty(ctx.db)))
             {
                 f(&format_args!("{}{tab}", field_name.display(ctx.db, ctx.edition)))
             } else {
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/tests/expression.rs b/src/tools/rust-analyzer/crates/ide-completion/src/tests/expression.rs
index c1205f9..e49afa6 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/tests/expression.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/tests/expression.rs
@@ -1055,6 +1055,7 @@ fn brr() {
             fn brr()                               fn()
             st YoloVariant                  YoloVariant
             st YoloVariant {…} YoloVariant { f: usize }
+            ev Yolo(…) (use HH::Yolo) Yolo(YoloVariant)
             bt u32                                  u32
             kw const
             kw crate::
@@ -1157,6 +1158,12 @@ fn complete_module_colons() {
         r#"mod module {} fn foo() { module:: }"#,
     );
 
+    check_edit(
+        "module",
+        r#"mod module {} fn foo() { $0foo::bar }"#,
+        r#"mod module {} fn foo() { module::foo::bar }"#,
+    );
+
     check_edit_with_config(
         CompletionConfig { add_colons_to_module: false, ..TEST_CONFIG },
         "module",
@@ -1166,6 +1173,27 @@ fn complete_module_colons() {
 }
 
 #[test]
+fn complete_module_exists_colons() {
+    check_edit(
+        "module",
+        r#"mod module {} fn foo() { $0::bar }"#,
+        r#"mod module {} fn foo() { module::bar }"#,
+    );
+
+    check_edit(
+        "module",
+        r#"
+macro_rules! i { ($i:ident) => { $i::bar } }
+mod module {}
+fn foo() { i!($0) }"#,
+        r#"
+macro_rules! i { ($i:ident) => { $i::bar } }
+mod module {}
+fn foo() { i!(module) }"#,
+    );
+}
+
+#[test]
 fn else_completion_after_if() {
     check(
         r#"
@@ -2344,7 +2372,7 @@ fn main() {
     $0
 }
 //- /std.rs crate:std
-#[unstable(feature = "intrinsics")]
+#[unstable(feature = "core_intrinsics")]
 pub mod intrinsics {}
     "#,
         expect![[r#"
@@ -2936,6 +2964,84 @@ fn foo() {
 }
 
 #[test]
+fn flyimport_excluded_mod_items_from_flyimport() {
+    check_with_config(
+        CompletionConfig {
+            exclude_flyimport: vec![(
+                "ra_test_fixture::xpack::xmodule2".to_owned(),
+                AutoImportExclusionType::SubItems,
+            )],
+            ..TEST_CONFIG
+        },
+        r#"
+mod xpack {
+    mod xmodule1 {
+        pub struct XOther;
+    }
+    pub mod xmodule2 {
+        pub use super::xmodule1::*;
+        pub struct XStruct;
+        pub fn xfn() {}
+    }
+}
+
+fn foo() {
+    x$0
+}
+        "#,
+        expect![[r#"
+            ct CONST                       Unit
+            en Enum                        Enum
+            fn foo()                       fn()
+            fn function()                  fn()
+            ma makro!(…)     macro_rules! makro
+            md module::
+            md xmodule2:: (use xpack::xmodule2)
+            md xpack::
+            sc STATIC                      Unit
+            st Record                    Record
+            st Tuple                      Tuple
+            st Unit                        Unit
+            un Union                      Union
+            ev TupleV(…)            TupleV(u32)
+            bt u32                          u32
+            kw async
+            kw const
+            kw crate::
+            kw enum
+            kw extern
+            kw false
+            kw fn
+            kw for
+            kw if
+            kw if let
+            kw impl
+            kw impl for
+            kw let
+            kw letm
+            kw loop
+            kw match
+            kw mod
+            kw return
+            kw self::
+            kw static
+            kw struct
+            kw trait
+            kw true
+            kw type
+            kw union
+            kw unsafe
+            kw use
+            kw while
+            kw while let
+            sn macro_rules
+            sn pd
+            sn ppd
+        "#]],
+    );
+}
+
+#[test]
 fn excluded_trait_method_is_excluded_from_path_completion() {
     check_with_config(
         CompletionConfig {
@@ -3092,8 +3198,8 @@ fn bar() {
 }
         "#,
         expect![[r#"
-            en Option                             Option<{unknown}>
-            en Result                  Result<{unknown}, {unknown}>
+            en Option                                     Option<T>
+            en Result                                  Result<T, E>
             fn bar()                                           fn()
             lc i                                                i32
             ma const_format_args!(…) macro_rules! const_format_args
@@ -3901,3 +4007,105 @@ fn tryme(…) fn(impl SubTrait<<impl SubTrait<<… as SuperTrait>::AssocTy> + ?Sized
         "#]],
     );
 }
+
+#[test]
+fn can_complete_macro_path_inside_expansion() {
+    check(
+        r#"
+macro_rules! bar { () => (); }
+macro_rules! foo { ($i:ident) => { $i!() }; }
+fn main() {
+    foo!(ba$0);
+}
+    "#,
+        expect![[r#"
+            fn main()          fn()
+            ma bar macro_rules! bar
+            ma foo macro_rules! foo
+            bt u32              u32
+            kw const
+            kw crate::
+            kw false
+            kw for
+            kw if
+            kw if let
+            kw loop
+            kw match
+            kw return
+            kw self::
+            kw true
+            kw unsafe
+            kw while
+            kw while let
+        "#]],
+    );
+}
+
+#[test]
+fn no_completion_for_autorefd_traits_in_path_mode() {
+    check(
+        r#"
+//- minicore: clone
+trait Test1 {}
+
+fn test<H: Test1>(test: H) {
+    H::$0
+}
+    "#,
+        expect![""],
+    );
+}
+
+#[test]
+fn imported_enum_variant_has_lower_priority() {
+    check(
+        r#"
+pub struct String {}
+mod foo {
+    pub enum Foo { String }
+}
+fn main() {
+    Strin$0
+}
+    "#,
+        expect![[r#"
+            fn main()                          fn()
+            md foo::
+            st String                        String
+            ev String (use foo::Foo::String) String
+            bt u32                              u32
+            kw async
+            kw const
+            kw crate::
+            kw enum
+            kw extern
+            kw false
+            kw fn
+            kw for
+            kw if
+            kw if let
+            kw impl
+            kw impl for
+            kw let
+            kw letm
+            kw loop
+            kw match
+            kw mod
+            kw return
+            kw self::
+            kw static
+            kw struct
+            kw trait
+            kw true
+            kw type
+            kw union
+            kw unsafe
+            kw use
+            kw while
+            kw while let
+            sn macro_rules
+            sn pd
+            sn ppd
+        "#]],
+    );
+}
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 231623a..45db8ec 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
@@ -781,9 +781,9 @@ fn main() {
 }
 "#,
         expect![[r#"
-            me random_method(…) (use dep::test_mod::TestTrait) fn(&self) DEPRECATED
             ct SPECIAL_CONST (use dep::test_mod::TestTrait)           u8 DEPRECATED
             fn weird_function() (use dep::test_mod::TestTrait)      fn() DEPRECATED
+            me random_method(…) (use dep::test_mod::TestTrait) fn(&self) DEPRECATED
         "#]],
     );
 }
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/tests/predicate.rs b/src/tools/rust-analyzer/crates/ide-completion/src/tests/predicate.rs
index 9826a8e..3f3a6f4 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/tests/predicate.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/tests/predicate.rs
@@ -14,7 +14,7 @@ struct Foo<'lt, T, const C: usize> where $0 {}
             en Enum                    Enum
             ma makro!(…) macro_rules! makro
             md module::
-            st Foo<…> Foo<'_, {unknown}, _>
+            st Foo<…>        Foo<'lt, T, C>
             st Record                Record
             st Tuple                  Tuple
             st Unit                    Unit
@@ -91,7 +91,7 @@ struct Foo<'lt, T, const C: usize> where for<'a> $0 {}
             en Enum                    Enum
             ma makro!(…) macro_rules! makro
             md module::
-            st Foo<…> Foo<'_, {unknown}, _>
+            st Foo<…>        Foo<'lt, T, C>
             st Record                Record
             st Tuple                  Tuple
             st Unit                    Unit
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/tests/record.rs b/src/tools/rust-analyzer/crates/ide-completion/src/tests/record.rs
index ddb9294..aecf8eb 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/tests/record.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/tests/record.rs
@@ -157,6 +157,8 @@ fn foo(f: Struct) {
 fn in_functional_update() {
     cov_mark::check!(functional_update);
 
+    // FIXME: This should filter out all completions that do not have the type `Foo`
+    // I think maybe ranking by type match is enough
     check(
         r#"
 //- minicore:default
@@ -210,7 +212,6 @@ fn default() (as Default) fn() -> Self
 #[test]
 fn functional_update_no_dot() {
     cov_mark::check!(functional_update_field);
-    // FIXME: This should filter out all completions that do not have the type `Foo`
     check(
         r#"
 //- minicore:default
@@ -281,6 +282,48 @@ fn main() {
 }
 
 #[test]
+fn functional_update_non_last() {
+    check(
+        r#"
+//- minicore:default
+struct Foo { foo1: u32, foo2: u32 }
+impl Default for Foo {
+    fn default() -> Self { loop {} }
+}
+
+fn main() {
+    let thing = 1;
+    let foo = Foo { foo1: 0, foo2: 0 };
+    let foo2 = Foo { $0 thing }
+}
+"#,
+        expect![[r#"
+            fd foo1 u32
+            fd foo2 u32
+        "#]],
+    );
+    check(
+        r#"
+//- minicore:default
+struct Foo { foo1: u32, foo2: u32 }
+impl Default for Foo {
+    fn default() -> Self { loop {} }
+}
+
+fn main() {
+    let thing = 1;
+    let foo = Foo { foo1: 0, foo2: 0 };
+    let foo2 = Foo { $0thing }
+}
+"#,
+        expect![[r#"
+            fd foo1 u32
+            fd foo2 u32
+        "#]],
+    );
+}
+
+#[test]
 fn functional_update_fields_completion() {
     // Complete fields before functional update `..`
     check(
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/tests/type_pos.rs b/src/tools/rust-analyzer/crates/ide-completion/src/tests/type_pos.rs
index 2408033..ad05890 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/tests/type_pos.rs
+++ b/src/tools/rust-analyzer/crates/ide-completion/src/tests/type_pos.rs
@@ -15,8 +15,8 @@ struct Foo<'lt, T, const C: usize> {
             en Enum                    Enum
             ma makro!(…) macro_rules! makro
             md module::
-            sp Self   Foo<'_, {unknown}, _>
-            st Foo<…> Foo<'_, {unknown}, _>
+            sp Self          Foo<'lt, T, C>
+            st Foo<…>        Foo<'lt, T, C>
             st Record                Record
             st Tuple                  Tuple
             st Unit                    Unit
@@ -44,8 +44,8 @@ fn tuple_struct_field() {
             en Enum                    Enum
             ma makro!(…) macro_rules! makro
             md module::
-            sp Self   Foo<'_, {unknown}, _>
-            st Foo<…> Foo<'_, {unknown}, _>
+            sp Self          Foo<'lt, T, C>
+            st Foo<…>        Foo<'lt, T, C>
             st Record                Record
             st Tuple                  Tuple
             st Unit                    Unit
@@ -409,7 +409,7 @@ fn inferred_type_const() {
             en Enum                    Enum
             ma makro!(…) macro_rules! makro
             md module::
-            st Foo<…>        Foo<{unknown}>
+            st Foo<…>                Foo<T>
             st Record                Record
             st Tuple                  Tuple
             st Unit                    Unit
@@ -438,7 +438,7 @@ fn inferred_type_static() {
             en Enum                    Enum
             ma makro!(…) macro_rules! makro
             md module::
-            st Foo<…>        Foo<{unknown}>
+            st Foo<…>                Foo<T>
             st Record                Record
             st Tuple                  Tuple
             st Unit                    Unit
@@ -629,7 +629,7 @@ fn foo<'lt, T, const C: usize>() {
             en Enum                    Enum
             ma makro!(…) macro_rules! makro
             md module::
-            st Foo<…>        Foo<{unknown}>
+            st Foo<…>                Foo<T>
             st Record                Record
             st Tuple                  Tuple
             st Unit                    Unit
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
index 264bb4f..3e78ae0 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
@@ -573,13 +573,6 @@ pub struct LintGroup {
         deny_since: None,
     },
     Lint {
-        label: "inline_always_mismatching_target_features",
-        description: r##"detects when a function annotated with `#[inline(always)]` and `#[target_feature(enable = "..")]` is inlined into a caller without the required target feature"##,
-        default_severity: Severity::Warning,
-        warn_since: None,
-        deny_since: None,
-    },
-    Lint {
         label: "inline_no_sanitize",
         description: r##"detects incompatible use of `#[inline(always)]` and `#[sanitize(... = "off")]`"##,
         default_severity: Severity::Warning,
@@ -2458,6 +2451,22 @@ pub fn device_function() {
         deny_since: None,
     },
     Lint {
+        label: "abi_swift",
+        description: r##"# `abi_swift`
+
+Allows `extern "Swift" fn()`.
+
+The tracking issue for this feature is: [#156481]
+
+[#156481]: https://github.com/rust-lang/rust/issues/156481
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "abi_unadjusted",
         description: r##"# `abi_unadjusted`
 
@@ -3932,22 +3941,6 @@ trait matching, this cycle would be an error, but for an auto trait it
         deny_since: None,
     },
     Lint {
-        label: "bool_to_result",
-        description: r##"# `bool_to_result`
-
-
-
-The tracking issue for this feature is: [#142748]
-
-[#142748]: https://github.com/rust-lang/rust/issues/142748
-
-------------------------
-"##,
-        default_severity: Severity::Allow,
-        warn_since: None,
-        deny_since: None,
-    },
-    Lint {
         label: "borrowed_buf_init",
         description: r##"# `borrowed_buf_init`
 
@@ -4494,20 +4487,6 @@ fn main() {
         deny_since: None,
     },
     Lint {
-        label: "cfg_emscripten_wasm_eh",
-        description: r##"# `cfg_emscripten_wasm_eh`
-
-Allows access to the emscripten_wasm_eh config, used by panic_unwind and unwind
-
-This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.
-
-------------------------
-"##,
-        default_severity: Severity::Allow,
-        warn_since: None,
-        deny_since: None,
-    },
-    Lint {
         label: "cfg_eval",
         description: r##"# `cfg_eval`
 
@@ -4645,22 +4624,6 @@ fn b() {
         deny_since: None,
     },
     Lint {
-        label: "cfg_target_has_atomic_equal_alignment",
-        description: r##"# `cfg_target_has_atomic_equal_alignment`
-
-Allows `cfg(target_has_atomic_equal_alignment = "...")`.
-
-The tracking issue for this feature is: [#93822]
-
-[#93822]: https://github.com/rust-lang/rust/issues/93822
-
-------------------------
-"##,
-        default_severity: Severity::Allow,
-        warn_since: None,
-        deny_since: None,
-    },
-    Lint {
         label: "cfg_target_has_reliable_f16_f128",
         description: r##"# `cfg_target_has_reliable_f16_f128`
 
@@ -4852,6 +4815,22 @@ fn b() {
         deny_since: None,
     },
     Lint {
+        label: "clflushopt_target_feature",
+        description: r##"# `clflushopt_target_feature`
+
+The `clflushopt` target feature on x86.
+
+The tracking issue for this feature is: [#157096]
+
+[#157096]: https://github.com/rust-lang/rust/issues/157096
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "clone_from_ref",
         description: r##"# `clone_from_ref`
 
@@ -9041,6 +9020,22 @@ fn generic_const_arg() {
         deny_since: None,
     },
     Lint {
+        label: "gpu_offload",
+        description: r##"# `gpu_offload`
+
+
+
+The tracking issue for this feature is: [#131513]
+
+[#131513]: https://github.com/rust-lang/rust/issues/131513
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "guard_patterns",
         description: r##"# `guard_patterns`
 
@@ -10005,8 +10000,7 @@ mod foo {
   failure mechanisms of the compiler. This is often mapped to GCC's personality
   function (see the [`std` implementation][personality] for more information),
   but programs which don't trigger a panic can be assured that this function is
-  never called. Additionally, a `eh_catch_typeinfo` static is needed for certain
-  targets which implement Rust panics on top of C++ exceptions.
+  never called.
 - the traits in `core::marker` used to indicate types of
   various kinds; e.g. lang items `sized`, `sync` and `copy`.
 - memory allocation, see below.
@@ -11167,6 +11161,22 @@ impl A for Foo {
         deny_since: None,
     },
     Lint {
+        label: "move_expr",
+        description: r##"# `move_expr`
+
+Allows `move(expr)` in closures.
+
+The tracking issue for this feature is: [#155050]
+
+[#155050]: https://github.com/rust-lang/rust/issues/155050
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "movrs_target_feature",
         description: r##"# `movrs_target_feature`
 
@@ -11263,6 +11273,22 @@ impl A for Foo {
         deny_since: None,
     },
     Lint {
+        label: "mut_restriction",
+        description: r##"# `mut_restriction`
+
+Allows `mut(crate) field: Type` restrictions.
+
+The tracking issue for this feature is: [#105077]
+
+[#105077]: https://github.com/rust-lang/rust/issues/105077
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "mutex_data_ptr",
         description: r##"# `mutex_data_ptr`
 
@@ -12069,6 +12095,20 @@ fn main() {
         deny_since: None,
     },
     Lint {
+        label: "os_str_split_at",
+        description: r##"# `os_str_split_at`
+
+
+
+This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "os_string_truncate",
         description: r##"# `os_string_truncate`
 
@@ -12257,22 +12297,6 @@ fn main() {
         deny_since: None,
     },
     Lint {
-        label: "path_is_empty",
-        description: r##"# `path_is_empty`
-
-
-
-The tracking issue for this feature is: [#148494]
-
-[#148494]: https://github.com/rust-lang/rust/issues/148494
-
-------------------------
-"##,
-        default_severity: Severity::Allow,
-        warn_since: None,
-        deny_since: None,
-    },
-    Lint {
         label: "path_trailing_sep",
         description: r##"# `path_trailing_sep`
 
@@ -13467,6 +13491,22 @@ pub struct Point {
         deny_since: None,
     },
     Lint {
+        label: "return_address",
+        description: r##"# `return_address`
+
+
+
+The tracking issue for this feature is: [#154966]
+
+[#154966]: https://github.com/rust-lang/rust/issues/154966
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "return_type_notation",
         description: r##"# `return_type_notation`
 
@@ -13941,6 +13981,22 @@ fn bar(&self) {
         deny_since: None,
     },
     Lint {
+        label: "share_trait",
+        description: r##"# `share_trait`
+
+
+
+The tracking issue for this feature is: [#156756]
+
+[#156756]: https://github.com/rust-lang/rust/issues/156756
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "signed_bigint_helpers",
         description: r##"# `signed_bigint_helpers`
 
@@ -14927,22 +14983,6 @@ fn main() {
         deny_since: None,
     },
     Lint {
-        label: "target_feature_inline_always",
-        description: r##"# `target_feature_inline_always`
-
-Allows the use of target_feature when a function is marked inline(always).
-
-The tracking issue for this feature is: [#145574]
-
-[#145574]: https://github.com/rust-lang/rust/issues/145574
-
-------------------------
-"##,
-        default_severity: Severity::Allow,
-        warn_since: None,
-        deny_since: None,
-    },
-    Lint {
         label: "tcp_deferaccept",
         description: r##"# `tcp_deferaccept`
 
@@ -15687,22 +15727,6 @@ pub union GenericUnion<T: Copy> { // Unions with non-`Copy` fields are unstable.
         deny_since: None,
     },
     Lint {
-        label: "trusted_len_next_unchecked",
-        description: r##"# `trusted_len_next_unchecked`
-
-
-
-The tracking issue for this feature is: [#37572]
-
-[#37572]: https://github.com/rust-lang/rust/issues/37572
-
-------------------------
-"##,
-        default_severity: Severity::Allow,
-        warn_since: None,
-        deny_since: None,
-    },
-    Lint {
         label: "trusted_random_access",
         description: r##"# `trusted_random_access`
 
@@ -16306,6 +16330,22 @@ fn main() {}
         deny_since: None,
     },
     Lint {
+        label: "unix_kill_process_group",
+        description: r##"# `unix_kill_process_group`
+
+
+
+The tracking issue for this feature is: [#156537]
+
+[#156537]: https://github.com/rust-lang/rust/issues/156537
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "unix_mkfifo",
         description: r##"# `unix_mkfifo`
 
@@ -16402,6 +16442,22 @@ fn main() {}
         deny_since: None,
     },
     Lint {
+        label: "unnamed_enum_variants",
+        description: r##"# `unnamed_enum_variants`
+
+Allows using `_ = <range-or-int>` enum variants.
+
+The tracking issue for this feature is: [#156628]
+
+[#156628]: https://github.com/rust-lang/rust/issues/156628
+
+------------------------
+"##,
+        default_severity: Severity::Allow,
+        warn_since: None,
+        deny_since: None,
+    },
+    Lint {
         label: "unqualified_local_imports",
         description: r##"# `unqualified_local_imports`
 
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs b/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs
index e0501b5..6edc550 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs
@@ -814,13 +814,13 @@ fn trait_applicable_items<'db>(
         let mut deref_chain = trait_candidate.receiver_ty.autoderef(db).collect::<Vec<_>>();
         // As a last step, we can do array unsizing (that's the only unsizing that rustc does for method receivers!)
         if let Some((ty, _len)) = deref_chain.last().and_then(|ty| ty.as_array(db)) {
-            let slice = Type::new_slice(ty);
+            let slice = Type::new_slice(db, ty);
             deref_chain.push(slice);
         }
         deref_chain
             .into_iter()
             .flat_map(|ty| {
-                let fingerprint = ty.fingerprint_for_trait_impl()?;
+                let fingerprint = ty.fingerprint_for_trait_impl(db)?;
                 let mut crates = vec![];
 
                 if let Some(adt) = ty.as_adt() {
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/lib.rs b/src/tools/rust-analyzer/crates/ide-db/src/lib.rs
index 6180e31..87cbc7c 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/lib.rs
@@ -160,7 +160,7 @@ fn set_source_root_with_durability(
     }
 
     fn file_source_root(&self, id: vfs::FileId) -> FileSourceRootInput {
-        self.files.file_source_root(id)
+        self.files.file_source_root(self, id)
     }
 
     fn set_file_source_root_with_durability(
@@ -180,6 +180,10 @@ fn crates_map(&self) -> Arc<CratesMap> {
     fn nonce_and_revision(&self) -> (Nonce, salsa::Revision) {
         (self.nonce, salsa::plumbing::ZalsaDatabase::zalsa(self).current_revision())
     }
+
+    fn line_column(&self, file: FileId, offset: syntax::TextSize) -> Result<(u32, u32), ()> {
+        line_index(self, file).try_line_col(offset).map(|lc| (lc.line, lc.col)).ok_or(())
+    }
 }
 
 impl Default for RootDatabase {
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs b/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs
index 11ba815..15ecabc 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs
@@ -216,12 +216,7 @@ pub fn walk_ty(ty: &ast::Type, cb: &mut dyn FnMut(ast::Type) -> bool) {
                 preorder.skip_subtree();
                 cb(ty);
             }
-            Some(ty) =>
-            {
-                #[expect(
-                    clippy::collapsible_match,
-                    reason = "it won't compile due to exhaustiveness"
-                )]
+            Some(ty) => {
                 if cb(ty) {
                     preorder.skip_subtree();
                 }
@@ -369,7 +364,8 @@ pub fn for_each_tail_expr(expr: &ast::Expr, cb: &mut dyn FnMut(&ast::Expr)) {
         | ast::Expr::YeetExpr(_)
         | ast::Expr::OffsetOfExpr(_)
         | ast::Expr::FormatArgsExpr(_)
-        | ast::Expr::AsmExpr(_) => cb(expr),
+        | ast::Expr::AsmExpr(_)
+        | ast::Expr::IncludeBytesExpr(_) => cb(expr),
     }
 }
 
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/suggest_name.rs b/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/suggest_name.rs
index 76fea5c..1592059 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/suggest_name.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/suggest_name.rs
@@ -412,7 +412,7 @@ fn from_type(
     edition: Edition,
 ) -> Option<SmolStr> {
     let ty = sema.type_of_expr(expr)?.adjusted();
-    let ty = ty.remove_ref().unwrap_or(ty);
+    let ty = ty.strip_reference();
 
     name_of_type(&ty, sema.db, edition)
 }
@@ -445,7 +445,7 @@ fn name_of_type<'db>(
             return None;
         }
         name
-    } else if let Some(inner_ty) = ty.remove_ref() {
+    } else if let Some((inner_ty, _)) = ty.as_reference() {
         return name_of_type(&inner_ty, db, edition);
     } else if let Some(inner_ty) = ty.as_slice() {
         return Some(sequence_name(Some(&inner_ty), db, edition));
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt b/src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt
index 1b20a57..a84f75c 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt
+++ b/src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt
@@ -38,7 +38,7 @@
                     "Enum",
                 ),
                 is_alias: false,
-                is_assoc: true,
+                is_assoc: false,
                 is_import: false,
                 do_not_complete: Yes,
                 _marker: PhantomData<&()>,
@@ -110,7 +110,7 @@
                     "Enum",
                 ),
                 is_alias: false,
-                is_assoc: true,
+                is_assoc: false,
                 is_import: false,
                 do_not_complete: Yes,
                 _marker: PhantomData<&()>,
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/traits.rs b/src/tools/rust-analyzer/crates/ide-db/src/traits.rs
index d38d9b6..994427a 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/traits.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/traits.rs
@@ -1,7 +1,7 @@
 //! Functionality for obtaining data related to traits from the DB.
 
 use crate::{RootDatabase, defs::Definition};
-use hir::{AsAssocItem, Semantics, db::HirDatabase};
+use hir::{AsAssocItem, HasCrate, Semantics, db::HirDatabase, sym};
 use rustc_hash::FxHashSet;
 use syntax::{AstNode, ast};
 
@@ -51,19 +51,38 @@ pub fn get_missing_assoc_items(
         }
     }
 
-    imp.trait_(sema.db).map_or(vec![], |target_trait| {
-        target_trait
-            .items(sema.db)
-            .into_iter()
-            .filter(|i| match i {
-                hir::AssocItem::Function(f) => !impl_fns_consts.contains(&f.name(sema.db)),
-                hir::AssocItem::TypeAlias(t) => !impl_type.contains(&t.name(sema.db)),
-                hir::AssocItem::Const(c) => {
-                    c.name(sema.db).map(|n| !impl_fns_consts.contains(&n)).unwrap_or_default()
-                }
-            })
-            .collect()
-    })
+    let Some(target_trait) = imp.trait_(sema.db) else { return Vec::new() };
+
+    // `Drop` has two methods, `drop()` and `pin_drop()`, and you can only implement one of them, so
+    // we consider `pin_drop()` to not exist, unless you already implement it.
+    let drop_trait = hir::Trait::lang(sema.db, imp.krate(sema.db), hir::LangItem::Drop);
+    if let Some(drop_trait) = drop_trait
+        && target_trait == drop_trait
+    {
+        return if impl_fns_consts.is_empty() {
+            // No method implemented, return `drop()`.
+            let drop_drop = drop_trait.function(sema.db, sym::drop);
+            match drop_drop {
+                Some(drop_drop) => vec![hir::AssocItem::Function(drop_drop)],
+                None => Vec::new(),
+            }
+        } else {
+            // Some method is already implemented, leave it.
+            Vec::new()
+        };
+    }
+
+    target_trait
+        .items(sema.db)
+        .into_iter()
+        .filter(|i| match i {
+            hir::AssocItem::Function(f) => !impl_fns_consts.contains(&f.name(sema.db)),
+            hir::AssocItem::TypeAlias(t) => !impl_type.contains(&t.name(sema.db)),
+            hir::AssocItem::Const(c) => {
+                c.name(sema.db).map(|n| !impl_fns_consts.contains(&n)).unwrap_or_default()
+            }
+        })
+        .collect()
 }
 
 /// Converts associated trait impl items to their trait definition counterpart
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/array_pattern_without_fixed_length.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/array_pattern_without_fixed_length.rs
new file mode 100644
index 0000000..e7d0868
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/array_pattern_without_fixed_length.rs
@@ -0,0 +1,46 @@
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: array-pattern-without-fixed-length
+//
+// This diagnostic is triggered when a rest array pattern is matched against an
+// array with a non-constant length.
+pub(crate) fn array_pattern_without_fixed_length(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::ArrayPatternWithoutFixedLength,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0730"),
+        "cannot pattern-match on an array without a fixed length",
+        d.pat.map(Into::into),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+
+    #[test]
+    fn array_pattern_without_fixed_length() {
+        check_diagnostics(
+            r#"
+fn f<const N: usize>(arr: [u8; N]) {
+    let [_head, _tail @ ..] = arr;
+      //^^^^^^^^^^^^^^^^^^^ error: cannot pattern-match on an array without a fixed length
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn fixed_length_array_pattern_is_ok() {
+        check_diagnostics(
+            r#"
+fn f(arr: [u8; 3]) {
+    let [_head, _tail @ ..] = arr;
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs
index b7265c4..43eb4ab 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs
@@ -126,14 +126,13 @@ fn foo() {
 
     #[test]
     fn value_break_in_for_loop() {
-        // FIXME: the error is correct, but the message is terrible
         check_diagnostics(
             r#"
 //- minicore: iterator
 fn test() {
     for _ in [()] {
         break 3;
-           // ^ error: expected (), found i32
+     // ^^^^^^^ error: can't break with a value in this position
     }
 }
 "#,
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_be_dereferenced.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_be_dereferenced.rs
new file mode 100644
index 0000000..6c9726f
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_be_dereferenced.rs
@@ -0,0 +1,74 @@
+use hir::HirDisplay;
+
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: cannot-be-dereferenced
+//
+// This diagnostic is triggered if the operand of a dereference expression
+// cannot be dereferenced.
+pub(crate) fn cannot_be_dereferenced(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::CannotBeDereferenced<'_>,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0614"),
+        format!(
+            "type `{}` cannot be dereferenced",
+            d.found.display(ctx.sema.db, ctx.display_target)
+        ),
+        d.expr.map(Into::into),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+
+    #[test]
+    fn cannot_be_dereferenced() {
+        check_diagnostics(
+            r#"
+fn f() {
+    let x = 1i32;
+    let _ = *x;
+          //^^ error: type `i32` cannot be dereferenced
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn allows_reference_deref() {
+        check_diagnostics(
+            r#"
+fn f(x: &i32) {
+    let _ = *x;
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn allows_overloaded_deref() {
+        check_diagnostics(
+            r#"
+//- minicore: deref
+struct Wrapper(i32);
+
+impl core::ops::Deref for Wrapper {
+    type Target = i32;
+
+    fn deref(&self) -> &i32 {
+        &self.0
+    }
+}
+
+fn f(x: Wrapper) {
+    let _ = *x;
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_implicitly_deref_trait_object.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_implicitly_deref_trait_object.rs
new file mode 100644
index 0000000..eca1414
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_implicitly_deref_trait_object.rs
@@ -0,0 +1,53 @@
+use hir::HirDisplay;
+
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: cannot-implicitly-deref-trait-object
+//
+// This diagnostic is triggered when a pointer to a trait object is implicitly
+// dereferenced by a pattern.
+pub(crate) fn cannot_implicitly_deref_trait_object(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::CannotImplicitlyDerefTraitObject<'_>,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0033"),
+        format!(
+            "type `{}` cannot be dereferenced",
+            d.found.display(ctx.sema.db, ctx.display_target)
+        ),
+        d.pat.map(Into::into),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+
+    #[test]
+    fn trait_object_pattern_deref() {
+        check_diagnostics(
+            r#"
+trait Trait {}
+
+fn f(x: &dyn Trait) {
+    let &ref _y = x;
+      //^^^^^^^ error: type `&(dyn Trait + 'static)` cannot be dereferenced
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn allows_sized_ref_pattern_deref() {
+        check_diagnostics(
+            r#"
+fn f(x: &i32) {
+    let &ref _y = x;
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_index_into.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_index_into.rs
new file mode 100644
index 0000000..1e42313
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/cannot_index_into.rs
@@ -0,0 +1,77 @@
+use hir::HirDisplay;
+
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: cannot-index-into
+//
+// This diagnostic is triggered if indexing is used on a type that cannot be
+// indexed.
+pub(crate) fn cannot_index_into(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::CannotIndexInto<'_>,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0608"),
+        format!(
+            "cannot index into a value of type `{}`",
+            d.found.display(ctx.sema.db, ctx.display_target)
+        ),
+        d.expr.map(Into::into),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+
+    #[test]
+    fn cannot_index_into() {
+        check_diagnostics(
+            r#"
+//- minicore: index
+fn f() {
+    let x = 1i32;
+    let _ = x[0];
+          //^^^^ error: cannot index into a value of type `i32`
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn allows_array_indexing() {
+        check_diagnostics(
+            r#"
+//- minicore: index, slice
+fn f() {
+    let x = [1i32, 2];
+    let _ = x[0];
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn allows_overloaded_indexing() {
+        check_diagnostics(
+            r#"
+//- minicore: index
+struct Bag(i32);
+
+impl core::ops::Index<usize> for Bag {
+    type Output = i32;
+
+    fn index(&self, _: usize) -> &Self::Output {
+        &self.0
+    }
+}
+
+fn f(x: Bag) {
+    let _ = x[0];
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/explicit_drop_method_use.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/explicit_drop_method_use.rs
new file mode 100644
index 0000000..b02bccf
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/explicit_drop_method_use.rs
@@ -0,0 +1,426 @@
+use either::Either;
+use hir::InFile;
+use ide_db::assists::Assist;
+use ide_db::source_change::{SourceChange, SourceChangeBuilder};
+use ide_db::text_edit::TextEdit;
+use itertools::Itertools;
+use syntax::{
+    AstNode, AstPtr,
+    ast::{self, HasArgList},
+};
+
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext, adjusted_display_range, fix};
+
+// Diagnostic: explicit-drop-method-use
+//
+// This diagnostic is triggered when the `Drop::drop` method is called (or named) explicitly.
+pub(crate) fn explicit_drop_method_use(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::ExplicitDropMethodUse,
+) -> Diagnostic {
+    match d.expr_or_path {
+        Either::Left(expr) => {
+            let display_range = adjusted_display_range(ctx, expr, &|node| {
+                Some(node.name_ref()?.syntax().text_range())
+            });
+            Diagnostic::new(
+                DiagnosticCode::RustcHardError("E0040"),
+                "explicit use of destructor method",
+                display_range,
+            )
+            .stable()
+            .with_main_node(expr.map(Into::into))
+            .with_fixes(fix_method_call(ctx, expr))
+        }
+        Either::Right(path) => Diagnostic::new_with_syntax_node_ptr(
+            ctx,
+            DiagnosticCode::RustcHardError("E0040"),
+            "explicit use of destructor method",
+            path.map(Into::into),
+        )
+        .stable()
+        .with_fixes(fix_path(ctx, path)),
+    }
+}
+
+fn fix_method_call(
+    ctx: &DiagnosticsContext<'_, '_>,
+    mcall_ptr: InFile<AstPtr<ast::MethodCallExpr>>,
+) -> Option<Vec<Assist>> {
+    if mcall_ptr.file_id.is_macro() {
+        // TODO: handle macro calls. Rough plan:
+        // 1. upmap the range of the receiver and the range of the whole call
+        // 2. delete everything outside the receiver and replace it with `drop(...)`, using range edits only.
+        return None;
+    }
+
+    let db = ctx.db();
+
+    let file_id = mcall_ptr.file_id;
+    let mcall = mcall_ptr.to_node(db);
+    let range = mcall.syntax().text_range();
+
+    // `mcall` is `foo.drop()` -- extract the receiver, and wrap it in `drop()`
+    // NOTE: it could theoretically be `(&mut foo).drop()` instead, in which case the fix
+    // below would be incorrect, as it'd result in `drop((&mut foo))` instead of `drop(foo)`
+    // -- but we don't bother to deal with that case.
+    let recv = mcall.receiver()?;
+
+    let mut builder = SourceChangeBuilder::new(file_id.original_file(db).file_id(db));
+    let editor = builder.make_editor(mcall.syntax());
+    let make = editor.make();
+    let new_call =
+        make.expr_call(make.expr_path(make.path_from_text("drop")), make.arg_list([recv]));
+    builder.replace_ast(ast::Expr::MethodCallExpr(mcall), ast::Expr::CallExpr(new_call));
+    let source_change = builder.finish();
+    Some(vec![fix("use-drop-function", "Use `drop` function", source_change, range)])
+}
+
+fn fix_path(
+    ctx: &DiagnosticsContext<'_, '_>,
+    path_ptr: InFile<AstPtr<ast::Path>>,
+) -> Option<Vec<Assist>> {
+    let db = ctx.db();
+
+    let file_id = path_ptr.file_id;
+    let path = path_ptr.to_node(db);
+
+    if let Some(call) =
+        path.syntax().parent().and_then(|it| it.parent()).and_then(ast::CallExpr::cast)
+    {
+        if file_id.is_macro() {
+            // TODO: make this work in macros? Might not be worth it, as this is a niche way to trigger this
+            // already niche error
+            return None;
+        }
+
+        // `call` is `Drop::drop(&mut foo)` -- extract the arg, and wrap it in `drop()`
+        let arg_list = call.arg_list()?;
+        let ref_recv = arg_list.args().exactly_one().ok()?;
+        let ast::Expr::RefExpr(ref_recv) = ref_recv else {
+            return None;
+        };
+        let recv = ref_recv.expr()?;
+
+        let range = call.syntax().text_range();
+
+        let mut builder = SourceChangeBuilder::new(file_id.original_file(db).file_id(db));
+        let editor = builder.make_editor(call.syntax());
+        let make = editor.make();
+        let new_call =
+            make.expr_call(make.expr_path(make.path_from_text("drop")), make.arg_list([recv]));
+        builder.replace_ast(call, new_call);
+        let source_change = builder.finish();
+        Some(vec![fix("use-drop-function", "Use `drop` function", source_change, range)])
+    } else {
+        // `path` could be the `Foo::drop` in `let d = Foo::drop;`
+        // -- replace the path with `drop`
+
+        let range = InFile::new(file_id, path.syntax().text_range())
+            .original_node_file_range_rooted_opt(db)?;
+
+        let edit = TextEdit::replace(range.range, "drop".to_owned());
+        let source_change = SourceChange::from_text_edit(range.file_id.file_id(db), edit);
+        Some(vec![fix("use-drop-function", "Use `drop` function", source_change, range.range)])
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::{
+        check_diagnostics, check_diagnostics_with_disabled, check_fix, check_fix_with_disabled,
+    };
+
+    #[test]
+    fn method_call_diagnostic() {
+        check_diagnostics(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    a.drop();
+   // ^^^^ 💡 error: explicit use of destructor method
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn method_call_fix() {
+        check_fix(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    a.drop$0();
+}
+"#,
+            r#"
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    drop(a);
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn qualified_call_1_diagnostic() {
+        check_diagnostics(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    A::drop(&mut a);
+ // ^^^^^^^ 💡 error: explicit use of destructor method
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn qualified_call_1_fix() {
+        check_fix(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    A::drop(&mut a$0);
+}
+"#,
+            r#"
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    drop(a);
+}
+"#,
+        )
+    }
+
+    #[test]
+    fn qualified_call_2_diagnostic() {
+        check_diagnostics(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    Drop::drop(&mut a);
+ // ^^^^^^^^^^ 💡 error: explicit use of destructor method
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn qualified_call_2_fix() {
+        check_fix(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    Drop::drop(&mut a$0);
+}
+"#,
+            r#"
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    drop(a);
+}
+"#,
+        )
+    }
+
+    #[test]
+    fn fully_qualified_call_diagnostic() {
+        check_diagnostics(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    <A as Drop>::drop(&mut a);
+ // ^^^^^^^^^^^^^^^^^ 💡 error: explicit use of destructor method
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn fully_qualified_call_fix() {
+        check_fix(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    <A as Drop>::drop(&mut a$0);
+}
+"#,
+            r#"
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    drop(a);
+}
+"#,
+        )
+    }
+
+    #[test]
+    fn path_diagnostic() {
+        check_diagnostics_with_disabled(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    let d = A::drop;
+         // ^^^^^^^ 💡 error: explicit use of destructor method
+    d(&mut a);
+}
+"#,
+            // Because of the error, the code isn't analyzed further (?), and so `d` is warned on as unused.
+            // Arguably a bug in r-a (rustc doesn't emit a warning in this case)
+            // FIXME: remove this once r-a no longer warns
+            &["unused_variables"],
+        );
+    }
+
+    #[test]
+    // NOTE: Here, the fix is not completely correct, as it doesn't replace `d(&mut a)` with `d(a)`.
+    // Oh well, rustc doesn't either
+    fn path_fix() {
+        check_fix_with_disabled(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    let d = A::drop$0;
+    d(&mut a);
+}
+"#,
+            r#"
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    let d = drop;
+    d(&mut a);
+}
+"#,
+            // Because of the error, the code isn't analyzed further (?), and so `d` is warned on as unused.
+            // Arguably a bug in r-a (rustc doesn't emit a warning in this case)
+            // FIXME: remove this once r-a no longer warns
+            &["unused_variables"],
+        );
+    }
+
+    #[test]
+    // NOTE: Here, the fix is not completely correct, as it doesn't replace `d(&mut a)` with `d(a)`.
+    // Oh well, rustc doesn't either
+    fn path_fix_in_macro() {
+        check_fix(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+macro_rules! main {
+    ($e:expr) => {
+        fn main() { $e }
+    }
+}
+
+main!{{
+    let mut a = A;
+    let d = A::drop$0;
+    d(&mut a);
+}};
+"#,
+            r#"
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+macro_rules! main {
+    ($e:expr) => {
+        fn main() { $e }
+    }
+}
+
+main!{{
+    let mut a = A;
+    let d = drop;
+    d(&mut a);
+}};
+"#,
+        );
+    }
+
+    #[test]
+    fn std_mem_drop() {
+        check_diagnostics(
+            r#"
+//- minicore: drop
+struct A;
+impl Drop for A { fn drop(&mut self) {} }
+
+fn main(a: A) {
+    drop(a);
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn inherent_drop_method() {
+        check_diagnostics(
+            r#"
+struct A;
+impl A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    a.drop();
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn custom_trait_drop_method() {
+        check_diagnostics(
+            r#"
+struct A;
+trait MyDrop { fn drop(&mut self); }
+impl MyDrop for A { fn drop(&mut self) {} }
+
+fn main(mut a: A) {
+    a.drop();
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/fru_in_destructuring_assignment.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/fru_in_destructuring_assignment.rs
new file mode 100644
index 0000000..f8d3d80
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/fru_in_destructuring_assignment.rs
@@ -0,0 +1,67 @@
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: fru-in-destructuring-assignment
+//
+// This diagnostic is triggered when a destructuring assignment contains functional record update
+pub(crate) fn fru_in_destructuring_assignment(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::FruInDestructuringAssignment,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::SyntaxError,
+        "functional record updates are not allowed in destructuring assignments",
+        d.node.map(Into::into),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::{check_diagnostics, check_diagnostics_with_disabled};
+
+    #[test]
+    fn spread_variable() {
+        check_diagnostics_with_disabled(
+            r#"
+struct Foo { bar: u32, baz: u32 }
+fn test(f: Foo, g: Foo, mut bar: u32, mut baz: u32) {
+    Foo { ..g } = f;
+         // ^ error: functional record updates are not allowed in destructuring assignments
+    Foo { bar, ..g } = f;
+              // ^ error: functional record updates are not allowed in destructuring assignments
+    Foo { bar, baz, ..g } = f;
+                   // ^ error: functional record updates are not allowed in destructuring assignments
+}
+        "#,
+            // We don't end up using neither `bar` nor `baz`
+            &["unused_variables"],
+        );
+    }
+
+    #[test]
+    fn spread_default() {
+        check_diagnostics(
+            r#"
+struct Foo { bar: u32, baz: u32 }
+fn test(f: Foo) {
+    Foo { ..Default::default() } = f;
+         // ^^^^^^^^^^^^^^^^^^ error: functional record updates are not allowed in destructuring assignments
+}
+        "#,
+        );
+    }
+
+    #[test]
+    fn spread_struct() {
+        check_diagnostics(
+            r#"
+struct Foo { bar: u32, baz: u32 }
+fn test(f: Foo) {
+    Foo { ..Foo { bar: 0, baz: 0 } } = f;
+         // ^^^^^^^^^^^^^^^^^^^^^^ error: functional record updates are not allowed in destructuring assignments
+}
+        "#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/infer_vars_not_allowed.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/infer_vars_not_allowed.rs
new file mode 100644
index 0000000..cf369a1
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/infer_vars_not_allowed.rs
@@ -0,0 +1,49 @@
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: infer-vars-not-allowed
+//
+// This diagnostic is triggered when `_` is used where type
+// inference is not allowed.
+pub(crate) fn infer_vars_not_allowed(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::InferVarsNotAllowed,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0121"),
+        "the type placeholder `_` is not allowed within types on item signatures",
+        d.node,
+    )
+}
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+    #[test]
+    fn type_alias() {
+        check_diagnostics(
+            r#"
+type Foo = _;
+        // ^ error: the type placeholder `_` is not allowed within types on item signatures
+        "#,
+        );
+    }
+    #[test]
+    fn const_item() {
+        check_diagnostics(
+            r#"
+const X: _ = 0;
+      // ^ error: the type placeholder `_` is not allowed within types on item signatures
+        "#,
+        );
+    }
+
+    #[test]
+    fn static_item() {
+        check_diagnostics(
+            r#"
+static Y: _ = 0;
+       // ^ error: the type placeholder `_` is not allowed within types on item signatures
+        "#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/invalid_range_pat_type.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/invalid_range_pat_type.rs
new file mode 100644
index 0000000..465f595
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/invalid_range_pat_type.rs
@@ -0,0 +1,55 @@
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: invalid-range-pat-type
+//
+// This diagnostic is triggered when a range pattern is used with a type that
+// is neither `char` nor numeric.
+pub(crate) fn invalid_range_pat_type(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::InvalidRangePatType,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0029"),
+        "only `char` and numeric types are allowed in range patterns",
+        d.pat.map(Into::into),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+
+    #[test]
+    fn bool_range_pattern() {
+        check_diagnostics(
+            r#"
+fn f(x: bool) {
+    match x {
+        false..=true => {}
+      //^^^^^^^^^^^^ error: only `char` and numeric types are allowed in range patterns
+    }
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn numeric_and_char_range_patterns() {
+        check_diagnostics(
+            r#"
+fn f(x: u8, c: char) {
+    match x {
+        0..=9 => {}
+        _ => {}
+    }
+    match c {
+        'a'..='z' => {}
+        _ => {}
+    }
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/macro_error.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/macro_error.rs
index b6571e0..7acbcad 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/macro_error.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/macro_error.rs
@@ -327,4 +327,21 @@ fn it_works() {
         "#,
         );
     }
+
+    #[test]
+    fn unimplemented_builtin_macro() {
+        check_diagnostics(
+            r#"
+#[rustc_builtin_macro]
+macro_rules! unimplemented_builtin_macro {
+          // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ weak: unimplemented built-in macro
+    () => {};
+}
+
+ #[unimplemented_builtin_macro]
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this built-in macro is not implemented
+struct Foo;
+        "#,
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/method_call_illegal_sized_bound.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/method_call_illegal_sized_bound.rs
new file mode 100644
index 0000000..0a0ac86
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/method_call_illegal_sized_bound.rs
@@ -0,0 +1,78 @@
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: method-call-illegal-sized-bound
+//
+// This diagnostic is triggered when a method is called on a trait-object
+// receiver but the method's predicates require `Self: Sized`, which the
+// trait object cannot satisfy.
+pub(crate) fn method_call_illegal_sized_bound(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::MethodCallIllegalSizedBound,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0277"),
+        "the method cannot be invoked on a trait object because its `Self: Sized` bound is not satisfied",
+        d.call_expr.map(|it| it.into()),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+
+    #[test]
+    fn sized_bound_method_on_trait_object_errors() {
+        check_diagnostics(
+            r#"
+//- minicore: sized
+trait Foo {
+    fn cant_call(&self) where Self: Sized;
+}
+
+fn f(x: &dyn Foo) {
+    x.cant_call();
+  //^^^^^^^^^^^^^ error: the method cannot be invoked on a trait object because its `Self: Sized` bound is not satisfied
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn method_without_sized_bound_on_trait_object_does_not_error() {
+        check_diagnostics(
+            r#"
+//- minicore: sized
+trait Foo {
+    fn dyn_safe(&self);
+}
+
+fn f(x: &dyn Foo) {
+    x.dyn_safe();
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn sized_bound_method_on_concrete_type_does_not_error() {
+        check_diagnostics(
+            r#"
+//- minicore: sized
+trait Foo {
+    fn cant_dispatch(&self) where Self: Sized;
+}
+
+struct S;
+impl Foo for S {
+    fn cant_dispatch(&self) {}
+}
+
+fn f(s: &S) {
+    s.cant_dispatch();
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/missing_unsafe.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/missing_unsafe.rs
index b4ddb23..d279e9b 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/missing_unsafe.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/missing_unsafe.rs
@@ -425,17 +425,20 @@ fn main() {
     fn raw_deref_on_union_field() {
         check_diagnostics(
             r#"
+//- minicore: index, slice
+#![allow(unused_variables)]
+
 fn main() {
 
     union U {
         a: u8
     }
-    let x = U { a: 3 };
+    let mut x = U { a: 3 };
 
     let a = &raw mut x.a;
 
     union U1 {
-        a: u8
+        a: usize
     }
     let x = U1 { a: 3 };
 
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/mutability_errors.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/mutability_errors.rs
index 31becd1..49aa6d7 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/mutability_errors.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/mutability_errors.rs
@@ -1313,7 +1313,7 @@ fn main() {
     fn regression_20662() {
         check_diagnostics(
             r#"
-//- minicore: index
+//- minicore: index, slice
 pub trait A: core::ops::IndexMut<usize> {
     type T: A;
 }
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/mutable_ref.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/mutable_ref.rs
new file mode 100644
index 0000000..b566196
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/mutable_ref.rs
@@ -0,0 +1,64 @@
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: mutable-ref
+//
+// This diagnostic is triggered when binding is taken that is both mutable and by-reference.
+pub(crate) fn mutable_ref_binding(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::MutableRefBinding,
+) -> Diagnostic {
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0658"),
+        "bindings cannot be both mutable and by-reference by default in 2024 edition. add experimental #![feature(mut_ref)] for this functionality",
+        d.pat.map(Into::into),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+
+    #[test]
+    fn mutable_ref_binding_missing_feature() {
+        check_diagnostics(
+            r#"
+//- minicore: option
+#![feature(ref_pat_eat_one_layer_2024)]
+struct TestStruct {
+   val: i32
+}
+fn main() {
+    let opt_ref = &Some(TestStruct {val: 1});
+
+    if let Some(mut x) = opt_ref {
+              //^^^^^ error: bindings cannot be both mutable and by-reference by default in 2024 edition. add experimental #![feature(mut_ref)] for this functionality
+        x = &TestStruct{val: 5};
+    }
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn mutable_ref_binding_with_feature() {
+        check_diagnostics(
+            r#"
+//- minicore: option
+#![feature(ref_pat_eat_one_layer_2024)]
+#![feature(mut_ref)]
+struct TestStruct {
+    val: i32
+}
+fn main() {
+    let opt_ref = &Some(TestStruct{val: 1});
+
+    if let Some(mut x) = opt_ref {
+        x = &TestStruct{val: 5};
+    }
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/no_such_field.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/no_such_field.rs
index 7959fdd..3dd6744 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/no_such_field.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/no_such_field.rs
@@ -116,14 +116,13 @@ fn missing_record_expr_field_fixes(
 
     let mut new_field = new_field.to_string();
     // FIXME: check submodule instead of FileId
-    if usage_file_id != def_file_id && !matches!(def_id, hir::Variant::EnumVariant(_)) {
-        new_field = format!("pub(crate) {new_field}");
-    }
-    new_field = format!("\n{indent}{new_field}{postfix}");
-
-    if needs_comma {
-        new_field = format!(",{new_field}");
-    }
+    let vis = if usage_file_id != def_file_id && !matches!(def_id, hir::Variant::EnumVariant(_)) {
+        "pub(crate) "
+    } else {
+        ""
+    };
+    let comma = if needs_comma { "," } else { "" };
+    new_field = format!("{comma}\n{indent}{vis}{new_field}{postfix}");
 
     let source_change = SourceChange::from_text_edit(
         def_file_id.file_id(sema.db),
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/non_exhaustive_record_pat.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/non_exhaustive_record_pat.rs
new file mode 100644
index 0000000..ea587e6
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/non_exhaustive_record_pat.rs
@@ -0,0 +1,79 @@
+use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext};
+
+// Diagnostic: non-exhaustive-record-pat
+//
+// This diagnostic is triggered if a record pattern destructures a `#[non_exhaustive]`
+// struct or enum variant from another crate without `..`.
+pub(crate) fn non_exhaustive_record_pat(
+    ctx: &DiagnosticsContext<'_, '_>,
+    d: &hir::NonExhaustiveRecordPat,
+) -> Diagnostic {
+    let item = match d.variant {
+        hir::Variant::Struct(_) => "struct",
+        hir::Variant::Union(_) => "union",
+        hir::Variant::EnumVariant(_) => "variant",
+    };
+
+    Diagnostic::new_with_syntax_node_ptr(
+        ctx,
+        DiagnosticCode::RustcHardError("E0638"),
+        format!("`..` required with {item} marked as non-exhaustive"),
+        d.pat.map(Into::into),
+    )
+    .stable()
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::tests::check_diagnostics;
+
+    #[test]
+    fn reports_external_non_exhaustive_struct_pattern_without_rest() {
+        check_diagnostics(
+            r#"
+//- /lib.rs crate:lib
+#[non_exhaustive]
+pub struct S {
+    pub field: u32,
+}
+
+fn local_ok(s: S) {
+    let S { field } = s;
+    let _ = field;
+}
+
+//- /main.rs crate:main deps:lib
+fn main(s: lib::S) {
+    let lib::S { field } = s;
+      //^^^^^^^^^^^^^^^^ error: `..` required with struct marked as non-exhaustive
+    let _ = field;
+}
+"#,
+        );
+    }
+
+    #[test]
+    fn reports_external_non_exhaustive_variant_pattern_without_rest() {
+        check_diagnostics(
+            r#"
+//- /lib.rs crate:lib
+pub enum E {
+    #[non_exhaustive]
+    V { field: u32 },
+}
+
+fn local_ok(e: E) {
+    let E::V { field } = e;
+    let _ = field;
+}
+
+//- /main.rs crate:main deps:lib
+fn main(e: lib::E) {
+    let lib::E::V { field } = e;
+      //^^^^^^^^^^^^^^^^^^^ error: `..` required with variant marked as non-exhaustive
+    let _ = field;
+}
+"#,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/pattern_arg_in_extern_fn.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/pattern_arg_in_extern_fn.rs
index 459ec17..8a54834 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/pattern_arg_in_extern_fn.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/pattern_arg_in_extern_fn.rs
@@ -21,6 +21,24 @@ mod tests {
     use crate::tests::check_diagnostics;
 
     #[test]
+    fn ident_pattern_allowed() {
+        check_diagnostics(
+            r#"
+unsafe extern { fn foo(a: i32); }
+            "#,
+        );
+    }
+
+    #[test]
+    fn wildcard_pattern_allowed() {
+        check_diagnostics(
+            r#"
+unsafe extern { fn foo(_: i32); }
+            "#,
+        );
+    }
+
+    #[test]
     fn tuple_pattern() {
         check_diagnostics(
             r#"
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/trait_impl_missing_assoc_item.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/trait_impl_missing_assoc_item.rs
index 5f5e155..1ffef25 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/trait_impl_missing_assoc_item.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/trait_impl_missing_assoc_item.rs
@@ -149,10 +149,18 @@ impl Trait for () {
     type Item = ();
     fn item() {}
 }
+impl Trait for Adt<i32> {}
+   //^^^^^ error: not all trait items implemented, missing: `type Item`, `fn item`
 
 // Items with Self: Sized bound not required to be implemented for unsized types.
 impl Trait for str {}
 impl Trait for dyn OtherTrait {}
+impl Trait for Adt<[i32]> {}
+impl Trait for Slice<i32> {}
+impl Trait for (str,) {}
+
+struct Adt<T>(i32, T);
+struct Slice<T>([T]);
  "#,
         )
     }
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_mismatch.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_mismatch.rs
index 250c692..5a1856c 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_mismatch.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_mismatch.rs
@@ -8,7 +8,7 @@
 use syntax::{
     AstNode, AstPtr, TextSize,
     ast::{
-        self, BlockExpr, Expr, ExprStmt, HasArgList,
+        self, BlockExpr, Expr, ExprStmt, HasArgList, RefExpr,
         edit::{AstNodeEdit, IndentLevel},
     },
 };
@@ -51,10 +51,10 @@ pub(crate) fn type_mismatch(
             format!(
                 "expected {}, found {}",
                 d.expected
-                    .display(ctx.sema.db, ctx.display_target)
+                    .display(ctx.db(), ctx.display_target)
                     .with_closure_style(ClosureStyle::ClosureWithId),
                 d.actual
-                    .display(ctx.sema.db, ctx.display_target)
+                    .display(ctx.db(), ctx.display_target)
                     .with_closure_style(ClosureStyle::ClosureWithId),
             ),
             display_range,
@@ -69,7 +69,7 @@ fn fixes(ctx: &DiagnosticsContext<'_, '_>, d: &hir::TypeMismatch<'_>) -> Option<
 
     if let Some(expr_ptr) = d.expr_or_pat.value.cast::<ast::Expr>() {
         let expr_ptr = &InFile { file_id: d.expr_or_pat.file_id, value: expr_ptr };
-        add_reference(ctx, d, expr_ptr, &mut fixes);
+        add_or_fix_reference(ctx, d, expr_ptr, &mut fixes);
         add_missing_ok_or_some(ctx, d, expr_ptr, &mut fixes);
         remove_unnecessary_wrapper(ctx, d, expr_ptr, &mut fixes);
         remove_semicolon(ctx, d, expr_ptr, &mut fixes);
@@ -79,7 +79,7 @@ fn fixes(ctx: &DiagnosticsContext<'_, '_>, d: &hir::TypeMismatch<'_>) -> Option<
     if fixes.is_empty() { None } else { Some(fixes) }
 }
 
-fn add_reference(
+fn add_or_fix_reference(
     ctx: &DiagnosticsContext<'_, '_>,
     d: &hir::TypeMismatch<'_>,
     expr_ptr: &InFile<AstPtr<ast::Expr>>,
@@ -87,13 +87,56 @@ fn add_reference(
 ) -> Option<()> {
     let range = ctx.sema.diagnostics_display_range((*expr_ptr).map(|it| it.into()));
 
-    let (_, mutability) = d.expected.as_reference()?;
-    let actual_with_ref = d.actual.add_reference(mutability);
-    if !actual_with_ref.could_coerce_to(ctx.sema.db, &d.expected) {
+    let (expected_with_ref_removed, expected_mutability) = d.expected.as_reference()?;
+
+    if let Some((actual_with_ref_removed, hir::Mutability::Shared)) = d.actual.as_reference()
+        && expected_mutability == hir::Mutability::Mut
+        && actual_with_ref_removed.could_coerce_to(ctx.db(), &expected_with_ref_removed)
+    {
+        // The actual type is `&T`, and the expected type is `&mut T`, (or `U` that `T` can be coerced to).
+        // It's likely that, instead of adding a reference, we should just change the mutability of
+        // the existing one.
+
+        let expr = expr_ptr.to_node(ctx.db());
+        // If the node comes from a macro expansion, then we shouldn't assist,
+        // as the suggestion would overwrite the macro _definition_ position
+        let expr = ctx.sema.original_ast_node(expr)?;
+        let expr_without_ref = RefExpr::cast(expr.syntax().clone())?.expr()?;
+
+        let pos = expr_without_ref.syntax().text_range().start();
+        let edit = TextEdit::insert(pos, expected_mutability.as_keyword_for_ref().to_owned());
+        let source_change = SourceChange::from_text_edit(range.file_id, edit);
+        acc.push(fix(
+            "make_reference_mutable",
+            "Make reference mutable",
+            source_change,
+            range.range,
+        ));
+        return Some(());
+    }
+
+    let actual_with_ref = d.actual.add_reference(ctx.db(), expected_mutability);
+    if !actual_with_ref.could_coerce_to(ctx.db(), &d.expected) {
         return None;
     }
 
-    let ampersands = format!("&{}", mutability.as_keyword_for_ref());
+    let expr = expr_ptr.to_node(ctx.db());
+    let assign = expr
+        .syntax()
+        .parent()
+        .and_then(ast::BinExpr::cast)
+        .filter(|it| it.op_kind() == Some(ast::BinaryOp::Assignment { op: None }));
+    if let Some(assign) = assign
+        && expected_mutability.is_mut()
+        && let Some(range) = ctx.sema.original_range_opt(assign.syntax())
+    {
+        let edit = TextEdit::insert(range.range.start(), "*".to_owned());
+        let source_change = SourceChange::from_text_edit(range.file_id.file_id(ctx.db()), edit);
+        acc.push(fix("add_deref_here", "Add deref here", source_change, range.range));
+        return Some(());
+    }
+
+    let ampersands = format!("&{}", expected_mutability.as_keyword_for_ref());
 
     let edit = TextEdit::insert(range.range.start(), ampersands);
     let source_change = SourceChange::from_text_edit(range.file_id, edit);
@@ -107,7 +150,7 @@ fn add_missing_ok_or_some(
     expr_ptr: &InFile<AstPtr<ast::Expr>>,
     acc: &mut Vec<Assist>,
 ) -> Option<()> {
-    let root = ctx.sema.db.parse_or_expand(expr_ptr.file_id);
+    let root = ctx.db().parse_or_expand(expr_ptr.file_id);
     let expr = expr_ptr.value.to_node(&root);
     let hir::FileRange { file_id, range: expr_range } =
         ctx.sema.original_range_opt(expr.syntax())?;
@@ -126,14 +169,13 @@ fn add_missing_ok_or_some(
 
     let variant_name = if Some(expected_enum) == core_result { "Ok" } else { "Some" };
 
-    let wrapped_actual_ty =
-        expected_adt.ty_with_args(ctx.sema.db, std::iter::once(d.actual.clone()));
+    let wrapped_actual_ty = expected_adt.ty(ctx.db()).instantiate([d.actual.clone()]);
 
-    if !d.expected.could_unify_with(ctx.sema.db, &wrapped_actual_ty) {
+    if !d.expected.could_unify_with(ctx.db(), &wrapped_actual_ty) {
         return None;
     }
 
-    let file_id = file_id.file_id(ctx.sema.db);
+    let file_id = file_id.file_id(ctx.db());
 
     if d.actual.is_unit() {
         if let Expr::BlockExpr(block) = &expr {
@@ -202,7 +244,7 @@ fn remove_unnecessary_wrapper(
     expr_ptr: &InFile<AstPtr<ast::Expr>>,
     acc: &mut Vec<Assist>,
 ) -> Option<()> {
-    let db = ctx.sema.db;
+    let db = ctx.db();
     let root = db.parse_or_expand(expr_ptr.file_id);
     let expr = expr_ptr.value.to_node(&root);
     // FIXME: support inside MacroCall?
@@ -225,7 +267,7 @@ fn remove_unnecessary_wrapper(
         return None;
     }
 
-    let inner_type = variant.fields(db).first()?.ty_with_args(db, d.actual.type_arguments());
+    let inner_type = variant.fields(db).first()?.ty(db).instantiate(d.actual.type_arguments());
     if !d.expected.could_unify_with(db, &inner_type) {
         return None;
     }
@@ -233,7 +275,7 @@ fn remove_unnecessary_wrapper(
     let inner_arg = call_expr.arg_list()?.args().next()?;
 
     let file_id = expr_ptr.file_id.original_file(db);
-    let mut builder = SourceChangeBuilder::new(file_id.file_id(ctx.sema.db));
+    let mut builder = SourceChangeBuilder::new(file_id.file_id(ctx.db()));
     let editor;
     match inner_arg {
         // We're returning `()`
@@ -267,7 +309,7 @@ fn remove_unnecessary_wrapper(
         }
     }
 
-    builder.add_file_edits(file_id.file_id(ctx.sema.db), editor);
+    builder.add_file_edits(file_id.file_id(ctx.db()), editor);
     let name = format!("Remove unnecessary {}() wrapper", variant.name(db).as_str());
     acc.push(fix(
         "remove_unnecessary_wrapper",
@@ -284,7 +326,7 @@ fn remove_semicolon(
     expr_ptr: &InFile<AstPtr<ast::Expr>>,
     acc: &mut Vec<Assist>,
 ) -> Option<()> {
-    let root = ctx.sema.db.parse_or_expand(expr_ptr.file_id);
+    let root = ctx.db().parse_or_expand(expr_ptr.file_id);
     let expr = expr_ptr.value.to_node(&root);
     if !d.actual.is_unit() {
         return None;
@@ -294,14 +336,14 @@ fn remove_semicolon(
     let expr_before_semi =
         block.statements().last().and_then(|s| ExprStmt::cast(s.syntax().clone()))?;
     let type_before_semi = ctx.sema.type_of_expr(&expr_before_semi.expr()?)?.original();
-    if !type_before_semi.could_coerce_to(ctx.sema.db, &d.expected) {
+    if !type_before_semi.could_coerce_to(ctx.db(), &d.expected) {
         return None;
     }
     let semicolon_range = expr_before_semi.semicolon_token()?.text_range();
 
     let edit = TextEdit::delete(semicolon_range);
     let source_change = SourceChange::from_text_edit(
-        expr_ptr.file_id.original_file(ctx.sema.db).file_id(ctx.sema.db),
+        expr_ptr.file_id.original_file(ctx.db()).file_id(ctx.db()),
         edit,
     );
 
@@ -315,21 +357,21 @@ fn str_ref_to_owned(
     expr_ptr: &InFile<AstPtr<ast::Expr>>,
     acc: &mut Vec<Assist>,
 ) -> Option<()> {
-    let expected = d.expected.display(ctx.sema.db, ctx.display_target);
+    let expected = d.expected.display(ctx.db(), ctx.display_target);
     // FIXME do this properly
     let is_applicable = d.actual.strip_reference().is_str() && expected.to_string() == "String";
     if !is_applicable {
         return None;
     }
 
-    let root = ctx.sema.db.parse_or_expand(expr_ptr.file_id);
+    let root = ctx.db().parse_or_expand(expr_ptr.file_id);
     let expr = expr_ptr.value.to_node(&root);
     let hir::FileRange { file_id, range } = ctx.sema.original_range_opt(expr.syntax())?;
 
     let to_owned = ".to_owned()".to_owned();
 
     let edit = TextEdit::insert(range.end(), to_owned);
-    let source_change = SourceChange::from_text_edit(file_id.file_id(ctx.sema.db), edit);
+    let source_change = SourceChange::from_text_edit(file_id.file_id(ctx.db()), edit);
     acc.push(fix("str_ref_to_owned", "Add .to_owned() here", source_change, range));
 
     Some(())
@@ -392,6 +434,112 @@ fn test(_arg: &mut i32) {}
     }
 
     #[test]
+    fn fix_reference_to_int() {
+        check_fix(
+            r#"
+fn main() {
+    test($0&123);
+}
+fn test(_arg: &mut i32) {}
+            "#,
+            r#"
+fn main() {
+    test(&mut 123);
+}
+fn test(_arg: &mut i32) {}
+            "#,
+        );
+    }
+
+    #[test]
+    fn add_reference_to_parenthesized_int() {
+        check_fix(
+            r#"
+fn main() {
+    test(($0123));
+}
+fn test(_arg: &i32) {}
+            "#,
+            r#"
+fn main() {
+    test((&123));
+}
+fn test(_arg: &i32) {}
+            "#,
+        );
+    }
+
+    #[test]
+    fn add_mutable_reference_to_parenthesized_int() {
+        check_fix(
+            r#"
+fn main() {
+    test(($0123));
+}
+fn test(_arg: &mut i32) {}
+            "#,
+            r#"
+fn main() {
+    test((&mut 123));
+}
+fn test(_arg: &mut i32) {}
+            "#,
+        );
+    }
+
+    #[test]
+    fn fix_reference_to_parenthesized_int_paren_inside_ref() {
+        check_fix(
+            r#"
+fn main() {
+    test(&$0(123));
+}
+fn test(_arg: &mut i32) {}
+            "#,
+            r#"
+fn main() {
+    test(&mut (123));
+}
+fn test(_arg: &mut i32) {}
+            "#,
+        );
+    }
+
+    #[test]
+    fn fix_reference_to_parenthesized_int_ref_inside_paren() {
+        check_fix(
+            r#"
+fn main() {
+    test(($0&123));
+}
+fn test(_arg: &mut i32) {}
+            "#,
+            r#"
+fn main() {
+    test((&mut 123));
+}
+fn test(_arg: &mut i32) {}
+            "#,
+        );
+    }
+
+    #[test]
+    fn add_deref_in_assign() {
+        check_fix(
+            r#"
+fn test(arg: &mut i32) {
+    arg = $02;
+}
+            "#,
+            r#"
+fn test(arg: &mut i32) {
+    *arg = 2;
+}
+            "#,
+        );
+    }
+
+    #[test]
     fn add_reference_to_array() {
         check_fix(
             r#"
@@ -411,6 +559,19 @@ fn test(_arg: &[i32]) {}
     }
 
     #[test]
+    fn fix_reference_to_array() {
+        check_no_fix(
+            r#"
+//- minicore: coerce_unsized
+fn main() {
+    test($0&[1, 2, 3]);
+}
+fn test(_arg: &mut [i32]) {}
+            "#,
+        );
+    }
+
+    #[test]
     fn add_reference_with_autoderef() {
         check_fix(
             r#"
@@ -444,6 +605,49 @@ fn test(_arg: &Bar) {}
     }
 
     #[test]
+    // FIXME: this should suggest making the reference mutable instead: `&Foo -> &mut Foo`.
+    // Currently it doesn't, as the logic for that assist strips away references, and thus checks
+    // whether `Foo` can be coerced to `Bar` (which it can't), instead of checking `&mut Foo` to
+    // `&mut Bar` (which it can)
+    fn fix_reference_with_autoderef() {
+        check_fix(
+            r#"
+//- minicore: coerce_unsized, deref_mut
+struct Foo;
+struct Bar;
+impl core::ops::Deref for Foo {
+    type Target = Bar;
+    fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::DerefMut for Foo {
+    fn deref_mut(&mut self) -> &mut Self::Target { loop {} }
+}
+
+fn main() {
+    test($0&Foo);
+}
+fn test(_arg: &mut Bar) {}
+            "#,
+            r#"
+struct Foo;
+struct Bar;
+impl core::ops::Deref for Foo {
+    type Target = Bar;
+    fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::DerefMut for Foo {
+    fn deref_mut(&mut self) -> &mut Self::Target { loop {} }
+}
+
+fn main() {
+    test(&mut &Foo);
+}
+fn test(_arg: &mut Bar) {}
+            "#,
+        );
+    }
+
+    #[test]
     fn add_reference_to_method_call() {
         check_fix(
             r#"
@@ -484,6 +688,38 @@ fn main() {
     }
 
     #[test]
+    fn add_mutable_reference_to_let_stmt() {
+        check_fix(
+            r#"
+fn main() {
+    let _test: &mut i32 = $0123;
+}
+            "#,
+            r#"
+fn main() {
+    let _test: &mut i32 = &mut 123;
+}
+            "#,
+        );
+    }
+
+    #[test]
+    fn fix_reference_to_let_stmt() {
+        check_fix(
+            r#"
+fn main() {
+    let _test: &mut i32 = $0&123;
+}
+            "#,
+            r#"
+fn main() {
+    let _test: &mut i32 = &mut 123;
+}
+            "#,
+        );
+    }
+
+    #[test]
     fn add_reference_to_macro_call() {
         check_fix(
             r#"
@@ -512,16 +748,50 @@ fn main() {
     }
 
     #[test]
-    fn add_mutable_reference_to_let_stmt() {
+    fn fix_reference_to_macro_call() {
         check_fix(
             r#"
+macro_rules! thousand {
+    () => {
+        1000_u64
+    };
+}
+
+fn test(_foo: &mut u64) {}
 fn main() {
-    let _test: &mut i32 = $0123;
+    test($0&thousand!());
 }
             "#,
             r#"
+macro_rules! thousand {
+    () => {
+        1000_u64
+    };
+}
+
+fn test(_foo: &mut u64) {}
 fn main() {
-    let _test: &mut i32 = &mut 123;
+    test(&mut thousand!());
+}
+            "#,
+        );
+    }
+
+    #[test]
+    // If the immutable reference comes from a macro expansion,
+    // we can't do anything to change it to a mutable one.
+    fn dont_fix_reference_inside_macro_call() {
+        check_no_fix(
+            r#"
+macro_rules! thousand {
+    () => {
+        &1000_u64
+    };
+}
+
+fn test(_foo: &mut u64) {}
+fn main() {
+    test($0thousand!());
 }
             "#,
         );
@@ -1207,6 +1477,20 @@ fn f() {
     }
 
     #[test]
+    fn type_mismatch_in_condition() {
+        check_diagnostics(
+            r#"
+fn f() {
+    if 1 {}
+     //^ error: expected bool, found i32
+    match () { _ if 1 => (), _ => () }
+                  //^ error: expected bool, found i32
+}
+"#,
+        );
+    }
+
+    #[test]
     fn regression_14768() {
         check_diagnostics(
             r#"
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_must_be_known.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_must_be_known.rs
index a03352f..ae4e6c6 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_must_be_known.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/type_must_be_known.rs
@@ -159,4 +159,17 @@ fn bar() {
         "#,
         );
     }
+
+    #[test]
+    fn include_bytes() {
+        check_diagnostics(
+            r#"
+//- minicore: include_bytes
+
+fn foo() {
+    include_bytes!("./foo.txt");
+}
+        "#,
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unimplemented_trait.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unimplemented_trait.rs
index d94ceef..4a253bc 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unimplemented_trait.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unimplemented_trait.rs
@@ -69,4 +69,20 @@ fn foo() {
         "#,
         );
     }
+
+    #[test]
+    fn for_iterable() {
+        check_diagnostics(
+            r#"
+//- minicore: iterator
+fn foo() {
+    for _ in () {}
+          // ^^ error: the trait bound `(): Iterator` is not satisfied
+          // ^^ error: the trait bound `(): Iterator` is not satisfied
+           // | required by the bound `(): IntoIterator`
+}
+
+        "#,
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unresolved_method.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unresolved_method.rs
index 93caf28..01929a5 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unresolved_method.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/unresolved_method.rs
@@ -129,25 +129,17 @@ fn assoc_func_fix(
         let receiver_type = &ctx.sema.type_of_expr(&receiver)?.original;
 
         let assoc_fn_params = f.assoc_fn_params(db);
-        let need_to_take_receiver_as_first_arg = if assoc_fn_params.is_empty() {
-            false
-        } else {
-            assoc_fn_params
-                .first()
-                .map(|first_arg| {
-                    // For generic type, say `Box`, take `Box::into_raw(b: Self)` as example,
-                    // type of `b` is `Self`, which is `Box<T, A>`, containing unspecified generics.
-                    // However, type of `receiver` is specified, it could be `Box<i32, Global>` or something like that,
-                    // so `first_arg.ty() == receiver_type` evaluate to `false` here.
-                    // Here add `first_arg.ty().as_adt() == receiver_type.as_adt()` as guard,
-                    // apply `.as_adt()` over `Box<T, A>` or `Box<i32, Global>` gets `Box`, so we get `true` here.
+        let need_to_take_receiver_as_first_arg = assoc_fn_params.first().is_some_and(|first_arg| {
+            // For generic type, say `Box`, take `Box::into_raw(b: Self)` as example,
+            // type of `b` is `Self`, which is `Box<T, A>`, containing unspecified generics.
+            // However, type of `receiver` is specified, it could be `Box<i32, Global>` or something like that,
+            // so `first_arg.ty() == receiver_type` evaluate to `false` here.
+            // Here add `first_arg.ty().as_adt() == receiver_type.as_adt()` as guard,
+            // apply `.as_adt()` over `Box<T, A>` or `Box<i32, Global>` gets `Box`, so we get `true` here.
 
-                    // FIXME: it fails when type of `b` is `Box` with other generic param different from `receiver`
-                    first_arg.ty() == receiver_type
-                        || first_arg.ty().as_adt() == receiver_type.as_adt()
-                })
-                .unwrap_or(false)
-        };
+            // FIXME: it fails when type of `b` is `Box` with other generic param different from `receiver`
+            first_arg.ty() == receiver_type || first_arg.ty().as_adt() == receiver_type.as_adt()
+        });
 
         let mut receiver_type_adt_name =
             receiver_type.as_adt()?.name(db).display_no_db(ctx.edition).to_smolstr();
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 49b3234..ea0d2d9 100644
--- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs
@@ -29,13 +29,19 @@
 extern crate rustc_driver as _;
 
 mod handlers {
+    pub(crate) mod array_pattern_without_fixed_length;
     pub(crate) mod await_outside_of_async;
     pub(crate) mod bad_rtn;
     pub(crate) mod break_outside_of_loop;
+    pub(crate) mod cannot_be_dereferenced;
+    pub(crate) mod cannot_implicitly_deref_trait_object;
+    pub(crate) mod cannot_index_into;
     pub(crate) mod duplicate_field;
     pub(crate) mod elided_lifetimes_in_path;
     pub(crate) mod expected_array_or_slice_pat;
     pub(crate) mod expected_function;
+    pub(crate) mod explicit_drop_method_use;
+    pub(crate) mod fru_in_destructuring_assignment;
     pub(crate) mod functional_record_update_on_non_struct;
     pub(crate) mod generic_args_prohibited;
     pub(crate) mod generic_default_refers_to_self;
@@ -44,11 +50,14 @@ mod handlers {
     pub(crate) mod incorrect_case;
     pub(crate) mod incorrect_generics_len;
     pub(crate) mod incorrect_generics_order;
+    pub(crate) mod infer_vars_not_allowed;
     pub(crate) mod invalid_cast;
     pub(crate) mod invalid_derive_target;
     pub(crate) mod invalid_lhs_of_assignment;
+    pub(crate) mod invalid_range_pat_type;
     pub(crate) mod macro_error;
     pub(crate) mod malformed_derive;
+    pub(crate) mod method_call_illegal_sized_bound;
     pub(crate) mod mismatched_arg_count;
     pub(crate) mod mismatched_array_pat_len;
     pub(crate) mod missing_fields;
@@ -57,9 +66,11 @@ mod handlers {
     pub(crate) mod missing_unsafe;
     pub(crate) mod moved_out_of_ref;
     pub(crate) mod mutability_errors;
+    pub(crate) mod mutable_ref;
     pub(crate) mod no_such_field;
     pub(crate) mod non_exhaustive_let;
     pub(crate) mod non_exhaustive_record_expr;
+    pub(crate) mod non_exhaustive_record_pat;
     pub(crate) mod parenthesized_generic_args_without_fn_trait;
     pub(crate) mod pattern_arg_in_extern_fn;
     pub(crate) mod private_assoc_item;
@@ -426,7 +437,16 @@ pub fn semantic_diagnostics(
     for diag in diags {
         let d = match diag {
             AnyDiagnostic::AwaitOutsideOfAsync(d) => handlers::await_outside_of_async::await_outside_of_async(&ctx, &d),
+            AnyDiagnostic::CannotBeDereferenced(d) => handlers::cannot_be_dereferenced::cannot_be_dereferenced(&ctx, &d),
+            AnyDiagnostic::CannotImplicitlyDerefTraitObject(d) => handlers::cannot_implicitly_deref_trait_object::cannot_implicitly_deref_trait_object(&ctx, &d),
+            AnyDiagnostic::CannotIndexInto(d) => handlers::cannot_index_into::cannot_index_into(&ctx, &d),
             AnyDiagnostic::CastToUnsized(d) => handlers::invalid_cast::cast_to_unsized(&ctx, &d),
+            AnyDiagnostic::InferVarsNotAllowed(d) => handlers::infer_vars_not_allowed::infer_vars_not_allowed(&ctx, &d),
+            AnyDiagnostic::ArrayPatternWithoutFixedLength(d) => {
+                handlers::array_pattern_without_fixed_length::array_pattern_without_fixed_length(
+                    &ctx, &d,
+                )
+            }
             AnyDiagnostic::ExpectedArrayOrSlicePat(d) => handlers::expected_array_or_slice_pat::expected_array_or_slice_pat(&ctx, &d),
             AnyDiagnostic::ExpectedFunction(d) => handlers::expected_function::expected_function(&ctx, &d),
             AnyDiagnostic::FunctionalRecordUpdateOnNonStruct(d) => handlers::functional_record_update_on_non_struct::functional_record_update_on_non_struct(&ctx, &d),
@@ -452,12 +472,14 @@ pub fn semantic_diagnostics(
                 continue;
             },
             AnyDiagnostic::MalformedDerive(d) => handlers::malformed_derive::malformed_derive(&ctx, &d),
+            AnyDiagnostic::MethodCallIllegalSizedBound(d) => handlers::method_call_illegal_sized_bound::method_call_illegal_sized_bound(&ctx, &d),
             AnyDiagnostic::MismatchedArgCount(d) => handlers::mismatched_arg_count::mismatched_arg_count(&ctx, &d),
             AnyDiagnostic::MismatchedArrayPatLen(d) => handlers::mismatched_array_pat_len::mismatched_array_pat_len(&ctx, &d),
             AnyDiagnostic::MissingFields(d) => handlers::missing_fields::missing_fields(&ctx, &d),
             AnyDiagnostic::MissingMatchArms(d) => handlers::missing_match_arms::missing_match_arms(&ctx, &d),
             AnyDiagnostic::MissingUnsafe(d) => handlers::missing_unsafe::missing_unsafe(&ctx, &d),
             AnyDiagnostic::MovedOutOfRef(d) => handlers::moved_out_of_ref::moved_out_of_ref(&ctx, &d),
+            AnyDiagnostic::MutableRefBinding(d) => handlers::mutable_ref::mutable_ref_binding(&ctx, &d),
             AnyDiagnostic::NeedMut(d) => match handlers::mutability_errors::need_mut(&ctx, &d) {
                 Some(it) => it,
                 None => continue,
@@ -466,6 +488,9 @@ pub fn semantic_diagnostics(
             AnyDiagnostic::NonExhaustiveRecordExpr(d) => {
                 handlers::non_exhaustive_record_expr::non_exhaustive_record_expr(&ctx, &d)
             }
+            AnyDiagnostic::NonExhaustiveRecordPat(d) => {
+                handlers::non_exhaustive_record_pat::non_exhaustive_record_pat(&ctx, &d)
+            }
             AnyDiagnostic::NoSuchField(d) => handlers::no_such_field::no_such_field(&ctx, &d),
             AnyDiagnostic::DuplicateField(d) => handlers::duplicate_field::duplicate_field(&ctx, &d),
             AnyDiagnostic::PrivateAssocItem(d) => handlers::private_assoc_item::private_assoc_item(&ctx, &d),
@@ -519,10 +544,13 @@ pub fn semantic_diagnostics(
             AnyDiagnostic::ElidedLifetimesInPath(d) => handlers::elided_lifetimes_in_path::elided_lifetimes_in_path(&ctx, &d),
             AnyDiagnostic::GenericDefaultRefersToSelf(d) => handlers::generic_default_refers_to_self::generic_default_refers_to_self(&ctx, &d),
             AnyDiagnostic::InvalidLhsOfAssignment(d) => handlers::invalid_lhs_of_assignment::invalid_lhs_of_assignment(&ctx, &d),
+            AnyDiagnostic::InvalidRangePatType(d) => handlers::invalid_range_pat_type::invalid_range_pat_type(&ctx, &d),
             AnyDiagnostic::TypeMustBeKnown(d) => handlers::type_must_be_known::type_must_be_known(&ctx, &d),
             AnyDiagnostic::PatternArgInExternFn(d) => handlers::pattern_arg_in_extern_fn::pattern_arg_in_extern_fn(&ctx, &d),
             AnyDiagnostic::UnionExprMustHaveExactlyOneField(d) => handlers::union_expr_must_have_exactly_one_field::union_expr_must_have_exactly_one_field(&ctx, &d),
             AnyDiagnostic::UnimplementedTrait(d) => handlers::unimplemented_trait::unimplemented_trait(&ctx, &d),
+            AnyDiagnostic::FruInDestructuringAssignment(d) => handlers::fru_in_destructuring_assignment::fru_in_destructuring_assignment(&ctx, &d),
+            AnyDiagnostic::ExplicitDropMethodUse(d) => handlers::explicit_drop_method_use::explicit_drop_method_use(&ctx, &d),
         };
         res.push(d)
     }
diff --git a/src/tools/rust-analyzer/crates/ide/src/folding_ranges.rs b/src/tools/rust-analyzer/crates/ide/src/folding_ranges.rs
index 965190b..ae006d1 100644
--- a/src/tools/rust-analyzer/crates/ide/src/folding_ranges.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/folding_ranges.rs
@@ -13,7 +13,7 @@
 const REGION_START: &str = "// region:";
 const REGION_END: &str = "// endregion";
 
-#[derive(Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
 pub enum FoldKind {
     Comment,
     Imports,
@@ -32,8 +32,8 @@ pub enum FoldKind {
     TypeAliases,
     ExternCrates,
     // endregion: item runs
-    Stmt(ast::Stmt),
-    TailExpr(ast::Expr),
+    Stmt,
+    TailExpr,
 }
 
 #[derive(Debug)]
@@ -68,7 +68,7 @@ pub(crate) fn folding_ranges(file: &SourceFile, add_collapsed_text: bool) -> Vec
 
     for element in file.syntax().descendants_with_tokens() {
         // Fold items that span multiple lines
-        if let Some(kind) = fold_kind(element.clone()) {
+        if let Some((kind, collapsed_text)) = fold_kind(element.clone(), add_collapsed_text) {
             let is_multiline = match &element {
                 NodeOrToken::Node(node) => node.text().contains_char('\n'),
                 NodeOrToken::Token(token) => token.text().contains('\n'),
@@ -100,7 +100,6 @@ pub(crate) fn folding_ranges(file: &SourceFile, add_collapsed_text: bool) -> Vec
                     }
                 }
 
-                let collapsed_text = if add_collapsed_text { collapsed_text(&kind) } else { None };
                 let fold = Fold::new(element.text_range(), kind).with_text(collapsed_text);
                 res.push(fold);
                 continue;
@@ -183,55 +182,10 @@ pub(crate) fn folding_ranges(file: &SourceFile, add_collapsed_text: bool) -> Vec
     res
 }
 
-fn collapsed_text(kind: &FoldKind) -> Option<String> {
-    match kind {
-        FoldKind::TailExpr(expr) => collapse_expr(expr.clone()),
-        FoldKind::Stmt(stmt) => {
-            match stmt {
-                ast::Stmt::ExprStmt(expr_stmt) => {
-                    expr_stmt.expr().and_then(collapse_expr).map(|text| format!("{text};"))
-                }
-                ast::Stmt::LetStmt(let_stmt) => 'blk: {
-                    if let_stmt.let_else().is_some() {
-                        break 'blk None;
-                    }
-
-                    let Some(expr) = let_stmt.initializer() else {
-                        break 'blk None;
-                    };
-
-                    // If the `let` statement spans multiple lines, we do not collapse it.
-                    // We use the `eq_token` to check whether the `let` statement is a single line,
-                    // as the formatter may place the initializer on a new line for better readability.
-                    //
-                    // Example:
-                    // ```rust
-                    // let complex_pat =
-                    //     complex_expr;
-                    // ```
-                    //
-                    // In this case, we should generate the collapsed text.
-                    let Some(eq_token) = let_stmt.eq_token() else {
-                        break 'blk None;
-                    };
-                    let eq_token_offset =
-                        eq_token.text_range().end() - let_stmt.syntax().text_range().start();
-                    let text_until_eq_token = let_stmt.syntax().text().slice(..eq_token_offset);
-                    if text_until_eq_token.contains_char('\n') {
-                        break 'blk None;
-                    }
-
-                    collapse_expr(expr).map(|text| format!("{text_until_eq_token} {text};"))
-                }
-                // handling `items` in external matches.
-                ast::Stmt::Item(_) => None,
-            }
-        }
-        _ => None,
-    }
-}
-
-fn fold_kind(element: SyntaxElement) -> Option<FoldKind> {
+fn fold_kind(
+    element: SyntaxElement,
+    add_collapsed_text: bool,
+) -> Option<(FoldKind, Option<String>)> {
     // handle tail_expr
     if let Some(node) = element.as_node()
         // tail_expr -> stmt_list -> block
@@ -239,7 +193,10 @@ fn fold_kind(element: SyntaxElement) -> Option<FoldKind> {
         && let Some(tail_expr) = block.tail_expr()
         && tail_expr.syntax() == node
     {
-        return Some(FoldKind::TailExpr(tail_expr));
+        return Some((
+            FoldKind::TailExpr,
+            add_collapsed_text.then(|| collapse_expr(tail_expr)).flatten(),
+        ));
     }
 
     match element.kind() {
@@ -260,14 +217,63 @@ fn fold_kind(element: SyntaxElement) -> Option<FoldKind> {
         | MATCH_ARM_LIST
         | VARIANT_LIST
         | TOKEN_TREE => Some(FoldKind::Block),
-        EXPR_STMT | LET_STMT => Some(FoldKind::Stmt(ast::Stmt::cast(element.as_node()?.clone())?)),
+        EXPR_STMT | LET_STMT => {
+            return Some((
+                FoldKind::Stmt,
+                add_collapsed_text
+                    .then(|| collapsed_stmt(ast::Stmt::cast(element.as_node()?.clone())?))
+                    .flatten(),
+            ));
+        }
         _ => None,
     }
+    .zip(Some(None))
+}
+
+fn collapsed_stmt(stmt: ast::Stmt) -> Option<String> {
+    match stmt {
+        ast::Stmt::ExprStmt(expr_stmt) => {
+            expr_stmt.expr().and_then(collapse_expr).map(|text| format!("{text};"))
+        }
+        ast::Stmt::LetStmt(let_stmt) => 'blk: {
+            if let_stmt.let_else().is_some() {
+                break 'blk None;
+            }
+
+            let Some(expr) = let_stmt.initializer() else {
+                break 'blk None;
+            };
+
+            // If the `let` statement spans multiple lines, we do not collapse it.
+            // We use the `eq_token` to check whether the `let` statement is a single line,
+            // as the formatter may place the initializer on a new line for better readability.
+            //
+            // Example:
+            // ```rust
+            // let complex_pat =
+            //     complex_expr;
+            // ```
+            //
+            // In this case, we should generate the collapsed text.
+            let Some(eq_token) = let_stmt.eq_token() else {
+                break 'blk None;
+            };
+            let eq_token_offset =
+                eq_token.text_range().end() - let_stmt.syntax().text_range().start();
+            let text_until_eq_token = let_stmt.syntax().text().slice(..eq_token_offset);
+            if text_until_eq_token.contains_char('\n') {
+                break 'blk None;
+            }
+
+            collapse_expr(expr).map(|text| format!("{text_until_eq_token} {text};"))
+        }
+        // handling `items` in external matches.
+        ast::Stmt::Item(_) => None,
+    }
 }
 
-const COLLAPSE_EXPR_MAX_LEN: usize = 100;
-
 fn collapse_expr(expr: ast::Expr) -> Option<String> {
+    const COLLAPSE_EXPR_MAX_LEN: usize = 100;
     let mut text = String::with_capacity(COLLAPSE_EXPR_MAX_LEN * 2);
 
     let mut preorder = expr.syntax().preorder_with_tokens();
@@ -435,7 +441,7 @@ fn contiguous_range_for_comment(
 }
 
 fn fold_range_for_multiline_match_arm(match_arm: ast::MatchArm) -> Option<TextRange> {
-    if fold_kind(match_arm.expr()?.syntax().syntax_element()).is_some() {
+    if fold_kind(match_arm.expr()?.syntax().syntax_element(), false).is_some() {
         None
     } else if match_arm.expr()?.syntax().text().contains_char('\n') {
         Some(match_arm.expr()?.syntax().text_range())
@@ -507,8 +513,8 @@ fn check_inner(ra_fixture: &str, enable_collapsed_text: bool) {
                 FoldKind::MatchArm => "matcharm",
                 FoldKind::Function => "function",
                 FoldKind::ExternCrates => "externcrates",
-                FoldKind::Stmt(_) => "stmt",
-                FoldKind::TailExpr(_) => "tailexpr",
+                FoldKind::Stmt => "stmt",
+                FoldKind::TailExpr => "tailexpr",
             };
             assert_eq!(kind, &attr.unwrap());
             if enable_collapsed_text {
diff --git a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
index 4890bad..991a0b6 100644
--- a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs
@@ -4180,4 +4180,21 @@ fn main() {
 "#,
         );
     }
+
+    #[test]
+    fn ide_features_work_in_field_default() {
+        check(
+            r#"
+struct S;
+impl S {
+    fn foo(&self) {}
+    // ^^^
+}
+
+struct Struct {
+    field: () = S.foo$0(),
+}
+        "#,
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide/src/goto_type_definition.rs b/src/tools/rust-analyzer/crates/ide/src/goto_type_definition.rs
index ae208fe..ffd144a 100644
--- a/src/tools/rust-analyzer/crates/ide/src/goto_type_definition.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/goto_type_definition.rs
@@ -88,7 +88,7 @@ pub(crate) fn goto_type_definition(
                             ast::Pat(it) => sema.type_of_pat(&it)?.original,
                             ast::SelfParam(it) => sema.type_of_self(&it)?,
                             ast::Type(it) => sema.resolve_type(&it)?,
-                            ast::RecordField(it) => sema.to_def(&it)?.ty(db).to_type(db),
+                            ast::RecordField(it) => sema.to_def(&it)?.ty(db),
                             // can't match on RecordExprField directly as `ast::Expr` will match an iteration too early otherwise
                             ast::NameRef(it) => {
                                 if let Some(record_field) = ast::RecordExprField::for_name_ref(&it) {
diff --git a/src/tools/rust-analyzer/crates/ide/src/hover.rs b/src/tools/rust-analyzer/crates/ide/src/hover.rs
index df1fcec..c3a8e03 100644
--- a/src/tools/rust-analyzer/crates/ide/src/hover.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/hover.rs
@@ -469,7 +469,7 @@ pub(crate) fn hover_for_definition(
         Definition::Local(it) => Some(it.ty(db)),
         Definition::GenericParam(hir::GenericParam::ConstParam(it)) => Some(it.ty(db)),
         Definition::GenericParam(hir::GenericParam::TypeParam(it)) => Some(it.ty(db)),
-        Definition::Field(field) => Some(field.ty(db).to_type(db)),
+        Definition::Field(field) => Some(field.ty(db)),
         Definition::TupleField(it) => Some(it.ty(db)),
         Definition::Function(it) => Some(it.ty(db)),
         Definition::Adt(it) => Some(it.ty(db)),
@@ -630,7 +630,7 @@ fn goto_type_action_for_def(
 
     let ty = match def {
         Definition::Local(it) => Some(it.ty(db)),
-        Definition::Field(field) => Some(field.ty(db).to_type(db)),
+        Definition::Field(field) => Some(field.ty(db)),
         Definition::TupleField(field) => Some(field.ty(db)),
         Definition::Const(it) => Some(it.ty(db)),
         Definition::Static(it) => Some(it.ty(db)),
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 e08bbc5..da4f185 100644
--- a/src/tools/rust-analyzer/crates/ide/src/hover/render.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/hover/render.rs
@@ -664,14 +664,14 @@ pub(super) fn definition(
         }
         let drop_info = match def {
             Definition::Field(field) => {
-                DropInfo { drop_glue: field.ty(db).to_type(db).drop_glue(db), has_dtor: None }
+                DropInfo { drop_glue: field.ty(db).drop_glue(db), has_dtor: None }
             }
             Definition::Adt(Adt::Struct(strukt)) => {
-                let struct_drop_glue = strukt.ty_params(db).drop_glue(db);
+                let struct_drop_glue = strukt.ty(db).drop_glue(db);
                 let mut fields_drop_glue = strukt
                     .fields(db)
                     .iter()
-                    .map(|field| field.ty(db).to_type(db).drop_glue(db))
+                    .map(|field| field.ty(db).drop_glue(db))
                     .max()
                     .unwrap_or(DropGlue::None);
                 let has_dtor = match (fields_drop_glue, struct_drop_glue) {
@@ -688,10 +688,10 @@ pub(super) fn definition(
             // Unions cannot have fields with drop glue.
             Definition::Adt(Adt::Union(union)) => DropInfo {
                 drop_glue: DropGlue::None,
-                has_dtor: Some(union.ty_params(db).drop_glue(db) != DropGlue::None),
+                has_dtor: Some(union.ty(db).drop_glue(db) != DropGlue::None),
             },
             Definition::Adt(Adt::Enum(enum_)) => {
-                let enum_drop_glue = enum_.ty_params(db).drop_glue(db);
+                let enum_drop_glue = enum_.ty(db).drop_glue(db);
                 let fields_drop_glue = enum_
                     .variants(db)
                     .iter()
@@ -699,7 +699,7 @@ pub(super) fn definition(
                         variant
                             .fields(db)
                             .iter()
-                            .map(|field| field.ty(db).to_type(db).drop_glue(db))
+                            .map(|field| field.ty(db).drop_glue(db))
                             .max()
                             .unwrap_or(DropGlue::None)
                     })
@@ -714,13 +714,13 @@ pub(super) fn definition(
                 let fields_drop_glue = variant
                     .fields(db)
                     .iter()
-                    .map(|field| field.ty(db).to_type(db).drop_glue(db))
+                    .map(|field| field.ty(db).drop_glue(db))
                     .max()
                     .unwrap_or(DropGlue::None);
                 DropInfo { drop_glue: fields_drop_glue, has_dtor: None }
             }
             Definition::TypeAlias(type_alias) => {
-                DropInfo { drop_glue: type_alias.ty_params(db).drop_glue(db), has_dtor: None }
+                DropInfo { drop_glue: type_alias.ty(db).drop_glue(db), has_dtor: None }
             }
             Definition::Local(local) => {
                 DropInfo { drop_glue: local.ty(db).drop_glue(db), has_dtor: None }
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 bf5e0be..30644fe 100644
--- a/src/tools/rust-analyzer/crates/ide/src/hover/tests.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/hover/tests.rs
@@ -3153,6 +3153,35 @@ enum Foo {
 }
 
 #[test]
+fn test_hover_layout_nonzero_type_alias() {
+    check(
+        r#"//- minicore: non_zero
+use core::num;
+trait Trait { type Inner; }
+impl Trait for u8 { type Inner = num::NonZeroU8; }
+#[repr(transparent)]
+struct NonZero<T: Trait>(T::Inner);
+type NonZeroU8$0 = NonZero<u8>;
+"#,
+        expect![[r#"
+            *NonZeroU8*
+
+            ```rust
+            ra_test_fixture
+            ```
+
+            ```rust
+            type NonZeroU8 = NonZero<u8>
+            ```
+
+            ---
+
+            size = 1, align = 1, niches = 1, no Drop
+        "#]],
+    );
+}
+
+#[test]
 fn test_hover_layout_padding_info() {
     check(
         r#"struct $0Foo {
diff --git a/src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs b/src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs
index 57aba51..9387573 100644
--- a/src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/inlay_hints/implicit_drop.rs
@@ -9,6 +9,7 @@
     DefWithBody,
     db::HirDatabase as _,
     mir::{MirSpan, TerminatorKind},
+    name,
 };
 use ide_db::{FileRange, famous_defs::FamousDefs};
 
@@ -43,7 +44,7 @@ pub(super) fn hints(
 
     for (_, bb) in mir.basic_blocks.iter() {
         let terminator = bb.terminator.as_ref()?;
-        if let TerminatorKind::Drop { place, .. } = terminator.kind {
+        if let TerminatorKind::Drop { place, .. } = &terminator.kind {
             if !place.projection.is_empty() {
                 continue; // Ignore complex cases for now
             }
@@ -95,7 +96,7 @@ pub(super) fn hints(
             };
             let binding = &hir[binding_idx];
             let name = binding.name.display_no_db(display_target.edition).to_smolstr();
-            if name.starts_with("<ra@") {
+            if name::is_generated(&name) {
                 continue; // Ignore desugared variables
             }
             let mut label = InlayHintLabel::simple(
diff --git a/src/tools/rust-analyzer/crates/ide/src/inlay_hints/param_name.rs b/src/tools/rust-analyzer/crates/ide/src/inlay_hints/param_name.rs
index c780ce5..f1689e5 100644
--- a/src/tools/rust-analyzer/crates/ide/src/inlay_hints/param_name.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/inlay_hints/param_name.rs
@@ -7,7 +7,7 @@
 use std::iter::zip;
 
 use either::Either;
-use hir::{EditionedFileId, Semantics};
+use hir::{EditionedFileId, Semantics, name};
 use ide_db::{RootDatabase, famous_defs::FamousDefs};
 
 use stdx::to_lower_snake_case;
@@ -197,13 +197,14 @@ fn should_hide_param_name_hint(
     //   parameter is a prefix/suffix of argument with _ splitting it off
     // - param starts with `ra_fixture`
     // - param is a well known name in a unary function
+    // - param is generated name
 
     let param_name = param_name.trim_matches('_');
     if param_name.is_empty() {
         return true;
     }
 
-    if param_name.starts_with("ra_fixture") {
+    if param_name.starts_with("ra_fixture") || name::is_generated(param_name) {
         return true;
     }
 
@@ -608,6 +609,7 @@ fn from_syntax(
 fn test_func(mut foo: i32, bar: i32, msg: &str, _: i32, last: i32) -> i32 {
     foo + bar
 }
+async fn test_async(foo: i32, _: i32) {}
 
 fn main() {
     let not_literal = 1;
@@ -631,6 +633,8 @@ fn main() {
         None,
       //^^^^ docs
     );
+    test_async(1, 2)
+             //^ foo
 }"#,
         );
     }
diff --git a/src/tools/rust-analyzer/crates/ide/src/lib.rs b/src/tools/rust-analyzer/crates/ide/src/lib.rs
index e131e7b..88cb570 100644
--- a/src/tools/rust-analyzer/crates/ide/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/lib.rs
@@ -41,6 +41,7 @@
 mod moniker;
 mod move_item;
 mod parent_module;
+mod predicate_eval;
 mod references;
 mod rename;
 mod runnables;
@@ -122,7 +123,7 @@
     },
     test_explorer::{TestItem, TestItemKind},
 };
-pub use hir::Semantics;
+pub use hir::{PredicateEvaluationResult, PredicateEvaluationStatus, Semantics};
 pub use ide_assists::{
     Assist, AssistConfig, AssistId, AssistKind, AssistResolveStrategy, SingleResolve,
 };
@@ -391,6 +392,14 @@ pub fn view_hir(&self, position: FilePosition) -> Cancellable<String> {
         self.with_db(|db| view_hir::view_hir(db, position))
     }
 
+    pub fn evaluate_predicate(
+        &self,
+        text: String,
+        position: FilePosition,
+    ) -> Cancellable<PredicateEvaluationResult> {
+        self.with_db(|db| predicate_eval::evaluate_predicate(db, text, position))
+    }
+
     pub fn view_mir(&self, position: FilePosition) -> Cancellable<String> {
         self.with_db(|db| view_mir::view_mir(db, position))
     }
diff --git a/src/tools/rust-analyzer/crates/ide/src/navigation_target.rs b/src/tools/rust-analyzer/crates/ide/src/navigation_target.rs
index f70bb335..b8c14dc0 100644
--- a/src/tools/rust-analyzer/crates/ide/src/navigation_target.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/navigation_target.rs
@@ -964,7 +964,7 @@ pub(crate) fn orig_range_with_focus_r(
                             // *should* contain the name
                             _ => {
                                 let call = call();
-                                let kind = call.kind;
+                                let kind = &call.kind;
                                 let range = kind.clone().original_call_range_with_input(db);
                                 //If the focus range is in the attribute/derive body, we
                                 // need to point the call site to the entire body, if not, fall back
diff --git a/src/tools/rust-analyzer/crates/ide/src/predicate_eval.rs b/src/tools/rust-analyzer/crates/ide/src/predicate_eval.rs
new file mode 100644
index 0000000..c6ec4ca
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/ide/src/predicate_eval.rs
@@ -0,0 +1,165 @@
+//! Evaluates type predicates at a given position in the source code.
+
+use hir::{PredicateEvaluationResult, Semantics};
+use ide_db::{FilePosition, RootDatabase};
+use syntax::{AstNode, SourceFile, ast};
+
+pub(crate) fn evaluate_predicate(
+    db: &RootDatabase,
+    text: String,
+    position: FilePosition,
+) -> PredicateEvaluationResult {
+    let sema = Semantics::new(db);
+    let source_file = sema.parse_guess_edition(position.file_id);
+    let edition = sema.attach_first_edition(position.file_id).edition(db);
+
+    let Some(where_clause) = parse_where_clause(&text, edition) else {
+        return PredicateEvaluationResult::invalid("expected a single where-clause predicate");
+    };
+
+    let node = source_file
+        .syntax()
+        .token_at_offset(position.offset)
+        .next()
+        .and_then(|token| token.parent())
+        .unwrap_or_else(|| source_file.syntax().clone());
+    sema.evaluate_where_clause_at(&node, position.offset, where_clause)
+}
+
+fn parse_where_clause(text: &str, edition: span::Edition) -> Option<ast::WhereClause> {
+    let text = text.trim().trim_end_matches(',').trim_end();
+    let wrapped = format!("fn __ra_evaluate_predicate() where {text}, {{}}");
+    let parse = SourceFile::parse(&wrapped, edition);
+    if !parse.errors().is_empty() {
+        return None;
+    }
+
+    let where_clause = parse.tree().syntax().descendants().find_map(ast::WhereClause::cast)?;
+    if where_clause.predicates().count() == 1 { Some(where_clause) } else { None }
+}
+
+#[cfg(test)]
+mod tests {
+    use hir::PredicateEvaluationStatus;
+
+    use crate::fixture;
+
+    fn check(ra_fixture: &str, predicate: &str, status: PredicateEvaluationStatus) {
+        let (analysis, position) = fixture::position(ra_fixture);
+        let result = analysis.evaluate_predicate(predicate.to_owned(), position).unwrap();
+        assert_eq!(result.status, status, "{}", result.message);
+    }
+
+    #[test]
+    fn evaluates_concrete_trait_predicate() {
+        check(
+            r#"
+trait Trait {}
+struct S;
+impl Trait for S {}
+fn f() { $0 }
+"#,
+            "S: Trait",
+            PredicateEvaluationStatus::Holds,
+        );
+    }
+
+    #[test]
+    fn evaluates_generic_bound_from_environment() {
+        check(
+            r#"
+trait Trait {}
+fn f<T: Trait>() { $0 }
+"#,
+            "T: Trait",
+            PredicateEvaluationStatus::Holds,
+        );
+    }
+
+    #[test]
+    fn reports_missing_generic_bound_as_not_proven() {
+        check(
+            r#"
+trait Trait {}
+fn f<T>() { $0 }
+"#,
+            "T: Trait",
+            PredicateEvaluationStatus::NotProven,
+        );
+    }
+
+    #[test]
+    fn evaluates_associated_type_binding() {
+        check(
+            r#"
+trait Iterator { type Item; }
+fn f<I: Iterator<Item = u32>>() { $0 }
+"#,
+            "I: Iterator<Item = u32>",
+            PredicateEvaluationStatus::Holds,
+        );
+    }
+
+    #[test]
+    fn reports_unresolved_type_as_invalid() {
+        check(
+            r#"
+trait Trait {}
+fn f() { $0 }
+"#,
+            "Type: Trait",
+            PredicateEvaluationStatus::Invalid,
+        );
+    }
+
+    #[test]
+    fn reports_unresolved_trait_as_invalid() {
+        check(
+            r#"
+struct Type;
+fn f() { $0 }
+"#,
+            "Type: Trait",
+            PredicateEvaluationStatus::Invalid,
+        );
+    }
+
+    #[test]
+    fn evaluates_lifetime_predicate() {
+        check(
+            r#"
+fn f<'a, 'b>()
+where
+    'a: 'b,
+{
+    $0
+}
+"#,
+            "'a: 'b",
+            PredicateEvaluationStatus::Holds,
+        );
+    }
+
+    #[test]
+    fn evaluates_type_outlives_predicate() {
+        check(
+            r#"
+fn f<T: 'static>() { $0 }
+"#,
+            "T: 'static",
+            PredicateEvaluationStatus::Holds,
+        );
+    }
+
+    #[test]
+    fn rejects_invalid_predicate() {
+        check(
+            r#"
+trait Trait {}
+fn f() { $0 }
+"#,
+            "u32 Trait",
+            PredicateEvaluationStatus::Invalid,
+        );
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/ide/src/rename.rs b/src/tools/rust-analyzer/crates/ide/src/rename.rs
index b664187..26c6776 100644
--- a/src/tools/rust-analyzer/crates/ide/src/rename.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/rename.rs
@@ -16,7 +16,7 @@
 use stdx::{always, format_to, never};
 use syntax::{
     AstNode, SyntaxKind, SyntaxNode, TextRange, TextSize,
-    ast::{self, HasArgList, make, prec::ExprPrecedence},
+    ast::{self, HasArgList, prec::ExprPrecedence},
 };
 
 use ide_db::text_edit::TextEdit;
@@ -522,11 +522,11 @@ fn rename_to_self(
     };
     let first_param_ty = first_param.ty();
     let impl_ty = impl_.self_ty(sema.db);
-    let (ty, self_param) = if impl_ty.remove_ref().is_some() {
+    let (ty, self_param) = if impl_ty.is_reference() {
         // if the impl is a ref to the type we can just match the `&T` with self directly
         (first_param_ty.clone(), "self")
     } else {
-        first_param_ty.remove_ref().map_or((first_param_ty.clone(), "self"), |ty| {
+        first_param_ty.as_reference_inner().map_or((first_param_ty.clone(), "self"), |ty| {
             (ty, if first_param_ty.is_mutable_reference() { "&mut self" } else { "&self" })
         })
     };
@@ -818,11 +818,12 @@ fn rename_elided_lifetime(
     let mut builder = SourceChangeBuilder::new(position.file_id);
 
     let editor = builder.make_editor(&root);
+    let make = editor.make();
 
-    editor.replace(lifetime_token, make::lifetime(new_name).syntax().clone());
+    editor.replace(lifetime_token, make.lifetime(new_name).syntax().clone());
 
     if let Some(has_generic_params) = parent.ancestors().find_map(ast::AnyHasGenericParams::cast) {
-        let lifetime_param = make::lifetime_param(make::lifetime(new_name));
+        let lifetime_param = make.lifetime_param(make.lifetime(new_name));
         editor.add_generic_param(&has_generic_params, lifetime_param.into());
     }
 
diff --git a/src/tools/rust-analyzer/crates/ide/src/signature_help.rs b/src/tools/rust-analyzer/crates/ide/src/signature_help.rs
index edcf0dc..0022c11 100644
--- a/src/tools/rust-analyzer/crates/ide/src/signature_help.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/signature_help.rs
@@ -174,9 +174,15 @@ fn signature_help_for_call(
     match callable.kind() {
         hir::CallableKind::Function(func) => {
             res.doc = func.docs(db).map(Documentation::into_owned);
+            if func.is_const(db) {
+                format_to!(res.signature, "const ");
+            }
             if func.is_async(db) {
                 format_to!(res.signature, "async ");
             }
+            if func.is_unsafe(db) {
+                format_to!(res.signature, "unsafe ");
+            }
             format_to!(res.signature, "fn {}", func.name(db).display(db, edition));
 
             let generic_params = GenericDef::Function(func)
@@ -529,7 +535,7 @@ fn signature_help_for_tuple_struct_pat(
         pat.syntax(),
         token,
         pat.fields(),
-        fields.into_iter().map(|it| it.ty(db).to_type(db)),
+        fields.into_iter().map(|it| it.ty(db)),
         display_target,
     ))
 }
@@ -2664,4 +2670,76 @@ async fn conn_mut<F: FnOnce() -> T, T>(f: F) -> Result<T, i32>
             "#]],
         );
     }
+
+    #[test]
+    fn test_const_function() {
+        check(
+            r#"
+//- minicore: sized, fn
+pub const fn foo(x: u32, y: u32) -> u32 { x + y }
+
+fn main() {
+    foo($0)
+}
+            "#,
+            expect![[r#"
+                const fn foo(x: u32, y: u32) -> u32
+                             ^^^^^^  ------
+            "#]],
+        );
+    }
+
+    #[test]
+    fn test_unsafe_function() {
+        check(
+            r#"
+//- minicore: sized, fn
+pub unsafe fn foo(x: u32, y: u32) -> u32 { x + y }
+
+fn main() {
+    unsafe { foo($0) }
+}
+            "#,
+            expect![[r#"
+                unsafe fn foo(x: u32, y: u32) -> u32
+                              ^^^^^^  ------
+            "#]],
+        );
+    }
+
+    #[test]
+    fn test_const_unsafe_function() {
+        check(
+            r#"
+//- minicore: sized, fn
+pub const unsafe fn foo(x: u32, y: u32) -> u32 { x + y }
+
+fn main() {
+    unsafe { foo($0) }
+}
+            "#,
+            expect![[r#"
+                const unsafe fn foo(x: u32, y: u32) -> u32
+                                    ^^^^^^  ------
+            "#]],
+        );
+    }
+
+    #[test]
+    fn test_async_unsafe_function() {
+        check(
+            r#"
+//- minicore: sized, fn, future
+pub async unsafe fn foo(x: u32, y: u32) -> u32 { x + y }
+
+fn main() {
+    unsafe { foo($0) }
+}
+            "#,
+            expect![[r#"
+                async unsafe fn foo(x: u32, y: u32) -> u32
+                                    ^^^^^^  ------
+            "#]],
+        );
+    }
 }
diff --git a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/inject.rs b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/inject.rs
index 76bb063..9af6d67 100644
--- a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/inject.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/inject.rs
@@ -177,7 +177,7 @@ pub(super) fn doc_comment(
         match sema.first_crate(vfs_file_id) {
             Some(krate) => krate.base().data(sema.db).proc_macro_cwd.clone(),
             None => {
-                // Arbitrarily pick /, since from_single_file treats this file as as /main.rs anyway.
+                // Arbitrarily pick /, since from_single_file treats this file as /main.rs anyway.
                 Arc::new(ide_db::base_db::AbsPathBuf::try_from("/").unwrap())
             }
         }
diff --git a/src/tools/rust-analyzer/crates/ide/src/view_memory_layout.rs b/src/tools/rust-analyzer/crates/ide/src/view_memory_layout.rs
index 1b9df97..03bde6f 100644
--- a/src/tools/rust-analyzer/crates/ide/src/view_memory_layout.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/view_memory_layout.rs
@@ -98,7 +98,7 @@ pub(crate) fn view_memory_layout(
         Definition::BuiltinType(it) => it.ty(db),
         Definition::SelfType(it) => it.self_ty(db),
         Definition::Local(it) => it.ty(db),
-        Definition::Field(it) => it.ty(db).to_type(db),
+        Definition::Field(it) => it.ty(db),
         Definition::Const(it) => it.ty(db),
         Definition::Static(it) => it.ty(db),
         _ => return None,
diff --git a/src/tools/rust-analyzer/crates/intern/Cargo.toml b/src/tools/rust-analyzer/crates/intern/Cargo.toml
index 1e6e8ff..2ba802f 100644
--- a/src/tools/rust-analyzer/crates/intern/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/intern/Cargo.toml
@@ -15,7 +15,10 @@
 
 [dependencies]
 dashmap.workspace = true
-hashbrown.workspace = true
+# We need to freeze the version of the crate, as it needs to match with dashmap
+hashbrown = { version = "0.14.*", features = [
+    "inline-more",
+], default-features = false }
 rustc-hash.workspace = true
 triomphe.workspace = true
 rayon.workspace = true
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 ac6daaf..fe303aa 100644
--- a/src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs
+++ b/src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs
@@ -295,6 +295,7 @@ pub(super) fn prefill() -> DashMap<Symbol, (), BuildHasherDefault<FxHasher>> {
     doc,
     drop_in_place,
     drop,
+    pin_drop,
     dyn_metadata,
     efiapi,
     eh_catch_typeinfo,
@@ -475,6 +476,7 @@ pub(super) fn prefill() -> DashMap<Symbol, (), BuildHasherDefault<FxHasher>> {
     PartialOrd,
     CoercePointee,
     path,
+    pattern_type,
     Pending,
     phantom_data,
     pieces,
@@ -645,6 +647,7 @@ pub(super) fn prefill() -> DashMap<Symbol, (), BuildHasherDefault<FxHasher>> {
     eii_internals,
     field_representing_type_raw,
     intrinsics,
+    core_intrinsics,
     link_cfg,
     more_maybe_bounds,
     negative_bounds,
@@ -670,4 +673,7 @@ pub(super) fn prefill() -> DashMap<Symbol, (), BuildHasherDefault<FxHasher>> {
     deref_patterns,
     mut_ref,
     type_changing_struct_update,
+    RangeMin,
+    RangeMax,
+    RangeSub,
 }
diff --git a/src/tools/rust-analyzer/crates/load-cargo/Cargo.toml b/src/tools/rust-analyzer/crates/load-cargo/Cargo.toml
index 91b012e..7b5e51f 100644
--- a/src/tools/rust-analyzer/crates/load-cargo/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/load-cargo/Cargo.toml
@@ -30,7 +30,7 @@
 intern.workspace = true
 
 [features]
-in-rust-tree = ["hir-expand/in-rust-tree"]
+in-rust-tree = ["hir-expand/in-rust-tree", "proc-macro-api/in-rust-tree"]
 
 [lints]
 workspace = true
diff --git a/src/tools/rust-analyzer/crates/load-cargo/src/lib.rs b/src/tools/rust-analyzer/crates/load-cargo/src/lib.rs
index 801eaea..fd90bc4 100644
--- a/src/tools/rust-analyzer/crates/load-cargo/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/load-cargo/src/lib.rs
@@ -609,11 +609,9 @@ fn expand(
             SubRequest::LineColumn { file_id, ast_id, offset } => {
                 let range =
                     resolve_sub_span(db, file_id, ast_id, TextRange::empty(TextSize::from(offset)));
-                let source = db.file_text(range.file_id.file_id(db)).text(db);
-                let line_index = ide_db::line_index::LineIndex::new(source);
-                let (line, column) = line_index
-                    .try_line_col(range.range.start())
-                    .map(|lc| (lc.line + 1, lc.col + 1))
+                let (line, column) = db
+                    .line_column(range.file_id.file_id(db), range.range.start())
+                    .map(|(line, col)| (line + 1, col + 1))
                     .unwrap_or((1, 1));
                 // proc_macro::Span line/column are 1-based
                 Ok(SubResponse::LineColumnResult { line, column })
@@ -726,6 +724,8 @@ fn expand(
 
                 Ok(SubResponse::SpanParentResult { parent_span: None })
             }
+            // FIXME: implement this
+            SubRequest::SpanJoin { .. } => Ok(SubResponse::SpanJoinResult { span: None }),
         };
         match self.0.expand(
             subtree.view(),
diff --git a/src/tools/rust-analyzer/crates/mbe/src/tests.rs b/src/tools/rust-analyzer/crates/mbe/src/tests.rs
index 271dfc8..f3ebb66 100644
--- a/src/tools/rust-analyzer/crates/mbe/src/tests.rs
+++ b/src/tools/rust-analyzer/crates/mbe/src/tests.rs
@@ -74,7 +74,7 @@ fn check_(
         "{}",
         syntax_bridge::prettify_macro_expansion::prettify_macro_expansion(
             node.syntax_node(),
-            &mut |_| None,
+            &mut |_, _| None,
             |_| ()
         )
     );
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 cabdd74..bc7db63 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
@@ -320,6 +320,10 @@ fn builtin_expr(p: &mut Parser<'_>) -> Option<CompletedMarker> {
         //     builtin#naked_asm("");
         // }
         parse_asm_expr(p, m)
+    } else if p.eat_contextual_kw(T![include_bytes]) {
+        // test include_bytes
+        // fn foo() { builtin # include_bytes }
+        Some(m.complete(p, INCLUDE_BYTES_EXPR))
     } else {
         m.abandon(p);
         None
diff --git a/src/tools/rust-analyzer/crates/parser/src/grammar/items/adt.rs b/src/tools/rust-analyzer/crates/parser/src/grammar/items/adt.rs
index a030190..33e19f5 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar/items/adt.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar/items/adt.rs
@@ -87,24 +87,27 @@ fn variant(p: &mut Parser<'_>) {
         attributes::outer_attrs(p);
         if p.at(IDENT) {
             name(p);
-            match p.current() {
-                T!['{'] => record_field_list(p),
-                T!['('] => tuple_field_list(p),
-                _ => (),
-            }
-
-            // test variant_discriminant
-            // enum E { X(i32) = 10 }
-            if p.eat(T![=]) {
-                let m = p.start();
-                expressions::expr(p);
-                m.complete(p, CONST_ARG);
-            }
-            m.complete(p, VARIANT);
+        } else if p.at(T![_]) {
+            p.bump(T![_]);
         } else {
             m.abandon(p);
             p.err_and_bump("expected enum variant");
+            return;
         }
+        match p.current() {
+            T!['{'] => record_field_list(p),
+            T!['('] => tuple_field_list(p),
+            _ => (),
+        }
+
+        // test variant_discriminant
+        // enum E { X(i32) = 10 }
+        if p.eat(T![=]) {
+            let m = p.start();
+            expressions::expr(p);
+            m.complete(p, CONST_ARG);
+        }
+        m.complete(p, VARIANT);
     }
 }
 
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 5726f08..29fa117 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar/patterns.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar/patterns.rs
@@ -12,6 +12,7 @@
         T![_],
         T![-],
         T![.],
+        T![!],
     ]));
 
 const PAT_TOP_FIRST: TokenSet = PATTERN_FIRST.union(TokenSet::new(&[T![|]]));
@@ -256,6 +257,7 @@ fn atom_pat(p: &mut Parser<'_>, recovery_set: TokenSet) -> Option<CompletedMarke
         T![&] => ref_pat(p),
         T!['('] => tuple_pat(p),
         T!['['] => slice_pat(p),
+        T![!] => not_null_pat(p),
 
         _ => {
             p.err_recover("expected pattern", recovery_set);
@@ -435,6 +437,18 @@ fn ref_pat(p: &mut Parser<'_>) -> CompletedMarker {
     m.complete(p, REF_PAT)
 }
 
+// test not_null_pat
+// fn main() {
+//     let (!a | !&0) = ();
+// }
+fn not_null_pat(p: &mut Parser<'_>) -> CompletedMarker {
+    assert!(p.at(T![!]));
+    let m = p.start();
+    p.bump(T![!]);
+    pattern_single(p);
+    m.complete(p, NOT_NULL)
+}
+
 // test tuple_pat
 // fn main() {
 //     let (a, b, ..) = ();
diff --git a/src/tools/rust-analyzer/crates/parser/src/grammar/types.rs b/src/tools/rust-analyzer/crates/parser/src/grammar/types.rs
index 667bb68..db01853 100644
--- a/src/tools/rust-analyzer/crates/parser/src/grammar/types.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/grammar/types.rs
@@ -1,3 +1,5 @@
+use crate::grammar::entry::prefix::pat_top;
+
 use super::*;
 
 pub(super) const TYPE_FIRST: TokenSet = paths::PATH_FIRST.union(TokenSet::new(&[
@@ -341,6 +343,10 @@ fn bare_dyn_trait_type(p: &mut Parser<'_>) {
 // type B = crate::foo!();
 fn path_or_macro_type(p: &mut Parser<'_>, allow_bounds: bool) {
     assert!(paths::is_path_start(p));
+    if p.at_contextual_kw(T![builtin]) && p.nth_at(1, T![#]) {
+        pattern_type(p);
+        return;
+    }
     let r = p.start();
     let m = p.start();
 
@@ -411,3 +417,23 @@ pub(super) fn opt_type_bounds_as_dyn_trait_type(
     // Finally precede everything with DYN_TRAIT_TYPE
     m.precede(p).complete(p, DYN_TRAIT_TYPE)
 }
+
+// test pattern_type
+// type T = builtin#pattern_type (u8 is 0..10);
+fn pattern_type(p: &mut Parser<'_>) {
+    let m = p.start();
+    p.bump_remap(T![builtin]);
+    p.bump(T![#]);
+    if p.eat_contextual_kw(T![pattern_type]) {
+        p.expect(T!['(']);
+        type_(p);
+        if !p.eat_contextual_kw(T![is]) {
+            p.error("expected `is`")
+        }
+        pat_top(p);
+        p.expect(T![')']);
+        m.complete(p, PATTERN_TYPE);
+    } else {
+        m.abandon(p);
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/parser/src/syntax_kind/generated.rs b/src/tools/rust-analyzer/crates/parser/src/syntax_kind/generated.rs
index b186727..1c4fcf0 100644
--- a/src/tools/rust-analyzer/crates/parser/src/syntax_kind/generated.rs
+++ b/src/tools/rust-analyzer/crates/parser/src/syntax_kind/generated.rs
@@ -125,8 +125,10 @@ pub enum SyntaxKind {
     FORMAT_ARGS_KW,
     GEN_KW,
     GLOBAL_ASM_KW,
+    INCLUDE_BYTES_KW,
     INLATEOUT_KW,
     INOUT_KW,
+    IS_KW,
     LABEL_KW,
     LATEOUT_KW,
     MACRO_RULES_KW,
@@ -135,9 +137,11 @@ pub enum SyntaxKind {
     NOMEM_KW,
     NORETURN_KW,
     NOSTACK_KW,
+    NULL_KW,
     OFFSET_OF_KW,
     OPTIONS_KW,
     OUT_KW,
+    PATTERN_TYPE_KW,
     PRESERVES_FLAGS_KW,
     PURE_KW,
     RAW_KW,
@@ -222,6 +226,7 @@ pub enum SyntaxKind {
     IMPL,
     IMPL_RESTRICTION,
     IMPL_TRAIT_TYPE,
+    INCLUDE_BYTES_EXPR,
     INDEX_EXPR,
     INFER_TYPE,
     ITEM_LIST,
@@ -254,6 +259,7 @@ pub enum SyntaxKind {
     NAME,
     NAME_REF,
     NEVER_TYPE,
+    NOT_NULL,
     OFFSET_OF_EXPR,
     OR_PAT,
     PARAM,
@@ -268,6 +274,7 @@ pub enum SyntaxKind {
     PATH_PAT,
     PATH_SEGMENT,
     PATH_TYPE,
+    PATTERN_TYPE,
     PREFIX_EXPR,
     PTR_TYPE,
     RANGE_EXPR,
@@ -407,6 +414,7 @@ pub const fn text(self) -> &'static str {
             | IMPL
             | IMPL_RESTRICTION
             | IMPL_TRAIT_TYPE
+            | INCLUDE_BYTES_EXPR
             | INDEX_EXPR
             | INFER_TYPE
             | ITEM_LIST
@@ -439,6 +447,7 @@ pub const fn text(self) -> &'static str {
             | NAME
             | NAME_REF
             | NEVER_TYPE
+            | NOT_NULL
             | OFFSET_OF_EXPR
             | OR_PAT
             | PARAM
@@ -453,6 +462,7 @@ pub const fn text(self) -> &'static str {
             | PATH_PAT
             | PATH_SEGMENT
             | PATH_TYPE
+            | PATTERN_TYPE
             | PREFIX_EXPR
             | PTR_TYPE
             | RANGE_EXPR
@@ -634,8 +644,10 @@ pub const fn text(self) -> &'static str {
             DYN_KW => "dyn",
             FORMAT_ARGS_KW => "format_args",
             GLOBAL_ASM_KW => "global_asm",
+            INCLUDE_BYTES_KW => "include_bytes",
             INLATEOUT_KW => "inlateout",
             INOUT_KW => "inout",
+            IS_KW => "is",
             LABEL_KW => "label",
             LATEOUT_KW => "lateout",
             MACRO_RULES_KW => "macro_rules",
@@ -644,9 +656,11 @@ pub const fn text(self) -> &'static str {
             NOMEM_KW => "nomem",
             NORETURN_KW => "noreturn",
             NOSTACK_KW => "nostack",
+            NULL_KW => "null",
             OFFSET_OF_KW => "offset_of",
             OPTIONS_KW => "options",
             OUT_KW => "out",
+            PATTERN_TYPE_KW => "pattern_type",
             PRESERVES_FLAGS_KW => "preserves_flags",
             PURE_KW => "pure",
             RAW_KW => "raw",
@@ -740,8 +754,10 @@ pub fn is_contextual_keyword(self, edition: Edition) -> bool {
             DYN_KW if edition < Edition::Edition2018 => true,
             FORMAT_ARGS_KW => true,
             GLOBAL_ASM_KW => true,
+            INCLUDE_BYTES_KW => true,
             INLATEOUT_KW => true,
             INOUT_KW => true,
+            IS_KW => true,
             LABEL_KW => true,
             LATEOUT_KW => true,
             MACRO_RULES_KW => true,
@@ -750,9 +766,11 @@ pub fn is_contextual_keyword(self, edition: Edition) -> bool {
             NOMEM_KW => true,
             NORETURN_KW => true,
             NOSTACK_KW => true,
+            NULL_KW => true,
             OFFSET_OF_KW => true,
             OPTIONS_KW => true,
             OUT_KW => true,
+            PATTERN_TYPE_KW => true,
             PRESERVES_FLAGS_KW => true,
             PURE_KW => true,
             RAW_KW => true,
@@ -834,8 +852,10 @@ pub fn is_keyword(self, edition: Edition) -> bool {
             DYN_KW if edition < Edition::Edition2018 => true,
             FORMAT_ARGS_KW => true,
             GLOBAL_ASM_KW => true,
+            INCLUDE_BYTES_KW => true,
             INLATEOUT_KW => true,
             INOUT_KW => true,
+            IS_KW => true,
             LABEL_KW => true,
             LATEOUT_KW => true,
             MACRO_RULES_KW => true,
@@ -844,9 +864,11 @@ pub fn is_keyword(self, edition: Edition) -> bool {
             NOMEM_KW => true,
             NORETURN_KW => true,
             NOSTACK_KW => true,
+            NULL_KW => true,
             OFFSET_OF_KW => true,
             OPTIONS_KW => true,
             OUT_KW => true,
+            PATTERN_TYPE_KW => true,
             PRESERVES_FLAGS_KW => true,
             PURE_KW => true,
             RAW_KW => true,
@@ -991,8 +1013,10 @@ pub fn from_contextual_keyword(ident: &str, edition: Edition) -> Option<SyntaxKi
             "dyn" if edition < Edition::Edition2018 => DYN_KW,
             "format_args" => FORMAT_ARGS_KW,
             "global_asm" => GLOBAL_ASM_KW,
+            "include_bytes" => INCLUDE_BYTES_KW,
             "inlateout" => INLATEOUT_KW,
             "inout" => INOUT_KW,
+            "is" => IS_KW,
             "label" => LABEL_KW,
             "lateout" => LATEOUT_KW,
             "macro_rules" => MACRO_RULES_KW,
@@ -1001,9 +1025,11 @@ pub fn from_contextual_keyword(ident: &str, edition: Edition) -> Option<SyntaxKi
             "nomem" => NOMEM_KW,
             "noreturn" => NORETURN_KW,
             "nostack" => NOSTACK_KW,
+            "null" => NULL_KW,
             "offset_of" => OFFSET_OF_KW,
             "options" => OPTIONS_KW,
             "out" => OUT_KW,
+            "pattern_type" => PATTERN_TYPE_KW,
             "preserves_flags" => PRESERVES_FLAGS_KW,
             "pure" => PURE_KW,
             "raw" => RAW_KW,
@@ -1166,8 +1192,10 @@ pub fn from_char(c: char) -> Option<SyntaxKind> {
     [dyn] => { $ crate :: SyntaxKind :: DYN_KW };
     [format_args] => { $ crate :: SyntaxKind :: FORMAT_ARGS_KW };
     [global_asm] => { $ crate :: SyntaxKind :: GLOBAL_ASM_KW };
+    [include_bytes] => { $ crate :: SyntaxKind :: INCLUDE_BYTES_KW };
     [inlateout] => { $ crate :: SyntaxKind :: INLATEOUT_KW };
     [inout] => { $ crate :: SyntaxKind :: INOUT_KW };
+    [is] => { $ crate :: SyntaxKind :: IS_KW };
     [label] => { $ crate :: SyntaxKind :: LABEL_KW };
     [lateout] => { $ crate :: SyntaxKind :: LATEOUT_KW };
     [macro_rules] => { $ crate :: SyntaxKind :: MACRO_RULES_KW };
@@ -1176,9 +1204,11 @@ pub fn from_char(c: char) -> Option<SyntaxKind> {
     [nomem] => { $ crate :: SyntaxKind :: NOMEM_KW };
     [noreturn] => { $ crate :: SyntaxKind :: NORETURN_KW };
     [nostack] => { $ crate :: SyntaxKind :: NOSTACK_KW };
+    [null] => { $ crate :: SyntaxKind :: NULL_KW };
     [offset_of] => { $ crate :: SyntaxKind :: OFFSET_OF_KW };
     [options] => { $ crate :: SyntaxKind :: OPTIONS_KW };
     [out] => { $ crate :: SyntaxKind :: OUT_KW };
+    [pattern_type] => { $ crate :: SyntaxKind :: PATTERN_TYPE_KW };
     [preserves_flags] => { $ crate :: SyntaxKind :: PRESERVES_FLAGS_KW };
     [pure] => { $ crate :: SyntaxKind :: PURE_KW };
     [raw] => { $ crate :: SyntaxKind :: RAW_KW };
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 7aaf270..26d28dd 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
@@ -362,6 +362,8 @@ fn impl_type_params() {
         run_and_expect_no_errors("test_data/parser/inline/ok/impl_type_params.rs");
     }
     #[test]
+    fn include_bytes() { run_and_expect_no_errors("test_data/parser/inline/ok/include_bytes.rs"); }
+    #[test]
     fn index_expr() { run_and_expect_no_errors("test_data/parser/inline/ok/index_expr.rs"); }
     #[test]
     fn label() { run_and_expect_no_errors("test_data/parser/inline/ok/label.rs"); }
@@ -474,6 +476,8 @@ fn nocontentexpr_after_item() {
         run_and_expect_no_errors("test_data/parser/inline/ok/nocontentexpr_after_item.rs");
     }
     #[test]
+    fn not_null_pat() { run_and_expect_no_errors("test_data/parser/inline/ok/not_null_pat.rs"); }
+    #[test]
     fn offset_of_parens() {
         run_and_expect_no_errors("test_data/parser/inline/ok/offset_of_parens.rs");
     }
@@ -506,6 +510,8 @@ fn path_type_with_bounds() {
         run_and_expect_no_errors("test_data/parser/inline/ok/path_type_with_bounds.rs");
     }
     #[test]
+    fn pattern_type() { run_and_expect_no_errors("test_data/parser/inline/ok/pattern_type.rs"); }
+    #[test]
     fn placeholder_pat() {
         run_and_expect_no_errors("test_data/parser/inline/ok/placeholder_pat.rs");
     }
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/err/0032_match_arms_inner_attrs.rast b/src/tools/rust-analyzer/crates/parser/test_data/parser/err/0032_match_arms_inner_attrs.rast
index 2334b73..234070b 100644
--- a/src/tools/rust-analyzer/crates/parser/test_data/parser/err/0032_match_arms_inner_attrs.rast
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/err/0032_match_arms_inner_attrs.rast
@@ -37,27 +37,26 @@
               MATCH_ARM
                 ATTR
                   POUND "#"
-                ERROR
+                NOT_NULL
                   BANG "!"
-                ARRAY_EXPR
-                  L_BRACK "["
-                  CALL_EXPR
-                    PATH_EXPR
+                  SLICE_PAT
+                    L_BRACK "["
+                    TUPLE_STRUCT_PAT
                       PATH
                         PATH_SEGMENT
                           NAME_REF
                             IDENT "doc"
-                    ARG_LIST
                       L_PAREN "("
-                      LITERAL
-                        STRING "\"Not allowed here\""
+                      LITERAL_PAT
+                        LITERAL
+                          STRING "\"Not allowed here\""
                       R_PAREN ")"
-                  R_BRACK "]"
-              WHITESPACE "\n        "
-              MATCH_ARM
-                WILDCARD_PAT
+                    R_BRACK "]"
+                WHITESPACE "\n        "
+                UNDERSCORE_EXPR
                   UNDERSCORE "_"
-                WHITESPACE " "
+              WHITESPACE " "
+              MATCH_ARM
                 FAT_ARROW "=>"
                 WHITESPACE " "
                 TUPLE_EXPR
@@ -103,22 +102,21 @@
               MATCH_ARM
                 ATTR
                   POUND "#"
-                ERROR
+                NOT_NULL
                   BANG "!"
-                ARRAY_EXPR
-                  L_BRACK "["
-                  CALL_EXPR
-                    PATH_EXPR
+                  SLICE_PAT
+                    L_BRACK "["
+                    TUPLE_STRUCT_PAT
                       PATH
                         PATH_SEGMENT
                           NAME_REF
                             IDENT "doc"
-                    ARG_LIST
                       L_PAREN "("
-                      LITERAL
-                        STRING "\"Nor here\""
+                      LITERAL_PAT
+                        LITERAL
+                          STRING "\"Nor here\""
                       R_PAREN ")"
-                  R_BRACK "]"
+                    R_BRACK "]"
               WHITESPACE "\n    "
               R_CURLY "}"
         WHITESPACE "\n\n    "
@@ -146,27 +144,26 @@
               WHITESPACE "\n        "
               ATTR
                 POUND "#"
-              ERROR
+              NOT_NULL
                 BANG "!"
-              ARRAY_EXPR
-                L_BRACK "["
-                CALL_EXPR
-                  PATH_EXPR
+                SLICE_PAT
+                  L_BRACK "["
+                  TUPLE_STRUCT_PAT
                     PATH
                       PATH_SEGMENT
                         NAME_REF
                           IDENT "doc"
-                  ARG_LIST
                     L_PAREN "("
-                    LITERAL
-                      STRING "\"Nor here\""
+                    LITERAL_PAT
+                      LITERAL
+                        STRING "\"Nor here\""
                     R_PAREN ")"
-                R_BRACK "]"
-            WHITESPACE "\n        "
-            MATCH_ARM
-              WILDCARD_PAT
+                  R_BRACK "]"
+              WHITESPACE "\n        "
+              UNDERSCORE_EXPR
                 UNDERSCORE "_"
-              WHITESPACE " "
+            WHITESPACE " "
+            MATCH_ARM
               FAT_ARROW "=>"
               WHITESPACE " "
               TUPLE_EXPR
@@ -190,13 +187,13 @@
         R_CURLY "}"
   WHITESPACE "\n"
 error 52: expected L_BRACK
-error 52: expected pattern
-error 53: expected FAT_ARROW
-error 78: expected `,`
+error 78: expected FAT_ARROW
+error 88: expected `,`
+error 89: expected pattern
 error 161: expected L_BRACK
-error 161: expected pattern
-error 162: expected FAT_ARROW
+error 179: expected FAT_ARROW
+error 179: expected expression
 error 232: expected L_BRACK
-error 232: expected pattern
-error 233: expected FAT_ARROW
-error 250: expected `,`
+error 250: expected FAT_ARROW
+error 260: expected `,`
+error 261: expected pattern
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/include_bytes.rast b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/include_bytes.rast
new file mode 100644
index 0000000..df47eb9
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/include_bytes.rast
@@ -0,0 +1,23 @@
+SOURCE_FILE
+  FN
+    FN_KW "fn"
+    WHITESPACE " "
+    NAME
+      IDENT "foo"
+    PARAM_LIST
+      L_PAREN "("
+      R_PAREN ")"
+    WHITESPACE " "
+    BLOCK_EXPR
+      STMT_LIST
+        L_CURLY "{"
+        WHITESPACE " "
+        INCLUDE_BYTES_EXPR
+          BUILTIN_KW "builtin"
+          WHITESPACE " "
+          POUND "#"
+          WHITESPACE " "
+          INCLUDE_BYTES_KW "include_bytes"
+        WHITESPACE " "
+        R_CURLY "}"
+  WHITESPACE "\n"
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/include_bytes.rs b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/include_bytes.rs
new file mode 100644
index 0000000..6367235
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/include_bytes.rs
@@ -0,0 +1 @@
+fn foo() { builtin # include_bytes }
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/not_null_pat.rast b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/not_null_pat.rast
new file mode 100644
index 0000000..7a2e655
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/not_null_pat.rast
@@ -0,0 +1,46 @@
+SOURCE_FILE
+  FN
+    FN_KW "fn"
+    WHITESPACE " "
+    NAME
+      IDENT "main"
+    PARAM_LIST
+      L_PAREN "("
+      R_PAREN ")"
+    WHITESPACE " "
+    BLOCK_EXPR
+      STMT_LIST
+        L_CURLY "{"
+        WHITESPACE "\n    "
+        LET_STMT
+          LET_KW "let"
+          WHITESPACE " "
+          PAREN_PAT
+            L_PAREN "("
+            OR_PAT
+              NOT_NULL
+                BANG "!"
+                IDENT_PAT
+                  NAME
+                    IDENT "a"
+              WHITESPACE " "
+              PIPE "|"
+              WHITESPACE " "
+              NOT_NULL
+                BANG "!"
+                REF_PAT
+                  AMP "&"
+                  LITERAL_PAT
+                    LITERAL
+                      INT_NUMBER "0"
+            R_PAREN ")"
+          WHITESPACE " "
+          EQ "="
+          WHITESPACE " "
+          TUPLE_EXPR
+            L_PAREN "("
+            R_PAREN ")"
+          SEMICOLON ";"
+        WHITESPACE "\n"
+        R_CURLY "}"
+  WHITESPACE "\n"
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/not_null_pat.rs b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/not_null_pat.rs
new file mode 100644
index 0000000..f44fae5
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/not_null_pat.rs
@@ -0,0 +1,3 @@
+fn main() {
+    let (!a | !&0) = ();
+}
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/pattern_type.rast b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/pattern_type.rast
new file mode 100644
index 0000000..c9caeb1
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/pattern_type.rast
@@ -0,0 +1,34 @@
+SOURCE_FILE
+  TYPE_ALIAS
+    TYPE_KW "type"
+    WHITESPACE " "
+    NAME
+      IDENT "T"
+    WHITESPACE " "
+    EQ "="
+    WHITESPACE " "
+    PATTERN_TYPE
+      BUILTIN_KW "builtin"
+      POUND "#"
+      PATTERN_TYPE_KW "pattern_type"
+      WHITESPACE " "
+      L_PAREN "("
+      PATH_TYPE
+        PATH
+          PATH_SEGMENT
+            NAME_REF
+              IDENT "u8"
+      WHITESPACE " "
+      IS_KW "is"
+      WHITESPACE " "
+      RANGE_PAT
+        LITERAL_PAT
+          LITERAL
+            INT_NUMBER "0"
+        DOT2 ".."
+        LITERAL_PAT
+          LITERAL
+            INT_NUMBER "10"
+      R_PAREN ")"
+    SEMICOLON ";"
+  WHITESPACE "\n"
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/pattern_type.rs b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/pattern_type.rs
new file mode 100644
index 0000000..c909c7b
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/pattern_type.rs
@@ -0,0 +1 @@
+type T = builtin#pattern_type (u8 is 0..10);
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rast b/src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rast
index 51837e5..24256ea 100644
--- a/src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rast
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rast
@@ -151,6 +151,16 @@
           L_PAREN "("
           R_PAREN ")"
       COMMA ","
+      WHITESPACE "\n    "
+      VARIANT
+        UNDERSCORE "_"
+        WHITESPACE " "
+        EQ "="
+        WHITESPACE " "
+        CONST_ARG
+          RANGE_EXPR
+            DOT2 ".."
+      COMMA ","
       WHITESPACE "\n"
       R_CURLY "}"
   WHITESPACE "\n"
diff --git a/src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rs b/src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rs
index 7a1afa0..f548479 100644
--- a/src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rs
+++ b/src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rs
@@ -22,4 +22,5 @@ enum E5 {
     F {},
     D(u32,),
     E(),
+    _ = ..,
 }
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml b/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml
index a135a46..7342e0e 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml
@@ -34,9 +34,8 @@
 rayon.workspace = true
 
 [features]
-sysroot-abi = ["proc-macro-srv", "proc-macro-srv/sysroot-abi"]
+in-rust-tree = ["proc-macro-srv", "proc-macro-srv/in-rust-tree"]
 default = []
-in-rust-tree = []
 
 [lints]
 workspace = true
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol.rs
index ba59cb2..75c3bf8 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol.rs
@@ -12,8 +12,8 @@
 use crate::{
     ProcMacro, ProcMacroKind, ServerError,
     bidirectional_protocol::msg::{
-        BidirectionalMessage, ExpandMacro, ExpandMacroData, ExpnGlobals, Request, Response,
-        SubRequest, SubResponse,
+        ApiVersionCheck, BidirectionalMessage, ExpandMacro, ExpandMacroData, ExpnGlobals,
+        ListMacros, Request, Response, SubRequest, SubResponse,
     },
     legacy_protocol::{
         SpanMode,
@@ -98,7 +98,7 @@ pub(crate) fn version_check(
     srv: &ProcMacroServerProcess,
     callback: SubCallback<'_>,
 ) -> Result<u32, ServerError> {
-    let request = BidirectionalMessage::Request(Request::ApiVersionCheck {});
+    let request = BidirectionalMessage::Request(Request::ApiVersionCheck(ApiVersionCheck {}));
 
     let response_payload = run_request(srv, request, callback)?;
 
@@ -135,9 +135,9 @@ pub(crate) fn find_proc_macros(
     dylib_path: &AbsPath,
     callback: SubCallback<'_>,
 ) -> Result<Result<Vec<(String, ProcMacroKind)>, String>, ServerError> {
-    let request = BidirectionalMessage::Request(Request::ListMacros {
+    let request = BidirectionalMessage::Request(Request::ListMacros(ListMacros {
         dylib_path: dylib_path.to_path_buf().into(),
-    });
+    }));
 
     let response_payload = run_request(srv, request, callback)?;
 
@@ -186,25 +186,12 @@ pub(crate) fn expand(
 
     match response_payload {
         BidirectionalMessage::Response(Response::ExpandMacro(it)) => Ok(it
-            .map(|tree| {
-                let mut expanded = FlatTree::to_subtree_resolved(tree, version, &span_data_table);
-                if proc_macro.needs_fixup_change() {
-                    proc_macro.change_fixup_to_match_old_server(&mut expanded);
-                }
-                expanded
-            })
-            .map_err(|msg| msg.0)),
-        BidirectionalMessage::Response(Response::ExpandMacroExtended(it)) => Ok(it
             .map(|resp| {
-                let mut expanded = FlatTree::to_subtree_resolved(
+                FlatTree::to_subtree_resolved(
                     resp.tree,
                     version,
                     &deserialize_span_data_index_map(&resp.span_data_table),
-                );
-                if proc_macro.needs_fixup_change() {
-                    proc_macro.change_fixup_to_match_old_server(&mut expanded);
-                }
-                expanded
+                )
             })
             .map_err(|msg| msg.0)),
         _ => Err(ServerError { message: "unexpected response".to_owned(), io: None }),
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol/msg.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol/msg.rs
index ab4bed8..e516297 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol/msg.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/bidirectional_protocol/msg.rs
@@ -1,6 +1,8 @@
 //! Bidirectional protocol messages
+#![expect(clippy::disallowed_types)]
 
 use std::{
+    collections::{HashMap, HashSet},
     io::{self, BufRead, Write},
     ops::Range,
 };
@@ -16,13 +18,54 @@
 
 #[derive(Debug, Serialize, Deserialize)]
 pub enum SubRequest {
-    FilePath { file_id: u32 },
-    SourceText { file_id: u32, ast_id: u32, start: u32, end: u32 },
-    LocalFilePath { file_id: u32 },
-    LineColumn { file_id: u32, ast_id: u32, offset: u32 },
-    ByteRange { file_id: u32, ast_id: u32, start: u32, end: u32 },
-    SpanSource { file_id: u32, ast_id: u32, start: u32, end: u32, ctx: u32 },
-    SpanParent { file_id: u32, ast_id: u32, start: u32, end: u32, ctx: u32 },
+    FilePath {
+        file_id: u32,
+    },
+    SourceText {
+        file_id: u32,
+        ast_id: u32,
+        start: u32,
+        end: u32,
+    },
+    LocalFilePath {
+        file_id: u32,
+    },
+    LineColumn {
+        file_id: u32,
+        ast_id: u32,
+        offset: u32,
+    },
+    ByteRange {
+        file_id: u32,
+        ast_id: u32,
+        start: u32,
+        end: u32,
+    },
+    SpanSource {
+        file_id: u32,
+        ast_id: u32,
+        start: u32,
+        end: u32,
+        ctx: u32,
+    },
+    SpanParent {
+        file_id: u32,
+        ast_id: u32,
+        start: u32,
+        end: u32,
+        ctx: u32,
+    },
+    SpanJoin {
+        file_id: u32,
+        ast_id_first: u32,
+        start_first: u32,
+        end_first: u32,
+        ctx_first: u32,
+        ast_id_second: u32,
+        start_second: u32,
+        end_second: u32,
+        ctx_second: u32,
+    },
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -54,6 +97,9 @@ pub enum SubResponse {
     SpanParentResult {
         parent_span: Option<ParentSpan>,
     },
+    SpanJoinResult {
+        span: Option<SpanJoin>,
+    },
     Cancel {
         reason: String,
     },
@@ -69,6 +115,15 @@ pub struct ParentSpan {
 }
 
 #[derive(Debug, Serialize, Deserialize)]
+pub struct SpanJoin {
+    pub ast_id: u32,
+    pub start: u32,
+    pub end: u32,
+    pub ctx: u32,
+}
+
+#[expect(clippy::large_enum_variant)]
+#[derive(Debug, Serialize, Deserialize)]
 pub enum BidirectionalMessage {
     Request(Request),
     Response(Response),
@@ -78,22 +133,30 @@ pub enum BidirectionalMessage {
 
 #[derive(Debug, Serialize, Deserialize)]
 pub enum Request {
-    ListMacros { dylib_path: Utf8PathBuf },
+    ListMacros(ListMacros),
     ExpandMacro(Box<ExpandMacro>),
-    ApiVersionCheck {},
+    ApiVersionCheck(ApiVersionCheck),
     SetConfig(ServerConfig),
 }
 
+#[expect(clippy::large_enum_variant)]
 #[derive(Debug, Serialize, Deserialize)]
 pub enum Response {
     ListMacros(Result<Vec<(String, ProcMacroKind)>, String>),
-    ExpandMacro(Result<FlatTree, PanicMessage>),
     ApiVersionCheck(u32),
     SetConfig(ServerConfig),
-    ExpandMacroExtended(Result<ExpandMacroExtended, PanicMessage>),
+    ExpandMacro(Result<ExpandMacroResponse, PanicMessage>),
 }
 
 #[derive(Debug, Serialize, Deserialize)]
+pub struct ListMacros {
+    pub dylib_path: Utf8PathBuf,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ApiVersionCheck {}
+
+#[derive(Debug, Serialize, Deserialize)]
 pub struct ExpandMacro {
     pub lib: Utf8PathBuf,
     pub env: Vec<(String, String)>,
@@ -102,9 +165,11 @@ pub struct ExpandMacro {
 }
 
 #[derive(Debug, Serialize, Deserialize)]
-pub struct ExpandMacroExtended {
+pub struct ExpandMacroResponse {
     pub tree: FlatTree,
     pub span_data_table: Vec<u32>,
+    pub tracked_env_vars: HashMap<Box<str>, Option<Box<str>>>,
+    pub tracked_paths: HashSet<Box<str>>,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs
index bb0dde4..9b71a8b 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg.rs
@@ -193,9 +193,7 @@ fn write(self, out: &mut dyn Write) -> io::Result<()> {
 #[cfg(test)]
 mod tests {
     use intern::Symbol;
-    use span::{
-        Edition, ROOT_ERASED_FILE_AST_ID, Span, SpanAnchor, SyntaxContext, TextRange, TextSize,
-    };
+    use span::{ROOT_ERASED_FILE_AST_ID, Span, SpanAnchor, SyntaxContext, TextRange, TextSize};
     use tt::{
         Delimiter, DelimiterKind, Ident, Leaf, Literal, Punct, Spacing, TopSubtree,
         TopSubtreeBuilder,
@@ -205,6 +203,11 @@ mod tests {
 
     use super::*;
 
+    fn make_ctx() -> SyntaxContext {
+        // SAFETY: Tests do not use a Database, so this won't ever be used within salsa.
+        unsafe { SyntaxContext::from_u32(0) }
+    }
+
     fn fixture_token_tree_top_many_none() -> TopSubtree {
         let anchor = SpanAnchor {
             file_id: span::EditionedFileId::new(
@@ -215,16 +218,8 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
         };
 
         let mut builder = TopSubtreeBuilder::new(Delimiter {
-            open: Span {
-                range: TextRange::empty(TextSize::new(0)),
-                anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
-            },
-            close: Span {
-                range: TextRange::empty(TextSize::new(0)),
-                anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
-            },
+            open: Span { range: TextRange::empty(TextSize::new(0)), anchor, ctx: make_ctx() },
+            close: Span { range: TextRange::empty(TextSize::new(0)), anchor, ctx: make_ctx() },
             kind: DelimiterKind::Invisible,
         });
 
@@ -234,7 +229,7 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
                 span: Span {
                     range: TextRange::at(TextSize::new(0), TextSize::of("struct")),
                     anchor,
-                    ctx: SyntaxContext::root(Edition::CURRENT),
+                    ctx: make_ctx(),
                 },
                 is_raw: tt::IdentIsRaw::No,
             }
@@ -246,7 +241,7 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
                 span: Span {
                     range: TextRange::at(TextSize::new(5), TextSize::of("r#Foo")),
                     anchor,
-                    ctx: SyntaxContext::root(Edition::CURRENT),
+                    ctx: make_ctx(),
                 },
                 is_raw: tt::IdentIsRaw::Yes,
             }
@@ -257,7 +252,7 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
             Span {
                 range: TextRange::at(TextSize::new(10), TextSize::of("\"Foo\"")),
                 anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
+                ctx: make_ctx(),
             },
             tt::LitKind::Str,
         )));
@@ -266,7 +261,7 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
             span: Span {
                 range: TextRange::at(TextSize::new(13), TextSize::of('@')),
                 anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
+                ctx: make_ctx(),
             },
             spacing: Spacing::Joint,
         }));
@@ -275,7 +270,7 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
             Span {
                 range: TextRange::at(TextSize::new(14), TextSize::of('{')),
                 anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
+                ctx: make_ctx(),
             },
         );
         builder.open(
@@ -283,7 +278,7 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
             Span {
                 range: TextRange::at(TextSize::new(15), TextSize::of('[')),
                 anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
+                ctx: make_ctx(),
             },
         );
         builder.push(Leaf::Literal(Literal::new(
@@ -291,7 +286,7 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
             Span {
                 range: TextRange::at(TextSize::new(16), TextSize::of("0u32")),
                 anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
+                ctx: make_ctx(),
             },
             tt::LitKind::Integer,
             "u32",
@@ -299,13 +294,13 @@ fn fixture_token_tree_top_many_none() -> TopSubtree {
         builder.close(Span {
             range: TextRange::at(TextSize::new(20), TextSize::of(']')),
             anchor,
-            ctx: SyntaxContext::root(Edition::CURRENT),
+            ctx: make_ctx(),
         });
 
         builder.close(Span {
             range: TextRange::at(TextSize::new(21), TextSize::of('}')),
             anchor,
-            ctx: SyntaxContext::root(Edition::CURRENT),
+            ctx: make_ctx(),
         });
 
         builder.build()
@@ -321,16 +316,8 @@ fn fixture_token_tree_top_empty_none() -> TopSubtree {
         };
 
         let builder = TopSubtreeBuilder::new(Delimiter {
-            open: Span {
-                range: TextRange::empty(TextSize::new(0)),
-                anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
-            },
-            close: Span {
-                range: TextRange::empty(TextSize::new(0)),
-                anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
-            },
+            open: Span { range: TextRange::empty(TextSize::new(0)), anchor, ctx: make_ctx() },
+            close: Span { range: TextRange::empty(TextSize::new(0)), anchor, ctx: make_ctx() },
             kind: DelimiterKind::Invisible,
         });
 
@@ -347,16 +334,8 @@ fn fixture_token_tree_top_empty_brace() -> TopSubtree {
         };
 
         let builder = TopSubtreeBuilder::new(Delimiter {
-            open: Span {
-                range: TextRange::empty(TextSize::new(0)),
-                anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
-            },
-            close: Span {
-                range: TextRange::empty(TextSize::new(0)),
-                anchor,
-                ctx: SyntaxContext::root(Edition::CURRENT),
-            },
+            open: Span { range: TextRange::empty(TextSize::new(0)), anchor, ctx: make_ctx() },
+            close: Span { range: TextRange::empty(TextSize::new(0)), anchor, ctx: make_ctx() },
             kind: DelimiterKind::Brace,
         });
 
@@ -405,7 +384,7 @@ fn test_proc_macro_rpc_works() {
     }
 
     #[test]
-    #[cfg(feature = "sysroot-abi")]
+    #[cfg(feature = "in-rust-tree")]
     fn test_proc_macro_rpc_works_ts() {
         for tt in [
             fixture_token_tree_top_many_none,
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs
index 248de70..3015bd0 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/legacy_protocol/msg/flat.rs
@@ -34,7 +34,7 @@
 //! as we don't have bincode in Cargo.toml yet, lets stick with serde_json for
 //! the time being.
 
-#[cfg(feature = "sysroot-abi")]
+#[cfg(feature = "in-rust-tree")]
 use proc_macro_srv::TokenStream;
 
 use std::collections::VecDeque;
@@ -195,7 +195,7 @@ pub fn to_subtree_resolved(
     }
 }
 
-#[cfg(feature = "sysroot-abi")]
+#[cfg(feature = "in-rust-tree")]
 impl FlatTree {
     pub fn from_tokenstream(
         tokenstream: proc_macro_srv::TokenStream<Span>,
@@ -591,7 +591,7 @@ fn token_id_of(&mut self, span: T::Span) -> SpanId {
         T::token_id_of(self.span_data_table, span)
     }
 
-    #[cfg(feature = "sysroot-abi")]
+    #[cfg(feature = "in-rust-tree")]
     pub(crate) fn intern(&mut self, text: &'a str) -> u32 {
         let table = &mut self.text;
         *self.string_table.entry(text.into()).or_insert_with(|| {
@@ -611,7 +611,7 @@ pub(crate) fn intern_owned(&mut self, text: String) -> u32 {
     }
 }
 
-#[cfg(feature = "sysroot-abi")]
+#[cfg(feature = "in-rust-tree")]
 impl<'a, T: SpanTransformer>
     Writer<'a, '_, T, Option<proc_macro_srv::TokenStreamIter<'a, T::Span>>>
 {
@@ -852,7 +852,7 @@ pub(crate) fn read_subtree(self) -> tt::TopSubtree {
     }
 }
 
-#[cfg(feature = "sysroot-abi")]
+#[cfg(feature = "in-rust-tree")]
 impl<T: SpanTransformer> Reader<'_, T> {
     pub(crate) fn read_tokenstream(
         self,
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs
index e83ddb8..149f6e4 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs
@@ -5,13 +5,12 @@
 //! is used to provide basic infrastructure for communication between two
 //! processes: Client (RA itself), Server (the external program)
 
-#![cfg_attr(not(feature = "sysroot-abi"), allow(unused_crate_dependencies))]
+#![cfg_attr(not(feature = "in-rust-tree"), allow(unused_crate_dependencies))]
 #![cfg_attr(
-    feature = "sysroot-abi",
-    feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)
+    feature = "in-rust-tree",
+    feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span, rustc_private)
 )]
 #![allow(internal_features, unused_features)]
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
 
 #[cfg(feature = "in-rust-tree")]
 extern crate rustc_driver as _;
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 80e4ed0..035c126 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
@@ -240,8 +240,9 @@ pub(crate) fn version(&self) -> u32 {
     /// Enable support for rust-analyzer span mode if the server supports it.
     pub(crate) fn rust_analyzer_spans(&self) -> bool {
         match self.protocol {
-            Protocol::LegacyJson { mode } => mode == SpanMode::RustAnalyzer,
-            Protocol::BidirectionalPostcardPrototype { mode } => mode == SpanMode::RustAnalyzer,
+            Protocol::LegacyJson { mode } | Protocol::BidirectionalPostcardPrototype { mode } => {
+                mode == SpanMode::RustAnalyzer
+            }
         }
     }
 
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml
index f586fe7..44e19f2 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml
@@ -31,9 +31,8 @@
 
 [features]
 default = []
-# default = ["sysroot-abi"]
-sysroot-abi = ["proc-macro-srv/sysroot-abi", "proc-macro-api/sysroot-abi"]
-in-rust-tree = ["proc-macro-srv/in-rust-tree", "sysroot-abi"]
+# default = ["in-rust-tree"]
+in-rust-tree = ["proc-macro-srv/in-rust-tree", "proc-macro-api/in-rust-tree"]
 
 
 [[bin]]
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/README.md b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/README.md
index 02a67ac..93a3c7f 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/README.md
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/README.md
@@ -9,12 +9,12 @@
 1. Proc macros are dynamic libraries that can segfault, bringing down the entire process, so running them out of process allows rust-analyzer to recover from fatal errors.

 2. Proc macro dylibs are compiled against a specific rustc version and require matching internal APIs to load and execute, as such having this binary shipped as a rustup component allows us to always match the rustc version irrespective of the rust-analyzer version used.

 

-## The `sysroot-abi` Feature

+## The `in-rust-tree` Feature

 

-**The `sysroot-abi` feature is required for the binary to actually function.** Without it, the binary will return an error:

+**The `in-rust-tree` feature is required for the binary to actually function.** Without it, the binary will return an error:

 

 ```

-proc-macro-srv-cli needs to be compiled with the `sysroot-abi` feature to function

+proc-macro-srv-cli needs to be compiled with the `in-rust-tree` feature to function

 ```

 

 This feature is necessary because the proc-macro server needs access to unstable rustc internals (`proc_macro_internals`, `proc_macro_diagnostic`, `proc_macro_span`) which are only available on nightly or with `RUSTC_BOOTSTRAP=1`.

@@ -24,10 +24,10 @@
 

 ```bash

 # Using nightly toolchain

-cargo build -p proc-macro-srv-cli --features sysroot-abi

+cargo build -p proc-macro-srv-cli --features in-rust-tree

 

 # Or with RUSTC_BOOTSTRAP on stable

-RUSTC_BOOTSTRAP=1 cargo build -p proc-macro-srv-cli --features sysroot-abi

+RUSTC_BOOTSTRAP=1 cargo build -p proc-macro-srv-cli --features in-rust-tree

 ```

 

 ### Installing the proc-macro server

@@ -42,7 +42,7 @@
 ## Testing

 

 ```bash

-cargo test --features sysroot-abi -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api

+cargo test --features in-rust-tree -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api

 ```

 

 The tests use a test proc macro dylib built by the `proc-macro-test` crate, which compiles a small proc macro implementation during build time.

diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/lib.rs b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/lib.rs
index 8475c05..c330928 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/lib.rs
@@ -1,11 +1,10 @@
-//! Library interface for `proc-macro-srv-cli`.

-//!

-//! This module exposes the server main loop and protocol format for integration testing.

-

-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]

-

-#[cfg(feature = "in-rust-tree")]

-extern crate rustc_driver as _;

-

-#[cfg(feature = "sysroot-abi")]

-pub mod main_loop;

+//! Library interface for `proc-macro-srv-cli`.
+//!
+//! This module exposes the server main loop and protocol format for integration testing.
+
+#![cfg(feature = "in-rust-tree")]
+#![feature(rustc_private)]
+
+extern crate rustc_driver as _;
+
+pub mod main_loop;
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main.rs b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main.rs
index 9287536..926633d 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main.rs
@@ -1,7 +1,7 @@
 //! A standalone binary for `proc-macro-srv`.
 //! Driver for proc macro server
 #![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
-#![cfg_attr(not(feature = "sysroot-abi"), allow(unused_crate_dependencies))]
+#![cfg_attr(not(feature = "in-rust-tree"), allow(unused_crate_dependencies))]
 #![allow(clippy::print_stdout, clippy::print_stderr)]
 
 #[cfg(feature = "in-rust-tree")]
@@ -12,7 +12,7 @@
 use clap::{Command, ValueEnum};
 use proc_macro_api::ProtocolFormat;
 
-#[cfg(feature = "sysroot-abi")]
+#[cfg(feature = "in-rust-tree")]
 use proc_macro_srv_cli::main_loop::run;
 
 fn main() -> std::io::Result<()> {
@@ -91,7 +91,7 @@ fn from_str(input: &str, _ignore_case: bool) -> Result<Self, String> {
     }
 }
 
-#[cfg(not(feature = "sysroot-abi"))]
+#[cfg(not(feature = "in-rust-tree"))]
 fn run(
     _: &mut std::io::BufReader<std::io::Stdin>,
     _: &mut std::io::Stdout,
@@ -99,7 +99,7 @@ fn run(
 ) -> std::io::Result<()> {
     Err(std::io::Error::new(
         std::io::ErrorKind::Unsupported,
-        "proc-macro-srv-cli needs to be compiled with the `sysroot-abi` feature to function"
+        "proc-macro-srv-cli needs to be compiled with the `in-rust-tree` feature to function"
             .to_owned(),
     ))
 }
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main_loop.rs b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main_loop.rs
index c525ed8..6697b63 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main_loop.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/src/main_loop.rs
@@ -1,4 +1,5 @@
 //! The main loop of the proc-macro server.
+use proc_macro_api::bidirectional_protocol::msg::{ApiVersionCheck, ListMacros};
 use proc_macro_api::{
     ProtocolFormat, bidirectional_protocol::msg as bidirectional, legacy_protocol::msg as legacy,
     version::CURRENT_API_VERSION,
@@ -72,7 +73,7 @@ fn macro_kind_to_api(kind: proc_macro_srv::ProcMacroKind) -> proc_macro_api::Pro
 
         match req {
             bidirectional::BidirectionalMessage::Request(request) => match request {
-                bidirectional::Request::ListMacros { dylib_path } => {
+                bidirectional::Request::ListMacros(ListMacros { dylib_path }) => {
                     let res = srv.list_macros(&dylib_path).map(|macros| {
                         macros
                             .into_iter()
@@ -83,7 +84,7 @@ fn macro_kind_to_api(kind: proc_macro_srv::ProcMacroKind) -> proc_macro_api::Pro
                     send_response(stdout, bidirectional::Response::ListMacros(res))?;
                 }
 
-                bidirectional::Request::ApiVersionCheck {} => {
+                bidirectional::Request::ApiVersionCheck(ApiVersionCheck {}) => {
                     send_response(
                         stdout,
                         bidirectional::Response::ApiVersionCheck(CURRENT_API_VERSION),
@@ -142,6 +143,7 @@ fn handle_expand_id(
     let attributes = attributes
         .map(|it| it.to_tokenstream_unresolved::<SpanTrans>(CURRENT_API_VERSION, |_, b| b));
 
+    let mut tracked_env = Default::default();
     let res = srv
         .expand(
             lib,
@@ -153,11 +155,18 @@ fn handle_expand_id(
             def_site,
             call_site,
             mixed_site,
+            &mut tracked_env,
             None,
         )
         .map(|it| {
             legacy::FlatTree::from_tokenstream_raw::<SpanTrans>(it, call_site, CURRENT_API_VERSION)
         })
+        .map(|tree| bidirectional::ExpandMacroResponse {
+            tree,
+            span_data_table: vec![],
+            tracked_env_vars: tracked_env.env_vars,
+            tracked_paths: tracked_env.paths,
+        })
         .map_err(|e| legacy::PanicMessage(e.into_string().unwrap_or_default()));
 
     send_response(stdout, bidirectional::Response::ExpandMacro(res))
@@ -343,6 +352,46 @@ fn span_parent(
             other => handle_failure(other),
         }
     }
+
+    fn span_join(
+        &mut self,
+        first: proc_macro_srv::span::Span,
+        second: proc_macro_srv::span::Span,
+    ) -> Option<proc_macro_srv::span::Span> {
+        assert_eq!(first.anchor.file_id, second.anchor.file_id);
+        let response = self.roundtrip(bidirectional::SubRequest::SpanJoin {
+            file_id: first.anchor.file_id.as_u32(),
+            ast_id_first: first.anchor.ast_id.into_raw(),
+            start_first: first.range.start().into(),
+            end_first: first.range.end().into(),
+            ctx_first: first.ctx.into_u32(),
+            ast_id_second: second.anchor.ast_id.into_raw(),
+            start_second: second.range.start().into(),
+            end_second: second.range.end().into(),
+            ctx_second: second.ctx.into_u32(),
+        });
+
+        match response {
+            Ok(bidirectional::SubResponse::SpanJoinResult { span }) => {
+                span.map(|bidirectional::SpanJoin { ast_id, start, end, ctx }| {
+                    proc_macro_srv::span::Span {
+                        range: proc_macro_srv::span::TextRange::new(
+                            proc_macro_srv::span::TextSize::new(start),
+                            proc_macro_srv::span::TextSize::new(end),
+                        ),
+                        anchor: proc_macro_srv::span::SpanAnchor {
+                            file_id: first.anchor.file_id,
+                            ast_id: proc_macro_srv::span::ErasedFileAstId::from_raw(ast_id),
+                        },
+                        // SAFETY: spans originate from the server. If the protocol is violated,
+                        // undefined behavior is the caller’s responsibility.
+                        ctx: unsafe { proc_macro_srv::span::SyntaxContext::from_u32(ctx) },
+                    }
+                })
+            }
+            other => handle_failure(other),
+        }
+    }
 }
 
 fn handle_expand_ra(
@@ -383,6 +432,8 @@ fn handle_expand_ra(
         })
     });
 
+    let mut tracked_env = Default::default();
+
     let res = srv
         .expand(
             lib,
@@ -394,6 +445,7 @@ fn handle_expand_ra(
             def_site,
             call_site,
             mixed_site,
+            &mut tracked_env,
             Some(&mut ProcMacroClientHandle { stdin, stdout, buf }),
         )
         .map(|it| {
@@ -407,10 +459,15 @@ fn handle_expand_ra(
                 legacy::serialize_span_data_index_map(&span_data_table),
             )
         })
-        .map(|(tree, span_data_table)| bidirectional::ExpandMacroExtended { tree, span_data_table })
+        .map(|(tree, span_data_table)| bidirectional::ExpandMacroResponse {
+            tree,
+            span_data_table,
+            tracked_env_vars: tracked_env.env_vars,
+            tracked_paths: tracked_env.paths,
+        })
         .map_err(|e| legacy::PanicMessage(e.into_string().unwrap_or_default()));
 
-    send_response(stdout, bidirectional::Response::ExpandMacroExtended(res))
+    send_response(stdout, bidirectional::Response::ExpandMacro(res))
 }
 
 fn run_old(
@@ -480,6 +537,7 @@ fn macro_kind_to_api(kind: proc_macro_srv::ProcMacroKind) -> proc_macro_api::Pro
                             def_site,
                             call_site,
                             mixed_site,
+                            &mut Default::default(),
                             None,
                         )
                         .map(|it| {
@@ -522,6 +580,7 @@ fn macro_kind_to_api(kind: proc_macro_srv::ProcMacroKind) -> proc_macro_api::Pro
                             def_site,
                             call_site,
                             mixed_site,
+                            &mut Default::default(),
                             None,
                         )
                         .map(|it| {
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs
index ba9657a..9c55eed 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs
@@ -1,7 +1,6 @@
-#![cfg(feature = "sysroot-abi")]
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
+#![cfg(feature = "in-rust-tree")]
+#![feature(rustc_private)]
 
-#[cfg(feature = "in-rust-tree")]
 extern crate rustc_driver as _;
 
 mod common {
@@ -15,7 +14,10 @@ mod common {
 use proc_macro_api::{
     ProtocolFormat::BidirectionalPostcardPrototype,
     bidirectional_protocol::{
-        msg::{ExpandMacro, ExpandMacroData, ExpnGlobals, Request, Response},
+        msg::{
+            ApiVersionCheck, ExpandMacro, ExpandMacroData, ExpnGlobals, ListMacros, Request,
+            Response,
+        },
         reject_subrequests,
     },
     legacy_protocol::msg::{PanicMessage, ServerConfig, SpanDataIndexMap, SpanMode},
@@ -25,8 +27,12 @@ mod common {
 #[test]
 fn test_bidi_version_check_bidirectional() {
     with_server(BidirectionalPostcardPrototype, |writer, reader| {
-        let response =
-            request_bidirectional(writer, reader, Request::ApiVersionCheck {}, reject_subrequests);
+        let response = request_bidirectional(
+            writer,
+            reader,
+            Request::ApiVersionCheck(ApiVersionCheck {}),
+            reject_subrequests,
+        );
 
         match response {
             Response::ApiVersionCheck(version) => {
@@ -44,7 +50,7 @@ fn test_bidi_list_macros() {
         let response = request_bidirectional(
             writer,
             reader,
-            Request::ListMacros { dylib_path },
+            Request::ListMacros(ListMacros { dylib_path }),
             &reject_subrequests,
         );
 
@@ -84,7 +90,7 @@ fn test_bidi_list_macros_invalid_path() {
         let response = request_bidirectional(
             writer,
             reader,
-            Request::ListMacros { dylib_path: "/nonexistent/path/to/dylib.so".into() },
+            Request::ListMacros(ListMacros { dylib_path: "/nonexistent/path/to/dylib.so".into() }),
             reject_subrequests,
         );
 
@@ -168,8 +174,12 @@ fn test_bidi_basic_call_flow() {
     with_server(BidirectionalPostcardPrototype, |writer, reader| {
         let dylib_path = proc_macro_test_dylib_path();
 
-        let response1 =
-            request_bidirectional(writer, reader, Request::ApiVersionCheck {}, reject_subrequests);
+        let response1 = request_bidirectional(
+            writer,
+            reader,
+            Request::ApiVersionCheck(ApiVersionCheck {}),
+            reject_subrequests,
+        );
         assert!(matches!(response1, Response::ApiVersionCheck(_)));
 
         let response2 = request_bidirectional(
@@ -183,7 +193,7 @@ fn test_bidi_basic_call_flow() {
         let response3 = request_bidirectional(
             writer,
             reader,
-            Request::ListMacros { dylib_path: dylib_path.clone() },
+            Request::ListMacros(ListMacros { dylib_path: dylib_path.clone() }),
             reject_subrequests,
         );
         assert!(matches!(response3, Response::ListMacros(Ok(_))));
@@ -195,8 +205,12 @@ fn test_bidi_expand_nonexistent_macro() {
     with_server(BidirectionalPostcardPrototype, |writer, reader| {
         let dylib_path = proc_macro_test_dylib_path();
 
-        let version_response =
-            request_bidirectional(writer, reader, Request::ApiVersionCheck {}, reject_subrequests);
+        let version_response = request_bidirectional(
+            writer,
+            reader,
+            Request::ApiVersionCheck(ApiVersionCheck {}),
+            reject_subrequests,
+        );
         let Response::ApiVersionCheck(version) = version_response else {
             panic!("expected version check response");
         };
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/common/utils.rs b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/common/utils.rs
index 3049e98..b78e107 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/common/utils.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/common/utils.rs
@@ -135,6 +135,11 @@ pub(crate) fn proc_macro_test_dylib_path() -> Utf8PathBuf {
     path.into()
 }
 
+fn make_ctx() -> SyntaxContext {
+    // SAFETY: Tests do not use a Database, so this won't ever be used within salsa.
+    unsafe { SyntaxContext::from_u32(0) }
+}
+
 /// Creates a simple empty token tree suitable for testing.
 pub(crate) fn create_empty_token_tree(
     version: u32,
@@ -144,11 +149,7 @@ pub(crate) fn create_empty_token_tree(
         file_id: EditionedFileId::new(FileId::from_raw(0), Edition::CURRENT),
         ast_id: span::ROOT_ERASED_FILE_AST_ID,
     };
-    let span = Span {
-        range: TextRange::empty(0.into()),
-        anchor,
-        ctx: SyntaxContext::root(Edition::CURRENT),
-    };
+    let span = Span { range: TextRange::empty(0.into()), anchor, ctx: make_ctx() };
 
     let builder = TopSubtreeBuilder::new(Delimiter {
         open: span,
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/legacy_json.rs b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/legacy_json.rs
index 562cf0c..f5cbaa7 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/legacy_json.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv-cli/tests/legacy_json.rs
@@ -3,10 +3,9 @@
 //! These tests exercise the full client-server RPC procedure using in-memory
 //! channels without needing to spawn the actual server and client processes.
 
-#![cfg(feature = "sysroot-abi")]
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
+#![cfg(feature = "in-rust-tree")]
+#![feature(rustc_private)]
 
-#[cfg(feature = "in-rust-tree")]
 extern crate rustc_driver as _;
 
 mod common {
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml b/src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml
index 8e5617f..72d394d 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/Cargo.toml
@@ -23,8 +23,6 @@
 span = { path = "../span", version = "0.0.0", default-features = false}
 intern.workspace = true
 
-ra-ap-rustc_lexer.workspace = true
-
 
 [target.'cfg(unix)'.dependencies]
 libc.workspace = true
@@ -37,9 +35,11 @@
 proc-macro-test.path = "./proc-macro-test"
 
 [features]
-default = []
-sysroot-abi = []
-in-rust-tree = ["sysroot-abi"]
+default = ["in-rust-tree"]
+in-rust-tree = []
 
 [lints]
 workspace = true
+
+[package.metadata.rust-analyzer]
+rustc_private=true
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib.rs
index 9a65538..f654d21 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib.rs
@@ -1,9 +1,14 @@
 //! Handles dynamic library loading for proc macro
 
 mod proc_macros;
-mod version;
 
+use rustc_codegen_ssa::back::metadata::DefaultMetadataLoader;
+use rustc_interface::util::rustc_version_str;
+use rustc_metadata::locator::MetadataError;
 use rustc_proc_macro::bridge;
+use rustc_session::config::host_tuple;
+use rustc_target::spec::{Target, TargetTuple};
+use std::path::Path;
 use std::{fmt, fs, io, time::SystemTime};
 use temp_dir::TempDir;
 
@@ -12,8 +17,9 @@
 use paths::{Utf8Path, Utf8PathBuf};
 
 use crate::{
-    PanicMessage, ProcMacroClientHandle, ProcMacroKind, ProcMacroSrvSpan,
-    dylib::proc_macros::ProcMacros, token_stream::TokenStream,
+    PanicMessage, ProcMacroClientHandle, ProcMacroKind, ProcMacroSrvSpan, TrackedEnv,
+    dylib::proc_macros::{ProcMacroClients, ProcMacros},
+    token_stream::TokenStream,
 };
 
 pub(crate) struct Expander {
@@ -45,14 +51,22 @@ pub(crate) fn expand<'a, S: ProcMacroSrvSpan + 'a>(
         def_site: S,
         call_site: S,
         mixed_site: S,
-        callback: Option<ProcMacroClientHandle<'_>>,
+        tracked_env: &'a mut TrackedEnv,
+        callback: Option<ProcMacroClientHandle<'a>>,
     ) -> Result<TokenStream<S>, PanicMessage>
     where
         <S::Server<'a> as bridge::server::Server>::TokenStream: Default,
     {
-        self.inner
-            .proc_macros
-            .expand(macro_name, macro_body, attribute, def_site, call_site, mixed_site, callback)
+        self.inner.proc_macros.expand(
+            macro_name,
+            macro_body,
+            attribute,
+            def_site,
+            call_site,
+            mixed_site,
+            tracked_env,
+            callback,
+        )
     }
 
     pub(crate) fn list_macros(&self) -> impl Iterator<Item = (&str, ProcMacroKind)> {
@@ -68,18 +82,15 @@ pub(crate) fn modified_time(&self) -> SystemTime {
 pub enum LoadProcMacroDylibError {
     Io(io::Error),
     LibLoading(libloading::Error),
-    AbiMismatch(String),
+    MetadataError(MetadataError<'static>),
 }
 
 impl fmt::Display for LoadProcMacroDylibError {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
             Self::Io(e) => e.fmt(f),
-            Self::AbiMismatch(v) => {
-                use crate::RUSTC_VERSION_STRING;
-                write!(f, "mismatched ABI expected: `{RUSTC_VERSION_STRING}`, got `{v}`")
-            }
             Self::LibLoading(e) => e.fmt(f),
+            Self::MetadataError(e) => e.fmt(f),
         }
     }
 }
@@ -96,25 +107,44 @@ fn from(e: libloading::Error) -> Self {
     }
 }
 
+impl From<MetadataError<'_>> for LoadProcMacroDylibError {
+    fn from(e: MetadataError<'_>) -> Self {
+        LoadProcMacroDylibError::MetadataError(match e {
+            MetadataError::NotPresent(path) => MetadataError::NotPresent(path.into_owned().into()),
+            MetadataError::LoadFailure(err) => MetadataError::LoadFailure(err),
+            MetadataError::VersionMismatch { expected_version, found_version } => {
+                MetadataError::VersionMismatch { expected_version, found_version }
+            }
+        })
+    }
+}
+
 struct ProcMacroLibrary {
-    // 'static is actually the lifetime of library, so make sure this drops before _lib
-    proc_macros: &'static ProcMacros,
+    // this contains references to the library, so make sure this drops before _lib
+    proc_macros: ProcMacros,
     // Hold on to the library so it doesn't unload
     _lib: Library,
 }
 
 impl ProcMacroLibrary {
     fn open(path: &Utf8Path) -> Result<Self, LoadProcMacroDylibError> {
+        let proc_macro_kinds = rustc_span::create_default_session_globals_then(|| {
+            let (target, _) =
+                Target::search(&TargetTuple::from_tuple(host_tuple()), Path::new(""), false)
+                    .unwrap();
+            rustc_metadata::locator::get_proc_macro_info(
+                &target,
+                path.as_ref(),
+                &DefaultMetadataLoader,
+                rustc_version_str().unwrap_or("unknown"),
+            )
+        })?;
+
         let file = fs::File::open(path)?;
         #[allow(clippy::undocumented_unsafe_blocks)] // FIXME
         let file = unsafe { memmap2::Mmap::map(&file) }?;
         let obj = object::File::parse(&*file)
             .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
-        let version_info = version::read_dylib_info(&obj)?;
-        if version_info.version_string != crate::RUSTC_VERSION_STRING {
-            return Err(LoadProcMacroDylibError::AbiMismatch(version_info.version_string));
-        }
-
         let symbol_name =
             find_registrar_symbol(&obj).map_err(invalid_data_err)?.ok_or_else(|| {
                 invalid_data_err(format!("Cannot find registrar symbol in file {path}"))
@@ -127,9 +157,12 @@ fn open(path: &Utf8Path) -> Result<Self, LoadProcMacroDylibError> {
         // due to self-referentiality
         // But we make sure that we do not drop it before the symbol is dropped
         let proc_macros =
-            unsafe { lib.get::<&'static &'static ProcMacros>(symbol_name.as_bytes()) };
+            unsafe { lib.get::<&'static &'static ProcMacroClients>(symbol_name.as_bytes()) };
         match proc_macros {
-            Ok(proc_macros) => Ok(ProcMacroLibrary { proc_macros: *proc_macros, _lib: lib }),
+            Ok(proc_macros) => Ok(ProcMacroLibrary {
+                proc_macros: ProcMacros::new(*proc_macros, proc_macro_kinds),
+                _lib: lib,
+            }),
             Err(e) => Err(e.into()),
         }
     }
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/proc_macros.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/proc_macros.rs
index cf00be0..ef6752d 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/proc_macros.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/proc_macros.rs
@@ -1,9 +1,11 @@
 //! Proc macro ABI
-use crate::{ProcMacroClientHandle, ProcMacroKind, ProcMacroSrvSpan, token_stream::TokenStream};
+use crate::{
+    ProcMacroClientHandle, ProcMacroKind, ProcMacroSrvSpan, TrackedEnv, token_stream::TokenStream,
+};
 use rustc_proc_macro::bridge;
 
 #[repr(transparent)]
-pub(crate) struct ProcMacros([bridge::client::ProcMacro]);
+pub(crate) struct ProcMacroClients([bridge::client::Client]);
 
 impl From<bridge::PanicMessage> for crate::PanicMessage {
     fn from(p: bridge::PanicMessage) -> Self {
@@ -11,8 +13,17 @@ fn from(p: bridge::PanicMessage) -> Self {
     }
 }
 
+pub(crate) struct ProcMacros(Vec<(bridge::client::Client, rustc_metadata::ProcMacroKind)>);
+
 impl ProcMacros {
-    pub(crate) fn expand<S: ProcMacroSrvSpan>(
+    pub(super) fn new(
+        clients: &ProcMacroClients,
+        kinds: Vec<rustc_metadata::ProcMacroKind>,
+    ) -> Self {
+        ProcMacros(clients.0.iter().copied().zip(kinds).collect::<Vec<_>>())
+    }
+
+    pub(crate) fn expand<'a, S: ProcMacroSrvSpan>(
         &self,
         macro_name: &str,
         macro_body: TokenStream<S>,
@@ -20,36 +31,37 @@ pub(crate) fn expand<S: ProcMacroSrvSpan>(
         def_site: S,
         call_site: S,
         mixed_site: S,
-        callback: Option<ProcMacroClientHandle<'_>>,
+        tracked_env: &'a mut TrackedEnv,
+        callback: Option<ProcMacroClientHandle<'a>>,
     ) -> Result<TokenStream<S>, crate::PanicMessage> {
         let parsed_attributes = attribute.unwrap_or_default();
 
-        for proc_macro in &self.0 {
-            match proc_macro {
-                bridge::client::ProcMacro::CustomDerive { trait_name, client, .. }
-                    if *trait_name == macro_name =>
+        for (client, kind) in &self.0 {
+            match kind {
+                rustc_metadata::ProcMacroKind::CustomDerive { trait_name, .. }
+                    if trait_name.as_str() == macro_name =>
                 {
-                    let res = client.run(
+                    let res = client.run1(
                         &bridge::server::SAME_THREAD,
-                        S::make_server(call_site, def_site, mixed_site, callback),
+                        S::make_server(call_site, def_site, mixed_site, tracked_env, callback),
                         macro_body,
                         cfg!(debug_assertions),
                     );
                     return res.map_err(crate::PanicMessage::from);
                 }
-                bridge::client::ProcMacro::Bang { name, client } if *name == macro_name => {
-                    let res = client.run(
+                rustc_metadata::ProcMacroKind::Bang { name } if name.as_str() == macro_name => {
+                    let res = client.run1(
                         &bridge::server::SAME_THREAD,
-                        S::make_server(call_site, def_site, mixed_site, callback),
+                        S::make_server(call_site, def_site, mixed_site, tracked_env, callback),
                         macro_body,
                         cfg!(debug_assertions),
                     );
                     return res.map_err(crate::PanicMessage::from);
                 }
-                bridge::client::ProcMacro::Attr { name, client } if *name == macro_name => {
-                    let res = client.run(
+                rustc_metadata::ProcMacroKind::Attr { name } if name.as_str() == macro_name => {
+                    let res = client.run2(
                         &bridge::server::SAME_THREAD,
-                        S::make_server(call_site, def_site, mixed_site, callback),
+                        S::make_server(call_site, def_site, mixed_site, tracked_env, callback),
                         parsed_attributes,
                         macro_body,
                         cfg!(debug_assertions),
@@ -64,12 +76,16 @@ pub(crate) fn expand<S: ProcMacroSrvSpan>(
     }
 
     pub(crate) fn list_macros(&self) -> impl Iterator<Item = (&str, ProcMacroKind)> {
-        self.0.iter().map(|proc_macro| match *proc_macro {
-            bridge::client::ProcMacro::CustomDerive { trait_name, .. } => {
-                (trait_name, ProcMacroKind::CustomDerive)
+        self.0.iter().map(|(_client, kind)| match kind {
+            rustc_metadata::ProcMacroKind::CustomDerive { trait_name, .. } => {
+                (trait_name.as_str(), ProcMacroKind::CustomDerive)
             }
-            bridge::client::ProcMacro::Bang { name, .. } => (name, ProcMacroKind::Bang),
-            bridge::client::ProcMacro::Attr { name, .. } => (name, ProcMacroKind::Attr),
+            rustc_metadata::ProcMacroKind::Bang { name, .. } => {
+                (name.as_str(), ProcMacroKind::Bang)
+            }
+            rustc_metadata::ProcMacroKind::Attr { name, .. } => {
+                (name.as_str(), ProcMacroKind::Attr)
+            }
         })
     }
 }
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/version.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/version.rs
deleted file mode 100644
index 209693b..0000000
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib/version.rs
+++ /dev/null
@@ -1,168 +0,0 @@
-//! Reading proc-macro rustc version information from binary data
-
-use std::io::{self, Read};
-
-use object::read::{Object, ObjectSection};
-
-#[derive(Debug)]
-pub struct RustCInfo {
-    #[allow(dead_code)]
-    pub version: (usize, usize, usize),
-    #[allow(dead_code)]
-    pub channel: String,
-    #[allow(dead_code)]
-    pub commit: Option<String>,
-    #[allow(dead_code)]
-    pub date: Option<String>,
-    // something like "rustc 1.58.1 (db9d1b20b 2022-01-20)"
-    pub version_string: String,
-}
-
-/// Read rustc dylib information
-pub fn read_dylib_info(obj: &object::File<'_>) -> io::Result<RustCInfo> {
-    macro_rules! err {
-        ($e:literal) => {
-            io::Error::new(io::ErrorKind::InvalidData, $e)
-        };
-    }
-
-    let ver_str = read_version(obj)?;
-    let mut items = ver_str.split_whitespace();
-    let tag = items.next().ok_or_else(|| err!("version format error"))?;
-    if tag != "rustc" {
-        return Err(err!("no rustc tag"));
-    }
-
-    let version_part = items.next().ok_or_else(|| err!("no version string"))?;
-    let mut version_parts = version_part.split('-');
-    let version = version_parts.next().ok_or_else(|| err!("no version"))?;
-    let channel = version_parts.next().unwrap_or_default().to_owned();
-
-    let commit = match items.next() {
-        Some(commit) => {
-            match commit.len() {
-                0 => None,
-                _ => Some(commit[1..].to_string() /* remove ( */),
-            }
-        }
-        None => None,
-    };
-    let date = match items.next() {
-        Some(date) => {
-            match date.len() {
-                0 => None,
-                _ => Some(date[0..date.len() - 2].to_string() /* remove ) */),
-            }
-        }
-        None => None,
-    };
-
-    let version_numbers = version
-        .split('.')
-        .map(|it| it.parse::<usize>())
-        .collect::<Result<Vec<_>, _>>()
-        .map_err(|_| err!("version number error"))?;
-
-    if version_numbers.len() != 3 {
-        return Err(err!("version number format error"));
-    }
-    let version = (version_numbers[0], version_numbers[1], version_numbers[2]);
-
-    Ok(RustCInfo { version, channel, commit, date, version_string: ver_str })
-}
-
-/// This is used inside read_version() to locate the ".rustc" section
-/// from a proc macro crate's binary file.
-fn read_section<'a>(obj: &object::File<'a>, section_name: &str) -> io::Result<&'a [u8]> {
-    obj.section_by_name(section_name)
-        .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "section read error"))?
-        .data()
-        .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
-}
-
-/// Check the version of rustc that was used to compile a proc macro crate's
-/// binary file.
-///
-/// A proc macro crate binary's ".rustc" section has following byte layout:
-/// * [b'r',b'u',b's',b't',0,0,0,5] is the first 8 bytes
-/// * ff060000 734e6150 is followed, it's the snappy format magic bytes,
-///   means bytes from here (including this sequence) are compressed in
-///   snappy compression format. Version info is inside here, so decompress
-///   this.
-///
-/// The bytes you get after decompressing the snappy format portion has
-/// following layout:
-/// * [b'r',b'u',b's',b't',0,0,0,5] is the first 8 bytes(again)
-/// * [crate root bytes] next 8 bytes (4 in old versions) is to store
-///   crate root position, according to rustc's source code comment
-/// * [length byte] next 1 byte tells us how many bytes we should read next
-///   for the version string's utf8 bytes
-/// * [version string bytes encoded in utf8] <- GET THIS BOI
-/// * [some more bytes that we don't really care but about still there] :-)
-///
-/// Check this issue for more about the bytes layout:
-/// <https://github.com/rust-lang/rust-analyzer/issues/6174>
-pub fn read_version(obj: &object::File<'_>) -> io::Result<String> {
-    let dot_rustc = read_section(obj, ".rustc")?;
-
-    // check if magic is valid
-    if &dot_rustc[0..4] != b"rust" {
-        return Err(io::Error::new(
-            io::ErrorKind::InvalidData,
-            format!("unknown metadata magic, expected `rust`, found `{:?}`", &dot_rustc[0..4]),
-        ));
-    }
-    let version = u32::from_be_bytes([dot_rustc[4], dot_rustc[5], dot_rustc[6], dot_rustc[7]]);
-    // Last version with breaking changes is:
-    // https://github.com/rust-lang/rust/commit/b94cfefc860715fb2adf72a6955423d384c69318
-    let (mut metadata_portion, bytes_before_version) = match version {
-        8 => {
-            let len_bytes = &dot_rustc[8..12];
-            let data_len = u32::from_be_bytes(len_bytes.try_into().unwrap()) as usize;
-            (&dot_rustc[12..data_len + 12], 13)
-        }
-        9 | 10 => {
-            let len_bytes = &dot_rustc[8..16];
-            let data_len = u64::from_le_bytes(len_bytes.try_into().unwrap()) as usize;
-            (&dot_rustc[16..data_len + 12], 17)
-        }
-        _ => {
-            return Err(io::Error::new(
-                io::ErrorKind::InvalidData,
-                format!("unsupported metadata version {version}"),
-            ));
-        }
-    };
-
-    // We're going to skip over the bytes before the version string, so basically:
-    // 8 bytes for [b'r',b'u',b's',b't',0,0,0,5]
-    // 4 or 8 bytes for [crate root bytes]
-    // 1 byte for length of version string
-    // so 13 or 17 bytes in total, and we should check the last of those bytes
-    // to know the length
-    let mut bytes = [0u8; 17];
-    metadata_portion.read_exact(&mut bytes[..bytes_before_version])?;
-    let length = bytes[bytes_before_version - 1];
-
-    let mut version_string_utf8 = vec![0u8; length as usize];
-    metadata_portion.read_exact(&mut version_string_utf8)?;
-    let version_string = String::from_utf8(version_string_utf8);
-    version_string.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
-}
-
-#[test]
-fn test_version_check() {
-    let info = read_dylib_info(
-        &object::File::parse(&*std::fs::read(crate::proc_macro_test_dylib_path()).unwrap())
-            .unwrap(),
-    )
-    .unwrap();
-
-    assert_eq!(
-        info.version_string,
-        crate::RUSTC_VERSION_STRING,
-        "sysroot ABI mismatch: dylib rustc version (read from .rustc section): {:?} != proc-macro-srv version (read from 'rustc --version'): {:?}",
-        info.version_string,
-        crate::RUSTC_VERSION_STRING,
-    );
-}
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs
index 0bdc379..b8cd362 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/lib.rs
@@ -7,33 +7,22 @@
 //!
 //! * We use `tt` for proc-macro `TokenStream` server, it is easier to manipulate and interact with
 //!   RA than `proc-macro2` token stream.
-//! * By **copying** the whole rustc `lib_proc_macro` code, we are able to build this with `stable`
-//!   rustc rather than `unstable`. (Although in general ABI compatibility is still an issue)…
 
-#![cfg(feature = "sysroot-abi")]
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
-#![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)]
-#![allow(
-    unreachable_pub,
-    internal_features,
-    clippy::disallowed_types,
-    clippy::print_stderr,
-    unused_crate_dependencies,
-    unused_features
-)]
+#![cfg(feature = "in-rust-tree")]
+#![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span, rustc_private)]
+#![expect(unreachable_pub, internal_features, clippy::disallowed_types, clippy::print_stderr)]
+#![allow(unused_features, unused_crate_dependencies)]
 #![deny(deprecated_safe, clippy::undocumented_unsafe_blocks)]
 
-#[cfg(not(feature = "in-rust-tree"))]
-extern crate proc_macro as rustc_proc_macro;
-#[cfg(feature = "in-rust-tree")]
+extern crate rustc_codegen_ssa;
 extern crate rustc_driver as _;
-#[cfg(feature = "in-rust-tree")]
-extern crate rustc_proc_macro;
-
-#[cfg(not(feature = "in-rust-tree"))]
-extern crate ra_ap_rustc_lexer as rustc_lexer;
-#[cfg(feature = "in-rust-tree")]
+extern crate rustc_interface;
 extern crate rustc_lexer;
+extern crate rustc_metadata;
+extern crate rustc_proc_macro;
+extern crate rustc_session;
+extern crate rustc_span;
+extern crate rustc_target;
 
 mod bridge;
 mod dylib;
@@ -41,7 +30,7 @@
 mod token_stream;
 
 use std::{
-    collections::{HashMap, hash_map::Entry},
+    collections::{HashMap, HashSet, hash_map::Entry},
     env,
     ffi::OsString,
     fs,
@@ -52,7 +41,7 @@
 };
 
 use paths::{Utf8Path, Utf8PathBuf};
-use span::Span;
+use span::{FIXUP_ERASED_FILE_AST_ID_MARKER, Span};
 use temp_dir::TempDir;
 
 pub use crate::server_impl::token_id::SpanId;
@@ -123,6 +112,7 @@ pub trait ProcMacroClientInterface {
     fn byte_range(&mut self, span: Span) -> Range<usize>;
     fn span_source(&mut self, span: Span) -> Span;
     fn span_parent(&mut self, span: Span) -> Option<Span>;
+    fn span_join(&mut self, first: Span, second: Span) -> Option<Span>;
 }
 
 const EXPANDER_STACK_SIZE: usize = 8 * 1024 * 1024;
@@ -144,7 +134,7 @@ pub fn into_string(self) -> Option<String> {
 }
 
 impl ProcMacroSrv<'_> {
-    pub fn expand<S: ProcMacroSrvSpan>(
+    pub fn expand<'a, S: ProcMacroSrvSpan + 'a>(
         &self,
         lib: impl AsRef<Utf8Path>,
         env: &[(String, String)],
@@ -155,7 +145,8 @@ pub fn expand<S: ProcMacroSrvSpan>(
         def_site: S,
         call_site: S,
         mixed_site: S,
-        callback: Option<ProcMacroClientHandle<'_>>,
+        tracked_env: &'a mut TrackedEnv,
+        callback: Option<ProcMacroClientHandle<'a>>,
     ) -> Result<token_stream::TokenStream<S>, ExpandError> {
         let snapped_env = self.env;
         let expander = self.expander(lib.as_ref()).map_err(|err| ExpandError::Internal {
@@ -172,13 +163,18 @@ pub fn expand<S: ProcMacroSrvSpan>(
                 .name(macro_name.to_owned())
                 .spawn_scoped(s, move || {
                     expander.expand(
-                        macro_name, macro_body, attribute, def_site, call_site, mixed_site,
+                        macro_name,
+                        macro_body,
+                        attribute,
+                        def_site,
+                        call_site,
+                        mixed_site,
+                        tracked_env,
                         callback,
                     )
                 });
             match thread.unwrap().join() {
                 Ok(res) => res.map_err(ExpandError::Panic),
-
                 Err(payload) => {
                     if let Some(marker) = payload.downcast_ref::<ProcMacroPanicMarker>() {
                         return match marker {
@@ -235,6 +231,12 @@ fn expander(&self, path: &Utf8Path) -> Result<Arc<dylib::Expander>, String> {
     }
 }
 
+#[derive(Default)]
+pub struct TrackedEnv {
+    pub env_vars: HashMap<Box<str>, Option<Box<str>>>,
+    pub paths: HashSet<Box<str>>,
+}
+
 pub trait ProcMacroSrvSpan: Copy + Send + Sync {
     type Server<'a>: rustc_proc_macro::bridge::server::Server<
             TokenStream = crate::token_stream::TokenStream<Self>,
@@ -243,6 +245,7 @@ fn make_server<'a>(
         call_site: Self,
         def_site: Self,
         mixed_site: Self,
+        tracked_env: &'a mut TrackedEnv,
         callback: Option<ProcMacroClientHandle<'a>>,
     ) -> Self::Server<'a>;
 }
@@ -254,16 +257,10 @@ fn make_server<'a>(
         call_site: Self,
         def_site: Self,
         mixed_site: Self,
+        _: &'a mut TrackedEnv,
         callback: Option<ProcMacroClientHandle<'a>>,
     ) -> Self::Server<'a> {
-        Self::Server {
-            call_site,
-            def_site,
-            mixed_site,
-            callback,
-            tracked_env_vars: Default::default(),
-            tracked_paths: Default::default(),
-        }
+        Self::Server { call_site, def_site, mixed_site, callback }
     }
 }
 
@@ -273,6 +270,7 @@ fn make_server<'a>(
         call_site: Self,
         def_site: Self,
         mixed_site: Self,
+        tracked_env: &'a mut TrackedEnv,
         callback: Option<ProcMacroClientHandle<'a>>,
     ) -> Self::Server<'a> {
         Self::Server {
@@ -280,8 +278,8 @@ fn make_server<'a>(
             def_site,
             mixed_site,
             callback,
-            tracked_env_vars: Default::default(),
-            tracked_paths: Default::default(),
+            tracked_env,
+            fixup_id: FIXUP_ERASED_FILE_AST_ID_MARKER,
         }
     }
 }
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
index 6b6bfcc..bdac9c9 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/rust_analyzer_span.rs
@@ -4,30 +4,25 @@
 //! It is an unfortunate result of how the proc-macro API works that we need to look into the
 //! concrete representation of the spans, and as such, RustRover cannot make use of this unless they
 //! change their representation to be compatible with rust-analyzer's.
-use std::{
-    collections::{HashMap, HashSet},
-    ops::{Bound, Range},
-};
+use std::ops::{Bound, Range};
 
 use intern::Symbol;
 use rustc_proc_macro::bridge::server;
-use span::{FIXUP_ERASED_FILE_AST_ID_MARKER, Span, TextRange, TextSize};
+use span::{ErasedFileAstId, Span, TextRange, TextSize};
 
 use crate::{
-    ProcMacroClientHandle,
+    ProcMacroClientHandle, TrackedEnv,
     bridge::{Diagnostic, ExpnGlobals, Literal, TokenTree},
     server_impl::literal_from_str,
 };
 
 pub struct RaSpanServer<'a> {
-    // FIXME: Report this back to the caller to track as dependencies
-    pub tracked_env_vars: HashMap<Box<str>, Option<Box<str>>>,
-    // FIXME: Report this back to the caller to track as dependencies
-    pub tracked_paths: HashSet<Box<str>>,
+    pub tracked_env: &'a mut TrackedEnv,
     pub call_site: Span,
     pub def_site: Span,
     pub mixed_site: Span,
     pub callback: Option<ProcMacroClientHandle<'a>>,
+    pub fixup_id: ErasedFileAstId,
 }
 
 impl server::Server for RaSpanServer<'_> {
@@ -56,10 +51,10 @@ fn injected_env_var(&mut self, _: &str) -> Option<std::string::String> {
     }
 
     fn track_env_var(&mut self, var: &str, value: Option<&str>) {
-        self.tracked_env_vars.insert(var.into(), value.map(Into::into));
+        self.tracked_env.env_vars.insert(var.into(), value.map(Into::into));
     }
     fn track_path(&mut self, path: &str) {
-        self.tracked_paths.insert(path.into());
+        self.tracked_env.paths.insert(path.into());
     }
 
     fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, String> {
@@ -185,24 +180,18 @@ fn span_byte_range(&mut self, span: Self::Span) -> Range<usize> {
     fn span_join(&mut self, first: Self::Span, second: Self::Span) -> Option<Self::Span> {
         // We can't modify the span range for fixup spans, those are meaningful to fixup, so just
         // prefer the non-fixup span.
-        if first.anchor.ast_id == FIXUP_ERASED_FILE_AST_ID_MARKER {
+        if first.anchor.ast_id == self.fixup_id {
             return Some(second);
         }
-        if second.anchor.ast_id == FIXUP_ERASED_FILE_AST_ID_MARKER {
+        if second.anchor.ast_id == self.fixup_id {
             return Some(first);
         }
-        // FIXME: Once we can talk back to the client, implement a "long join" request for anchors
-        // that differ in [AstId]s as joining those spans requires resolving the AstIds.
         if first.anchor != second.anchor {
-            return None;
+            return self.callback.as_mut()?.span_join(first, second);
         }
-        // Differing context, we can't merge these so prefer the one that's root
+        // Differing context, we can't merge these
         if first.ctx != second.ctx {
-            if first.ctx.is_root() {
-                return Some(second);
-            } else if second.ctx.is_root() {
-                return Some(first);
-            }
+            return Some(first);
         }
         Some(Span {
             range: first.range.cover(second.range),
@@ -217,7 +206,7 @@ fn span_subspan(
         end: Bound<usize>,
     ) -> Option<Self::Span> {
         // We can't modify the span range for fixup spans, those are meaningful to fixup.
-        if span.anchor.ast_id == FIXUP_ERASED_FILE_AST_ID_MARKER {
+        if span.anchor.ast_id == self.fixup_id {
             return Some(span);
         }
         let length = span.range.len().into();
@@ -260,7 +249,7 @@ fn span_resolved_at(&mut self, span: Self::Span, at: Self::Span) -> Self::Span {
 
     fn span_end(&mut self, span: Self::Span) -> Self::Span {
         // We can't modify the span range for fixup spans, those are meaningful to fixup.
-        if span.anchor.ast_id == FIXUP_ERASED_FILE_AST_ID_MARKER {
+        if span.anchor.ast_id == self.fixup_id {
             return span;
         }
         Span { range: TextRange::empty(span.range.end()), ..span }
@@ -268,7 +257,7 @@ fn span_end(&mut self, span: Self::Span) -> Self::Span {
 
     fn span_start(&mut self, span: Self::Span) -> Self::Span {
         // We can't modify the span range for fixup spans, those are meaningful to fixup.
-        if span.anchor.ast_id == FIXUP_ERASED_FILE_AST_ID_MARKER {
+        if span.anchor.ast_id == self.fixup_id {
             return span;
         }
         Span { range: TextRange::empty(span.range.start()), ..span }
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/token_id.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/token_id.rs
index e1c9609..6c393b8 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/token_id.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl/token_id.rs
@@ -1,9 +1,6 @@
 //! proc-macro server backend based on [`proc_macro_api::msg::SpanId`] as the backing span.
 //! This backend is rather inflexible, used by RustRover and older rust-analyzer versions.
-use std::{
-    collections::{HashMap, HashSet},
-    ops::{Bound, Range},
-};
+use std::ops::{Bound, Range};
 
 use intern::Symbol;
 use rustc_proc_macro::bridge::server;
@@ -26,10 +23,6 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 type Span = SpanId;
 
 pub struct SpanIdServer<'a> {
-    // FIXME: Report this back to the caller to track as dependencies
-    pub tracked_env_vars: HashMap<Box<str>, Option<Box<str>>>,
-    // FIXME: Report this back to the caller to track as dependencies
-    pub tracked_paths: HashSet<Box<str>>,
     pub call_site: Span,
     pub def_site: Span,
     pub mixed_site: Span,
@@ -60,12 +53,9 @@ fn with_symbol_string(symbol: &Self::Symbol, f: impl FnOnce(&str)) {
     fn injected_env_var(&mut self, _: &str) -> Option<std::string::String> {
         None
     }
-    fn track_env_var(&mut self, var: &str, value: Option<&str>) {
-        self.tracked_env_vars.insert(var.into(), value.map(Into::into));
-    }
-    fn track_path(&mut self, path: &str) {
-        self.tracked_paths.insert(path.into());
-    }
+    fn track_env_var(&mut self, _: &str, _: Option<&str>) {}
+
+    fn track_path(&mut self, _: &str) {}
 
     fn literal_from_str(&mut self, s: &str) -> Result<Literal<Self::Span>, String> {
         literal_from_str(s, self.call_site)
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/mod.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/mod.rs
index ebef9a9..a8ddb21 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/mod.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/mod.rs
@@ -31,23 +31,23 @@ fn test_derive_empty() {
               IDENT 1 r#u32
         "#]],
         expect![[r#"
-            IDENT 42:Root[0000, 0]@0..6#ROOT2024 struct
-            IDENT 42:Root[0000, 0]@7..8#ROOT2024 S
-            GROUP {} 42:Root[0000, 0]@9..10#ROOT2024 42:Root[0000, 0]@46..47#ROOT2024 42:Root[0000, 0]@9..47#ROOT2024
-              IDENT 42:Root[0000, 0]@11..16#ROOT2024 field
-              PUNCT 42:Root[0000, 0]@16..17#ROOT2024 : [alone]
-              PUNCT 42:Root[0000, 0]@18..19#ROOT2024 & [joint]
-              PUNCT 42:Root[0000, 0]@22..23#ROOT2024 ' [joint]
-              IDENT 42:Root[0000, 0]@22..24#ROOT2024 r#lt
-              IDENT 42:Root[0000, 0]@25..27#ROOT2024 fn
-              GROUP () 42:Root[0000, 0]@27..28#ROOT2024 42:Root[0000, 0]@31..32#ROOT2024 42:Root[0000, 0]@27..32#ROOT2024
-                IDENT 42:Root[0000, 0]@28..31#ROOT2024 u32
-              PUNCT 42:Root[0000, 0]@33..34#ROOT2024 - [joint]
-              PUNCT 42:Root[0000, 0]@34..35#ROOT2024 > [alone]
-              PUNCT 42:Root[0000, 0]@36..37#ROOT2024 & [joint]
-              PUNCT 42:Root[0000, 0]@38..39#ROOT2024 ' [joint]
-              IDENT 42:Root[0000, 0]@38..39#ROOT2024 a
-              IDENT 42:Root[0000, 0]@42..45#ROOT2024 r#u32
+            IDENT 42:Root[0000, 0]@0..6#0 struct
+            IDENT 42:Root[0000, 0]@7..8#0 S
+            GROUP {} 42:Root[0000, 0]@9..10#0 42:Root[0000, 0]@46..47#0 42:Root[0000, 0]@9..47#0
+              IDENT 42:Root[0000, 0]@11..16#0 field
+              PUNCT 42:Root[0000, 0]@16..17#0 : [alone]
+              PUNCT 42:Root[0000, 0]@18..19#0 & [joint]
+              PUNCT 42:Root[0000, 0]@22..23#0 ' [joint]
+              IDENT 42:Root[0000, 0]@22..24#0 r#lt
+              IDENT 42:Root[0000, 0]@25..27#0 fn
+              GROUP () 42:Root[0000, 0]@27..28#0 42:Root[0000, 0]@31..32#0 42:Root[0000, 0]@27..32#0
+                IDENT 42:Root[0000, 0]@28..31#0 u32
+              PUNCT 42:Root[0000, 0]@33..34#0 - [joint]
+              PUNCT 42:Root[0000, 0]@34..35#0 > [alone]
+              PUNCT 42:Root[0000, 0]@36..37#0 & [joint]
+              PUNCT 42:Root[0000, 0]@38..39#0 ' [joint]
+              IDENT 42:Root[0000, 0]@38..39#0 a
+              IDENT 42:Root[0000, 0]@42..45#0 r#u32
         "#]],
     );
 }
@@ -137,76 +137,76 @@ pub struct Foo {
               PUNCT 1 , [alone]
         "#]],
         expect![[r#"
-            PUNCT 42:Root[0000, 0]@1..2#ROOT2024 # [joint]
-            GROUP [] 42:Root[0000, 0]@2..3#ROOT2024 42:Root[0000, 0]@52..53#ROOT2024 42:Root[0000, 0]@2..53#ROOT2024
-              IDENT 42:Root[0000, 0]@3..9#ROOT2024 helper
-              GROUP () 42:Root[0000, 0]@9..10#ROOT2024 42:Root[0000, 0]@51..52#ROOT2024 42:Root[0000, 0]@9..52#ROOT2024
-                IDENT 42:Root[0000, 0]@10..18#ROOT2024 build_fn
-                GROUP () 42:Root[0000, 0]@18..19#ROOT2024 42:Root[0000, 0]@50..51#ROOT2024 42:Root[0000, 0]@18..51#ROOT2024
-                  IDENT 42:Root[0000, 0]@19..26#ROOT2024 private
-                  PUNCT 42:Root[0000, 0]@26..27#ROOT2024 , [alone]
-                  IDENT 42:Root[0000, 0]@28..32#ROOT2024 name
-                  PUNCT 42:Root[0000, 0]@33..34#ROOT2024 = [alone]
-                  LITER 42:Root[0000, 0]@35..50#ROOT2024 Str partial_build
-            IDENT 42:Root[0000, 0]@54..57#ROOT2024 pub
-            IDENT 42:Root[0000, 0]@58..64#ROOT2024 struct
-            IDENT 42:Root[0000, 0]@65..68#ROOT2024 Foo
-            GROUP {} 42:Root[0000, 0]@69..70#ROOT2024 42:Root[0000, 0]@190..191#ROOT2024 42:Root[0000, 0]@69..191#ROOT2024
-              PUNCT 42:Root[0000, 0]@0..0#ROOT2024 # [alone]
-              GROUP [] 42:Root[0000, 0]@0..0#ROOT2024 42:Root[0000, 0]@0..0#ROOT2024 42:Root[0000, 0]@0..0#ROOT2024
-                IDENT 42:Root[0000, 0]@0..0#ROOT2024 doc
-                PUNCT 42:Root[0000, 0]@0..0#ROOT2024 = [alone]
-                LITER 42:Root[0000, 0]@75..130#ROOT2024 Str / The domain where this federated instance is running
-              PUNCT 42:Root[0000, 0]@135..136#ROOT2024 # [joint]
-              GROUP [] 42:Root[0000, 0]@136..137#ROOT2024 42:Root[0000, 0]@157..158#ROOT2024 42:Root[0000, 0]@136..158#ROOT2024
-                IDENT 42:Root[0000, 0]@137..143#ROOT2024 helper
-                GROUP () 42:Root[0000, 0]@143..144#ROOT2024 42:Root[0000, 0]@156..157#ROOT2024 42:Root[0000, 0]@143..157#ROOT2024
-                  IDENT 42:Root[0000, 0]@144..150#ROOT2024 setter
-                  GROUP () 42:Root[0000, 0]@150..151#ROOT2024 42:Root[0000, 0]@155..156#ROOT2024 42:Root[0000, 0]@150..156#ROOT2024
-                    IDENT 42:Root[0000, 0]@151..155#ROOT2024 into
-              IDENT 42:Root[0000, 0]@163..166#ROOT2024 pub
-              GROUP () 42:Root[0000, 0]@166..167#ROOT2024 42:Root[0000, 0]@172..173#ROOT2024 42:Root[0000, 0]@166..173#ROOT2024
-                IDENT 42:Root[0000, 0]@167..172#ROOT2024 crate
-              IDENT 42:Root[0000, 0]@174..180#ROOT2024 domain
-              PUNCT 42:Root[0000, 0]@180..181#ROOT2024 : [alone]
-              IDENT 42:Root[0000, 0]@182..188#ROOT2024 String
-              PUNCT 42:Root[0000, 0]@188..189#ROOT2024 , [alone]
+            PUNCT 42:Root[0000, 0]@1..2#0 # [joint]
+            GROUP [] 42:Root[0000, 0]@2..3#0 42:Root[0000, 0]@52..53#0 42:Root[0000, 0]@2..53#0
+              IDENT 42:Root[0000, 0]@3..9#0 helper
+              GROUP () 42:Root[0000, 0]@9..10#0 42:Root[0000, 0]@51..52#0 42:Root[0000, 0]@9..52#0
+                IDENT 42:Root[0000, 0]@10..18#0 build_fn
+                GROUP () 42:Root[0000, 0]@18..19#0 42:Root[0000, 0]@50..51#0 42:Root[0000, 0]@18..51#0
+                  IDENT 42:Root[0000, 0]@19..26#0 private
+                  PUNCT 42:Root[0000, 0]@26..27#0 , [alone]
+                  IDENT 42:Root[0000, 0]@28..32#0 name
+                  PUNCT 42:Root[0000, 0]@33..34#0 = [alone]
+                  LITER 42:Root[0000, 0]@35..50#0 Str partial_build
+            IDENT 42:Root[0000, 0]@54..57#0 pub
+            IDENT 42:Root[0000, 0]@58..64#0 struct
+            IDENT 42:Root[0000, 0]@65..68#0 Foo
+            GROUP {} 42:Root[0000, 0]@69..70#0 42:Root[0000, 0]@190..191#0 42:Root[0000, 0]@69..191#0
+              PUNCT 42:Root[0000, 0]@0..0#0 # [alone]
+              GROUP [] 42:Root[0000, 0]@0..0#0 42:Root[0000, 0]@0..0#0 42:Root[0000, 0]@0..0#0
+                IDENT 42:Root[0000, 0]@0..0#0 doc
+                PUNCT 42:Root[0000, 0]@0..0#0 = [alone]
+                LITER 42:Root[0000, 0]@75..130#0 Str / The domain where this federated instance is running
+              PUNCT 42:Root[0000, 0]@135..136#0 # [joint]
+              GROUP [] 42:Root[0000, 0]@136..137#0 42:Root[0000, 0]@157..158#0 42:Root[0000, 0]@136..158#0
+                IDENT 42:Root[0000, 0]@137..143#0 helper
+                GROUP () 42:Root[0000, 0]@143..144#0 42:Root[0000, 0]@156..157#0 42:Root[0000, 0]@143..157#0
+                  IDENT 42:Root[0000, 0]@144..150#0 setter
+                  GROUP () 42:Root[0000, 0]@150..151#0 42:Root[0000, 0]@155..156#0 42:Root[0000, 0]@150..156#0
+                    IDENT 42:Root[0000, 0]@151..155#0 into
+              IDENT 42:Root[0000, 0]@163..166#0 pub
+              GROUP () 42:Root[0000, 0]@166..167#0 42:Root[0000, 0]@172..173#0 42:Root[0000, 0]@166..173#0
+                IDENT 42:Root[0000, 0]@167..172#0 crate
+              IDENT 42:Root[0000, 0]@174..180#0 domain
+              PUNCT 42:Root[0000, 0]@180..181#0 : [alone]
+              IDENT 42:Root[0000, 0]@182..188#0 String
+              PUNCT 42:Root[0000, 0]@188..189#0 , [alone]
 
 
-            PUNCT 42:Root[0000, 0]@1..2#ROOT2024 # [joint]
-            GROUP [] 42:Root[0000, 0]@2..3#ROOT2024 42:Root[0000, 0]@52..53#ROOT2024 42:Root[0000, 0]@2..53#ROOT2024
-              IDENT 42:Root[0000, 0]@3..9#ROOT2024 helper
-              GROUP () 42:Root[0000, 0]@9..10#ROOT2024 42:Root[0000, 0]@51..52#ROOT2024 42:Root[0000, 0]@9..52#ROOT2024
-                IDENT 42:Root[0000, 0]@10..18#ROOT2024 build_fn
-                GROUP () 42:Root[0000, 0]@18..19#ROOT2024 42:Root[0000, 0]@50..51#ROOT2024 42:Root[0000, 0]@18..51#ROOT2024
-                  IDENT 42:Root[0000, 0]@19..26#ROOT2024 private
-                  PUNCT 42:Root[0000, 0]@26..27#ROOT2024 , [alone]
-                  IDENT 42:Root[0000, 0]@28..32#ROOT2024 name
-                  PUNCT 42:Root[0000, 0]@33..34#ROOT2024 = [alone]
-                  LITER 42:Root[0000, 0]@35..50#ROOT2024 Str partial_build
-            IDENT 42:Root[0000, 0]@54..57#ROOT2024 pub
-            IDENT 42:Root[0000, 0]@58..64#ROOT2024 struct
-            IDENT 42:Root[0000, 0]@65..68#ROOT2024 Foo
-            GROUP {} 42:Root[0000, 0]@69..70#ROOT2024 42:Root[0000, 0]@190..191#ROOT2024 42:Root[0000, 0]@69..191#ROOT2024
-              PUNCT 42:Root[0000, 0]@0..0#ROOT2024 # [alone]
-              GROUP [] 42:Root[0000, 0]@0..0#ROOT2024 42:Root[0000, 0]@0..0#ROOT2024 42:Root[0000, 0]@0..0#ROOT2024
-                IDENT 42:Root[0000, 0]@0..0#ROOT2024 doc
-                PUNCT 42:Root[0000, 0]@0..0#ROOT2024 = [alone]
-                LITER 42:Root[0000, 0]@75..130#ROOT2024 Str / The domain where this federated instance is running
-              PUNCT 42:Root[0000, 0]@135..136#ROOT2024 # [joint]
-              GROUP [] 42:Root[0000, 0]@136..137#ROOT2024 42:Root[0000, 0]@157..158#ROOT2024 42:Root[0000, 0]@136..158#ROOT2024
-                IDENT 42:Root[0000, 0]@137..143#ROOT2024 helper
-                GROUP () 42:Root[0000, 0]@143..144#ROOT2024 42:Root[0000, 0]@156..157#ROOT2024 42:Root[0000, 0]@143..157#ROOT2024
-                  IDENT 42:Root[0000, 0]@144..150#ROOT2024 setter
-                  GROUP () 42:Root[0000, 0]@150..151#ROOT2024 42:Root[0000, 0]@155..156#ROOT2024 42:Root[0000, 0]@150..156#ROOT2024
-                    IDENT 42:Root[0000, 0]@151..155#ROOT2024 into
-              IDENT 42:Root[0000, 0]@163..166#ROOT2024 pub
-              GROUP () 42:Root[0000, 0]@166..167#ROOT2024 42:Root[0000, 0]@172..173#ROOT2024 42:Root[0000, 0]@166..173#ROOT2024
-                IDENT 42:Root[0000, 0]@167..172#ROOT2024 crate
-              IDENT 42:Root[0000, 0]@174..180#ROOT2024 domain
-              PUNCT 42:Root[0000, 0]@180..181#ROOT2024 : [alone]
-              IDENT 42:Root[0000, 0]@182..188#ROOT2024 String
-              PUNCT 42:Root[0000, 0]@188..189#ROOT2024 , [alone]
+            PUNCT 42:Root[0000, 0]@1..2#0 # [joint]
+            GROUP [] 42:Root[0000, 0]@2..3#0 42:Root[0000, 0]@52..53#0 42:Root[0000, 0]@2..53#0
+              IDENT 42:Root[0000, 0]@3..9#0 helper
+              GROUP () 42:Root[0000, 0]@9..10#0 42:Root[0000, 0]@51..52#0 42:Root[0000, 0]@9..52#0
+                IDENT 42:Root[0000, 0]@10..18#0 build_fn
+                GROUP () 42:Root[0000, 0]@18..19#0 42:Root[0000, 0]@50..51#0 42:Root[0000, 0]@18..51#0
+                  IDENT 42:Root[0000, 0]@19..26#0 private
+                  PUNCT 42:Root[0000, 0]@26..27#0 , [alone]
+                  IDENT 42:Root[0000, 0]@28..32#0 name
+                  PUNCT 42:Root[0000, 0]@33..34#0 = [alone]
+                  LITER 42:Root[0000, 0]@35..50#0 Str partial_build
+            IDENT 42:Root[0000, 0]@54..57#0 pub
+            IDENT 42:Root[0000, 0]@58..64#0 struct
+            IDENT 42:Root[0000, 0]@65..68#0 Foo
+            GROUP {} 42:Root[0000, 0]@69..70#0 42:Root[0000, 0]@190..191#0 42:Root[0000, 0]@69..191#0
+              PUNCT 42:Root[0000, 0]@0..0#0 # [alone]
+              GROUP [] 42:Root[0000, 0]@0..0#0 42:Root[0000, 0]@0..0#0 42:Root[0000, 0]@0..0#0
+                IDENT 42:Root[0000, 0]@0..0#0 doc
+                PUNCT 42:Root[0000, 0]@0..0#0 = [alone]
+                LITER 42:Root[0000, 0]@75..130#0 Str / The domain where this federated instance is running
+              PUNCT 42:Root[0000, 0]@135..136#0 # [joint]
+              GROUP [] 42:Root[0000, 0]@136..137#0 42:Root[0000, 0]@157..158#0 42:Root[0000, 0]@136..158#0
+                IDENT 42:Root[0000, 0]@137..143#0 helper
+                GROUP () 42:Root[0000, 0]@143..144#0 42:Root[0000, 0]@156..157#0 42:Root[0000, 0]@143..157#0
+                  IDENT 42:Root[0000, 0]@144..150#0 setter
+                  GROUP () 42:Root[0000, 0]@150..151#0 42:Root[0000, 0]@155..156#0 42:Root[0000, 0]@150..156#0
+                    IDENT 42:Root[0000, 0]@151..155#0 into
+              IDENT 42:Root[0000, 0]@163..166#0 pub
+              GROUP () 42:Root[0000, 0]@166..167#0 42:Root[0000, 0]@172..173#0 42:Root[0000, 0]@166..173#0
+                IDENT 42:Root[0000, 0]@167..172#0 crate
+              IDENT 42:Root[0000, 0]@174..180#0 domain
+              PUNCT 42:Root[0000, 0]@180..181#0 : [alone]
+              IDENT 42:Root[0000, 0]@182..188#0 String
+              PUNCT 42:Root[0000, 0]@188..189#0 , [alone]
         "#]],
     );
 }
@@ -232,19 +232,19 @@ fn test_derive_error() {
             PUNCT 1 ; [alone]
         "#]],
         expect![[r#"
-            IDENT 42:Root[0000, 0]@0..6#ROOT2024 struct
-            IDENT 42:Root[0000, 0]@7..8#ROOT2024 S
-            GROUP {} 42:Root[0000, 0]@9..10#ROOT2024 42:Root[0000, 0]@22..23#ROOT2024 42:Root[0000, 0]@9..23#ROOT2024
-              IDENT 42:Root[0000, 0]@11..16#ROOT2024 field
-              PUNCT 42:Root[0000, 0]@16..17#ROOT2024 : [alone]
-              IDENT 42:Root[0000, 0]@18..21#ROOT2024 u32
+            IDENT 42:Root[0000, 0]@0..6#0 struct
+            IDENT 42:Root[0000, 0]@7..8#0 S
+            GROUP {} 42:Root[0000, 0]@9..10#0 42:Root[0000, 0]@22..23#0 42:Root[0000, 0]@9..23#0
+              IDENT 42:Root[0000, 0]@11..16#0 field
+              PUNCT 42:Root[0000, 0]@16..17#0 : [alone]
+              IDENT 42:Root[0000, 0]@18..21#0 u32
 
 
-            IDENT 42:Root[0000, 0]@0..13#ROOT2024 compile_error
-            PUNCT 42:Root[0000, 0]@13..14#ROOT2024 ! [joint]
-            GROUP () 42:Root[0000, 0]@14..15#ROOT2024 42:Root[0000, 0]@62..63#ROOT2024 42:Root[0000, 0]@14..63#ROOT2024
-              LITER 42:Root[0000, 0]@15..62#ROOT2024 Str #[derive(DeriveError)] struct S {field : u32}
-            PUNCT 42:Root[0000, 0]@63..64#ROOT2024 ; [alone]
+            IDENT 42:Root[0000, 0]@0..13#0 compile_error
+            PUNCT 42:Root[0000, 0]@13..14#0 ! [joint]
+            GROUP () 42:Root[0000, 0]@14..15#0 42:Root[0000, 0]@62..63#0 42:Root[0000, 0]@14..63#0
+              LITER 42:Root[0000, 0]@15..62#0 Str #[derive(DeriveError)] struct S {field : u32}
+            PUNCT 42:Root[0000, 0]@63..64#0 ; [alone]
         "#]],
     );
 }
@@ -273,22 +273,22 @@ fn test_fn_like_macro_noop() {
             GROUP [] 1 1 1
         "#]],
         expect![[r#"
-            IDENT 42:Root[0000, 0]@0..5#ROOT2024 ident
-            PUNCT 42:Root[0000, 0]@5..6#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@7..8#ROOT2024 Integer 0
-            PUNCT 42:Root[0000, 0]@8..9#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@10..11#ROOT2024 Integer 1
-            PUNCT 42:Root[0000, 0]@11..12#ROOT2024 , [alone]
-            GROUP [] 42:Root[0000, 0]@13..14#ROOT2024 42:Root[0000, 0]@14..15#ROOT2024 42:Root[0000, 0]@13..15#ROOT2024
+            IDENT 42:Root[0000, 0]@0..5#0 ident
+            PUNCT 42:Root[0000, 0]@5..6#0 , [alone]
+            LITER 42:Root[0000, 0]@7..8#0 Integer 0
+            PUNCT 42:Root[0000, 0]@8..9#0 , [alone]
+            LITER 42:Root[0000, 0]@10..11#0 Integer 1
+            PUNCT 42:Root[0000, 0]@11..12#0 , [alone]
+            GROUP [] 42:Root[0000, 0]@13..14#0 42:Root[0000, 0]@14..15#0 42:Root[0000, 0]@13..15#0
 
 
-            IDENT 42:Root[0000, 0]@0..5#ROOT2024 ident
-            PUNCT 42:Root[0000, 0]@5..6#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@7..8#ROOT2024 Integer 0
-            PUNCT 42:Root[0000, 0]@8..9#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@10..11#ROOT2024 Integer 1
-            PUNCT 42:Root[0000, 0]@11..12#ROOT2024 , [alone]
-            GROUP [] 42:Root[0000, 0]@13..14#ROOT2024 42:Root[0000, 0]@14..15#ROOT2024 42:Root[0000, 0]@13..15#ROOT2024
+            IDENT 42:Root[0000, 0]@0..5#0 ident
+            PUNCT 42:Root[0000, 0]@5..6#0 , [alone]
+            LITER 42:Root[0000, 0]@7..8#0 Integer 0
+            PUNCT 42:Root[0000, 0]@8..9#0 , [alone]
+            LITER 42:Root[0000, 0]@10..11#0 Integer 1
+            PUNCT 42:Root[0000, 0]@11..12#0 , [alone]
+            GROUP [] 42:Root[0000, 0]@13..14#0 42:Root[0000, 0]@14..15#0 42:Root[0000, 0]@13..15#0
         "#]],
     );
 }
@@ -315,20 +315,20 @@ fn test_fn_like_macro_clone_ident_subtree() {
               IDENT 1 ident3
         "#]],
         expect![[r#"
-            IDENT 42:Root[0000, 0]@0..5#ROOT2024 ident
-            PUNCT 42:Root[0000, 0]@5..6#ROOT2024 , [alone]
-            GROUP [] 42:Root[0000, 0]@7..8#ROOT2024 42:Root[0000, 0]@22..23#ROOT2024 42:Root[0000, 0]@7..23#ROOT2024
-              IDENT 42:Root[0000, 0]@8..14#ROOT2024 ident2
-              PUNCT 42:Root[0000, 0]@14..15#ROOT2024 , [alone]
-              IDENT 42:Root[0000, 0]@16..22#ROOT2024 ident3
+            IDENT 42:Root[0000, 0]@0..5#0 ident
+            PUNCT 42:Root[0000, 0]@5..6#0 , [alone]
+            GROUP [] 42:Root[0000, 0]@7..8#0 42:Root[0000, 0]@22..23#0 42:Root[0000, 0]@7..23#0
+              IDENT 42:Root[0000, 0]@8..14#0 ident2
+              PUNCT 42:Root[0000, 0]@14..15#0 , [alone]
+              IDENT 42:Root[0000, 0]@16..22#0 ident3
 
 
-            IDENT 42:Root[0000, 0]@0..5#ROOT2024 ident
-            PUNCT 42:Root[0000, 0]@5..6#ROOT2024 , [alone]
-            GROUP [] 42:Root[0000, 0]@7..23#ROOT2024 42:Root[0000, 0]@7..23#ROOT2024 42:Root[0000, 0]@7..23#ROOT2024
-              IDENT 42:Root[0000, 0]@8..14#ROOT2024 ident2
-              PUNCT 42:Root[0000, 0]@14..15#ROOT2024 , [alone]
-              IDENT 42:Root[0000, 0]@16..22#ROOT2024 ident3
+            IDENT 42:Root[0000, 0]@0..5#0 ident
+            PUNCT 42:Root[0000, 0]@5..6#0 , [alone]
+            GROUP [] 42:Root[0000, 0]@7..23#0 42:Root[0000, 0]@7..23#0 42:Root[0000, 0]@7..23#0
+              IDENT 42:Root[0000, 0]@8..14#0 ident2
+              PUNCT 42:Root[0000, 0]@14..15#0 , [alone]
+              IDENT 42:Root[0000, 0]@16..22#0 ident3
         "#]],
     );
 }
@@ -345,10 +345,10 @@ fn test_fn_like_macro_clone_raw_ident() {
             IDENT 1 r#async
         "#]],
         expect![[r#"
-            IDENT 42:Root[0000, 0]@2..7#ROOT2024 r#async
+            IDENT 42:Root[0000, 0]@2..7#0 r#async
 
 
-            IDENT 42:Root[0000, 0]@2..7#ROOT2024 r#async
+            IDENT 42:Root[0000, 0]@2..7#0 r#async
         "#]],
     );
 }
@@ -366,11 +366,11 @@ fn test_fn_like_fn_like_span_join() {
             IDENT 1 r#joined
         "#]],
         expect![[r#"
-            IDENT 42:Root[0000, 0]@0..3#ROOT2024 foo
-            IDENT 42:Root[0000, 0]@8..11#ROOT2024 bar
+            IDENT 42:Root[0000, 0]@0..3#0 foo
+            IDENT 42:Root[0000, 0]@8..11#0 bar
 
 
-            IDENT 42:Root[0000, 0]@0..11#ROOT2024 r#joined
+            IDENT 42:Root[0000, 0]@0..11#0 r#joined
         "#]],
     );
 }
@@ -391,14 +391,14 @@ fn test_fn_like_fn_like_span_ops() {
             IDENT 1 start_span
         "#]],
         expect![[r#"
-            IDENT 42:Root[0000, 0]@0..12#ROOT2024 set_def_site
-            IDENT 42:Root[0000, 0]@13..33#ROOT2024 resolved_at_def_site
-            IDENT 42:Root[0000, 0]@34..44#ROOT2024 start_span
+            IDENT 42:Root[0000, 0]@0..12#0 set_def_site
+            IDENT 42:Root[0000, 0]@13..33#0 resolved_at_def_site
+            IDENT 42:Root[0000, 0]@34..44#0 start_span
 
 
-            IDENT 41:Root[0000, 0]@0..150#ROOT2024 set_def_site
-            IDENT 42:Root[0000, 0]@13..33#ROOT2024 resolved_at_def_site
-            IDENT 42:Root[0000, 0]@34..34#ROOT2024 start_span
+            IDENT 41:Root[0000, 0]@0..150#0 set_def_site
+            IDENT 42:Root[0000, 0]@13..33#0 resolved_at_def_site
+            IDENT 42:Root[0000, 0]@34..34#0 start_span
         "#]],
     );
 }
@@ -428,19 +428,19 @@ fn test_fn_like_mk_literals() {
         expect![[r#"
 
 
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 ByteStr byte_string
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Char c
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Str string
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Str -string
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 CStr cstring
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Float 3.14f64
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Float -3.14f64
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Float 3.14
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Float -3.14
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Integer 123i64
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Integer -123i64
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Integer 123
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Integer -123
+            LITER 42:Root[0000, 0]@0..100#0 ByteStr byte_string
+            LITER 42:Root[0000, 0]@0..100#0 Char c
+            LITER 42:Root[0000, 0]@0..100#0 Str string
+            LITER 42:Root[0000, 0]@0..100#0 Str -string
+            LITER 42:Root[0000, 0]@0..100#0 CStr cstring
+            LITER 42:Root[0000, 0]@0..100#0 Float 3.14f64
+            LITER 42:Root[0000, 0]@0..100#0 Float -3.14f64
+            LITER 42:Root[0000, 0]@0..100#0 Float 3.14
+            LITER 42:Root[0000, 0]@0..100#0 Float -3.14
+            LITER 42:Root[0000, 0]@0..100#0 Integer 123i64
+            LITER 42:Root[0000, 0]@0..100#0 Integer -123i64
+            LITER 42:Root[0000, 0]@0..100#0 Integer 123
+            LITER 42:Root[0000, 0]@0..100#0 Integer -123
         "#]],
     );
 }
@@ -459,8 +459,8 @@ fn test_fn_like_mk_idents() {
         expect![[r#"
 
 
-            IDENT 42:Root[0000, 0]@0..100#ROOT2024 standard
-            IDENT 42:Root[0000, 0]@0..100#ROOT2024 r#raw
+            IDENT 42:Root[0000, 0]@0..100#0 standard
+            IDENT 42:Root[0000, 0]@0..100#0 r#raw
         "#]],
     );
 }
@@ -515,48 +515,48 @@ fn test_fn_like_macro_clone_literals() {
             LITER 1 CStr null
         "#]],
         expect![[r#"
-            LITER 42:Root[0000, 0]@0..4#ROOT2024 Integer 1u16
-            PUNCT 42:Root[0000, 0]@4..5#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@6..11#ROOT2024 Integer 2_u32
-            PUNCT 42:Root[0000, 0]@11..12#ROOT2024 , [alone]
-            PUNCT 42:Root[0000, 0]@13..14#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@14..18#ROOT2024 Integer 4i64
-            PUNCT 42:Root[0000, 0]@18..19#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@20..27#ROOT2024 Float 3.14f32
-            PUNCT 42:Root[0000, 0]@27..28#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@29..43#ROOT2024 Str hello bridge
-            PUNCT 42:Root[0000, 0]@43..44#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@45..61#ROOT2024 Str suffixedsuffix
-            PUNCT 42:Root[0000, 0]@61..62#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@63..73#ROOT2024 StrRaw(2) raw
-            PUNCT 42:Root[0000, 0]@73..74#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@75..78#ROOT2024 Char a
-            PUNCT 42:Root[0000, 0]@78..79#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@80..84#ROOT2024 Byte b
-            PUNCT 42:Root[0000, 0]@84..85#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@86..93#ROOT2024 CStr null
+            LITER 42:Root[0000, 0]@0..4#0 Integer 1u16
+            PUNCT 42:Root[0000, 0]@4..5#0 , [alone]
+            LITER 42:Root[0000, 0]@6..11#0 Integer 2_u32
+            PUNCT 42:Root[0000, 0]@11..12#0 , [alone]
+            PUNCT 42:Root[0000, 0]@13..14#0 - [alone]
+            LITER 42:Root[0000, 0]@14..18#0 Integer 4i64
+            PUNCT 42:Root[0000, 0]@18..19#0 , [alone]
+            LITER 42:Root[0000, 0]@20..27#0 Float 3.14f32
+            PUNCT 42:Root[0000, 0]@27..28#0 , [alone]
+            LITER 42:Root[0000, 0]@29..43#0 Str hello bridge
+            PUNCT 42:Root[0000, 0]@43..44#0 , [alone]
+            LITER 42:Root[0000, 0]@45..61#0 Str suffixedsuffix
+            PUNCT 42:Root[0000, 0]@61..62#0 , [alone]
+            LITER 42:Root[0000, 0]@63..73#0 StrRaw(2) raw
+            PUNCT 42:Root[0000, 0]@73..74#0 , [alone]
+            LITER 42:Root[0000, 0]@75..78#0 Char a
+            PUNCT 42:Root[0000, 0]@78..79#0 , [alone]
+            LITER 42:Root[0000, 0]@80..84#0 Byte b
+            PUNCT 42:Root[0000, 0]@84..85#0 , [alone]
+            LITER 42:Root[0000, 0]@86..93#0 CStr null
 
 
-            LITER 42:Root[0000, 0]@0..4#ROOT2024 Integer 1u16
-            PUNCT 42:Root[0000, 0]@4..5#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@6..11#ROOT2024 Integer 2_u32
-            PUNCT 42:Root[0000, 0]@11..12#ROOT2024 , [alone]
-            PUNCT 42:Root[0000, 0]@13..14#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@14..18#ROOT2024 Integer 4i64
-            PUNCT 42:Root[0000, 0]@18..19#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@20..27#ROOT2024 Float 3.14f32
-            PUNCT 42:Root[0000, 0]@27..28#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@29..43#ROOT2024 Str hello bridge
-            PUNCT 42:Root[0000, 0]@43..44#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@45..61#ROOT2024 Str suffixedsuffix
-            PUNCT 42:Root[0000, 0]@61..62#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@63..73#ROOT2024 StrRaw(2) raw
-            PUNCT 42:Root[0000, 0]@73..74#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@75..78#ROOT2024 Char a
-            PUNCT 42:Root[0000, 0]@78..79#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@80..84#ROOT2024 Byte b
-            PUNCT 42:Root[0000, 0]@84..85#ROOT2024 , [alone]
-            LITER 42:Root[0000, 0]@86..93#ROOT2024 CStr null
+            LITER 42:Root[0000, 0]@0..4#0 Integer 1u16
+            PUNCT 42:Root[0000, 0]@4..5#0 , [alone]
+            LITER 42:Root[0000, 0]@6..11#0 Integer 2_u32
+            PUNCT 42:Root[0000, 0]@11..12#0 , [alone]
+            PUNCT 42:Root[0000, 0]@13..14#0 - [alone]
+            LITER 42:Root[0000, 0]@14..18#0 Integer 4i64
+            PUNCT 42:Root[0000, 0]@18..19#0 , [alone]
+            LITER 42:Root[0000, 0]@20..27#0 Float 3.14f32
+            PUNCT 42:Root[0000, 0]@27..28#0 , [alone]
+            LITER 42:Root[0000, 0]@29..43#0 Str hello bridge
+            PUNCT 42:Root[0000, 0]@43..44#0 , [alone]
+            LITER 42:Root[0000, 0]@45..61#0 Str suffixedsuffix
+            PUNCT 42:Root[0000, 0]@61..62#0 , [alone]
+            LITER 42:Root[0000, 0]@63..73#0 StrRaw(2) raw
+            PUNCT 42:Root[0000, 0]@73..74#0 , [alone]
+            LITER 42:Root[0000, 0]@75..78#0 Char a
+            PUNCT 42:Root[0000, 0]@78..79#0 , [alone]
+            LITER 42:Root[0000, 0]@80..84#0 Byte b
+            PUNCT 42:Root[0000, 0]@84..85#0 , [alone]
+            LITER 42:Root[0000, 0]@86..93#0 CStr null
         "#]],
     );
 }
@@ -593,30 +593,30 @@ fn test_fn_like_macro_negative_literals() {
             LITER 1 Float 2.7
         "#]],
         expect![[r#"
-            PUNCT 42:Root[0000, 0]@0..1#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@1..5#ROOT2024 Integer 1u16
-            PUNCT 42:Root[0000, 0]@5..6#ROOT2024 , [alone]
-            PUNCT 42:Root[0000, 0]@7..8#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@9..14#ROOT2024 Integer 2_u32
-            PUNCT 42:Root[0000, 0]@14..15#ROOT2024 , [alone]
-            PUNCT 42:Root[0000, 0]@16..17#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@17..24#ROOT2024 Float 3.14f32
-            PUNCT 42:Root[0000, 0]@24..25#ROOT2024 , [alone]
-            PUNCT 42:Root[0000, 0]@26..27#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@28..31#ROOT2024 Float 2.7
+            PUNCT 42:Root[0000, 0]@0..1#0 - [alone]
+            LITER 42:Root[0000, 0]@1..5#0 Integer 1u16
+            PUNCT 42:Root[0000, 0]@5..6#0 , [alone]
+            PUNCT 42:Root[0000, 0]@7..8#0 - [alone]
+            LITER 42:Root[0000, 0]@9..14#0 Integer 2_u32
+            PUNCT 42:Root[0000, 0]@14..15#0 , [alone]
+            PUNCT 42:Root[0000, 0]@16..17#0 - [alone]
+            LITER 42:Root[0000, 0]@17..24#0 Float 3.14f32
+            PUNCT 42:Root[0000, 0]@24..25#0 , [alone]
+            PUNCT 42:Root[0000, 0]@26..27#0 - [alone]
+            LITER 42:Root[0000, 0]@28..31#0 Float 2.7
 
 
-            PUNCT 42:Root[0000, 0]@0..1#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@1..5#ROOT2024 Integer 1u16
-            PUNCT 42:Root[0000, 0]@5..6#ROOT2024 , [alone]
-            PUNCT 42:Root[0000, 0]@7..8#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@9..14#ROOT2024 Integer 2_u32
-            PUNCT 42:Root[0000, 0]@14..15#ROOT2024 , [alone]
-            PUNCT 42:Root[0000, 0]@16..17#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@17..24#ROOT2024 Float 3.14f32
-            PUNCT 42:Root[0000, 0]@24..25#ROOT2024 , [alone]
-            PUNCT 42:Root[0000, 0]@26..27#ROOT2024 - [alone]
-            LITER 42:Root[0000, 0]@28..31#ROOT2024 Float 2.7
+            PUNCT 42:Root[0000, 0]@0..1#0 - [alone]
+            LITER 42:Root[0000, 0]@1..5#0 Integer 1u16
+            PUNCT 42:Root[0000, 0]@5..6#0 , [alone]
+            PUNCT 42:Root[0000, 0]@7..8#0 - [alone]
+            LITER 42:Root[0000, 0]@9..14#0 Integer 2_u32
+            PUNCT 42:Root[0000, 0]@14..15#0 , [alone]
+            PUNCT 42:Root[0000, 0]@16..17#0 - [alone]
+            LITER 42:Root[0000, 0]@17..24#0 Float 3.14f32
+            PUNCT 42:Root[0000, 0]@24..25#0 , [alone]
+            PUNCT 42:Root[0000, 0]@26..27#0 - [alone]
+            LITER 42:Root[0000, 0]@28..31#0 Float 2.7
         "#]],
     );
 }
@@ -647,20 +647,20 @@ fn test_attr_macro() {
             PUNCT 1 ; [alone]
         "#]],
         expect![[r#"
-            IDENT 42:Root[0000, 0]@0..3#ROOT2024 mod
-            IDENT 42:Root[0000, 0]@4..5#ROOT2024 m
-            GROUP {} 42:Root[0000, 0]@6..7#ROOT2024 42:Root[0000, 0]@7..8#ROOT2024 42:Root[0000, 0]@6..8#ROOT2024
+            IDENT 42:Root[0000, 0]@0..3#0 mod
+            IDENT 42:Root[0000, 0]@4..5#0 m
+            GROUP {} 42:Root[0000, 0]@6..7#0 42:Root[0000, 0]@7..8#0 42:Root[0000, 0]@6..8#0
 
 
-            IDENT 42:Root[0000, 0]@0..4#ROOT2024 some
-            IDENT 42:Root[0000, 0]@5..14#ROOT2024 arguments
+            IDENT 42:Root[0000, 0]@0..4#0 some
+            IDENT 42:Root[0000, 0]@5..14#0 arguments
 
 
-            IDENT 42:Root[0000, 0]@0..13#ROOT2024 compile_error
-            PUNCT 42:Root[0000, 0]@13..14#ROOT2024 ! [joint]
-            GROUP () 42:Root[0000, 0]@14..15#ROOT2024 42:Root[0000, 0]@55..56#ROOT2024 42:Root[0000, 0]@14..56#ROOT2024
-              LITER 42:Root[0000, 0]@15..55#ROOT2024 Str #[attr_error(some arguments)] mod m {}
-            PUNCT 42:Root[0000, 0]@56..57#ROOT2024 ; [alone]
+            IDENT 42:Root[0000, 0]@0..13#0 compile_error
+            PUNCT 42:Root[0000, 0]@13..14#0 ! [joint]
+            GROUP () 42:Root[0000, 0]@14..15#0 42:Root[0000, 0]@55..56#0 42:Root[0000, 0]@14..56#0
+              LITER 42:Root[0000, 0]@15..55#0 Str #[attr_error(some arguments)] mod m {}
+            PUNCT 42:Root[0000, 0]@56..57#0 ; [alone]
         "#]],
     );
 }
@@ -722,8 +722,8 @@ fn test_fn_like_span_line_column() {
         "
 hello",
         expect![[r#"
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Integer 2
-            LITER 42:Root[0000, 0]@0..100#ROOT2024 Integer 1
+            LITER 42:Root[0000, 0]@0..100#0 Integer 2
+            LITER 42:Root[0000, 0]@0..100#0 Integer 1
         "#]],
     );
 }
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs b/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs
index 31beca2..9780bcf 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/src/tests/utils.rs
@@ -11,6 +11,11 @@
     token_stream::TokenStream,
 };
 
+fn make_ctx() -> SyntaxContext {
+    // SAFETY: Tests do not use a Database, so this won't ever be used within salsa.
+    unsafe { SyntaxContext::from_u32(0) }
+}
+
 fn parse_string(call_site: SpanId, src: &str) -> TokenStream<SpanId> {
     TokenStream::from_str(src, call_site).unwrap()
 }
@@ -62,7 +67,16 @@ fn assert_expand_impl(
     let attr_ts_string = attr_ts.as_ref().map(|it| format!("{it:?}"));
 
     let res = expander
-        .expand(macro_name, input_ts, attr_ts, def_site, call_site, mixed_site, None)
+        .expand(
+            macro_name,
+            input_ts,
+            attr_ts,
+            def_site,
+            call_site,
+            mixed_site,
+            &mut Default::default(),
+            None,
+        )
         .unwrap();
     expect.assert_eq(&format!(
         "{input_ts_string}{}{}{}",
@@ -77,7 +91,7 @@ fn assert_expand_impl(
             file_id: EditionedFileId::current_edition(FileId::from_raw(41)),
             ast_id: ROOT_ERASED_FILE_AST_ID,
         },
-        ctx: SyntaxContext::root(span::Edition::CURRENT),
+        ctx: make_ctx(),
     };
     let call_site = Span {
         range: TextRange::new(0.into(), 100.into()),
@@ -85,7 +99,7 @@ fn assert_expand_impl(
             file_id: EditionedFileId::current_edition(FileId::from_raw(42)),
             ast_id: ROOT_ERASED_FILE_AST_ID,
         },
-        ctx: SyntaxContext::root(span::Edition::CURRENT),
+        ctx: make_ctx(),
     };
     let mixed_site = call_site;
 
@@ -94,8 +108,18 @@ fn assert_expand_impl(
     let fixture_string = format!("{fixture:?}");
     let attr_string = attr.as_ref().map(|it| format!("{it:?}"));
 
-    let res =
-        expander.expand(macro_name, fixture, attr, def_site, call_site, mixed_site, None).unwrap();
+    let res = expander
+        .expand(
+            macro_name,
+            fixture,
+            attr,
+            def_site,
+            call_site,
+            mixed_site,
+            &mut Default::default(),
+            None,
+        )
+        .unwrap();
     expect_spanned.assert_eq(&format!(
         "{fixture_string}{}{}{}",
         if attr_string.is_some() { "\n\n" } else { "" },
@@ -150,6 +174,10 @@ fn span_source(&mut self, span: Span) -> Span {
     fn span_parent(&mut self, _span: Span) -> Option<Span> {
         None
     }
+
+    fn span_join(&mut self, _: Span, _: Span) -> Option<Span> {
+        None
+    }
 }
 
 pub fn assert_expand_with_callback(
@@ -166,7 +194,7 @@ pub fn assert_expand_with_callback(
             file_id: EditionedFileId::current_edition(FileId::from_raw(41)),
             ast_id: ROOT_ERASED_FILE_AST_ID,
         },
-        ctx: SyntaxContext::root(span::Edition::CURRENT),
+        ctx: make_ctx(),
     };
     let call_site = Span {
         range: TextRange::new(0.into(), 100.into()),
@@ -174,7 +202,7 @@ pub fn assert_expand_with_callback(
             file_id: EditionedFileId::current_edition(FileId::from_raw(42)),
             ast_id: ROOT_ERASED_FILE_AST_ID,
         },
-        ctx: SyntaxContext::root(span::Edition::CURRENT),
+        ctx: make_ctx(),
     };
     let mixed_site = call_site;
 
@@ -182,7 +210,16 @@ pub fn assert_expand_with_callback(
 
     let mut callback = MockCallback { text: ra_fixture };
     let res = expander
-        .expand(macro_name, fixture, None, def_site, call_site, mixed_site, Some(&mut callback))
+        .expand(
+            macro_name,
+            fixture,
+            None,
+            def_site,
+            call_site,
+            mixed_site,
+            &mut Default::default(),
+            Some(&mut callback),
+        )
         .unwrap();
     expect_spanned.assert_eq(&format!("{res:?}"));
 }
diff --git a/src/tools/rust-analyzer/crates/profile/Cargo.toml b/src/tools/rust-analyzer/crates/profile/Cargo.toml
index 048d3776..2cffb26 100644
--- a/src/tools/rust-analyzer/crates/profile/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/profile/Cargo.toml
@@ -13,7 +13,6 @@
 doctest = false
 
 [dependencies]
-cfg-if = "1.0.1"
 jemalloc-ctl = { version = "0.5.4", package = "tikv-jemalloc-ctl", optional = true }
 
 [target.'cfg(all(target_os = "linux", not(target_env = "ohos"), any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")))'.dependencies]
diff --git a/src/tools/rust-analyzer/crates/profile/src/memory_usage.rs b/src/tools/rust-analyzer/crates/profile/src/memory_usage.rs
index 1462259..a8a409b 100644
--- a/src/tools/rust-analyzer/crates/profile/src/memory_usage.rs
+++ b/src/tools/rust-analyzer/crates/profile/src/memory_usage.rs
@@ -3,8 +3,6 @@
 //! Measures the total size of all currently allocated objects.
 use std::fmt;
 
-use cfg_if::cfg_if;
-
 #[derive(Copy, Clone)]
 pub struct MemoryUsage {
     pub allocated: Bytes,
@@ -25,15 +23,17 @@ fn sub(self, rhs: MemoryUsage) -> MemoryUsage {
 
 impl MemoryUsage {
     pub fn now() -> MemoryUsage {
-        cfg_if! {
-            if #[cfg(all(feature = "jemalloc", not(target_env = "msvc")))] {
+        cfg_select! {
+            all(feature = "jemalloc", not(target_env = "msvc")) => {
                 jemalloc_ctl::epoch::advance().unwrap();
                 MemoryUsage {
                     allocated: Bytes(jemalloc_ctl::stats::allocated::read().unwrap() as isize),
                 }
-            } else if #[cfg(all(target_os = "linux", target_env = "gnu"))] {
+            }
+            all(target_os = "linux", target_env = "gnu") => {
                 memusage_linux()
-            } else if #[cfg(windows)] {
+            }
+            windows => {
                 // There doesn't seem to be an API for determining heap usage, so we try to
                 // approximate that by using the Commit Charge value.
 
@@ -48,7 +48,8 @@ pub fn now() -> MemoryUsage {
 
                 let usage = unsafe { mem_counters.assume_init().PagefileUsage };
                 MemoryUsage { allocated: Bytes(usage as isize) }
-            } else {
+            }
+           _ => {
                 MemoryUsage { allocated: Bytes(0) }
             }
         }
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 61e0b1e..1a036c3 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
@@ -14,14 +14,16 @@
     Adt, AssocItem, Crate, DefWithBody, FindPathConfig, GenericDef, HasCrate, HasSource,
     HirDisplay, ModuleDef, Name, Variant, crate_lang_items,
     db::{DefDatabase, ExpandDatabase, HirDatabase},
-    next_solver::{DbInterner, GenericArgs},
 };
 use hir_def::{
     DefWithBodyId, ExpressionStoreOwnerId, GenericDefId, SyntheticSyntax,
     expr_store::{Body, BodySourceMap, ExpressionStore},
     hir::{ExprId, PatId, generics::GenericParams},
 };
-use hir_ty::InferenceResult;
+use hir_ty::{
+    InferenceResult,
+    next_solver::{DbInterner, GenericArgs},
+};
 use ide::{
     Analysis, AnalysisHost, AnnotationConfig, DiagnosticsConfig, Edition, InlayFieldsToResolve,
     InlayHintsConfig, LineCol, RaFixtureConfig, RootDatabase,
@@ -415,7 +417,7 @@ fn run_data_layout(&self, db: &RootDatabase, adts: &[hir::Adt], verbosity: Verbo
                 hir_def::AdtId::from(a),
                 GenericArgs::empty(interner).store(),
                 hir_ty::ParamEnvAndCrate {
-                    param_env: db.trait_environment(GenericDefId::from(a).into()),
+                    param_env: db.trait_environment(a.into()),
                     krate: a.krate(db).into(),
                 }
                 .store(),
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/command.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/command.rs
index 49ce6db..ff2e21c 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/command.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/command.rs
@@ -13,7 +13,7 @@
 use anyhow::Context;
 use crossbeam_channel::Sender;
 use paths::Utf8PathBuf;
-use process_wrap::std::{StdChildWrapper, StdCommandWrap};
+use process_wrap::std::{ChildWrapper, CommandWrap};
 use stdx::process::streaming_output;
 
 /// This trait abstracts parsing one line of JSON output into a Rust
@@ -120,7 +120,7 @@ fn run(self, outfile: Option<Utf8PathBuf>) -> io::Result<(bool, String)> {
 /// 'Join On Drop' wrapper for a child process.
 ///
 /// This wrapper kills the process when the wrapper is dropped.
-struct JodGroupChild(Box<dyn StdChildWrapper>);
+struct JodGroupChild(Box<dyn ChildWrapper>);
 
 impl Drop for JodGroupChild {
     fn drop(&mut self) {
@@ -164,7 +164,7 @@ pub(crate) fn spawn(
         let arguments = command.get_args().map(|arg| arg.into()).collect::<Vec<OsString>>();
         let current_dir = command.get_current_dir().map(|arg| arg.to_path_buf());
 
-        let mut child = StdCommandWrap::from(command);
+        let mut child = CommandWrap::from(command);
         #[cfg(unix)]
         child.wrap(process_wrap::std::ProcessSession);
         #[cfg(windows)]
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
index f4c3f24..6f532e4 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
@@ -662,6 +662,9 @@ pub enum MaxSubstitutionLength {
         /// For traits the type "methods" can be used to only exclude the methods but not the trait
         /// itself.
         ///
+        /// For modules the type "subItems" can be used to only exclude the all items in it but not the module
+        /// itself. This does not include items defined in nested modules.
+        ///
         /// This setting also inherits `#rust-analyzer.completion.excludeTraits#`.
         completion_autoimport_exclude: Vec<AutoImportExclusion> = vec![
             AutoImportExclusion::Verbose { path: "core::borrow::Borrow".to_owned(), r#type: AutoImportExclusionType::Methods },
@@ -1938,6 +1941,9 @@ pub fn completion<'a>(
                             AutoImportExclusionType::Methods => {
                                 ide_completion::AutoImportExclusionType::Methods
                             }
+                            AutoImportExclusionType::SubItems => {
+                                ide_completion::AutoImportExclusionType::SubItems
+                            }
                         },
                     ),
                 })
@@ -2997,6 +3003,7 @@ pub enum AutoImportExclusion {
 pub enum AutoImportExclusionType {
     Always,
     Methods,
+    SubItems,
 }
 
 #[derive(Serialize, Deserialize, Debug, Clone)]
@@ -4128,10 +4135,11 @@ macro_rules! set {
                             },
                             "type": {
                                 "type": "string",
-                                "enum": ["always", "methods"],
+                                "enum": ["always", "methods", "subItems"],
                                 "enumDescriptions": [
                                     "Do not show this item or its methods (if it is a trait) in auto-import completions.",
-                                    "Do not show this traits methods in auto-import completions."
+                                    "Do not show this trait's methods in auto-import completions.",
+                                    "Do not show this module's all items in it in auto-import completions."
                                 ],
                             },
                         }
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs
index aad8bec..3c9a8c1 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs
@@ -63,7 +63,12 @@ pub(crate) enum Target {
 }
 
 impl CargoOptions {
-    pub(crate) fn apply_on_command(&self, cmd: &mut Command, ws_target_dir: Option<&Utf8Path>) {
+    pub(crate) fn apply_on_command(
+        &self,
+        cmd: &mut Command,
+        ws_target_dir: Option<&Utf8Path>,
+        package_repr: Option<&str>,
+    ) {
         for target in &self.target_tuples {
             cmd.args(["--target", target.as_str()]);
         }
@@ -83,8 +88,24 @@ pub(crate) fn apply_on_command(&self, cmd: &mut Command, ws_target_dir: Option<&
                 cmd.arg("--no-default-features");
             }
             if !self.features.is_empty() {
+                // If we are scoped to a particular package, filter any features of the form
+                // `crate/feature` which target other packages.
+                let features = if let Some(name) = package_repr {
+                    let filtered = self
+                        .features
+                        .iter()
+                        .filter(|f| match f.split_once('/') {
+                            Some((c, _)) => c == name,
+                            None => true,
+                        })
+                        .map(|s| s.as_str())
+                        .collect::<Vec<_>>();
+                    filtered.join(" ")
+                } else {
+                    self.features.join(" ")
+                };
                 cmd.arg("--features");
-                cmd.arg(self.features.join(" "));
+                cmd.arg(features);
             }
         }
         if let Some(target_dir) = self.target_dir_config.target_dir(ws_target_dir) {
@@ -890,12 +911,18 @@ fn check_command(
                 cmd.env("CARGO_LOG", "cargo::core::compiler::fingerprint=info");
                 cmd.arg(&cargo_options.subcommand);
 
-                match scope {
-                    FlycheckScope::Workspace => cmd.arg("--workspace"),
+                let package_repr = match scope {
+                    FlycheckScope::Workspace => {
+                        cmd.arg("--workspace");
+                        None
+                    }
                     FlycheckScope::Package {
                         package: PackageSpecifier::Cargo { package_id },
                         ..
-                    } => cmd.arg("-p").arg(&package_id.repr),
+                    } => {
+                        cmd.arg("-p").arg(&package_id.repr);
+                        Some(package_id.repr.as_str())
+                    }
                     FlycheckScope::Package {
                         package: PackageSpecifier::BuildInfo { .. }, ..
                     } => {
@@ -935,6 +962,7 @@ fn check_command(
                 cargo_options.apply_on_command(
                     &mut cmd,
                     self.ws_target_dir.as_ref().map(Utf8PathBuf::as_path),
+                    package_repr,
                 );
                 cmd.args(&cargo_options.extra_args);
                 Some((cmd, FlycheckCommandOrigin::Cargo))
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs
index ca6a2e7..cf85db3 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs
@@ -1662,7 +1662,10 @@ pub(crate) fn handle_code_lens(
                 .map(|spec| {
                     matches!(
                         spec.target_kind(),
-                        TargetKind::Bin | TargetKind::Example | TargetKind::Test
+                        TargetKind::Bin
+                            | TargetKind::Example
+                            | TargetKind::Test
+                            | TargetKind::Bench
                     )
                 })
                 .unwrap_or(false),
@@ -2345,7 +2348,7 @@ fn should_skip_target(runnable: &Runnable, cargo_spec: Option<&TargetSpec>) -> b
             match &cargo_spec {
                 Some(spec) => !matches!(
                     spec.target_kind(),
-                    TargetKind::Bin | TargetKind::Example | TargetKind::Test
+                    TargetKind::Bin | TargetKind::Example | TargetKind::Test | TargetKind::Bench
                 ),
                 None => true,
             }
@@ -2595,6 +2598,28 @@ pub(crate) fn internal_testing_fetch_config(
     }))
 }
 
+pub(crate) fn handle_evaluate_predicate(
+    snap: GlobalStateSnapshot,
+    params: lsp_ext::EvaluatePredicateParams,
+) -> anyhow::Result<lsp_ext::EvaluatePredicateResult> {
+    let _p = tracing::info_span!("handle_evaluate_predicate").entered();
+    let file_id = try_default!(from_proto::file_id(&snap, &params.text_document.uri)?);
+    let line_index = snap.file_line_index(file_id)?;
+    let offset = from_proto::offset(&line_index, params.position)?;
+
+    let result = snap.analysis.evaluate_predicate(params.text, FilePosition { file_id, offset })?;
+    let status = match result.status {
+        ide::PredicateEvaluationStatus::Holds => lsp_ext::PredicateEvaluationStatus::Holds,
+        ide::PredicateEvaluationStatus::NotProven => lsp_ext::PredicateEvaluationStatus::NotProven,
+        ide::PredicateEvaluationStatus::Invalid => lsp_ext::PredicateEvaluationStatus::Invalid,
+        ide::PredicateEvaluationStatus::Unsupported => {
+            lsp_ext::PredicateEvaluationStatus::Unsupported
+        }
+    };
+
+    Ok(lsp_ext::EvaluatePredicateResult { status, message: result.message })
+}
+
 pub(crate) fn get_failed_obligations(
     snap: GlobalStateSnapshot,
     params: GetFailedObligationsParams,
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs
index 754d6e6..4447158 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs
@@ -859,6 +859,39 @@ pub struct ClientCommandOptions {
     pub commands: Vec<String>,
 }
 
+pub enum EvaluatePredicate {}
+
+#[derive(Deserialize, Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+pub struct EvaluatePredicateParams {
+    pub text: String,
+    pub text_document: TextDocumentIdentifier,
+    pub position: Position,
+}
+
+#[derive(Deserialize, Serialize, Debug, Default)]
+#[serde(rename_all = "camelCase")]
+pub struct EvaluatePredicateResult {
+    pub status: PredicateEvaluationStatus,
+    pub message: String,
+}
+
+#[derive(Deserialize, Serialize, Debug, Default, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub enum PredicateEvaluationStatus {
+    Holds,
+    #[default]
+    NotProven,
+    Invalid,
+    Unsupported,
+}
+
+impl Request for EvaluatePredicate {
+    type Params = EvaluatePredicateParams;
+    type Result = EvaluatePredicateResult;
+    const METHOD: &'static str = "rust-analyzer/evaluatePredicate";
+}
+
 pub enum GetFailedObligations {}
 
 #[derive(Deserialize, Serialize, Debug)]
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs
index eff5477..3e8de07 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs
@@ -934,8 +934,8 @@ pub(crate) fn folding_range(
         | FoldKind::ExternCrates
         | FoldKind::MatchArm
         | FoldKind::Function
-        | FoldKind::Stmt(_)
-        | FoldKind::TailExpr(_) => None,
+        | FoldKind::Stmt
+        | FoldKind::TailExpr => None,
     };
 
     let range = range(line_index, text_range);
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 a9ce6f7..edf3da5 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
@@ -478,6 +478,7 @@ fn handle_event(&mut self, event: Event) {
             (false, false)
         };
 
+        let mut gc_elapsed = None;
         if self.is_quiescent() {
             let became_quiescent = !was_quiescent;
             if became_quiescent {
@@ -541,8 +542,10 @@ fn handle_event(&mut self, event: Event) {
                 && self.fmt_pool.handle.is_empty()
                 && current_revision != self.last_gc_revision
             {
+                let gc_start = Instant::now();
                 self.analysis_host.trigger_garbage_collection();
-                self.last_gc_revision = current_revision;
+                self.last_gc_revision = self.analysis_host.raw_database().nonce_and_revision().1;
+                gc_elapsed = Some(gc_start.elapsed());
             }
         }
 
@@ -588,10 +591,14 @@ fn handle_event(&mut self, event: Event) {
         let loop_duration = loop_start.elapsed();
         if loop_duration > Duration::from_millis(100) && was_quiescent {
             tracing::warn!(
-                "overly long loop turn took {loop_duration:?} (event handling took {event_handling_duration:?}): {event_dbg_msg}"
+                "overly long loop turn took {loop_duration:?}:\n\
+                (event handling took {event_handling_duration:?}): {event_dbg_msg}\n\
+                (garbage collection took {gc_elapsed:?})"
             );
             self.poke_rust_analyzer_developer(format!(
-                "overly long loop turn took {loop_duration:?} (event handling took {event_handling_duration:?}): {event_dbg_msg}"
+                "overly long loop turn took {loop_duration:?}:\n\
+                (event handling took {event_handling_duration:?}): {event_dbg_msg}\n\
+                (garbage collection took {gc_elapsed:?})"
             ));
         }
     }
@@ -1260,6 +1267,10 @@ fn on_request(&mut self, req: Request) {
         let mut dispatcher = RequestDispatcher { req: Some(req), global_state: self };
         dispatcher.on_sync_mut::<lsp_types::request::Shutdown>(|s, ()| {
             s.shutdown_requested = true;
+            s.proc_macro_clients =
+                std::iter::repeat_with(|| None).take(s.proc_macro_clients.len()).collect();
+            s.flycheck.iter().for_each(|handle| handle.cancel());
+            s.discover_handles.clear();
             Ok(())
         });
 
@@ -1368,6 +1379,7 @@ fn on_request(&mut self, req: Request) {
             .on::<NO_RETRY, lsp_ext::MoveItem>(handlers::handle_move_item)
             //
             .on::<NO_RETRY, lsp_ext::InternalTestingFetchConfig>(handlers::internal_testing_fetch_config)
+            .on::<RETRY, lsp_ext::EvaluatePredicate>(handlers::handle_evaluate_predicate)
             .on::<RETRY, lsp_ext::GetFailedObligations>(handlers::get_failed_obligations)
             .finish();
     }
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/mem_docs.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/mem_docs.rs
index 6a93a0e..05fc7a8 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/mem_docs.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/mem_docs.rs
@@ -3,6 +3,7 @@
 use std::mem;
 
 use rustc_hash::FxHashMap;
+use triomphe::Arc;
 use vfs::VfsPath;
 
 /// Holds the set of in-memory documents.
@@ -11,7 +12,7 @@
 /// might be different from what's on disk.
 #[derive(Default, Clone)]
 pub(crate) struct MemDocs {
-    mem_docs: FxHashMap<VfsPath, DocumentData>,
+    mem_docs: Arc<FxHashMap<VfsPath, Arc<DocumentData>>>,
     added_or_removed: bool,
 }
 
@@ -22,7 +23,7 @@ pub(crate) fn contains(&self, path: &VfsPath) -> bool {
 
     pub(crate) fn insert(&mut self, path: VfsPath, data: DocumentData) -> Result<(), ()> {
         self.added_or_removed = true;
-        match self.mem_docs.insert(path, data) {
+        match Arc::make_mut(&mut self.mem_docs).insert(path, Arc::new(data)) {
             Some(_) => Err(()),
             None => Ok(()),
         }
@@ -30,20 +31,20 @@ pub(crate) fn insert(&mut self, path: VfsPath, data: DocumentData) -> Result<(),
 
     pub(crate) fn remove(&mut self, path: &VfsPath) -> Result<(), ()> {
         self.added_or_removed = true;
-        match self.mem_docs.remove(path) {
+        match Arc::make_mut(&mut self.mem_docs).remove(path) {
             Some(_) => Ok(()),
             None => Err(()),
         }
     }
 
     pub(crate) fn get(&self, path: &VfsPath) -> Option<&DocumentData> {
-        self.mem_docs.get(path)
+        self.mem_docs.get(path).map(Arc::as_ref)
     }
 
     pub(crate) fn get_mut(&mut self, path: &VfsPath) -> Option<&mut DocumentData> {
         // NB: don't set `self.added_or_removed` here, as that purposefully only
         // tracks changes to the key set.
-        self.mem_docs.get_mut(path)
+        Arc::make_mut(&mut self.mem_docs).get_mut(path).map(Arc::make_mut)
     }
 
     pub(crate) fn iter(&self) -> impl Iterator<Item = &VfsPath> {
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/target_spec.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/target_spec.rs
index 5bdc9d8..81d9786 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/target_spec.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/target_spec.rs
@@ -99,7 +99,7 @@ pub(crate) fn runnable_args(&self, kind: &RunnableKind) -> Option<Runnable> {
                     arg.replace("{label}", &this.label)
                 }),
             RunnableKind::Test { test_id, .. } => {
-                self.find_replace_runnable(project_json::RunnableKind::Run, &|this, arg| {
+                self.find_replace_runnable(project_json::RunnableKind::TestOne, &|this, arg| {
                     arg.replace("{label}", &this.label).replace("{test_id}", &test_id.to_string())
                 })
             }
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/test_runner.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/test_runner.rs
index 0d9c831..31f35df 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/test_runner.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/test_runner.rs
@@ -124,7 +124,7 @@ pub(crate) fn new(
         cmd.arg("--no-fail-fast");
         cmd.arg("--manifest-path");
         cmd.arg(root.join("Cargo.toml"));
-        options.apply_on_command(&mut cmd, ws_target_dir);
+        options.apply_on_command(&mut cmd, ws_target_dir, Some(&test_target.package));
         cmd.arg("--");
         if let Some(path) = path {
             cmd.arg(path);
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/flycheck.rs b/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/flycheck.rs
index 386edb8..c6f1f81 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/flycheck.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/flycheck.rs
@@ -76,7 +76,6 @@ fn main() {
 }
 
 #[test]
-#[ignore = "this test tends to stuck, FIXME: investigate that"]
 fn test_flycheck_diagnostic_with_override_command() {
     if skip_slow_tests() {
         return;
@@ -113,7 +112,6 @@ fn main() {}
 }
 
 #[test]
-#[ignore = "this test tends to stuck, FIXME: investigate that"]
 fn test_flycheck_diagnostics_with_override_command_cleared_after_fix() {
     if skip_slow_tests() {
         return;
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs b/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs
index a863263..b91bde8 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs
@@ -1543,6 +1543,45 @@ pub fn bar() {}
 }
 
 #[test]
+fn test_evaluate_predicate() {
+    if skip_slow_tests() {
+        return;
+    }
+
+    let server = Project::with_fixture(
+        r#"
+//- /Cargo.toml
+[package]
+name = "foo"
+version = "0.0.0"
+
+//- /src/lib.rs
+trait Trait {}
+struct S;
+impl Trait for S {}
+
+fn test<T: Trait>() {
+    let _ = 0;$0
+}
+"#,
+    )
+    .server()
+    .wait_until_workspace_is_loaded();
+
+    let res = server.send_request::<rust_analyzer::lsp::ext::EvaluatePredicate>(
+        rust_analyzer::lsp::ext::EvaluatePredicateParams {
+            text: "T: Trait".to_owned(),
+            text_document: server.doc_id("src/lib.rs"),
+            position: Position::new(5, 14),
+        },
+    );
+
+    let res: rust_analyzer::lsp::ext::EvaluatePredicateResult =
+        serde_json::from_value(res).unwrap();
+    assert_eq!(res.status, rust_analyzer::lsp::ext::PredicateEvaluationStatus::Holds);
+}
+
+#[test]
 fn test_get_failed_obligations() {
     use expect_test::expect;
     if skip_slow_tests() {
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/support.rs b/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/support.rs
index 7390403..2c4b978 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/support.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/support.rs
@@ -378,8 +378,9 @@ fn send_request_(&self, r: Request) -> Value {
                         {
                             continue;
                         }
+                    } else if req.method != "workspace/diagnostic/refresh" {
+                        panic!("unexpected request: {req:?}")
                     }
-                    panic!("unexpected request: {req:?}")
                 }
                 Message::Notification(_) => (),
                 Message::Response(res) => {
diff --git a/src/tools/rust-analyzer/crates/span/src/hygiene.rs b/src/tools/rust-analyzer/crates/span/src/hygiene.rs
index f475de9..70b0447 100644
--- a/src/tools/rust-analyzer/crates/span/src/hygiene.rs
+++ b/src/tools/rust-analyzer/crates/span/src/hygiene.rs
@@ -19,7 +19,9 @@
 //! # The Call-site Hierarchy
 //!
 //! `ExpnData::call_site` in rustc, `MacroCallLoc::call_site` in rust-analyzer.
+#[cfg(feature = "salsa")]
 use crate::Edition;
+
 use std::fmt;
 
 /// A syntax context describes a hierarchy tracking order of macro definitions.
@@ -282,7 +284,7 @@ pub fn edition<Db>(self, db: &'db Db) -> Edition
                     let fields = SyntaxContext::ingredient(zalsa).data(zalsa, id);
                     fields.edition
                 }
-                None => Edition::from_u32(SyntaxContext::MAX_ID - self.into_u32()),
+                None => Edition::from_u32(SyntaxContext::MAX_ROOT_ID - self.into_u32()),
             }
         }
 
@@ -332,32 +334,9 @@ pub fn opaque_and_semiopaque<Db>(self, db: &'db Db) -> SyntaxContext
     }
 };
 
-impl SyntaxContext {
-    #[inline]
-    pub fn is_root(self) -> bool {
-        (SyntaxContext::MAX_ID - Edition::LATEST as u32) <= self.into_u32()
-            && self.into_u32() <= (SyntaxContext::MAX_ID - Edition::Edition2015 as u32)
-    }
-
-    #[inline]
-    pub fn remove_root_edition(&mut self) {
-        if self.is_root() {
-            *self = Self::root(Edition::Edition2015);
-        }
-    }
-
-    /// The root context, which is the parent of all other contexts. All `FileId`s have this context.
-    #[inline]
-    pub const fn root(edition: Edition) -> Self {
-        let edition = edition as u32;
-        // SAFETY: Roots are valid `SyntaxContext`s
-        unsafe { SyntaxContext::from_u32(SyntaxContext::MAX_ID - edition) }
-    }
-}
-
 #[cfg(feature = "salsa")]
 impl<'db> SyntaxContext {
-    const MAX_ID: u32 = salsa::Id::MAX_U32 - 1;
+    const MAX_ROOT_ID: u32 = salsa::Id::MAX_U32 + Edition::LATEST as u32;
 
     #[inline]
     pub const fn into_u32(self) -> u32 {
@@ -378,7 +357,8 @@ fn as_salsa_id(self) -> Option<salsa::Id> {
         if self.is_root() {
             None
         } else {
-            // SAFETY: By our invariant, this is either a root (which we verified it's not) or a valid `salsa::Id`.
+            // SAFETY: By our invariant, this is either a root (which we verified it's not) or a
+            // valid `salsa::Id` index.
             unsafe { Some(salsa::Id::from_index(self.0)) }
         }
     }
@@ -390,6 +370,27 @@ fn from_salsa_id(id: salsa::Id) -> Self {
     }
 
     #[inline]
+    pub fn is_root(self) -> bool {
+        (SyntaxContext::MAX_ROOT_ID - Edition::LATEST as u32) <= self.into_u32()
+            && self.into_u32() <= (SyntaxContext::MAX_ROOT_ID - Edition::Edition2015 as u32)
+    }
+
+    #[inline]
+    pub fn remove_root_edition(&mut self) {
+        if self.is_root() {
+            *self = Self::root(Edition::Edition2015);
+        }
+    }
+
+    /// The root context, which is the parent of all other contexts. All `FileId`s have this context.
+    #[inline]
+    pub const fn root(edition: Edition) -> Self {
+        let edition = edition as u32;
+        // SAFETY: Roots are valid `SyntaxContext`s
+        unsafe { SyntaxContext::from_u32(SyntaxContext::MAX_ROOT_ID - edition) }
+    }
+
+    #[inline]
     pub fn outer_mark(
         self,
         db: &'db dyn salsa::Database,
@@ -447,15 +448,8 @@ pub fn marks_rev(
 #[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
 pub struct SyntaxContext(u32);
 
-#[allow(dead_code)]
-const SALSA_MAX_ID_MIRROR: u32 = u32::MAX - 0xFF;
-#[cfg(feature = "salsa")]
-const _: () = assert!(salsa::Id::MAX_U32 == SALSA_MAX_ID_MIRROR);
-
 #[cfg(not(feature = "salsa"))]
 impl SyntaxContext {
-    const MAX_ID: u32 = SALSA_MAX_ID_MIRROR - 1;
-
     pub const fn into_u32(self) -> u32 {
         self.0
     }
@@ -496,16 +490,28 @@ pub fn is_opaque(&self) -> bool {
     }
 }
 
+#[cfg(feature = "salsa")]
 impl fmt::Display for SyntaxContext {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         if self.is_root() {
-            write!(f, "ROOT{}", Edition::from_u32(SyntaxContext::MAX_ID - self.into_u32()).number())
+            write!(
+                f,
+                "ROOT{}",
+                Edition::from_u32(SyntaxContext::MAX_ROOT_ID - self.into_u32()).number()
+            )
         } else {
             write!(f, "{}", self.into_u32())
         }
     }
 }
 
+#[cfg(not(feature = "salsa"))]
+impl fmt::Display for SyntaxContext {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "{}", self.into_u32())
+    }
+}
+
 impl std::fmt::Debug for SyntaxContext {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         if f.alternate() {
@@ -515,3 +521,69 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         }
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_root_edition_is_root() {
+        for edition in Edition::iter() {
+            let ctx = SyntaxContext::root(edition);
+            assert!(ctx.is_root(), "{edition} root should be identified as root");
+        }
+    }
+
+    #[test]
+    fn test_root_edition_editions() {
+        let db = salsa::DatabaseImpl::new();
+        for edition in Edition::iter() {
+            let ctx = SyntaxContext::root(edition);
+            assert_eq!(edition, ctx.edition(&db), "{edition} root should have edition {edition}");
+        }
+    }
+
+    #[test]
+    fn test_roots_do_not_overlap_with_salsa_ids() {
+        for edition in Edition::iter() {
+            let root = SyntaxContext::root(edition);
+            let root_u32 = root.into_u32();
+            assert!(
+                root_u32 >= salsa::Id::MAX_U32,
+                "Root context for {:?} (value {}) must be >= salsa::Id::MAX_U32 ({}) to avoid collision",
+                edition,
+                root_u32,
+                salsa::Id::MAX_U32
+            );
+        }
+    }
+
+    #[test]
+    fn test_non_root_value_is_not_root() {
+        for edition in Edition::iter() {
+            // SAFETY: This is just for testing purposes
+            let ctx = unsafe { SyntaxContext::from_u32(edition as u32 + 1) };
+            assert!(!ctx.is_root(), "{edition} root should be identified as root");
+        }
+    }
+
+    #[test]
+    fn test_interned_context_round_trips_through_u32() {
+        let db = salsa::DatabaseImpl::new();
+        let root = SyntaxContext::root(Edition::Edition2015);
+        let ctx = SyntaxContext::new(
+            &db,
+            None,
+            Transparency::Opaque,
+            Edition::Edition2021,
+            root,
+            |_| root,
+            |_| root,
+        );
+
+        // SAFETY: The value was produced by `SyntaxContext::into_u32` above.
+        let round_tripped = unsafe { SyntaxContext::from_u32(ctx.into_u32()) };
+        assert_eq!(round_tripped.edition(&db), Edition::Edition2021);
+        assert_eq!(round_tripped.parent(&db), root);
+    }
+}
diff --git a/src/tools/rust-analyzer/crates/span/src/lib.rs b/src/tools/rust-analyzer/crates/span/src/lib.rs
index bfe7b26..8274a94 100644
--- a/src/tools/rust-analyzer/crates/span/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/span/src/lib.rs
@@ -51,13 +51,20 @@ pub fn join(
         }
         // Differing context, we can't merge these so prefer the one that's root
         if self.ctx != other.ctx {
+            #[cfg(feature = "salsa")]
             if self.ctx.is_root() {
                 return Some(other);
             } else if other.ctx.is_root() {
                 return Some(self);
             }
+            None
+        } else {
+            Some(Span {
+                range: self.range.cover(other.range),
+                anchor: other.anchor,
+                ctx: other.ctx,
+            })
         }
-        Some(Span { range: self.range.cover(other.range), anchor: other.anchor, ctx: other.ctx })
     }
 
     pub fn eq_ignoring_ctx(self, other: Self) -> bool {
diff --git a/src/tools/rust-analyzer/crates/span/src/map.rs b/src/tools/rust-analyzer/crates/span/src/map.rs
index dc7d471..d8309b0 100644
--- a/src/tools/rust-analyzer/crates/span/src/map.rs
+++ b/src/tools/rust-analyzer/crates/span/src/map.rs
@@ -6,8 +6,8 @@
 use stdx::{always, itertools::Itertools};
 
 use crate::{
-    EditionedFileId, ErasedFileAstId, ROOT_ERASED_FILE_AST_ID, Span, SpanAnchor, SyntaxContext,
-    TextRange, TextSize,
+    EditionedFileId, ErasedFileAstId, ROOT_ERASED_FILE_AST_ID, Span, SyntaxContext, TextRange,
+    TextSize,
 };
 
 /// Maps absolute text ranges for the corresponding file to the relevant span data.
@@ -220,6 +220,7 @@ pub fn from_file(
         Self { file_id, pairs, end }
     }
 
+    #[cfg(feature = "salsa")]
     pub fn span_for_range(&self, range: TextRange) -> Span {
         assert!(
             range.end() <= self.end,
@@ -234,7 +235,7 @@ pub fn span_for_range(&self, range: TextRange) -> Span {
         let (offset, ast_id) = self.pairs[idx - 1];
         Span {
             range: range - offset,
-            anchor: SpanAnchor { file_id: self.file_id, ast_id },
+            anchor: crate::SpanAnchor { file_id: self.file_id, ast_id },
             ctx: SyntaxContext::root(self.file_id.edition()),
         }
     }
diff --git a/src/tools/rust-analyzer/crates/stdx/src/assert.rs b/src/tools/rust-analyzer/crates/stdx/src/assert.rs
index 91c2797..6032395 100644
--- a/src/tools/rust-analyzer/crates/stdx/src/assert.rs
+++ b/src/tools/rust-analyzer/crates/stdx/src/assert.rs
@@ -43,7 +43,7 @@
 
 /// Asserts that the condition is always true and returns its actual value.
 ///
-/// If the condition is true does nothing and and evaluates to true.
+/// If the condition is true does nothing and evaluates to true.
 ///
 /// If the condition is false:
 /// * panics if `force` feature or `debug_assertions` are enabled,
@@ -71,7 +71,7 @@ macro_rules! always {
 
 /// Asserts that the condition is never true and returns its actual value.
 ///
-/// If the condition is false does nothing and and evaluates to false.
+/// If the condition is false does nothing and evaluates to false.
 ///
 /// If the condition is true:
 /// * panics if `force` feature or `debug_assertions` are enabled,
diff --git a/src/tools/rust-analyzer/crates/syntax-bridge/Cargo.toml b/src/tools/rust-analyzer/crates/syntax-bridge/Cargo.toml
index c928f23..a539cea 100644
--- a/src/tools/rust-analyzer/crates/syntax-bridge/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/syntax-bridge/Cargo.toml
@@ -20,8 +20,7 @@
 parser.workspace = true
 tt.workspace = true
 stdx.workspace = true
-# span = {workspace = true, default-features = false} does not work
-span = { path = "../span", version = "0.0.0", default-features = false}
+span.workspace = true
 intern.workspace = true
 
 [dev-dependencies]
diff --git a/src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs b/src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs
index 648119e..001c920 100644
--- a/src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs
+++ b/src/tools/rust-analyzer/crates/syntax-bridge/src/prettify_macro_expansion.rs
@@ -3,6 +3,7 @@
     NodeOrToken,
     SyntaxKind::{self, *},
     SyntaxNode, SyntaxToken, T, WalkEvent,
+    ast::syntax_factory::SyntaxFactory,
     syntax_editor::{Position, SyntaxEditor},
 };
 
@@ -21,7 +22,7 @@ pub enum PrettifyWsKind {
 #[deprecated = "use `hir_expand::prettify_macro_expansion()` instead"]
 pub fn prettify_macro_expansion(
     syn: SyntaxNode,
-    dollar_crate_replacement: &mut dyn FnMut(&SyntaxToken) -> Option<SyntaxToken>,
+    dollar_crate_replacement: &mut dyn FnMut(&SyntaxToken, &SyntaxFactory) -> Option<SyntaxToken>,
     inspect_mods: impl FnOnce(&[(Position, PrettifyWsKind)]),
 ) -> SyntaxNode {
     let mut indent = 0;
@@ -66,7 +67,7 @@ pub fn prettify_macro_expansion(
         };
         if token.kind() == SyntaxKind::IDENT
             && token.text() == "$crate"
-            && let Some(replacement) = dollar_crate_replacement(&token)
+            && let Some(replacement) = dollar_crate_replacement(&token, editor.make())
         {
             dollar_crate_replacements.push((token.clone(), replacement));
         }
@@ -191,7 +192,7 @@ fn check_pretty(#[rust_analyzer::rust_fixture] ra_fixture: &str, expect: Expect)
         let source_file = syntax::ast::SourceFile::parse(&ra_fixture, span::Edition::CURRENT);
         let syn = remove_whitespaces(&source_file.syntax_node());
 
-        let pretty = prettify_macro_expansion(syn, &mut |_| None, |_| ());
+        let pretty = prettify_macro_expansion(syn, &mut |_, _| None, |_| ());
         let mut pretty = pretty.to_string();
         if pretty.contains('\n') {
             pretty.push('\n');
diff --git a/src/tools/rust-analyzer/crates/syntax/rust.ungram b/src/tools/rust-analyzer/crates/syntax/rust.ungram
index 6bcf8ba..e1c91c4 100644
--- a/src/tools/rust-analyzer/crates/syntax/rust.ungram
+++ b/src/tools/rust-analyzer/crates/syntax/rust.ungram
@@ -305,7 +305,7 @@
 
 Variant =
   Attr* Visibility?
-  Name FieldList? ('=' ConstArg)?
+  (Name | '_') FieldList? ('=' ConstArg)?
 
 Union =
   Attr* Visibility?
@@ -442,6 +442,12 @@
 | YeetExpr
 | LetExpr
 | UnderscoreExpr
+| IncludeBytesExpr
+
+// We need a special expression for this because we don't have access to the file,
+// and emitting a specific array will have problems with the length.
+IncludeBytesExpr =
+  'builtin' '#' 'include_bytes'
 
 OffsetOfExpr =
   Attr* 'builtin' '#' 'offset_of' '(' Type ',' fields:(NameRef ('.' NameRef)* ) ')'
@@ -665,6 +671,7 @@
 | NeverType
 | ParenType
 | PathType
+| PatternType
 | PtrType
 | RefType
 | SliceType
@@ -706,6 +713,9 @@
 ForType =
   ForBinder Type
 
+PatternType =
+  'builtin' '#' 'pattern_type' '(' Type 'is' Pat ')'
+
 ImplTraitType =
   'impl' TypeBoundList
 
@@ -749,6 +759,10 @@
 | TupleStructPat
 | ConstBlockPat
 | DerefPat
+| NotNull
+
+NotNull =
+    '!' 'null'
 
 DerefPat =
     'builtin' '#' 'deref' '(' Pat ')'
diff --git a/src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs b/src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs
index e3e5c49..ac1cddf 100644
--- a/src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs
+++ b/src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs
@@ -845,6 +845,19 @@ pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.sy
     #[inline]
     pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
 }
+pub struct IncludeBytesExpr {
+    pub(crate) syntax: SyntaxNode,
+}
+impl IncludeBytesExpr {
+    #[inline]
+    pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
+    #[inline]
+    pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) }
+    #[inline]
+    pub fn include_bytes_token(&self) -> Option<SyntaxToken> {
+        support::token(&self.syntax, T![include_bytes])
+    }
+}
 pub struct IndexExpr {
     pub(crate) syntax: SyntaxNode,
 }
@@ -1186,6 +1199,15 @@ impl NeverType {
     #[inline]
     pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
 }
+pub struct NotNull {
+    pub(crate) syntax: SyntaxNode,
+}
+impl NotNull {
+    #[inline]
+    pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
+    #[inline]
+    pub fn null_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![null]) }
+}
 pub struct OffsetOfExpr {
     pub(crate) syntax: SyntaxNode,
 }
@@ -1357,6 +1379,29 @@ impl PathType {
     #[inline]
     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
 }
+pub struct PatternType {
+    pub(crate) syntax: SyntaxNode,
+}
+impl PatternType {
+    #[inline]
+    pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
+    #[inline]
+    pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
+    #[inline]
+    pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
+    #[inline]
+    pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
+    #[inline]
+    pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
+    #[inline]
+    pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) }
+    #[inline]
+    pub fn is_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![is]) }
+    #[inline]
+    pub fn pattern_type_token(&self) -> Option<SyntaxToken> {
+        support::token(&self.syntax, T![pattern_type])
+    }
+}
 pub struct PrefixExpr {
     pub(crate) syntax: SyntaxNode,
 }
@@ -2027,6 +2072,8 @@ pub fn const_arg(&self) -> Option<ConstArg> { support::child(&self.syntax) }
     pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
     #[inline]
     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
+    #[inline]
+    pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
 }
 pub struct VariantList {
     pub(crate) syntax: SyntaxNode,
@@ -2180,6 +2227,7 @@ pub enum Expr {
     ForExpr(ForExpr),
     FormatArgsExpr(FormatArgsExpr),
     IfExpr(IfExpr),
+    IncludeBytesExpr(IncludeBytesExpr),
     IndexExpr(IndexExpr),
     LetExpr(LetExpr),
     Literal(Literal),
@@ -2275,6 +2323,7 @@ pub enum Pat {
     IdentPat(IdentPat),
     LiteralPat(LiteralPat),
     MacroPat(MacroPat),
+    NotNull(NotNull),
     OrPat(OrPat),
     ParenPat(ParenPat),
     PathPat(PathPat),
@@ -2307,6 +2356,7 @@ pub enum Type {
     NeverType(NeverType),
     ParenType(ParenType),
     PathType(PathType),
+    PatternType(PatternType),
     PtrType(PtrType),
     RefType(RefType),
     SliceType(SliceType),
@@ -4339,6 +4389,38 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("ImplTraitType").field("syntax", &self.syntax).finish()
     }
 }
+impl AstNode for IncludeBytesExpr {
+    #[inline]
+    fn kind() -> SyntaxKind
+    where
+        Self: Sized,
+    {
+        INCLUDE_BYTES_EXPR
+    }
+    #[inline]
+    fn can_cast(kind: SyntaxKind) -> bool { kind == INCLUDE_BYTES_EXPR }
+    #[inline]
+    fn cast(syntax: SyntaxNode) -> Option<Self> {
+        if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
+    }
+    #[inline]
+    fn syntax(&self) -> &SyntaxNode { &self.syntax }
+}
+impl hash::Hash for IncludeBytesExpr {
+    fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); }
+}
+impl Eq for IncludeBytesExpr {}
+impl PartialEq for IncludeBytesExpr {
+    fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax }
+}
+impl Clone for IncludeBytesExpr {
+    fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } }
+}
+impl fmt::Debug for IncludeBytesExpr {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_struct("IncludeBytesExpr").field("syntax", &self.syntax).finish()
+    }
+}
 impl AstNode for IndexExpr {
     #[inline]
     fn kind() -> SyntaxKind
@@ -5363,6 +5445,38 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("NeverType").field("syntax", &self.syntax).finish()
     }
 }
+impl AstNode for NotNull {
+    #[inline]
+    fn kind() -> SyntaxKind
+    where
+        Self: Sized,
+    {
+        NOT_NULL
+    }
+    #[inline]
+    fn can_cast(kind: SyntaxKind) -> bool { kind == NOT_NULL }
+    #[inline]
+    fn cast(syntax: SyntaxNode) -> Option<Self> {
+        if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
+    }
+    #[inline]
+    fn syntax(&self) -> &SyntaxNode { &self.syntax }
+}
+impl hash::Hash for NotNull {
+    fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); }
+}
+impl Eq for NotNull {}
+impl PartialEq for NotNull {
+    fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax }
+}
+impl Clone for NotNull {
+    fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } }
+}
+impl fmt::Debug for NotNull {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_struct("NotNull").field("syntax", &self.syntax).finish()
+    }
+}
 impl AstNode for OffsetOfExpr {
     #[inline]
     fn kind() -> SyntaxKind
@@ -5811,6 +5925,38 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("PathType").field("syntax", &self.syntax).finish()
     }
 }
+impl AstNode for PatternType {
+    #[inline]
+    fn kind() -> SyntaxKind
+    where
+        Self: Sized,
+    {
+        PATTERN_TYPE
+    }
+    #[inline]
+    fn can_cast(kind: SyntaxKind) -> bool { kind == PATTERN_TYPE }
+    #[inline]
+    fn cast(syntax: SyntaxNode) -> Option<Self> {
+        if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
+    }
+    #[inline]
+    fn syntax(&self) -> &SyntaxNode { &self.syntax }
+}
+impl hash::Hash for PatternType {
+    fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); }
+}
+impl Eq for PatternType {}
+impl PartialEq for PatternType {
+    fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax }
+}
+impl Clone for PatternType {
+    fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } }
+}
+impl fmt::Debug for PatternType {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_struct("PatternType").field("syntax", &self.syntax).finish()
+    }
+}
 impl AstNode for PrefixExpr {
     #[inline]
     fn kind() -> SyntaxKind
@@ -8003,6 +8149,10 @@ impl From<IfExpr> for Expr {
     #[inline]
     fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) }
 }
+impl From<IncludeBytesExpr> for Expr {
+    #[inline]
+    fn from(node: IncludeBytesExpr) -> Expr { Expr::IncludeBytesExpr(node) }
+}
 impl From<IndexExpr> for Expr {
     #[inline]
     fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) }
@@ -8107,6 +8257,7 @@ fn can_cast(kind: SyntaxKind) -> bool {
                 | FOR_EXPR
                 | FORMAT_ARGS_EXPR
                 | IF_EXPR
+                | INCLUDE_BYTES_EXPR
                 | INDEX_EXPR
                 | LET_EXPR
                 | LITERAL
@@ -8148,6 +8299,7 @@ fn cast(syntax: SyntaxNode) -> Option<Self> {
             FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
             FORMAT_ARGS_EXPR => Expr::FormatArgsExpr(FormatArgsExpr { syntax }),
             IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
+            INCLUDE_BYTES_EXPR => Expr::IncludeBytesExpr(IncludeBytesExpr { syntax }),
             INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
             LET_EXPR => Expr::LetExpr(LetExpr { syntax }),
             LITERAL => Expr::Literal(Literal { syntax }),
@@ -8191,6 +8343,7 @@ fn syntax(&self) -> &SyntaxNode {
             Expr::ForExpr(it) => &it.syntax,
             Expr::FormatArgsExpr(it) => &it.syntax,
             Expr::IfExpr(it) => &it.syntax,
+            Expr::IncludeBytesExpr(it) => &it.syntax,
             Expr::IndexExpr(it) => &it.syntax,
             Expr::LetExpr(it) => &it.syntax,
             Expr::Literal(it) => &it.syntax,
@@ -8581,6 +8734,10 @@ impl From<MacroPat> for Pat {
     #[inline]
     fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
 }
+impl From<NotNull> for Pat {
+    #[inline]
+    fn from(node: NotNull) -> Pat { Pat::NotNull(node) }
+}
 impl From<OrPat> for Pat {
     #[inline]
     fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
@@ -8636,6 +8793,7 @@ fn can_cast(kind: SyntaxKind) -> bool {
                 | IDENT_PAT
                 | LITERAL_PAT
                 | MACRO_PAT
+                | NOT_NULL
                 | OR_PAT
                 | PAREN_PAT
                 | PATH_PAT
@@ -8658,6 +8816,7 @@ fn cast(syntax: SyntaxNode) -> Option<Self> {
             IDENT_PAT => Pat::IdentPat(IdentPat { syntax }),
             LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
             MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
+            NOT_NULL => Pat::NotNull(NotNull { syntax }),
             OR_PAT => Pat::OrPat(OrPat { syntax }),
             PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
             PATH_PAT => Pat::PathPat(PathPat { syntax }),
@@ -8682,6 +8841,7 @@ fn syntax(&self) -> &SyntaxNode {
             Pat::IdentPat(it) => &it.syntax,
             Pat::LiteralPat(it) => &it.syntax,
             Pat::MacroPat(it) => &it.syntax,
+            Pat::NotNull(it) => &it.syntax,
             Pat::OrPat(it) => &it.syntax,
             Pat::ParenPat(it) => &it.syntax,
             Pat::PathPat(it) => &it.syntax,
@@ -8748,6 +8908,10 @@ impl From<PathType> for Type {
     #[inline]
     fn from(node: PathType) -> Type { Type::PathType(node) }
 }
+impl From<PatternType> for Type {
+    #[inline]
+    fn from(node: PatternType) -> Type { Type::PatternType(node) }
+}
 impl From<PtrType> for Type {
     #[inline]
     fn from(node: PtrType) -> Type { Type::PtrType(node) }
@@ -8779,6 +8943,7 @@ fn can_cast(kind: SyntaxKind) -> bool {
                 | NEVER_TYPE
                 | PAREN_TYPE
                 | PATH_TYPE
+                | PATTERN_TYPE
                 | PTR_TYPE
                 | REF_TYPE
                 | SLICE_TYPE
@@ -8798,6 +8963,7 @@ fn cast(syntax: SyntaxNode) -> Option<Self> {
             NEVER_TYPE => Type::NeverType(NeverType { syntax }),
             PAREN_TYPE => Type::ParenType(ParenType { syntax }),
             PATH_TYPE => Type::PathType(PathType { syntax }),
+            PATTERN_TYPE => Type::PatternType(PatternType { syntax }),
             PTR_TYPE => Type::PtrType(PtrType { syntax }),
             REF_TYPE => Type::RefType(RefType { syntax }),
             SLICE_TYPE => Type::SliceType(SliceType { syntax }),
@@ -8819,6 +8985,7 @@ fn syntax(&self) -> &SyntaxNode {
             Type::NeverType(it) => &it.syntax,
             Type::ParenType(it) => &it.syntax,
             Type::PathType(it) => &it.syntax,
+            Type::PatternType(it) => &it.syntax,
             Type::PtrType(it) => &it.syntax,
             Type::RefType(it) => &it.syntax,
             Type::SliceType(it) => &it.syntax,
@@ -10293,6 +10460,11 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         std::fmt::Display::fmt(self.syntax(), f)
     }
 }
+impl std::fmt::Display for IncludeBytesExpr {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        std::fmt::Display::fmt(self.syntax(), f)
+    }
+}
 impl std::fmt::Display for IndexExpr {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         std::fmt::Display::fmt(self.syntax(), f)
@@ -10453,6 +10625,11 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         std::fmt::Display::fmt(self.syntax(), f)
     }
 }
+impl std::fmt::Display for NotNull {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        std::fmt::Display::fmt(self.syntax(), f)
+    }
+}
 impl std::fmt::Display for OffsetOfExpr {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         std::fmt::Display::fmt(self.syntax(), f)
@@ -10523,6 +10700,11 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         std::fmt::Display::fmt(self.syntax(), f)
     }
 }
+impl std::fmt::Display for PatternType {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        std::fmt::Display::fmt(self.syntax(), f)
+    }
+}
 impl std::fmt::Display for PrefixExpr {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         std::fmt::Display::fmt(self.syntax(), f)
diff --git a/src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs b/src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs
index d99cf49..8411275 100644
--- a/src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs
+++ b/src/tools/rust-analyzer/crates/syntax/src/ast/prec.rs
@@ -134,7 +134,8 @@ pub fn precedence(expr: &ast::Expr) -> ExprPrecedence {
         | Expr::RecordExpr(_)
         | Expr::TupleExpr(_)
         | Expr::UnderscoreExpr(_)
-        | Expr::WhileExpr(_) => ExprPrecedence::Unambiguous,
+        | Expr::WhileExpr(_)
+        | Expr::IncludeBytesExpr(_) => ExprPrecedence::Unambiguous,
     }
 }
 
@@ -375,7 +376,7 @@ fn binding_power(&self) -> (u8, u8) {
 
             ArrayExpr(_) | TupleExpr(_) | Literal(_) | PathExpr(_) | ParenExpr(_) | IfExpr(_)
             | WhileExpr(_) | ForExpr(_) | LoopExpr(_) | MatchExpr(_) | BlockExpr(_)
-            | RecordExpr(_) | UnderscoreExpr(_) => (0, 0),
+            | RecordExpr(_) | UnderscoreExpr(_) | IncludeBytesExpr(_) => (0, 0),
         }
     }
 
@@ -519,7 +520,8 @@ fn order(this: &Expr) -> TextSize {
                 AsmExpr(e) => e.builtin_token(),
                 ArrayExpr(_) | TupleExpr(_) | Literal(_) | PathExpr(_) | ParenExpr(_)
                 | IfExpr(_) | WhileExpr(_) | ForExpr(_) | LoopExpr(_) | MatchExpr(_)
-                | BlockExpr(_) | RecordExpr(_) | UnderscoreExpr(_) | MacroExpr(_) => None,
+                | BlockExpr(_) | RecordExpr(_) | UnderscoreExpr(_) | MacroExpr(_)
+                | IncludeBytesExpr(_) => None,
             };
 
             token.map(|t| t.text_range()).unwrap_or_else(|| this.syntax().text_range()).start()
@@ -546,7 +548,7 @@ fn child_is_followed_by_a_block(&self) -> bool {
                 .map(|e| e.child_is_followed_by_a_block())
                 .unwrap_or(false),
 
-            ForExpr(_) | IfExpr(_) | MatchExpr(_) | WhileExpr(_) => true,
+            ForExpr(_) | IfExpr(_) | MatchExpr(_) | WhileExpr(_) | IncludeBytesExpr(_) => true,
         }
     }
 }
diff --git a/src/tools/rust-analyzer/crates/syntax/src/ast/syntax_factory/constructors.rs b/src/tools/rust-analyzer/crates/syntax/src/ast/syntax_factory/constructors.rs
index 1070af6..2f7eab2 100644
--- a/src/tools/rust-analyzer/crates/syntax/src/ast/syntax_factory/constructors.rs
+++ b/src/tools/rust-analyzer/crates/syntax/src/ast/syntax_factory/constructors.rs
@@ -479,6 +479,18 @@ pub fn const_param(&self, name: ast::Name, ty: ast::Type) -> ast::ConstParam {
         ast
     }
 
+    pub fn lifetime_param(&self, lifetime: ast::Lifetime) -> ast::LifetimeParam {
+        let ast = make::lifetime_param(lifetime.clone()).clone_for_update();
+
+        if let Some(mut mapping) = self.mappings() {
+            let mut builder = SyntaxMappingBuilder::new(ast.syntax().clone());
+            builder.map_node(lifetime.syntax().clone(), ast.lifetime().unwrap().syntax().clone());
+            builder.finish(&mut mapping);
+        }
+
+        ast
+    }
+
     pub fn generic_param_list(
         &self,
         params: impl IntoIterator<Item = ast::GenericParam>,
diff --git a/src/tools/rust-analyzer/crates/syntax/src/ast/token_ext.rs b/src/tools/rust-analyzer/crates/syntax/src/ast/token_ext.rs
index 29b3b09..b5c4e1a 100644
--- a/src/tools/rust-analyzer/crates/syntax/src/ast/token_ext.rs
+++ b/src/tools/rust-analyzer/crates/syntax/src/ast/token_ext.rs
@@ -315,8 +315,8 @@ pub fn value(&self) -> Result<Cow<'_, [u8]>, EscapeError> {
         let mut prev_end = 0;
         let mut has_error = None;
         let extend_unit = |buf: &mut Vec<u8>, unit: MixedUnit| match unit {
-            MixedUnit::Char(c) => buf.extend(c.encode_utf8(&mut [0; 4]).as_bytes()),
-            MixedUnit::HighByte(b) => buf.push(b),
+            MixedUnit::Char(c) => buf.extend(c.get().encode_utf8(&mut [0; 4]).as_bytes()),
+            MixedUnit::HighByte(b) => buf.push(b.get()),
         };
         unescape_c_str(text, |char_range, unescaped| match (unescaped, buf.capacity() == 0) {
             (Ok(u), false) => extend_unit(&mut buf, u),
diff --git a/src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edits.rs b/src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edits.rs
index 0338d97..f2b979e 100644
--- a/src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edits.rs
+++ b/src/tools/rust-analyzer/crates/syntax/src/syntax_editor/edits.rs
@@ -3,7 +3,7 @@
 use crate::{
     AstToken, Direction, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, T,
     algo::neighbor,
-    ast::{self, AstNode, HasGenericParams, HasName, edit::IndentLevel, make},
+    ast::{self, AstNode, HasGenericParams, HasName, edit::IndentLevel},
     syntax_editor::{Position, SyntaxEditor},
 };
 
@@ -207,6 +207,7 @@ impl ast::AssocItemList {
     /// Attention! This function does align the first line of `item` with respect to `self`,
     /// but it does _not_ change indentation of other lines (if any).
     pub fn add_items(&self, editor: &SyntaxEditor, items: Vec<ast::AssocItem>) {
+        let make = editor.make();
         let (indent, position, whitespace) = match self.assoc_items().last() {
             Some(last_item) => (
                 IndentLevel::from_node(last_item.syntax()),
@@ -228,7 +229,7 @@ pub fn add_items(&self, editor: &SyntaxEditor, items: Vec<ast::AssocItem>) {
             .flat_map(|(i, item)| {
                 let whitespace = if i != 0 { "\n\n" } else { whitespace };
                 vec![
-                    make::tokens::whitespace(&format!("{whitespace}{indent}")).into(),
+                    make.whitespace(&format!("{whitespace}{indent}")).into(),
                     item.syntax().clone().into(),
                 ]
             })
@@ -390,10 +391,11 @@ pub fn add_variant(&self, editor: &SyntaxEditor, variant: &ast::Variant) {
 
 impl ast::Fn {
     pub fn replace_or_insert_body(&self, editor: &SyntaxEditor, body: ast::BlockExpr) {
+        let make = editor.make();
         if let Some(old_body) = self.body() {
             editor.replace(old_body.syntax(), body.syntax());
         } else {
-            let single_space = make::tokens::single_space();
+            let single_space = make.whitespace(" ");
             let elements = vec![single_space.into(), body.syntax().clone().into()];
 
             if let Some(semicolon) = self.semicolon_token() {
diff --git a/src/tools/rust-analyzer/crates/test-utils/src/fixture.rs b/src/tools/rust-analyzer/crates/test-utils/src/fixture.rs
index 1f6262c..64a0d23 100644
--- a/src/tools/rust-analyzer/crates/test-utils/src/fixture.rs
+++ b/src/tools/rust-analyzer/crates/test-utils/src/fixture.rs
@@ -399,6 +399,7 @@ pub fn available_flags(raw_source: &str) -> impl Iterator<Item = &str> {
     ///
     /// This is probably over-engineered to support flags dependencies.
     pub fn source_code(mut self, raw_source: &str) -> String {
+        let raw_source = raw_source.replace("\r\n", "\n").replace('\r', "\n");
         let mut buf = String::new();
         let mut lines = raw_source.split_inclusive('\n');
 
@@ -507,7 +508,7 @@ pub fn source_code(mut self, raw_source: &str) -> String {
                 active_regions.drain(active_regions.len() - active_line_region..);
             }
             if inactive_line_region > 0 {
-                inactive_regions.drain(inactive_regions.len() - active_line_region..);
+                inactive_regions.drain(inactive_regions.len() - inactive_line_region..);
             }
         }
 
@@ -580,3 +581,12 @@ fn parse_fixture_gets_full_meta() {
     assert_eq!("/lib.rs", meta.path);
     assert_eq!(2, meta.env.len());
 }
+
+#[test]
+fn minicore_source_code_normalizes_line_endings() {
+    let source = MiniCore::RAW_SOURCE.replace("\r\n", "\n").replace('\r', "\n");
+    let source = source.replace('\n', "\r\n");
+    let source = MiniCore::from_flags(["option"]).source_code(&source);
+
+    assert!(!source.contains('\r'));
+}
diff --git a/src/tools/rust-analyzer/crates/test-utils/src/lib.rs b/src/tools/rust-analyzer/crates/test-utils/src/lib.rs
index 62867fd..4eab7f4 100644
--- a/src/tools/rust-analyzer/crates/test-utils/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/test-utils/src/lib.rs
@@ -260,7 +260,7 @@ pub fn extract_annotations(text: &str) -> Vec<(TextRange, String)> {
                         let &(_, idx) = prev_line_annotations
                             .iter()
                             .find(|&&(off, _idx)| off == offset)
-                            .unwrap();
+                            .expect("annotation continuation not found");
                         res[idx].1.push('\n');
                         res[idx].1.push_str(&content);
                         res[idx].1.push('\n');
diff --git a/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs b/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs
index 8975fa5..0588b1c 100644
--- a/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs
+++ b/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs
@@ -54,11 +54,12 @@
 //!     iterators: iterator, fn
 //!     manually_drop: drop
 //!     matches:
-//!     non_null:
-//!     non_zero:
+//!     non_null: pat
+//!     non_zero: pat, transmute, option
 //!     option: panic
 //!     ord: eq, option
 //!     panic: fmt
+//!     pat: panic
 //!     phantom_data:
 //!     pin:
 //!     pointee: copy, send, sync, ord, hash, unpin, phantom_data
@@ -538,10 +539,10 @@ pub const fn metadata<T: PointeeSized>(ptr: *const T) -> <T as Pointee>::Metadat
 
     // endregion:pointee
     // region:non_null
-    #[rustc_layout_scalar_valid_range_start(1)]
     #[rustc_nonnull_optimization_guaranteed]
+    #[repr(transparent)]
     pub struct NonNull<T: crate::marker::PointeeSized> {
-        pointer: *const T,
+        pointer: crate::pattern_type!(*const T is !null),
     }
     // region:coerce_unsized
     impl<T: crate::marker::PointeeSized, U: crate::marker::PointeeSized>
@@ -654,6 +655,10 @@ impl<P: PointeeSized, T: PointeeSized> Receiver for P
     #[lang = "drop"]
     pub trait Drop {
         fn drop(&mut self);
+
+        // region:pin
+        fn pin_drop(self: crate::pin::Pin<&mut Self>) {}
+        // endregion:pin
     }
     // endregion:drop
 
@@ -1713,6 +1718,43 @@ pub enum Result<T, E> {
         #[lang = "Err"]
         Err(E),
     }
+    impl<T, E> Result<T, E> {
+        pub const fn or<F>(self, res: Result<T, F>) -> Result<T, F> {
+            match self {
+                Ok(v) => Ok(v),
+                Err(_) => res,
+            }
+        }
+
+        pub const fn unwrap_or(self, default: T) -> T {
+            match self {
+                Ok(t) => t,
+                Err(_) => default,
+            }
+        }
+
+        // region:fn
+        pub const fn or_else<F, O>(self, op: O) -> Result<T, F>
+        where
+            O: FnOnce(E) -> Result<T, F>,
+        {
+            match self {
+                Ok(t) => Ok(t),
+                Err(e) => op(e),
+            }
+        }
+
+        pub const fn unwrap_or_else<F>(self, op: F) -> T
+        where
+            F: FnOnce(E) -> T,
+        {
+            match self {
+                Ok(t) => t,
+                Err(e) => op(e),
+            }
+        }
+        // endregion:fn
+    }
 }
 // endregion:result
 
@@ -2278,12 +2320,73 @@ macro_rules! option_env {}
     // endregion:deref_pat
 }
 
+// region:pat
+pub mod pat {
+    #[macro_export]
+    #[rustc_builtin_macro(pattern_type)]
+    macro_rules! pattern_type {
+        ($($arg:tt)*) => {
+            /* compiler built-in */
+        };
+    }
+
+    pub const trait RangePattern {
+        #[lang = "RangeMin"]
+        const MIN: Self;
+
+        #[lang = "RangeMax"]
+        const MAX: Self;
+
+        #[lang = "RangeSub"]
+        fn sub_one(self) -> Self;
+    }
+
+    impl const RangePattern for u8 {
+        const MIN: u8 = 0;
+        const MAX: u8 = 0xFF;
+        fn sub_one(self) -> Self {
+            if self == Self::MIN {
+                panic!("exclusive range end at minimum value of type")
+            } else {
+                self - 1
+            }
+        }
+    }
+
+    impl const RangePattern for i32 {
+        const MIN: i32 = 0x80_00_00_00;
+        const MAX: i32 = 0x7F_FF_FF_FF;
+        fn sub_one(self) -> Self {
+            if self == Self::MIN {
+                panic!("exclusive range end at minimum value of type")
+            } else {
+                self - 1
+            }
+        }
+    }
+
+    // region:coerce_unsized
+    impl<T: crate::marker::PointeeSized, U: crate::marker::PointeeSized>
+        crate::ops::CoerceUnsized<pattern_type!(*const U is !null)> for pattern_type!(*const T is !null)
+    where
+        T: crate::marker::Unsize<U>,
+    {
+    }
+    // endregion:coerce_unsized
+
+    // region:dispatch_from_dyn
+    impl<T: crate::ops::DispatchFromDyn<U>, U>
+        crate::ops::DispatchFromDyn<pattern_type!(U is !null)> for pattern_type!(T is !null)
+    {
+    }
+    // endregion:dispatch_from_dyn
+}
+// endregion:pat
+
 // region:non_zero
 pub mod num {
     #[repr(transparent)]
-    #[rustc_layout_scalar_valid_range_start(1)]
-    #[rustc_nonnull_optimization_guaranteed]
-    pub struct NonZeroU8(u8);
+    pub struct NonZeroU8(crate::pattern_type!(u8 is 1..));
 }
 // endregion:non_zero
 
@@ -2392,6 +2495,7 @@ pub mod v1 {
             hash::derive::Hash,                           // :hash, derive
             iter::{FromIterator, IntoIterator, Iterator}, // :iterator
             macros::builtin::{derive, derive_const},      // :derive
+            macros::deref,                                // :deref_pat
             marker::Copy,                                 // :copy
             marker::Send,                                 // :send
             marker::Sized,                                // :sized
@@ -2405,7 +2509,6 @@ pub mod v1 {
             panic,                                        // :panic
             result::Result::{self, Err, Ok},              // :result
             str::FromStr,                                 // :str
-            macros::deref,                                // :deref_pat
         };
     }
 
diff --git a/src/tools/rust-analyzer/crates/tt/Cargo.toml b/src/tools/rust-analyzer/crates/tt/Cargo.toml
index 6cfb764..9a798b5 100644
--- a/src/tools/rust-analyzer/crates/tt/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/tt/Cargo.toml
@@ -24,7 +24,6 @@
 ra-ap-rustc_lexer.workspace = true
 
 [features]
-default = []
 in-rust-tree = []
 
 [lints]
diff --git a/src/tools/rust-analyzer/crates/tt/src/lib.rs b/src/tools/rust-analyzer/crates/tt/src/lib.rs
index 72b0d76..7b46c33 100644
--- a/src/tools/rust-analyzer/crates/tt/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/tt/src/lib.rs
@@ -765,27 +765,24 @@ pub fn count(&self) -> usize {
 
 pub fn pretty(tkns: TokenTreesView<'_>) -> String {
     return dispatch_ref! {
-        match tkns.repr => tt => pretty_impl(tt)
+        match tkns.repr => tt => pretty_impl(tkns, tt)
     };
 
     use crate::storage::TokenTree;
 
-    fn tokentree_to_text<S: SpanStorage>(tkn: &TokenTree<S>, tkns: &mut &[TokenTree<S>]) -> String {
+    fn tokentree_to_text<S: SpanStorage>(
+        tkns_view: TokenTreesView<'_>,
+        tkn: &TokenTree<S>,
+        tkns: &mut &[TokenTree<S>],
+    ) -> String {
         match tkn {
             TokenTree::Ident { sym, is_raw, .. } => format!("{}{}", is_raw.as_str(), sym),
-            &TokenTree::Literal { ref text_and_suffix, kind, suffix_len, span: _ } => {
+            &TokenTree::Literal { ref text_and_suffix, kind, suffix_len, span } => {
                 format!(
                     "{}",
                     Literal {
                         text_and_suffix: text_and_suffix.clone(),
-                        span: Span {
-                            range: TextRange::empty(TextSize::new(0)),
-                            anchor: span::SpanAnchor {
-                                file_id: span::EditionedFileId::from_raw(0),
-                                ast_id: span::FIXUP_ERASED_FILE_AST_ID_MARKER
-                            },
-                            ctx: span::SyntaxContext::root(span::Edition::Edition2015)
-                        },
+                        span: span.span(tkns_view.span_parts),
                         kind,
                         suffix_len
                     }
@@ -794,7 +791,7 @@ fn tokentree_to_text<S: SpanStorage>(tkn: &TokenTree<S>, tkns: &mut &[TokenTree<
             TokenTree::Punct { char, .. } => format!("{}", char),
             TokenTree::Subtree { len, delim_kind, .. } => {
                 let (subtree_content, rest) = tkns.split_at(*len as usize);
-                let content = pretty_impl(subtree_content);
+                let content = pretty_impl(tkns_view, subtree_content);
                 *tkns = rest;
                 let (open, close) = match *delim_kind {
                     DelimiterKind::Brace => ("{", "}"),
@@ -807,13 +804,16 @@ fn tokentree_to_text<S: SpanStorage>(tkn: &TokenTree<S>, tkns: &mut &[TokenTree<
         }
     }
 
-    fn pretty_impl<S: SpanStorage>(mut tkns: &[TokenTree<S>]) -> String {
+    fn pretty_impl<S: SpanStorage>(
+        tkns_view: TokenTreesView<'_>,
+        mut tkns: &[TokenTree<S>],
+    ) -> String {
         let mut last = String::new();
         let mut last_to_joint = true;
 
         while let Some((tkn, rest)) = tkns.split_first() {
             tkns = rest;
-            last = [last, tokentree_to_text(tkn, &mut tkns)].join(if last_to_joint {
+            last = [last, tokentree_to_text(tkns_view, tkn, &mut tkns)].join(if last_to_joint {
                 ""
             } else {
                 " "
diff --git a/src/tools/rust-analyzer/docs/book/src/configuration_generated.md b/src/tools/rust-analyzer/docs/book/src/configuration_generated.md
index 069c821..7bbb9e0 100644
--- a/src/tools/rust-analyzer/docs/book/src/configuration_generated.md
+++ b/src/tools/rust-analyzer/docs/book/src/configuration_generated.md
@@ -446,6 +446,9 @@
 For traits the type "methods" can be used to only exclude the methods but not the trait
 itself.
 
+For modules the type "subItems" can be used to only exclude the all items in it but not the module
+itself. This does not include items defined in nested modules.
+
 This setting also inherits `#rust-analyzer.completion.excludeTraits#`.
 
 
diff --git a/src/tools/rust-analyzer/docs/book/src/contributing/lsp-extensions.md b/src/tools/rust-analyzer/docs/book/src/contributing/lsp-extensions.md
index b74c40c..a318940 100644
--- a/src/tools/rust-analyzer/docs/book/src/contributing/lsp-extensions.md
+++ b/src/tools/rust-analyzer/docs/book/src/contributing/lsp-extensions.md
@@ -1,5 +1,5 @@
 <!---
-lsp/ext.rs hash: 57ae57d2a5c65b14 
+lsp/ext.rs hash: cec81c987f189e83
 
 If you need to change the above hash to make the test pass, please check if you
 need to adjust this doc as well and ping this issue:
diff --git a/src/tools/rust-analyzer/editors/code/package.json b/src/tools/rust-analyzer/editors/code/package.json
index 14369e6..53c5a29 100644
--- a/src/tools/rust-analyzer/editors/code/package.json
+++ b/src/tools/rust-analyzer/editors/code/package.json
@@ -347,6 +347,11 @@
                 "command": "rust-analyzer.getFailedObligations",
                 "title": "Get Failed Obligations",
                 "category": "rust-analyzer (debug command)"
+            },
+            {
+                "command": "rust-analyzer.evaluatePredicate",
+                "title": "Evaluate Predicate",
+                "category": "rust-analyzer"
             }
         ],
         "keybindings": [
@@ -1328,7 +1333,7 @@
                 "title": "Completion",
                 "properties": {
                     "rust-analyzer.completion.autoimport.exclude": {
-                        "markdownDescription": "A list of full paths to items to exclude from auto-importing completions.\n\nTraits in this list won't have their methods suggested in completions unless the trait\nis in scope.\n\nYou can either specify a string path which defaults to type \"always\" or use the more\nverbose form `{ \"path\": \"path::to::item\", type: \"always\" }`.\n\nFor traits the type \"methods\" can be used to only exclude the methods but not the trait\nitself.\n\nThis setting also inherits `#rust-analyzer.completion.excludeTraits#`.",
+                        "markdownDescription": "A list of full paths to items to exclude from auto-importing completions.\n\nTraits in this list won't have their methods suggested in completions unless the trait\nis in scope.\n\nYou can either specify a string path which defaults to type \"always\" or use the more\nverbose form `{ \"path\": \"path::to::item\", type: \"always\" }`.\n\nFor traits the type \"methods\" can be used to only exclude the methods but not the trait\nitself.\n\nFor modules the type \"subItems\" can be used to only exclude the all items in it but not the module\nitself. This does not include items defined in nested modules.\n\nThis setting also inherits `#rust-analyzer.completion.excludeTraits#`.",
                         "default": [
                             {
                                 "path": "core::borrow::Borrow",
@@ -1355,11 +1360,13 @@
                                             "type": "string",
                                             "enum": [
                                                 "always",
-                                                "methods"
+                                                "methods",
+                                                "subItems"
                                             ],
                                             "enumDescriptions": [
                                                 "Do not show this item or its methods (if it is a trait) in auto-import completions.",
-                                                "Do not show this traits methods in auto-import completions."
+                                                "Do not show this trait's methods in auto-import completions.",
+                                                "Do not show this module's all items in it in auto-import completions."
                                             ]
                                         }
                                     }
@@ -3862,6 +3869,10 @@
                 {
                     "command": "rust-analyzer.getFailedObligations",
                     "when": "inRustProject"
+                },
+                {
+                    "command": "rust-analyzer.evaluatePredicate",
+                    "when": "inRustProject"
                 }
             ],
             "editor/context": [
diff --git a/src/tools/rust-analyzer/editors/code/src/commands.ts b/src/tools/rust-analyzer/editors/code/src/commands.ts
index 302f51d..9c8b707 100644
--- a/src/tools/rust-analyzer/editors/code/src/commands.ts
+++ b/src/tools/rust-analyzer/editors/code/src/commands.ts
@@ -494,6 +494,102 @@
     };
 }
 
+const EVALUATE_PREDICATE_LAST_INPUT_KEY = "evaluatePredicate.lastInput";
+
+export function evaluatePredicate(ctx: CtxInit): Cmd {
+    return async () => {
+        const editor = ctx.activeRustEditor;
+        if (!editor) {
+            await vscode.window.showWarningMessage(
+                "rust-analyzer: evaluate predicate requires an active Rust editor",
+            );
+            return;
+        }
+
+        const client = ctx.client;
+        const textDocument = client.code2ProtocolConverter.asTextDocumentIdentifier(
+            editor.document,
+        );
+        const position = client.code2ProtocolConverter.asPosition(editor.selection.active);
+
+        const input = vscode.window.createInputBox();
+        input.value = ctx.extCtx.workspaceState.get<string>(
+            EVALUATE_PREDICATE_LAST_INPUT_KEY,
+            "Vec<u32>: Clone",
+        );
+        input.prompt = "Enter a Rust where-clause predicate";
+        input.placeholder = "Vec<u32>: Clone";
+
+        let requestId = 0;
+        let hidden = false;
+        const updatePredicateResult = async (text: string) => {
+            const currentRequestId = ++requestId;
+            await ctx.extCtx.workspaceState.update(EVALUATE_PREDICATE_LAST_INPUT_KEY, text);
+            if (text.trim() === "") {
+                input.validationMessage = undefined;
+                return;
+            }
+
+            try {
+                const result = await client.sendRequest(ra.evaluatePredicate, {
+                    text,
+                    textDocument,
+                    position,
+                });
+                if (!hidden && currentRequestId === requestId) {
+                    input.validationMessage = predicateEvaluationValidationMessage(result);
+                }
+            } catch (error) {
+                if (!hidden && currentRequestId === requestId) {
+                    input.validationMessage = {
+                        message: String(error),
+                        severity: vscode.InputBoxValidationSeverity.Error,
+                    };
+                }
+            }
+        };
+
+        await new Promise<void>((resolve) => {
+            input.onDidChangeValue((text) => void updatePredicateResult(text));
+            input.onDidAccept(() => input.hide());
+            input.onDidHide(() => {
+                hidden = true;
+                input.dispose();
+                resolve();
+            });
+            input.show();
+            void updatePredicateResult(input.value);
+        });
+    };
+}
+
+function predicateEvaluationValidationMessage(
+    result: ra.EvaluatePredicateResult,
+): vscode.InputBoxValidationMessage {
+    switch (result.status) {
+        case "holds":
+            return {
+                message: result.message,
+                severity: vscode.InputBoxValidationSeverity.Info,
+            };
+        case "notProven":
+            return {
+                message: result.message,
+                severity: vscode.InputBoxValidationSeverity.Warning,
+            };
+        case "invalid":
+            return {
+                message: result.message,
+                severity: vscode.InputBoxValidationSeverity.Error,
+            };
+        case "unsupported":
+            return {
+                message: result.message,
+                severity: vscode.InputBoxValidationSeverity.Warning,
+            };
+    }
+}
+
 export function serverVersion(ctx: CtxInit): Cmd {
     return async () => {
         if (!ctx.serverPath) {
diff --git a/src/tools/rust-analyzer/editors/code/src/lsp_ext.ts b/src/tools/rust-analyzer/editors/code/src/lsp_ext.ts
index cf190ea..80cb04d 100644
--- a/src/tools/rust-analyzer/editors/code/src/lsp_ext.ts
+++ b/src/tools/rust-analyzer/editors/code/src/lsp_ext.ts
@@ -67,6 +67,21 @@
 export const viewItemTree = new lc.RequestType<ViewItemTreeParams, string, void>(
     "rust-analyzer/viewItemTree",
 );
+export type EvaluatePredicateParams = {
+    text: string;
+    textDocument: lc.TextDocumentIdentifier;
+    position: lc.Position;
+};
+export type PredicateEvaluationStatus = "holds" | "notProven" | "invalid" | "unsupported";
+export type EvaluatePredicateResult = {
+    status: PredicateEvaluationStatus;
+    message: string;
+};
+export const evaluatePredicate = new lc.RequestType<
+    EvaluatePredicateParams,
+    EvaluatePredicateResult,
+    void
+>("rust-analyzer/evaluatePredicate");
 export const getFailedObligations = new lc.RequestType<lc.TextDocumentPositionParams, string, void>(
     "rust-analyzer/getFailedObligations",
 );
diff --git a/src/tools/rust-analyzer/editors/code/src/main.ts b/src/tools/rust-analyzer/editors/code/src/main.ts
index 7d91286..6567bcd 100644
--- a/src/tools/rust-analyzer/editors/code/src/main.ts
+++ b/src/tools/rust-analyzer/editors/code/src/main.ts
@@ -187,6 +187,7 @@
         clearFlycheck: { enabled: commands.clearFlycheck },
         runFlycheck: { enabled: commands.runFlycheck },
         ssr: { enabled: commands.ssr },
+        evaluatePredicate: { enabled: commands.evaluatePredicate },
         serverVersion: { enabled: commands.serverVersion },
         viewMemoryLayout: { enabled: commands.viewMemoryLayout },
         toggleCheckOnSave: { enabled: commands.toggleCheckOnSave },
diff --git a/src/tools/rust-analyzer/rust-version b/src/tools/rust-analyzer/rust-version
index 1e8579c..387bd8e 100644
--- a/src/tools/rust-analyzer/rust-version
+++ b/src/tools/rust-analyzer/rust-version
@@ -1 +1 @@
-8afb6a8b1b32fce2f8aa7520517833338dc36c5e
+029c9e18dd1f4668e1d42bb187c1c263dfe20093
diff --git a/src/tools/rust-analyzer/xtask/src/codegen/grammar/ast_src.rs b/src/tools/rust-analyzer/xtask/src/codegen/grammar/ast_src.rs
index 43462d1..1ae139f 100644
--- a/src/tools/rust-analyzer/xtask/src/codegen/grammar/ast_src.rs
+++ b/src/tools/rust-analyzer/xtask/src/codegen/grammar/ast_src.rs
@@ -123,6 +123,7 @@ fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
     "bikeshed",
     "cfg_attr",
     "cfg",
+    "null",
 ];
 // keywords we use for special macro expansions
 const CONTEXTUAL_BUILTIN_KEYWORDS: &[&str] = &[
@@ -151,6 +152,9 @@ fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
     "readonly",
     "sym",
     "deref",
+    "pattern_type",
+    "is",
+    "include_bytes",
 ];
 
 // keywords that are keywords depending on the edition
diff --git a/src/tools/rust-analyzer/xtask/src/dist.rs b/src/tools/rust-analyzer/xtask/src/dist.rs
index 57a6a0e..e8bedbe 100644
--- a/src/tools/rust-analyzer/xtask/src/dist.rs
+++ b/src/tools/rust-analyzer/xtask/src/dist.rs
@@ -107,7 +107,9 @@ fn dist_server(
 ) -> anyhow::Result<()> {
     let _e = sh.push_env("CFG_RELEASE", release);
     let _e = sh.push_env("CARGO_PROFILE_RELEASE_LTO", "thin");
+    let _e = sh.push_env("CARGO_PROFILE_RELEASE_CODEGEN_UNITS", "1");
     let _e = sh.push_env("CARGO_PROFILE_DEV_REL_LTO", "thin");
+    let _e = sh.push_env("CARGO_PROFILE_DEV_REL_CODEGEN_UNITS", "1");
 
     // Uncomment to enable debug info for releases. Note that:
     //   * debug info is split on windows and macs, so it does nothing for those platforms,
diff --git a/src/tools/rust-analyzer/xtask/src/install.rs b/src/tools/rust-analyzer/xtask/src/install.rs
index a803b4e..bbb6d9a 100644
--- a/src/tools/rust-analyzer/xtask/src/install.rs
+++ b/src/tools/rust-analyzer/xtask/src/install.rs
@@ -179,7 +179,7 @@ fn install_proc_macro_server(sh: &Shell, opts: ProcMacroServerOpt) -> anyhow::Re
 
     let mut cmd = cmd!(
         sh,
-        "cargo install --path crates/proc-macro-srv-cli --profile={profile} --locked --force --features sysroot-abi"
+        "cargo install --path crates/proc-macro-srv-cli --profile={profile} --locked --force --features in-rust-tree"
     );
     if std::env::var_os("RUSTUP_TOOLCHAIN").is_none() {
         cmd = cmd.env("RUSTUP_TOOLCHAIN", "nightly");
diff --git a/src/tools/rust-analyzer/xtask/src/pgo.rs b/src/tools/rust-analyzer/xtask/src/pgo.rs
index 0c6f499..ca6dace 100644
--- a/src/tools/rust-analyzer/xtask/src/pgo.rs
+++ b/src/tools/rust-analyzer/xtask/src/pgo.rs
@@ -91,7 +91,7 @@ fn download_crate_for_training(sh: &Shell, pgo_dir: &Path, repo: &str) -> anyhow
     let target_path = pgo_dir.join(normalized_path);
     cmd!(sh, "git clone --depth 1 https://github.com/{repo} {revision...} {target_path}")
         .run()
-        .with_context(|| "cannot download PGO training crate from {repo}")?;
+        .with_context(|| format!("cannot download PGO training crate from {repo}"))?;
 
     Ok(target_path)
 }
diff --git a/src/tools/rust-analyzer/xtask/src/tidy.rs b/src/tools/rust-analyzer/xtask/src/tidy.rs
index 122cf48..33145a8 100644
--- a/src/tools/rust-analyzer/xtask/src/tidy.rs
+++ b/src/tools/rust-analyzer/xtask/src/tidy.rs
@@ -21,13 +21,13 @@ pub(crate) fn run(&self, sh: &Shell) -> anyhow::Result<()> {
 }
 
 fn check_lsp_extensions_docs(sh: &Shell) {
-    let expected_hash = {
+    let actual_hash = {
         let lsp_ext_rs =
             sh.read_file(project_root().join("crates/rust-analyzer/src/lsp/ext.rs")).unwrap();
         stable_hash(lsp_ext_rs.as_str())
     };
 
-    let actual_hash = {
+    let expected_hash = {
         let lsp_extensions_md = sh
             .read_file(project_root().join("docs/book/src/contributing/lsp-extensions.md"))
             .unwrap();
@@ -135,7 +135,6 @@ fn check_licenses(sh: &Shell) {
         "(MIT OR Apache-2.0) AND Unicode-3.0",
         "0BSD OR MIT OR Apache-2.0",
         "Apache-2.0 / MIT",
-        "Apache-2.0 OR BSL-1.0",
         "Apache-2.0 OR MIT",
         "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
         "Apache-2.0 WITH LLVM-exception",
@@ -155,6 +154,7 @@ fn check_licenses(sh: &Shell) {
         "Unlicense OR MIT",
         "Unlicense/MIT",
         "Zlib",
+        "Zlib OR Apache-2.0 OR MIT",
     ];
 
     let meta = cmd!(sh, "cargo metadata --format-version 1").read().unwrap();
diff --git a/src/tools/rustfmt/src/types.rs b/src/tools/rustfmt/src/types.rs
index e574a9d..2dfb5e5 100644
--- a/src/tools/rustfmt/src/types.rs
+++ b/src/tools/rustfmt/src/types.rs
@@ -484,16 +484,6 @@ fn rewrite_result(&self, context: &RewriteContext<'_>, shape: Shape) -> RewriteR
                 ref lifetime,
                 ref bounds,
             }) => rewrite_bounded_lifetime(lifetime, bounds, self.span, context, shape)?,
-            ast::WherePredicateKind::EqPredicate(ast::WhereEqPredicate {
-                ref lhs_ty,
-                ref rhs_ty,
-                ..
-            }) => {
-                let lhs_ty_str = lhs_ty
-                    .rewrite_result(context, shape)
-                    .map(|lhs| lhs + " =")?;
-                rewrite_assign_rhs(context, lhs_ty_str, &**rhs_ty, &RhsAssignKind::Ty, shape)?
-            }
         };
 
         let mut result = String::with_capacity(attrs_str.len() + pred_str.len() + 1);
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index ef08286..89aae46 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -597,6 +597,7 @@ pub(crate) struct WorkspaceInfo<'a> {
     "log",
     "mach2",
     "memchr",
+    "memmap2",
     "object",
     "proc-macro2",
     "quote",
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 50ec411..d58adbc 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -220,6 +220,7 @@ fn check_unexpected_extension(check: &mut RunningCheck, file_path: &Path, ext: &
         "tests/ui/asm/named-asm-labels.s", // loading an external asm file to test named labels lint
         "tests/ui/asm/normalize-offsets-for-crlf.s", // loading an external asm file to test CRLF normalization
         "tests/ui/codegen/mismatched-data-layout.json", // testing mismatched data layout w/ custom targets
+        "tests/ui/codegen/custom-target-invalid-llvm-target.json", // testing invalid custom targets
         "tests/ui/check-cfg/my-awesome-platform.json",  // testing custom targets with cfgs
         "tests/ui/argfile/commandline-argfile-badutf8.args", // passing args via a file
         "tests/ui/argfile/commandline-argfile.args",    // passing args via a file
diff --git a/src/tools/unicode-table-generator/Cargo.toml b/src/tools/unicode-table-generator/Cargo.toml
index 3ca6e9e..3be916d 100644
--- a/src/tools/unicode-table-generator/Cargo.toml
+++ b/src/tools/unicode-table-generator/Cargo.toml
@@ -7,3 +7,4 @@
 
 [dependencies]
 ucd-parse = "0.1.3"
+rustc-hash = "2.0.0"
diff --git a/src/tools/unicode-table-generator/src/cascading_map.rs b/src/tools/unicode-table-generator/src/cascading_map.rs
index 56e6401..da06049 100644
--- a/src/tools/unicode-table-generator/src/cascading_map.rs
+++ b/src/tools/unicode-table-generator/src/cascading_map.rs
@@ -1,7 +1,8 @@
-use std::collections::HashMap;
 use std::fmt::Write as _;
 use std::ops::Range;
 
+use rustc_hash::FxHashMap;
+
 use crate::fmt_list;
 use crate::raw_emitter::RawEmitter;
 
@@ -27,7 +28,7 @@ pub fn emit_cascading_map(&mut self, ranges: &[Range<u32>]) -> bool {
         println!("there are {} points", points.len());
 
         // how many distinct ranges need to be counted?
-        let mut codepoints_by_high_bytes = HashMap::<usize, Vec<u32>>::new();
+        let mut codepoints_by_high_bytes = FxHashMap::<usize, Vec<u32>>::default();
         for point in points {
             // assert that there is no whitespace over the 0x3000 range.
             assert!(point <= 0x3000, "the highest unicode whitespace value has changed");
diff --git a/src/tools/unicode-table-generator/src/case_mapping.rs b/src/tools/unicode-table-generator/src/case_mapping.rs
index b7b3855..9336eaf 100644
--- a/src/tools/unicode-table-generator/src/case_mapping.rs
+++ b/src/tools/unicode-table-generator/src/case_mapping.rs
@@ -48,21 +48,33 @@
 use crate::fmt_helpers::Hex;
 use crate::{UnicodeData, fmt_list};
 
-pub(crate) fn generate_case_mapping(data: &UnicodeData) -> (String, [(String, usize); 3]) {
+pub(crate) fn generate_case_mapping(data: &UnicodeData) -> (String, [(String, usize); 4]) {
     let mut file = String::new();
 
     file.push_str("\n\n");
     file.push_str(HEADER.trim_start());
     file.push('\n');
-    let (lower_tables, lower_desc, lower_size) = generate_tables("LOWER", &data.to_lower);
+    let (lower_tables, lower_desc, lower_size) = generate_tables("LOWERCASE", &data.to_lower);
     file.push_str(&lower_tables);
     file.push_str("\n\n");
-    let (upper_tables, upper_desc, upper_size) = generate_tables("UPPER", &data.to_upper);
+    let (upper_tables, upper_desc, upper_size) = generate_tables("UPPERCASE", &data.to_upper);
     file.push_str(&upper_tables);
     file.push_str("\n\n");
-    let (title_tables, title_desc, title_size) = generate_tables("TITLE", &data.to_title);
+    let (title_tables, title_desc, title_size) = generate_tables("TITLECASE", &data.to_title);
     file.push_str(&title_tables);
-    (file, [(lower_desc, lower_size), (upper_desc, upper_size), (title_desc, title_size)])
+    file.push_str("\n\n");
+    let (casefold_tables, casefold_desc, casefold_size) =
+        generate_tables("CASEFOLD", &data.to_casefold);
+    file.push_str(&casefold_tables);
+    (
+        file,
+        [
+            (lower_desc, lower_size),
+            (upper_desc, upper_size),
+            (title_desc, title_size),
+            (casefold_desc, casefold_size),
+        ],
+    )
 }
 
 // So far, only planes 0 and 1 (Basic Multilingual Plane and Supplementary
@@ -205,7 +217,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                     output_high, input_high,
                     "Case-mapping a character should not change its plane"
                 );
-                let delta = output_low as i16 - input_low as i16;
+                let delta = output_low.wrapping_sub(input_low).cast_signed();
                 let range = Range::singleton(input_low);
                 l2_lut.singles.push((range, delta));
             }
@@ -264,7 +276,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     let size = l1_lut.size();
     let num_ranges =
         l1_lut.l2_luts.iter().map(|l2| l2.singles.len() + l2.multis.len()).sum::<usize>();
-    let table = format!("static {case}CASE_LUT: L1Lut = {l1_lut:#?};");
+    let table = format!("static {case}_LUT: L1Lut = {l1_lut:#?};");
     let desc = format!(
         "{:6} codepoints in {:3} ranges (U+{:06X} - U+{:06X}) using 2-level LUT",
         data.len(),
@@ -381,7 +393,7 @@ unsafe fn reconstruct(plane: u16, low: u16) -> char {
 }
 
 pub fn to_lower(c: char) -> [char; 3] {
-    // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%253AChanges_When_Lowercased%253A%5D-%5B%253AASCII%253A%5D&abb=on
+    // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=[:Changes_When_Lowercased:]-[:ASCII:]&abb=on
     if c < '\u{C0}' {
         return [c.to_ascii_lowercase(), '\0', '\0'];
     }
@@ -390,7 +402,7 @@ unsafe fn reconstruct(plane: u16, low: u16) -> char {
 }
 
 pub fn to_upper(c: char) -> [char; 3] {
-    // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%253AChanges_When_Uppercased%253A%5D-%5B%253AASCII%253A%5D&abb=on
+    // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=[:Changes_When_Uppercased:]-[:ASCII:]&abb=on
     if c < '\u{B5}' {
         return [c.to_ascii_uppercase(), '\0', '\0'];
     }
@@ -399,11 +411,93 @@ unsafe fn reconstruct(plane: u16, low: u16) -> char {
 }
 
 pub fn to_title(c: char) -> [char; 3] {
-    // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%253AChanges_When_Titlecased%253A%5D-%5B%253AASCII%253A%5D&abb=on
+    // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=[:Changes_When_Titlecased:]-[:ASCII:]&abb=on
     if c < '\u{B5}' {
         return [c.to_ascii_uppercase(), '\0', '\0'];
     }
 
     lookup(c, &TITLECASE_LUT).or_else(|| lookup(c, &UPPERCASE_LUT)).unwrap_or([c, '\0', '\0'])
 }
+
+pub fn to_casefold(c: char) -> [char; 3] {
+    // https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=[:Changes_When_Casefolded:]-[:ASCII:]&abb=on
+    if c < '\u{B5}' {
+        return [c.to_ascii_lowercase(), '\0', '\0'];
+    }
+
+
+    lookup(c, &CASEFOLD_LUT).unwrap_or_else(|| {
+        // Fall back to lowercase of uppercase
+
+        let uppercase = lookup(c, &UPPERCASE_LUT).unwrap_or([c, '\0', '\0']);
+
+        // We need to take the lowercase of each character in `uppercase`,
+        // and then concatenate them together.
+
+        // Lowercase the first uppercased char
+        let mut final_result = to_lower(uppercase[0]);
+
+        if uppercase[1] != '\0' {
+            // There's a 2nd uppercase char, lowercase it as well
+            let lowercase_1 = to_lower(uppercase[1]);
+
+            // The lowercase of the second uppercase character
+            // can't be 3 chars long;
+            // that would bring the total case-folding length
+            // above 3 characters, which would violate
+            // a Unicode stability guarantee.
+            debug_assert_eq!(lowercase_1[2], '\0');
+
+            // Currently, in every case where there
+            // are multiple uppercased characters,
+            // the lowercase of the first uppercase
+            // has length 1. However, Unicode doesn't
+            // guarantee this.
+            // If, after updating the Unicode data
+            // to a new Unicode version, the below
+            // assertion starts to fail in
+            // `coretests/tests/unicode.rs` `to_casefold()`,
+            // delete it, and uncomment the
+            // `if` condition and corresponding
+            // `else` block below it.
+            debug_assert_eq!(final_result[1], '\0');
+            //if final_result[1] == '\0' {
+
+            final_result[1] = lowercase_1[0];
+
+            if uppercase[2] != '\0' {
+                // There's a 3rd uppercased char, lowercase it as well.
+                // Because of the Unicode stability guarantee that case-folding
+                // does not expand a string more than 3x in length,
+                // we know this lowercase must be 1 char long.
+
+                debug_assert_eq!(lowercase_1[1], '\0');
+                let lowercase_2 = to_lower(uppercase[2]);
+                debug_assert_eq!(lowercase_2[1], '\0');
+                debug_assert_eq!(lowercase_2[2], '\0');
+                final_result[2] = lowercase_2[0];
+            } else {
+                // Currently, the lowercase of
+                // the second uppercase character
+                // can't be 2 chars long either,
+                // but Unicode doesn't guarantee this.
+                // If, after updating the Unicode data
+                // to a new Unicode version, the below
+                // assertion starts to fail in
+                // `coretests/tests/unicode.rs` `to_casefold()`,
+                // delete it and uncomment the line
+                // below it.
+                debug_assert_eq!(lowercase_1[1], '\0');
+                //final_result[2] = lowercase_1[1];
+            }
+
+            /*} else {
+                final_result[2] = lowercase_1[0];
+                debug_assert_eq!(lowercase_1[1], '\0');
+                debug_assert_eq!(uppercase[2], '\0')
+            }*/
+        }
+        final_result
+    })
+}
 ";
diff --git a/src/tools/unicode-table-generator/src/main.rs b/src/tools/unicode-table-generator/src/main.rs
index 398b4c7..a55cd2f 100644
--- a/src/tools/unicode-table-generator/src/main.rs
+++ b/src/tools/unicode-table-generator/src/main.rs
@@ -71,11 +71,12 @@
 //! index of that offset is utilized as the answer to whether we're in the set
 //! or not.
 
-use std::collections::{BTreeMap, HashMap};
+use std::collections::BTreeMap;
 use std::fmt::Write;
 use std::ops::Range;
 
-use ucd_parse::Codepoints;
+use rustc_hash::{FxHashMap, FxHashSet};
+use ucd_parse::{Codepoint, Codepoints};
 
 mod cascading_map;
 mod case_mapping;
@@ -106,6 +107,9 @@ struct UnicodeData {
     to_title: BTreeMap<u32, [u32; 3]>,
     /// Only stores mappings that are not to self
     to_lower: BTreeMap<u32, [u32; 3]>,
+    /// Only stores mappings that differ from
+    /// `to_upper` followed by `to_lower`
+    to_casefold: BTreeMap<u32, [u32; 3]>,
 }
 
 fn to_mapping(
@@ -126,7 +130,7 @@ fn to_mapping(
 fn load_data() -> UnicodeData {
     unicode_download::fetch_latest();
 
-    let mut properties = HashMap::new();
+    let mut properties = FxHashMap::default();
     for row in ucd_parse::parse::<_, ucd_parse::CoreProperty>(&UNICODE_DIRECTORY).unwrap() {
         if let Some(name) = PROPERTIES.iter().find(|prop| **prop == row.property.as_str()) {
             properties.entry(*name).or_insert_with(Vec::new).push(row.codepoints);
@@ -138,7 +142,8 @@ fn load_data() -> UnicodeData {
         }
     }
 
-    let [mut to_lower, mut to_upper, mut to_title] = [const { BTreeMap::new() }; 3];
+    let [mut to_lower, mut to_upper, mut to_title, mut to_casefold] =
+        [const { BTreeMap::new() }; 4];
     for row in ucd_parse::UnicodeDataExpander::new(
         ucd_parse::parse::<_, ucd_parse::UnicodeData>(&UNICODE_DIRECTORY).unwrap(),
     ) {
@@ -189,6 +194,78 @@ fn load_data() -> UnicodeData {
         }
     }
 
+    fn get_mapping_from_btreemap<'a>(
+        cp: Codepoint,
+        map: &'a BTreeMap<u32, [u32; 3]>,
+    ) -> Vec<Codepoint> {
+        let mapping =
+            map.get(&cp.value()).copied().map(|cs| cs.map(|c| Codepoint::from_u32(c).unwrap()));
+
+        mapping
+            .as_ref()
+            .map(|cs| {
+                let nul = Codepoint::from_u32(0).unwrap();
+                if cs[1] == nul {
+                    &cs[..1]
+                } else if cs[2] == nul {
+                    &cs[..2]
+                } else {
+                    &cs[..]
+                }
+            })
+            .map_or_else(|| vec![cp], ToOwned::to_owned)
+    }
+
+    let mut nontrivial_casefold = FxHashSet::default();
+
+    for row in ucd_parse::parse::<_, ucd_parse::CaseFold>(&UNICODE_DIRECTORY).unwrap() {
+        use ucd_parse::{CaseStatus, Codepoint};
+        if matches!(row.status, CaseStatus::Common | CaseStatus::Full) {
+            let key = row.codepoint.value();
+            nontrivial_casefold.insert(key);
+
+            // We store case-fold data only for characters whose case-folding
+            // differs from the lowercase of their uppercase.
+
+            let lower_upper_mapping: Vec<Codepoint> =
+                get_mapping_from_btreemap(row.codepoint, &to_upper)
+                    .into_iter()
+                    .flat_map(|cp| get_mapping_from_btreemap(cp, &to_lower))
+                    .collect();
+
+            if let Some(casefold) = to_mapping(&lower_upper_mapping, &row.mapping) {
+                to_casefold.insert(key, casefold);
+            }
+        }
+    }
+
+    // Now, account for characters that remain unchanged by case-folding
+    // (and are therefore omitted from `CaseFolding.txt`),
+    // but yet differ from the lowercase of their uppercase.
+
+    for c in '\0'..=char::MAX {
+        let cnum: u32 = c.into();
+        if !nontrivial_casefold.contains(&cnum) {
+            let cp = Codepoint::from_u32(cnum).unwrap();
+
+            use std::collections::btree_map::Entry;
+            match to_casefold.entry(cnum) {
+                Entry::Vacant(vacant_entry) => {
+                    let lower_upper_mapping: Vec<Codepoint> =
+                        get_mapping_from_btreemap(cp, &to_upper)
+                            .into_iter()
+                            .flat_map(|cp| get_mapping_from_btreemap(cp, &to_lower))
+                            .collect();
+
+                    if let Some(casefold) = to_mapping(&lower_upper_mapping, &[cp]) {
+                        vacant_entry.insert(casefold);
+                    }
+                }
+                Entry::Occupied(_) => {}
+            }
+        }
+    }
+
     // Filter out ASCII codepoints.
     to_lower.retain(|&c, _| c > 0x7f);
     to_upper.retain(|&c, _| c > 0x7f);
@@ -207,7 +284,7 @@ fn load_data() -> UnicodeData {
         .collect();
 
     properties.sort_by_key(|p| p.0);
-    UnicodeData { ranges: properties, to_lower, to_title, to_upper }
+    UnicodeData { ranges: properties, to_lower, to_title, to_upper, to_casefold }
 }
 
 fn main() {
@@ -259,7 +336,9 @@ fn main() {
         total_bytes += emitter.bytes_used;
     }
     let (conversions, sizes) = case_mapping::generate_case_mapping(&unicode_data);
-    for (name, (desc, size)) in ["to_lower", "to_upper", "to_title"].iter().zip(sizes) {
+    for (name, (desc, size)) in
+        ["to_lower", "to_upper", "to_title", "to_casefold"].iter().zip(sizes)
+    {
         table_file.push_str(&format!("// {:16}: {:5} bytes, {desc}\n", name, size,));
         total_bytes += size;
     }
@@ -369,10 +448,11 @@ fn generate_tests(data: &UnicodeData) -> String {
         .unwrap();
     }
 
-    for (name, lut) in ["TO_LOWER", "TO_UPPER", "TO_TITLE"].iter().zip([
+    for (name, lut) in ["TO_LOWER", "TO_UPPER", "TO_TITLE", "TO_CASEFOLD"].iter().zip([
         &data.to_lower,
         &data.to_upper,
         &data.to_title,
+        &data.to_casefold,
     ]) {
         let lut = lut
             .iter()
diff --git a/src/tools/unicode-table-generator/src/raw_emitter.rs b/src/tools/unicode-table-generator/src/raw_emitter.rs
index 2979656..de3395d 100644
--- a/src/tools/unicode-table-generator/src/raw_emitter.rs
+++ b/src/tools/unicode-table-generator/src/raw_emitter.rs
@@ -1,7 +1,9 @@
-use std::collections::{BTreeMap, BTreeSet, HashMap};
+use std::collections::{BTreeMap, BTreeSet};
 use std::fmt::{self, Write};
 use std::ops::Range;
 
+use rustc_hash::FxHashMap;
+
 use crate::fmt_list;
 
 #[derive(Clone)]
@@ -126,8 +128,11 @@ fn emit_chunk_map(&mut self, zero_at: u8, compressed_words: &[u8], chunk_length:
         for chunk in compressed_words.chunks(chunk_length) {
             chunks.insert(chunk);
         }
-        let chunk_map =
-            chunks.iter().enumerate().map(|(idx, &chunk)| (chunk, idx)).collect::<HashMap<_, _>>();
+        let chunk_map = chunks
+            .iter()
+            .enumerate()
+            .map(|(idx, &chunk)| (chunk, idx))
+            .collect::<FxHashMap<_, _>>();
         let mut chunk_indices = Vec::new();
         for chunk in compressed_words.chunks(chunk_length) {
             chunk_indices.push(chunk_map[chunk]);
@@ -186,7 +191,7 @@ struct Canonicalized {
 
     /// Maps an input unique word to the associated index (u8) which is into
     /// canonical_words or canonicalized_words (in order).
-    unique_mapping: HashMap<u64, u8>,
+    unique_mapping: FxHashMap<u64, u8>,
 }
 
 impl Canonicalized {
@@ -253,7 +258,7 @@ enum Mapping {
         // These are mapped words, which will be represented by an index into
         // the canonical_words and a Mapping; u16 when encoded.
         let mut canonicalized_words = Vec::new();
-        let mut unique_mapping = HashMap::new();
+        let mut unique_mapping = FxHashMap::default();
 
         #[derive(Debug, PartialEq, Eq)]
         enum UniqueMapping {
@@ -361,7 +366,7 @@ enum UniqueMapping {
                     },
                 )
             })
-            .collect::<HashMap<_, _>>();
+            .collect::<FxHashMap<_, _>>();
 
         let mut distinct_indices = BTreeSet::new();
         for &w in unique_words {
diff --git a/src/tools/unicode-table-generator/src/unicode_download.rs b/src/tools/unicode-table-generator/src/unicode_download.rs
index c982617..b2fcf64 100644
--- a/src/tools/unicode-table-generator/src/unicode_download.rs
+++ b/src/tools/unicode-table-generator/src/unicode_download.rs
@@ -7,8 +7,13 @@
 
 static README: &str = "ReadMe.txt";
 
-static RESOURCES: &[&str] =
-    &["DerivedCoreProperties.txt", "PropList.txt", "UnicodeData.txt", "SpecialCasing.txt"];
+static RESOURCES: &[&str] = &[
+    "CaseFolding.txt",
+    "DerivedCoreProperties.txt",
+    "PropList.txt",
+    "SpecialCasing.txt",
+    "UnicodeData.txt",
+];
 
 #[track_caller]
 fn fetch(url: &str) -> Output {
diff --git a/tests/assembly-llvm/asm/xtensa-types.rs b/tests/assembly-llvm/asm/xtensa-types.rs
new file mode 100644
index 0000000..8a6251e
--- /dev/null
+++ b/tests/assembly-llvm/asm/xtensa-types.rs
@@ -0,0 +1,228 @@
+//@ add-minicore
+//@ assembly-output: emit-asm
+//@ compile-flags: --target xtensa-esp32-none-elf -Zmerge-functions=disabled
+//@ min-llvm-version: 22
+//@ needs-llvm-components: xtensa
+
+#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)]
+#![crate_type = "rlib"]
+#![no_core]
+#![allow(asm_sub_register, non_camel_case_types)]
+
+extern crate minicore;
+use minicore::*;
+
+type ptr = *mut u8;
+
+extern "C" {
+    fn extern_func();
+}
+
+// CHECK-LABEL: sym_fn:
+// CHECK: #APP
+// CHECK: call4 extern_func
+// CHECK: #NO_APP
+#[no_mangle]
+pub unsafe fn sym_fn() {
+    asm!("call4 {}", sym extern_func);
+}
+
+macro_rules! check_general_reg {
+    ($func:ident $ty:ident $class:ident $mov:literal) => {
+        #[no_mangle]
+        pub unsafe fn $func(x: $ty) -> $ty {
+            let y;
+            asm!(concat!($mov, " {}, {}"), out($class) y, in($class) x);
+            y
+        }
+    };
+}
+
+// CHECK-LABEL: reg_i8:
+// CHECK: #APP
+// CHECK: or a{{[0-9]+}}, a{{[0-9]+}}, a{{[0-9]+}}
+// CHECK: #NO_APP
+check_general_reg!(reg_i8 i8 reg "mov");
+
+// CHECK-LABEL: reg_i16:
+// CHECK: #APP
+// CHECK: or a{{[0-9]+}}, a{{[0-9]+}}, a{{[0-9]+}}
+// CHECK: #NO_APP
+check_general_reg!(reg_i16 i16 reg "mov");
+
+// CHECK-LABEL: reg_i32:
+// CHECK: #APP
+// CHECK: or a{{[0-9]+}}, a{{[0-9]+}}, a{{[0-9]+}}
+// CHECK: #NO_APP
+check_general_reg!(reg_i32 i32 reg "mov");
+
+// CHECK-LABEL: reg_ptr:
+// CHECK: #APP
+// CHECK: or a{{[0-9]+}}, a{{[0-9]+}}, a{{[0-9]+}}
+// CHECK: #NO_APP
+check_general_reg!(reg_ptr ptr reg "mov");
+
+macro_rules! check_explicit_reg {
+    ($func:ident $ty:ident $reg:tt $mov:literal) => {
+        #[no_mangle]
+        pub unsafe fn $func(x: $ty) -> $ty {
+            let y;
+            asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
+            y
+        }
+    };
+}
+
+// CHECK-LABEL: a2_i32:
+// CHECK: #APP
+// CHECK: or a2, a2, a2
+// CHECK: #NO_APP
+check_explicit_reg!(a2_i32 i32 "a2" "mov");
+
+// CHECK-LABEL: a5_i8:
+// CHECK: #APP
+// CHECK: or a5, a5, a5
+// CHECK: #NO_APP
+check_explicit_reg!(a5_i8 i8 "a5" "mov");
+
+// CHECK-LABEL: a5_i16:
+// CHECK: #APP
+// CHECK: or a5, a5, a5
+// CHECK: #NO_APP
+check_explicit_reg!(a5_i16 i16 "a5" "mov");
+
+// CHECK-LABEL: a5_i32:
+// CHECK: #APP
+// CHECK: or a5, a5, a5
+// CHECK: #NO_APP
+check_explicit_reg!(a5_i32 i32 "a5" "mov");
+
+// CHECK-LABEL: a5_ptr:
+// CHECK: #APP
+// CHECK: or a5, a5, a5
+// CHECK: #NO_APP
+check_explicit_reg!(a5_ptr ptr "a5" "mov");
+
+// CHECK-LABEL: a14_i32:
+// CHECK: #APP
+// CHECK: or a14, a14, a14
+// CHECK: #NO_APP
+check_explicit_reg!(a14_i32 i32 "a14" "mov");
+
+// a15 is the frame pointer under CALL0, but usable under the windowed ABI
+// (this test target).
+// CHECK-LABEL: a15_i32:
+// CHECK: #APP
+// CHECK: or a15, a15, a15
+// CHECK: #NO_APP
+check_explicit_reg!(a15_i32 i32 "a15" "mov");
+
+// CHECK-LABEL: f0_f32:
+// CHECK: #APP
+// CHECK: mov.s f0, f0
+// CHECK: #NO_APP
+check_explicit_reg!(f0_f32 f32 "f0" "mov.s");
+
+// CHECK-LABEL: f7_f32:
+// CHECK: #APP
+// CHECK: mov.s f7, f7
+// CHECK: #NO_APP
+check_explicit_reg!(f7_f32 f32 "f7" "mov.s");
+
+// CHECK-LABEL: f15_f32:
+// CHECK: #APP
+// CHECK: mov.s f15, f15
+// CHECK: #NO_APP
+check_explicit_reg!(f15_f32 f32 "f15" "mov.s");
+
+// Special/Boolean registers are clobber-only.
+macro_rules! check_clobber {
+    ($func:ident $reg:tt $insn:literal) => {
+        #[no_mangle]
+        pub unsafe fn $func(x: i32) {
+            asm!($insn, in(reg) x, out($reg) _);
+        }
+    };
+}
+
+// CHECK-LABEL: sar_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, sar
+// CHECK: #NO_APP
+check_clobber!(sar_clobber "sar" "wsr {0}, sar");
+
+// CHECK-LABEL: scompare1_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, scompare1
+// CHECK: #NO_APP
+check_clobber!(scompare1_clobber "scompare1" "wsr {0}, scompare1");
+
+// CHECK-LABEL: lbeg_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, lbeg
+// CHECK: #NO_APP
+check_clobber!(lbeg_clobber "lbeg" "wsr {0}, lbeg");
+
+// CHECK-LABEL: lend_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, lend
+// CHECK: #NO_APP
+check_clobber!(lend_clobber "lend" "wsr {0}, lend");
+
+// CHECK-LABEL: lcount_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, lcount
+// CHECK: #NO_APP
+check_clobber!(lcount_clobber "lcount" "wsr {0}, lcount");
+
+// CHECK-LABEL: acclo_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, acclo
+// CHECK: #NO_APP
+check_clobber!(acclo_clobber "acclo" "wsr {0}, acclo");
+
+// CHECK-LABEL: acchi_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, acchi
+// CHECK: #NO_APP
+check_clobber!(acchi_clobber "acchi" "wsr {0}, acchi");
+
+// CHECK-LABEL: m0_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, m0
+// CHECK: #NO_APP
+check_clobber!(m0_clobber "m0" "wsr {0}, m0");
+
+// CHECK-LABEL: m3_clobber:
+// CHECK: #APP
+// CHECK: wsr a{{[0-9]+}}, m3
+// CHECK: #NO_APP
+check_clobber!(m3_clobber "m3" "wsr {0}, m3");
+
+// Boolean registers are bits of BR; write them via `andb`.
+macro_rules! check_breg_clobber {
+    ($func:ident $reg:tt) => {
+        #[no_mangle]
+        pub unsafe fn $func() {
+            asm!(concat!("andb ", $reg, ", ", $reg, ", ", $reg), out($reg) _);
+        }
+    };
+}
+
+// CHECK-LABEL: b0_clobber:
+// CHECK: #APP
+// CHECK: andb b0, b0, b0
+// CHECK: #NO_APP
+check_breg_clobber!(b0_clobber "b0");
+
+// CHECK-LABEL: b7_clobber:
+// CHECK: #APP
+// CHECK: andb b7, b7, b7
+// CHECK: #NO_APP
+check_breg_clobber!(b7_clobber "b7");
+
+// CHECK-LABEL: b15_clobber:
+// CHECK: #APP
+// CHECK: andb b15, b15, b15
+// CHECK: #NO_APP
+check_breg_clobber!(b15_clobber "b15");
diff --git a/tests/codegen-llvm/bpf-allows-unaligned.rs b/tests/codegen-llvm/bpf-allows-unaligned.rs
index 7e95a56..c7a70d5 100644
--- a/tests/codegen-llvm/bpf-allows-unaligned.rs
+++ b/tests/codegen-llvm/bpf-allows-unaligned.rs
@@ -5,7 +5,7 @@
 
 #[no_mangle]
 #[target_feature(enable = "allows-misaligned-mem-access")]
-// CHECK: define noundef zeroext i8 @foo(i8 noundef returned %arg) unnamed_addr #0
+// CHECK: define noundef zeroext i8 @foo(i8 noundef returned %arg) unnamed_addr #0 {
 pub unsafe fn foo(arg: u8) -> u8 {
     arg
 }
diff --git a/tests/codegen-llvm/branch-protection.rs b/tests/codegen-llvm/branch-protection.rs
index 11847c2..ed1cb2c 100644
--- a/tests/codegen-llvm/branch-protection.rs
+++ b/tests/codegen-llvm/branch-protection.rs
@@ -22,7 +22,7 @@
 use minicore::*;
 
 // A basic test function.
-// CHECK: @test(){{.*}} [[ATTR:#[0-9]+]]
+// CHECK: @test(){{.*}} [[ATTR:#[0-9]+]] {
 #[no_mangle]
 pub fn test() {}
 
diff --git a/tests/codegen-llvm/cffi/c-variadic-opt.rs b/tests/codegen-llvm/cffi/c-variadic-opt.rs
index c779b25..9a15342 100644
--- a/tests/codegen-llvm/cffi/c-variadic-opt.rs
+++ b/tests/codegen-llvm/cffi/c-variadic-opt.rs
@@ -1,4 +1,5 @@
 //@ compile-flags: -C opt-level=3
+//@ ignore-bpf: BPF does not support C variadics
 
 #![crate_type = "lib"]
 #![feature(c_variadic)]
diff --git a/tests/codegen-llvm/copy.rs b/tests/codegen-llvm/copy.rs
new file mode 100644
index 0000000..201db1f
--- /dev/null
+++ b/tests/codegen-llvm/copy.rs
@@ -0,0 +1,17 @@
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
+//@ only-64bit (so I don't need to worry about usize)
+
+#![crate_type = "lib"]
+#![feature(core_intrinsics)]
+
+// This deals in a count of elements, not bytes, so we need to multiply.
+// Ensure we preserve UB from a count too high to be valid.
+use std::intrinsics::copy;
+
+// CHECK-LABEL: @copy_u16(
+#[no_mangle]
+pub unsafe fn copy_u16(src: *const u16, dst: *mut u16, count: usize) {
+    // CHECK: [[BYTES:%.+]] = mul nuw nsw i64 2, %count
+    // CHECK: call void @llvm.memmove.p0.p0.i64(ptr align 2 %dst, ptr align 2 %src, i64 [[BYTES]], i1 false)
+    copy(src, dst, count)
+}
diff --git a/tests/codegen-llvm/frame-pointer-cli-control.rs b/tests/codegen-llvm/frame-pointer-cli-control.rs
index 79cdfc7..911a5f0 100644
--- a/tests/codegen-llvm/frame-pointer-cli-control.rs
+++ b/tests/codegen-llvm/frame-pointer-cli-control.rs
@@ -45,7 +45,7 @@
 
 extern crate minicore;
 
-// CHECK: i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]]
+// CHECK: i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
 #[no_mangle]
 pub fn peach(x: u32) -> u32 {
     x
diff --git a/tests/codegen-llvm/frame-pointer.rs b/tests/codegen-llvm/frame-pointer.rs
index a52d95a..1d0dd76 100644
--- a/tests/codegen-llvm/frame-pointer.rs
+++ b/tests/codegen-llvm/frame-pointer.rs
@@ -18,7 +18,7 @@
 extern crate minicore;
 use minicore::*;
 
-// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]]
+// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
 #[no_mangle]
 pub fn peach(x: u32) -> u32 {
     x
diff --git a/tests/codegen-llvm/gpu-convergent.rs b/tests/codegen-llvm/gpu-convergent.rs
index 376d65a..bb9271a 100644
--- a/tests/codegen-llvm/gpu-convergent.rs
+++ b/tests/codegen-llvm/gpu-convergent.rs
@@ -17,7 +17,7 @@
     fn ext();
 }
 
-// CHECK: define {{.*}}_kernel void @fun(i32{{.*}}) unnamed_addr #[[ATTR:[0-9]+]]
+// CHECK: define {{.*}}_kernel void @fun(i32{{.*}}) unnamed_addr #[[ATTR:[0-9]+]] {
 // CHECK: declare void @ext() unnamed_addr #[[ATTR]]
 // CHECK: attributes #[[ATTR]] = {{.*}} convergent
 #[no_mangle]
diff --git a/tests/codegen-llvm/ilog_known_base.rs b/tests/codegen-llvm/ilog_known_base.rs
new file mode 100644
index 0000000..3f0cdd5
--- /dev/null
+++ b/tests/codegen-llvm/ilog_known_base.rs
@@ -0,0 +1,36 @@
+//@ compile-flags: -Copt-level=3
+// Test that `checked_ilog` can use a faster implementation when `base` is a
+// known power of two
+
+#![crate_type = "lib"]
+
+// CHECK-LABEL: @checked_ilog2
+#[no_mangle]
+pub fn checked_ilog2(val: u32) -> Option<u32> {
+    // CHECK: %[[ICMP:.+]] = icmp ne i32 %val, 0
+    // CHECK: %[[CTZ:.+]] = tail call range(i32 0, 33) i32 @llvm.ctlz.i32(i32 %val, i1 true)
+    // CHECK: %[[LOG2:.+]] = xor i32 %[[CTZ]], 31
+    val.checked_ilog(2)
+}
+
+// log(4, x) == log(2, x) / 2
+// CHECK-LABEL: @checked_ilog4
+#[no_mangle]
+pub fn checked_ilog4(val: u32) -> Option<u32> {
+    // CHECK: %[[ICMP:.+]] = icmp ne i32 %val, 0
+    // CHECK: %[[CTZ:.+]] = tail call range(i32 0, 33) i32 @llvm.ctlz.i32(i32 %val, i1 true)
+    // CHECK: %[[DIV2:.+]] = lshr i32 %[[CTZ]], 1
+    // CHECK: %[[LOG4:.+]] = xor i32 %[[DIV2]], 15
+    val.checked_ilog(4)
+}
+
+// log(16, x) == log(2, x) / 4
+// CHECK-LABEL: @checked_ilog16
+#[no_mangle]
+pub fn checked_ilog16(val: u32) -> Option<u32> {
+    // CHECK: %[[ICMP:.+]] = icmp ne i32 %val, 0
+    // CHECK: %[[CTZ:.+]] = tail call range(i32 0, 33) i32 @llvm.ctlz.i32(i32 %val, i1 true)
+    // CHECK: %[[DIV4:.+]] = lshr i32 %[[CTZ]], 2
+    // CHECK: %[[LOG16:.+]] = xor i32 %[[DIV2]], 7
+    val.checked_ilog(16)
+}
diff --git a/tests/codegen-llvm/instrument-coverage/testprog.rs b/tests/codegen-llvm/instrument-coverage/testprog.rs
index 67c49c4..ef61ede 100644
--- a/tests/codegen-llvm/instrument-coverage/testprog.rs
+++ b/tests/codegen-llvm/instrument-coverage/testprog.rs
@@ -101,7 +101,7 @@ fn main() {
 // CHECK-SAME:   @__llvm_prf_nm
 // CHECK-SAME:   section "llvm.metadata"
 
-// CHECK:        define internal { {{.*}} } @_R{{[a-zA-Z0-9_]+}}testprog14will_be_called() unnamed_addr #{{[0-9]+}}
+// CHECK:        define internal { {{.*}} } @_R{{[a-zA-Z0-9_]+}}testprog14will_be_called() unnamed_addr #{{[0-9]+}} {
 // CHECK-NEXT:   start:
 // CHECK-NOT:    define internal
 // CHECK:        atomicrmw add ptr
@@ -109,7 +109,7 @@ fn main() {
 
 // CHECK:        declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #[[LLVM_INSTRPROF_INCREMENT_ATTR:[0-9]+]]
 
-// WIN:          define linkonce_odr hidden i32 @__llvm_profile_runtime_user() #[[LLVM_PROFILE_RUNTIME_USER_ATTR:[0-9]+]] comdat {{.*}}
+// WIN:          define linkonce_odr hidden i32 @__llvm_profile_runtime_user() #[[LLVM_PROFILE_RUNTIME_USER_ATTR:[0-9]+]] comdat {{.*}}{
 // WIN-NEXT:     %1 = load i32, ptr @__llvm_profile_runtime
 // WIN-NEXT:     ret i32 %1
 // WIN-NEXT:     }
diff --git a/tests/codegen-llvm/intrinsics/copy_nonoverlapping.rs b/tests/codegen-llvm/intrinsics/copy_nonoverlapping.rs
new file mode 100644
index 0000000..84a1f71
--- /dev/null
+++ b/tests/codegen-llvm/intrinsics/copy_nonoverlapping.rs
@@ -0,0 +1,17 @@
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
+//@ only-64bit (so I don't need to worry about usize)
+
+#![crate_type = "lib"]
+#![feature(core_intrinsics)]
+
+// This deals in a count of elements, not bytes, so we need to multiply.
+// Ensure we preserve UB from a count too high to be valid.
+use std::intrinsics::copy_nonoverlapping;
+
+// CHECK-LABEL: @copy_u16(
+#[no_mangle]
+pub unsafe fn copy_u16(src: *const u16, dst: *mut u16, count: usize) {
+    // CHECK: [[BYTES:%.+]] = mul nuw nsw i64 %count, 2
+    // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 2 %dst, ptr align 2 %src, i64 [[BYTES]], i1 false)
+    copy_nonoverlapping(src, dst, count)
+}
diff --git a/tests/codegen-llvm/link_section.rs b/tests/codegen-llvm/link_section.rs
index 61bde68..f196ea8 100644
--- a/tests/codegen-llvm/link_section.rs
+++ b/tests/codegen-llvm/link_section.rs
@@ -29,7 +29,7 @@ pub enum E {
 #[link_section = "__TEST,three"]
 pub static VAR3: E = E::B(1.);
 
-// CHECK: define {{(dso_local )?}}void @fn1() {{.*}} section "__TEST,four"
+// CHECK: define {{(dso_local )?}}void @fn1() {{.*}} section "__TEST,four" {
 #[no_mangle]
 #[link_section = "__TEST,four"]
 pub fn fn1() {}
diff --git a/tests/codegen-llvm/pow_known_base.rs b/tests/codegen-llvm/pow_known_base.rs
new file mode 100644
index 0000000..ea0e405
--- /dev/null
+++ b/tests/codegen-llvm/pow_known_base.rs
@@ -0,0 +1,58 @@
+//@ compile-flags: -Copt-level=3
+// Test that `pow` can use a faster implementation when `base` is a
+// known power of two
+
+#![crate_type = "lib"]
+
+// 2 ** n == 2 ** (1 * n) == 1 << (1 * n)
+// CHECK-LABEL: @pow2
+#[no_mangle]
+pub fn pow2(exp: u32) -> u32 {
+    // CHECK: %[[OVERFLOW:.+]] = icmp ult i32 %exp, 32
+    // CHECK: %[[POW:.+]] = shl nuw i32 1, %exp
+    // CHECK: %[[RET:.+]] = select i1 %[[OVERFLOW]], i32 %[[POW]], i32 0
+    // CHECK: ret i32 %[[RET]]
+    2u32.pow(exp)
+}
+
+// 4 ** n == 2 ** (2 * n) == 1 << (2 * n)
+// CHECK-LABEL: @pow4
+#[no_mangle]
+pub fn pow4(exp: u32) -> u32 {
+    // CHECK: %[[ICMP1:.+]] = icmp slt i32 %exp, 0
+    // CHECK: %[[SHIFT_AMOUNT:.+]] = shl i32 %exp, 1
+    // CHECK: %[[ICMP2:.+]] = icmp ult i32 %[[SHIFT_AMOUNT]], 32
+    // CHECK: %[[POW:.+]] = shl nuw i32 1, %[[SHIFT_AMOUNT]]
+    // CHECK: %[[SEL:.+]] = select i1 %[[ICMP2]], i32 %[[POW]], i32 0
+    // CHECK: %[[RET:.+]] = select i1 %[[ICMP1]], i32 0, i32 %[[SEL]]
+    // CHECK: ret i32 %[[RET]]
+    4u32.pow(exp)
+}
+
+// 16 ** n == 2 ** (4 * n) == 1 << (4 * n)
+// CHECK-LABEL: @pow16
+#[no_mangle]
+pub fn pow16(exp: u32) -> u32 {
+    // CHECK: %[[ICMP1:.+]] = icmp ugt i32 %exp, 1073741823
+    // CHECK: %[[SHIFT_AMOUNT:.+]] = shl i32 %exp, 2
+    // CHECK: %[[ICMP2:.+]] = icmp ult i32 %[[SHIFT_AMOUNT]], 32
+    // CHECK: %[[POW:.+]] = shl nuw i32 1, %[[SHIFT_AMOUNT]]
+    // CHECK: %[[SEL:.+]] = select i1 %[[ICMP2]], i32 %[[POW]], i32 0
+    // CHECK: %[[RET:.+]] = select i1 %[[ICMP1]], i32 0, i32 %[[SEL]]
+    // CHECK: ret i32 %[[RET]]
+    16u32.pow(exp)
+}
+
+// (-2) ** n == (-2) ** (1 * n) == 1 << (1 * n)
+// CHECK-LABEL: @pow_minus_2
+#[no_mangle]
+pub fn pow_minus_2(exp: u32) -> i32 {
+    // CHECK: %[[IS_ODD:.+]] = and i32 %exp, 1
+    // CHECK: %[[IS_EVEN:.+]] = icmp eq i32 %[[IS_ODD]], 0
+    // CHECK: %[[BASE:.+]] = select i1 %[[IS_EVEN]], i32 1, i32 -1
+    // CHECK: %[[OVERFLOW:.+]] = icmp ult i32 %exp, 32
+    // CHECK: %[[SHIFT:.+]] = shl i32 %[[BASE]], %exp
+    // CHECK: %[[RET:.+]] = select i1 %[[OVERFLOW]], i32 %[[SHIFT]], i32 0
+    // CHECK: ret i32 %[[RET]]
+    (-2i32).pow(exp)
+}
diff --git a/tests/codegen-llvm/preserve-none.rs b/tests/codegen-llvm/preserve-none.rs
index b45e49a..b8c8db2 100644
--- a/tests/codegen-llvm/preserve-none.rs
+++ b/tests/codegen-llvm/preserve-none.rs
@@ -19,7 +19,7 @@
 // UNSUPPORTED: define{{( dso_local)?}} void @peach(i16
 #[no_mangle]
 #[inline(never)]
-pub extern "rust-preserve-none" fn peach(x: u16) {
+pub extern "rust-preserve-none" fn peach(_: u16) {
     loop {}
 }
 
diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs
index 5b1aa97..7639ce7 100644
--- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs
+++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs
@@ -7,21 +7,21 @@
 
 pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
     // CHECK-LABEL: define{{.*}}foo
-    // CHECK-SAME:  {{.*}}!type ![[TYPE1:[0-9]+]]
+    // CHECK-SAME:  {{.*}}![[TYPE1:[0-9]+]]
     // CHECK:       call i1 @llvm.type.test(ptr {{%f|%0}}, metadata !"_ZTSFu3i32S_E.normalized.generalized")
     f(arg)
 }
 
 pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 {
     // CHECK-LABEL: define{{.*}}bar
-    // CHECK-SAME:  {{.*}}!type ![[TYPE2:[0-9]+]]
+    // CHECK-SAME:  {{.*}}![[TYPE2:[0-9]+]]
     // CHECK:       call i1 @llvm.type.test(ptr {{%f|%0}}, metadata !"_ZTSFu3i32S_S_E.normalized.generalized")
     f(arg1, arg2)
 }
 
 pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 {
     // CHECK-LABEL: define{{.*}}baz
-    // CHECK-SAME:  {{.*}}!type ![[TYPE3:[0-9]+]]
+    // CHECK-SAME:  {{.*}}![[TYPE3:[0-9]+]]
     // CHECK:       call i1 @llvm.type.test(ptr {{%f|%0}}, metadata !"_ZTSFu3i32S_S_S_E.normalized.generalized")
     f(arg1, arg2, arg3)
 }
diff --git a/tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs b/tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs
index 3df2d56..35317b0 100644
--- a/tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs
+++ b/tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs
@@ -72,7 +72,7 @@ pub unsafe fn some_non_zero_from_atomic_get() -> Option<NonZeroUsize> {
 ///
 /// The way we check that the LLVM IR is correct is by making sure that neither
 /// `panic` nor `unreachable` is part of the LLVM IR:
-// CHECK-LABEL: define {{.*}} i64 @some_non_zero_from_atomic_get2() {{.*}}
+// CHECK-LABEL: define {{.*}} i64 @some_non_zero_from_atomic_get2() {{.*}} {
 // CHECK-NOT: panic
 // CHECK-NOT: unreachable
 #[no_mangle]
diff --git a/tests/codegen-llvm/str-range-indexing.rs b/tests/codegen-llvm/str-range-indexing.rs
index 5fa8e0d..57fd886 100644
--- a/tests/codegen-llvm/str-range-indexing.rs
+++ b/tests/codegen-llvm/str-range-indexing.rs
@@ -18,18 +18,19 @@ pub fn $index_func_name(slice: &str, range: $range_ty) -> &str {
     };
 }
 
-// 9 comparisons required:
-// start <= end
-// && (start == 0 || (start >= len && start == len) || bytes[start] >= -0x40)
-// && (end   == 0 || (end   >= len && end   == len) || bytes[end]   >= -0x40)
+// 7 comparisons required:
+// start <= end && end <= len
+// && (start == len ||
+// (  (start == 0   || bytes[start] >= -0x40)
+// && (end   == len || bytes[end] >= -0x40)))
 
 // CHECK-LABEL: @get_range
-// CHECK-COUNT-9: %{{.+}} = icmp
+// CHECK-COUNT-7: %{{.+}} = icmp
 // CHECK-NOT: %{{.+}} = icmp
 // CHECK: ret
 
 // CHECK-LABEL: @index_range
-// CHECK-COUNT-9: %{{.+}} = icmp
+// CHECK-COUNT-7: %{{.+}} = icmp
 // CHECK-NOT: %{{.+}} = icmp
 // CHECK: ret
 tests!(Range<usize>, get_range, index_range);
diff --git a/tests/codegen-llvm/tailcc.rs b/tests/codegen-llvm/tailcc.rs
new file mode 100644
index 0000000..15ae69c
--- /dev/null
+++ b/tests/codegen-llvm/tailcc.rs
@@ -0,0 +1,28 @@
+//@ add-minicore
+//@ revisions: I586 X86_64 AARCH64
+//@ [I586] compile-flags: -C no-prepopulate-passes --target=i586-unknown-linux-gnu
+//@ [I586] needs-llvm-components: x86
+//@ [X86_64] compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu
+//@ [X86_64] needs-llvm-components: x86
+//@ [AARCH64] compile-flags: -C no-prepopulate-passes --target=aarch64-unknown-linux-gnu
+//@ [AARCH64] needs-llvm-components: aarch64
+
+#![crate_type = "lib"]
+#![feature(no_core, rust_tail_cc, explicit_tail_calls)]
+#![no_core]
+
+extern crate minicore;
+
+// CHECK: define{{( dso_local)?}} tailcc void @peach(i16
+#[no_mangle]
+#[inline(never)]
+pub extern "tail" fn peach(_: u16) {
+    loop {}
+}
+
+// CHECK: call tailcc void @peach(i16
+pub fn quince(x: u16) {
+    if let 12345u16 = x {
+        peach(54321);
+    }
+}
diff --git a/tests/codegen-llvm/target-feature-negative-implication.rs b/tests/codegen-llvm/target-feature-negative-implication.rs
index 3765997..a9cdca4 100644
--- a/tests/codegen-llvm/target-feature-negative-implication.rs
+++ b/tests/codegen-llvm/target-feature-negative-implication.rs
@@ -13,7 +13,7 @@
 #[no_mangle]
 pub unsafe fn banana() {
     // CHECK-LABEL: @banana()
-    // CHECK-SAME: [[BANANAATTRS:#[0-9]+]]
+    // CHECK-SAME: [[BANANAATTRS:#[0-9]+]] {
 }
 
 // CHECK: attributes [[BANANAATTRS]]
diff --git a/tests/codegen-llvm/target-feature-overrides.rs b/tests/codegen-llvm/target-feature-overrides.rs
index 3bf05c7..2adc8ee 100644
--- a/tests/codegen-llvm/target-feature-overrides.rs
+++ b/tests/codegen-llvm/target-feature-overrides.rs
@@ -23,7 +23,7 @@
 #[no_mangle]
 pub unsafe fn apple() -> u32 {
     // CHECK-LABEL: @apple()
-    // CHECK-SAME: [[APPLEATTRS:#[0-9]+]]
+    // CHECK-SAME: [[APPLEATTRS:#[0-9]+]] {
     // CHECK: {{.*}}call{{.*}}@peach
     peach()
 }
@@ -32,7 +32,7 @@ pub unsafe fn apple() -> u32 {
 #[no_mangle]
 pub unsafe fn banana() -> u32 {
     // CHECK-LABEL: @banana()
-    // CHECK-SAME: [[BANANAATTRS:#[0-9]+]]
+    // CHECK-SAME: [[BANANAATTRS:#[0-9]+]] {
     // COMPAT: {{.*}}call{{.*}}@peach
     // INCOMPAT: {{.*}}call{{.*}}@apple
     apple() // Compatible for inline in COMPAT revision and can't be inlined in INCOMPAT
diff --git a/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs
index 279780e..ecace72 100644
--- a/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs
@@ -16,11 +16,11 @@ pub trait Sized: MetaSized {}
 // `aapcs-unwind` extern functions. `aapcs-unwind` functions MUST NOT have this attribute. We
 // disable optimizations above to prevent LLVM from inferring the attribute.
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "aapcs" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "aapcs-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs
index 1b33128..46c08b5 100644
--- a/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs
@@ -7,11 +7,11 @@
 
 #![crate_type = "lib"]
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "C" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "C-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs
index 6f4eafb..8e643d6 100644
--- a/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs
@@ -7,11 +7,11 @@
 
 #![crate_type = "lib"]
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "cdecl" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "cdecl-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs
index 51c6fd1..7df4681 100644
--- a/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs
@@ -16,11 +16,11 @@ pub trait Sized: MetaSized {}
 // `fastcall-unwind` extern functions. `fastcall-unwind` functions MUST NOT have this attribute. We
 // disable optimizations above to prevent LLVM from inferring the attribute.
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "fastcall" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "fastcall-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs
index b5fcea5..cc06ee1 100644
--- a/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs
@@ -16,11 +16,11 @@ pub trait Sized: MetaSized {}
 // extern functions. `stdcall-unwind` functions MUST NOT have this attribute. We disable
 // optimizations above to prevent LLVM from inferring the attribute.
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "stdcall" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "stdcall-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs
index 15fce95f..5f91024 100644
--- a/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs
@@ -7,11 +7,11 @@
 
 #![crate_type = "lib"]
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "system" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "system-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs
index 1293e7c..69bfaf8 100644
--- a/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs
@@ -16,11 +16,11 @@ pub trait Sized: MetaSized {}
 // `sysv64-unwind` extern functions. `sysv64-unwind` functions MUST NOT have this attribute. We
 // disable optimizations above to prevent LLVM from inferring the attribute.
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "sysv64" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "sysv64-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs
index a9b6c34..05f6b8b 100644
--- a/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs
@@ -16,11 +16,11 @@ pub trait Sized: MetaSized {}
 // `thiscall-unwind` extern functions. `thiscall-unwind` functions MUST NOT have this attribute. We
 // disable optimizations above to prevent LLVM from inferring the attribute.
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "thiscall" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "thiscall-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs
index 8cedb55..d001a16 100644
--- a/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs
@@ -16,11 +16,11 @@ pub trait Sized: MetaSized {}
 // `vectorcall-unwind` extern functions. `vectorcall-unwind` functions MUST NOT have this attribute.
 // We disable optimizations above to prevent LLVM from inferring the attribute.
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "vectorcall" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "vectorcall-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs
index 2a3ad33..257f00b 100644
--- a/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs
+++ b/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs
@@ -16,11 +16,11 @@ pub trait Sized: MetaSized {}
 // `win64-unwind` extern functions. `win64-unwind` functions MUST NOT have this attribute. We
 // disable optimizations above to prevent LLVM from inferring the attribute.
 
-// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0
+// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 {
 #[no_mangle]
 pub extern "win64" fn rust_item_that_cannot_unwind() {}
 
-// CHECK: @rust_item_that_can_unwind() unnamed_addr #1
+// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 {
 #[no_mangle]
 pub extern "win64-unwind" fn rust_item_that_can_unwind() {}
 
diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs
index bf31029..3ecaf02 100644
--- a/tests/debuginfo/pretty-std.rs
+++ b/tests/debuginfo/pretty-std.rs
@@ -109,12 +109,15 @@
 //@ cdb-check:    [10]             : 103 'g' [Type: char]
 //@ cdb-check:    [11]             : 33 '!' [Type: char]
 
-//@ cdb-command: dx os_string
-// NOTE: OSString is WTF-8 encoded which Windows debuggers don't understand. Verify the UTF-8
-//       portion displays correctly.
-//@ cdb-check:os_string        : "IAMA OS string [...]" [Type: std::ffi::os_str::OsString]
-//@ cdb-check:    [<Raw View>]     [Type: std::ffi::os_str::OsString]
-//@ cdb-check:    [chars]          : "IAMA OS string [...]"
+// FIXME(#88840, #148743, #88796): since approx. Windows SDK 20348, the corresponding cdb (and/or
+// its underlying WinDbg engine) changed or regressed the `OsStr`/`OsString` visualization, and no
+// longer renders the emoji. Since approx. 26100, the output formatting of the string containing
+// UTF-8 (i.e. the multi-byte emoji grapheme) seems to have further regressed (e.g. the end
+// quotation mark is no longer shown and command output becomes garbled).
+//(DISABLED) @ cdb-command: dx os_string
+//(DISABLED) @ cdb-check:os_string        : "IAMA OS string 😃" [Type: std::ffi::os_str::OsString]
+//(DISABLED) @ cdb-check:    [<Raw View>]     [Type: std::ffi::os_str::OsString]
+//(DISABLED) @ cdb-check:    [chars]          : "IAMA OS string 😃"
 
 //@ cdb-command: dx some
 //@ cdb-check:some             : Some [Type: enum2$<core::option::Option<i16> >]
diff --git "a/tests/mir-opt/coroutine/async_await.a-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_await.a-\173closure\0430\175.StateTransform.diff"
index dddd66e..0d89336 100644
--- "a/tests/mir-opt/coroutine/async_await.a-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_await.a-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,8 @@
 - fn a::{closure#0}(_1: {async fn body of a()}, _2: std::future::ResumeTy) -> ()
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     let mut _0: ();
 + fn a::{closure#0}(_1: Pin<&mut {async fn body of a()}>, _2: &mut Context<'_>) -> Poll<()> {
 +     coroutine layout {
 +         variant_fields = {
@@ -13,16 +15,19 @@
 +         }
 +         storage_conflicts = BitMatrix(0x0) {}
 +     }
-      debug _task_context => _2;
--     let mut _0: ();
++     debug _task_context => _6;
 +     let mut _0: std::task::Poll<()>;
 +     let mut _3: ();
 +     let mut _4: u32;
 +     let mut _5: &mut {async fn body of a()};
++     let mut _6: std::future::ResumeTy;
++     let mut _7: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         _0 = const ();
 -         drop(_1) -> [return: bb1, unwind: bb2];
++         _7 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _6 = std::future::ResumeTy(move _7);
 +         _5 = copy (_1.0: &mut {async fn body of a()});
 +         _4 = discriminant((*_5));
 +         switchInt(move _4) -> [0: bb5, 1: bb3, otherwise: bb4];
diff --git "a/tests/mir-opt/coroutine/async_await.b-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_await.b-\173closure\0430\175.StateTransform.diff"
index fdbc67d..a97366e7c 100644
--- "a/tests/mir-opt/coroutine/async_await.b-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_await.b-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,8 @@
 - fn b::{closure#0}(_1: {async fn body of b()}, _2: std::future::ResumeTy) -> ()
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     let mut _0: ();
 + fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) -> Poll<()> {
 +     coroutine layout {
 +         field _s0: {async fn body of a()};
@@ -17,8 +19,7 @@
 +         }
 +         storage_conflicts = BitMatrix(2x2) {(_s0, _s0), (_s1, _s1)}
 +     }
-      debug _task_context => _2;
--     let mut _0: ();
++     debug _task_context => _40;
 +     coroutine debug __awaitee => _s0;
 +     coroutine debug __awaitee => _s1;
 +     let mut _0: std::task::Poll<()>;
@@ -34,12 +35,10 @@
       let mut _12: &mut {async fn body of a()};
       let mut _13: &mut std::task::Context<'_>;
       let mut _14: &mut std::task::Context<'_>;
--     let mut _15: std::future::ResumeTy;
-+     let mut _15: &mut std::task::Context<'_>;
+      let mut _15: std::future::ResumeTy;
       let mut _16: isize;
       let mut _18: !;
--     let mut _19: std::future::ResumeTy;
-+     let mut _19: &mut std::task::Context<'_>;
+      let mut _19: std::future::ResumeTy;
       let mut _20: ();
       let mut _21: {async fn body of a()};
       let mut _22: {async fn body of a()};
@@ -51,16 +50,16 @@
       let mut _28: &mut {async fn body of a()};
       let mut _29: &mut std::task::Context<'_>;
       let mut _30: &mut std::task::Context<'_>;
--     let mut _31: std::future::ResumeTy;
-+     let mut _31: &mut std::task::Context<'_>;
+      let mut _31: std::future::ResumeTy;
       let mut _32: isize;
       let mut _34: !;
--     let mut _35: std::future::ResumeTy;
-+     let mut _35: &mut std::task::Context<'_>;
+      let mut _35: std::future::ResumeTy;
       let mut _36: ();
 +     let mut _37: ();
 +     let mut _38: u32;
 +     let mut _39: &mut {async fn body of b()};
++     let mut _40: std::future::ResumeTy;
++     let mut _41: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug __awaitee => _6;
 +         debug __awaitee => (((*_39) as variant#3).0: {async fn body of a()});
@@ -83,6 +82,8 @@
 -         StorageLive(_4);
 -         StorageLive(_5);
 -         _5 = a() -> [return: bb1, unwind: bb47];
++         _41 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _40 = std::future::ResumeTy(move _41);
 +         _39 = copy (_1.0: &mut {async fn body of b()});
 +         _38 = discriminant((*_39));
 +         switchInt(move _38) -> [0: bb47, 1: bb46, 2: bb45, 3: bb43, 4: bb44, otherwise: bb7];
@@ -121,9 +122,10 @@
           StorageLive(_13);
           StorageLive(_14);
           StorageLive(_15);
-          _15 = copy _2;
+-         _15 = copy _2;
 -         _14 = std::future::get_context::<'_, '_>(move _15) -> [return: bb5, unwind: bb41];
-+         _14 = move _15;
++         _15 = copy _40;
++         _14 = copy (_15.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb5;
       }
   
@@ -180,7 +182,8 @@
   
       bb10: {
           StorageDead(_20);
-          _2 = move _19;
+-         _2 = move _19;
++         _40 = move _19;
           StorageDead(_19);
           _7 = const ();
           goto -> bb3;
@@ -234,9 +237,10 @@
           StorageLive(_29);
           StorageLive(_30);
           StorageLive(_31);
-          _31 = copy _2;
+-         _31 = copy _2;
 -         _30 = std::future::get_context::<'_, '_>(move _31) -> [return: bb17, unwind: bb33];
-+         _30 = move _31;
++         _31 = copy _40;
++         _30 = copy (_31.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb17;
       }
   
@@ -289,7 +293,8 @@
   
       bb21: {
           StorageDead(_36);
-          _2 = move _35;
+-         _2 = move _35;
++         _40 = move _35;
           StorageDead(_35);
           _7 = const ();
           goto -> bb15;
@@ -501,7 +506,7 @@
 +         StorageLive(_4);
 +         StorageLive(_19);
 +         StorageLive(_20);
-+         _19 = move _2;
++         _19 = move _40;
 +         goto -> bb10;
       }
   
@@ -512,7 +517,7 @@
 +         StorageLive(_21);
 +         StorageLive(_35);
 +         StorageLive(_36);
-+         _35 = move _2;
++         _35 = move _40;
 +         goto -> bb21;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncEnum.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncEnum.StateTransform.diff"
index aedc5a0..8e6c685 100644
--- "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncEnum.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncEnum.StateTransform.diff"
@@ -26,35 +26,29 @@
 +     let mut _0: std::task::Poll<()>;
       let mut _3: &mut AsyncEnum;
       let mut _4: impl std::future::Future<Output = ()>;
--     let mut _5: std::future::ResumeTy;
-+     let mut _5: &mut std::task::Context<'_>;
+      let mut _5: std::future::ResumeTy;
       let mut _6: std::task::Poll<()>;
       let mut _7: isize;
       let mut _8: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _9: &mut std::task::Context<'_>;
--     let mut _10: std::future::ResumeTy;
-+     let mut _10: &mut std::task::Context<'_>;
+      let mut _10: std::future::ResumeTy;
       let mut _11: &mut impl std::future::Future<Output = ()>;
       let mut _12: std::pin::Pin<&mut AsyncInt>;
       let mut _13: &mut AsyncInt;
       let mut _14: impl std::future::Future<Output = ()>;
--     let mut _15: std::future::ResumeTy;
-+     let mut _15: &mut std::task::Context<'_>;
+      let mut _15: std::future::ResumeTy;
       let mut _16: std::task::Poll<()>;
       let mut _17: isize;
       let mut _18: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _19: &mut std::task::Context<'_>;
--     let mut _20: std::future::ResumeTy;
-+     let mut _20: &mut std::task::Context<'_>;
+      let mut _20: std::future::ResumeTy;
       let mut _21: &mut impl std::future::Future<Output = ()>;
--     let mut _22: std::future::ResumeTy;
-+     let mut _22: &mut std::task::Context<'_>;
+      let mut _22: std::future::ResumeTy;
       let mut _23: std::task::Poll<()>;
       let mut _24: isize;
       let mut _25: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _26: &mut std::task::Context<'_>;
--     let mut _27: std::future::ResumeTy;
-+     let mut _27: &mut std::task::Context<'_>;
+      let mut _27: std::future::ResumeTy;
       let mut _28: &mut impl std::future::Future<Output = ()>;
       let mut _29: std::pin::Pin<&mut AsyncInt>;
       let mut _30: &mut AsyncInt;
@@ -62,23 +56,19 @@
       let mut _32: isize;
       let mut _33: isize;
       let mut _34: impl std::future::Future<Output = ()>;
--     let mut _35: std::future::ResumeTy;
-+     let mut _35: &mut std::task::Context<'_>;
+      let mut _35: std::future::ResumeTy;
       let mut _36: std::task::Poll<()>;
       let mut _37: isize;
       let mut _38: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _39: &mut std::task::Context<'_>;
--     let mut _40: std::future::ResumeTy;
-+     let mut _40: &mut std::task::Context<'_>;
+      let mut _40: std::future::ResumeTy;
       let mut _41: &mut impl std::future::Future<Output = ()>;
--     let mut _42: std::future::ResumeTy;
-+     let mut _42: &mut std::task::Context<'_>;
+      let mut _42: std::future::ResumeTy;
       let mut _43: std::task::Poll<()>;
       let mut _44: isize;
       let mut _45: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _46: &mut std::task::Context<'_>;
--     let mut _47: std::future::ResumeTy;
-+     let mut _47: &mut std::task::Context<'_>;
+      let mut _47: std::future::ResumeTy;
       let mut _48: &mut impl std::future::Future<Output = ()>;
       let mut _49: std::pin::Pin<&mut AsyncEnum>;
       let mut _50: &mut AsyncEnum;
@@ -92,11 +82,15 @@
 +     let mut _58: &mut AsyncEnum;
 +     let mut _59: &mut AsyncEnum;
 +     let mut _60: &mut AsyncEnum;
++     let _61: std::future::ResumeTy;
++     let mut _62: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         _3 = move (_1.0: &mut AsyncEnum);
 -         _50 = &mut (*_3);
 -         _49 = Pin::<&mut AsyncEnum>::new_unchecked(move _50) -> [return: bb59, unwind: bb40];
++         _62 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _61 = std::future::ResumeTy(move _62);
 +         _53 = copy (_1.0: &mut {async fn body of std::future::async_drop_in_place<AsyncEnum>()});
 +         _52 = discriminant((*_53));
 +         switchInt(move _52) -> [0: bb42, 1: bb41, 2: bb40, 3: bb35, 4: bb36, 5: bb37, 6: bb38, 7: bb39, otherwise: bb7];
@@ -136,7 +130,7 @@
   
       bb6: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb6, unwind: bb5];
-+         _2 = move _5;
++         _61 = move _5;
 +         StorageDead(_5);
 +         goto -> bb5;
       }
@@ -172,14 +166,14 @@
       bb11: {
 -         _7 = discriminant(_6);
 -         switchInt(move _7) -> [0: bb4, 1: bb9, otherwise: bb10];
-+         _2 = move _15;
++         _61 = move _15;
 +         StorageDead(_15);
 +         goto -> bb10;
       }
   
       bb12: {
 -         _6 = <impl Future<Output = ()> as Future>::poll(move _8, move _9) -> [return: bb11, unwind: bb5];
-+         _2 = move _22;
++         _61 = move _22;
 +         StorageDead(_22);
 +         goto -> bb17;
       }
@@ -210,8 +204,8 @@
       bb16: {
 -         _13 = &mut (((*_3) as A).0: AsyncInt);
 -         _12 = Pin::<&mut AsyncInt>::new_unchecked(move _13) -> [return: bb15, unwind: bb2];
-+         _27 = move _2;
-+         _26 = move _27;
++         _27 = move _61;
++         _26 = copy (_27.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb15;
       }
   
@@ -288,7 +282,7 @@
       bb26: {
 -         _20 = move _2;
 -         _19 = std::future::get_context::<'_, '_>(move _20) -> [return: bb25, unwind: bb19];
-+         _2 = move _35;
++         _61 = move _35;
 +         StorageDead(_35);
 +         goto -> bb25;
       }
@@ -296,7 +290,7 @@
       bb27: {
 -         _21 = &mut _14;
 -         _18 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _21) -> [return: bb26, unwind: bb19];
-+         _2 = move _42;
++         _61 = move _42;
 +         StorageDead(_42);
 +         goto -> bb32;
       }
@@ -329,8 +323,8 @@
       bb31: {
 -         _24 = discriminant(_23);
 -         switchInt(move _24) -> [0: bb17, 1: bb30, otherwise: bb10];
-+         _47 = move _2;
-+         _46 = move _47;
++         _47 = move _61;
++         _46 = copy (_47.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb30;
       }
   
@@ -359,7 +353,7 @@
 -         StorageLive(_14);
 -         _14 = async_drop_in_place::<AsyncInt>(copy (_29.0: &mut AsyncInt)) -> [return: bb34, unwind: bb19];
 +         StorageLive(_5);
-+         _5 = move _2;
++         _5 = move _61;
 +         goto -> bb6;
       }
   
@@ -367,7 +361,7 @@
 -         _30 = &mut (((*_3) as A).0: AsyncInt);
 -         _29 = Pin::<&mut AsyncInt>::new_unchecked(move _30) -> [return: bb35, unwind: bb2];
 +         StorageLive(_15);
-+         _15 = move _2;
++         _15 = move _61;
 +         goto -> bb11;
       }
   
@@ -375,21 +369,21 @@
 -         drop((((*_3) as B).0: SyncInt)) -> [return: bb2, unwind terminate(cleanup)];
 +     bb37: {
 +         StorageLive(_22);
-+         _22 = move _2;
++         _22 = move _61;
 +         goto -> bb12;
       }
   
       bb38: {
 -         drop((((*_3) as B).0: SyncInt)) -> [return: bb1, unwind: bb2];
 +         StorageLive(_35);
-+         _35 = move _2;
++         _35 = move _61;
 +         goto -> bb26;
       }
   
       bb39: {
 -         drop((((*_3) as B).0: SyncInt)) -> [return: bb1, unwind: bb2];
 +         StorageLive(_42);
-+         _42 = move _2;
++         _42 = move _61;
 +         goto -> bb27;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncInt.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncInt.StateTransform.diff"
index f384928..015c275 100644
--- "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncInt.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncInt.StateTransform.diff"
@@ -20,34 +20,34 @@
 +     let mut _0: std::task::Poll<()>;
       let mut _3: &mut AsyncInt;
       let mut _4: impl std::future::Future<Output = ()>;
--     let mut _5: std::future::ResumeTy;
-+     let mut _5: &mut std::task::Context<'_>;
+      let mut _5: std::future::ResumeTy;
       let mut _6: std::task::Poll<()>;
       let mut _7: isize;
       let mut _8: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _9: &mut std::task::Context<'_>;
--     let mut _10: std::future::ResumeTy;
-+     let mut _10: &mut std::task::Context<'_>;
+      let mut _10: std::future::ResumeTy;
       let mut _11: &mut impl std::future::Future<Output = ()>;
--     let mut _12: std::future::ResumeTy;
-+     let mut _12: &mut std::task::Context<'_>;
+      let mut _12: std::future::ResumeTy;
       let mut _13: std::task::Poll<()>;
       let mut _14: isize;
       let mut _15: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _16: &mut std::task::Context<'_>;
--     let mut _17: std::future::ResumeTy;
-+     let mut _17: &mut std::task::Context<'_>;
+      let mut _17: std::future::ResumeTy;
       let mut _18: &mut impl std::future::Future<Output = ()>;
       let mut _19: std::pin::Pin<&mut AsyncInt>;
       let mut _20: &mut AsyncInt;
 +     let mut _21: ();
 +     let mut _22: u32;
 +     let mut _23: &mut {async fn body of std::future::async_drop_in_place<AsyncInt>()};
++     let _24: std::future::ResumeTy;
++     let mut _25: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         _3 = move (_1.0: &mut AsyncInt);
 -         _20 = &mut (*_3);
 -         _19 = Pin::<&mut AsyncInt>::new_unchecked(move _20) -> [return: bb22, unwind: bb2];
++         _25 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _24 = std::future::ResumeTy(move _25);
 +         _23 = copy (_1.0: &mut {async fn body of std::future::async_drop_in_place<AsyncInt>()});
 +         _22 = discriminant((*_23));
 +         switchInt(move _22) -> [0: bb20, 1: bb19, 2: bb18, 3: bb16, 4: bb17, otherwise: bb7];
@@ -87,7 +87,7 @@
   
       bb6: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb6, unwind: bb5];
-+         _2 = move _5;
++         _24 = move _5;
 +         StorageDead(_5);
 +         goto -> bb5;
       }
@@ -103,7 +103,7 @@
 -         _2 = move _5;
 -         StorageDead(_5);
 -         goto -> bb14;
-+         _2 = move _12;
++         _24 = move _12;
 +         StorageDead(_12);
 +         goto -> bb13;
       }
@@ -132,8 +132,8 @@
   
       bb12: {
 -         _6 = <impl Future<Output = ()> as Future>::poll(move _8, move _9) -> [return: bb11, unwind: bb5];
-+         _17 = move _2;
-+         _16 = move _17;
++         _17 = move _24;
++         _16 = copy (_17.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb11;
       }
   
@@ -165,14 +165,14 @@
 -         StorageDead(_12);
 -         goto -> bb14;
 +         StorageLive(_5);
-+         _5 = move _2;
++         _5 = move _24;
 +         goto -> bb6;
       }
   
       bb17: {
           StorageLive(_12);
 -         _12 = yield(const ()) -> [resume: bb15, drop: bb16];
-+         _12 = move _2;
++         _12 = move _24;
 +         goto -> bb8;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncReference_\047__.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncReference_\047__.StateTransform.diff"
index 120028d..93b76ad 100644
--- "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncReference_\047__.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncReference_\047__.StateTransform.diff"
@@ -20,34 +20,34 @@
 +     let mut _0: std::task::Poll<()>;
       let mut _3: &mut AsyncReference<'_>;
       let mut _4: impl std::future::Future<Output = ()>;
--     let mut _5: std::future::ResumeTy;
-+     let mut _5: &mut std::task::Context<'_>;
+      let mut _5: std::future::ResumeTy;
       let mut _6: std::task::Poll<()>;
       let mut _7: isize;
       let mut _8: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _9: &mut std::task::Context<'_>;
--     let mut _10: std::future::ResumeTy;
-+     let mut _10: &mut std::task::Context<'_>;
+      let mut _10: std::future::ResumeTy;
       let mut _11: &mut impl std::future::Future<Output = ()>;
--     let mut _12: std::future::ResumeTy;
-+     let mut _12: &mut std::task::Context<'_>;
+      let mut _12: std::future::ResumeTy;
       let mut _13: std::task::Poll<()>;
       let mut _14: isize;
       let mut _15: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _16: &mut std::task::Context<'_>;
--     let mut _17: std::future::ResumeTy;
-+     let mut _17: &mut std::task::Context<'_>;
+      let mut _17: std::future::ResumeTy;
       let mut _18: &mut impl std::future::Future<Output = ()>;
       let mut _19: std::pin::Pin<&mut AsyncReference<'_>>;
       let mut _20: &mut AsyncReference<'_>;
 +     let mut _21: ();
 +     let mut _22: u32;
 +     let mut _23: &mut {async fn body of std::future::async_drop_in_place<AsyncReference<'_>>()};
++     let _24: std::future::ResumeTy;
++     let mut _25: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         _3 = move (_1.0: &mut AsyncReference<'_>);
 -         _20 = &mut (*_3);
 -         _19 = Pin::<&mut AsyncReference<'_>>::new_unchecked(move _20) -> [return: bb22, unwind: bb2];
++         _25 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _24 = std::future::ResumeTy(move _25);
 +         _23 = copy (_1.0: &mut {async fn body of std::future::async_drop_in_place<AsyncReference<'_>>()});
 +         _22 = discriminant((*_23));
 +         switchInt(move _22) -> [0: bb20, 1: bb19, 2: bb18, 3: bb16, 4: bb17, otherwise: bb7];
@@ -87,7 +87,7 @@
   
       bb6: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb6, unwind: bb5];
-+         _2 = move _5;
++         _24 = move _5;
 +         StorageDead(_5);
 +         goto -> bb5;
       }
@@ -103,7 +103,7 @@
 -         _2 = move _5;
 -         StorageDead(_5);
 -         goto -> bb14;
-+         _2 = move _12;
++         _24 = move _12;
 +         StorageDead(_12);
 +         goto -> bb13;
       }
@@ -132,8 +132,8 @@
   
       bb12: {
 -         _6 = <impl Future<Output = ()> as Future>::poll(move _8, move _9) -> [return: bb11, unwind: bb5];
-+         _17 = move _2;
-+         _16 = move _17;
++         _17 = move _24;
++         _16 = copy (_17.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb11;
       }
   
@@ -165,14 +165,14 @@
 -         StorageDead(_12);
 -         goto -> bb14;
 +         StorageLive(_5);
-+         _5 = move _2;
++         _5 = move _24;
 +         goto -> bb6;
       }
   
       bb17: {
           StorageLive(_12);
 -         _12 = yield(const ()) -> [resume: bb15, drop: bb16];
-+         _12 = move _2;
++         _12 = move _24;
 +         goto -> bb8;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncStruct.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncStruct.StateTransform.diff"
index 0de0be9..339661e 100644
--- "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncStruct.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.AsyncStruct.StateTransform.diff"
@@ -31,89 +31,73 @@
 +     let mut _0: std::task::Poll<()>;
       let mut _3: &mut AsyncStruct;
       let mut _4: impl std::future::Future<Output = ()>;
--     let mut _5: std::future::ResumeTy;
-+     let mut _5: &mut std::task::Context<'_>;
+      let mut _5: std::future::ResumeTy;
       let mut _6: std::task::Poll<()>;
       let mut _7: isize;
       let mut _8: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _9: &mut std::task::Context<'_>;
--     let mut _10: std::future::ResumeTy;
-+     let mut _10: &mut std::task::Context<'_>;
+      let mut _10: std::future::ResumeTy;
       let mut _11: &mut impl std::future::Future<Output = ()>;
       let mut _12: std::pin::Pin<&mut AsyncInt>;
       let mut _13: &mut AsyncInt;
       let mut _14: impl std::future::Future<Output = ()>;
--     let mut _15: std::future::ResumeTy;
-+     let mut _15: &mut std::task::Context<'_>;
+      let mut _15: std::future::ResumeTy;
       let mut _16: std::task::Poll<()>;
       let mut _17: isize;
       let mut _18: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _19: &mut std::task::Context<'_>;
--     let mut _20: std::future::ResumeTy;
-+     let mut _20: &mut std::task::Context<'_>;
+      let mut _20: std::future::ResumeTy;
       let mut _21: &mut impl std::future::Future<Output = ()>;
       let mut _22: std::pin::Pin<&mut AsyncInt>;
       let mut _23: &mut AsyncInt;
       let mut _24: impl std::future::Future<Output = ()>;
--     let mut _25: std::future::ResumeTy;
-+     let mut _25: &mut std::task::Context<'_>;
+      let mut _25: std::future::ResumeTy;
       let mut _26: std::task::Poll<()>;
       let mut _27: isize;
       let mut _28: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _29: &mut std::task::Context<'_>;
--     let mut _30: std::future::ResumeTy;
-+     let mut _30: &mut std::task::Context<'_>;
+      let mut _30: std::future::ResumeTy;
       let mut _31: &mut impl std::future::Future<Output = ()>;
--     let mut _32: std::future::ResumeTy;
-+     let mut _32: &mut std::task::Context<'_>;
+      let mut _32: std::future::ResumeTy;
       let mut _33: std::task::Poll<()>;
       let mut _34: isize;
       let mut _35: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _36: &mut std::task::Context<'_>;
--     let mut _37: std::future::ResumeTy;
-+     let mut _37: &mut std::task::Context<'_>;
+      let mut _37: std::future::ResumeTy;
       let mut _38: &mut impl std::future::Future<Output = ()>;
       let mut _39: std::pin::Pin<&mut AsyncInt>;
       let mut _40: &mut AsyncInt;
       let mut _41: impl std::future::Future<Output = ()>;
--     let mut _42: std::future::ResumeTy;
-+     let mut _42: &mut std::task::Context<'_>;
+      let mut _42: std::future::ResumeTy;
       let mut _43: std::task::Poll<()>;
       let mut _44: isize;
       let mut _45: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _46: &mut std::task::Context<'_>;
--     let mut _47: std::future::ResumeTy;
-+     let mut _47: &mut std::task::Context<'_>;
+      let mut _47: std::future::ResumeTy;
       let mut _48: &mut impl std::future::Future<Output = ()>;
--     let mut _49: std::future::ResumeTy;
-+     let mut _49: &mut std::task::Context<'_>;
+      let mut _49: std::future::ResumeTy;
       let mut _50: std::task::Poll<()>;
       let mut _51: isize;
       let mut _52: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _53: &mut std::task::Context<'_>;
--     let mut _54: std::future::ResumeTy;
-+     let mut _54: &mut std::task::Context<'_>;
+      let mut _54: std::future::ResumeTy;
       let mut _55: &mut impl std::future::Future<Output = ()>;
       let mut _56: std::pin::Pin<&mut AsyncInt>;
       let mut _57: &mut AsyncInt;
       let mut _58: impl std::future::Future<Output = ()>;
--     let mut _59: std::future::ResumeTy;
-+     let mut _59: &mut std::task::Context<'_>;
+      let mut _59: std::future::ResumeTy;
       let mut _60: std::task::Poll<()>;
       let mut _61: isize;
       let mut _62: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _63: &mut std::task::Context<'_>;
--     let mut _64: std::future::ResumeTy;
-+     let mut _64: &mut std::task::Context<'_>;
+      let mut _64: std::future::ResumeTy;
       let mut _65: &mut impl std::future::Future<Output = ()>;
--     let mut _66: std::future::ResumeTy;
-+     let mut _66: &mut std::task::Context<'_>;
+      let mut _66: std::future::ResumeTy;
       let mut _67: std::task::Poll<()>;
       let mut _68: isize;
       let mut _69: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _70: &mut std::task::Context<'_>;
--     let mut _71: std::future::ResumeTy;
-+     let mut _71: &mut std::task::Context<'_>;
+      let mut _71: std::future::ResumeTy;
       let mut _72: &mut impl std::future::Future<Output = ()>;
       let mut _73: std::pin::Pin<&mut AsyncStruct>;
       let mut _74: &mut AsyncStruct;
@@ -125,11 +109,15 @@
 +     let mut _80: &mut AsyncStruct;
 +     let mut _81: &mut AsyncStruct;
 +     let mut _82: &mut AsyncStruct;
++     let _83: std::future::ResumeTy;
++     let mut _84: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         _3 = move (_1.0: &mut AsyncStruct);
 -         _74 = &mut (*_3);
 -         _73 = Pin::<&mut AsyncStruct>::new_unchecked(move _74) -> [return: bb85, unwind: bb4];
++         _84 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _83 = std::future::ResumeTy(move _84);
 +         _77 = copy (_1.0: &mut {async fn body of std::future::async_drop_in_place<AsyncStruct>()});
 +         _76 = discriminant((*_77));
 +         switchInt(move _76) -> [0: bb56, 1: bb55, 2: bb54, 3: bb46, 4: bb47, 5: bb48, 6: bb49, 7: bb50, 8: bb51, 9: bb52, 10: bb53, otherwise: bb8];
@@ -175,7 +163,7 @@
   
       bb7: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb7, unwind: bb6];
-+         _2 = move _5;
++         _83 = move _5;
 +         StorageDead(_5);
 +         goto -> bb6;
       }
@@ -204,7 +192,7 @@
   
       bb11: {
 -         unreachable;
-+         _2 = move _15;
++         _83 = move _15;
 +         StorageDead(_15);
 +         goto -> bb10;
       }
@@ -232,7 +220,7 @@
       bb15: {
 -         _11 = &mut _4;
 -         _8 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb14, unwind: bb6];
-+         _2 = move _25;
++         _83 = move _25;
 +         StorageDead(_25);
 +         goto -> bb14;
       }
@@ -240,7 +228,7 @@
       bb16: {
 -         StorageLive(_4);
 -         _4 = async_drop_in_place::<AsyncInt>(copy (_12.0: &mut AsyncInt)) -> [return: bb15, unwind: bb6];
-+         _2 = move _32;
++         _83 = move _32;
 +         StorageDead(_32);
 +         goto -> bb21;
       }
@@ -271,8 +259,8 @@
   
       bb20: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb20, unwind: bb19];
-+         _37 = move _2;
-+         _36 = move _37;
++         _37 = move _83;
++         _36 = copy (_37.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb19;
       }
   
@@ -317,7 +305,7 @@
       bb26: {
 -         _20 = move _2;
 -         _19 = std::future::get_context::<'_, '_>(move _20) -> [return: bb25, unwind: bb19];
-+         _2 = move _42;
++         _83 = move _42;
 +         StorageDead(_42);
 +         goto -> bb25;
       }
@@ -325,7 +313,7 @@
       bb27: {
 -         _21 = &mut _14;
 -         _18 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _21) -> [return: bb26, unwind: bb19];
-+         _2 = move _49;
++         _83 = move _49;
 +         StorageDead(_49);
 +         goto -> bb32;
       }
@@ -357,8 +345,8 @@
 -         StorageDead(_24);
 -         goto -> bb2;
 +     bb31: {
-+         _54 = move _2;
-+         _53 = move _54;
++         _54 = move _83;
++         _53 = copy (_54.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb30;
       }
   
@@ -402,7 +390,7 @@
   
       bb37: {
 -         _26 = <impl Future<Output = ()> as Future>::poll(move _28, move _29) -> [return: bb36, unwind: bb31];
-+         _2 = move _59;
++         _83 = move _59;
 +         StorageDead(_59);
 +         goto -> bb36;
       }
@@ -410,7 +398,7 @@
       bb38: {
 -         _30 = move _2;
 -         _29 = std::future::get_context::<'_, '_>(move _30) -> [return: bb37, unwind: bb31];
-+         _2 = move _66;
++         _83 = move _66;
 +         StorageDead(_66);
 +         goto -> bb43;
       }
@@ -443,8 +431,8 @@
       bb42: {
 -         StorageLive(_32);
 -         _32 = yield(const ()) -> [resume: bb40, drop: bb41];
-+         _71 = move _2;
-+         _70 = move _71;
++         _71 = move _83;
++         _70 = copy (_71.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb41;
       }
   
@@ -473,7 +461,7 @@
 -         _38 = &mut _24;
 -         _35 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _38) -> [return: bb45, unwind: bb31];
 +         StorageLive(_5);
-+         _5 = move _2;
++         _5 = move _83;
 +         goto -> bb7;
       }
   
@@ -481,7 +469,7 @@
 -         StorageLive(_24);
 -         _24 = async_drop_in_place::<AsyncInt>(copy (_39.0: &mut AsyncInt)) -> [return: bb46, unwind: bb31];
 +         StorageLive(_15);
-+         _15 = move _2;
++         _15 = move _83;
 +         goto -> bb11;
       }
   
@@ -490,7 +478,7 @@
 -         _40 = &mut ((*_3).2: AsyncInt);
 -         _39 = Pin::<&mut AsyncInt>::new_unchecked(move _40) -> [return: bb47, unwind: bb2];
 +         StorageLive(_25);
-+         _25 = move _2;
++         _25 = move _83;
 +         goto -> bb15;
       }
   
@@ -498,7 +486,7 @@
 -         StorageDead(_41);
 -         goto -> bb17;
 +         StorageLive(_32);
-+         _32 = move _2;
++         _32 = move _83;
 +         goto -> bb16;
       }
   
@@ -507,14 +495,14 @@
 -         goto -> bb3;
 +     bb50: {
 +         StorageLive(_42);
-+         _42 = move _2;
++         _42 = move _83;
 +         goto -> bb26;
       }
   
       bb51: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb51, unwind: bb50];
 +         StorageLive(_49);
-+         _49 = move _2;
++         _49 = move _83;
 +         goto -> bb27;
       }
   
@@ -523,7 +511,7 @@
 -         StorageDead(_42);
 -         goto -> bb51;
 +         StorageLive(_59);
-+         _59 = move _2;
++         _59 = move _83;
 +         goto -> bb37;
       }
   
@@ -532,7 +520,7 @@
 -         StorageDead(_42);
 -         goto -> bb58;
 +         StorageLive(_66);
-+         _66 = move _2;
++         _66 = move _83;
 +         goto -> bb38;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.Int.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.Int.StateTransform.diff"
index 1536d5b..be51f11 100644
--- "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.Int.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.Int.StateTransform.diff"
@@ -18,8 +18,12 @@
 +     let mut _3: ();
 +     let mut _4: u32;
 +     let mut _5: &mut {async fn body of std::future::async_drop_in_place<Int>()};
++     let _6: std::future::ResumeTy;
++     let mut _7: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
++         _7 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _6 = std::future::ResumeTy(move _7);
 +         _5 = copy (_1.0: &mut {async fn body of std::future::async_drop_in_place<Int>()});
 +         _4 = discriminant((*_5));
 +         switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2];
diff --git "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.SyncInt.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.SyncInt.StateTransform.diff"
index 198209a..2d127c4 100644
--- "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.SyncInt.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.SyncInt.StateTransform.diff"
@@ -19,10 +19,14 @@
 +     let mut _4: ();
 +     let mut _5: u32;
 +     let mut _6: &mut {async fn body of std::future::async_drop_in_place<SyncInt>()};
++     let _7: std::future::ResumeTy;
++     let mut _8: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         _3 = no_retag copy (_1.0: &mut SyncInt);
 -         drop((*_3)) -> [return: bb1, unwind continue];
++         _8 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _7 = std::future::ResumeTy(move _8);
 +         _6 = copy (_1.0: &mut {async fn body of std::future::async_drop_in_place<SyncInt>()});
 +         _5 = discriminant((*_6));
 +         switchInt(move _5) -> [0: bb6, 1: bb4, 2: bb3, otherwise: bb5];
diff --git "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.SyncThenAsync.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.SyncThenAsync.StateTransform.diff"
index 1247a7f..6a7ad14 100644
--- "a/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.SyncThenAsync.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.core.future-async_drop-async_drop_in_place-\173closure\0430\175.SyncThenAsync.StateTransform.diff"
@@ -26,14 +26,12 @@
 +     let mut _0: std::task::Poll<()>;
       let mut _3: &mut SyncThenAsync;
       let mut _4: impl std::future::Future<Output = ()>;
--     let mut _5: std::future::ResumeTy;
-+     let mut _5: &mut std::task::Context<'_>;
+      let mut _5: std::future::ResumeTy;
       let mut _6: std::task::Poll<()>;
       let mut _7: isize;
       let mut _8: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _9: &mut std::task::Context<'_>;
--     let mut _10: std::future::ResumeTy;
-+     let mut _10: &mut std::task::Context<'_>;
+      let mut _10: std::future::ResumeTy;
       let mut _11: &mut impl std::future::Future<Output = ()>;
       let mut _12: std::pin::Pin<&mut AsyncInt>;
       let mut _13: &mut AsyncInt;
@@ -48,44 +46,36 @@
       let mut _22: std::pin::Pin<&mut AsyncInt>;
       let mut _23: &mut AsyncInt;
       let mut _24: impl std::future::Future<Output = ()>;
--     let mut _25: std::future::ResumeTy;
-+     let mut _25: &mut std::task::Context<'_>;
+      let mut _25: std::future::ResumeTy;
       let mut _26: std::task::Poll<()>;
       let mut _27: isize;
       let mut _28: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _29: &mut std::task::Context<'_>;
--     let mut _30: std::future::ResumeTy;
-+     let mut _30: &mut std::task::Context<'_>;
+      let mut _30: std::future::ResumeTy;
       let mut _31: &mut impl std::future::Future<Output = ()>;
--     let mut _32: std::future::ResumeTy;
-+     let mut _32: &mut std::task::Context<'_>;
+      let mut _32: std::future::ResumeTy;
       let mut _33: std::task::Poll<()>;
       let mut _34: isize;
       let mut _35: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _36: &mut std::task::Context<'_>;
--     let mut _37: std::future::ResumeTy;
-+     let mut _37: &mut std::task::Context<'_>;
+      let mut _37: std::future::ResumeTy;
       let mut _38: &mut impl std::future::Future<Output = ()>;
       let mut _39: std::pin::Pin<&mut AsyncInt>;
       let mut _40: &mut AsyncInt;
       let mut _41: impl std::future::Future<Output = ()>;
--     let mut _42: std::future::ResumeTy;
-+     let mut _42: &mut std::task::Context<'_>;
+      let mut _42: std::future::ResumeTy;
       let mut _43: std::task::Poll<()>;
       let mut _44: isize;
       let mut _45: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _46: &mut std::task::Context<'_>;
--     let mut _47: std::future::ResumeTy;
-+     let mut _47: &mut std::task::Context<'_>;
+      let mut _47: std::future::ResumeTy;
       let mut _48: &mut impl std::future::Future<Output = ()>;
--     let mut _49: std::future::ResumeTy;
-+     let mut _49: &mut std::task::Context<'_>;
+      let mut _49: std::future::ResumeTy;
       let mut _50: std::task::Poll<()>;
       let mut _51: isize;
       let mut _52: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _53: &mut std::task::Context<'_>;
--     let mut _54: std::future::ResumeTy;
-+     let mut _54: &mut std::task::Context<'_>;
+      let mut _54: std::future::ResumeTy;
       let mut _55: &mut impl std::future::Future<Output = ()>;
       let mut _56: std::pin::Pin<&mut AsyncInt>;
       let mut _57: &mut AsyncInt;
@@ -101,11 +91,15 @@
 +     let mut _67: &mut SyncThenAsync;
 +     let mut _68: &mut SyncThenAsync;
 +     let mut _69: &mut SyncThenAsync;
++     let _70: std::future::ResumeTy;
++     let mut _71: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         _3 = move (_1.0: &mut SyncThenAsync);
 -         _58 = &mut (*_3);
 -         _59 = <SyncThenAsync as Drop>::drop(move _58) -> [return: bb58, unwind: bb5];
++         _71 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _70 = std::future::ResumeTy(move _71);
 +         _62 = copy (_1.0: &mut {async fn body of std::future::async_drop_in_place<SyncThenAsync>()});
 +         _61 = discriminant((*_62));
 +         switchInt(move _61) -> [0: bb42, 1: bb41, 2: bb40, 3: bb35, 4: bb36, 5: bb37, 6: bb38, 7: bb39, otherwise: bb9];
@@ -157,7 +151,7 @@
   
       bb8: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb8, unwind: bb7];
-+         _2 = move _5;
++         _70 = move _5;
 +         StorageDead(_5);
 +         goto -> bb7;
       }
@@ -193,14 +187,14 @@
       bb13: {
 -         _7 = discriminant(_6);
 -         switchInt(move _7) -> [0: bb6, 1: bb11, otherwise: bb12];
-+         _2 = move _25;
++         _70 = move _25;
 +         StorageDead(_25);
 +         goto -> bb12;
       }
   
       bb14: {
 -         _6 = <impl Future<Output = ()> as Future>::poll(move _8, move _9) -> [return: bb13, unwind: bb7];
-+         _2 = move _32;
++         _70 = move _32;
 +         StorageDead(_32);
 +         goto -> bb19;
       }
@@ -231,8 +225,8 @@
       bb18: {
 -         _13 = &mut ((*_3).3: AsyncInt);
 -         _12 = Pin::<&mut AsyncInt>::new_unchecked(move _13) -> [return: bb17, unwind: bb2];
-+         _37 = move _2;
-+         _36 = move _37;
++         _37 = move _70;
++         _36 = copy (_37.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb17;
       }
   
@@ -285,7 +279,7 @@
       bb25: {
 -         StorageLive(_25);
 -         _25 = yield(const ()) -> [resume: bb23, drop: bb24];
-+         _2 = move _42;
++         _70 = move _42;
 +         StorageDead(_42);
 +         goto -> bb24;
       }
@@ -293,7 +287,7 @@
       bb26: {
 -         _27 = discriminant(_26);
 -         switchInt(move _27) -> [0: bb20, 1: bb25, otherwise: bb12];
-+         _2 = move _49;
++         _70 = move _49;
 +         StorageDead(_49);
 +         goto -> bb31;
       }
@@ -324,8 +318,8 @@
 -         _2 = move _32;
 -         StorageDead(_32);
 -         goto -> bb36;
-+         _54 = move _2;
-+         _53 = move _54;
++         _54 = move _70;
++         _53 = copy (_54.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb29;
       }
   
@@ -363,7 +357,7 @@
 -         _37 = move _2;
 -         _36 = std::future::get_context::<'_, '_>(move _37) -> [return: bb34, unwind: bb21];
 +         StorageLive(_5);
-+         _5 = move _2;
++         _5 = move _70;
 +         goto -> bb8;
       }
   
@@ -371,7 +365,7 @@
 -         _38 = &mut _24;
 -         _35 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _38) -> [return: bb35, unwind: bb21];
 +         StorageLive(_25);
-+         _25 = move _2;
++         _25 = move _70;
 +         goto -> bb13;
       }
   
@@ -379,7 +373,7 @@
 -         StorageLive(_24);
 -         _24 = async_drop_in_place::<AsyncInt>(copy (_39.0: &mut AsyncInt)) -> [return: bb36, unwind: bb21];
 +         StorageLive(_32);
-+         _32 = move _2;
++         _32 = move _70;
 +         goto -> bb14;
       }
   
@@ -387,7 +381,7 @@
 -         _40 = &mut ((*_3).3: AsyncInt);
 -         _39 = Pin::<&mut AsyncInt>::new_unchecked(move _40) -> [return: bb37, unwind: bb2];
 +         StorageLive(_42);
-+         _42 = move _2;
++         _42 = move _70;
 +         goto -> bb25;
       }
   
@@ -395,7 +389,7 @@
 -         StorageDead(_41);
 -         drop(((*_3).2: SyncInt)) -> [return: bb38, unwind: bb3];
 +         StorageLive(_49);
-+         _49 = move _2;
++         _49 = move _70;
 +         goto -> bb26;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.double-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.double-\173closure\0430\175.StateTransform.diff"
index b59d810..9e6df1e 100644
--- "a/tests/mir-opt/coroutine/async_drop.double-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.double-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,8 @@
 - fn double::{closure#0}(_1: {async fn body of double()}, _2: std::future::ResumeTy) -> ()
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     let mut _0: ();
 + fn double::{closure#0}(_1: Pin<&mut {async fn body of double()}>, _2: &mut Context<'_>) -> Poll<()> {
 +     coroutine layout {
 +         field _s0: ();
@@ -23,56 +25,49 @@
 +         }
 +         storage_conflicts = BitMatrix(6x6) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s0, _s3), (_s0, _s4), (_s0, _s5), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s1, _s3), (_s1, _s4), (_s1, _s5), (_s2, _s0), (_s2, _s1), (_s2, _s2), (_s2, _s3), (_s2, _s4), (_s2, _s5), (_s3, _s0), (_s3, _s1), (_s3, _s2), (_s3, _s3), (_s3, _s4), (_s4, _s0), (_s4, _s1), (_s4, _s2), (_s4, _s3), (_s4, _s4), (_s5, _s0), (_s5, _s1), (_s5, _s2), (_s5, _s5)}
 +     }
-      debug _task_context => _2;
--     let mut _0: ();
++     debug _task_context => _43;
 +     coroutine debug sync_int => _s1;
 +     let mut _0: std::task::Poll<()>;
       let _3: SyncInt;
       let mut _6: impl std::future::Future<Output = ()>;
--     let mut _7: std::future::ResumeTy;
-+     let mut _7: &mut std::task::Context<'_>;
+      let mut _7: std::future::ResumeTy;
       let mut _8: std::task::Poll<()>;
       let mut _9: isize;
       let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _11: &mut std::task::Context<'_>;
--     let mut _12: std::future::ResumeTy;
-+     let mut _12: &mut std::task::Context<'_>;
+      let mut _12: std::future::ResumeTy;
       let mut _13: &mut impl std::future::Future<Output = ()>;
--     let mut _14: std::future::ResumeTy;
-+     let mut _14: &mut std::task::Context<'_>;
+      let mut _14: std::future::ResumeTy;
       let mut _15: std::task::Poll<()>;
       let mut _16: isize;
       let mut _17: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _18: &mut std::task::Context<'_>;
--     let mut _19: std::future::ResumeTy;
-+     let mut _19: &mut std::task::Context<'_>;
+      let mut _19: std::future::ResumeTy;
       let mut _20: &mut impl std::future::Future<Output = ()>;
       let mut _21: std::pin::Pin<&mut AsyncInt>;
       let mut _22: &mut AsyncInt;
       let mut _23: impl std::future::Future<Output = ()>;
--     let mut _24: std::future::ResumeTy;
-+     let mut _24: &mut std::task::Context<'_>;
+      let mut _24: std::future::ResumeTy;
       let mut _25: std::task::Poll<()>;
       let mut _26: isize;
       let mut _27: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _28: &mut std::task::Context<'_>;
--     let mut _29: std::future::ResumeTy;
-+     let mut _29: &mut std::task::Context<'_>;
+      let mut _29: std::future::ResumeTy;
       let mut _30: &mut impl std::future::Future<Output = ()>;
--     let mut _31: std::future::ResumeTy;
-+     let mut _31: &mut std::task::Context<'_>;
+      let mut _31: std::future::ResumeTy;
       let mut _32: std::task::Poll<()>;
       let mut _33: isize;
       let mut _34: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _35: &mut std::task::Context<'_>;
--     let mut _36: std::future::ResumeTy;
-+     let mut _36: &mut std::task::Context<'_>;
+      let mut _36: std::future::ResumeTy;
       let mut _37: &mut impl std::future::Future<Output = ()>;
       let mut _38: std::pin::Pin<&mut AsyncInt>;
       let mut _39: &mut AsyncInt;
 +     let mut _40: ();
 +     let mut _41: u32;
 +     let mut _42: &mut {async fn body of double()};
++     let mut _43: std::future::ResumeTy;
++     let mut _44: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug sync_int => _3;
 +         debug sync_int => (((*_42) as variant#6).1: SyncInt);
@@ -99,6 +94,8 @@
 -         _5 = AsyncInt(const 0_i32);
 -         _0 = const ();
 -         goto -> bb33;
++         _44 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _43 = std::future::ResumeTy(move _44);
 +         _42 = copy (_1.0: &mut {async fn body of double()});
 +         _41 = discriminant((*_42));
 +         switchInt(move _41) -> [0: bb42, 1: bb41, 2: bb40, 3: bb36, 4: bb37, 5: bb38, 6: bb39, otherwise: bb13];
@@ -185,7 +182,7 @@
 -     bb12 (cleanup): {
 -         resume;
 +     bb12: {
-+         _2 = move _7;
++         _43 = move _7;
 +         StorageDead(_7);
 +         goto -> bb11;
       }
@@ -199,7 +196,7 @@
       bb14: {
 -         StorageDead(_6);
 -         goto -> bb5;
-+         _2 = move _14;
++         _43 = move _14;
 +         StorageDead(_14);
 +         goto -> bb19;
       }
@@ -232,8 +229,8 @@
 -         _2 = move _7;
 -         StorageDead(_7);
 -         goto -> bb24;
-+         _19 = move _2;
-+         _18 = move _19;
++         _19 = move _43;
++         _18 = copy (_19.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb17;
       }
   
@@ -281,7 +278,7 @@
 -         _2 = move _14;
 -         StorageDead(_14);
 -         goto -> bb31;
-+         _2 = move _24;
++         _43 = move _24;
 +         StorageDead(_24);
 +         goto -> bb24;
       }
@@ -290,7 +287,7 @@
 -         _2 = move _14;
 -         StorageDead(_14);
 -         goto -> bb24;
-+         _2 = move _31;
++         _43 = move _31;
 +         StorageDead(_31);
 +         goto -> bb31;
       }
@@ -320,8 +317,8 @@
       bb30: {
 -         _19 = move _2;
 -         _18 = std::future::get_context::<'_, '_>(move _19) -> [return: bb29, unwind: bb15];
-+         _36 = move _2;
-+         _35 = move _36;
++         _36 = move _43;
++         _35 = copy (_36.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb29;
       }
   
@@ -365,14 +362,14 @@
 -         goto -> bb10;
 +     bb36: {
 +         StorageLive(_7);
-+         _7 = move _2;
++         _7 = move _43;
 +         goto -> bb12;
       }
   
       bb37: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb37, unwind: bb36];
 +         StorageLive(_14);
-+         _14 = move _2;
++         _14 = move _43;
 +         goto -> bb14;
       }
   
@@ -381,7 +378,7 @@
 -         StorageDead(_24);
 -         goto -> bb37;
 +         StorageLive(_24);
-+         _24 = move _2;
++         _24 = move _43;
 +         goto -> bb25;
       }
   
@@ -390,7 +387,7 @@
 -         StorageDead(_24);
 -         goto -> bb44;
 +         StorageLive(_31);
-+         _31 = move _2;
++         _31 = move _43;
 +         goto -> bb26;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.double-\173closure\0430\175.coroutine_drop_async.0.mir" "b/tests/mir-opt/coroutine/async_drop.double-\173closure\0430\175.coroutine_drop_async.0.mir"
index acd0228..6fc7b46 100644
--- "a/tests/mir-opt/coroutine/async_drop.double-\173closure\0430\175.coroutine_drop_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_drop.double-\173closure\0430\175.coroutine_drop_async.0.mir"
@@ -1,46 +1,48 @@
 // MIR for `double::{closure#0}` 0 coroutine_drop_async
 
 fn double::{closure#0}(_1: Pin<&mut {async fn body of double()}>, _2: &mut Context<'_>) -> Poll<()> {
-    debug _task_context => _2;
+    debug _task_context => _43;
     let mut _0: std::task::Poll<()>;
     let _3: SyncInt;
     let mut _6: impl std::future::Future<Output = ()>;
-    let mut _7: &mut std::task::Context<'_>;
+    let mut _7: std::future::ResumeTy;
     let mut _8: std::task::Poll<()>;
     let mut _9: isize;
     let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _11: &mut std::task::Context<'_>;
-    let mut _12: &mut std::task::Context<'_>;
+    let mut _12: std::future::ResumeTy;
     let mut _13: &mut impl std::future::Future<Output = ()>;
-    let mut _14: &mut std::task::Context<'_>;
+    let mut _14: std::future::ResumeTy;
     let mut _15: std::task::Poll<()>;
     let mut _16: isize;
     let mut _17: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _18: &mut std::task::Context<'_>;
-    let mut _19: &mut std::task::Context<'_>;
+    let mut _19: std::future::ResumeTy;
     let mut _20: &mut impl std::future::Future<Output = ()>;
     let mut _21: std::pin::Pin<&mut AsyncInt>;
     let mut _22: &mut AsyncInt;
     let mut _23: impl std::future::Future<Output = ()>;
-    let mut _24: &mut std::task::Context<'_>;
+    let mut _24: std::future::ResumeTy;
     let mut _25: std::task::Poll<()>;
     let mut _26: isize;
     let mut _27: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _28: &mut std::task::Context<'_>;
-    let mut _29: &mut std::task::Context<'_>;
+    let mut _29: std::future::ResumeTy;
     let mut _30: &mut impl std::future::Future<Output = ()>;
-    let mut _31: &mut std::task::Context<'_>;
+    let mut _31: std::future::ResumeTy;
     let mut _32: std::task::Poll<()>;
     let mut _33: isize;
     let mut _34: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _35: &mut std::task::Context<'_>;
-    let mut _36: &mut std::task::Context<'_>;
+    let mut _36: std::future::ResumeTy;
     let mut _37: &mut impl std::future::Future<Output = ()>;
     let mut _38: std::pin::Pin<&mut AsyncInt>;
     let mut _39: &mut AsyncInt;
     let mut _40: ();
     let mut _41: u32;
     let mut _42: &mut {async fn body of double()};
+    let mut _43: std::future::ResumeTy;
+    let mut _44: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         debug sync_int => (((*_42) as variant#6).1: SyncInt);
         let _4: AsyncInt;
@@ -54,6 +56,8 @@
     }
 
     bb0: {
+        _44 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _43 = std::future::ResumeTy(move _44);
         _42 = copy (_1.0: &mut {async fn body of double()});
         _41 = discriminant((*_42));
         switchInt(move _41) -> [0: bb29, 2: bb36, 3: bb32, 4: bb33, 5: bb34, 6: bb35, otherwise: bb37];
@@ -109,7 +113,7 @@
     }
 
     bb11: {
-        _2 = move _7;
+        _43 = move _7;
         StorageDead(_7);
         goto -> bb17;
     }
@@ -136,8 +140,8 @@
     }
 
     bb16: {
-        _12 = move _2;
-        _11 = move _12;
+        _12 = move _43;
+        _11 = copy (_12.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
         goto -> bb15;
     }
 
@@ -147,7 +151,7 @@
     }
 
     bb18: {
-        _2 = move _14;
+        _43 = move _14;
         StorageDead(_14);
         goto -> bb17;
     }
@@ -163,7 +167,7 @@
     }
 
     bb21: {
-        _2 = move _24;
+        _43 = move _24;
         StorageDead(_24);
         goto -> bb26;
     }
@@ -186,8 +190,8 @@
     }
 
     bb25: {
-        _29 = move _2;
-        _28 = move _29;
+        _29 = move _43;
+        _28 = copy (_29.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
         goto -> bb24;
     }
 
@@ -197,7 +201,7 @@
     }
 
     bb27: {
-        _2 = move _31;
+        _43 = move _31;
         StorageDead(_31);
         goto -> bb26;
     }
@@ -222,25 +226,25 @@
 
     bb32: {
         StorageLive(_7);
-        _7 = move _2;
+        _7 = move _43;
         goto -> bb11;
     }
 
     bb33: {
         StorageLive(_14);
-        _14 = move _2;
+        _14 = move _43;
         goto -> bb18;
     }
 
     bb34: {
         StorageLive(_24);
-        _24 = move _2;
+        _24 = move _43;
         goto -> bb21;
     }
 
     bb35: {
         StorageLive(_31);
-        _31 = move _2;
+        _31 = move _43;
         goto -> bb27;
     }
 
diff --git "a/tests/mir-opt/coroutine/async_drop.elaborate_drops-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.elaborate_drops-\173closure\0430\175.StateTransform.diff"
index b0e6100..5fb3dba 100644
--- "a/tests/mir-opt/coroutine/async_drop.elaborate_drops-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.elaborate_drops-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,8 @@
 - fn elaborate_drops::{closure#0}(_1: {async fn body of elaborate_drops()}, _2: std::future::ResumeTy) -> ()
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     let mut _0: ();
 + fn elaborate_drops::{closure#0}(_1: Pin<&mut {async fn body of elaborate_drops()}>, _2: &mut Context<'_>) -> Poll<()> {
 +     coroutine layout {
 +         field _s0: ();
@@ -51,8 +53,7 @@
 +         }
 +         storage_conflicts = BitMatrix(20x20) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s0, _s3), (_s0, _s4), (_s0, _s5), (_s0, _s6), (_s0, _s7), (_s0, _s8), (_s0, _s9), (_s0, _s10), (_s0, _s11), (_s0, _s12), (_s0, _s13), (_s0, _s14), (_s0, _s15), (_s0, _s16), (_s0, _s17), (_s0, _s18), (_s0, _s19), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s1, _s3), (_s1, _s4), (_s1, _s5), (_s1, _s6), (_s1, _s7), (_s1, _s8), (_s1, _s9), (_s1, _s10), (_s1, _s11), (_s1, _s12), (_s1, _s13), (_s1, _s14), (_s1, _s15), (_s1, _s16), (_s1, _s17), (_s1, _s18), (_s1, _s19), (_s2, _s0), (_s2, _s1), (_s2, _s2), (_s2, _s3), (_s2, _s4), (_s2, _s5), (_s2, _s6), (_s2, _s7), (_s2, _s8), (_s2, _s9), (_s2, _s10), (_s2, _s11), (_s2, _s12), (_s2, _s13), (_s2, _s14), (_s2, _s15), (_s2, _s16), (_s2, _s17), (_s2, _s18), (_s2, _s19), (_s3, _s0), (_s3, _s1), (_s3, _s2), (_s3, _s3), (_s3, _s4), (_s3, _s5), (_s3, _s6), (_s3, _s7), (_s3, _s8), (_s3, _s9), (_s3, _s10), (_s3, _s11), (_s3, _s12), (_s3, _s13), (_s3, _s14), (_s3, _s15), (_s3, _s16), (_s3, _s17), (_s3, _s18), (_s4, _s0), (_s4, _s1), (_s4, _s2), (_s4, _s3), (_s4, _s4), (_s4, _s5), (_s4, _s6), (_s4, _s7), (_s4, _s8), (_s4, _s9), (_s4, _s10), (_s4, _s11), (_s4, _s12), (_s4, _s13), (_s4, _s14), (_s4, _s15), (_s4, _s16), (_s4, _s17), (_s5, _s0), (_s5, _s1), (_s5, _s2), (_s5, _s3), (_s5, _s4), (_s5, _s5), (_s5, _s6), (_s5, _s7), (_s5, _s8), (_s5, _s9), (_s5, _s10), (_s5, _s11), (_s5, _s12), (_s5, _s13), (_s5, _s14), (_s5, _s15), (_s5, _s16), (_s6, _s0), (_s6, _s1), (_s6, _s2), (_s6, _s3), (_s6, _s4), (_s6, _s5), (_s6, _s6), (_s6, _s7), (_s6, _s8), (_s6, _s9), (_s6, _s10), (_s6, _s11), (_s6, _s12), (_s6, _s13), (_s6, _s14), (_s6, _s15), (_s7, _s0), (_s7, _s1), (_s7, _s2), (_s7, _s3), (_s7, _s4), (_s7, _s5), (_s7, _s6), (_s7, _s7), (_s7, _s8), (_s7, _s9), (_s7, _s10), (_s7, _s11), (_s7, _s12), (_s7, _s13), (_s7, _s14), (_s8, _s0), (_s8, _s1), (_s8, _s2), (_s8, _s3), (_s8, _s4), (_s8, _s5), (_s8, _s6), (_s8, _s7), (_s8, _s8), (_s8, _s9), (_s8, _s10), (_s8, _s11), (_s8, _s12), (_s8, _s13), (_s9, _s0), (_s9, _s1), (_s9, _s2), (_s9, _s3), (_s9, _s4), (_s9, _s5), (_s9, _s6), (_s9, _s7), (_s9, _s8), (_s9, _s9), (_s9, _s10), (_s9, _s11), (_s9, _s12), (_s10, _s0), (_s10, _s1), (_s10, _s2), (_s10, _s3), (_s10, _s4), (_s10, _s5), (_s10, _s6), (_s10, _s7), (_s10, _s8), (_s10, _s9), (_s10, _s10), (_s10, _s11), (_s11, _s0), (_s11, _s1), (_s11, _s2), (_s11, _s3), (_s11, _s4), (_s11, _s5), (_s11, _s6), (_s11, _s7), (_s11, _s8), (_s11, _s9), (_s11, _s10), (_s11, _s11), (_s12, _s0), (_s12, _s1), (_s12, _s2), (_s12, _s3), (_s12, _s4), (_s12, _s5), (_s12, _s6), (_s12, _s7), (_s12, _s8), (_s12, _s9), (_s12, _s12), (_s13, _s0), (_s13, _s1), (_s13, _s2), (_s13, _s3), (_s13, _s4), (_s13, _s5), (_s13, _s6), (_s13, _s7), (_s13, _s8), (_s13, _s13), (_s14, _s0), (_s14, _s1), (_s14, _s2), (_s14, _s3), (_s14, _s4), (_s14, _s5), (_s14, _s6), (_s14, _s7), (_s14, _s14), (_s15, _s0), (_s15, _s1), (_s15, _s2), (_s15, _s3), (_s15, _s4), (_s15, _s5), (_s15, _s6), (_s15, _s15), (_s16, _s0), (_s16, _s1), (_s16, _s2), (_s16, _s3), (_s16, _s4), (_s16, _s5), (_s16, _s16), (_s17, _s0), (_s17, _s1), (_s17, _s2), (_s17, _s3), (_s17, _s4), (_s17, _s17), (_s18, _s0), (_s18, _s1), (_s18, _s2), (_s18, _s3), (_s18, _s18), (_s19, _s0), (_s19, _s1), (_s19, _s2), (_s19, _s19)}
 +     }
-      debug _task_context => _2;
--     let mut _0: ();
++     debug _task_context => _183;
 +     coroutine debug sync_int => _s1;
 +     let mut _0: std::task::Poll<()>;
       let _3: SyncInt;
@@ -68,197 +69,163 @@
       let mut _21: &AsyncInt;
       let _22: &AsyncInt;
       let mut _27: impl std::future::Future<Output = ()>;
--     let mut _28: std::future::ResumeTy;
-+     let mut _28: &mut std::task::Context<'_>;
+      let mut _28: std::future::ResumeTy;
       let mut _29: std::task::Poll<()>;
       let mut _30: isize;
       let mut _31: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _32: &mut std::task::Context<'_>;
--     let mut _33: std::future::ResumeTy;
-+     let mut _33: &mut std::task::Context<'_>;
+      let mut _33: std::future::ResumeTy;
       let mut _34: &mut impl std::future::Future<Output = ()>;
--     let mut _35: std::future::ResumeTy;
-+     let mut _35: &mut std::task::Context<'_>;
+      let mut _35: std::future::ResumeTy;
       let mut _36: std::task::Poll<()>;
       let mut _37: isize;
       let mut _38: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _39: &mut std::task::Context<'_>;
--     let mut _40: std::future::ResumeTy;
-+     let mut _40: &mut std::task::Context<'_>;
+      let mut _40: std::future::ResumeTy;
       let mut _41: &mut impl std::future::Future<Output = ()>;
       let mut _42: std::pin::Pin<&mut {async closure@$DIR/async_drop.rs:78:27: 78:35}>;
       let mut _43: &mut {async closure@$DIR/async_drop.rs:78:27: 78:35};
       let mut _44: impl std::future::Future<Output = ()>;
--     let mut _45: std::future::ResumeTy;
-+     let mut _45: &mut std::task::Context<'_>;
+      let mut _45: std::future::ResumeTy;
       let mut _46: std::task::Poll<()>;
       let mut _47: isize;
       let mut _48: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _49: &mut std::task::Context<'_>;
--     let mut _50: std::future::ResumeTy;
-+     let mut _50: &mut std::task::Context<'_>;
+      let mut _50: std::future::ResumeTy;
       let mut _51: &mut impl std::future::Future<Output = ()>;
--     let mut _52: std::future::ResumeTy;
-+     let mut _52: &mut std::task::Context<'_>;
+      let mut _52: std::future::ResumeTy;
       let mut _53: std::task::Poll<()>;
       let mut _54: isize;
       let mut _55: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _56: &mut std::task::Context<'_>;
--     let mut _57: std::future::ResumeTy;
-+     let mut _57: &mut std::task::Context<'_>;
+      let mut _57: std::future::ResumeTy;
       let mut _58: &mut impl std::future::Future<Output = ()>;
       let mut _59: std::pin::Pin<&mut {closure@$DIR/async_drop.rs:70:25: 70:27}>;
       let mut _60: &mut {closure@$DIR/async_drop.rs:70:25: 70:27};
       let mut _61: impl std::future::Future<Output = ()>;
--     let mut _62: std::future::ResumeTy;
-+     let mut _62: &mut std::task::Context<'_>;
+      let mut _62: std::future::ResumeTy;
       let mut _63: std::task::Poll<()>;
       let mut _64: isize;
       let mut _65: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _66: &mut std::task::Context<'_>;
--     let mut _67: std::future::ResumeTy;
-+     let mut _67: &mut std::task::Context<'_>;
+      let mut _67: std::future::ResumeTy;
       let mut _68: &mut impl std::future::Future<Output = ()>;
--     let mut _69: std::future::ResumeTy;
-+     let mut _69: &mut std::task::Context<'_>;
+      let mut _69: std::future::ResumeTy;
       let mut _70: std::task::Poll<()>;
       let mut _71: isize;
       let mut _72: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _73: &mut std::task::Context<'_>;
--     let mut _74: std::future::ResumeTy;
-+     let mut _74: &mut std::task::Context<'_>;
+      let mut _74: std::future::ResumeTy;
       let mut _75: &mut impl std::future::Future<Output = ()>;
       let mut _76: std::pin::Pin<&mut AsyncReference<'_>>;
       let mut _77: &mut AsyncReference<'_>;
       let mut _78: impl std::future::Future<Output = ()>;
--     let mut _79: std::future::ResumeTy;
-+     let mut _79: &mut std::task::Context<'_>;
+      let mut _79: std::future::ResumeTy;
       let mut _80: std::task::Poll<()>;
       let mut _81: isize;
       let mut _82: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _83: &mut std::task::Context<'_>;
--     let mut _84: std::future::ResumeTy;
-+     let mut _84: &mut std::task::Context<'_>;
+      let mut _84: std::future::ResumeTy;
       let mut _85: &mut impl std::future::Future<Output = ()>;
--     let mut _86: std::future::ResumeTy;
-+     let mut _86: &mut std::task::Context<'_>;
+      let mut _86: std::future::ResumeTy;
       let mut _87: std::task::Poll<()>;
       let mut _88: isize;
       let mut _89: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _90: &mut std::task::Context<'_>;
--     let mut _91: std::future::ResumeTy;
-+     let mut _91: &mut std::task::Context<'_>;
+      let mut _91: std::future::ResumeTy;
       let mut _92: &mut impl std::future::Future<Output = ()>;
       let mut _93: std::pin::Pin<&mut AsyncInt>;
       let mut _94: &mut AsyncInt;
       let mut _95: impl std::future::Future<Output = ()>;
--     let mut _96: std::future::ResumeTy;
-+     let mut _96: &mut std::task::Context<'_>;
+      let mut _96: std::future::ResumeTy;
       let mut _97: std::task::Poll<()>;
       let mut _98: isize;
       let mut _99: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _100: &mut std::task::Context<'_>;
--     let mut _101: std::future::ResumeTy;
-+     let mut _101: &mut std::task::Context<'_>;
+      let mut _101: std::future::ResumeTy;
       let mut _102: &mut impl std::future::Future<Output = ()>;
--     let mut _103: std::future::ResumeTy;
-+     let mut _103: &mut std::task::Context<'_>;
+      let mut _103: std::future::ResumeTy;
       let mut _104: std::task::Poll<()>;
       let mut _105: isize;
       let mut _106: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _107: &mut std::task::Context<'_>;
--     let mut _108: std::future::ResumeTy;
-+     let mut _108: &mut std::task::Context<'_>;
+      let mut _108: std::future::ResumeTy;
       let mut _109: &mut impl std::future::Future<Output = ()>;
       let mut _110: std::pin::Pin<&mut AsyncEnum>;
       let mut _111: &mut AsyncEnum;
       let mut _112: impl std::future::Future<Output = ()>;
--     let mut _113: std::future::ResumeTy;
-+     let mut _113: &mut std::task::Context<'_>;
+      let mut _113: std::future::ResumeTy;
       let mut _114: std::task::Poll<()>;
       let mut _115: isize;
       let mut _116: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _117: &mut std::task::Context<'_>;
--     let mut _118: std::future::ResumeTy;
-+     let mut _118: &mut std::task::Context<'_>;
+      let mut _118: std::future::ResumeTy;
       let mut _119: &mut impl std::future::Future<Output = ()>;
--     let mut _120: std::future::ResumeTy;
-+     let mut _120: &mut std::task::Context<'_>;
+      let mut _120: std::future::ResumeTy;
       let mut _121: std::task::Poll<()>;
       let mut _122: isize;
       let mut _123: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _124: &mut std::task::Context<'_>;
--     let mut _125: std::future::ResumeTy;
-+     let mut _125: &mut std::task::Context<'_>;
+      let mut _125: std::future::ResumeTy;
       let mut _126: &mut impl std::future::Future<Output = ()>;
       let mut _127: std::pin::Pin<&mut SyncThenAsync>;
       let mut _128: &mut SyncThenAsync;
       let mut _129: impl std::future::Future<Output = ()>;
--     let mut _130: std::future::ResumeTy;
-+     let mut _130: &mut std::task::Context<'_>;
+      let mut _130: std::future::ResumeTy;
       let mut _131: std::task::Poll<()>;
       let mut _132: isize;
       let mut _133: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _134: &mut std::task::Context<'_>;
--     let mut _135: std::future::ResumeTy;
-+     let mut _135: &mut std::task::Context<'_>;
+      let mut _135: std::future::ResumeTy;
       let mut _136: &mut impl std::future::Future<Output = ()>;
--     let mut _137: std::future::ResumeTy;
-+     let mut _137: &mut std::task::Context<'_>;
+      let mut _137: std::future::ResumeTy;
       let mut _138: std::task::Poll<()>;
       let mut _139: isize;
       let mut _140: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _141: &mut std::task::Context<'_>;
--     let mut _142: std::future::ResumeTy;
-+     let mut _142: &mut std::task::Context<'_>;
+      let mut _142: std::future::ResumeTy;
       let mut _143: &mut impl std::future::Future<Output = ()>;
       let mut _144: std::pin::Pin<&mut AsyncStruct>;
       let mut _145: &mut AsyncStruct;
       let mut _146: impl std::future::Future<Output = ()>;
--     let mut _147: std::future::ResumeTy;
-+     let mut _147: &mut std::task::Context<'_>;
+      let mut _147: std::future::ResumeTy;
       let mut _148: std::task::Poll<()>;
       let mut _149: isize;
       let mut _150: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _151: &mut std::task::Context<'_>;
--     let mut _152: std::future::ResumeTy;
-+     let mut _152: &mut std::task::Context<'_>;
+      let mut _152: std::future::ResumeTy;
       let mut _153: &mut impl std::future::Future<Output = ()>;
--     let mut _154: std::future::ResumeTy;
-+     let mut _154: &mut std::task::Context<'_>;
+      let mut _154: std::future::ResumeTy;
       let mut _155: std::task::Poll<()>;
       let mut _156: isize;
       let mut _157: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _158: &mut std::task::Context<'_>;
--     let mut _159: std::future::ResumeTy;
-+     let mut _159: &mut std::task::Context<'_>;
+      let mut _159: std::future::ResumeTy;
       let mut _160: &mut impl std::future::Future<Output = ()>;
       let mut _161: std::pin::Pin<&mut [AsyncInt; 2]>;
       let mut _162: &mut [AsyncInt; 2];
       let mut _163: impl std::future::Future<Output = ()>;
--     let mut _164: std::future::ResumeTy;
-+     let mut _164: &mut std::task::Context<'_>;
+      let mut _164: std::future::ResumeTy;
       let mut _165: std::task::Poll<()>;
       let mut _166: isize;
       let mut _167: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _168: &mut std::task::Context<'_>;
--     let mut _169: std::future::ResumeTy;
-+     let mut _169: &mut std::task::Context<'_>;
+      let mut _169: std::future::ResumeTy;
       let mut _170: &mut impl std::future::Future<Output = ()>;
--     let mut _171: std::future::ResumeTy;
-+     let mut _171: &mut std::task::Context<'_>;
+      let mut _171: std::future::ResumeTy;
       let mut _172: std::task::Poll<()>;
       let mut _173: isize;
       let mut _174: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _175: &mut std::task::Context<'_>;
--     let mut _176: std::future::ResumeTy;
-+     let mut _176: &mut std::task::Context<'_>;
+      let mut _176: std::future::ResumeTy;
       let mut _177: &mut impl std::future::Future<Output = ()>;
       let mut _178: std::pin::Pin<&mut AsyncInt>;
       let mut _179: &mut AsyncInt;
 +     let mut _180: ();
 +     let mut _181: u32;
 +     let mut _182: &mut {async fn body of elaborate_drops()};
++     let mut _183: std::future::ResumeTy;
++     let mut _184: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug sync_int => _3;
 +         debug sync_int => (((*_182) as variant#20).1: SyncInt);
@@ -342,6 +309,8 @@
 -         _7 = AsyncInt(const 2_i32);
 -         _5 = [move _6, move _7];
 -         goto -> bb1;
++         _184 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _183 = std::future::ResumeTy(move _184);
 +         _182 = copy (_1.0: &mut {async fn body of elaborate_drops()});
 +         _181 = discriminant((*_182));
 +         switchInt(move _181) -> [0: bb170, 1: bb169, 2: bb168, 3: bb150, 4: bb151, 5: bb152, 6: bb153, 7: bb154, 8: bb155, 9: bb156, 10: bb157, 11: bb158, 12: bb159, 13: bb160, 14: bb161, 15: bb162, 16: bb163, 17: bb164, 18: bb165, 19: bb166, 20: bb167, otherwise: bb43];
@@ -679,7 +648,7 @@
 -     bb42 (cleanup): {
 -         goto -> bb43;
 +     bb42: {
-+         _2 = move _28;
++         _183 = move _28;
 +         StorageDead(_28);
 +         goto -> bb41;
       }
@@ -695,7 +664,7 @@
 -         StorageDead(_17);
 -         drop(_15) -> [return: bb45, unwind terminate(cleanup)];
 +     bb44: {
-+         _2 = move _35;
++         _183 = move _35;
 +         StorageDead(_35);
 +         goto -> bb49;
       }
@@ -733,8 +702,8 @@
 -         StorageDead(_5);
 -         drop(_4) -> [return: bb49, unwind terminate(cleanup)];
 +     bb48: {
-+         _40 = move _2;
-+         _39 = move _40;
++         _40 = move _183;
++         _39 = copy (_40.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb47;
       }
   
@@ -785,7 +754,7 @@
   
       bb55: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb55, unwind: bb54];
-+         _2 = move _45;
++         _183 = move _45;
 +         StorageDead(_45);
 +         goto -> bb54;
       }
@@ -794,7 +763,7 @@
 -         _2 = move _28;
 -         StorageDead(_28);
 -         goto -> bb55;
-+         _2 = move _52;
++         _183 = move _52;
 +         StorageDead(_52);
 +         goto -> bb61;
       }
@@ -827,8 +796,8 @@
       bb60: {
 -         _30 = discriminant(_29);
 -         switchInt(move _30) -> [0: bb53, 1: bb58, otherwise: bb59];
-+         _57 = move _2;
-+         _56 = move _57;
++         _57 = move _183;
++         _56 = copy (_57.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb59;
       }
   
@@ -878,14 +847,14 @@
       bb67: {
 -         _37 = discriminant(_36);
 -         switchInt(move _37) -> [0: bb52, 1: bb66, otherwise: bb59];
-+         _2 = move _62;
++         _183 = move _62;
 +         StorageDead(_62);
 +         goto -> bb66;
       }
   
       bb68: {
 -         _36 = <impl Future<Output = ()> as Future>::poll(move _38, move _39) -> [return: bb67, unwind: bb54];
-+         _2 = move _69;
++         _183 = move _69;
 +         StorageDead(_69);
 +         goto -> bb73;
       }
@@ -917,8 +886,8 @@
       bb72: {
 -         _43 = &mut _26;
 -         _42 = Pin::<&mut {async closure@$DIR/async_drop.rs:78:27: 78:35}>::new_unchecked(move _43) -> [return: bb71, unwind: bb36];
-+         _74 = move _2;
-+         _73 = move _74;
++         _74 = move _183;
++         _73 = copy (_74.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb71;
       }
   
@@ -969,7 +938,7 @@
       bb79: {
 -         StorageLive(_45);
 -         _45 = yield(const ()) -> [resume: bb77, drop: bb78];
-+         _2 = move _79;
++         _183 = move _79;
 +         StorageDead(_79);
 +         goto -> bb78;
       }
@@ -977,7 +946,7 @@
       bb80: {
 -         _47 = discriminant(_46);
 -         switchInt(move _47) -> [0: bb74, 1: bb79, otherwise: bb59];
-+         _2 = move _86;
++         _183 = move _86;
 +         StorageDead(_86);
 +         goto -> bb85;
       }
@@ -1009,8 +978,8 @@
 -         _2 = move _52;
 -         StorageDead(_52);
 -         goto -> bb90;
-+         _91 = move _2;
-+         _90 = move _91;
++         _91 = move _183;
++         _90 = copy (_91.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb83;
       }
   
@@ -1059,7 +1028,7 @@
       bb91: {
 -         StorageLive(_44);
 -         _44 = async_drop_in_place::<{closure@$DIR/async_drop.rs:70:25: 70:27}>(copy (_59.0: &mut {closure@$DIR/async_drop.rs:70:25: 70:27})) -> [return: bb90, unwind: bb75];
-+         _2 = move _96;
++         _183 = move _96;
 +         StorageDead(_96);
 +         goto -> bb90;
       }
@@ -1067,7 +1036,7 @@
       bb92: {
 -         _60 = &mut _24;
 -         _59 = Pin::<&mut {closure@$DIR/async_drop.rs:70:25: 70:27}>::new_unchecked(move _60) -> [return: bb91, unwind: bb38];
-+         _2 = move _103;
++         _183 = move _103;
 +         StorageDead(_103);
 +         goto -> bb97;
       }
@@ -1098,8 +1067,8 @@
   
       bb96: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb96, unwind: bb95];
-+         _108 = move _2;
-+         _107 = move _108;
++         _108 = move _183;
++         _107 = copy (_108.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb95;
       }
   
@@ -1149,7 +1118,7 @@
       bb103: {
 -         _68 = &mut _61;
 -         _65 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _68) -> [return: bb102, unwind: bb95];
-+         _2 = move _113;
++         _183 = move _113;
 +         StorageDead(_113);
 +         goto -> bb102;
       }
@@ -1158,7 +1127,7 @@
 -         _2 = move _69;
 -         StorageDead(_69);
 -         goto -> bb110;
-+         _2 = move _120;
++         _183 = move _120;
 +         StorageDead(_120);
 +         goto -> bb109;
       }
@@ -1189,8 +1158,8 @@
   
       bb108: {
 -         _70 = <impl Future<Output = ()> as Future>::poll(move _72, move _73) -> [return: bb107, unwind: bb95];
-+         _125 = move _2;
-+         _124 = move _125;
++         _125 = move _183;
++         _124 = copy (_125.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb107;
       }
   
@@ -1240,14 +1209,14 @@
 -         StorageDead(_78);
 -         goto -> bb41;
 +     bb115: {
-+         _2 = move _130;
++         _183 = move _130;
 +         StorageDead(_130);
 +         goto -> bb114;
       }
   
       bb116: {
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb116, unwind: bb115];
-+         _2 = move _137;
++         _183 = move _137;
 +         StorageDead(_137);
 +         goto -> bb121;
       }
@@ -1280,8 +1249,8 @@
       bb120: {
 -         _81 = discriminant(_80);
 -         switchInt(move _81) -> [0: bb114, 1: bb119, otherwise: bb59];
-+         _142 = move _2;
-+         _141 = move _142;
++         _142 = move _183;
++         _141 = copy (_142.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb119;
       }
   
@@ -1331,14 +1300,14 @@
       bb127: {
 -         _88 = discriminant(_87);
 -         switchInt(move _88) -> [0: bb113, 1: bb126, otherwise: bb59];
-+         _2 = move _147;
++         _183 = move _147;
 +         StorageDead(_147);
 +         goto -> bb126;
       }
   
       bb128: {
 -         _87 = <impl Future<Output = ()> as Future>::poll(move _89, move _90) -> [return: bb127, unwind: bb115];
-+         _2 = move _154;
++         _183 = move _154;
 +         StorageDead(_154);
 +         goto -> bb133;
       }
@@ -1369,8 +1338,8 @@
       bb132: {
 -         _94 = &mut _19;
 -         _93 = Pin::<&mut AsyncInt>::new_unchecked(move _94) -> [return: bb131, unwind: bb41];
-+         _159 = move _2;
-+         _158 = move _159;
++         _159 = move _183;
++         _158 = copy (_159.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb131;
       }
   
@@ -1421,7 +1390,7 @@
       bb139: {
 -         StorageLive(_96);
 -         _96 = yield(const ()) -> [resume: bb137, drop: bb138];
-+         _2 = move _164;
++         _183 = move _164;
 +         StorageDead(_164);
 +         goto -> bb138;
       }
@@ -1429,7 +1398,7 @@
       bb140: {
 -         _98 = discriminant(_97);
 -         switchInt(move _98) -> [0: bb134, 1: bb139, otherwise: bb59];
-+         _2 = move _171;
++         _183 = move _171;
 +         StorageDead(_171);
 +         goto -> bb145;
       }
@@ -1460,8 +1429,8 @@
 -         _2 = move _103;
 -         StorageDead(_103);
 -         goto -> bb150;
-+         _176 = move _2;
-+         _175 = move _176;
++         _176 = move _183;
++         _175 = copy (_176.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb143;
       }
   
@@ -1507,7 +1476,7 @@
 +         StorageLive(_23);
 +         StorageLive(_25);
 +         StorageLive(_28);
-+         _28 = move _2;
++         _28 = move _183;
 +         goto -> bb42;
       }
   
@@ -1518,7 +1487,7 @@
 +         StorageLive(_23);
 +         StorageLive(_25);
 +         StorageLive(_35);
-+         _35 = move _2;
++         _35 = move _183;
 +         goto -> bb44;
       }
   
@@ -1528,7 +1497,7 @@
 +         StorageLive(_17);
 +         StorageLive(_23);
 +         StorageLive(_45);
-+         _45 = move _2;
++         _45 = move _183;
 +         goto -> bb55;
       }
   
@@ -1538,7 +1507,7 @@
 +         StorageLive(_17);
 +         StorageLive(_23);
 +         StorageLive(_52);
-+         _52 = move _2;
++         _52 = move _183;
 +         goto -> bb56;
       }
   
@@ -1547,7 +1516,7 @@
 -         goto -> bb30;
 +         StorageLive(_17);
 +         StorageLive(_62);
-+         _62 = move _2;
++         _62 = move _183;
 +         goto -> bb67;
       }
   
@@ -1557,7 +1526,7 @@
 +     bb155: {
 +         StorageLive(_17);
 +         StorageLive(_69);
-+         _69 = move _2;
++         _69 = move _183;
 +         goto -> bb68;
       }
   
@@ -1565,7 +1534,7 @@
 -         assert(const false, "`async fn` resumed after async drop") -> [success: bb156, unwind: bb155];
 +         StorageLive(_17);
 +         StorageLive(_79);
-+         _79 = move _2;
++         _79 = move _183;
 +         goto -> bb79;
       }
   
@@ -1575,7 +1544,7 @@
 -         goto -> bb156;
 +         StorageLive(_17);
 +         StorageLive(_86);
-+         _86 = move _2;
++         _86 = move _183;
 +         goto -> bb80;
       }
   
@@ -1584,7 +1553,7 @@
 -         StorageDead(_113);
 -         goto -> bb163;
 +         StorageLive(_96);
-+         _96 = move _2;
++         _96 = move _183;
 +         goto -> bb91;
       }
   
@@ -1592,7 +1561,7 @@
 -         StorageLive(_113);
 -         _113 = yield(const ()) -> [resume: bb157, drop: bb158];
 +         StorageLive(_103);
-+         _103 = move _2;
++         _103 = move _183;
 +         goto -> bb92;
       }
   
@@ -1600,14 +1569,14 @@
 -         _115 = discriminant(_114);
 -         switchInt(move _115) -> [0: bb154, 1: bb159, otherwise: bb59];
 +         StorageLive(_113);
-+         _113 = move _2;
++         _113 = move _183;
 +         goto -> bb103;
       }
   
       bb161: {
 -         _114 = <impl Future<Output = ()> as Future>::poll(move _116, move _117) -> [return: bb160, unwind: bb155];
 +         StorageLive(_120);
-+         _120 = move _2;
++         _120 = move _183;
 +         goto -> bb104;
       }
   
@@ -1615,7 +1584,7 @@
 -         _118 = move _2;
 -         _117 = std::future::get_context::<'_, '_>(move _118) -> [return: bb161, unwind: bb155];
 +         StorageLive(_130);
-+         _130 = move _2;
++         _130 = move _183;
 +         goto -> bb115;
       }
   
@@ -1623,7 +1592,7 @@
 -         _119 = &mut _112;
 -         _116 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _119) -> [return: bb162, unwind: bb155];
 +         StorageLive(_137);
-+         _137 = move _2;
++         _137 = move _183;
 +         goto -> bb116;
       }
   
@@ -1632,7 +1601,7 @@
 -         StorageDead(_120);
 -         goto -> bb170;
 +         StorageLive(_147);
-+         _147 = move _2;
++         _147 = move _183;
 +         goto -> bb127;
       }
   
@@ -1641,7 +1610,7 @@
 -         StorageDead(_120);
 -         goto -> bb163;
 +         StorageLive(_154);
-+         _154 = move _2;
++         _154 = move _183;
 +         goto -> bb128;
       }
   
@@ -1649,7 +1618,7 @@
 -         StorageLive(_120);
 -         _120 = yield(const ()) -> [resume: bb164, drop: bb165];
 +         StorageLive(_164);
-+         _164 = move _2;
++         _164 = move _183;
 +         goto -> bb139;
       }
   
@@ -1657,7 +1626,7 @@
 -         _122 = discriminant(_121);
 -         switchInt(move _122) -> [0: bb153, 1: bb166, otherwise: bb59];
 +         StorageLive(_171);
-+         _171 = move _2;
++         _171 = move _183;
 +         goto -> bb140;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.simple-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_drop.simple-\173closure\0430\175.StateTransform.diff"
index 0f2b3ab..6454844 100644
--- "a/tests/mir-opt/coroutine/async_drop.simple-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_drop.simple-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,8 @@
 - fn simple::{closure#0}(_1: {async fn body of simple()}, _2: std::future::ResumeTy) -> ()
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     let mut _0: ();
 + fn simple::{closure#0}(_1: Pin<&mut {async fn body of simple()}>, _2: &mut Context<'_>) -> Poll<()> {
 +     coroutine layout {
 +         field _s0: ();
@@ -19,35 +21,32 @@
 +         }
 +         storage_conflicts = BitMatrix(4x4) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s0, _s3), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s1, _s3), (_s2, _s0), (_s2, _s1), (_s2, _s2), (_s2, _s3), (_s3, _s0), (_s3, _s1), (_s3, _s2), (_s3, _s3)}
 +     }
-      debug _task_context => _2;
--     let mut _0: ();
++     debug _task_context => _25;
 +     coroutine debug sync_int => _s1;
 +     let mut _0: std::task::Poll<()>;
       let _3: SyncInt;
       let mut _5: impl std::future::Future<Output = ()>;
--     let mut _6: std::future::ResumeTy;
-+     let mut _6: &mut std::task::Context<'_>;
+      let mut _6: std::future::ResumeTy;
       let mut _7: std::task::Poll<()>;
       let mut _8: isize;
       let mut _9: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _10: &mut std::task::Context<'_>;
--     let mut _11: std::future::ResumeTy;
-+     let mut _11: &mut std::task::Context<'_>;
+      let mut _11: std::future::ResumeTy;
       let mut _12: &mut impl std::future::Future<Output = ()>;
--     let mut _13: std::future::ResumeTy;
-+     let mut _13: &mut std::task::Context<'_>;
+      let mut _13: std::future::ResumeTy;
       let mut _14: std::task::Poll<()>;
       let mut _15: isize;
       let mut _16: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
       let mut _17: &mut std::task::Context<'_>;
--     let mut _18: std::future::ResumeTy;
-+     let mut _18: &mut std::task::Context<'_>;
+      let mut _18: std::future::ResumeTy;
       let mut _19: &mut impl std::future::Future<Output = ()>;
       let mut _20: std::pin::Pin<&mut AsyncInt>;
       let mut _21: &mut AsyncInt;
 +     let mut _22: ();
 +     let mut _23: u32;
 +     let mut _24: &mut {async fn body of simple()};
++     let mut _25: std::future::ResumeTy;
++     let mut _26: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug sync_int => _3;
 +         debug sync_int => (((*_24) as variant#4).1: SyncInt);
@@ -66,6 +65,8 @@
 -         _4 = AsyncInt(const 0_i32);
 -         _0 = const ();
 -         goto -> bb30;
++         _26 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _25 = std::future::ResumeTy(move _26);
 +         _24 = copy (_1.0: &mut {async fn body of simple()});
 +         _23 = discriminant((*_24));
 +         switchInt(move _23) -> [0: bb26, 1: bb25, 2: bb24, 3: bb22, 4: bb23, otherwise: bb11];
@@ -136,7 +137,7 @@
       bb10: {
 -         StorageDead(_5);
 -         goto -> bb1;
-+         _2 = move _6;
++         _25 = move _6;
 +         StorageDead(_6);
 +         goto -> bb9;
       }
@@ -151,7 +152,7 @@
 -         StorageDead(_5);
 -         goto -> bb7;
 +     bb12: {
-+         _2 = move _13;
++         _25 = move _13;
 +         StorageDead(_13);
 +         goto -> bb17;
       }
@@ -183,8 +184,8 @@
       bb16: {
 -         StorageLive(_6);
 -         _6 = yield(const ()) -> [resume: bb14, drop: bb15];
-+         _18 = move _2;
-+         _17 = move _18;
++         _18 = move _25;
++         _17 = copy (_18.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb15;
       }
   
@@ -226,7 +227,7 @@
 -         StorageDead(_13);
 -         goto -> bb28;
 +         StorageLive(_6);
-+         _6 = move _2;
++         _6 = move _25;
 +         goto -> bb10;
       }
   
@@ -235,7 +236,7 @@
 -         StorageDead(_13);
 -         goto -> bb21;
 +         StorageLive(_13);
-+         _13 = move _2;
++         _13 = move _25;
 +         goto -> bb12;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_drop.simple-\173closure\0430\175.coroutine_drop_async.0.mir" "b/tests/mir-opt/coroutine/async_drop.simple-\173closure\0430\175.coroutine_drop_async.0.mir"
index bc3def6..a09f6ec 100644
--- "a/tests/mir-opt/coroutine/async_drop.simple-\173closure\0430\175.coroutine_drop_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_drop.simple-\173closure\0430\175.coroutine_drop_async.0.mir"
@@ -1,29 +1,31 @@
 // MIR for `simple::{closure#0}` 0 coroutine_drop_async
 
 fn simple::{closure#0}(_1: Pin<&mut {async fn body of simple()}>, _2: &mut Context<'_>) -> Poll<()> {
-    debug _task_context => _2;
+    debug _task_context => _25;
     let mut _0: std::task::Poll<()>;
     let _3: SyncInt;
     let mut _5: impl std::future::Future<Output = ()>;
-    let mut _6: &mut std::task::Context<'_>;
+    let mut _6: std::future::ResumeTy;
     let mut _7: std::task::Poll<()>;
     let mut _8: isize;
     let mut _9: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _10: &mut std::task::Context<'_>;
-    let mut _11: &mut std::task::Context<'_>;
+    let mut _11: std::future::ResumeTy;
     let mut _12: &mut impl std::future::Future<Output = ()>;
-    let mut _13: &mut std::task::Context<'_>;
+    let mut _13: std::future::ResumeTy;
     let mut _14: std::task::Poll<()>;
     let mut _15: isize;
     let mut _16: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _17: &mut std::task::Context<'_>;
-    let mut _18: &mut std::task::Context<'_>;
+    let mut _18: std::future::ResumeTy;
     let mut _19: &mut impl std::future::Future<Output = ()>;
     let mut _20: std::pin::Pin<&mut AsyncInt>;
     let mut _21: &mut AsyncInt;
     let mut _22: ();
     let mut _23: u32;
     let mut _24: &mut {async fn body of simple()};
+    let mut _25: std::future::ResumeTy;
+    let mut _26: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         debug sync_int => (((*_24) as variant#4).1: SyncInt);
         let _4: AsyncInt;
@@ -33,6 +35,8 @@
     }
 
     bb0: {
+        _26 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _25 = std::future::ResumeTy(move _26);
         _24 = copy (_1.0: &mut {async fn body of simple()});
         _23 = discriminant((*_24));
         switchInt(move _23) -> [0: bb18, 2: bb23, 3: bb21, 4: bb22, otherwise: bb24];
@@ -78,7 +82,7 @@
     }
 
     bb9: {
-        _2 = move _6;
+        _25 = move _6;
         StorageDead(_6);
         goto -> bb15;
     }
@@ -105,8 +109,8 @@
     }
 
     bb14: {
-        _11 = move _2;
-        _10 = move _11;
+        _11 = move _25;
+        _10 = copy (_11.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
         goto -> bb13;
     }
 
@@ -116,7 +120,7 @@
     }
 
     bb16: {
-        _2 = move _13;
+        _25 = move _13;
         StorageDead(_13);
         goto -> bb15;
     }
@@ -141,13 +145,13 @@
 
     bb21: {
         StorageLive(_6);
-        _6 = move _2;
+        _6 = move _25;
         goto -> bb9;
     }
 
     bb22: {
         StorageLive(_13);
-        _13 = move _2;
+        _13 = move _25;
         goto -> bb16;
     }
 
diff --git "a/tests/mir-opt/coroutine/async_drop_live_dead.a-\173closure\0430\175.coroutine_drop_async.0.panic-abort.mir" "b/tests/mir-opt/coroutine/async_drop_live_dead.a-\173closure\0430\175.coroutine_drop_async.0.panic-abort.mir"
index 1790b35..d93774c 100644
--- "a/tests/mir-opt/coroutine/async_drop_live_dead.a-\173closure\0430\175.coroutine_drop_async.0.panic-abort.mir"
+++ "b/tests/mir-opt/coroutine/async_drop_live_dead.a-\173closure\0430\175.coroutine_drop_async.0.panic-abort.mir"
@@ -1,35 +1,39 @@
 // MIR for `a::{closure#0}` 0 coroutine_drop_async
 
 fn a::{closure#0}(_1: Pin<&mut {async fn body of a<T>()}>, _2: &mut Context<'_>) -> Poll<()> {
-    debug _task_context => _2;
+    debug _task_context => _24;
     debug x => ((*_23).0: T);
     let mut _0: std::task::Poll<()>;
     let _3: T;
     let mut _4: impl std::future::Future<Output = ()>;
-    let mut _5: &mut std::task::Context<'_>;
+    let mut _5: std::future::ResumeTy;
     let mut _6: std::task::Poll<()>;
     let mut _7: isize;
     let mut _8: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _9: &mut std::task::Context<'_>;
-    let mut _10: &mut std::task::Context<'_>;
+    let mut _10: std::future::ResumeTy;
     let mut _11: &mut impl std::future::Future<Output = ()>;
-    let mut _12: &mut std::task::Context<'_>;
+    let mut _12: std::future::ResumeTy;
     let mut _13: std::task::Poll<()>;
     let mut _14: isize;
     let mut _15: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _16: &mut std::task::Context<'_>;
-    let mut _17: &mut std::task::Context<'_>;
+    let mut _17: std::future::ResumeTy;
     let mut _18: &mut impl std::future::Future<Output = ()>;
     let mut _19: std::pin::Pin<&mut T>;
     let mut _20: &mut T;
     let mut _21: ();
     let mut _22: u32;
     let mut _23: &mut {async fn body of a<T>()};
+    let mut _24: std::future::ResumeTy;
+    let mut _25: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         debug x => (((*_23) as variant#4).1: T);
     }
 
     bb0: {
+        _25 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _24 = std::future::ResumeTy(move _25);
         _23 = copy (_1.0: &mut {async fn body of a<T>()});
         _22 = discriminant((*_23));
         switchInt(move _22) -> [0: bb13, 3: bb16, 4: bb17, otherwise: bb18];
@@ -51,7 +55,7 @@
     }
 
     bb4: {
-        _2 = move _5;
+        _24 = move _5;
         StorageDead(_5);
         goto -> bb10;
     }
@@ -78,8 +82,8 @@
     }
 
     bb9: {
-        _10 = move _2;
-        _9 = move _10;
+        _10 = move _24;
+        _9 = copy (_10.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
         goto -> bb8;
     }
 
@@ -89,7 +93,7 @@
     }
 
     bb11: {
-        _2 = move _12;
+        _24 = move _12;
         StorageDead(_12);
         goto -> bb10;
     }
@@ -113,13 +117,13 @@
 
     bb16: {
         StorageLive(_5);
-        _5 = move _2;
+        _5 = move _24;
         goto -> bb4;
     }
 
     bb17: {
         StorageLive(_12);
-        _12 = move _2;
+        _12 = move _24;
         goto -> bb11;
     }
 
diff --git "a/tests/mir-opt/coroutine/async_drop_live_dead.a-\173closure\0430\175.coroutine_drop_async.0.panic-unwind.mir" "b/tests/mir-opt/coroutine/async_drop_live_dead.a-\173closure\0430\175.coroutine_drop_async.0.panic-unwind.mir"
index 83bfc39..7c8426f 100644
--- "a/tests/mir-opt/coroutine/async_drop_live_dead.a-\173closure\0430\175.coroutine_drop_async.0.panic-unwind.mir"
+++ "b/tests/mir-opt/coroutine/async_drop_live_dead.a-\173closure\0430\175.coroutine_drop_async.0.panic-unwind.mir"
@@ -1,35 +1,39 @@
 // MIR for `a::{closure#0}` 0 coroutine_drop_async
 
 fn a::{closure#0}(_1: Pin<&mut {async fn body of a<T>()}>, _2: &mut Context<'_>) -> Poll<()> {
-    debug _task_context => _2;
+    debug _task_context => _24;
     debug x => ((*_23).0: T);
     let mut _0: std::task::Poll<()>;
     let _3: T;
     let mut _4: impl std::future::Future<Output = ()>;
-    let mut _5: &mut std::task::Context<'_>;
+    let mut _5: std::future::ResumeTy;
     let mut _6: std::task::Poll<()>;
     let mut _7: isize;
     let mut _8: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _9: &mut std::task::Context<'_>;
-    let mut _10: &mut std::task::Context<'_>;
+    let mut _10: std::future::ResumeTy;
     let mut _11: &mut impl std::future::Future<Output = ()>;
-    let mut _12: &mut std::task::Context<'_>;
+    let mut _12: std::future::ResumeTy;
     let mut _13: std::task::Poll<()>;
     let mut _14: isize;
     let mut _15: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
     let mut _16: &mut std::task::Context<'_>;
-    let mut _17: &mut std::task::Context<'_>;
+    let mut _17: std::future::ResumeTy;
     let mut _18: &mut impl std::future::Future<Output = ()>;
     let mut _19: std::pin::Pin<&mut T>;
     let mut _20: &mut T;
     let mut _21: ();
     let mut _22: u32;
     let mut _23: &mut {async fn body of a<T>()};
+    let mut _24: std::future::ResumeTy;
+    let mut _25: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         debug x => (((*_23) as variant#4).1: T);
     }
 
     bb0: {
+        _25 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _24 = std::future::ResumeTy(move _25);
         _23 = copy (_1.0: &mut {async fn body of a<T>()});
         _22 = discriminant((*_23));
         switchInt(move _22) -> [0: bb17, 2: bb23, 3: bb21, 4: bb22, otherwise: bb24];
@@ -65,7 +69,7 @@
     }
 
     bb7: {
-        _2 = move _5;
+        _24 = move _5;
         StorageDead(_5);
         goto -> bb13;
     }
@@ -92,8 +96,8 @@
     }
 
     bb12: {
-        _10 = move _2;
-        _9 = move _10;
+        _10 = move _24;
+        _9 = copy (_10.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
         goto -> bb11;
     }
 
@@ -103,7 +107,7 @@
     }
 
     bb14: {
-        _2 = move _12;
+        _24 = move _12;
         StorageDead(_12);
         goto -> bb13;
     }
@@ -136,13 +140,13 @@
 
     bb21: {
         StorageLive(_5);
-        _5 = move _2;
+        _5 = move _24;
         goto -> bb7;
     }
 
     bb22: {
         StorageLive(_12);
-        _12 = move _2;
+        _12 = move _24;
         goto -> bb14;
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
index 3619637..c893394 100644
--- "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,10 @@
 - fn add::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:34:13: 34:18}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug x => (*(_1.0: &u32));
+-     debug y => (*(_1.1: &u32));
+-     let mut _0: u32;
 + fn add::{closure#0}::{closure#0}(_1: Pin<&mut {async block@$DIR/async_fn.rs:34:13: 34:18}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         variant_fields = {
@@ -13,10 +17,7 @@
 +         }
 +         storage_conflicts = BitMatrix(0x0) {}
 +     }
-      debug _task_context => _2;
--     debug x => (*(_1.0: &u32));
--     debug y => (*(_1.1: &u32));
--     let mut _0: u32;
++     debug _task_context => _10;
 +     debug x => (*((*_9).0: &u32));
 +     debug y => (*((*_9).1: &u32));
 +     let mut _0: std::task::Poll<u32>;
@@ -27,6 +28,8 @@
 +     let mut _7: u32;
 +     let mut _8: u32;
 +     let mut _9: &mut {async block@$DIR/async_fn.rs:34:13: 34:18};
++     let mut _10: std::future::ResumeTy;
++     let mut _11: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         StorageLive(_3);
@@ -39,6 +42,8 @@
 -         StorageDead(_4);
 -         StorageDead(_3);
 -         drop(_1) -> [return: bb1, unwind: bb2];
++         _11 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _10 = std::future::ResumeTy(move _11);
 +         _9 = copy (_1.0: &mut {async block@$DIR/async_fn.rs:34:13: 34:18});
 +         _8 = discriminant((*_9));
 +         switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4];
diff --git "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
index 0439d4c..bc31fc3 100644
--- "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
@@ -5,7 +5,7 @@
     debug x => (*((*_1).0: &u32));
     debug y => (*((*_1).1: &u32));
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let mut _3: u32;
     let mut _4: u32;
     let mut _5: &u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index 0c8f25d..a415461 100644
--- "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,8 +2,12 @@
 
 fn add::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:34:13: 34:18}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.StateTransform.diff"
index 472d469..af2d7de 100644
--- "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,10 @@
 - fn add::{closure#0}(_1: {async fn body of add()}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug x => (_1.0: u32);
+-     debug y => (_1.1: u32);
+-     let mut _0: u32;
 + fn add::{closure#0}(_1: Pin<&mut {async fn body of add()}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         field _s0: u32;
@@ -17,10 +21,7 @@
 +         }
 +         storage_conflicts = BitMatrix(3x3) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s2, _s0), (_s2, _s1), (_s2, _s2)}
 +     }
-      debug _task_context => _2;
--     debug x => (_1.0: u32);
--     debug y => (_1.1: u32);
--     let mut _0: u32;
++     debug _task_context => _28;
 +     debug x => ((*_27).0: u32);
 +     debug y => ((*_27).1: u32);
 +     coroutine debug x => _s0;
@@ -38,16 +39,16 @@
       let mut _16: &mut {async block@$DIR/async_fn.rs:34:13: 34:18};
       let mut _17: &mut std::task::Context<'_>;
       let mut _18: &mut std::task::Context<'_>;
--     let mut _19: std::future::ResumeTy;
-+     let mut _19: &mut std::task::Context<'_>;
+      let mut _19: std::future::ResumeTy;
       let mut _20: isize;
       let mut _22: !;
--     let mut _23: std::future::ResumeTy;
-+     let mut _23: &mut std::task::Context<'_>;
+      let mut _23: std::future::ResumeTy;
       let mut _24: ();
 +     let mut _25: u32;
 +     let mut _26: u32;
 +     let mut _27: &mut {async fn body of add()};
++     let mut _28: std::future::ResumeTy;
++     let mut _29: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug x => _3;
 +         debug x => (((*_27) as variant#3).0: u32);
@@ -90,6 +91,8 @@
 -         StorageLive(_9);
 -         _9 = move _5;
 -         _8 = <{async block@$DIR/async_fn.rs:34:13: 34:18} as IntoFuture>::into_future(move _9) -> [return: bb1, unwind: bb24];
++         _29 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _28 = std::future::ResumeTy(move _29);
 +         _27 = copy (_1.0: &mut {async fn body of add()});
 +         _26 = discriminant((*_27));
 +         switchInt(move _26) -> [0: bb28, 1: bb27, 2: bb26, 3: bb25, otherwise: bb6];
@@ -123,9 +126,10 @@
           StorageLive(_17);
           StorageLive(_18);
           StorageLive(_19);
-          _19 = copy _2;
+-         _19 = copy _2;
 -         _18 = std::future::get_context::<'_, '_>(move _19) -> [return: bb4, unwind: bb19];
-+         _18 = move _19;
++         _19 = copy _28;
++         _18 = copy (_19.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb4;
       }
   
@@ -181,7 +185,8 @@
   
       bb9: {
           StorageDead(_24);
-          _2 = move _23;
+-         _2 = move _23;
++         _28 = move _23;
           StorageDead(_23);
           _11 = const ();
           goto -> bb2;
@@ -310,7 +315,7 @@
 +         StorageLive(_8);
 +         StorageLive(_23);
 +         StorageLive(_24);
-+         _23 = move _2;
++         _23 = move _28;
 +         goto -> bb9;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.coroutine_drop.0.mir"
index ecff837..36b32d6 100644
--- "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.coroutine_drop.0.mir"
@@ -5,7 +5,7 @@
     debug x => ((*_1).0: u32);
     debug y => ((*_1).1: u32);
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let _3: u32;
     let mut _6: &u32;
     let mut _7: &u32;
@@ -19,10 +19,10 @@
     let mut _16: &mut {async block@$DIR/async_fn.rs:34:13: 34:18};
     let mut _17: &mut std::task::Context<'_>;
     let mut _18: &mut std::task::Context<'_>;
-    let mut _19: &mut std::task::Context<'_>;
+    let mut _19: std::future::ResumeTy;
     let mut _20: isize;
     let mut _22: !;
-    let mut _23: &mut std::task::Context<'_>;
+    let mut _23: std::future::ResumeTy;
     let mut _24: ();
     let mut _25: u32;
     let mut _26: u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index c86391c..f398c48 100644
--- "a/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.add-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,6 +2,8 @@
 
 fn add::{closure#0}(_1: {async fn body of add()}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         scope 2 {
             scope 3 {
@@ -14,6 +16,8 @@
     }
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.StateTransform.diff"
index 9a64430..3e791a0 100644
--- "a/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,12 @@
 - fn build_aggregate::{closure#0}(_1: {async fn body of build_aggregate()}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug a => (_1.0: u32);
+-     debug b => (_1.1: u32);
+-     debug c => (_1.2: u32);
+-     debug d => (_1.3: u32);
+-     let mut _0: u32;
 + fn build_aggregate::{closure#0}(_1: Pin<&mut {async fn body of build_aggregate()}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         field _s0: u32;
@@ -20,12 +26,7 @@
 +         }
 +         storage_conflicts = BitMatrix(5x5) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s0, _s3), (_s0, _s4), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s1, _s3), (_s1, _s4), (_s2, _s0), (_s2, _s1), (_s2, _s2), (_s2, _s3), (_s2, _s4), (_s3, _s0), (_s3, _s1), (_s3, _s2), (_s3, _s3), (_s4, _s0), (_s4, _s1), (_s4, _s2), (_s4, _s4)}
 +     }
-      debug _task_context => _2;
--     debug a => (_1.0: u32);
--     debug b => (_1.1: u32);
--     debug c => (_1.2: u32);
--     debug d => (_1.3: u32);
--     let mut _0: u32;
++     debug _task_context => _52;
 +     debug a => ((*_51).0: u32);
 +     debug b => ((*_51).1: u32);
 +     debug c => ((*_51).2: u32);
@@ -45,12 +46,10 @@
       let mut _19: &mut {async fn body of add()};
       let mut _20: &mut std::task::Context<'_>;
       let mut _21: &mut std::task::Context<'_>;
--     let mut _22: std::future::ResumeTy;
-+     let mut _22: &mut std::task::Context<'_>;
+      let mut _22: std::future::ResumeTy;
       let mut _23: isize;
       let mut _25: !;
--     let mut _26: std::future::ResumeTy;
-+     let mut _26: &mut std::task::Context<'_>;
+      let mut _26: std::future::ResumeTy;
       let mut _27: ();
       let mut _28: u32;
       let mut _29: {async fn body of add()};
@@ -64,18 +63,18 @@
       let mut _38: &mut {async fn body of add()};
       let mut _39: &mut std::task::Context<'_>;
       let mut _40: &mut std::task::Context<'_>;
--     let mut _41: std::future::ResumeTy;
-+     let mut _41: &mut std::task::Context<'_>;
+      let mut _41: std::future::ResumeTy;
       let mut _42: isize;
       let mut _44: !;
--     let mut _45: std::future::ResumeTy;
-+     let mut _45: &mut std::task::Context<'_>;
+      let mut _45: std::future::ResumeTy;
       let mut _46: ();
       let mut _47: u32;
       let mut _48: u32;
 +     let mut _49: u32;
 +     let mut _50: u32;
 +     let mut _51: &mut {async fn body of build_aggregate()};
++     let mut _52: std::future::ResumeTy;
++     let mut _53: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
           debug a => _3;
           let _4: u32;
@@ -138,6 +137,8 @@
 -         StorageLive(_12);
 -         _12 = copy _4;
 -         _10 = add(move _11, move _12) -> [return: bb1, unwind: bb49];
++         _53 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _52 = std::future::ResumeTy(move _53);
 +         _51 = copy (_1.0: &mut {async fn body of build_aggregate()});
 +         _50 = discriminant((*_51));
 +         switchInt(move _50) -> [0: bb49, 1: bb48, 2: bb47, 3: bb45, 4: bb46, otherwise: bb7];
@@ -178,9 +179,10 @@
           StorageLive(_20);
           StorageLive(_21);
           StorageLive(_22);
-          _22 = copy _2;
+-         _22 = copy _2;
 -         _21 = std::future::get_context::<'_, '_>(move _22) -> [return: bb5, unwind: bb42];
-+         _21 = move _22;
++         _22 = copy _52;
++         _21 = copy (_22.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb5;
       }
   
@@ -238,7 +240,8 @@
   
       bb10: {
           StorageDead(_27);
-          _2 = move _26;
+-         _2 = move _26;
++         _52 = move _26;
           StorageDead(_26);
           _14 = const ();
           goto -> bb3;
@@ -295,9 +298,10 @@
           StorageLive(_39);
           StorageLive(_40);
           StorageLive(_41);
-          _41 = copy _2;
+-         _41 = copy _2;
 -         _40 = std::future::get_context::<'_, '_>(move _41) -> [return: bb16, unwind: bb33];
-+         _40 = move _41;
++         _41 = copy _52;
++         _40 = copy (_41.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb16;
       }
   
@@ -352,7 +356,8 @@
   
       bb20: {
           StorageDead(_46);
-          _2 = move _45;
+-         _2 = move _45;
++         _52 = move _45;
           StorageDead(_45);
           _14 = const ();
           goto -> bb14;
@@ -630,7 +635,7 @@
 +         StorageLive(_9);
 +         StorageLive(_26);
 +         StorageLive(_27);
-+         _26 = move _2;
++         _26 = move _52;
 +         goto -> bb10;
       }
   
@@ -646,7 +651,7 @@
 +         StorageLive(_29);
 +         StorageLive(_45);
 +         StorageLive(_46);
-+         _45 = move _2;
++         _45 = move _52;
 +         goto -> bb20;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.coroutine_drop.0.mir"
index bd5fea3..11cafac 100644
--- "a/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.coroutine_drop.0.mir"
@@ -7,7 +7,7 @@
     debug c => ((*_1).2: u32);
     debug d => ((*_1).3: u32);
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let _3: u32;
     let mut _8: u32;
     let mut _9: {async fn body of add()};
@@ -22,10 +22,10 @@
     let mut _19: &mut {async fn body of add()};
     let mut _20: &mut std::task::Context<'_>;
     let mut _21: &mut std::task::Context<'_>;
-    let mut _22: &mut std::task::Context<'_>;
+    let mut _22: std::future::ResumeTy;
     let mut _23: isize;
     let mut _25: !;
-    let mut _26: &mut std::task::Context<'_>;
+    let mut _26: std::future::ResumeTy;
     let mut _27: ();
     let mut _28: u32;
     let mut _29: {async fn body of add()};
@@ -39,10 +39,10 @@
     let mut _38: &mut {async fn body of add()};
     let mut _39: &mut std::task::Context<'_>;
     let mut _40: &mut std::task::Context<'_>;
-    let mut _41: &mut std::task::Context<'_>;
+    let mut _41: std::future::ResumeTy;
     let mut _42: isize;
     let mut _44: !;
-    let mut _45: &mut std::task::Context<'_>;
+    let mut _45: std::future::ResumeTy;
     let mut _46: ();
     let mut _47: u32;
     let mut _48: u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index 9f06ae9..68b809e 100644
--- "a/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.build_aggregate-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,6 +2,8 @@
 
 fn build_aggregate::{closure#0}(_1: {async fn body of build_aggregate()}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         scope 2 {
             scope 3 {
@@ -22,6 +24,8 @@
     }
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
index b902c7c..e54cc4c 100644
--- "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,10 @@
 - fn foo::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:21:13: 21:18}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug y => (*(_1.0: &u32));
+-     debug z => (*(_1.1: &u32));
+-     let mut _0: u32;
 + fn foo::{closure#0}::{closure#0}(_1: Pin<&mut {async block@$DIR/async_fn.rs:21:13: 21:18}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         variant_fields = {
@@ -13,10 +17,7 @@
 +         }
 +         storage_conflicts = BitMatrix(0x0) {}
 +     }
-      debug _task_context => _2;
--     debug y => (*(_1.0: &u32));
--     debug z => (*(_1.1: &u32));
--     let mut _0: u32;
++     debug _task_context => _10;
 +     debug y => (*((*_9).0: &u32));
 +     debug z => (*((*_9).1: &u32));
 +     let mut _0: std::task::Poll<u32>;
@@ -27,6 +28,8 @@
 +     let mut _7: u32;
 +     let mut _8: u32;
 +     let mut _9: &mut {async block@$DIR/async_fn.rs:21:13: 21:18};
++     let mut _10: std::future::ResumeTy;
++     let mut _11: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         StorageLive(_3);
@@ -39,6 +42,8 @@
 -         StorageDead(_4);
 -         StorageDead(_3);
 -         drop(_1) -> [return: bb1, unwind: bb2];
++         _11 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _10 = std::future::ResumeTy(move _11);
 +         _9 = copy (_1.0: &mut {async block@$DIR/async_fn.rs:21:13: 21:18});
 +         _8 = discriminant((*_9));
 +         switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4];
diff --git "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
index c22d1ca..97b9a70 100644
--- "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
@@ -5,7 +5,7 @@
     debug y => (*((*_1).0: &u32));
     debug z => (*((*_1).1: &u32));
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let mut _3: u32;
     let mut _4: u32;
     let mut _5: &u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index 19fe75d..b15cd69 100644
--- "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,8 +2,12 @@
 
 fn foo::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:21:13: 21:18}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.StateTransform.diff"
index 86cac4a..cfbf542 100644
--- "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,10 @@
 - fn foo::{closure#0}(_1: {async fn body of foo()}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug x => (_1.0: &u32);
+-     debug y => (_1.1: u32);
+-     let mut _0: u32;
 + fn foo::{closure#0}(_1: Pin<&mut {async fn body of foo()}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         field _s0: &u32;
@@ -18,10 +22,7 @@
 +         }
 +         storage_conflicts = BitMatrix(4x4) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s0, _s3), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s1, _s3), (_s2, _s0), (_s2, _s1), (_s2, _s2), (_s2, _s3), (_s3, _s0), (_s3, _s1), (_s3, _s2), (_s3, _s3)}
 +     }
-      debug _task_context => _2;
--     debug x => (_1.0: &u32);
--     debug y => (_1.1: u32);
--     let mut _0: u32;
++     debug _task_context => _38;
 +     debug x => ((*_36).0: &u32);
 +     debug y => ((*_36).1: u32);
 +     coroutine debug x => _s0;
@@ -39,12 +40,10 @@
       let mut _19: &mut {async block@$DIR/async_fn.rs:21:13: 21:18};
       let mut _20: &mut std::task::Context<'_>;
       let mut _21: &mut std::task::Context<'_>;
--     let mut _22: std::future::ResumeTy;
-+     let mut _22: &mut std::task::Context<'_>;
+      let mut _22: std::future::ResumeTy;
       let mut _23: isize;
       let mut _25: !;
--     let mut _26: std::future::ResumeTy;
-+     let mut _26: &mut std::task::Context<'_>;
+      let mut _26: std::future::ResumeTy;
       let mut _27: ();
       let mut _30: u32;
       let mut _31: u32;
@@ -54,6 +53,8 @@
 +     let mut _35: u32;
 +     let mut _36: &mut {async fn body of foo()};
 +     let mut _37: &u32;
++     let mut _38: std::future::ResumeTy;
++     let mut _39: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug x => _3;
 +         debug x => (((*_36) as variant#3).0: &u32);
@@ -123,6 +124,8 @@
 -         StorageDead(_12);
 -         StorageDead(_11);
 -         _9 = <{async block@$DIR/async_fn.rs:21:13: 21:18} as IntoFuture>::into_future(move _10) -> [return: bb1, unwind: bb22];
++         _39 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _38 = std::future::ResumeTy(move _39);
 +         _36 = copy (_1.0: &mut {async fn body of foo()});
 +         _35 = discriminant((*_36));
 +         switchInt(move _35) -> [0: bb26, 1: bb25, 2: bb24, 3: bb23, otherwise: bb6];
@@ -156,9 +159,10 @@
           StorageLive(_20);
           StorageLive(_21);
           StorageLive(_22);
-          _22 = copy _2;
+-         _22 = copy _2;
 -         _21 = std::future::get_context::<'_, '_>(move _22) -> [return: bb4, unwind: bb17];
-+         _21 = move _22;
++         _22 = copy _38;
++         _21 = copy (_22.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb4;
       }
   
@@ -215,7 +219,8 @@
   
       bb9: {
           StorageDead(_27);
-          _2 = move _26;
+-         _2 = move _26;
++         _38 = move _26;
           StorageDead(_26);
           _14 = const ();
           goto -> bb2;
@@ -368,7 +373,7 @@
 +         StorageLive(_9);
 +         StorageLive(_26);
 +         StorageLive(_27);
-+         _26 = move _2;
++         _26 = move _38;
 +         goto -> bb9;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.coroutine_drop.0.mir"
index 1ce52d3..6e17bfb 100644
--- "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.coroutine_drop.0.mir"
@@ -5,7 +5,7 @@
     debug x => ((*_1).0: &u32);
     debug y => ((*_1).1: u32);
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let _3: &u32;
     let mut _9: {async block@$DIR/async_fn.rs:21:13: 21:18};
     let mut _10: {async block@$DIR/async_fn.rs:21:13: 21:18};
@@ -19,10 +19,10 @@
     let mut _19: &mut {async block@$DIR/async_fn.rs:21:13: 21:18};
     let mut _20: &mut std::task::Context<'_>;
     let mut _21: &mut std::task::Context<'_>;
-    let mut _22: &mut std::task::Context<'_>;
+    let mut _22: std::future::ResumeTy;
     let mut _23: isize;
     let mut _25: !;
-    let mut _26: &mut std::task::Context<'_>;
+    let mut _26: std::future::ResumeTy;
     let mut _27: ();
     let mut _30: u32;
     let mut _31: u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index f7038fc..3eba893 100644
--- "a/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.foo-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,6 +2,8 @@
 
 fn foo::{closure#0}(_1: {async fn body of foo()}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         scope 2 {
             scope 3 {
@@ -24,6 +26,8 @@
     }
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.StateTransform.diff"
index fbbec5a..b6e211f 100644
--- "a/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,8 @@
 - fn hello_world::{closure#0}(_1: {async fn body of hello_world()}, _2: std::future::ResumeTy) -> ()
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     let mut _0: ();
 + fn hello_world::{closure#0}(_1: Pin<&mut {async fn body of hello_world()}>, _2: &mut Context<'_>) -> Poll<()> {
 +     coroutine layout {
 +         field _s0: [u8; 1];
@@ -18,8 +20,7 @@
 +         }
 +         storage_conflicts = BitMatrix(4x4) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s0, _s3), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s1, _s3), (_s2, _s0), (_s2, _s1), (_s2, _s2), (_s2, _s3), (_s3, _s0), (_s3, _s1), (_s3, _s2), (_s3, _s3)}
 +     }
-      debug _task_context => _2;
--     let mut _0: ();
++     debug _task_context => _36;
 +     coroutine debug data => _s0;
 +     let mut _0: std::task::Poll<()>;
       let _3: [u8; 1];
@@ -43,16 +44,16 @@
       let mut _24: &mut {async fn body of read_exact()};
       let mut _25: &mut std::task::Context<'_>;
       let mut _26: &mut std::task::Context<'_>;
--     let mut _27: std::future::ResumeTy;
-+     let mut _27: &mut std::task::Context<'_>;
+      let mut _27: std::future::ResumeTy;
       let mut _28: isize;
       let mut _30: !;
--     let mut _31: std::future::ResumeTy;
-+     let mut _31: &mut std::task::Context<'_>;
+      let mut _31: std::future::ResumeTy;
       let mut _32: ();
 +     let mut _33: ();
 +     let mut _34: u32;
 +     let mut _35: &mut {async fn body of hello_world()};
++     let mut _36: std::future::ResumeTy;
++     let mut _37: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug data => _3;
 +         debug data => (((*_35) as variant#3).0: [u8; 1]);
@@ -90,6 +91,8 @@
 -         StorageLive(_7);
 -         _7 = RangeFull;
 -         _5 = <[u8; 1] as Index<RangeFull>>::index(move _6, move _7) -> [return: bb1, unwind: bb30];
++         _37 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _36 = std::future::ResumeTy(move _37);
 +         _35 = copy (_1.0: &mut {async fn body of hello_world()});
 +         _34 = discriminant((*_35));
 +         switchInt(move _34) -> [0: bb33, 1: bb32, 2: bb31, 3: bb30, otherwise: bb8];
@@ -160,9 +163,10 @@
           StorageLive(_25);
           StorageLive(_26);
           StorageLive(_27);
-          _27 = copy _2;
+-         _27 = copy _2;
 -         _26 = std::future::get_context::<'_, '_>(move _27) -> [return: bb6, unwind: bb20];
-+         _26 = move _27;
++         _27 = copy _36;
++         _26 = copy (_27.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb6;
       }
   
@@ -221,7 +225,8 @@
   
       bb11: {
           StorageDead(_32);
-          _2 = move _31;
+-         _2 = move _31;
++         _36 = move _31;
           StorageDead(_31);
           _19 = const ();
           goto -> bb4;
@@ -416,7 +421,7 @@
 +         StorageLive(_17);
 +         StorageLive(_31);
 +         StorageLive(_32);
-+         _31 = move _2;
++         _31 = move _36;
 +         goto -> bb11;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.coroutine_drop.0.mir"
index 2fd801f..c8ee84c 100644
--- "a/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.coroutine_drop.0.mir"
@@ -3,7 +3,7 @@
 fn hello_world::{closure#0}(_1: &mut {async fn body of hello_world()}) -> () {
     debug _task_context => _2;
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let _3: [u8; 1];
     let _5: &[u8];
     let mut _6: &[u8; 1];
@@ -25,10 +25,10 @@
     let mut _24: &mut {async fn body of read_exact()};
     let mut _25: &mut std::task::Context<'_>;
     let mut _26: &mut std::task::Context<'_>;
-    let mut _27: &mut std::task::Context<'_>;
+    let mut _27: std::future::ResumeTy;
     let mut _28: isize;
     let mut _30: !;
-    let mut _31: &mut std::task::Context<'_>;
+    let mut _31: std::future::ResumeTy;
     let mut _32: ();
     let mut _33: ();
     let mut _34: u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index f611658..891d350 100644
--- "a/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.hello_world-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,6 +2,8 @@
 
 fn hello_world::{closure#0}(_1: {async fn body of hello_world()}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         scope 2 {
             scope 3 {
@@ -14,6 +16,8 @@
     }
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
index 00bddd7..6d004fa 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,9 @@
 - fn includes_never::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:61:18: 61:23}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug x => (*(_1.0: &u32));
+-     let mut _0: u32;
 + fn includes_never::{closure#0}::{closure#0}(_1: Pin<&mut {async block@$DIR/async_fn.rs:61:18: 61:23}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         variant_fields = {
@@ -13,9 +16,7 @@
 +         }
 +         storage_conflicts = BitMatrix(0x0) {}
 +     }
-      debug _task_context => _2;
--     debug x => (*(_1.0: &u32));
--     let mut _0: u32;
++     debug _task_context => _10;
 +     debug x => (*((*_9).0: &u32));
 +     let mut _0: std::task::Poll<u32>;
       let mut _3: u32;
@@ -25,6 +26,8 @@
 +     let mut _7: u32;
 +     let mut _8: u32;
 +     let mut _9: &mut {async block@$DIR/async_fn.rs:61:18: 61:23};
++     let mut _10: std::future::ResumeTy;
++     let mut _11: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         StorageLive(_3);
@@ -37,6 +40,8 @@
 -         StorageDead(_4);
 -         StorageDead(_3);
 -         drop(_1) -> [return: bb1, unwind: bb2];
++         _11 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _10 = std::future::ResumeTy(move _11);
 +         _9 = copy (_1.0: &mut {async block@$DIR/async_fn.rs:61:18: 61:23});
 +         _8 = discriminant((*_9));
 +         switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4];
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
index a17dbe3..e367ee4 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
@@ -4,7 +4,7 @@
     debug _task_context => _2;
     debug x => (*((*_1).0: &u32));
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let mut _3: u32;
     let mut _4: u32;
     let mut _5: &u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index 11fefd8..8058024 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,8 +2,12 @@
 
 fn includes_never::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:61:18: 61:23}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.StateTransform.diff"
index b516426..35f51cf 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.StateTransform.diff"
@@ -4,6 +4,9 @@
 - fn includes_never::{closure#0}::{closure#1}(_1: {async block@$DIR/async_fn.rs:67:15: 67:20}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug x => (*(_1.0: &u32));
+-     let mut _0: u32;
 + fn includes_never::{closure#0}::{closure#1}(_1: Pin<&mut {async block@$DIR/async_fn.rs:67:15: 67:20}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         variant_fields = {
@@ -13,9 +16,7 @@
 +         }
 +         storage_conflicts = BitMatrix(0x0) {}
 +     }
-      debug _task_context => _2;
--     debug x => (*(_1.0: &u32));
--     let mut _0: u32;
++     debug _task_context => _10;
 +     debug x => (*((*_9).0: &u32));
 +     let mut _0: std::task::Poll<u32>;
       let mut _3: u32;
@@ -25,6 +26,8 @@
 +     let mut _7: u32;
 +     let mut _8: u32;
 +     let mut _9: &mut {async block@$DIR/async_fn.rs:67:15: 67:20};
++     let mut _10: std::future::ResumeTy;
++     let mut _11: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         StorageLive(_3);
@@ -37,6 +40,8 @@
 -         StorageDead(_4);
 -         StorageDead(_3);
 -         drop(_1) -> [return: bb1, unwind: bb2];
++         _11 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _10 = std::future::ResumeTy(move _11);
 +         _9 = copy (_1.0: &mut {async block@$DIR/async_fn.rs:67:15: 67:20});
 +         _8 = discriminant((*_9));
 +         switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4];
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.coroutine_drop.0.mir"
index bf47e4c..e62115d 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.coroutine_drop.0.mir"
@@ -4,7 +4,7 @@
     debug _task_context => _2;
     debug x => (*((*_1).0: &u32));
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let mut _3: u32;
     let mut _4: u32;
     let mut _5: &u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.coroutine_drop_proxy_async.0.mir"
index 8daa763..aa204dd 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175-\173closure\0431\175.coroutine_drop_proxy_async.0.mir"
@@ -2,8 +2,12 @@
 
 fn includes_never::{closure#0}::{closure#1}(_1: {async block@$DIR/async_fn.rs:67:15: 67:20}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.StateTransform.diff"
index b3d14b5..4f2cf48 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,10 @@
 - fn includes_never::{closure#0}(_1: {async fn body of includes_never()}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug crash => (_1.0: bool);
+-     debug x => (_1.1: u32);
+-     let mut _0: u32;
 + fn includes_never::{closure#0}(_1: Pin<&mut {async fn body of includes_never()}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         field _s0: bool;
@@ -17,10 +21,7 @@
 +         }
 +         storage_conflicts = BitMatrix(3x3) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s2, _s0), (_s2, _s1), (_s2, _s2)}
 +     }
-      debug _task_context => _2;
--     debug crash => (_1.0: bool);
--     debug x => (_1.1: u32);
--     let mut _0: u32;
++     debug _task_context => _51;
 +     debug crash => ((*_50).0: bool);
 +     debug x => ((*_50).1: u32);
 +     coroutine debug crash => _s0;
@@ -37,12 +38,10 @@
       let mut _15: &mut {async block@$DIR/async_fn.rs:61:18: 61:23};
       let mut _16: &mut std::task::Context<'_>;
       let mut _17: &mut std::task::Context<'_>;
--     let mut _18: std::future::ResumeTy;
-+     let mut _18: &mut std::task::Context<'_>;
+      let mut _18: std::future::ResumeTy;
       let mut _19: isize;
       let mut _21: !;
--     let mut _22: std::future::ResumeTy;
-+     let mut _22: &mut std::task::Context<'_>;
+      let mut _22: std::future::ResumeTy;
       let mut _23: ();
       let _24: ();
       let mut _25: bool;
@@ -68,6 +67,8 @@
 +     let mut _48: u32;
 +     let mut _49: u32;
 +     let mut _50: &mut {async fn body of includes_never()};
++     let mut _51: std::future::ResumeTy;
++     let mut _52: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug crash => _3;
 +         debug crash => (((*_50) as variant#3).0: bool);
@@ -120,6 +121,8 @@
 -         _7 = {coroutine@$DIR/async_fn.rs:61:18: 61:23 (#0)} { x: move _8 };
 -         StorageDead(_8);
 -         _6 = <{async block@$DIR/async_fn.rs:61:18: 61:23} as IntoFuture>::into_future(move _7) -> [return: bb1, unwind: bb25];
++         _52 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _51 = std::future::ResumeTy(move _52);
 +         _50 = copy (_1.0: &mut {async fn body of includes_never()});
 +         _49 = discriminant((*_50));
 +         switchInt(move _49) -> [0: bb30, 1: bb29, 2: bb28, 3: bb27, otherwise: bb6];
@@ -153,9 +156,10 @@
           StorageLive(_16);
           StorageLive(_17);
           StorageLive(_18);
-          _18 = copy _2;
+-         _18 = copy _2;
 -         _17 = std::future::get_context::<'_, '_>(move _18) -> [return: bb4, unwind: bb20];
-+         _17 = move _18;
++         _18 = copy _51;
++         _17 = copy (_18.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb4;
       }
   
@@ -210,7 +214,8 @@
   
       bb9: {
           StorageDead(_23);
-          _2 = move _22;
+-         _2 = move _22;
++         _51 = move _22;
           StorageDead(_22);
           _10 = const ();
           goto -> bb2;
@@ -364,7 +369,7 @@
 +         StorageLive(_6);
 +         StorageLive(_22);
 +         StorageLive(_23);
-+         _22 = move _2;
++         _22 = move _51;
 +         goto -> bb9;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.coroutine_drop.0.mir"
index a701710..f65034a 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.coroutine_drop.0.mir"
@@ -5,7 +5,7 @@
     debug crash => ((*_1).0: bool);
     debug x => ((*_1).1: u32);
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let _3: bool;
     let mut _6: {async block@$DIR/async_fn.rs:61:18: 61:23};
     let mut _7: {async block@$DIR/async_fn.rs:61:18: 61:23};
@@ -18,10 +18,10 @@
     let mut _15: &mut {async block@$DIR/async_fn.rs:61:18: 61:23};
     let mut _16: &mut std::task::Context<'_>;
     let mut _17: &mut std::task::Context<'_>;
-    let mut _18: &mut std::task::Context<'_>;
+    let mut _18: std::future::ResumeTy;
     let mut _19: isize;
     let mut _21: !;
-    let mut _22: &mut std::task::Context<'_>;
+    let mut _22: std::future::ResumeTy;
     let mut _23: ();
     let _24: ();
     let mut _25: bool;
diff --git "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index 4a6ceb7..0acb7d0 100644
--- "a/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.includes_never-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,6 +2,8 @@
 
 fn includes_never::{closure#0}(_1: {async fn body of includes_never()}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         scope 2 {
             scope 3 {
@@ -22,6 +24,8 @@
     }
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
index 8f66ed1..48c288b 100644
--- "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,9 @@
 - fn partial_init::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:80:50: 80:55}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug x => (*(_1.0: &u32));
+-     let mut _0: u32;
 + fn partial_init::{closure#0}::{closure#0}(_1: Pin<&mut {async block@$DIR/async_fn.rs:80:50: 80:55}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         variant_fields = {
@@ -13,9 +16,7 @@
 +         }
 +         storage_conflicts = BitMatrix(0x0) {}
 +     }
-      debug _task_context => _2;
--     debug x => (*(_1.0: &u32));
--     let mut _0: u32;
++     debug _task_context => _10;
 +     debug x => (*((*_9).0: &u32));
 +     let mut _0: std::task::Poll<u32>;
       let mut _3: u32;
@@ -25,6 +26,8 @@
 +     let mut _7: u32;
 +     let mut _8: u32;
 +     let mut _9: &mut {async block@$DIR/async_fn.rs:80:50: 80:55};
++     let mut _10: std::future::ResumeTy;
++     let mut _11: std::ptr::NonNull<std::task::Context<'_>>;
   
       bb0: {
 -         StorageLive(_3);
@@ -37,6 +40,8 @@
 -         StorageDead(_4);
 -         StorageDead(_3);
 -         drop(_1) -> [return: bb1, unwind: bb2];
++         _11 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _10 = std::future::ResumeTy(move _11);
 +         _9 = copy (_1.0: &mut {async block@$DIR/async_fn.rs:80:50: 80:55});
 +         _8 = discriminant((*_9));
 +         switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4];
diff --git "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
index 0261bfd..6cbf36d 100644
--- "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.coroutine_drop.0.mir"
@@ -4,7 +4,7 @@
     debug _task_context => _2;
     debug x => (*((*_1).0: &u32));
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let mut _3: u32;
     let mut _4: u32;
     let mut _5: &u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index 3ddd757..95842dc 100644
--- "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,8 +2,12 @@
 
 fn partial_init::{closure#0}::{closure#0}(_1: {async block@$DIR/async_fn.rs:80:50: 80:55}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.StateTransform.diff"
index 7acd06e..2b91b6e 100644
--- "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,9 @@
 - fn partial_init::{closure#0}(_1: {async fn body of partial_init()}, _2: std::future::ResumeTy) -> u32
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     debug x => (_1.0: u32);
+-     let mut _0: u32;
 + fn partial_init::{closure#0}(_1: Pin<&mut {async fn body of partial_init()}>, _2: &mut Context<'_>) -> Poll<u32> {
 +     coroutine layout {
 +         field _s0: u32;
@@ -17,9 +20,7 @@
 +         }
 +         storage_conflicts = BitMatrix(3x3) {(_s0, _s0), (_s0, _s1), (_s0, _s2), (_s1, _s0), (_s1, _s1), (_s1, _s2), (_s2, _s0), (_s2, _s1), (_s2, _s2)}
 +     }
-      debug _task_context => _2;
--     debug x => (_1.0: u32);
--     let mut _0: u32;
++     debug _task_context => _29;
 +     debug x => ((*_28).0: u32);
 +     coroutine debug x => _s0;
 +     let mut _0: std::task::Poll<u32>;
@@ -38,16 +39,16 @@
       let mut _17: &mut {async block@$DIR/async_fn.rs:80:50: 80:55};
       let mut _18: &mut std::task::Context<'_>;
       let mut _19: &mut std::task::Context<'_>;
--     let mut _20: std::future::ResumeTy;
-+     let mut _20: &mut std::task::Context<'_>;
+      let mut _20: std::future::ResumeTy;
       let mut _21: isize;
       let mut _23: !;
--     let mut _24: std::future::ResumeTy;
-+     let mut _24: &mut std::task::Context<'_>;
+      let mut _24: std::future::ResumeTy;
       let mut _25: ();
 +     let mut _26: u32;
 +     let mut _27: u32;
 +     let mut _28: &mut {async fn body of partial_init()};
++     let mut _29: std::future::ResumeTy;
++     let mut _30: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug x => _3;
 +         debug x => (((*_28) as variant#3).0: u32);
@@ -76,6 +77,8 @@
 -         StorageLive(_5);
 -         StorageLive(_6);
 -         _6 = String::new() -> [return: bb1, unwind: bb30];
++         _30 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _29 = std::future::ResumeTy(move _30);
 +         _28 = copy (_1.0: &mut {async fn body of partial_init()});
 +         _27 = discriminant((*_28));
 +         switchInt(move _27) -> [0: bb32, 1: bb31, 2: bb30, 3: bb29, otherwise: bb7];
@@ -121,9 +124,10 @@
           StorageLive(_18);
           StorageLive(_19);
           StorageLive(_20);
-          _20 = copy _2;
+-         _20 = copy _2;
 -         _19 = std::future::get_context::<'_, '_>(move _20) -> [return: bb5, unwind: bb20];
-+         _19 = move _20;
++         _20 = copy _29;
++         _19 = copy (_20.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb5;
       }
   
@@ -180,7 +184,8 @@
   
       bb10: {
           StorageDead(_25);
-          _2 = move _24;
+-         _2 = move _24;
++         _29 = move _24;
           StorageDead(_24);
           _12 = const ();
           goto -> bb3;
@@ -335,7 +340,7 @@
 +         StorageLive(_8);
 +         StorageLive(_24);
 +         StorageLive(_25);
-+         _24 = move _2;
++         _24 = move _29;
 +         goto -> bb10;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.coroutine_drop.0.mir"
index 20525a4..c404d49 100644
--- "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.coroutine_drop.0.mir"
@@ -4,7 +4,7 @@
     debug _task_context => _2;
     debug x => ((*_1).0: u32);
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let _3: u32;
     let mut _4: !;
     let mut _6: std::string::String;
@@ -20,10 +20,10 @@
     let mut _17: &mut {async block@$DIR/async_fn.rs:80:50: 80:55};
     let mut _18: &mut std::task::Context<'_>;
     let mut _19: &mut std::task::Context<'_>;
-    let mut _20: &mut std::task::Context<'_>;
+    let mut _20: std::future::ResumeTy;
     let mut _21: isize;
     let mut _23: !;
-    let mut _24: &mut std::task::Context<'_>;
+    let mut _24: std::future::ResumeTy;
     let mut _25: ();
     let mut _26: u32;
     let mut _27: u32;
diff --git "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index 1f67854..bbcda31 100644
--- "a/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.partial_init-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,6 +2,8 @@
 
 fn partial_init::{closure#0}(_1: {async fn body of partial_init()}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         scope 2 {
         }
@@ -14,6 +16,8 @@
     }
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.StateTransform.diff" "b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.StateTransform.diff"
index f29242c..8ae369a 100644
--- "a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.StateTransform.diff"
+++ "b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.StateTransform.diff"
@@ -4,6 +4,8 @@
 - fn uninhabited_variant::{closure#0}(_1: {async fn body of uninhabited_variant()}, _2: std::future::ResumeTy) -> ()
 - yields ()
 -  {
+-     debug _task_context => _2;
+-     let mut _0: ();
 + fn uninhabited_variant::{closure#0}(_1: Pin<&mut {async fn body of uninhabited_variant()}>, _2: &mut Context<'_>) -> Poll<()> {
 +     coroutine layout {
 +         field _s0: {async block@$DIR/async_fn.rs:106:13: 106:18};
@@ -19,8 +21,7 @@
 +         }
 +         storage_conflicts = BitMatrix(4x4) {(_s0, _s0), (_s0, _s2), (_s0, _s3), (_s1, _s1), (_s1, _s3), (_s2, _s0), (_s2, _s2), (_s2, _s3), (_s3, _s0), (_s3, _s1), (_s3, _s2), (_s3, _s3)}
 +     }
-      debug _task_context => _2;
--     let mut _0: ();
++     debug _task_context => _47;
 +     coroutine debug c => _s0;
 +     let mut _0: std::task::Poll<()>;
       let _3: {async block@$DIR/async_fn.rs:106:13: 106:18};
@@ -37,12 +38,10 @@
       let mut _15: &mut {async block@$DIR/async_fn.rs:106:13: 106:18};
       let mut _16: &mut std::task::Context<'_>;
       let mut _17: &mut std::task::Context<'_>;
--     let mut _18: std::future::ResumeTy;
-+     let mut _18: &mut std::task::Context<'_>;
+      let mut _18: std::future::ResumeTy;
       let mut _19: isize;
       let mut _21: !;
--     let mut _22: std::future::ResumeTy;
-+     let mut _22: &mut std::task::Context<'_>;
+      let mut _22: std::future::ResumeTy;
       let mut _23: ();
       let _25: ();
       let mut _26: {async fn body of uninhabited_variant::{closure#0}::unreachable()};
@@ -55,17 +54,17 @@
       let mut _34: &mut {async fn body of uninhabited_variant::{closure#0}::unreachable()};
       let mut _35: &mut std::task::Context<'_>;
       let mut _36: &mut std::task::Context<'_>;
--     let mut _37: std::future::ResumeTy;
-+     let mut _37: &mut std::task::Context<'_>;
+      let mut _37: std::future::ResumeTy;
       let mut _38: isize;
       let mut _40: !;
--     let mut _41: std::future::ResumeTy;
-+     let mut _41: &mut std::task::Context<'_>;
+      let mut _41: std::future::ResumeTy;
       let mut _42: ();
       let mut _43: bool;
 +     let mut _44: ();
 +     let mut _45: u32;
 +     let mut _46: &mut {async fn body of uninhabited_variant()};
++     let mut _47: std::future::ResumeTy;
++     let mut _48: std::ptr::NonNull<std::task::Context<'_>>;
       scope 1 {
 -         debug c => _3;
 +         debug c => (((*_46) as variant#4).0: {async block@$DIR/async_fn.rs:106:13: 106:18});
@@ -105,6 +104,8 @@
 -         PlaceMention(_4);
 -         _5 = discriminant(_4);
 -         switchInt(move _5) -> [0: bb3, 1: bb2, otherwise: bb1];
++         _48 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _47 = std::future::ResumeTy(move _48);
 +         _46 = copy (_1.0: &mut {async fn body of uninhabited_variant()});
 +         _45 = discriminant((*_46));
 +         switchInt(move _45) -> [0: bb56, 1: bb55, 2: bb54, 3: bb52, 4: bb53, otherwise: bb1];
@@ -166,9 +167,10 @@
           StorageLive(_16);
           StorageLive(_17);
           StorageLive(_18);
-          _18 = copy _2;
+-         _18 = copy _2;
 -         _17 = std::future::get_context::<'_, '_>(move _18) -> [return: bb7, unwind: bb46];
-+         _17 = move _18;
++         _18 = copy _47;
++         _17 = copy (_18.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb7;
       }
   
@@ -220,7 +222,8 @@
   
       bb11: {
           StorageDead(_23);
-          _2 = move _22;
+-         _2 = move _22;
++         _47 = move _22;
           StorageDead(_22);
           _10 = const ();
           goto -> bb5;
@@ -274,9 +277,10 @@
           StorageLive(_35);
           StorageLive(_36);
           StorageLive(_37);
-          _37 = copy _2;
+-         _37 = copy _2;
 -         _36 = std::future::get_context::<'_, '_>(move _37) -> [return: bb18, unwind: bb37];
-+         _36 = move _37;
++         _37 = copy _47;
++         _36 = copy (_37.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         goto -> bb18;
       }
   
@@ -329,7 +333,8 @@
   
       bb22: {
           StorageDead(_42);
-          _2 = move _41;
+-         _2 = move _41;
++         _47 = move _41;
           StorageDead(_41);
           _10 = const ();
           goto -> bb16;
@@ -625,7 +630,7 @@
 +         StorageLive(_7);
 +         StorageLive(_22);
 +         StorageLive(_23);
-+         _22 = move _2;
++         _22 = move _47;
 +         goto -> bb11;
       }
   
@@ -638,7 +643,7 @@
 +         StorageLive(_26);
 +         StorageLive(_41);
 +         StorageLive(_42);
-+         _41 = move _2;
++         _41 = move _47;
 +         goto -> bb22;
       }
   
diff --git "a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.coroutine_drop.0.mir" "b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.coroutine_drop.0.mir"
index 31b418c..a4a7516 100644
--- "a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.coroutine_drop.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.coroutine_drop.0.mir"
@@ -3,7 +3,7 @@
 fn uninhabited_variant::{closure#0}(_1: &mut {async fn body of uninhabited_variant()}) -> () {
     debug _task_context => _2;
     let mut _0: ();
-    let mut _2: &mut std::task::Context<'_>;
+    let mut _2: std::future::ResumeTy;
     let _3: {async block@$DIR/async_fn.rs:106:13: 106:18};
     let mut _4: std::option::Option<Never>;
     let mut _5: isize;
@@ -18,10 +18,10 @@
     let mut _15: &mut {async block@$DIR/async_fn.rs:106:13: 106:18};
     let mut _16: &mut std::task::Context<'_>;
     let mut _17: &mut std::task::Context<'_>;
-    let mut _18: &mut std::task::Context<'_>;
+    let mut _18: std::future::ResumeTy;
     let mut _19: isize;
     let mut _21: !;
-    let mut _22: &mut std::task::Context<'_>;
+    let mut _22: std::future::ResumeTy;
     let mut _23: ();
     let _25: ();
     let mut _26: {async fn body of uninhabited_variant::{closure#0}::unreachable()};
@@ -34,10 +34,10 @@
     let mut _34: &mut {async fn body of uninhabited_variant::{closure#0}::unreachable()};
     let mut _35: &mut std::task::Context<'_>;
     let mut _36: &mut std::task::Context<'_>;
-    let mut _37: &mut std::task::Context<'_>;
+    let mut _37: std::future::ResumeTy;
     let mut _38: isize;
     let mut _40: !;
-    let mut _41: &mut std::task::Context<'_>;
+    let mut _41: std::future::ResumeTy;
     let mut _42: ();
     let mut _43: bool;
     let mut _44: ();
diff --git "a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.coroutine_drop_proxy_async.0.mir" "b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
index f460d89..124debe 100644
--- "a/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
+++ "b/tests/mir-opt/coroutine/async_fn.uninhabited_variant-\173closure\0430\175.coroutine_drop_proxy_async.0.mir"
@@ -2,6 +2,8 @@
 
 fn uninhabited_variant::{closure#0}(_1: {async fn body of uninhabited_variant()}, _2: &mut Context<'_>) -> Poll<()> {
     let mut _0: std::task::Poll<()>;
+    let mut _3: std::future::ResumeTy;
+    let mut _4: std::ptr::NonNull<std::task::Context<'_>>;
     scope 1 {
         scope 2 {
             scope 3 {
@@ -16,6 +18,8 @@
     }
 
     bb0: {
+        _4 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
+        _3 = std::future::ResumeTy(move _4);
         drop(_1) -> [return: bb1, unwind continue];
     }
 
diff --git "a/tests/mir-opt/inline/inline_coroutine_body.run2-\173closure\0430\175.Inline.panic-abort.diff" "b/tests/mir-opt/inline/inline_coroutine_body.run2-\173closure\0430\175.Inline.panic-abort.diff"
index 617f2ad..4b117a4 100644
--- "a/tests/mir-opt/inline/inline_coroutine_body.run2-\173closure\0430\175.Inline.panic-abort.diff"
+++ "b/tests/mir-opt/inline/inline_coroutine_body.run2-\173closure\0430\175.Inline.panic-abort.diff"
@@ -33,14 +33,16 @@
 +                 let mut _21: &mut std::future::Ready<()>;
 +                 let mut _22: &mut std::task::Context<'_>;
 +                 let mut _23: &mut std::task::Context<'_>;
-+                 let mut _24: &mut std::task::Context<'_>;
++                 let mut _24: std::future::ResumeTy;
 +                 let mut _25: isize;
 +                 let mut _27: !;
-+                 let mut _28: &mut std::task::Context<'_>;
++                 let mut _28: std::future::ResumeTy;
 +                 let mut _29: ();
 +                 let mut _30: ();
 +                 let mut _31: u32;
 +                 let mut _32: &mut {async fn body of ActionPermit<'_, T>::perform()};
++                 let mut _33: std::future::ResumeTy;
++                 let mut _34: std::ptr::NonNull<std::task::Context<'_>>;
 +                 scope 7 {
 +                     let mut _15: std::future::Ready<()>;
 +                     scope 8 {
@@ -50,30 +52,30 @@
 +                         scope 11 (inlined Pin::<&mut std::future::Ready<()>>::new_unchecked) {
 +                         }
 +                         scope 12 (inlined <std::future::Ready<()> as Future>::poll) {
-+                             let mut _33: ();
-+                             let mut _34: std::option::Option<()>;
-+                             let mut _35: &mut std::option::Option<()>;
-+                             let mut _36: &mut std::future::Ready<()>;
-+                             let mut _37: &mut std::pin::Pin<&mut std::future::Ready<()>>;
++                             let mut _35: ();
++                             let mut _36: std::option::Option<()>;
++                             let mut _37: &mut std::option::Option<()>;
++                             let mut _38: &mut std::future::Ready<()>;
++                             let mut _39: &mut std::pin::Pin<&mut std::future::Ready<()>>;
 +                             scope 13 (inlined <Pin<&mut std::future::Ready<()>> as DerefMut>::deref_mut) {
-+                                 let mut _38: *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>>;
-+                                 let mut _39: *mut std::pin::Pin<&mut std::future::Ready<()>>;
++                                 let mut _40: *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>>;
++                                 let mut _41: *mut std::pin::Pin<&mut std::future::Ready<()>>;
 +                                 scope 14 (inlined <pin::helper::PinHelper<&mut std::future::Ready<()>> as pin::helper::PinDerefMutHelper>::deref_mut) {
-+                                     let mut _40: &mut &mut std::future::Ready<()>;
++                                     let mut _42: &mut &mut std::future::Ready<()>;
 +                                     scope 15 (inlined <&mut std::future::Ready<()> as DerefMut>::deref_mut) {
 +                                     }
 +                                 }
 +                             }
 +                             scope 16 (inlined Option::<()>::take) {
-+                                 let mut _41: std::option::Option<()>;
++                                 let mut _43: std::option::Option<()>;
 +                                 scope 17 (inlined std::mem::replace::<Option<()>>) {
 +                                     scope 18 {
 +                                     }
 +                                 }
 +                             }
 +                             scope 19 (inlined #[track_caller] Option::<()>::expect) {
-+                                 let mut _42: isize;
-+                                 let mut _43: !;
++                                 let mut _44: isize;
++                                 let mut _45: !;
 +                                 scope 20 {
 +                                 }
 +                             }
@@ -82,7 +84,7 @@
 +                     scope 10 (inlined <std::future::Ready<()> as IntoFuture>::into_future) {
 +                     }
 +                     scope 21 (inlined ready::<()>) {
-+                         let mut _44: std::option::Option<()>;
++                         let mut _46: std::option::Option<()>;
 +                     }
 +                 }
 +             }
@@ -125,6 +127,10 @@
 +         StorageLive(_30);
 +         StorageLive(_31);
 +         StorageLive(_32);
++         StorageLive(_33);
++         StorageLive(_34);
++         _34 = move _9 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _33 = std::future::ResumeTy(move _34);
 +         _32 = copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         _31 = discriminant((*_32));
 +         switchInt(move _31) -> [0: bb10, 1: bb9, 3: bb8, otherwise: bb4];
@@ -137,6 +143,8 @@
 +     }
 + 
 +     bb2: {
++         StorageDead(_34);
++         StorageDead(_33);
 +         StorageDead(_32);
 +         StorageDead(_31);
 +         StorageDead(_30);
@@ -166,28 +174,28 @@
 +         StorageLive(_22);
 +         StorageLive(_23);
 +         StorageLive(_24);
-+         _24 = copy _9;
-+         _23 = move _24;
++         _24 = copy _33;
++         _23 = copy (_24.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         _22 = &mut (*_23);
 +         StorageDead(_24);
-+         StorageLive(_36);
 +         StorageLive(_38);
-+         StorageLive(_43);
-+         StorageLive(_33);
-+         StorageLive(_34);
-+         StorageLive(_39);
-+         _39 = &raw mut _19;
-+         _38 = copy _39 as *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>> (PtrToPtr);
-+         StorageDead(_39);
-+         _36 = no_retag copy ((*_38).0: &mut std::future::Ready<()>);
++         StorageLive(_40);
++         StorageLive(_45);
++         StorageLive(_35);
++         StorageLive(_36);
 +         StorageLive(_41);
-+         _41 = Option::<()>::None;
-+         _34 = copy ((*_36).0: std::option::Option<()>);
-+         ((*_36).0: std::option::Option<()>) = move _41;
++         _41 = &raw mut _19;
++         _40 = copy _41 as *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>> (PtrToPtr);
 +         StorageDead(_41);
-+         StorageLive(_42);
-+         _42 = discriminant(_34);
-+         switchInt(move _42) -> [0: bb11, 1: bb12, otherwise: bb4];
++         _38 = no_retag copy ((*_40).0: &mut std::future::Ready<()>);
++         StorageLive(_43);
++         _43 = Option::<()>::None;
++         _36 = copy ((*_38).0: std::option::Option<()>);
++         ((*_38).0: std::option::Option<()>) = move _43;
++         StorageDead(_43);
++         StorageLive(_44);
++         _44 = discriminant(_36);
++         switchInt(move _44) -> [0: bb11, 1: bb12, otherwise: bb4];
 +     }
 + 
       bb4: {
@@ -236,9 +244,9 @@
 +         StorageLive(_12);
 +         StorageLive(_28);
 +         StorageLive(_29);
-+         _28 = move _9;
++         _28 = move _33;
 +         StorageDead(_29);
-+         _9 = move _28;
++         _33 = move _28;
 +         StorageDead(_28);
 +         _16 = const ();
 +         goto -> bb3;
@@ -254,10 +262,10 @@
 +         StorageLive(_13);
 +         StorageLive(_14);
 +         _14 = ();
-+         StorageLive(_44);
-+         _44 = Option::<()>::Some(copy _14);
-+         _13 = std::future::Ready::<()>(move _44);
-+         StorageDead(_44);
++         StorageLive(_46);
++         _46 = Option::<()>::Some(copy _14);
++         _13 = std::future::Ready::<()>(move _46);
++         StorageDead(_46);
 +         StorageDead(_14);
 +         _12 = move _13;
 +         StorageDead(_13);
@@ -266,18 +274,18 @@
 +     }
 + 
 +     bb11: {
-+         _43 = option::expect_failed(const "`Ready` polled after completion") -> unwind unreachable;
++         _45 = option::expect_failed(const "`Ready` polled after completion") -> unwind unreachable;
 +     }
 + 
 +     bb12: {
-+         _33 = move ((_34 as Some).0: ());
-+         StorageDead(_42);
-+         StorageDead(_34);
-+         _18 = Poll::<()>::Ready(move _33);
-+         StorageDead(_33);
-+         StorageDead(_43);
-+         StorageDead(_38);
++         _35 = move ((_36 as Some).0: ());
++         StorageDead(_44);
 +         StorageDead(_36);
++         _18 = Poll::<()>::Ready(move _35);
++         StorageDead(_35);
++         StorageDead(_45);
++         StorageDead(_40);
++         StorageDead(_38);
 +         StorageDead(_22);
 +         StorageDead(_19);
 +         _25 = discriminant(_18);
diff --git "a/tests/mir-opt/inline/inline_coroutine_body.run2-\173closure\0430\175.Inline.panic-unwind.diff" "b/tests/mir-opt/inline/inline_coroutine_body.run2-\173closure\0430\175.Inline.panic-unwind.diff"
index f12462a..c365aee 100644
--- "a/tests/mir-opt/inline/inline_coroutine_body.run2-\173closure\0430\175.Inline.panic-unwind.diff"
+++ "b/tests/mir-opt/inline/inline_coroutine_body.run2-\173closure\0430\175.Inline.panic-unwind.diff"
@@ -33,14 +33,16 @@
 +                 let mut _21: &mut std::future::Ready<()>;
 +                 let mut _22: &mut std::task::Context<'_>;
 +                 let mut _23: &mut std::task::Context<'_>;
-+                 let mut _24: &mut std::task::Context<'_>;
++                 let mut _24: std::future::ResumeTy;
 +                 let mut _25: isize;
 +                 let mut _27: !;
-+                 let mut _28: &mut std::task::Context<'_>;
++                 let mut _28: std::future::ResumeTy;
 +                 let mut _29: ();
 +                 let mut _30: ();
 +                 let mut _31: u32;
 +                 let mut _32: &mut {async fn body of ActionPermit<'_, T>::perform()};
++                 let mut _33: std::future::ResumeTy;
++                 let mut _34: std::ptr::NonNull<std::task::Context<'_>>;
 +                 scope 7 {
 +                     let mut _15: std::future::Ready<()>;
 +                     scope 8 {
@@ -50,30 +52,30 @@
 +                         scope 11 (inlined Pin::<&mut std::future::Ready<()>>::new_unchecked) {
 +                         }
 +                         scope 12 (inlined <std::future::Ready<()> as Future>::poll) {
-+                             let mut _33: ();
-+                             let mut _34: std::option::Option<()>;
-+                             let mut _35: &mut std::option::Option<()>;
-+                             let mut _36: &mut std::future::Ready<()>;
-+                             let mut _37: &mut std::pin::Pin<&mut std::future::Ready<()>>;
++                             let mut _35: ();
++                             let mut _36: std::option::Option<()>;
++                             let mut _37: &mut std::option::Option<()>;
++                             let mut _38: &mut std::future::Ready<()>;
++                             let mut _39: &mut std::pin::Pin<&mut std::future::Ready<()>>;
 +                             scope 13 (inlined <Pin<&mut std::future::Ready<()>> as DerefMut>::deref_mut) {
-+                                 let mut _38: *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>>;
-+                                 let mut _39: *mut std::pin::Pin<&mut std::future::Ready<()>>;
++                                 let mut _40: *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>>;
++                                 let mut _41: *mut std::pin::Pin<&mut std::future::Ready<()>>;
 +                                 scope 14 (inlined <pin::helper::PinHelper<&mut std::future::Ready<()>> as pin::helper::PinDerefMutHelper>::deref_mut) {
-+                                     let mut _40: &mut &mut std::future::Ready<()>;
++                                     let mut _42: &mut &mut std::future::Ready<()>;
 +                                     scope 15 (inlined <&mut std::future::Ready<()> as DerefMut>::deref_mut) {
 +                                     }
 +                                 }
 +                             }
 +                             scope 16 (inlined Option::<()>::take) {
-+                                 let mut _41: std::option::Option<()>;
++                                 let mut _43: std::option::Option<()>;
 +                                 scope 17 (inlined std::mem::replace::<Option<()>>) {
 +                                     scope 18 {
 +                                     }
 +                                 }
 +                             }
 +                             scope 19 (inlined #[track_caller] Option::<()>::expect) {
-+                                 let mut _42: isize;
-+                                 let mut _43: !;
++                                 let mut _44: isize;
++                                 let mut _45: !;
 +                                 scope 20 {
 +                                 }
 +                             }
@@ -82,7 +84,7 @@
 +                     scope 10 (inlined <std::future::Ready<()> as IntoFuture>::into_future) {
 +                     }
 +                     scope 21 (inlined ready::<()>) {
-+                         let mut _44: std::option::Option<()>;
++                         let mut _46: std::option::Option<()>;
 +                     }
 +                 }
 +             }
@@ -125,6 +127,10 @@
 +         StorageLive(_30);
 +         StorageLive(_31);
 +         StorageLive(_32);
++         StorageLive(_33);
++         StorageLive(_34);
++         _34 = move _9 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
++         _33 = std::future::ResumeTy(move _34);
 +         _32 = copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         _31 = discriminant((*_32));
 +         switchInt(move _31) -> [0: bb15, 1: bb14, 2: bb13, 3: bb12, otherwise: bb6];
@@ -145,6 +151,8 @@
 +     }
 + 
 +     bb4: {
++         StorageDead(_34);
++         StorageDead(_33);
 +         StorageDead(_32);
 +         StorageDead(_31);
 +         StorageDead(_30);
@@ -177,28 +185,28 @@
 +         StorageLive(_22);
 +         StorageLive(_23);
 +         StorageLive(_24);
-+         _24 = copy _9;
-+         _23 = move _24;
++         _24 = copy _33;
++         _23 = copy (_24.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
 +         _22 = &mut (*_23);
 +         StorageDead(_24);
-+         StorageLive(_36);
 +         StorageLive(_38);
-+         StorageLive(_43);
-+         StorageLive(_33);
-+         StorageLive(_34);
-+         StorageLive(_39);
-+         _39 = &raw mut _19;
-+         _38 = copy _39 as *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>> (PtrToPtr);
-+         StorageDead(_39);
-+         _36 = no_retag copy ((*_38).0: &mut std::future::Ready<()>);
++         StorageLive(_40);
++         StorageLive(_45);
++         StorageLive(_35);
++         StorageLive(_36);
 +         StorageLive(_41);
-+         _41 = Option::<()>::None;
-+         _34 = copy ((*_36).0: std::option::Option<()>);
-+         ((*_36).0: std::option::Option<()>) = move _41;
++         _41 = &raw mut _19;
++         _40 = copy _41 as *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>> (PtrToPtr);
 +         StorageDead(_41);
-+         StorageLive(_42);
-+         _42 = discriminant(_34);
-+         switchInt(move _42) -> [0: bb16, 1: bb17, otherwise: bb6];
++         _38 = no_retag copy ((*_40).0: &mut std::future::Ready<()>);
++         StorageLive(_43);
++         _43 = Option::<()>::None;
++         _36 = copy ((*_38).0: std::option::Option<()>);
++         ((*_38).0: std::option::Option<()>) = move _43;
++         StorageDead(_43);
++         StorageLive(_44);
++         _44 = discriminant(_36);
++         switchInt(move _44) -> [0: bb16, 1: bb17, otherwise: bb6];
       }
   
 -     bb5 (cleanup): {
@@ -265,9 +273,9 @@
 +         StorageLive(_12);
 +         StorageLive(_28);
 +         StorageLive(_29);
-+         _28 = move _9;
++         _28 = move _33;
 +         StorageDead(_29);
-+         _9 = move _28;
++         _33 = move _28;
 +         StorageDead(_28);
 +         _16 = const ();
 +         goto -> bb5;
@@ -287,10 +295,10 @@
 +         StorageLive(_13);
 +         StorageLive(_14);
 +         _14 = ();
-+         StorageLive(_44);
-+         _44 = Option::<()>::Some(copy _14);
-+         _13 = std::future::Ready::<()>(move _44);
-+         StorageDead(_44);
++         StorageLive(_46);
++         _46 = Option::<()>::Some(copy _14);
++         _13 = std::future::Ready::<()>(move _46);
++         StorageDead(_46);
 +         StorageDead(_14);
 +         _12 = move _13;
 +         StorageDead(_13);
@@ -299,18 +307,18 @@
 +     }
 + 
 +     bb16: {
-+         _43 = option::expect_failed(const "`Ready` polled after completion") -> bb10;
++         _45 = option::expect_failed(const "`Ready` polled after completion") -> bb10;
 +     }
 + 
 +     bb17: {
-+         _33 = move ((_34 as Some).0: ());
-+         StorageDead(_42);
-+         StorageDead(_34);
-+         _18 = Poll::<()>::Ready(move _33);
-+         StorageDead(_33);
-+         StorageDead(_43);
-+         StorageDead(_38);
++         _35 = move ((_36 as Some).0: ());
++         StorageDead(_44);
 +         StorageDead(_36);
++         _18 = Poll::<()>::Ready(move _35);
++         StorageDead(_35);
++         StorageDead(_45);
++         StorageDead(_40);
++         StorageDead(_38);
 +         StorageDead(_22);
 +         StorageDead(_19);
 +         _25 = discriminant(_18);
diff --git a/tests/run-make/doctests-test_harness/doctests.rs b/tests/run-make/doctests-test_harness/doctests.rs
new file mode 100644
index 0000000..9e2a6e4
--- /dev/null
+++ b/tests/run-make/doctests-test_harness/doctests.rs
@@ -0,0 +1,26 @@
+// Test that we can successfully run two separate test suites.
+// Check that we run all four tests even though `ill` and `bad` both fail.
+
+//! ```test_harness
+//! #[test]
+//! fn well() {
+//!     assert!(true);
+//! }
+//!
+//! #[test]
+//! fn ill() {
+//!      assert!(false);
+//! }
+//! ```
+
+//! ```test_harness
+//! #[test]
+//! fn bad() {
+//!     assert!(false);
+//! }
+//!
+//! #[test]
+//! fn good() {
+//!     assert!(true);
+//! }
+//! ```
diff --git a/tests/run-make/doctests-test_harness/doctests.stdout b/tests/run-make/doctests-test_harness/doctests.stdout
new file mode 100644
index 0000000..082f9be
--- /dev/null
+++ b/tests/run-make/doctests-test_harness/doctests.stdout
@@ -0,0 +1,64 @@
+
+running 2 tests
+test doctests.rs - (line 15) ... FAILED
+test doctests.rs - (line 4) ... FAILED
+
+failures:
+
+---- doctests.rs - (line 15) stdout ----
+Test executable failed ($STATUS).
+
+stdout:
+
+running 2 tests
+test bad ... FAILED
+test good ... ok
+
+failures:
+
+---- bad stdout ----
+
+thread 'bad' ($TID) panicked at doctests.rs:4:5:
+assertion failed: false
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+
+
+failures:
+    bad
+
+test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
+
+
+---- doctests.rs - (line 4) stdout ----
+Test executable failed ($STATUS).
+
+stdout:
+
+running 2 tests
+test ill ... FAILED
+test well ... ok
+
+failures:
+
+---- ill stdout ----
+
+thread 'ill' ($TID) panicked at doctests.rs:9:6:
+assertion failed: false
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+
+
+failures:
+    ill
+
+test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
+
+
+
+failures:
+    doctests.rs - (line 15)
+    doctests.rs - (line 4)
+
+test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/run-make/doctests-test_harness/rmake.rs b/tests/run-make/doctests-test_harness/rmake.rs
new file mode 100644
index 0000000..608adeb
--- /dev/null
+++ b/tests/run-make/doctests-test_harness/rmake.rs
@@ -0,0 +1,41 @@
+//@ ignore-cross-compile (needs to run host tool binary)
+
+// Test the behavior of doctests that are marked `test_harness` and that contain multiple `#[test]`
+// functions. Sadly this needs to be a run-make test instead of rustdoc-UI one because at the time
+// of writing we can only pass `--test-threads=1` to the inner test suite using a runtool (needed to
+// guarantee deterministic test output) which we'd like to be written in Rust to be cross-platform.
+//
+// See also #157511 and `tests/rustdoc-ui/doctest/test_harness.rs`.
+
+use std::path::Path;
+
+use run_make_support::{diff, rustc, rustdoc};
+
+fn main() {
+    let doctests_path = Path::new("doctests.rs");
+    let runtool_path = Path::new("runtool.rs");
+
+    rustc().input(doctests_path).crate_type("lib").run();
+    rustc().input(runtool_path).run();
+
+    let output = rustdoc()
+        .input(doctests_path)
+        .arg("--test")
+        // for the outer test suite
+        .arg("--test-args=--test-threads=1")
+        .arg("--test-runtool")
+        .arg(Path::new(".").join(runtool_path).with_extension(std::env::consts::EXE_EXTENSION))
+        .arg("-L.")
+        .env("RUST_BACKTRACE", "0")
+        .run_fail();
+    output.assert_exit_code(101);
+    output.assert_stderr_equals("");
+
+    diff()
+        .expected_file(doctests_path.with_extension("stdout"))
+        .actual_text("stdout", output.stdout_utf8())
+        .normalize(r#"finished in \d+\.\d+s"#, "finished in $$TIME")
+        .normalize(r"thread '(?P<name>.*?)' \(\d+\) panicked", "thread '$name' ($$TID) panicked")
+        .normalize(r"Test executable failed \(.+?\)", "Test executable failed ($$STATUS)")
+        .run();
+}
diff --git a/tests/run-make/doctests-test_harness/runtool.rs b/tests/run-make/doctests-test_harness/runtool.rs
new file mode 100644
index 0000000..e656b58
--- /dev/null
+++ b/tests/run-make/doctests-test_harness/runtool.rs
@@ -0,0 +1,11 @@
+// The whole purpose of this runtool is to pass `--test-threads=1`
+// to the inner testsuite to guarantee deterministic output.
+// See also #157511.
+
+fn main() {
+    let status = std::process::Command::new(std::env::args().nth(1).unwrap())
+        .arg("--test-threads=1")
+        .status()
+        .unwrap();
+    std::process::exit(status.code().unwrap())
+}
diff --git a/tests/run-make/dynamic-loading-cdylib/foo.rs b/tests/run-make/dynamic-loading-cdylib/foo.rs
index 15ce482..5d29ca2 100644
--- a/tests/run-make/dynamic-loading-cdylib/foo.rs
+++ b/tests/run-make/dynamic-loading-cdylib/foo.rs
@@ -6,18 +6,36 @@ pub extern "C" fn extern_fn_1(a: u32, b: u32) -> u32 {
     a + b
 }
 
-struct NotifyOnDrop;
+#[derive(Default)]
+struct NotifyOnDrop {
+    last_result: std::cell::Cell<u32>,
+}
+
+impl NotifyOnDrop {
+    fn save_and_print(&self, result: u32) {
+        self.last_result.set(result);
+    }
+}
 
 impl Drop for NotifyOnDrop {
     fn drop(&mut self) {
-        println!("drop");
+        println!("dropping, last result: {}", self.last_result.get());
     }
 }
 
+thread_local! {
+    static FOO: NotifyOnDrop = NotifyOnDrop::default();
+}
+
 #[no_mangle]
 pub extern "C" fn extern_fn_2(a: u32, b: u32) -> u32 {
-    thread_local!(static FOO: NotifyOnDrop = NotifyOnDrop);
-    FOO.with(|_foo| {});
-    println!("extern_fn_2");
-    a * b
+    let result = a * b;
+
+    FOO.with(|foo| {
+        foo.save_and_print(result);
+    });
+
+    println!("extern_fn_2({a}, {b})");
+
+    result
 }
diff --git a/tests/run-make/dynamic-loading-cdylib/load_and_unload.rs b/tests/run-make/dynamic-loading-cdylib/load_and_unload.rs
index 24409c1..ec3c558 100644
--- a/tests/run-make/dynamic-loading-cdylib/load_and_unload.rs
+++ b/tests/run-make/dynamic-loading-cdylib/load_and_unload.rs
@@ -101,6 +101,15 @@ fn main() {
     let result = unsafe { extern_fn_2(2, 3) };
     println!("result of extern_fn_2(2, 3): {}", result);
 
+    println!("spawning thread");
+    std::thread::spawn(move || {
+        let result = unsafe { extern_fn_2(4, 5) };
+        println!("result of extern_fn_2(4, 5) in other thread: {}", result);
+    })
+    .join()
+    .expect("Thread panicked");
+    println!("thread joined");
+
     libloading::unload(foo);
     println!("unloaded library");
 }
diff --git a/tests/run-make/dynamic-loading-cdylib/output_unix.txt b/tests/run-make/dynamic-loading-cdylib/output_unix.txt
index f79d5a2..6e1736c 100644
--- a/tests/run-make/dynamic-loading-cdylib/output_unix.txt
+++ b/tests/run-make/dynamic-loading-cdylib/output_unix.txt
@@ -1,7 +1,12 @@
 loaded library
 extern_fn_1
 result of extern_fn_1(2, 3): 5
-extern_fn_2
+extern_fn_2(2, 3)
 result of extern_fn_2(2, 3): 6
+spawning thread
+extern_fn_2(4, 5)
+result of extern_fn_2(4, 5) in other thread: 20
+dropping, last result: 20
+thread joined
 unloaded library
-drop
+dropping, last result: 6
diff --git a/tests/run-make/dynamic-loading-cdylib/output_windows.txt b/tests/run-make/dynamic-loading-cdylib/output_windows.txt
index 5ce77ad..e87baf4 100644
--- a/tests/run-make/dynamic-loading-cdylib/output_windows.txt
+++ b/tests/run-make/dynamic-loading-cdylib/output_windows.txt
@@ -1,7 +1,12 @@
 loaded library
 extern_fn_1
 result of extern_fn_1(2, 3): 5
-extern_fn_2
+extern_fn_2(2, 3)
 result of extern_fn_2(2, 3): 6
-drop
+spawning thread
+extern_fn_2(4, 5)
+result of extern_fn_2(4, 5) in other thread: 20
+dropping, last result: 20
+thread joined
+dropping, last result: 6
 unloaded library
diff --git a/tests/run-make/staticlib-hide-internal-symbols-macho/rmake.rs b/tests/run-make/staticlib-hide-internal-symbols-macho/rmake.rs
new file mode 100644
index 0000000..c0ea7d1
--- /dev/null
+++ b/tests/run-make/staticlib-hide-internal-symbols-macho/rmake.rs
@@ -0,0 +1,115 @@
+//@ only-apple
+//@ ignore-cross-compile
+
+use std::collections::HashSet;
+
+use run_make_support::object::Endianness;
+use run_make_support::object::macho::{MachHeader64, N_EXT, N_PEXT, N_SECT, N_STAB, N_TYPE};
+use run_make_support::object::read::archive::ArchiveFile;
+use run_make_support::object::read::macho::{MachHeader as _, Nlist as _};
+use run_make_support::path_helpers::source_root;
+use run_make_support::{cc, extra_c_flags, rfs, run, rustc, static_lib_name};
+
+type MachOFileHeader64 = MachHeader64<Endianness>;
+type SymbolTable<'data> =
+    run_make_support::object::read::macho::SymbolTable<'data, MachOFileHeader64>;
+
+const EXPORTED: &[&str] = &["my_add", "my_hash_lookup", "call_internal", "my_safe_div"];
+
+fn main() {
+    let sibling = source_root().join("tests/run-make/staticlib-hide-internal-symbols");
+    rfs::copy(sibling.join("lib.rs"), "lib.rs");
+    rfs::copy(sibling.join("main.c"), "main.c");
+
+    let lib_name = static_lib_name("lib");
+
+    rustc()
+        .input("lib.rs")
+        .crate_type("staticlib")
+        .arg("-Zstaticlib-hide-internal-symbols")
+        .opt()
+        .run();
+
+    cc().input("main.c").input(&lib_name).out_exe("main").args(extra_c_flags()).run();
+    run("main");
+
+    let data = rfs::read(&lib_name);
+    check_symbols(&data, true);
+
+    rfs::remove_file(&lib_name);
+    rustc().input("lib.rs").crate_type("staticlib").opt().run();
+
+    let data = rfs::read(&lib_name);
+    check_symbols(&data, false);
+}
+
+fn check_symbols(archive_data: &[u8], with_flag: bool) {
+    let archive = ArchiveFile::parse(archive_data).unwrap();
+    let mut found_exported = HashSet::new();
+
+    for member in archive.members() {
+        let member = member.unwrap();
+        let data = member.data(archive_data).unwrap();
+
+        let Ok(header) = MachOFileHeader64::parse(data, 0) else { continue };
+        let Ok(endian) = header.endian() else { continue };
+
+        let Some(symtab) = find_symtab(header, endian, data) else { continue };
+        let strtab = symtab.strings();
+
+        for nlist in symtab.iter() {
+            let n_type = nlist.n_type();
+            if n_type & N_STAB != 0 {
+                continue;
+            }
+            if n_type & N_EXT == 0 {
+                continue;
+            }
+            if n_type & N_TYPE != N_SECT {
+                continue;
+            }
+
+            let Ok(name_bytes) = nlist.name(endian, strtab) else { continue };
+            let Ok(name) = str::from_utf8(name_bytes) else { continue };
+            let name = name.strip_prefix('_').unwrap_or(name);
+
+            let exported = EXPORTED.contains(&name);
+            let has_pext = n_type & N_PEXT != 0;
+
+            if with_flag {
+                if exported {
+                    assert!(!has_pext, "with -Z hide: exported `{name}` should NOT have N_PEXT");
+                } else {
+                    assert!(has_pext, "with -Z hide: internal `{name}` should have N_PEXT");
+                }
+            } else if exported {
+                assert!(!has_pext, "without -Z: exported `{name}` should NOT have N_PEXT");
+            }
+
+            if exported {
+                found_exported.insert(name.to_string());
+            }
+        }
+    }
+
+    for expected in EXPORTED {
+        assert!(
+            found_exported.contains(*expected),
+            "expected to find exported symbol `{expected}` in archive"
+        );
+    }
+}
+
+fn find_symtab<'data>(
+    header: &MachOFileHeader64,
+    endian: Endianness,
+    data: &'data [u8],
+) -> Option<SymbolTable<'data>> {
+    let mut commands = header.load_commands(endian, data, 0).ok()?;
+    while let Ok(Some(command)) = commands.next() {
+        if let Ok(Some(symtab_cmd)) = command.symtab() {
+            return symtab_cmd.symbols::<MachOFileHeader64, _>(endian, data).ok();
+        }
+    }
+    None
+}
diff --git a/tests/run-make/staticlib-hide-internal-symbols/lib.rs b/tests/run-make/staticlib-hide-internal-symbols/lib.rs
new file mode 100644
index 0000000..4bbf21b
--- /dev/null
+++ b/tests/run-make/staticlib-hide-internal-symbols/lib.rs
@@ -0,0 +1,40 @@
+#![crate_type = "staticlib"]
+
+use std::collections::HashMap;
+use std::panic::{AssertUnwindSafe, catch_unwind};
+
+#[no_mangle]
+pub extern "C" fn my_add(a: i32, b: i32) -> i32 {
+    a + b
+}
+
+#[no_mangle]
+pub extern "C" fn my_hash_lookup(key: u64) -> u64 {
+    let mut map = HashMap::new();
+    for i in 0..100u64 {
+        map.insert(i, i.wrapping_mul(2654435761));
+    }
+    *map.get(&key).unwrap_or(&0)
+}
+
+fn internal_helper() -> i32 {
+    42
+}
+
+#[no_mangle]
+pub extern "C" fn call_internal() -> i32 {
+    internal_helper()
+}
+
+#[no_mangle]
+pub extern "C" fn my_safe_div(a: i32, b: i32) -> i32 {
+    match catch_unwind(AssertUnwindSafe(|| {
+        if b == 0 {
+            panic!("division by zero!");
+        }
+        a / b
+    })) {
+        Ok(result) => result,
+        Err(_) => -1,
+    }
+}
diff --git a/tests/run-make/staticlib-hide-internal-symbols/main.c b/tests/run-make/staticlib-hide-internal-symbols/main.c
new file mode 100644
index 0000000..ad8b26e
--- /dev/null
+++ b/tests/run-make/staticlib-hide-internal-symbols/main.c
@@ -0,0 +1,20 @@
+#include <stdint.h>
+
+extern int my_add(int a, int b);
+extern uint64_t my_hash_lookup(uint64_t key);
+extern int call_internal(void);
+extern int my_safe_div(int a, int b);
+
+int main() {
+    if (my_add(10, 20) != 30)
+        return 1;
+    if (my_hash_lookup(5) != (uint64_t)5 * 2654435761ULL)
+        return 1;
+    if (call_internal() != 42)
+        return 1;
+    if (my_safe_div(100, 5) != 20)
+        return 1;
+    if (my_safe_div(100, 0) != -1)
+        return 1;
+    return 0;
+}
diff --git a/tests/run-make/staticlib-hide-internal-symbols/rmake.rs b/tests/run-make/staticlib-hide-internal-symbols/rmake.rs
new file mode 100644
index 0000000..8f6324d
--- /dev/null
+++ b/tests/run-make/staticlib-hide-internal-symbols/rmake.rs
@@ -0,0 +1,132 @@
+//@ only-elf
+//@ ignore-cross-compile
+
+use std::collections::HashSet;
+
+use run_make_support::object::read::archive::ArchiveFile;
+use run_make_support::object::read::elf::{FileHeader as _, SectionHeader as _, Sym as _};
+use run_make_support::object::{Endianness, elf};
+use run_make_support::{cc, extra_c_flags, rfs, run, rustc, static_lib_name};
+
+const EXPORTED: &[&str] = &["my_add", "my_hash_lookup", "call_internal", "my_safe_div"];
+
+fn main() {
+    let lib_name = static_lib_name("lib");
+
+    rustc()
+        .input("lib.rs")
+        .crate_type("staticlib")
+        .arg("-Zstaticlib-hide-internal-symbols")
+        .opt()
+        .run();
+
+    cc().input("main.c").input(&lib_name).out_exe("main").args(extra_c_flags()).run();
+    run("main");
+
+    let data = rfs::read(&lib_name);
+    check_symbols(&data, true);
+
+    rfs::remove_file(&lib_name);
+    rustc().input("lib.rs").crate_type("staticlib").opt().run();
+
+    let data = rfs::read(&lib_name);
+    check_symbols(&data, false);
+}
+
+fn check_symbols(archive_data: &[u8], with_flag: bool) {
+    let archive = ArchiveFile::parse(archive_data).unwrap();
+    let mut found_exported = HashSet::new();
+
+    for member in archive.members() {
+        let member = member.unwrap();
+        if !member.name().ends_with(b".rcgu.o") {
+            continue;
+        }
+        let data = member.data(archive_data).unwrap();
+
+        if let Ok(header) = elf::FileHeader64::<Endianness>::parse(data) {
+            check_elf_symbols(header, data, with_flag, &mut found_exported);
+        } else if let Ok(header) = elf::FileHeader32::<Endianness>::parse(data) {
+            check_elf_symbols(header, data, with_flag, &mut found_exported);
+        }
+    }
+
+    for expected in EXPORTED {
+        assert!(
+            found_exported.contains(*expected),
+            "expected to find exported symbol `{expected}` in archive"
+        );
+    }
+}
+
+fn check_elf_symbols<Elf: run_make_support::object::read::elf::FileHeader<Endian = Endianness>>(
+    header: &Elf,
+    data: &[u8],
+    with_flag: bool,
+    found_exported: &mut HashSet<String>,
+) {
+    let Ok(endian) = header.endian() else { return };
+    let Ok(sections) = header.sections(endian, data) else { return };
+
+    for (si, section) in sections.enumerate() {
+        if section.sh_type(endian) != elf::SHT_SYMTAB {
+            continue;
+        }
+        let Ok(symbols) = run_make_support::object::read::elf::SymbolTable::parse(
+            endian, data, &sections, si, section,
+        ) else {
+            continue;
+        };
+        let strtab = symbols.strings();
+
+        for symbol in symbols.symbols() {
+            let vis = symbol.st_visibility();
+            let bind = symbol.st_bind();
+            let shndx = symbol.st_shndx(endian);
+
+            if shndx == elf::SHN_UNDEF {
+                continue;
+            }
+            if bind != elf::STB_GLOBAL && bind != elf::STB_WEAK {
+                continue;
+            }
+
+            let Ok(name_bytes) = symbol.name(endian, strtab) else { continue };
+            let Ok(name) = str::from_utf8(name_bytes) else { continue };
+
+            let exported = EXPORTED.contains(&name);
+
+            if with_flag {
+                let expected = if exported { elf::STV_DEFAULT } else { elf::STV_HIDDEN };
+                assert_eq!(
+                    vis,
+                    expected,
+                    "with -Z hide: `{name}` should be {}, got {}",
+                    visibility_name(expected),
+                    visibility_name(vis)
+                );
+            } else if exported {
+                assert_eq!(
+                    vis,
+                    elf::STV_DEFAULT,
+                    "without -Z: `{name}` should be STV_DEFAULT, got {}",
+                    visibility_name(vis)
+                );
+            }
+
+            if exported {
+                found_exported.insert(name.to_string());
+            }
+        }
+    }
+}
+
+fn visibility_name(v: u8) -> &'static str {
+    match v {
+        elf::STV_DEFAULT => "STV_DEFAULT",
+        elf::STV_HIDDEN => "STV_HIDDEN",
+        elf::STV_INTERNAL => "STV_INTERNAL",
+        elf::STV_PROTECTED => "STV_PROTECTED",
+        _ => "UNKNOWN",
+    }
+}
diff --git a/tests/rustdoc-html/hidden-trait-methods-with-document-hidden-items.rs b/tests/rustdoc-html/hidden-trait-methods-with-document-hidden-items.rs
index a290992..dc8ff4b 100644
--- a/tests/rustdoc-html/hidden-trait-methods-with-document-hidden-items.rs
+++ b/tests/rustdoc-html/hidden-trait-methods-with-document-hidden-items.rs
@@ -29,3 +29,9 @@ impl Trait for S {
     fn f() {}
     fn g() {}
 }
+
+// Regression test for https://github.com/rust-lang/rust/issues/151454.
+//@ has foo/fn.hidden_projection.html
+//@ has - '//pre[@class="rust item-decl"]' 'T::Foo'
+//@ has - '//pre[@class="rust item-decl"]//a[@href="trait.Trait.html#associatedtype.Foo"]' 'Foo'
+pub fn hidden_projection<T: Trait>(_: T::Foo) {}
diff --git a/tests/rustdoc-html/hidden-trait-methods.rs b/tests/rustdoc-html/hidden-trait-methods.rs
index 2c342ff..5f25d99 100644
--- a/tests/rustdoc-html/hidden-trait-methods.rs
+++ b/tests/rustdoc-html/hidden-trait-methods.rs
@@ -27,3 +27,9 @@ impl Trait for S {
     fn f() {}
     fn g() {}
 }
+
+// Regression test for https://github.com/rust-lang/rust/issues/151454.
+//@ has foo/fn.hidden_projection.html
+//@ has - '//pre[@class="rust item-decl"]' 'T::Foo'
+//@ count - '//pre[@class="rust item-decl"]//a' 'Foo' 0
+pub fn hidden_projection<T: Trait>(_: T::Foo) {}
diff --git a/tests/rustdoc-html/macro/const-rendering-macros-33302.rs b/tests/rustdoc-html/macro/const-rendering-macros-33302.rs
index 9fd45df..26b7d3d 100644
--- a/tests/rustdoc-html/macro/const-rendering-macros-33302.rs
+++ b/tests/rustdoc-html/macro/const-rendering-macros-33302.rs
@@ -1,5 +1,5 @@
 // https://github.com/rust-lang/rust/issues/33302
-#![crate_name="issue_33302"]
+#![crate_name = "issue_33302"]
 
 // Ensure constant and array length values are not taken from source
 // code, which wreaks havoc with macros.
@@ -25,11 +25,12 @@ fn ignore(_: &X) {}
         }
 
         //@ has issue_33302/struct.S.html \
-        //        '//*[@class="impl"]' 'impl T<[i32; 16]> for S'
-        //@ has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]'
+        //        '//*[@class="impl"]' 'impl T<(i32, i32)> for S'
+        //@ has - '//*[@id="associatedconstant.C"]' 'const C: (i32, i32)'
         //@ has - '//*[@id="associatedconstant.D"]' 'const D: i32'
-        impl T<[i32; ($n * $n)]> for S {
-            const C: [i32; ($n * $n)] = [0; ($n * $n)];
+        impl T<(i32, i32)> for S {
+            const C: (i32, i32) = ($n, $n);
+            const D: i32 = ($n / $n);
         }
 
         //@ has issue_33302/struct.S.html \
@@ -41,12 +42,11 @@ impl T<(i32,)> for S {
         }
 
         //@ has issue_33302/struct.S.html \
-        //        '//*[@class="impl"]' 'impl T<(i32, i32)> for S'
-        //@ has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)'
+        //        '//*[@class="impl"]' 'impl T<[i32; 16]> for S'
+        //@ has - '//*[@id="associatedconstant.C-2"]' 'const C: [i32; 16]'
         //@ has - '//*[@id="associatedconstant.D-2"]' 'const D: i32'
-        impl T<(i32, i32)> for S {
-            const C: (i32, i32) = ($n, $n);
-            const D: i32 = ($n / $n);
+        impl T<[i32; ($n * $n)]> for S {
+            const C: [i32; ($n * $n)] = [0; ($n * $n)];
         }
     };
 }
diff --git a/tests/rustdoc-ui/doctest/test_harness.rs b/tests/rustdoc-ui/doctest/test_harness.rs
new file mode 100644
index 0000000..f32309b
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/test_harness.rs
@@ -0,0 +1,42 @@
+// Ensure that the code block attr `test_harness` works as expected.
+//@ compile-flags: --test --test-args --test-threads=1
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ normalize-stdout: "Test executable failed \(.+?\)" -> "Test executable failed ($$STATUS)"
+//@ rustc-env: RUST_BACKTRACE=0
+//@ failure-status: 101
+
+// NOTE(#157511): This test file only contains `test_harness` doctests that each only contain at
+// most a single `#[test]` function. That's because at the time of writing, arguments passed via
+// `--test-args` only get propagated to the "main" libtest runner. However, we would *have* to pass
+// `--test-threads=1` to the inner libtest runner to ensure deterministic test output. We can only
+// do that by utilizing a runtool currently.
+//
+// While we could call a runtool "inline" (via something like `sh -c` on Linux) here in this UI test
+// we would need to branch on the host platform and do some crimes to get it working. Instead, we
+// have chosen to use a run-make test for this with a Rust runtool which is cross-platform.
+
+// The `main` fn won't be run under `test_harness`, so this test should pass.
+//! ```test_harness
+//! fn main() {
+//!     assert!(false);
+//! }
+//! ```
+
+// Contrary to normal doctests, cfg `test` is active under `test_harness`.
+//! ```test_harness
+//! #[cfg(test)]
+//! mod group {
+//!     #[test]
+//!     fn element() {
+//!         assert!(false);
+//!     }
+//! }
+//! ```
+
+// `test_harness` doctests aren't implicitly wrapped in a `main` fn even if they contain stmts.
+//! ```test_harness
+//! assert!(true);
+//!
+//! #[test] fn extra() {}
+//! ```
diff --git a/tests/rustdoc-ui/doctest/test_harness.stdout b/tests/rustdoc-ui/doctest/test_harness.stdout
new file mode 100644
index 0000000..6e71e54
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/test_harness.stdout
@@ -0,0 +1,49 @@
+
+running 3 tests
+test $DIR/test_harness.rs - (line 20) ... ok
+test $DIR/test_harness.rs - (line 25) ... FAILED
+test $DIR/test_harness.rs - (line 34) ... FAILED
+
+failures:
+
+---- $DIR/test_harness.rs - (line 25) stdout ----
+Test executable failed ($STATUS).
+
+stdout:
+
+running 1 test
+test group::element ... FAILED
+
+failures:
+
+---- group::element stdout ----
+
+thread 'group::element' ($TID) panicked at $DIR/test_harness.rs:6:9:
+assertion failed: false
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+
+
+failures:
+    group::element
+
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
+
+
+---- $DIR/test_harness.rs - (line 34) stdout ----
+error: non-item macro in item position: assert
+  --> $DIR/test_harness.rs:35:1
+   |
+LL | assert!(true);
+   | ^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+Couldn't compile the test.
+
+failures:
+    $DIR/test_harness.rs - (line 25)
+    $DIR/test_harness.rs - (line 34)
+
+test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/rustdoc-ui/intra-doc/deprecated-note-link-after-unclosed-code-fence.rs b/tests/rustdoc-ui/intra-doc/deprecated-note-link-after-unclosed-code-fence.rs
new file mode 100644
index 0000000..ac85c14
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/deprecated-note-link-after-unclosed-code-fence.rs
@@ -0,0 +1,12 @@
+//@ check-pass
+
+// Regression test for https://github.com/rust-lang/rust/issues/157326.
+#![allow(rustdoc::invalid_rust_codeblocks)]
+#![deprecated(note = "use [Env::try_invoke] instead")]
+//! ```
+
+pub struct Env;
+
+impl Env {
+    pub fn try_invoke(&self) {}
+}
diff --git a/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs b/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs
index 8a7cacf..610a499 100644
--- a/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs
+++ b/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs
@@ -4,24 +4,17 @@
 #![deny(warnings)]
 
 extern crate rustc_codegen_ssa;
-extern crate rustc_data_structures;
-extern crate rustc_driver;
-extern crate rustc_errors;
-extern crate rustc_hir;
+extern crate rustc_driver as _;
 extern crate rustc_metadata;
 extern crate rustc_middle;
 extern crate rustc_session;
-extern crate rustc_span;
-extern crate rustc_symbol_mangling;
-extern crate rustc_target;
 
 use std::any::Any;
 
 use rustc_codegen_ssa::traits::CodegenBackend;
 use rustc_codegen_ssa::{CompiledModules, CrateInfo};
-use rustc_data_structures::fx::FxIndexMap;
 use rustc_metadata::EncodedMetadata;
-use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
+use rustc_middle::dep_graph::WorkProductMap;
 use rustc_middle::ty::TyCtxt;
 use rustc_session::Session;
 use rustc_session::config::OutputFilenames;
@@ -47,11 +40,11 @@ fn join_codegen(
         _sess: &Session,
         _outputs: &OutputFilenames,
         _crate_info: &CrateInfo,
-    ) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
+    ) -> (CompiledModules, WorkProductMap) {
         let codegen_results = ongoing_codegen
             .downcast::<CompiledModules>()
             .expect("in join_codegen: ongoing_codegen is not a CompiledModules");
-        (*codegen_results, FxIndexMap::default())
+        (*codegen_results, WorkProductMap::default())
     }
 
     fn link(
diff --git a/tests/ui-fulldeps/rustc_public/check_fn_attrs.rs b/tests/ui-fulldeps/rustc_public/check_fn_attrs.rs
index 552e8cb..aaa3167 100644
--- a/tests/ui-fulldeps/rustc_public/check_fn_attrs.rs
+++ b/tests/ui-fulldeps/rustc_public/check_fn_attrs.rs
@@ -14,20 +14,26 @@
 #[macro_use]
 extern crate rustc_public;
 
-use rustc_public::crate_def::CrateDef;
-use rustc_public::ty::{Asyncness, Constness, FnDef};
 use std::io::Write;
 use std::ops::ControlFlow;
 
+use rustc_public::crate_def::CrateDef;
+use rustc_public::ty::{Asyncness, Constness, FnDef};
+
 const CRATE_NAME: &str = "input";
 
 fn test_stable_mir() -> ControlFlow<()> {
     let fns = rustc_public::local_crate().fn_defs();
 
-    check_fn(&fns, "input::const_sync", Constness::Const, Asyncness::NotAsync);
+    check_fn(&fns, "input::const_sync", Constness::Const { always: false }, Asyncness::NotAsync);
     check_fn(&fns, "input::async_fn", Constness::NotConst, Asyncness::Async);
     check_fn(&fns, "input::plain", Constness::NotConst, Asyncness::NotAsync);
-    check_fn(&fns, "input::Widget::assoc_const", Constness::Const, Asyncness::NotAsync);
+    check_fn(
+        &fns,
+        "input::Widget::assoc_const",
+        Constness::Const { always: false },
+        Asyncness::NotAsync,
+    );
     check_fn(&fns, "input::Widget::assoc_async", Constness::NotConst, Asyncness::Async);
     check_fn(&fns, "input::Widget::assoc_plain", Constness::NotConst, Asyncness::NotAsync);
 
diff --git a/tests/ui/README.md b/tests/ui/README.md
index 00afc98..a1ec43e 100644
--- a/tests/ui/README.md
+++ b/tests/ui/README.md
@@ -296,6 +296,10 @@
 
 Meta test suite of the test harness `compiletest` itself.
 
+## `tests/ui/comptime`: compile-time only functions and intrinsics
+
+Test the `#[rustc_comptime]` attribute and intrinsics that inherently can only run at compile-time.
+
 ## `tests/ui/conditional-compilation/`: Conditional Compilation
 
 Tests for `#[cfg]` attribute or `--cfg` flags, used to compile certain files or code blocks only if certain conditions are met (such as developing on a specific architecture).
diff --git a/tests/ui/abi/rust-preserve-none-cc.rs b/tests/ui/abi/rust-preserve-none-cc.rs
index deacb92..20895e1 100644
--- a/tests/ui/abi/rust-preserve-none-cc.rs
+++ b/tests/ui/abi/rust-preserve-none-cc.rs
@@ -1,5 +1,6 @@
 //@ run-pass
 //@ needs-unwind
+//@ ignore-backends: gcc
 
 #![feature(rust_preserve_none_cc)]
 
@@ -17,9 +18,7 @@ extern "rust-preserve-none" fn oven_explosion() {
 
 #[inline(never)]
 fn bite_into(yummy: u64) -> u64 {
-    let did_it_actually = std::panic::catch_unwind(move || {
-        oven_explosion()
-    });
+    let did_it_actually = std::panic::catch_unwind(move || oven_explosion());
     assert!(did_it_actually.is_err());
     yummy - 25
 }
@@ -52,16 +51,26 @@ extern "rust-preserve-none" fn lotsa_apples(
         and_a.rome.iter().sum(),
         fuji + ambrosia,
         cosmic_crisp - honeycrisp,
-        bite_into(and_a.golden_delicious)
+        bite_into(and_a.golden_delicious),
     )
 }
 
 fn main() {
-    let pie = lotsa_apples(220, 140, 210.54201234, &[180, 210], (), CrateOf {
-        mcintosh: 150.0,
-        golden_delicious: 185,
-        jonagold: None,
-        rome: [180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202]
-    }, 270, 193.1, &[]);
+    let pie = lotsa_apples(
+        220,
+        140,
+        210.54201234,
+        &[180, 210],
+        (),
+        CrateOf {
+            mcintosh: 150.0,
+            golden_delicious: 185,
+            jonagold: None,
+            rome: [180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202],
+        },
+        270,
+        193.1,
+        &[],
+    );
     assert_eq!(pie, (2292, 403.64201234, 50, 160));
 }
diff --git a/tests/ui/abi/rust-tail-cc.rs b/tests/ui/abi/rust-tail-cc.rs
new file mode 100644
index 0000000..aba5d0d
--- /dev/null
+++ b/tests/ui/abi/rust-tail-cc.rs
@@ -0,0 +1,80 @@
+//@ revisions: aarch64 x32 x64
+//@ run-pass
+//@[aarch64] only-aarch64
+//@[x32] only-x86
+//@[x64] only-x86_64
+//@ needs-unwind
+//@ ignore-backends: gcc
+
+#![feature(rust_tail_cc)]
+
+struct CrateOf<'a> {
+    mcintosh: f64,
+    golden_delicious: u64,
+    jonagold: Option<&'a u64>,
+    rome: [u64; 12],
+}
+
+#[inline(never)]
+extern "tail" fn oven_explosion() {
+    panic!("bad time");
+}
+
+#[inline(never)]
+fn bite_into(yummy: u64) -> u64 {
+    let did_it_actually = std::panic::catch_unwind(move || oven_explosion());
+    assert!(did_it_actually.is_err());
+    yummy - 25
+}
+
+#[inline(never)]
+extern "tail" fn lotsa_apples(
+    honeycrisp: u64,
+    gala: u32,
+    fuji: f64,
+    granny_smith: &[u64],
+    pink_lady: (),
+    and_a: CrateOf<'static>,
+    cosmic_crisp: u64,
+    ambrosia: f64,
+    winesap: &[u64],
+) -> (u64, f64, u64, u64) {
+    assert_eq!(honeycrisp, 220);
+    assert_eq!(gala, 140);
+    assert_eq!(fuji, 210.54201234);
+    assert_eq!(granny_smith, &[180, 210]);
+    assert_eq!(pink_lady, ());
+    assert_eq!(and_a.mcintosh, 150.0);
+    assert_eq!(and_a.golden_delicious, 185);
+    assert_eq!(and_a.jonagold, None); // my scales can't weight these gargantuans.
+    assert_eq!(and_a.rome, [180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202]);
+    assert_eq!(cosmic_crisp, 270);
+    assert_eq!(ambrosia, 193.1);
+    assert_eq!(winesap, &[]);
+    (
+        and_a.rome.iter().sum(),
+        fuji + ambrosia,
+        cosmic_crisp - honeycrisp,
+        bite_into(and_a.golden_delicious),
+    )
+}
+
+fn main() {
+    let pie = lotsa_apples(
+        220,
+        140,
+        210.54201234,
+        &[180, 210],
+        (),
+        CrateOf {
+            mcintosh: 150.0,
+            golden_delicious: 185,
+            jonagold: None,
+            rome: [180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202],
+        },
+        270,
+        193.1,
+        &[],
+    );
+    assert_eq!(pie, (2292, 403.64201234, 50, 160));
+}
diff --git a/tests/ui/argument-suggestions/wrong-highlight-span-extra-arguments-147070.svg b/tests/ui/argument-suggestions/wrong-highlight-span-extra-arguments-147070.svg
index 549acee..af41631 100644
--- a/tests/ui/argument-suggestions/wrong-highlight-span-extra-arguments-147070.svg
+++ b/tests/ui/argument-suggestions/wrong-highlight-span-extra-arguments-147070.svg
@@ -1,4 +1,4 @@
-<svg width="944px" height="434px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="434px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { fill: #000000 }
diff --git a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.rs b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.rs
index b757521..0072c4c 100644
--- a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.rs
+++ b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.rs
@@ -29,12 +29,7 @@ fn paint<C:BoxCar>(c: C, d: C::Color) {
     //~^ ERROR ambiguous associated type `Color` in bounds of `C`
 }
 
-fn dent_object_2<COLOR>(c: &dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
-    //~^ ERROR the value of the associated types
-    //~| ERROR equality constraints are not yet supported in `where` clauses
-}
-
-fn dent_object_3<X, COLOR>(c: X)
+fn dent_object_2<X, COLOR>(c: X)
 where X: BoxCar,
     X: Vehicle<Color = COLOR>,
     X: Box<Color = COLOR>
diff --git a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
index 063623e..78a6d02 100644
--- a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
+++ b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
@@ -1,11 +1,3 @@
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:47
-   |
-LL | fn dent_object_2<COLOR>(c: &dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
-   |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-
 error[E0221]: ambiguous associated type `Color` in bounds of `C`
   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:19:32
    |
@@ -84,21 +76,7 @@
 LL + fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
    |
 
-error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
-  --> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:33
-   |
-LL |     type Color;
-   |     ---------- `Vehicle::Color` defined here
-...
-LL |     type Color;
-   |     ---------- `Box::Color` defined here
-...
-LL | fn dent_object_2<COLOR>(c: &dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
-   |                                 ^^^^^^ associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified
-   |
-   = help: consider introducing a new type parameter, adding `where` constraints using the fully-qualified path to the associated types
-
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0191, E0221, E0222.
 For more information about an error, try `rustc --explain E0191`.
diff --git a/tests/ui/async-await/async-drop/async-drop-box.rs b/tests/ui/async-await/async-drop/async-drop-box.rs
index 0a6ed41..f44a3e8 100644
--- a/tests/ui/async-await/async-drop/async-drop-box.rs
+++ b/tests/ui/async-await/async-drop/async-drop-box.rs
@@ -1,12 +1,9 @@
 //@ run-pass
 //@ check-run-results
 // struct `Foo` has both sync and async drop.
-// `Foo` is always inside `Box`
+// `Foo` is always inside `Box`.
 // Sync version is called in sync context, async version is called in async function.
 
-//@ known-bug: #143658
-// async version is never actually called
-
 #![feature(async_drop)]
 #![allow(incomplete_features)]
 
@@ -30,6 +27,10 @@ struct Foo {
     my_resource_handle: usize,
 }
 
+trait DynFoo {}
+
+impl DynFoo for Foo {}
+
 impl Foo {
     fn new(my_resource_handle: usize) -> Self {
         let out = Foo {
@@ -58,6 +59,8 @@ fn main() {
     }
     println!("Middle");
     block_on(bar(10));
+    println!("Dyn");
+    block_on(bar_dyn(20));
     println!("Done")
 }
 
@@ -65,6 +68,12 @@ async fn bar(ident_base: usize) {
     let _first = Box::new(Foo::new(ident_base));
 }
 
+async fn bar_dyn(ident_base: usize) {
+    // FIXME(async_drop): boxed dyn pointees should eventually use async drop
+    // glue in async contexts. For now this documents the sync-drop fallback.
+    let _first: Box<dyn DynFoo> = Box::new(Foo::new(ident_base));
+}
+
 fn block_on<F>(fut_unpin: F) -> F::Output
 where
     F: Future,
diff --git a/tests/ui/async-await/async-drop/async-drop-box.run.stdout b/tests/ui/async-await/async-drop/async-drop-box.run.stdout
index a2dab2b..da0ff3c 100644
--- a/tests/ui/async-await/async-drop/async-drop-box.run.stdout
+++ b/tests/ui/async-await/async-drop/async-drop-box.run.stdout
@@ -2,5 +2,8 @@
 Foo::drop() : 7
 Middle
 Foo::new() : 10
-Foo::drop() : 10
+Foo::async drop() : 10
+Dyn
+Foo::new() : 20
+Foo::drop() : 20
 Done
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.rs b/tests/ui/async-await/future-sizes/async-awaiting-fut.rs
index ab2a519..3b29356 100644
--- a/tests/ui/async-await/future-sizes/async-awaiting-fut.rs
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.rs
@@ -5,7 +5,7 @@
 //@ edition:2021
 //@ build-pass
 //@ no-pass-override (codegen affects -Zprint-type-sizes)
-//@ only-x86_64
+//@ only-64bit
 
 async fn wait() {}
 
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
index 13f03ff..90381a1 100644
--- a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
@@ -72,6 +72,8 @@
 print-type-size     field `.0`: 16 bytes
 print-type-size type: `std::ptr::NonNull<str>`: 16 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 16 bytes
+print-type-size type: `std::future::ResumeTy`: 8 bytes, alignment: 8 bytes
+print-type-size     field `.0`: 8 bytes
 print-type-size type: `std::pin::Pin<&mut {async fn body of big_fut()}>`: 8 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 8 bytes
 print-type-size type: `std::pin::Pin<&mut {async fn body of calls_fut<{async fn body of big_fut()}>()}>`: 8 bytes, alignment: 8 bytes
@@ -85,6 +87,8 @@
 print-type-size     field `._phantom`: 0 bytes
 print-type-size type: `std::ptr::NonNull<std::ptr::metadata::VTable>`: 8 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 8 bytes
+print-type-size type: `std::ptr::NonNull<std::task::Context<'_>>`: 8 bytes, alignment: 8 bytes
+print-type-size     field `.pointer`: 8 bytes
 print-type-size type: `std::mem::ManuallyDrop<bool>`: 1 bytes, alignment: 1 bytes
 print-type-size     field `.value`: 1 bytes
 print-type-size type: `std::mem::ManuallyDrop<{async fn body of wait()}>`: 1 bytes, alignment: 1 bytes
diff --git a/tests/ui/async-await/future-sizes/large-arg.rs b/tests/ui/async-await/future-sizes/large-arg.rs
index 3843e36..d41bf71 100644
--- a/tests/ui/async-await/future-sizes/large-arg.rs
+++ b/tests/ui/async-await/future-sizes/large-arg.rs
@@ -5,7 +5,7 @@
 //@ edition: 2021
 //@ build-pass
 //@ no-pass-override (codegen affects -Zprint-type-sizes)
-//@ only-x86_64
+//@ only-64bit
 
 pub async fn test() {
     let _ = a([0u8; 1024]).await;
diff --git a/tests/ui/async-await/future-sizes/large-arg.stdout b/tests/ui/async-await/future-sizes/large-arg.stdout
index d51afa3..f65c5c1 100644
--- a/tests/ui/async-await/future-sizes/large-arg.stdout
+++ b/tests/ui/async-await/future-sizes/large-arg.stdout
@@ -84,6 +84,8 @@
 print-type-size     field `.0`: 16 bytes
 print-type-size type: `std::ptr::NonNull<str>`: 16 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 16 bytes
+print-type-size type: `std::future::ResumeTy`: 8 bytes, alignment: 8 bytes
+print-type-size     field `.0`: 8 bytes
 print-type-size type: `std::pin::Pin<&mut {async fn body of a<[u8; 1024]>()}>`: 8 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 8 bytes
 print-type-size type: `std::pin::Pin<&mut {async fn body of b<[u8; 1024]>()}>`: 8 bytes, alignment: 8 bytes
@@ -97,6 +99,8 @@
 print-type-size     field `._phantom`: 0 bytes
 print-type-size type: `std::ptr::NonNull<std::ptr::metadata::VTable>`: 8 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 8 bytes
+print-type-size type: `std::ptr::NonNull<std::task::Context<'_>>`: 8 bytes, alignment: 8 bytes
+print-type-size     field `.pointer`: 8 bytes
 print-type-size type: `std::task::Poll<()>`: 1 bytes, alignment: 1 bytes
 print-type-size     discriminant: 1 bytes
 print-type-size     variant `Ready`: 0 bytes
diff --git a/tests/ui/attributes/attr-on-mac-call.rs b/tests/ui/attributes/attr-on-mac-call.rs
index 2875ff0..1fdc2a6 100644
--- a/tests/ui/attributes/attr-on-mac-call.rs
+++ b/tests/ui/attributes/attr-on-mac-call.rs
@@ -108,6 +108,6 @@ fn main() {
     //~| WARN previously accepted
     unreachable!();
     #[register_tool(xyz)]
-    //~^ WARN crate-level attribute should be an inner attribute
+    //~^ ERROR crate-level attribute should be an inner attribute
     unreachable!();
 }
diff --git a/tests/ui/attributes/attr-on-mac-call.stderr b/tests/ui/attributes/attr-on-mac-call.stderr
index 8d19137..c688acc 100644
--- a/tests/ui/attributes/attr-on-mac-call.stderr
+++ b/tests/ui/attributes/attr-on-mac-call.stderr
@@ -6,6 +6,18 @@
    |
    = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics
 
+error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![register_tool]`
+  --> $DIR/attr-on-mac-call.rs:110:5
+   |
+LL |     #[register_tool(xyz)]
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+note: this attribute does not have an `!`, which means it is applied to this macro call
+  --> $DIR/attr-on-mac-call.rs:112:5
+   |
+LL |     unreachable!();
+   |     ^^^^^^^^^^^^^^
+
 warning: `#[export_name]` attribute cannot be used on macro calls
   --> $DIR/attr-on-mac-call.rs:8:5
    |
@@ -161,7 +173,7 @@
 LL |     #[macro_use]
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[must_use]` attribute cannot be used on macro calls
@@ -289,17 +301,5 @@
    = help: `#[repr(simd)]` can only be applied to structs
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![register_tool]`
-  --> $DIR/attr-on-mac-call.rs:110:5
-   |
-LL |     #[register_tool(xyz)]
-   |     ^^^^^^^^^^^^^^^^^^^^^
-   |
-note: this attribute does not have an `!`, which means it is applied to this macro call
-  --> $DIR/attr-on-mac-call.rs:112:5
-   |
-LL |     unreachable!();
-   |     ^^^^^^^^^^^^^^
-
-error: aborting due to 1 previous error; 32 warnings emitted
+error: aborting due to 2 previous errors; 31 warnings emitted
 
diff --git a/tests/ui/attributes/malformed-no-std.stderr b/tests/ui/attributes/malformed-no-std.stderr
index 07963e6..a965b7e 100644
--- a/tests/ui/attributes/malformed-no-std.stderr
+++ b/tests/ui/attributes/malformed-no-std.stderr
@@ -106,6 +106,18 @@
 LL | #![no_core = "foo"]
    | ^^^^^^^^^^^^^^^^^^^
 
+error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_core]`
+  --> $DIR/malformed-no-std.rs:23:1
+   |
+LL | #[no_core]
+   | ^^^^^^^^^^
+   |
+note: this attribute does not have an `!`, which means it is applied to this extern crate
+  --> $DIR/malformed-no-std.rs:26:1
+   |
+LL | extern crate core;
+   | ^^^^^^^^^^^^^^^^^^
+
 error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]`
   --> $DIR/malformed-no-std.rs:21:1
    |
@@ -123,18 +135,6 @@
 LL | #[deny(unused_attributes)]
    |        ^^^^^^^^^^^^^^^^^
 
-error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_core]`
-  --> $DIR/malformed-no-std.rs:23:1
-   |
-LL | #[no_core]
-   | ^^^^^^^^^^
-   |
-note: this attribute does not have an `!`, which means it is applied to this extern crate
-  --> $DIR/malformed-no-std.rs:26:1
-   |
-LL | extern crate core;
-   | ^^^^^^^^^^^^^^^^^^
-
 warning: unused attribute
   --> $DIR/malformed-no-std.rs:5:1
    |
diff --git a/tests/ui/attributes/optimize-smoke-test.rs b/tests/ui/attributes/optimize-smoke-test.rs
new file mode 100644
index 0000000..9d8e75c
--- /dev/null
+++ b/tests/ui/attributes/optimize-smoke-test.rs
@@ -0,0 +1,25 @@
+//! Basic smoke test for `#[optimize(..)]` attributes.
+//@ run-pass
+
+#![feature(optimize_attribute)]
+
+#[optimize(speed)]
+fn optimized_speed() -> i32 {
+    42
+}
+
+#[optimize(size)]
+fn optimized_size() -> i32 {
+    42
+}
+
+#[optimize(none)]
+fn optimized_none() -> i32 {
+    42
+}
+
+fn main() {
+    assert_eq!(optimized_speed(), 42);
+    assert_eq!(optimized_size(), 42);
+    assert_eq!(optimized_none(), 42);
+}
diff --git a/tests/ui/attributes/optimize.rs b/tests/ui/attributes/optimize.rs
index c55353d..f1e07f3 100644
--- a/tests/ui/attributes/optimize.rs
+++ b/tests/ui/attributes/optimize.rs
@@ -62,3 +62,15 @@ fn duplicate_same() {}
 #[optimize(speed)]
 #[optimize(size)] //~ ERROR multiple `optimize` attributes
 fn duplicate_different() {}
+
+#[optimize(none)] //~ ERROR `#[optimize(none)]` cannot be used with `#[inline]` attributes
+#[inline]
+fn inline_conflict_a() {}
+
+#[inline(always)]
+#[optimize(none)] //~ ERROR `#[optimize(none)]` cannot be used with `#[inline]` attributes
+fn inline_conflict_b() {}
+
+#[inline(never)]
+#[optimize(none)]
+fn inline_conflict_c() {}
diff --git a/tests/ui/attributes/optimize.stderr b/tests/ui/attributes/optimize.stderr
index bd28646..c6555ce 100644
--- a/tests/ui/attributes/optimize.stderr
+++ b/tests/ui/attributes/optimize.stderr
@@ -62,5 +62,21 @@
 LL | #[optimize(speed)]
    | ^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 7 previous errors
+error: `#[optimize(none)]` cannot be used with `#[inline]` attributes
+  --> $DIR/optimize.rs:66:1
+   |
+LL | #[optimize(none)]
+   | ^^^^^^^^^^^^^^^^^ `#[optimize(none)]` here
+LL | #[inline]
+   | --------- `#[inline]` here
+
+error: `#[optimize(none)]` cannot be used with `#[inline]` attributes
+  --> $DIR/optimize.rs:71:1
+   |
+LL | #[inline(always)]
+   | ----------------- `#[inline]` here
+LL | #[optimize(none)]
+   | ^^^^^^^^^^^^^^^^^ `#[optimize(none)]` here
+
+error: aborting due to 9 previous errors
 
diff --git a/tests/ui/attributes/register-tool-target.rs b/tests/ui/attributes/register-tool-target.rs
index a92b946..8498e7f 100644
--- a/tests/ui/attributes/register-tool-target.rs
+++ b/tests/ui/attributes/register-tool-target.rs
@@ -1,8 +1,7 @@
-//@ check-pass
 #![feature(register_tool)]
 
 #[register_tool(no_valid_target)]
-//~^ WARN crate-level attribute should be an inner attribute
+//~^ ERROR crate-level attribute should be an inner attribute
 fn main() {
 
 }
diff --git a/tests/ui/attributes/register-tool-target.stderr b/tests/ui/attributes/register-tool-target.stderr
index 4808ee4..bf865c2 100644
--- a/tests/ui/attributes/register-tool-target.stderr
+++ b/tests/ui/attributes/register-tool-target.stderr
@@ -1,17 +1,16 @@
-warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![register_tool]`
-  --> $DIR/register-tool-target.rs:4:1
+error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![register_tool]`
+  --> $DIR/register-tool-target.rs:3:1
    |
 LL | #[register_tool(no_valid_target)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/register-tool-target.rs:6:1
+  --> $DIR/register-tool-target.rs:5:1
    |
 LL | / fn main() {
 LL | |
 LL | | }
    | |_^
-   = note: requested on the command line with `-W unused-attributes`
 
-warning: 1 warning emitted
+error: aborting due to 1 previous error
 
diff --git a/tests/ui/binding/issue-40402-2.stderr b/tests/ui/binding/issue-40402-2.stderr
index 9875589..571dbe4 100644
--- a/tests/ui/binding/issue-40402-2.stderr
+++ b/tests/ui/binding/issue-40402-2.stderr
@@ -8,10 +8,14 @@
    |          data moved here
    |
    = note: move occurs because these variables have types that don't implement the `Copy` trait
-help: consider borrowing here
+help: consider borrowing the pattern binding
    |
-LL |     let (a, b) = &x[0];
-   |                  +
+LL |     let (ref a, b) = x[0];
+   |          +++
+help: consider borrowing the pattern binding
+   |
+LL |     let (a, ref b) = x[0];
+   |             +++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.fixed b/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.fixed
new file mode 100644
index 0000000..1e70933
--- /dev/null
+++ b/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.fixed
@@ -0,0 +1,40 @@
+//@ run-rustfix
+#![allow(dead_code)]
+
+use std::ops::{Deref, DerefMut};
+
+fn take(mut wrap: Wrap<Struct>) {
+    if let Some(ref mut val) = wrap.field {
+        //~^ ERROR cannot move out of dereference of `Wrap<Struct>`
+        val.0 = ();
+    }
+}
+
+fn take_mut_ref_base(mut wrap: Wrap<Struct>) {
+    if let Some(ref mut val) = (&mut wrap).field {
+        //~^ ERROR cannot move out of dereference of `Wrap<Struct>`
+        val.0 = ();
+    }
+}
+
+struct Wrap<T>(T);
+struct Struct {
+    field: Option<NonCopy>,
+}
+struct NonCopy(());
+
+impl<T> Deref for Wrap<T> {
+    type Target = T;
+
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+
+impl<T> DerefMut for Wrap<T> {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.0
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.rs b/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.rs
new file mode 100644
index 0000000..ff9d440
--- /dev/null
+++ b/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.rs
@@ -0,0 +1,40 @@
+//@ run-rustfix
+#![allow(dead_code)]
+
+use std::ops::{Deref, DerefMut};
+
+fn take(mut wrap: Wrap<Struct>) {
+    if let Some(mut val) = wrap.field {
+        //~^ ERROR cannot move out of dereference of `Wrap<Struct>`
+        val.0 = ();
+    }
+}
+
+fn take_mut_ref_base(mut wrap: Wrap<Struct>) {
+    if let Some(mut val) = (&mut wrap).field {
+        //~^ ERROR cannot move out of dereference of `Wrap<Struct>`
+        val.0 = ();
+    }
+}
+
+struct Wrap<T>(T);
+struct Struct {
+    field: Option<NonCopy>,
+}
+struct NonCopy(());
+
+impl<T> Deref for Wrap<T> {
+    type Target = T;
+
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+
+impl<T> DerefMut for Wrap<T> {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.0
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.stderr b/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.stderr
new file mode 100644
index 0000000..506ddd3
--- /dev/null
+++ b/tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.stderr
@@ -0,0 +1,29 @@
+error[E0507]: cannot move out of dereference of `Wrap<Struct>`
+  --> $DIR/deref-field-pattern-ref-suggestion-issue-146995.rs:7:28
+   |
+LL |     if let Some(mut val) = wrap.field {
+   |                 -------    ^^^^^^^^^^
+   |                 |
+   |                 data moved here because `val` has type `NonCopy`, which does not implement the `Copy` trait
+   |
+help: consider borrowing the pattern binding
+   |
+LL |     if let Some(ref mut val) = wrap.field {
+   |                 +++
+
+error[E0507]: cannot move out of dereference of `Wrap<Struct>`
+  --> $DIR/deref-field-pattern-ref-suggestion-issue-146995.rs:14:28
+   |
+LL |     if let Some(mut val) = (&mut wrap).field {
+   |                 -------    ^^^^^^^^^^^^^^^^^
+   |                 |
+   |                 data moved here because `val` has type `NonCopy`, which does not implement the `Copy` trait
+   |
+help: consider borrowing the pattern binding
+   |
+LL |     if let Some(ref mut val) = (&mut wrap).field {
+   |                 +++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/borrowck/deref-index-pattern-ref-suggestion.fixed b/tests/ui/borrowck/deref-index-pattern-ref-suggestion.fixed
new file mode 100644
index 0000000..155a7c7
--- /dev/null
+++ b/tests/ui/borrowck/deref-index-pattern-ref-suggestion.fixed
@@ -0,0 +1,37 @@
+//@ run-rustfix
+#![allow(dead_code)]
+
+use std::ops::{Deref, DerefMut};
+
+fn take(mut wrap: Wrap<[Option<NonCopy>; 1]>) {
+    if let Some(ref mut val) = wrap[0] {
+        //~^ ERROR cannot move out of type `[Option<NonCopy>; 1]`, a non-copy array
+        val.0 = ();
+    }
+}
+
+fn take_mut_ref_base(mut wrap: Wrap<[Option<NonCopy>; 1]>) {
+    if let Some(ref mut val) = (&mut wrap)[0] {
+        //~^ ERROR cannot move out of type `[Option<NonCopy>; 1]`, a non-copy array
+        val.0 = ();
+    }
+}
+
+struct Wrap<T>(T);
+struct NonCopy(());
+
+impl<T> Deref for Wrap<T> {
+    type Target = T;
+
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+
+impl<T> DerefMut for Wrap<T> {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.0
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/deref-index-pattern-ref-suggestion.rs b/tests/ui/borrowck/deref-index-pattern-ref-suggestion.rs
new file mode 100644
index 0000000..5cfb229
--- /dev/null
+++ b/tests/ui/borrowck/deref-index-pattern-ref-suggestion.rs
@@ -0,0 +1,37 @@
+//@ run-rustfix
+#![allow(dead_code)]
+
+use std::ops::{Deref, DerefMut};
+
+fn take(mut wrap: Wrap<[Option<NonCopy>; 1]>) {
+    if let Some(mut val) = wrap[0] {
+        //~^ ERROR cannot move out of type `[Option<NonCopy>; 1]`, a non-copy array
+        val.0 = ();
+    }
+}
+
+fn take_mut_ref_base(mut wrap: Wrap<[Option<NonCopy>; 1]>) {
+    if let Some(mut val) = (&mut wrap)[0] {
+        //~^ ERROR cannot move out of type `[Option<NonCopy>; 1]`, a non-copy array
+        val.0 = ();
+    }
+}
+
+struct Wrap<T>(T);
+struct NonCopy(());
+
+impl<T> Deref for Wrap<T> {
+    type Target = T;
+
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+
+impl<T> DerefMut for Wrap<T> {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.0
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/deref-index-pattern-ref-suggestion.stderr b/tests/ui/borrowck/deref-index-pattern-ref-suggestion.stderr
new file mode 100644
index 0000000..fbaf659
--- /dev/null
+++ b/tests/ui/borrowck/deref-index-pattern-ref-suggestion.stderr
@@ -0,0 +1,29 @@
+error[E0508]: cannot move out of type `[Option<NonCopy>; 1]`, a non-copy array
+  --> $DIR/deref-index-pattern-ref-suggestion.rs:7:28
+   |
+LL |     if let Some(mut val) = wrap[0] {
+   |                 -------    ^^^^^^^ cannot move out of here
+   |                 |
+   |                 data moved here because `val` has type `NonCopy`, which does not implement the `Copy` trait
+   |
+help: consider borrowing the pattern binding
+   |
+LL |     if let Some(ref mut val) = wrap[0] {
+   |                 +++
+
+error[E0508]: cannot move out of type `[Option<NonCopy>; 1]`, a non-copy array
+  --> $DIR/deref-index-pattern-ref-suggestion.rs:14:28
+   |
+LL |     if let Some(mut val) = (&mut wrap)[0] {
+   |                 -------    ^^^^^^^^^^^^^^ cannot move out of here
+   |                 |
+   |                 data moved here because `val` has type `NonCopy`, which does not implement the `Copy` trait
+   |
+help: consider borrowing the pattern binding
+   |
+LL |     if let Some(ref mut val) = (&mut wrap)[0] {
+   |                 +++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/tests/ui/issues/issue-20055-box-trait.rs b/tests/ui/box/box-array-match-temporary-drop.rs
similarity index 90%
rename from tests/ui/issues/issue-20055-box-trait.rs
rename to tests/ui/box/box-array-match-temporary-drop.rs
index 43f1f43..d87c430 100644
--- a/tests/ui/issues/issue-20055-box-trait.rs
+++ b/tests/ui/box/box-array-match-temporary-drop.rs
@@ -1,5 +1,5 @@
 //@ run-pass
-// See Issues #20055 and #21695.
+// See Issues https://github.com/rust-lang/rust/issues/20055 and https://github.com/rust-lang/rust/issues/21695.
 
 // We are checking here that the temporaries `Box<[i8, k]>`, for `k`
 // in 1, 2, 3, 4, that are induced by the match expression are
diff --git a/tests/ui/issues/issue-20055-box-trait.stderr b/tests/ui/box/box-array-match-temporary-drop.stderr
similarity index 82%
rename from tests/ui/issues/issue-20055-box-trait.stderr
rename to tests/ui/box/box-array-match-temporary-drop.stderr
index b1cbb2a..09caa67 100644
--- a/tests/ui/issues/issue-20055-box-trait.stderr
+++ b/tests/ui/box/box-array-match-temporary-drop.stderr
@@ -1,5 +1,5 @@
 warning: method `dummy` is never used
-  --> $DIR/issue-20055-box-trait.rs:11:8
+  --> $DIR/box-array-match-temporary-drop.rs:11:8
    |
 LL | trait Boo {
    |       --- method in this trait
diff --git a/tests/ui/box/box-deref-in-match-arm-no-invalid-ir.rs b/tests/ui/box/box-deref-in-match-arm-no-invalid-ir.rs
new file mode 100644
index 0000000..8c005a3
--- /dev/null
+++ b/tests/ui/box/box-deref-in-match-arm-no-invalid-ir.rs
@@ -0,0 +1,18 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/18845
+
+//@ run-pass
+// This used to generate invalid IR in that even if we took the
+// `false` branch we'd still try to free the Box from the other
+// arm. This was due to treating `*Box::new(9)` as an rvalue datum
+// instead of as a place.
+
+fn test(foo: bool) -> u8 {
+    match foo {
+        true => *Box::new(9),
+        false => 0
+    }
+}
+
+fn main() {
+    assert_eq!(9, test(true));
+}
diff --git a/tests/ui/issues/issue-23491.rs b/tests/ui/box/box-dst-node-with-empty-slice.rs
similarity index 67%
rename from tests/ui/issues/issue-23491.rs
rename to tests/ui/box/box-dst-node-with-empty-slice.rs
index 0a2dfa4..15ee8d4 100644
--- a/tests/ui/issues/issue-23491.rs
+++ b/tests/ui/box/box-dst-node-with-empty-slice.rs
@@ -1,3 +1,5 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/23491
+
 //@ run-pass
 #![allow(unused_variables)]
 
diff --git a/tests/ui/issues/issue-20055-box-unsized-array.rs b/tests/ui/box/box-fixed-array-coerce-unsized-match.rs
similarity index 87%
rename from tests/ui/issues/issue-20055-box-unsized-array.rs
rename to tests/ui/box/box-fixed-array-coerce-unsized-match.rs
index 2663bcf..4251495 100644
--- a/tests/ui/issues/issue-20055-box-unsized-array.rs
+++ b/tests/ui/box/box-fixed-array-coerce-unsized-match.rs
@@ -1,5 +1,5 @@
 //@ run-pass
-// Issue #2005: Check that boxed fixed-size arrays are properly
+// Issue https://github.com/rust-lang/rust/issues/20055: Check that boxed fixed-size arrays are properly
 // accounted for (namely, only deallocated if they were actually
 // created) when they appear as temporaries in unused arms of a match
 // expression.
diff --git a/tests/ui/cfg/diagnostics-reexport.stderr b/tests/ui/cfg/diagnostics-reexport.stderr
index a3a6e13..026b552 100644
--- a/tests/ui/cfg/diagnostics-reexport.stderr
+++ b/tests/ui/cfg/diagnostics-reexport.stderr
@@ -2,7 +2,9 @@
   --> $DIR/diagnostics-reexport.rs:12:9
    |
 LL | pub use a::x;
-   |         ^^^^ no `x` in `a`
+   |         ^^^-
+   |            |
+   |            no `x` in `a`
    |
 note: found an item that was configured out
   --> $DIR/diagnostics-reexport.rs:18:12
diff --git a/tests/ui/cfg/diagnostics-same-crate.stderr b/tests/ui/cfg/diagnostics-same-crate.stderr
index c20542e..0f5ad1d 100644
--- a/tests/ui/cfg/diagnostics-same-crate.stderr
+++ b/tests/ui/cfg/diagnostics-same-crate.stderr
@@ -2,7 +2,9 @@
   --> $DIR/diagnostics-same-crate.rs:32:9
    |
 LL |     use super::inner::doesnt_exist;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `doesnt_exist` in `inner`
+   |         ^^^^^^^^^^^^^^------------
+   |                       |
+   |                       no `doesnt_exist` in `inner`
    |
 note: found an item that was configured out
   --> $DIR/diagnostics-same-crate.rs:11:13
diff --git a/tests/ui/cfg/reserved-macro-names-rename.stderr b/tests/ui/cfg/reserved-macro-names-rename.stderr
index d632791..443816b 100644
--- a/tests/ui/cfg/reserved-macro-names-rename.stderr
+++ b/tests/ui/cfg/reserved-macro-names-rename.stderr
@@ -20,7 +20,9 @@
   --> $DIR/reserved-macro-names-rename.rs:27:9
    |
 LL |     use not_found as cfg; // trigger "unresolved import", not "cfg reserved".
-   |         ^^^^^^^^^^^^^^^^ no external crate `not_found`
+   |         ---------^^^^^^^
+   |         |
+   |         no external crate `not_found`
 
 error[E0659]: `cfg` is ambiguous
   --> $DIR/reserved-macro-names-rename.rs:17:9
diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr
index 3474228..bcc3abf 100644
--- a/tests/ui/check-cfg/target_feature.stderr
+++ b/tests/ui/check-cfg/target_feature.stderr
@@ -60,6 +60,7 @@
 `bf16`
 `bmi1`
 `bmi2`
+`bool`
 `break`
 `bti`
 `bulk-memory`
@@ -68,11 +69,13 @@
 `clflushopt`
 `cmpxchg16b`
 `concurrent-functions`
+`coprocessor`
 `crc`
 `crt-static`
 `cssc`
 `d`
 `d32`
+`debug`
 `deflate-conversion`
 `dit`
 `div32`
@@ -94,8 +97,10 @@
 `elrw`
 `enhanced-sort`
 `ermsb`
+`exception`
 `exception-handling`
 `extended-const`
+`extendedl32r`
 `f`
 `f16c`
 `f32mm`
@@ -113,6 +118,7 @@
 `floate1`
 `fma`
 `fma4`
+`fp`
 `fp-armv8`
 `fp16`
 `fp64`
@@ -139,6 +145,7 @@
 `hbc`
 `high-registers`
 `high-word`
+`highpriinterrupts`
 `hvx`
 `hvx-ieee-fp`
 `hvx-length128b`
@@ -158,6 +165,7 @@
 `hwdiv`
 `i8mm`
 `ijmpcall`
+`interrupt`
 `isa-68000`
 `isa-68010`
 `isa-68020`
@@ -176,6 +184,7 @@
 `lbt`
 `ld-seq-sa`
 `leoncasa`
+`loop`
 `lor`
 `lowbytefirst`
 `lpm`
@@ -188,6 +197,7 @@
 `lvz`
 `lzcnt`
 `m`
+`mac16`
 `mclass`
 `message-security-assist-extension12`
 `message-security-assist-extension3`
@@ -198,6 +208,7 @@
 `miscellaneous-extensions-2`
 `miscellaneous-extensions-3`
 `miscellaneous-extensions-4`
+`miscsr`
 `mops`
 `movbe`
 `movrs`
@@ -208,11 +219,14 @@
 `msync`
 `mte`
 `mul`
+`mul32`
+`mul32high`
 `multivalue`
 `mutable-globals`
 `neon`
 `nnp-assist`
 `nontrapping-fptoint`
+`nsa`
 `nvic`
 `outline-atomics`
 `paca`
@@ -230,6 +244,7 @@
 `power9-altivec`
 `power9-vector`
 `prfchw`
+`prid`
 `ptx70`
 `ptx71`
 `ptx72`
@@ -258,13 +273,17 @@
 `rdrand`
 `rdseed`
 `reference-types`
+`regprotect`
 `relax`
 `relaxed-simd`
 `rmw`
 `rtm`
 `rva23u64`
+`rvector`
+`s32c1i`
 `sb`
 `scq`
+`sext`
 `sha`
 `sha2`
 `sha3`
@@ -325,6 +344,7 @@
 `sve2p1`
 `tail-call`
 `tbm`
+`threadptr`
 `thumb-mode`
 `thumb2`
 `tinyencoding`
diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/liveness.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/liveness.rs
index e5f7ed3..1861faf 100644
--- a/tests/ui/closures/2229_closure_analysis/diagnostics/liveness.rs
+++ b/tests/ui/closures/2229_closure_analysis/diagnostics/liveness.rs
@@ -1,6 +1,6 @@
 //@ edition:2021
 //@ check-pass
-//@ ignore-parallel-frontend unstable liveness diagnostics
+
 #![allow(unreachable_code)]
 #![warn(unused)]
 #![allow(dead_code)]
diff --git a/tests/ui/codegen/custom-target-invalid-llvm-target.json b/tests/ui/codegen/custom-target-invalid-llvm-target.json
new file mode 100644
index 0000000..07b20df
--- /dev/null
+++ b/tests/ui/codegen/custom-target-invalid-llvm-target.json
@@ -0,0 +1,6 @@
+{
+    "llvm-target": "not-a-real-target",
+    "data-layout": "e",
+    "arch": "x86_64",
+    "target-pointer-width": 64
+}
diff --git a/tests/ui/codegen/custom-target-invalid-llvm-target.rs b/tests/ui/codegen/custom-target-invalid-llvm-target.rs
new file mode 100644
index 0000000..72c80cd
--- /dev/null
+++ b/tests/ui/codegen/custom-target-invalid-llvm-target.rs
@@ -0,0 +1,10 @@
+// Regression test for https://github.com/rust-lang/rust/issues/157401
+
+// ignore-tidy-target-specific-tests
+//@ check-fail
+//@ compile-flags: --target={{src-base}}/codegen/custom-target-invalid-llvm-target.json -Z unstable-options
+//@ ignore-backends: gcc
+
+fn main() {}
+
+//~? ERROR failed to parse target machine config to target machine
diff --git a/tests/ui/codegen/custom-target-invalid-llvm-target.stderr b/tests/ui/codegen/custom-target-invalid-llvm-target.stderr
new file mode 100644
index 0000000..d5ac437
--- /dev/null
+++ b/tests/ui/codegen/custom-target-invalid-llvm-target.stderr
@@ -0,0 +1,2 @@
+error: failed to parse target machine config to target machine: could not create LLVM TargetMachine for triple: not-a-real-target
+
diff --git a/tests/ui/compiletest-self-test/ui-test-missing-annotations-detection.stderr b/tests/ui/compiletest-self-test/ui-test-missing-annotations-detection.stderr
new file mode 100644
index 0000000..ee49a5c
--- /dev/null
+++ b/tests/ui/compiletest-self-test/ui-test-missing-annotations-detection.stderr
@@ -0,0 +1,18 @@
+error[E0463]: can't find crate for `std`
+   |
+   = note: the `x86_64-unknown-linux-gnu` target may not support the standard library
+   = note: `std` is required by `<unknown>` because it does not declare `#![no_std]`
+   = help: consider building the standard library from source with `cargo build -Zbuild-std`
+
+error: cannot resolve a prelude import
+
+error: `#[panic_handler]` function required, but not found
+
+error: unwinding panics are not supported without std
+   |
+   = help: using nightly cargo, use -Zbuild-std with panic="abort" to avoid unwinding
+   = note: since the core library is usually precompiled with panic="unwind", rebuilding your crate with panic="abort" may not be enough to fix the problem
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/tests/ui/comptime/const_comptime.rs b/tests/ui/comptime/const_comptime.rs
new file mode 100644
index 0000000..827e4df
--- /dev/null
+++ b/tests/ui/comptime/const_comptime.rs
@@ -0,0 +1,7 @@
+#![feature(rustc_attrs)]
+
+#[rustc_comptime]
+const fn foo() {}
+//~^ ERROR a function cannot be both `comptime` and `const`
+
+fn main() {}
diff --git a/tests/ui/comptime/const_comptime.stderr b/tests/ui/comptime/const_comptime.stderr
new file mode 100644
index 0000000..8be8ee7
--- /dev/null
+++ b/tests/ui/comptime/const_comptime.stderr
@@ -0,0 +1,16 @@
+error: a function cannot be both `comptime` and `const`
+  --> $DIR/const_comptime.rs:4:1
+   |
+LL | #[rustc_comptime]
+   | ----------------- `comptime` because of this
+LL | const fn foo() {}
+   | ^^^^^ help: remove the `const`
+   |
+note: `const` implies the function can be called at runtime, too
+  --> $DIR/const_comptime.rs:4:1
+   |
+LL | const fn foo() {}
+   | ^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/comptime/feature-gate-test.rs b/tests/ui/comptime/feature-gate-test.rs
new file mode 100644
index 0000000..cd4ee52
--- /dev/null
+++ b/tests/ui/comptime/feature-gate-test.rs
@@ -0,0 +1,5 @@
+#[rustc_comptime]
+//~^ ERROR use of an internal attribute
+fn foo() {}
+
+fn main() {}
diff --git a/tests/ui/comptime/feature-gate-test.stderr b/tests/ui/comptime/feature-gate-test.stderr
new file mode 100644
index 0000000..0230a28
--- /dev/null
+++ b/tests/ui/comptime/feature-gate-test.stderr
@@ -0,0 +1,12 @@
+error[E0658]: use of an internal attribute
+  --> $DIR/feature-gate-test.rs:1:1
+   |
+LL | #[rustc_comptime]
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+   = note: the `#[rustc_comptime]` attribute is an internal implementation detail that will never be stable
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/comptime/not_callable.rs b/tests/ui/comptime/not_callable.rs
new file mode 100644
index 0000000..c06e643
--- /dev/null
+++ b/tests/ui/comptime/not_callable.rs
@@ -0,0 +1,22 @@
+#![feature(rustc_attrs, const_trait_impl)]
+
+#[rustc_comptime]
+fn foo() {}
+
+fn main() {
+    // Ok
+    const { foo() };
+    // Not Ok
+    foo(); //~ ERROR: comptime fns can only be called at compile time
+}
+
+const fn bar() {
+    // Not Ok
+    foo(); //~ ERROR: comptime fns can only be called at compile time
+}
+
+#[rustc_comptime]
+fn baz() {
+    // Ok
+    foo();
+}
diff --git a/tests/ui/comptime/not_callable.stderr b/tests/ui/comptime/not_callable.stderr
new file mode 100644
index 0000000..8a2c3fb
--- /dev/null
+++ b/tests/ui/comptime/not_callable.stderr
@@ -0,0 +1,14 @@
+error: comptime fns can only be called at compile time
+  --> $DIR/not_callable.rs:10:5
+   |
+LL |     foo();
+   |     ^^^^^
+
+error: comptime fns can only be called at compile time
+  --> $DIR/not_callable.rs:15:5
+   |
+LL |     foo();
+   |     ^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/comptime/trait_bounds.rs b/tests/ui/comptime/trait_bounds.rs
new file mode 100644
index 0000000..3df2f41
--- /dev/null
+++ b/tests/ui/comptime/trait_bounds.rs
@@ -0,0 +1,25 @@
+#![feature(rustc_attrs, const_trait_impl)]
+
+const trait Trait {
+    fn method() {}
+}
+
+#[rustc_comptime]
+fn always_const<T: const Trait>() {
+    T::method()
+}
+
+#[rustc_comptime]
+fn conditionally_const<T: [const] Trait>() {
+    //~^ ERROR: `[const]` is not allowed here
+    T::method()
+    //~^ ERROR: `T: const Trait` is not satisfied
+}
+
+#[rustc_comptime]
+fn non_const<T: Trait>() {
+    T::method()
+    //~^ ERROR: `T: const Trait` is not satisfied
+}
+
+fn main() {}
diff --git a/tests/ui/comptime/trait_bounds.stderr b/tests/ui/comptime/trait_bounds.stderr
new file mode 100644
index 0000000..c5a03af
--- /dev/null
+++ b/tests/ui/comptime/trait_bounds.stderr
@@ -0,0 +1,27 @@
+error: `[const]` is not allowed here
+  --> $DIR/trait_bounds.rs:13:27
+   |
+LL | fn conditionally_const<T: [const] Trait>() {
+   |                           ^^^^^^^
+   |
+note: this function is not `const`, so it cannot have `[const]` trait bounds
+  --> $DIR/trait_bounds.rs:13:4
+   |
+LL | fn conditionally_const<T: [const] Trait>() {
+   |    ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `T: const Trait` is not satisfied
+  --> $DIR/trait_bounds.rs:15:5
+   |
+LL |     T::method()
+   |     ^
+
+error[E0277]: the trait bound `T: const Trait` is not satisfied
+  --> $DIR/trait_bounds.rs:21:5
+   |
+LL |     T::method()
+   |     ^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/comptime/trait_comptime.rs b/tests/ui/comptime/trait_comptime.rs
new file mode 100644
index 0000000..a42e85c
--- /dev/null
+++ b/tests/ui/comptime/trait_comptime.rs
@@ -0,0 +1,26 @@
+#![feature(rustc_attrs)]
+
+trait Foo {
+    #[rustc_comptime]
+    //~^ ERROR: cannot be used on required trait methods
+    fn foo();
+
+    #[rustc_comptime]
+    //~^ ERROR: cannot be used on provided trait methods
+    fn bar() {}
+}
+
+struct Bar;
+
+impl Bar {
+    #[rustc_comptime]
+    fn foo() {}
+}
+
+impl Foo for Bar {
+    #[rustc_comptime]
+    //~^ ERROR: cannot be used on trait methods
+    fn foo() {}
+}
+
+fn main() {}
diff --git a/tests/ui/comptime/trait_comptime.stderr b/tests/ui/comptime/trait_comptime.stderr
new file mode 100644
index 0000000..06e9822
--- /dev/null
+++ b/tests/ui/comptime/trait_comptime.stderr
@@ -0,0 +1,26 @@
+error: `#[rustc_comptime]` attribute cannot be used on required trait methods
+  --> $DIR/trait_comptime.rs:4:5
+   |
+LL |     #[rustc_comptime]
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[rustc_comptime]` can only be applied to functions with a body
+
+error: `#[rustc_comptime]` attribute cannot be used on provided trait methods
+  --> $DIR/trait_comptime.rs:8:5
+   |
+LL |     #[rustc_comptime]
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[rustc_comptime]` can be applied to functions and inherent methods
+
+error: `#[rustc_comptime]` attribute cannot be used on trait methods in impl blocks
+  --> $DIR/trait_comptime.rs:21:5
+   |
+LL |     #[rustc_comptime]
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[rustc_comptime]` can be applied to functions and inherent methods
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/cross-crate/auxiliary/const-fn-evaluated-cross-crate.rs b/tests/ui/cross-crate/auxiliary/const-fn-evaluated-cross-crate.rs
new file mode 100644
index 0000000..9f09008
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/const-fn-evaluated-cross-crate.rs
@@ -0,0 +1,8 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/36954
+#![crate_type = "lib"]
+
+const fn foo(i: i32) -> i32 {
+    i
+}
+
+pub const FOO: i32 = foo(1);
diff --git a/tests/ui/issues/auxiliary/issue-3012-1.rs b/tests/ui/cross-crate/auxiliary/construct-extern-struct-with-destructor.rs
similarity index 69%
rename from tests/ui/issues/auxiliary/issue-3012-1.rs
rename to tests/ui/cross-crate/auxiliary/construct-extern-struct-with-destructor.rs
index 509af2a..e01835c 100644
--- a/tests/ui/issues/auxiliary/issue-3012-1.rs
+++ b/tests/ui/cross-crate/auxiliary/construct-extern-struct-with-destructor.rs
@@ -1,4 +1,5 @@
-#![crate_name="socketlib"]
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/3012
+#![crate_name="construct_extern_struct_with_destructor"]
 #![crate_type = "lib"]
 
 pub mod socket {
diff --git a/tests/ui/issues/auxiliary/issue-29265.rs b/tests/ui/cross-crate/auxiliary/cross-crate-static-reference-and-field-access.rs
similarity index 62%
rename from tests/ui/issues/auxiliary/issue-29265.rs
rename to tests/ui/cross-crate/auxiliary/cross-crate-static-reference-and-field-access.rs
index 6d26002..5c50ee0 100644
--- a/tests/ui/issues/auxiliary/issue-29265.rs
+++ b/tests/ui/cross-crate/auxiliary/cross-crate-static-reference-and-field-access.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/29265
 #![crate_type = "lib"]
 
 pub struct SomeType {
diff --git a/tests/ui/issues/auxiliary/issue-3979-traits.rs b/tests/ui/cross-crate/auxiliary/cross-crate-trait-inheritance-on-default-method.rs
similarity index 60%
rename from tests/ui/issues/auxiliary/issue-3979-traits.rs
rename to tests/ui/cross-crate/auxiliary/cross-crate-trait-inheritance-on-default-method.rs
index 5d03a0e..17796ae 100644
--- a/tests/ui/issues/auxiliary/issue-3979-traits.rs
+++ b/tests/ui/cross-crate/auxiliary/cross-crate-trait-inheritance-on-default-method.rs
@@ -1,4 +1,5 @@
-#![crate_name="issue_3979_traits"]
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/3979
+#![crate_name="cross_crate_trait_inheritance_on_default_method"]
 
 #![crate_type = "lib"]
 
diff --git a/tests/ui/issues/auxiliary/issue-2526.rs b/tests/ui/cross-crate/auxiliary/cross-crate-type-alias-with-nested-destructors.rs
similarity index 82%
rename from tests/ui/issues/auxiliary/issue-2526.rs
rename to tests/ui/cross-crate/auxiliary/cross-crate-type-alias-with-nested-destructors.rs
index 3b27f65..879f215 100644
--- a/tests/ui/issues/auxiliary/issue-2526.rs
+++ b/tests/ui/cross-crate/auxiliary/cross-crate-type-alias-with-nested-destructors.rs
@@ -1,4 +1,5 @@
-#![crate_name="issue_2526"]
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/2526
+#![crate_name="cross_crate_type_alias_with_nested_destructors"]
 #![crate_type = "lib"]
 
 use std::marker;
diff --git a/tests/ui/issues/auxiliary/issue-38226-aux.rs b/tests/ui/cross-crate/auxiliary/default-trait-method-reachable-through-trait-object.rs
similarity index 80%
rename from tests/ui/issues/auxiliary/issue-38226-aux.rs
rename to tests/ui/cross-crate/auxiliary/default-trait-method-reachable-through-trait-object.rs
index a8e964e..b14a140 100644
--- a/tests/ui/issues/auxiliary/issue-38226-aux.rs
+++ b/tests/ui/cross-crate/auxiliary/default-trait-method-reachable-through-trait-object.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/38226
 #![crate_type="rlib"]
 
 #[inline(never)]
diff --git a/tests/ui/cross-crate/auxiliary/extern-crate-and-impl-inside-method-body.rs b/tests/ui/cross-crate/auxiliary/extern-crate-and-impl-inside-method-body.rs
new file mode 100644
index 0000000..cd011fc
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/extern-crate-and-impl-inside-method-body.rs
@@ -0,0 +1,2 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/41053
+pub struct Test;
diff --git a/tests/ui/cross-crate/auxiliary/extern-generic-tuple-struct-construction.rs b/tests/ui/cross-crate/auxiliary/extern-generic-tuple-struct-construction.rs
new file mode 100644
index 0000000..1a27ca2
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/extern-generic-tuple-struct-construction.rs
@@ -0,0 +1,3 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/4545
+pub struct S<T>(Option<T>);
+pub fn mk<T>() -> S<T> { S(None) }
diff --git a/tests/ui/cross-crate/auxiliary/extern-repr-enum-with-discriminant-cast.rs b/tests/ui/cross-crate/auxiliary/extern-repr-enum-with-discriminant-cast.rs
new file mode 100644
index 0000000..8581900
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/extern-repr-enum-with-discriminant-cast.rs
@@ -0,0 +1,5 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/42007
+#[repr(u8)]
+pub enum E {
+    B = 1 as u8,
+}
diff --git a/tests/ui/cross-crate/auxiliary/extern-trait-bound-with-array-associated-type.rs b/tests/ui/cross-crate/auxiliary/extern-trait-bound-with-array-associated-type.rs
new file mode 100644
index 0000000..d383b9f
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/extern-trait-bound-with-array-associated-type.rs
@@ -0,0 +1,7 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/48984
+#![crate_type = "lib"]
+#![crate_name = "extern_trait_bound_with_array_associated_type"]
+
+pub trait Foo { type Item; }
+
+pub trait Bar: Foo<Item=[u8;1]> {  }
diff --git a/tests/ui/cross-crate/auxiliary/fn-declared-inside-closure-body-cross-crate.rs b/tests/ui/cross-crate/auxiliary/fn-declared-inside-closure-body-cross-crate.rs
new file mode 100644
index 0000000..6346ebf
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/fn-declared-inside-closure-body-cross-crate.rs
@@ -0,0 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/2723
+pub unsafe fn f(xs: Vec<isize> ) {
+    xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::<Vec<()>>();
+}
diff --git a/tests/ui/issues/auxiliary/issue-2380.rs b/tests/ui/cross-crate/auxiliary/fn-local-impl-returned-as-trait-object.rs
similarity index 71%
rename from tests/ui/issues/auxiliary/issue-2380.rs
rename to tests/ui/cross-crate/auxiliary/fn-local-impl-returned-as-trait-object.rs
index 9ec829b..4207925 100644
--- a/tests/ui/issues/auxiliary/issue-2380.rs
+++ b/tests/ui/cross-crate/auxiliary/fn-local-impl-returned-as-trait-object.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/2380
 #![crate_name="a"]
 #![crate_type = "lib"]
 
diff --git a/tests/ui/cross-crate/auxiliary/for-loop-in-match-on-self.rs b/tests/ui/cross-crate/auxiliary/for-loop-in-match-on-self.rs
index 307f23c..db1f5ed 100644
--- a/tests/ui/cross-crate/auxiliary/for-loop-in-match-on-self.rs
+++ b/tests/ui/cross-crate/auxiliary/for-loop-in-match-on-self.rs
@@ -1,5 +1,4 @@
-//! Auxiliary crate for <https://github.com/rust-lang/rust/issues/16643>.
-
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/16643
 #![crate_type = "lib"]
 
 pub struct TreeBuilder<H> { pub h: H }
diff --git a/tests/ui/cross-crate/auxiliary/generic-fn-with-supertrait-bound-cross-crate.rs b/tests/ui/cross-crate/auxiliary/generic-fn-with-supertrait-bound-cross-crate.rs
new file mode 100644
index 0000000..ad0fe92
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/generic-fn-with-supertrait-bound-cross-crate.rs
@@ -0,0 +1,11 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/4208
+#![crate_name="generic_fn_with_supertrait_bound_cross_crate"]
+#![crate_type = "lib"]
+
+pub trait Trig<T> {
+    fn sin(&self) -> T;
+}
+
+pub fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() }
+
+pub trait Angle<T>: Trig<T> {}
diff --git a/tests/ui/cross-crate/auxiliary/graceful-error-for-mistyped-assoc-const.rs b/tests/ui/cross-crate/auxiliary/graceful-error-for-mistyped-assoc-const.rs
new file mode 100644
index 0000000..84ac2b5
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/graceful-error-for-mistyped-assoc-const.rs
@@ -0,0 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/41549
+pub trait Trait {
+    const CONST: u32;
+}
diff --git a/tests/ui/cross-crate/auxiliary/impl-extern-trait-with-associated-type.rs b/tests/ui/cross-crate/auxiliary/impl-extern-trait-with-associated-type.rs
new file mode 100644
index 0000000..5d93538
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/impl-extern-trait-with-associated-type.rs
@@ -0,0 +1,5 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/20389
+pub trait T {
+    type C;
+    fn dummy(&self) { }
+}
diff --git a/tests/ui/cross-crate/auxiliary/imported-struct-not-confused-with-variant.rs b/tests/ui/cross-crate/auxiliary/imported-struct-not-confused-with-variant.rs
new file mode 100644
index 0000000..4f70e98
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/imported-struct-not-confused-with-variant.rs
@@ -0,0 +1,5 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/19293
+pub struct Foo (pub isize);
+pub enum MyEnum {
+    Foo(Foo),
+}
diff --git a/tests/ui/cross-crate/auxiliary/macro-generated-module-path-resolution.rs b/tests/ui/cross-crate/auxiliary/macro-generated-module-path-resolution.rs
new file mode 100644
index 0000000..f808fa7
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/macro-generated-module-path-resolution.rs
@@ -0,0 +1,3 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/38190
+#[macro_export]
+macro_rules! m { ([$i:item]) => {} }
diff --git a/tests/ui/cross-crate/auxiliary/method-call-on-extern-fn-return-value.rs b/tests/ui/cross-crate/auxiliary/method-call-on-extern-fn-return-value.rs
new file mode 100644
index 0000000..02f85ee
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/method-call-on-extern-fn-return-value.rs
@@ -0,0 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/51798
+#![crate_type = "lib"]
+
+pub fn vec() -> Vec<u8> { vec![] }
diff --git a/tests/ui/issues/auxiliary/issue-2631-a.rs b/tests/ui/cross-crate/auxiliary/monomorphize-index-op-cross-crate.rs
similarity index 81%
rename from tests/ui/issues/auxiliary/issue-2631-a.rs
rename to tests/ui/cross-crate/auxiliary/monomorphize-index-op-cross-crate.rs
index 1e8211b..6ab5380 100644
--- a/tests/ui/issues/auxiliary/issue-2631-a.rs
+++ b/tests/ui/cross-crate/auxiliary/monomorphize-index-op-cross-crate.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/2631
 #![crate_name="req"]
 #![crate_type = "lib"]
 
diff --git a/tests/ui/cross-crate/auxiliary/mut-ref-write-visible-after-unwind.rs b/tests/ui/cross-crate/auxiliary/mut-ref-write-visible-after-unwind.rs
new file mode 100644
index 0000000..2545f4f
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/mut-ref-write-visible-after-unwind.rs
@@ -0,0 +1,17 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/29265
+#![crate_name="mut_ref_write_visible_after_unwind"]
+#![crate_type = "lib"]
+
+pub struct X(pub u8);
+
+impl Drop for X {
+    fn drop(&mut self) {
+        assert_eq!(self.0, 1)
+    }
+}
+
+pub fn f(x: &mut X, g: fn()) {
+    x.0 = 1;
+    g();
+    x.0 = 0;
+}
diff --git a/tests/ui/issues/auxiliary/issue-3136-a.rs b/tests/ui/cross-crate/auxiliary/nested-struct-in-polymorphic-impl-method.rs
similarity index 75%
rename from tests/ui/issues/auxiliary/issue-3136-a.rs
rename to tests/ui/cross-crate/auxiliary/nested-struct-in-polymorphic-impl-method.rs
index 22bb1c8..24f7601 100644
--- a/tests/ui/issues/auxiliary/issue-3136-a.rs
+++ b/tests/ui/cross-crate/auxiliary/nested-struct-in-polymorphic-impl-method.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/3136
 #![crate_type = "lib"]
 
 trait x {
diff --git a/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test-a.rs b/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test-a.rs
new file mode 100644
index 0000000..2261880
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test-a.rs
@@ -0,0 +1,16 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/32518
+//@ no-prefer-dynamic
+//@ compile-flags: -Ccodegen-units=2 --crate-type=lib
+
+extern crate no_duplicate_symbols_with_codegen_units_cgu_test as cgu_test;
+
+pub mod a {
+    pub fn a() {
+        ::cgu_test::id(0);
+    }
+}
+pub mod b {
+    pub fn a() {
+        ::cgu_test::id(0);
+    }
+}
diff --git a/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test-b.rs b/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test-b.rs
new file mode 100644
index 0000000..2261880
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test-b.rs
@@ -0,0 +1,16 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/32518
+//@ no-prefer-dynamic
+//@ compile-flags: -Ccodegen-units=2 --crate-type=lib
+
+extern crate no_duplicate_symbols_with_codegen_units_cgu_test as cgu_test;
+
+pub mod a {
+    pub fn a() {
+        ::cgu_test::id(0);
+    }
+}
+pub mod b {
+    pub fn a() {
+        ::cgu_test::id(0);
+    }
+}
diff --git a/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test.rs b/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test.rs
new file mode 100644
index 0000000..73dd32b
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/no-duplicate-symbols-with-codegen-units-cgu-test.rs
@@ -0,0 +1,7 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/32518
+//@ no-prefer-dynamic
+//@ compile-flags: --crate-type=lib
+
+pub fn id<T>(t: T) -> T {
+  t
+}
diff --git a/tests/ui/issues/auxiliary/issue-31702-1.rs b/tests/ui/cross-crate/auxiliary/optimized-closure-with-debug-info-cross-crate-1.rs
similarity index 74%
rename from tests/ui/issues/auxiliary/issue-31702-1.rs
rename to tests/ui/cross-crate/auxiliary/optimized-closure-with-debug-info-cross-crate-1.rs
index a48d0dc..b14ce0b 100644
--- a/tests/ui/issues/auxiliary/issue-31702-1.rs
+++ b/tests/ui/cross-crate/auxiliary/optimized-closure-with-debug-info-cross-crate-1.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/31702
 #[derive(Copy)]
 pub struct U256(pub [u64; 4]);
 
diff --git a/tests/ui/issues/auxiliary/issue-31702-2.rs b/tests/ui/cross-crate/auxiliary/optimized-closure-with-debug-info-cross-crate-2.rs
similarity index 66%
rename from tests/ui/issues/auxiliary/issue-31702-2.rs
rename to tests/ui/cross-crate/auxiliary/optimized-closure-with-debug-info-cross-crate-2.rs
index 16300b0..05da5e2 100644
--- a/tests/ui/issues/auxiliary/issue-31702-2.rs
+++ b/tests/ui/cross-crate/auxiliary/optimized-closure-with-debug-info-cross-crate-2.rs
@@ -1,9 +1,10 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/31702
 //@ compile-flags: -g
 
-extern crate issue_31702_1;
+extern crate optimized_closure_with_debug_info_cross_crate_1;
 
 use std::collections::HashMap;
-use issue_31702_1::U256;
+use optimized_closure_with_debug_info_cross_crate_1::U256;
 
 pub struct Ethash {
     engine_params: fn() -> Option<&'static Vec<u8>>,
diff --git a/tests/ui/issues/auxiliary/issue-34796-aux.rs b/tests/ui/cross-crate/auxiliary/stable-hash-for-trait-object-type.rs
similarity index 75%
rename from tests/ui/issues/auxiliary/issue-34796-aux.rs
rename to tests/ui/cross-crate/auxiliary/stable-hash-for-trait-object-type.rs
index 0e91bb4..a3c278d 100644
--- a/tests/ui/issues/auxiliary/issue-34796-aux.rs
+++ b/tests/ui/cross-crate/auxiliary/stable-hash-for-trait-object-type.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate for regression test of https://github.com/rust-lang/rust/issues/34796
 #![crate_type = "lib"]
 pub trait Future {
     type Item;
diff --git a/tests/ui/issues/auxiliary/issue-25467.rs b/tests/ui/cross-crate/auxiliary/trait-object-projection-bounds-with-interning-order.rs
similarity index 75%
rename from tests/ui/issues/auxiliary/issue-25467.rs
rename to tests/ui/cross-crate/auxiliary/trait-object-projection-bounds-with-interning-order.rs
index 16c2869..eb58bb5 100644
--- a/tests/ui/issues/auxiliary/issue-25467.rs
+++ b/tests/ui/cross-crate/auxiliary/trait-object-projection-bounds-with-interning-order.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/25467
 #![crate_type="lib"]
 
 pub trait Trait {
diff --git a/tests/ui/issues/auxiliary/issue-2414-a.rs b/tests/ui/cross-crate/auxiliary/transitive-crate-dependency-with-trait-impl-a.rs
similarity index 61%
rename from tests/ui/issues/auxiliary/issue-2414-a.rs
rename to tests/ui/cross-crate/auxiliary/transitive-crate-dependency-with-trait-impl-a.rs
index b90ab32..58d7957 100644
--- a/tests/ui/issues/auxiliary/issue-2414-a.rs
+++ b/tests/ui/cross-crate/auxiliary/transitive-crate-dependency-with-trait-impl-a.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/2414
 #![crate_name="a"]
 #![crate_type = "lib"]
 
diff --git a/tests/ui/cross-crate/auxiliary/transitive-crate-dependency-with-trait-impl-b.rs b/tests/ui/cross-crate/auxiliary/transitive-crate-dependency-with-trait-impl-b.rs
new file mode 100644
index 0000000..eddb36b
--- /dev/null
+++ b/tests/ui/cross-crate/auxiliary/transitive-crate-dependency-with-trait-impl-b.rs
@@ -0,0 +1,5 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/2414
+#![crate_name="b"]
+#![crate_type = "lib"]
+
+extern crate a;
diff --git a/tests/ui/issues/auxiliary/issue-30123-aux.rs b/tests/ui/cross-crate/auxiliary/type-default-applied-in-cross-crate-method-lookup.rs
similarity index 84%
rename from tests/ui/issues/auxiliary/issue-30123-aux.rs
rename to tests/ui/cross-crate/auxiliary/type-default-applied-in-cross-crate-method-lookup.rs
index 07c743e..68b9f68 100644
--- a/tests/ui/issues/auxiliary/issue-30123-aux.rs
+++ b/tests/ui/cross-crate/auxiliary/type-default-applied-in-cross-crate-method-lookup.rs
@@ -1,3 +1,4 @@
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/30123
 use std::marker::PhantomData;
 
 pub struct Directed;
diff --git a/tests/ui/cross-crate/const-fn-evaluated-cross-crate.rs b/tests/ui/cross-crate/const-fn-evaluated-cross-crate.rs
new file mode 100644
index 0000000..cf0843f
--- /dev/null
+++ b/tests/ui/cross-crate/const-fn-evaluated-cross-crate.rs
@@ -0,0 +1,12 @@
+//@ run-pass
+//@ aux-build:const-fn-evaluated-cross-crate.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/36954
+//! Cross crate const fn evaluation failed because the compiler's
+//! internal argument lookup table used crate local ids that didn't
+//! exist when evaluating a const fn from another crate.
+
+extern crate const_fn_evaluated_cross_crate as lib;
+
+fn main() {
+    let _ = lib::FOO;
+}
diff --git a/tests/ui/cross-crate/construct-extern-struct-with-destructor.rs b/tests/ui/cross-crate/construct-extern-struct-with-destructor.rs
new file mode 100644
index 0000000..d916305
--- /dev/null
+++ b/tests/ui/cross-crate/construct-extern-struct-with-destructor.rs
@@ -0,0 +1,14 @@
+//@ run-pass
+//@ aux-build:construct-extern-struct-with-destructor.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/3012
+//! Guarantees that you can construct cross crate structs.
+
+extern crate construct_extern_struct_with_destructor as socketlib;
+
+use socketlib::socket;
+
+pub fn main() {
+    let fd: u32 = 1 as u32;
+    let _sock: Box<_> = Box::new(socket::socket_handle(fd));
+}
diff --git a/tests/ui/cross-crate/cross-crate-static-reference-and-field-access.rs b/tests/ui/cross-crate/cross-crate-static-reference-and-field-access.rs
new file mode 100644
index 0000000..25e52c1
--- /dev/null
+++ b/tests/ui/cross-crate/cross-crate-static-reference-and-field-access.rs
@@ -0,0 +1,14 @@
+//@ aux-build:cross-crate-static-reference-and-field-access.rs
+//@ check-pass
+
+//! Regression test for https://github.com/rust-lang/rust/issues/29265
+//! Exposed an bug where referencing a static variable from another crate
+//! was causing an error.
+
+extern crate cross_crate_static_reference_and_field_access as lib;
+
+static _UNUSED: &'static lib::SomeType = &lib::SOME_VALUE;
+
+fn main() {
+    vec![0u8; lib::SOME_VALUE.some_member];
+}
diff --git a/tests/ui/cross-crate/cross-crate-trait-inheritance-on-default-method.rs b/tests/ui/cross-crate/cross-crate-trait-inheritance-on-default-method.rs
new file mode 100644
index 0000000..3ff481d
--- /dev/null
+++ b/tests/ui/cross-crate/cross-crate-trait-inheritance-on-default-method.rs
@@ -0,0 +1,27 @@
+//@ run-pass
+#![allow(dead_code)]
+//@ aux-build:cross-crate-trait-inheritance-on-default-method.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/3979
+//! Exposed a bug where external traits on a default method were failing to typecheck.
+
+extern crate cross_crate_trait_inheritance_on_default_method as  issue_3979_traits;
+use issue_3979_traits::{Positioned, Movable};
+
+struct Point { x: isize, y: isize }
+
+impl Positioned for Point {
+    fn SetX(&mut self, x: isize) {
+        self.x = x;
+    }
+    fn X(&self) -> isize {
+        self.x
+    }
+}
+
+impl Movable for Point {}
+
+pub fn main() {
+    let mut p = Point{ x: 1, y: 2};
+    p.translate(3);
+    assert_eq!(p.X(), 4);
+}
diff --git a/tests/ui/cross-crate/cross-crate-type-alias-with-nested-destructors.rs b/tests/ui/cross-crate/cross-crate-type-alias-with-nested-destructors.rs
new file mode 100644
index 0000000..c12dc04
--- /dev/null
+++ b/tests/ui/cross-crate/cross-crate-type-alias-with-nested-destructors.rs
@@ -0,0 +1,11 @@
+//@ run-pass
+//@ aux-build:cross-crate-type-alias-with-nested-destructors.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/2526
+
+#![allow(unused_imports)]
+
+extern crate cross_crate_type_alias_with_nested_destructors;
+use cross_crate_type_alias_with_nested_destructors::*;
+
+pub fn main() {}
diff --git a/tests/ui/issues/issue-38226.rs b/tests/ui/cross-crate/default-trait-method-reachable-through-trait-object.rs
similarity index 71%
rename from tests/ui/issues/issue-38226.rs
rename to tests/ui/cross-crate/default-trait-method-reachable-through-trait-object.rs
index d8bd9d6..a768325 100644
--- a/tests/ui/issues/issue-38226.rs
+++ b/tests/ui/cross-crate/default-trait-method-reachable-through-trait-object.rs
@@ -2,13 +2,13 @@
 // This test makes sure that we don't run into a linker error because of the
 // middle::reachable pass missing trait methods with default impls.
 
-//@ aux-build:issue-38226-aux.rs
+//@ aux-build:default-trait-method-reachable-through-trait-object.rs
 
 // Need -Cno-prepopulate-passes to really disable inlining, otherwise the faulty
 // code gets optimized out:
 //@ compile-flags: -Cno-prepopulate-passes -Cpasses=name-anon-globals
 
-extern crate issue_38226_aux;
+extern crate default_trait_method_reachable_through_trait_object as issue_38226_aux;
 
 fn main() {
     issue_38226_aux::foo::<()>();
diff --git a/tests/ui/cross-crate/extern-crate-and-impl-inside-method-body.rs b/tests/ui/cross-crate/extern-crate-and-impl-inside-method-body.rs
new file mode 100644
index 0000000..15ce563
--- /dev/null
+++ b/tests/ui/cross-crate/extern-crate-and-impl-inside-method-body.rs
@@ -0,0 +1,28 @@
+//@ run-pass
+//@ aux-build:extern-crate-and-impl-inside-method-body.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/41053
+//! An extern crate declaration and trait impl referencing that crate
+//! inside an impl method body triggered a borrow conflict in the
+//! compiler's visible_parent_map.
+
+#![allow(non_local_definitions)]
+
+pub trait Trait { fn foo(&self) {} }
+
+pub struct Foo;
+
+impl Iterator for Foo {
+    type Item = Box<dyn Trait>;
+    fn next(&mut self) -> Option<Box<dyn Trait>> {
+        extern crate extern_crate_and_impl_inside_method_body as issue_41053;
+        impl crate::Trait for issue_41053::Test {
+            fn foo(&self) {}
+        }
+        Some(Box::new(issue_41053::Test))
+    }
+}
+
+fn main() {
+    Foo.next().unwrap().foo();
+}
diff --git a/tests/ui/cross-crate/extern-generic-tuple-struct-construction.rs b/tests/ui/cross-crate/extern-generic-tuple-struct-construction.rs
new file mode 100644
index 0000000..98d1fec
--- /dev/null
+++ b/tests/ui/cross-crate/extern-generic-tuple-struct-construction.rs
@@ -0,0 +1,6 @@
+//@ run-pass
+//@ aux-build:extern-generic-tuple-struct-construction.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/4545
+
+extern crate extern_generic_tuple_struct_construction as somelib;
+pub fn main() { somelib::mk::<isize>(); }
diff --git a/tests/ui/cross-crate/extern-repr-enum-with-discriminant-cast.rs b/tests/ui/cross-crate/extern-repr-enum-with-discriminant-cast.rs
new file mode 100644
index 0000000..96f345d
--- /dev/null
+++ b/tests/ui/cross-crate/extern-repr-enum-with-discriminant-cast.rs
@@ -0,0 +1,15 @@
+//@ run-pass
+#![allow(dead_code)]
+//@ aux-build:extern-repr-enum-with-discriminant-cast.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/42007
+//! This test exposes a bug that happens because the Session LintStore is emptied when linting
+//! The LintStore is emptied because the checker wants ownership as it wants to
+//! mutate the pass objects and lint levels.
+//! The fix was not taking ownership of the entire store just the lint levels and pass objects.
+extern crate extern_repr_enum_with_discriminant_cast as issue_42007_s;
+
+enum I {
+    E(issue_42007_s::E),
+}
+
+fn main() {}
diff --git a/tests/ui/cross-crate/extern-trait-bound-with-array-associated-type.rs b/tests/ui/cross-crate/extern-trait-bound-with-array-associated-type.rs
new file mode 100644
index 0000000..a0b5d0e
--- /dev/null
+++ b/tests/ui/cross-crate/extern-trait-bound-with-array-associated-type.rs
@@ -0,0 +1,15 @@
+//@ run-pass
+#![allow(dead_code)]
+//@ aux-build:extern-trait-bound-with-array-associated-type.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/48984
+//! This test exposes an error that occurs when a base trait has at
+//! least one associated type, and the extending trait specifies the
+//! associated type as an array of some kind. In order to trigger the
+//! error, the extending trait must be defined in an external crate, and
+//! used to constrain a generic type parameter.
+extern crate extern_trait_bound_with_array_associated_type as issue48984aux;
+use issue48984aux::Bar;
+
+fn do_thing<T: Bar>() { }
+
+fn main() { }
diff --git a/tests/ui/cross-crate/fn-declared-inside-closure-body-cross-crate.rs b/tests/ui/cross-crate/fn-declared-inside-closure-body-cross-crate.rs
new file mode 100644
index 0000000..9d47358
--- /dev/null
+++ b/tests/ui/cross-crate/fn-declared-inside-closure-body-cross-crate.rs
@@ -0,0 +1,13 @@
+//@ run-pass
+//@ aux-build:fn-declared-inside-closure-body-cross-crate.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/2723
+
+extern crate fn_declared_inside_closure_body_cross_crate;
+use fn_declared_inside_closure_body_cross_crate::f;
+
+pub fn main() {
+    unsafe {
+        f(vec![2]);
+    }
+}
diff --git a/tests/ui/cross-crate/fn-local-impl-returned-as-trait-object.rs b/tests/ui/cross-crate/fn-local-impl-returned-as-trait-object.rs
new file mode 100644
index 0000000..0fc4047
--- /dev/null
+++ b/tests/ui/cross-crate/fn-local-impl-returned-as-trait-object.rs
@@ -0,0 +1,12 @@
+//@ run-pass
+//@ aux-build:fn-local-impl-returned-as-trait-object.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/2380
+//! This test exposes a bug where a function that defines a trait impl inside its body
+//!  and returns it as a trait object failed  because the reachability pass skipped nested
+//! items in function bodies.
+
+extern crate a;
+
+pub fn main() {
+    a::f::<()>();
+}
diff --git a/tests/ui/cross-crate/generic-fn-with-supertrait-bound-cross-crate.rs b/tests/ui/cross-crate/generic-fn-with-supertrait-bound-cross-crate.rs
new file mode 100644
index 0000000..bce55b2
--- /dev/null
+++ b/tests/ui/cross-crate/generic-fn-with-supertrait-bound-cross-crate.rs
@@ -0,0 +1,11 @@
+//@ run-pass
+#![allow(dead_code)]
+//@ aux-build:generic-fn-with-supertrait-bound-cross-crate.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/4208
+extern crate generic_fn_with_supertrait_bound_cross_crate as numeric;
+use numeric::{sin, Angle};
+
+fn foo<T, A:Angle<T>>(theta: A) -> T { sin(&theta) }
+
+pub fn main() {}
diff --git a/tests/ui/cross-crate/graceful-error-for-mistyped-assoc-const.rs b/tests/ui/cross-crate/graceful-error-for-mistyped-assoc-const.rs
new file mode 100644
index 0000000..238fb6b
--- /dev/null
+++ b/tests/ui/cross-crate/graceful-error-for-mistyped-assoc-const.rs
@@ -0,0 +1,13 @@
+//@ aux-build:graceful-error-for-mistyped-assoc-const.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/41549
+//! Mismatched types on exernal associated constants used to ice,
+//! this test confirms that it errors correctly.
+extern crate graceful_error_for_mistyped_assoc_const as issue_41549;
+
+struct S;
+
+impl issue_41549::Trait for S {
+    const CONST: () = (); //~ ERROR incompatible type for trait
+}
+
+fn main() {}
diff --git a/tests/ui/issues/issue-41549.stderr b/tests/ui/cross-crate/graceful-error-for-mistyped-assoc-const.stderr
similarity index 81%
rename from tests/ui/issues/issue-41549.stderr
rename to tests/ui/cross-crate/graceful-error-for-mistyped-assoc-const.stderr
index 55be596..18b0646 100644
--- a/tests/ui/issues/issue-41549.stderr
+++ b/tests/ui/cross-crate/graceful-error-for-mistyped-assoc-const.stderr
@@ -1,5 +1,5 @@
 error[E0326]: implemented const `CONST` has an incompatible type for trait
-  --> $DIR/issue-41549.rs:9:18
+  --> $DIR/graceful-error-for-mistyped-assoc-const.rs:10:18
    |
 LL |     const CONST: () = ();
    |                  ^^ expected `u32`, found `()`
diff --git a/tests/ui/cross-crate/impl-extern-trait-with-associated-type.rs b/tests/ui/cross-crate/impl-extern-trait-with-associated-type.rs
new file mode 100644
index 0000000..c6905e9
--- /dev/null
+++ b/tests/ui/cross-crate/impl-extern-trait-with-associated-type.rs
@@ -0,0 +1,16 @@
+//@ run-pass
+#![allow(dead_code)]
+//@ aux-build:impl-extern-trait-with-associated-type.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/20389
+//! This test confirms that code implementing a trait with an associated type from an external crate
+//! runs.
+
+extern crate impl_extern_trait_with_associated_type;
+
+struct Foo;
+
+impl impl_extern_trait_with_associated_type::T for Foo {
+    type C = ();
+}
+
+fn main() {}
diff --git a/tests/ui/cross-crate/imported-struct-not-confused-with-variant.rs b/tests/ui/cross-crate/imported-struct-not-confused-with-variant.rs
new file mode 100644
index 0000000..458fc32
--- /dev/null
+++ b/tests/ui/cross-crate/imported-struct-not-confused-with-variant.rs
@@ -0,0 +1,12 @@
+//@ run-pass
+//@ aux-build:imported-struct-not-confused-with-variant.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/19293
+//! This test ensures that cross crate variants are properly namespaced under their enum or struct.
+
+extern crate imported_struct_not_confused_with_variant;
+use imported_struct_not_confused_with_variant::{Foo, MyEnum};
+
+fn main() {
+    MyEnum::Foo(Foo(5));
+}
diff --git a/tests/ui/cross-crate/macro-generated-module-path-resolution.rs b/tests/ui/cross-crate/macro-generated-module-path-resolution.rs
new file mode 100644
index 0000000..f785c24
--- /dev/null
+++ b/tests/ui/cross-crate/macro-generated-module-path-resolution.rs
@@ -0,0 +1,18 @@
+//@ run-pass
+//@ aux-build:macro-generated-module-path-resolution.rs
+//! Regression test for https://github.com/rust-lang/rust/issues/38190
+//! Non inline modules parsed as macro item fragments used the wrong
+//! directory for file resolution, because the fragment parser didn't
+//! inherit the correct directory from the macro invocation context.
+
+#[macro_use]
+extern crate macro_generated_module_path_resolution as aux;
+
+mod auxiliary {
+    m!([
+        #[path = "macro-generated-module-path-resolution"]
+        mod aux;
+    ]);
+}
+
+fn main() {}
diff --git a/tests/ui/cross-crate/method-call-on-extern-fn-return-value.rs b/tests/ui/cross-crate/method-call-on-extern-fn-return-value.rs
new file mode 100644
index 0000000..26a24ae
--- /dev/null
+++ b/tests/ui/cross-crate/method-call-on-extern-fn-return-value.rs
@@ -0,0 +1,18 @@
+//@ edition:2018
+//@ aux-build:method-call-on-extern-fn-return-value.rs
+//@ check-pass
+//! Regression test for https://github.com/rust-lang/rust/issues/51798
+//! Calling a method on a value returned from an external crate function
+//! caused the privacy checker to panic when looking up the method's
+//! type dependent definition. Requires 2018 edition.
+
+extern crate method_call_on_extern_fn_return_value as issue_51798;
+
+mod server {
+    fn f() {
+        let mut v = issue_51798::vec();
+        v.clear();
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/issues/issue-2631-b.rs b/tests/ui/cross-crate/monomorphize-index-op-cross-crate.rs
similarity index 71%
rename from tests/ui/issues/issue-2631-b.rs
rename to tests/ui/cross-crate/monomorphize-index-op-cross-crate.rs
index fb2ecd7..b915bbe 100644
--- a/tests/ui/issues/issue-2631-b.rs
+++ b/tests/ui/cross-crate/monomorphize-index-op-cross-crate.rs
@@ -1,6 +1,8 @@
 //@ run-pass
 
-//@ aux-build:issue-2631-a.rs
+//@ aux-build:monomorphize-index-op-cross-crate.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/2631
 
 extern crate req;
 
diff --git a/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs b/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs
new file mode 100644
index 0000000..2e30732
--- /dev/null
+++ b/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs
@@ -0,0 +1,19 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/29485
+//! Exposed an LLVM bug that caused rustc to panic.
+//@ run-pass
+//@ aux-build:mut-ref-write-visible-after-unwind.rs
+//@ needs-unwind
+//@ needs-threads
+//@ ignore-backends: gcc
+
+extern crate mut_ref_write_visible_after_unwind as lib;
+
+fn main() {
+    let _ = std::thread::spawn(move || {
+        lib::f(&mut lib::X(0), g);
+    }).join();
+}
+
+fn g() {
+    panic!();
+}
diff --git a/tests/ui/cross-crate/nested-struct-in-polymorphic-impl-method.rs b/tests/ui/cross-crate/nested-struct-in-polymorphic-impl-method.rs
new file mode 100644
index 0000000..12d09cd
--- /dev/null
+++ b/tests/ui/cross-crate/nested-struct-in-polymorphic-impl-method.rs
@@ -0,0 +1,8 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/3136
+//@ run-pass
+//@ aux-build:nested-struct-in-polymorphic-impl-method.rs
+
+
+extern crate nested_struct_in_polymorphic_impl_method;
+
+pub fn main() {}
diff --git a/tests/ui/cross-crate/no-duplicate-symbols-with-codegen-units.rs b/tests/ui/cross-crate/no-duplicate-symbols-with-codegen-units.rs
new file mode 100644
index 0000000..f54c89a
--- /dev/null
+++ b/tests/ui/cross-crate/no-duplicate-symbols-with-codegen-units.rs
@@ -0,0 +1,14 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/32518
+//@ run-pass
+//@ no-prefer-dynamic
+//@ aux-build:no-duplicate-symbols-with-codegen-units-cgu-test.rs
+//@ aux-build:no-duplicate-symbols-with-codegen-units-cgu-test-a.rs
+//@ aux-build:no-duplicate-symbols-with-codegen-units-cgu-test-b.rs
+
+extern crate no_duplicate_symbols_with_codegen_units_cgu_test_a as cgu_test_a;
+extern crate no_duplicate_symbols_with_codegen_units_cgu_test_b as cgu_test_b;
+
+fn main() {
+    cgu_test_a::a::a();
+    cgu_test_b::a::a();
+}
diff --git a/tests/ui/cross-crate/optimized-closure-with-debug-info-cross-crate.rs b/tests/ui/cross-crate/optimized-closure-with-debug-info-cross-crate.rs
new file mode 100644
index 0000000..f0b34bd
--- /dev/null
+++ b/tests/ui/cross-crate/optimized-closure-with-debug-info-cross-crate.rs
@@ -0,0 +1,11 @@
+//@ run-pass
+//@ aux-build:optimized-closure-with-debug-info-cross-crate-1.rs
+//@ aux-build:optimized-closure-with-debug-info-cross-crate-2.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/31702
+// this test is actually entirely in the linked library crates
+
+extern crate optimized_closure_with_debug_info_cross_crate_1;
+extern crate optimized_closure_with_debug_info_cross_crate_2;
+
+fn main() {}
diff --git a/tests/ui/issues/issue-34796.rs b/tests/ui/cross-crate/stable-hash-for-trait-object-type.rs
similarity index 79%
rename from tests/ui/issues/issue-34796.rs
rename to tests/ui/cross-crate/stable-hash-for-trait-object-type.rs
index 1a417b3..725469e 100644
--- a/tests/ui/issues/issue-34796.rs
+++ b/tests/ui/cross-crate/stable-hash-for-trait-object-type.rs
@@ -1,5 +1,6 @@
 //@ run-pass
 #![allow(dead_code)]
+// Regression test for https://github.com/rust-lang/rust/issues/34796
 // This test case exposes conditions where the encoding of a trait object type
 // with projection predicates would differ between this crate and the upstream
 // crate, because the predicates were encoded in different order within each
@@ -8,8 +9,8 @@
 // the symbol name.
 // The fix was to make the order in which predicates get encoded stable.
 
-//@ aux-build:issue-34796-aux.rs
-extern crate issue_34796_aux;
+//@ aux-build:stable-hash-for-trait-object-type.rs
+extern crate stable_hash_for_trait_object_type as issue_34796_aux;
 
 fn mk<T>() -> T { loop {} }
 
diff --git a/tests/ui/cross-crate/trait-object-projection-bounds-with-interning-order.rs b/tests/ui/cross-crate/trait-object-projection-bounds-with-interning-order.rs
new file mode 100644
index 0000000..44aff69
--- /dev/null
+++ b/tests/ui/cross-crate/trait-object-projection-bounds-with-interning-order.rs
@@ -0,0 +1,14 @@
+//@ run-pass
+#![allow(unused_variables)]
+//@ aux-build:trait-object-projection-bounds-with-interning-order.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/25467
+
+pub type Issue25467BarT = ();
+pub type Issue25467FooT = ();
+
+extern crate trait_object_projection_bounds_with_interning_order as aux;
+
+fn main() {
+    let o: aux::Object = None;
+}
diff --git a/tests/ui/cross-crate/transitive-crate-dependency-with-trait-impl.rs b/tests/ui/cross-crate/transitive-crate-dependency-with-trait-impl.rs
new file mode 100644
index 0000000..8d3b15c
--- /dev/null
+++ b/tests/ui/cross-crate/transitive-crate-dependency-with-trait-impl.rs
@@ -0,0 +1,9 @@
+//@ run-pass
+//@ aux-build:transitive-crate-dependency-with-trait-impl-a.rs
+//@ aux-build:transitive-crate-dependency-with-trait-impl-b.rs
+
+//! Regression test for https://github.com/rust-lang/rust/issues/2414
+
+extern crate b;
+
+pub fn main() {}
diff --git a/tests/ui/cross-crate/type-default-applied-in-cross-crate-method-lookup.rs b/tests/ui/cross-crate/type-default-applied-in-cross-crate-method-lookup.rs
new file mode 100644
index 0000000..b0b6f05
--- /dev/null
+++ b/tests/ui/cross-crate/type-default-applied-in-cross-crate-method-lookup.rs
@@ -0,0 +1,10 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/30123
+//@ aux-build:type-default-applied-in-cross-crate-method-lookup.rs
+
+extern crate type_default_applied_in_cross_crate_method_lookup;
+use type_default_applied_in_cross_crate_method_lookup::*;
+
+fn main() {
+    let ug = Graph::<i32, i32>::new_undirected();
+    //~^ ERROR no associated function or constant named `new_undirected` found
+}
diff --git a/tests/ui/cross-crate/type-default-applied-in-cross-crate-method-lookup.stderr b/tests/ui/cross-crate/type-default-applied-in-cross-crate-method-lookup.stderr
new file mode 100644
index 0000000..c5c5f20
--- /dev/null
+++ b/tests/ui/cross-crate/type-default-applied-in-cross-crate-method-lookup.stderr
@@ -0,0 +1,16 @@
+error[E0599]: no associated function or constant named `new_undirected` found for struct `type_default_applied_in_cross_crate_method_lookup::Graph<i32, i32>` in the current scope
+  --> $DIR/type-default-applied-in-cross-crate-method-lookup.rs:8:33
+   |
+LL |     let ug = Graph::<i32, i32>::new_undirected();
+   |                                 ^^^^^^^^^^^^^^ associated function or constant not found in `type_default_applied_in_cross_crate_method_lookup::Graph<i32, i32>`
+   |
+note: if you're trying to build a new `type_default_applied_in_cross_crate_method_lookup::Graph<i32, i32>`, consider using `type_default_applied_in_cross_crate_method_lookup::Graph::<N, E>::new` which returns `type_default_applied_in_cross_crate_method_lookup::Graph<_, _>`
+  --> $DIR/auxiliary/type-default-applied-in-cross-crate-method-lookup.rs:15:5
+   |
+LL |     pub fn new() -> Self {
+   |     ^^^^^^^^^^^^^^^^^^^^
+   = note: the associated function or constant was found for `type_default_applied_in_cross_crate_method_lookup::Graph<N, E, Undirected>`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/delegation/delegation-first-arg.rs b/tests/ui/delegation/delegation-first-arg.rs
new file mode 100644
index 0000000..0721e6e
--- /dev/null
+++ b/tests/ui/delegation/delegation-first-arg.rs
@@ -0,0 +1,86 @@
+#![feature(fn_delegation)]
+
+trait Trait: Sized {
+    fn value(self) {}
+    fn r#ref(&self) {}
+    fn mut_ref(&mut self) {}
+
+    fn static_empty() {}
+    fn static_one_param(x: usize) {}
+}
+
+struct S;
+impl Trait for S {}
+
+struct F(S);
+// In glob delegations silently remove first arg if no params or generate default
+// first arg (`arg0`) if it is a static function.
+reuse impl Trait for F { self.0 }
+//~^ ERROR: type annotations needed
+//~| ERROR: type annotations needed
+
+struct F1(S);
+impl F1 {
+    reuse Trait::{value, r#ref, mut_ref} { self.0 }
+
+    // Error is reported as user has explicitly specified block when no params.
+    reuse <S as Trait>::static_empty { self.0 }
+    //~^ ERROR: delegation's target expression is specified for function with no params
+    //~| ERROR: this function takes 0 arguments but 1 argument was supplied
+
+    reuse <S as Trait>::static_one_param { self.0 }
+    //~^ ERROR: `usize` is a primitive type and therefore doesn't have fields
+}
+
+struct F2(S);
+impl F2 {
+    // In list delegations silently remove first arg if it is not a method.
+    reuse <S as Trait>::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+}
+
+mod trait_to_reuse {
+    use super::Trait;
+
+    pub fn value(_: impl Trait) {}
+    pub fn r#ref(_: &impl Trait) {}
+    pub fn mut_ref(_: &mut impl Trait) {}
+
+    pub fn static_empty() {}
+    pub fn static_one_param(x: usize) {}
+}
+
+struct F3(S);
+impl Trait for F3 {
+    reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+    //~^ ERROR: mismatched types
+    //~| ERROR: mismatched types
+}
+
+struct F4(S);
+impl F4 {
+    reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+    //~^ ERROR: no field `0` on type `impl Trait`
+    //~| ERROR: no field `0` on type `&impl Trait`
+    //~| ERROR: no field `0` on type `&mut impl Trait`
+    //~| ERROR: `usize` is a primitive type and therefore doesn't have fields
+    //~| ERROR: this function takes 0 arguments but 1 argument was supplied
+    //~| ERROR: delegation's target expression is specified for function with no params
+}
+
+mod to_reuse {
+    pub fn empty() {}
+    pub fn one_param(x: usize) {}
+}
+
+// Error is reported as user has explicitly specified block when no params.
+reuse to_reuse::empty { self + 1 }
+//~^ ERROR: delegation's target expression is specified for function with no params
+//~| ERROR: this function takes 0 arguments but 1 argument was supplied
+
+reuse to_reuse::one_param { self + 1 }
+
+reuse to_reuse::{empty as empty1, one_param as one_param1} { self + 1 }
+//~^ ERROR: this function takes 0 arguments but 1 argument was supplied
+//~| ERROR: delegation's target expression is specified for function with no params
+
+fn main() {}
diff --git a/tests/ui/delegation/delegation-first-arg.stderr b/tests/ui/delegation/delegation-first-arg.stderr
new file mode 100644
index 0000000..da1cf2f
--- /dev/null
+++ b/tests/ui/delegation/delegation-first-arg.stderr
@@ -0,0 +1,203 @@
+error: delegation's target expression is specified for function with no params
+  --> $DIR/delegation-first-arg.rs:27:38
+   |
+LL |     reuse <S as Trait>::static_empty { self.0 }
+   |                                      ^^^^^^^^^^
+
+error: delegation's target expression is specified for function with no params
+  --> $DIR/delegation-first-arg.rs:61:83
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+   |                                                                                   ^^^^^^^^^^
+
+error: delegation's target expression is specified for function with no params
+  --> $DIR/delegation-first-arg.rs:76:23
+   |
+LL | reuse to_reuse::empty { self + 1 }
+   |                       ^^^^^^^^^^^^
+
+error: delegation's target expression is specified for function with no params
+  --> $DIR/delegation-first-arg.rs:82:60
+   |
+LL | reuse to_reuse::{empty as empty1, one_param as one_param1} { self + 1 }
+   |                                                            ^^^^^^^^^^^^
+
+error[E0283]: type annotations needed
+  --> $DIR/delegation-first-arg.rs:18:1
+   |
+LL | reuse impl Trait for F { self.0 }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+   |
+   = note: the type must implement `Trait`
+help: the following types implement trait `Trait`
+  --> $DIR/delegation-first-arg.rs:13:1
+   |
+LL | impl Trait for S {}
+   | ^^^^^^^^^^^^^^^^ `S`
+...
+LL | reuse impl Trait for F { self.0 }
+   | ^^^^^^^^^^^^^^^^^^^^^^ `F`
+...
+LL | impl Trait for F3 {
+   | ^^^^^^^^^^^^^^^^^ `F3`
+
+error[E0283]: type annotations needed
+  --> $DIR/delegation-first-arg.rs:18:1
+   |
+LL | reuse impl Trait for F { self.0 }
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+   |
+   = note: the type must implement `Trait`
+help: the following types implement trait `Trait`
+  --> $DIR/delegation-first-arg.rs:13:1
+   |
+LL | impl Trait for S {}
+   | ^^^^^^^^^^^^^^^^ `S`
+...
+LL | reuse impl Trait for F { self.0 }
+   | ^^^^^^^^^^^^^^^^^^^^^^ `F`
+...
+LL | impl Trait for F3 {
+   | ^^^^^^^^^^^^^^^^^ `F3`
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/delegation-first-arg.rs:27:25
+   |
+LL |     reuse <S as Trait>::static_empty { self.0 }
+   |                         ^^^^^^^^^^^^ ---------- unexpected argument
+   |
+note: associated function defined here
+  --> $DIR/delegation-first-arg.rs:8:8
+   |
+LL |     fn static_empty() {}
+   |        ^^^^^^^^^^^^
+help: remove the extra argument
+   |
+LL -     reuse <S as Trait>::static_empty { self.0 }
+LL +     reuse <S as Trait>::static_empt{ self.0 }
+   |
+
+error[E0610]: `usize` is a primitive type and therefore doesn't have fields
+  --> $DIR/delegation-first-arg.rs:31:49
+   |
+LL |     reuse <S as Trait>::static_one_param { self.0 }
+   |                                                 ^
+
+error[E0308]: mismatched types
+  --> $DIR/delegation-first-arg.rs:54:85
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+   |                                   ----- arguments to this function are incorrect    ^^^^^^ expected `&_`, found `S`
+   |
+   = note: expected reference `&_`
+                 found struct `S`
+note: function defined here
+  --> $DIR/delegation-first-arg.rs:45:12
+   |
+LL |     pub fn r#ref(_: &impl Trait) {}
+   |            ^^^^^ --------------
+help: consider borrowing here
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { &self.0 }
+   |                                                                                     +
+
+error[E0308]: mismatched types
+  --> $DIR/delegation-first-arg.rs:54:85
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+   |                                          -------                                    ^^^^^^ expected `&mut _`, found `S`
+   |                                          |
+   |                                          arguments to this function are incorrect
+   |
+   = note: expected mutable reference `&mut _`
+                         found struct `S`
+note: function defined here
+  --> $DIR/delegation-first-arg.rs:46:12
+   |
+LL |     pub fn mut_ref(_: &mut impl Trait) {}
+   |            ^^^^^^^ ------------------
+help: consider mutably borrowing here
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { &mut self.0 }
+   |                                                                                     ++++
+
+error[E0609]: no field `0` on type `impl Trait`
+  --> $DIR/delegation-first-arg.rs:61:90
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+   |                                                                                          ^ unknown field
+
+error[E0609]: no field `0` on type `&impl Trait`
+  --> $DIR/delegation-first-arg.rs:61:90
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+   |                                                                                          ^ unknown field
+
+error[E0609]: no field `0` on type `&mut impl Trait`
+  --> $DIR/delegation-first-arg.rs:61:90
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+   |                                                                                          ^ unknown field
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/delegation-first-arg.rs:61:51
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+   |                                                   ^^^^^^^^^^^^                    ---------- unexpected argument
+   |
+note: function defined here
+  --> $DIR/delegation-first-arg.rs:48:12
+   |
+LL |     pub fn static_empty() {}
+   |            ^^^^^^^^^^^^
+help: remove the extra argument
+   |
+LL -     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+LL +     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empt{ self.0 }
+   |
+
+error[E0610]: `usize` is a primitive type and therefore doesn't have fields
+  --> $DIR/delegation-first-arg.rs:61:90
+   |
+LL |     reuse trait_to_reuse::{value, r#ref, mut_ref, static_empty, static_one_param} { self.0 }
+   |                                                                                          ^
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/delegation-first-arg.rs:76:17
+   |
+LL | reuse to_reuse::empty { self + 1 }
+   |                 ^^^^^ ------------ unexpected argument
+   |
+note: function defined here
+  --> $DIR/delegation-first-arg.rs:71:12
+   |
+LL |     pub fn empty() {}
+   |            ^^^^^
+help: remove the extra argument
+   |
+LL - reuse to_reuse::empty { self + 1 }
+LL + reuse to_reuse::empt{ self + 1 }
+   |
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/delegation-first-arg.rs:82:18
+   |
+LL | reuse to_reuse::{empty as empty1, one_param as one_param1} { self + 1 }
+   |                  ^^^^^                                     ------------ unexpected argument
+   |
+note: function defined here
+  --> $DIR/delegation-first-arg.rs:71:12
+   |
+LL |     pub fn empty() {}
+   |            ^^^^^
+help: remove the extra argument
+   |
+LL - reuse to_reuse::{empty as empty1, one_param as one_param1} { self + 1 }
+LL + reuse to_reuse::{empt{ self + 1 }
+   |
+
+error: aborting due to 17 previous errors
+
+Some errors have detailed explanations: E0061, E0283, E0308, E0609, E0610.
+For more information about an error, try `rustc --explain E0061`.
diff --git a/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155128.stderr b/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155128.stderr
index 833b086..80ecb2e 100644
--- a/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155128.stderr
+++ b/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155128.stderr
@@ -1,8 +1,20 @@
+error: delegation's target expression is specified for function with no params
+  --> $DIR/hir-crate-items-before-lowering-ices.rs:36:18
+   |
+LL |       reuse a as b {
+   |  __________________^
+LL | |
+LL | |         fn foo<T>() {};
+LL | |         foo
+LL | |     }
+   | |_____^
+
 error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/hir-crate-items-before-lowering-ices.rs:36:11
    |
 LL |       reuse a as b {
    |  ___________^______-
+LL | |
 LL | |         fn foo<T>() {};
 LL | |         foo
 LL | |     }
@@ -19,6 +31,6 @@
 LL +     reuse {
    |
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155164.stderr b/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155164.stderr
index 8590881..34d1a92 100644
--- a/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155164.stderr
+++ b/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155164.stderr
@@ -1,5 +1,5 @@
 error: complex const arguments must be placed inside of a `const` block
-  --> $DIR/hir-crate-items-before-lowering-ices.rs:46:13
+  --> $DIR/hir-crate-items-before-lowering-ices.rs:47:13
    |
 LL | /             {
 LL | |
diff --git a/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155202.stderr b/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155202.stderr
index abe70cb..28f045c 100644
--- a/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155202.stderr
+++ b/tests/ui/delegation/hir-crate-items-before-lowering-ices.ice_155202.stderr
@@ -1,11 +1,11 @@
 error[E0425]: cannot find value `async` in this scope
-  --> $DIR/hir-crate-items-before-lowering-ices.rs:65:13
+  --> $DIR/hir-crate-items-before-lowering-ices.rs:66:13
    |
 LL |             async || {};
    |             ^^^^^ not found in this scope
 
 error[E0308]: mismatched types
-  --> $DIR/hir-crate-items-before-lowering-ices.rs:65:22
+  --> $DIR/hir-crate-items-before-lowering-ices.rs:66:22
    |
 LL |             async || {};
    |                      ^^ expected `bool`, found `()`
diff --git a/tests/ui/delegation/hir-crate-items-before-lowering-ices.rs b/tests/ui/delegation/hir-crate-items-before-lowering-ices.rs
index c223d5d..b9a7a73 100644
--- a/tests/ui/delegation/hir-crate-items-before-lowering-ices.rs
+++ b/tests/ui/delegation/hir-crate-items-before-lowering-ices.rs
@@ -33,7 +33,8 @@ impl S {
 mod ice_155128 {
     fn a() {}
 
-    reuse a as b { //[ice_155128]~ ERROR: this function takes 0 arguments but 1 argument was supplied
+    reuse a as b { //[ice_155128]~ ERROR: delegation's target expression is specified for function with no params
+        //[ice_155128]~^ ERROR: this function takes 0 arguments but 1 argument was supplied
         fn foo<T>() {};
         foo
     }
diff --git a/tests/ui/delegation/inner-attr.rs b/tests/ui/delegation/inner-attr.rs
index 6bd2892..03e9b86 100644
--- a/tests/ui/delegation/inner-attr.rs
+++ b/tests/ui/delegation/inner-attr.rs
@@ -3,6 +3,7 @@
 fn a() {}
 
 reuse a as b { #![rustc_dummy] self } //~ ERROR an inner attribute is not permitted in this context
-//~^ ERROR: this function takes 0 arguments but 1 argument was supplied
+//~^ ERROR: delegation's target expression is specified for function with no params
+//~| ERROR: this function takes 0 arguments but 1 argument was supplied
 
 fn main() {}
diff --git a/tests/ui/delegation/inner-attr.stderr b/tests/ui/delegation/inner-attr.stderr
index 9f4b668..95fd5a1 100644
--- a/tests/ui/delegation/inner-attr.stderr
+++ b/tests/ui/delegation/inner-attr.stderr
@@ -9,6 +9,12 @@
    |
    = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
 
+error: delegation's target expression is specified for function with no params
+  --> $DIR/inner-attr.rs:5:14
+   |
+LL | reuse a as b { #![rustc_dummy] self }
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^
+
 error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/inner-attr.rs:5:7
    |
@@ -26,6 +32,6 @@
 LL + reuse { #![rustc_dummy] self }
    |
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/delegation/self-coercion-static-free.rs b/tests/ui/delegation/self-coercion-static-free.rs
index f61d424..2aeb5bd 100644
--- a/tests/ui/delegation/self-coercion-static-free.rs
+++ b/tests/ui/delegation/self-coercion-static-free.rs
@@ -20,10 +20,11 @@ impl Trait for F {}
 
 impl Trait for S {
     reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
-        let _ = self;
-        S::static_self()
         //~^ ERROR: mismatched types
         //~| ERROR: mismatched types
+        //~| ERROR: mismatched types
+        let _ = self;
+        S::static_self()
     }
 }
 
@@ -31,10 +32,11 @@ impl Trait for S {
 
 impl Trait for S1 {
     reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
-        let _ = self;
-        S1::static_self()
         //~^ ERROR: mismatched types
         //~| ERROR: mismatched types
+        //~| ERROR: mismatched types
+        let _ = self;
+        S1::static_self()
     }
 }
 
diff --git a/tests/ui/delegation/self-coercion-static-free.stderr b/tests/ui/delegation/self-coercion-static-free.stderr
index d77dcb1..b61ec58 100644
--- a/tests/ui/delegation/self-coercion-static-free.stderr
+++ b/tests/ui/delegation/self-coercion-static-free.stderr
@@ -1,81 +1,103 @@
 error[E0308]: mismatched types
-  --> $DIR/self-coercion-static-free.rs:24:9
+  --> $DIR/self-coercion-static-free.rs:22:26
    |
 LL |     reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
-   |                                        -------------- arguments to this function are incorrect
-LL |         let _ = self;
-LL |         S::static_self()
-   |         ^^^^^^^^^^^^^^^^ expected `&mut F`, found `F`
+   |                          ^^^^^^^^^^^^
+   |                          |
+   |                          expected `F`, found `S`
+   |                          arguments to this function are incorrect
    |
 note: associated function defined here
+  --> $DIR/self-coercion-static-free.rs:10:8
+   |
+LL |     fn static_value(_: Self) -> i32 { 1 }
+   |        ^^^^^^^^^^^^ -------
+
+error[E0308]: mismatched types
+  --> $DIR/self-coercion-static-free.rs:22:40
+   |
+LL |     reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
+   |                                        ^^^^^^^^^^^^^^
+   |                                        |
+   |                                        expected `&mut F`, found `&mut S`
+   |                                        arguments to this function are incorrect
+   |
+   = note: expected mutable reference `&mut F`
+              found mutable reference `&mut S`
+note: associated function defined here
   --> $DIR/self-coercion-static-free.rs:11:8
    |
 LL |     fn static_mut_ref(_: &mut Self) -> i32 { 2 }
    |        ^^^^^^^^^^^^^^ ------------
-help: consider mutably borrowing here
-   |
-LL |         &mut S::static_self()
-   |         ++++
 
 error[E0308]: mismatched types
-  --> $DIR/self-coercion-static-free.rs:24:9
+  --> $DIR/self-coercion-static-free.rs:22:56
    |
 LL |     reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
-   |                                                        ---------- arguments to this function are incorrect
-LL |         let _ = self;
-LL |         S::static_self()
-   |         ^^^^^^^^^^^^^^^^ expected `&F`, found `F`
+   |                                                        ^^^^^^^^^^
+   |                                                        |
+   |                                                        expected `&F`, found `&S`
+   |                                                        arguments to this function are incorrect
    |
+   = note: expected reference `&F`
+              found reference `&S`
 note: associated function defined here
   --> $DIR/self-coercion-static-free.rs:12:8
    |
 LL |     fn static_ref(_: &Self) -> i32 { 3 }
    |        ^^^^^^^^^^ --------
-help: consider borrowing here
-   |
-LL |         &S::static_self()
-   |         +
 
 error[E0308]: mismatched types
-  --> $DIR/self-coercion-static-free.rs:35:9
+  --> $DIR/self-coercion-static-free.rs:34:26
    |
 LL |     reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
-   |                                        -------------- arguments to this function are incorrect
-LL |         let _ = self;
-LL |         S1::static_self()
-   |         ^^^^^^^^^^^^^^^^^ expected `&mut F`, found `F`
+   |                          ^^^^^^^^^^^^
+   |                          |
+   |                          expected `F`, found `S1`
+   |                          arguments to this function are incorrect
    |
 note: associated function defined here
+  --> $DIR/self-coercion-static-free.rs:10:8
+   |
+LL |     fn static_value(_: Self) -> i32 { 1 }
+   |        ^^^^^^^^^^^^ -------
+
+error[E0308]: mismatched types
+  --> $DIR/self-coercion-static-free.rs:34:40
+   |
+LL |     reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
+   |                                        ^^^^^^^^^^^^^^
+   |                                        |
+   |                                        expected `&mut F`, found `&mut S1`
+   |                                        arguments to this function are incorrect
+   |
+   = note: expected mutable reference `&mut F`
+              found mutable reference `&mut S1`
+note: associated function defined here
   --> $DIR/self-coercion-static-free.rs:11:8
    |
 LL |     fn static_mut_ref(_: &mut Self) -> i32 { 2 }
    |        ^^^^^^^^^^^^^^ ------------
-help: consider mutably borrowing here
-   |
-LL |         &mut S1::static_self()
-   |         ++++
 
 error[E0308]: mismatched types
-  --> $DIR/self-coercion-static-free.rs:35:9
+  --> $DIR/self-coercion-static-free.rs:34:56
    |
 LL |     reuse <F as Trait>::{static_value, static_mut_ref, static_ref} {
-   |                                                        ---------- arguments to this function are incorrect
-LL |         let _ = self;
-LL |         S1::static_self()
-   |         ^^^^^^^^^^^^^^^^^ expected `&F`, found `F`
+   |                                                        ^^^^^^^^^^
+   |                                                        |
+   |                                                        expected `&F`, found `&S1`
+   |                                                        arguments to this function are incorrect
    |
+   = note: expected reference `&F`
+              found reference `&S1`
 note: associated function defined here
   --> $DIR/self-coercion-static-free.rs:12:8
    |
 LL |     fn static_ref(_: &Self) -> i32 { 3 }
    |        ^^^^^^^^^^ --------
-help: consider borrowing here
-   |
-LL |         &S1::static_self()
-   |         +
 
 error[E0308]: mismatched types
-  --> $DIR/self-coercion-static-free.rs:48:43
+  --> $DIR/self-coercion-static-free.rs:50:43
    |
 LL | reuse to_reuse::{value, mut_ref, r#ref} { F }
    |                         -------           ^ expected `&mut _`, found `F`
@@ -85,7 +107,7 @@
    = note: expected mutable reference `&mut _`
                          found struct `F`
 note: function defined here
-  --> $DIR/self-coercion-static-free.rs:44:12
+  --> $DIR/self-coercion-static-free.rs:46:12
    |
 LL |     pub fn mut_ref(_: &mut impl Trait) -> i32 { 2 }
    |            ^^^^^^^ ------------------
@@ -95,7 +117,7 @@
    |                                           ++++
 
 error[E0308]: mismatched types
-  --> $DIR/self-coercion-static-free.rs:48:43
+  --> $DIR/self-coercion-static-free.rs:50:43
    |
 LL | reuse to_reuse::{value, mut_ref, r#ref} { F }
    |                                  -----    ^ expected `&_`, found `F`
@@ -105,7 +127,7 @@
    = note: expected reference `&_`
                  found struct `F`
 note: function defined here
-  --> $DIR/self-coercion-static-free.rs:45:12
+  --> $DIR/self-coercion-static-free.rs:47:12
    |
 LL |     pub fn r#ref(_: &impl Trait) -> i32 { 3 }
    |            ^^^^^ --------------
@@ -114,6 +136,6 @@
 LL | reuse to_reuse::{value, mut_ref, r#ref} { &F }
    |                                           +
 
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/delegation/target-expr-removal-defs-inside.rs b/tests/ui/delegation/target-expr-removal-defs-inside.rs
new file mode 100644
index 0000000..665c889
--- /dev/null
+++ b/tests/ui/delegation/target-expr-removal-defs-inside.rs
@@ -0,0 +1,76 @@
+#![feature(fn_delegation)]
+
+pub trait Trait: Sized {
+    fn static_self() -> F { F }
+
+    fn static_value(_: Self) -> i32 { 1 }
+    fn static_mut_ref(_: &mut Self) -> i32 { 2 }
+    fn static_ref(_: &Self) -> i32 { 3 }
+}
+
+struct F;
+impl Trait for F {}
+
+struct S(F);
+
+reuse impl Trait for S {
+    //~^ ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: method `static_self` has an incompatible type for trait
+    //~| ERROR: method `static_value` has 0 parameters but the declaration in trait `Trait::static_value` has 1
+    //~| ERROR: method `static_mut_ref` has 0 parameters but the declaration in trait `Trait::static_mut_ref` has 1
+    //~| ERROR: method `static_ref` has 0 parameters but the declaration in trait `Trait::static_ref` has 1
+    //~| ERROR: this function takes 0 arguments but 1 argument was supplied
+    struct Def {}
+    self.0
+}
+
+struct S1(F);
+reuse impl Trait for S1 {
+    //~^ ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: method `static_self` has an incompatible type for trait
+    //~| ERROR: method `static_value` has 0 parameters but the declaration in trait `Trait::static_value` has 1
+    //~| ERROR: method `static_mut_ref` has 0 parameters but the declaration in trait `Trait::static_mut_ref` has 1
+    //~| ERROR: method `static_ref` has 0 parameters but the declaration in trait `Trait::static_ref` has 1
+    //~| ERROR: this function takes 0 arguments but 1 argument was supplied
+    some::path::<{ fn foo() {} }>::xd();
+    //~^ ERROR: cannot find module or crate `some` in this scope
+    //~| ERROR: cannot find module or crate `some` in this scope
+    //~| ERROR: cannot find module or crate `some` in this scope
+    //~| ERROR: cannot find module or crate `some` in this scope
+    self.0
+}
+
+struct S2(F);
+reuse impl Trait for S2 {
+    //~^ ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: attempted to delete delegation's target expression that contains definitions inside
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: mismatched types
+    //~| ERROR: method `static_self` has an incompatible type for trait
+    //~| ERROR: method `static_value` has 0 parameters but the declaration in trait `Trait::static_value` has 1
+    //~| ERROR: method `static_mut_ref` has 0 parameters but the declaration in trait `Trait::static_mut_ref` has 1
+    //~| ERROR: method `static_ref` has 0 parameters but the declaration in trait `Trait::static_ref` has 1
+    //~| ERROR: this function takes 0 arguments but 1 argument was supplied
+    fn foo() {}
+    self.0
+}
+
+fn main() {}
diff --git a/tests/ui/delegation/target-expr-removal-defs-inside.stderr b/tests/ui/delegation/target-expr-removal-defs-inside.stderr
new file mode 100644
index 0000000..eb35408
--- /dev/null
+++ b/tests/ui/delegation/target-expr-removal-defs-inside.stderr
@@ -0,0 +1,683 @@
+error[E0433]: cannot find module or crate `some` in this scope
+  --> $DIR/target-expr-removal-defs-inside.rs:49:5
+   |
+LL |     some::path::<{ fn foo() {} }>::xd();
+   |     ^^^^ use of unresolved module or unlinked crate `some`
+   |
+   = help: you might be missing a crate named `some`
+
+error[E0433]: cannot find module or crate `some` in this scope
+  --> $DIR/target-expr-removal-defs-inside.rs:49:5
+   |
+LL |     some::path::<{ fn foo() {} }>::xd();
+   |     ^^^^ use of unresolved module or unlinked crate `some`
+   |
+   = help: you might be missing a crate named `some`
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0433]: cannot find module or crate `some` in this scope
+  --> $DIR/target-expr-removal-defs-inside.rs:49:5
+   |
+LL |     some::path::<{ fn foo() {} }>::xd();
+   |     ^^^^ use of unresolved module or unlinked crate `some`
+   |
+   = help: you might be missing a crate named `some`
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0433]: cannot find module or crate `some` in this scope
+  --> $DIR/target-expr-removal-defs-inside.rs:49:5
+   |
+LL |     some::path::<{ fn foo() {} }>::xd();
+   |     ^^^^ use of unresolved module or unlinked crate `some`
+   |
+   = help: you might be missing a crate named `some`
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:16:24
+   |
+LL |   reuse impl Trait for S {
+   |  ________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:16:24
+   |
+LL |   reuse impl Trait for S {
+   |  ________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:16:24
+   |
+LL |   reuse impl Trait for S {
+   |  ________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:16:24
+   |
+LL |   reuse impl Trait for S {
+   |  ________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:35:25
+   |
+LL |   reuse impl Trait for S1 {
+   |  _________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:35:25
+   |
+LL |   reuse impl Trait for S1 {
+   |  _________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:35:25
+   |
+LL |   reuse impl Trait for S1 {
+   |  _________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:35:25
+   |
+LL |   reuse impl Trait for S1 {
+   |  _________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:58:25
+   |
+LL |   reuse impl Trait for S2 {
+   |  _________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:58:25
+   |
+LL |   reuse impl Trait for S2 {
+   |  _________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:58:25
+   |
+LL |   reuse impl Trait for S2 {
+   |  _________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: attempted to delete delegation's target expression that contains definitions inside
+  --> $DIR/target-expr-removal-defs-inside.rs:58:25
+   |
+LL |   reuse impl Trait for S2 {
+   |  _________________________^
+...  |
+LL | |     self.0
+LL | | }
+   | |_^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0053]: method `static_self` has an incompatible type for trait
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL | / reuse impl Trait for S {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected `F`, found `()`
+   |
+note: type in trait
+  --> $DIR/target-expr-removal-defs-inside.rs:4:25
+   |
+LL |     fn static_self() -> F { F }
+   |                         ^
+   = note: expected signature `fn() -> F`
+              found signature `fn() -> ()`
+help: change the output type to match the trait
+   |
+LL - reuse impl Trait for S {
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -     struct Def {}
+LL -     self.0
+LL - }
+LL +  -> F
+   |
+
+error[E0050]: method `static_value` has 0 parameters but the declaration in trait `Trait::static_value` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL |       fn static_value(_: Self) -> i32 { 1 }
+   |                          ---- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0050]: method `static_mut_ref` has 0 parameters but the declaration in trait `Trait::static_mut_ref` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL |       fn static_mut_ref(_: &mut Self) -> i32 { 2 }
+   |                            --------- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0050]: method `static_ref` has 0 parameters but the declaration in trait `Trait::static_ref` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL |       fn static_ref(_: &Self) -> i32 { 3 }
+   |                        ----- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0053]: method `static_self` has an incompatible type for trait
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL | / reuse impl Trait for S1 {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected `F`, found `()`
+   |
+note: type in trait
+  --> $DIR/target-expr-removal-defs-inside.rs:4:25
+   |
+LL |     fn static_self() -> F { F }
+   |                         ^
+   = note: expected signature `fn() -> F`
+              found signature `fn() -> ()`
+help: change the output type to match the trait
+   |
+LL - reuse impl Trait for S1 {
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -     some::path::<{ fn foo() {} }>::xd();
+LL -
+LL -
+LL -
+LL -
+LL -     self.0
+LL - }
+LL +  -> F
+   |
+
+error[E0050]: method `static_value` has 0 parameters but the declaration in trait `Trait::static_value` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL |       fn static_value(_: Self) -> i32 { 1 }
+   |                          ---- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S1 {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0050]: method `static_mut_ref` has 0 parameters but the declaration in trait `Trait::static_mut_ref` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL |       fn static_mut_ref(_: &mut Self) -> i32 { 2 }
+   |                            --------- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S1 {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0050]: method `static_ref` has 0 parameters but the declaration in trait `Trait::static_ref` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL |       fn static_ref(_: &Self) -> i32 { 3 }
+   |                        ----- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S1 {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0053]: method `static_self` has an incompatible type for trait
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL | / reuse impl Trait for S2 {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected `F`, found `()`
+   |
+note: type in trait
+  --> $DIR/target-expr-removal-defs-inside.rs:4:25
+   |
+LL |     fn static_self() -> F { F }
+   |                         ^
+   = note: expected signature `fn() -> F`
+              found signature `fn() -> ()`
+help: change the output type to match the trait
+   |
+LL - reuse impl Trait for S2 {
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -     fn foo() {}
+LL -     self.0
+LL - }
+LL +  -> F
+   |
+
+error[E0050]: method `static_value` has 0 parameters but the declaration in trait `Trait::static_value` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL |       fn static_value(_: Self) -> i32 { 1 }
+   |                          ---- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S2 {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0050]: method `static_mut_ref` has 0 parameters but the declaration in trait `Trait::static_mut_ref` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL |       fn static_mut_ref(_: &mut Self) -> i32 { 2 }
+   |                            --------- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S2 {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0050]: method `static_ref` has 0 parameters but the declaration in trait `Trait::static_ref` has 1
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL |       fn static_ref(_: &Self) -> i32 { 3 }
+   |                        ----- trait requires 1 parameter
+...
+LL | / reuse impl Trait for S2 {
+...  |
+LL | |     self.0
+LL | | }
+   | |_^ expected 1 parameter, found 0
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL |    reuse impl Trait for S {
+   |   _^                      -
+   |  |________________________|
+...  ||
+LL | ||     self.0
+LL | || }
+   | ||_^ unexpected argument
+   |  |_|
+   |
+   |
+note: associated function defined here
+  --> $DIR/target-expr-removal-defs-inside.rs:4:8
+   |
+LL |     fn static_self() -> F { F }
+   |        ^^^^^^^^^^^
+help: remove the extra argument
+   |
+LL - reuse impl Trait for S {
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -     struct Def {}
+LL -     self.0
+LL - }
+LL + reuse impl Trait for S }
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL | / reuse impl Trait for S {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `F`
+   |   expected `()` because of default return type
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL | / reuse impl Trait for S {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL | / reuse impl Trait for S {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:16:1
+   |
+LL | / reuse impl Trait for S {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL |    reuse impl Trait for S1 {
+   |   _^                       -
+   |  |_________________________|
+...  ||
+LL | ||     self.0
+LL | || }
+   | ||_^ unexpected argument
+   |  |_|
+   |
+   |
+note: associated function defined here
+  --> $DIR/target-expr-removal-defs-inside.rs:4:8
+   |
+LL |     fn static_self() -> F { F }
+   |        ^^^^^^^^^^^
+help: remove the extra argument
+   |
+LL - reuse impl Trait for S1 {
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -     some::path::<{ fn foo() {} }>::xd();
+LL -
+LL -
+LL -
+LL -
+LL -     self.0
+LL - }
+LL + reuse impl Trait for S1 }
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL | / reuse impl Trait for S1 {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `F`
+   |   expected `()` because of default return type
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL | / reuse impl Trait for S1 {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL | / reuse impl Trait for S1 {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:35:1
+   |
+LL | / reuse impl Trait for S1 {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL |    reuse impl Trait for S2 {
+   |   _^                       -
+   |  |_________________________|
+...  ||
+LL | ||     self.0
+LL | || }
+   | ||_^ unexpected argument
+   |  |_|
+   |
+   |
+note: associated function defined here
+  --> $DIR/target-expr-removal-defs-inside.rs:4:8
+   |
+LL |     fn static_self() -> F { F }
+   |        ^^^^^^^^^^^
+help: remove the extra argument
+   |
+LL - reuse impl Trait for S2 {
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -
+LL -     fn foo() {}
+LL -     self.0
+LL - }
+LL + reuse impl Trait for S2 }
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL | / reuse impl Trait for S2 {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `F`
+   |   expected `()` because of default return type
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL | / reuse impl Trait for S2 {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL | / reuse impl Trait for S2 {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0308]: mismatched types
+  --> $DIR/target-expr-removal-defs-inside.rs:58:1
+   |
+LL | / reuse impl Trait for S2 {
+...  |
+LL | |     self.0
+LL | | }
+   | | ^- help: consider using a semicolon here: `;`
+   | | |
+   | |_expected `()`, found `i32`
+   |   expected `()` because of default return type
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 43 previous errors
+
+Some errors have detailed explanations: E0050, E0053, E0061, E0308, E0433.
+For more information about an error, try `rustc --explain E0050`.
diff --git a/tests/ui/delegation/target-expr-removal-free-to-free.rs b/tests/ui/delegation/target-expr-removal-free-to-free.rs
new file mode 100644
index 0000000..02470c2
--- /dev/null
+++ b/tests/ui/delegation/target-expr-removal-free-to-free.rs
@@ -0,0 +1,12 @@
+#![feature(fn_delegation)]
+
+mod to_reuse {
+    pub fn foo(x: usize) -> usize { x }
+    pub fn bar() -> () { () }
+}
+
+reuse to_reuse::{foo, bar} { self + 1 }
+//~^ ERROR: this function takes 0 arguments but 1 argument was supplied
+//~| ERROR: delegation's target expression is specified for function with no params
+
+fn main() {}
diff --git a/tests/ui/delegation/target-expr-removal-free-to-free.stderr b/tests/ui/delegation/target-expr-removal-free-to-free.stderr
new file mode 100644
index 0000000..a0ccd6b
--- /dev/null
+++ b/tests/ui/delegation/target-expr-removal-free-to-free.stderr
@@ -0,0 +1,26 @@
+error: delegation's target expression is specified for function with no params
+  --> $DIR/target-expr-removal-free-to-free.rs:8:28
+   |
+LL | reuse to_reuse::{foo, bar} { self + 1 }
+   |                            ^^^^^^^^^^^^
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/target-expr-removal-free-to-free.rs:8:23
+   |
+LL | reuse to_reuse::{foo, bar} { self + 1 }
+   |                       ^^^  ------------ unexpected argument
+   |
+note: function defined here
+  --> $DIR/target-expr-removal-free-to-free.rs:5:12
+   |
+LL |     pub fn bar() -> () { () }
+   |            ^^^
+help: remove the extra argument
+   |
+LL - reuse to_reuse::{foo, bar} { self + 1 }
+LL + reuse to_reuse::{foo, ba{ self + 1 }
+   |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/delegation/target-expression-removal-pass.rs b/tests/ui/delegation/target-expression-removal-pass.rs
new file mode 100644
index 0000000..14bf5a6
--- /dev/null
+++ b/tests/ui/delegation/target-expression-removal-pass.rs
@@ -0,0 +1,39 @@
+//@ run-pass
+
+#![feature(fn_delegation)]
+
+trait Trait: Sized {
+    fn by_value(self) -> i32 { 1 }
+    fn by_mut_ref(&mut self) -> i32 { 2 }
+    fn by_ref(&self) -> i32 { 3 }
+
+    fn static_self() -> F { F }
+
+    fn static_value(_: F) -> i32 { 1 }
+    fn static_mut_ref(_: &mut F) -> i32 { 2 }
+    fn static_ref(_: &F) -> i32 { 3 }
+}
+
+#[derive(Default, Eq, PartialEq, Debug)]
+struct F;
+impl Trait for F {}
+
+struct S(F);
+
+impl Trait for S {
+    // Delegation's expression is removed from static functions.
+    reuse <F as Trait>::* { self.0 }
+}
+
+fn main() {
+    let mut s = S(F);
+    assert_eq!(s.by_mut_ref(), 2);
+    assert_eq!(s.by_ref(), 3);
+    assert_eq!(s.by_value(), 1);
+
+    assert_eq!(S::static_self(), F);
+
+    assert_eq!(S::static_value(F), 1);
+    assert_eq!(S::static_mut_ref(&mut F), 2);
+    assert_eq!(S::static_ref(&F), 3);
+}
diff --git a/tests/ui/delegation/zero-args-delegations-ice-154332.rs b/tests/ui/delegation/zero-args-delegations-ice-154332.rs
index a9d7876..2b412fd 100644
--- a/tests/ui/delegation/zero-args-delegations-ice-154332.rs
+++ b/tests/ui/delegation/zero-args-delegations-ice-154332.rs
@@ -3,7 +3,8 @@
 mod test_ice {
     fn a() {}
 
-    reuse a as b { //~ ERROR: this function takes 0 arguments but 1 argument was supplied
+    reuse a as b { //~ ERROR: delegation's target expression is specified for function with no params
+        //~^ ERROR: this function takes 0 arguments but 1 argument was supplied
         let closure = || {
             fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
 
@@ -23,7 +24,34 @@ pub fn zero_args() -> i32 {
     }
 
     reuse to_reuse::zero_args { self }
-    //~^ ERROR: this function takes 0 arguments but 1 argument was supplied
+    //~^ ERROR: delegation's target expression is specified for function with no params
+    //~| ERROR: this function takes 0 arguments but 1 argument was supplied
+    //~| ERROR: mismatched types
+}
+
+mod nested_delegations {
+    fn a() {}
+
+    reuse a as b { //~ ERROR: delegation's target expression is specified for function with no params
+        //~^ ERROR: this function takes 0 arguments but 1 argument was supplied
+        let closure = || {
+            reuse a as b { //~ ERROR: delegation's target expression is specified for function with no params
+                //~^ ERROR: this function takes 0 arguments but 1 argument was supplied
+                fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
+
+                reuse foo::<String, 1, String> as bar;
+                bar(&"".to_string(), &"".to_string());
+
+                reuse a as b { //~ ERROR: delegation's target expression is specified for function with no params
+                    //~^ ERROR: this function takes 0 arguments but 1 argument was supplied
+                    reuse foo::<String, 1, String> as bar;
+                    bar(&"".to_string(), &"".to_string());
+                }
+            }
+        };
+
+        closure();
+    }
 }
 
 fn main() {}
diff --git a/tests/ui/delegation/zero-args-delegations-ice-154332.stderr b/tests/ui/delegation/zero-args-delegations-ice-154332.stderr
index d2aab75..9154012 100644
--- a/tests/ui/delegation/zero-args-delegations-ice-154332.stderr
+++ b/tests/ui/delegation/zero-args-delegations-ice-154332.stderr
@@ -1,8 +1,63 @@
+error: delegation's target expression is specified for function with no params
+  --> $DIR/zero-args-delegations-ice-154332.rs:6:18
+   |
+LL |       reuse a as b {
+   |  __________________^
+LL | |
+LL | |         let closure = || {
+LL | |             fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
+...  |
+LL | |         closure();
+LL | |     }
+   | |_____^
+
+error: delegation's target expression is specified for function with no params
+  --> $DIR/zero-args-delegations-ice-154332.rs:26:31
+   |
+LL |     reuse to_reuse::zero_args { self }
+   |                               ^^^^^^^^
+
+error: delegation's target expression is specified for function with no params
+  --> $DIR/zero-args-delegations-ice-154332.rs:35:18
+   |
+LL |       reuse a as b {
+   |  __________________^
+LL | |
+LL | |         let closure = || {
+LL | |             reuse a as b {
+...  |
+LL | |         closure();
+LL | |     }
+   | |_____^
+
+error: delegation's target expression is specified for function with no params
+  --> $DIR/zero-args-delegations-ice-154332.rs:38:26
+   |
+LL |               reuse a as b {
+   |  __________________________^
+LL | |
+LL | |                 fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
+...  |
+LL | |             }
+   | |_____________^
+
+error: delegation's target expression is specified for function with no params
+  --> $DIR/zero-args-delegations-ice-154332.rs:45:30
+   |
+LL |                   reuse a as b {
+   |  ______________________________^
+LL | |
+LL | |                     reuse foo::<String, 1, String> as bar;
+LL | |                     bar(&"".to_string(), &"".to_string());
+LL | |                 }
+   | |_________________^
+
 error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/zero-args-delegations-ice-154332.rs:6:11
    |
 LL |       reuse a as b {
    |  ___________^______-
+LL | |
 LL | |         let closure = || {
 LL | |             fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
 ...  |
@@ -22,13 +77,13 @@
    |
 
 error[E0061]: this function takes 0 arguments but 1 argument was supplied
-  --> $DIR/zero-args-delegations-ice-154332.rs:25:21
+  --> $DIR/zero-args-delegations-ice-154332.rs:26:21
    |
 LL |     reuse to_reuse::zero_args { self }
    |                     ^^^^^^^^^ -------- unexpected argument
    |
 note: function defined here
-  --> $DIR/zero-args-delegations-ice-154332.rs:20:16
+  --> $DIR/zero-args-delegations-ice-154332.rs:21:16
    |
 LL |         pub fn zero_args() -> i32 {
    |                ^^^^^^^^^
@@ -38,6 +93,91 @@
 LL +     reuse to_reuse::zero_arg{ self }
    |
 
-error: aborting due to 2 previous errors
+error[E0308]: mismatched types
+  --> $DIR/zero-args-delegations-ice-154332.rs:26:21
+   |
+LL |     reuse to_reuse::zero_args { self }
+   |                     ^^^^^^^^^ expected `()`, found `i32`
+   |
+help: consider using a semicolon here
+   |
+LL |     reuse to_reuse::zero_args; { self }
+   |                              +
+help: try adding a return type
+   |
+LL -     reuse to_reuse::zero_args { self }
+LL +     reuse to_reuse:: -> i32 { self }
+   |
 
-For more information about this error, try `rustc --explain E0061`.
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/zero-args-delegations-ice-154332.rs:35:11
+   |
+LL |       reuse a as b {
+   |  ___________^______-
+LL | |
+LL | |         let closure = || {
+LL | |             reuse a as b {
+...  |
+LL | |         closure();
+LL | |     }
+   | |_____- unexpected argument of type `()`
+   |
+note: function defined here
+  --> $DIR/zero-args-delegations-ice-154332.rs:33:8
+   |
+LL |     fn a() {}
+   |        ^
+help: remove the extra argument
+   |
+LL -     reuse a as b {
+LL +     reuse {
+   |
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/zero-args-delegations-ice-154332.rs:38:19
+   |
+LL |               reuse a as b {
+   |  ___________________^______-
+LL | |
+LL | |                 fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
+...  |
+LL | |             }
+   | |_____________- unexpected argument of type `()`
+   |
+note: function defined here
+  --> $DIR/zero-args-delegations-ice-154332.rs:33:8
+   |
+LL |     fn a() {}
+   |        ^
+help: remove the extra argument
+   |
+LL -             reuse a as b {
+LL +             reuse {
+   |
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/zero-args-delegations-ice-154332.rs:45:23
+   |
+LL |                   reuse a as b {
+   |  _______________________^______-
+LL | |
+LL | |                     reuse foo::<String, 1, String> as bar;
+LL | |                     bar(&"".to_string(), &"".to_string());
+LL | |                 }
+   | |_________________- unexpected argument of type `()`
+   |
+note: function defined here
+  --> $DIR/zero-args-delegations-ice-154332.rs:33:8
+   |
+LL |     fn a() {}
+   |        ^
+help: remove the extra argument
+   |
+LL -                 reuse a as b {
+LL +                 reuse {
+   |
+
+error: aborting due to 11 previous errors
+
+Some errors have detailed explanations: E0061, E0308.
+For more information about an error, try `rustc --explain E0061`.
diff --git a/tests/ui/delegation/zero-args-delegations-ice-154427.rs b/tests/ui/delegation/zero-args-delegations-ice-154427.rs
new file mode 100644
index 0000000..11c27c7
--- /dev/null
+++ b/tests/ui/delegation/zero-args-delegations-ice-154427.rs
@@ -0,0 +1,21 @@
+#![feature(fn_delegation)]
+
+mod ice_154427 {
+    trait Trait {
+        fn foo();
+    }
+    struct F;
+    struct S;
+    mod to_reuse {
+        use super::F;
+        pub fn foo(_: F) {}
+    }
+    impl Trait for S {
+        reuse to_reuse::foo { self }
+        //~^ ERROR: delegation's target expression is specified for function with no params
+    }
+
+    fn main() {}
+}
+
+fn main() {}
diff --git a/tests/ui/delegation/zero-args-delegations-ice-154427.stderr b/tests/ui/delegation/zero-args-delegations-ice-154427.stderr
new file mode 100644
index 0000000..03d5c62
--- /dev/null
+++ b/tests/ui/delegation/zero-args-delegations-ice-154427.stderr
@@ -0,0 +1,8 @@
+error: delegation's target expression is specified for function with no params
+  --> $DIR/zero-args-delegations-ice-154427.rs:14:29
+   |
+LL |         reuse to_reuse::foo { self }
+   |                             ^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/issues/issue-19037.rs b/tests/ui/derives/clone-copy/clone-ref-to-dst.rs
similarity index 78%
rename from tests/ui/issues/issue-19037.rs
rename to tests/ui/derives/clone-copy/clone-ref-to-dst.rs
index 7f88a89..3eb8bba 100644
--- a/tests/ui/issues/issue-19037.rs
+++ b/tests/ui/derives/clone-copy/clone-ref-to-dst.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19037>.
+
 //@ check-pass
 #![allow(dead_code)]
 
diff --git a/tests/ui/destructuring-assignment/non-exhaustive-destructure.rs b/tests/ui/destructuring-assignment/non-exhaustive-destructure.rs
index 39939f2..d1bcec7 100644
--- a/tests/ui/destructuring-assignment/non-exhaustive-destructure.rs
+++ b/tests/ui/destructuring-assignment/non-exhaustive-destructure.rs
@@ -1,4 +1,4 @@
 fn main() {
     None = Some(3);
-    //~^ ERROR refutable pattern in local binding
+    //~^ ERROR refutable pattern in assignment
 }
diff --git a/tests/ui/destructuring-assignment/non-exhaustive-destructure.stderr b/tests/ui/destructuring-assignment/non-exhaustive-destructure.stderr
index 88f7d2d..a98a494 100644
--- a/tests/ui/destructuring-assignment/non-exhaustive-destructure.stderr
+++ b/tests/ui/destructuring-assignment/non-exhaustive-destructure.stderr
@@ -1,16 +1,12 @@
-error[E0005]: refutable pattern in local binding
+error[E0005]: refutable pattern in assignment
   --> $DIR/non-exhaustive-destructure.rs:2:5
    |
 LL |     None = Some(3);
    |     ^^^^ pattern `Some(_)` not covered
    |
-   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+   = note: destructuring assignments require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
    = note: the matched value is of type `Option<i32>`
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |     if None = Some(3) { todo!() };
-   |     ++                +++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/destructuring-assignment/refutable-enum-assignment.rs b/tests/ui/destructuring-assignment/refutable-enum-assignment.rs
new file mode 100644
index 0000000..dcd8e8e
--- /dev/null
+++ b/tests/ui/destructuring-assignment/refutable-enum-assignment.rs
@@ -0,0 +1,11 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/157553>.
+
+enum Foo {
+    One,
+    Two,
+}
+
+fn main() {
+    Foo::One = Foo::One;
+    //~^ ERROR refutable pattern in assignment
+}
diff --git a/tests/ui/destructuring-assignment/refutable-enum-assignment.stderr b/tests/ui/destructuring-assignment/refutable-enum-assignment.stderr
new file mode 100644
index 0000000..610cb5a
--- /dev/null
+++ b/tests/ui/destructuring-assignment/refutable-enum-assignment.stderr
@@ -0,0 +1,21 @@
+error[E0005]: refutable pattern in assignment
+  --> $DIR/refutable-enum-assignment.rs:9:5
+   |
+LL |     Foo::One = Foo::One;
+   |     ^^^^^^^^ pattern `Foo::Two` not covered
+   |
+   = note: destructuring assignments require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+   = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
+note: `Foo` defined here
+  --> $DIR/refutable-enum-assignment.rs:3:6
+   |
+LL | enum Foo {
+   |      ^^^
+LL |     One,
+LL |     Two,
+   |     --- not covered
+   = note: the matched value is of type `Foo`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/tests/ui/diagnostic_namespace/on_unknown/incorrect_format_string.stderr b/tests/ui/diagnostic_namespace/on_unknown/incorrect_format_string.stderr
index 9c2d5b0..7bc85c1 100644
--- a/tests/ui/diagnostic_namespace/on_unknown/incorrect_format_string.stderr
+++ b/tests/ui/diagnostic_namespace/on_unknown/incorrect_format_string.stderr
@@ -2,7 +2,9 @@
   --> $DIR/incorrect_format_string.rs:5:5
    |
 LL | use std::does_not_exist;
-   |     ^^^^^^^^^^^^^^^^^^^ no `does_not_exist` in the root
+   |     ^^^^^--------------
+   |          |
+   |          no `does_not_exist` in the root
    |
    = note: unresolved import `std::does_not_exist`
 
@@ -10,7 +12,9 @@
   --> $DIR/incorrect_format_string.rs:10:5
    |
 LL | use std::does_not_exist2;
-   |     ^^^^^^^^^^^^^^^^^^^^ no `does_not_exist2` in the root
+   |     ^^^^^---------------
+   |          |
+   |          no `does_not_exist2` in the root
    |
    = note: unresolved import `std::does_not_exist2`
 
@@ -18,19 +22,25 @@
   --> $DIR/incorrect_format_string.rs:15:5
    |
 LL | use std::does_not_exist3;
-   |     ^^^^^^^^^^^^^^^^^^^^ foo {}
+   |     ^^^^^---------------
+   |          |
+   |          foo {}
 
 error[E0432]: unresolved import `std::does_not_exist4`
   --> $DIR/incorrect_format_string.rs:20:5
    |
 LL | use std::does_not_exist4;
-   |     ^^^^^^^^^^^^^^^^^^^^ foo {A}
+   |     ^^^^^---------------
+   |          |
+   |          foo {A}
 
 error[E0432]: unresolved import `std::does_not_exist5`
   --> $DIR/incorrect_format_string.rs:25:5
    |
 LL | use std::does_not_exist5;
-   |     ^^^^^^^^^^^^^^^^^^^^ no `does_not_exist5` in the root
+   |     ^^^^^---------------
+   |          |
+   |          no `does_not_exist5` in the root
    |
    = note: foo {}
 
@@ -38,7 +48,9 @@
   --> $DIR/incorrect_format_string.rs:33:5
    |
 LL | use std::does_not_exist6;
-   |     ^^^^^^^^^^^^^^^^^^^^ no `does_not_exist6` in the root
+   |     ^^^^^---------------
+   |          |
+   |          no `does_not_exist6` in the root
    |
    = note: foo {Self} {ItemContext} {Trait} {A}
 
diff --git a/tests/ui/diagnostic_namespace/on_unknown/malformed_attribute.stderr b/tests/ui/diagnostic_namespace/on_unknown/malformed_attribute.stderr
index a949ace..3aefd4c 100644
--- a/tests/ui/diagnostic_namespace/on_unknown/malformed_attribute.stderr
+++ b/tests/ui/diagnostic_namespace/on_unknown/malformed_attribute.stderr
@@ -2,7 +2,9 @@
   --> $DIR/malformed_attribute.rs:16:5
    |
 LL | use std::str::NotExisting;
-   |     ^^^^^^^^^^^^^^^^^^^^^ no `NotExisting` in `str`
+   |     ^^^^^^^^^^-----------
+   |               |
+   |               no `NotExisting` in `str`
    |
    = note: unresolved import `std::str::NotExisting`
 
diff --git a/tests/ui/diagnostic_namespace/on_unknown/multiple_errors.stderr b/tests/ui/diagnostic_namespace/on_unknown/multiple_errors.stderr
index fcce77f..5456f12 100644
--- a/tests/ui/diagnostic_namespace/on_unknown/multiple_errors.stderr
+++ b/tests/ui/diagnostic_namespace/on_unknown/multiple_errors.stderr
@@ -13,8 +13,9 @@
   --> $DIR/multiple_errors.rs:19:15
    |
 LL |     use std::{Whatever, vec::NonExisting, vec::Vec, *};
-   |               ^^^^^^^^  ^^^^^^^^^^^^^^^^ custom label
-   |               |
+   |               ^^^^^^^^  ^^^^^-----------
+   |               |              |
+   |               |              custom label
    |               custom label
    |
    = note: unresolved imports `std::Whatever`, `std::vec::NonExisting`
diff --git a/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.rs b/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.rs
new file mode 100644
index 0000000..b7aa11c
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.rs
@@ -0,0 +1,31 @@
+//! Test that the `label` span points at the identifier passed to the macro.
+
+#![feature(diagnostic_on_unknown)]
+#![crate_type = "lib"]
+
+mod things {}
+
+macro_rules! mac {
+    ($thing: ident) => {{
+        const _x: u32 = {
+            #[diagnostic::on_unknown(label = "you did the bad thing")]
+            use things::$thing;
+            //~^ ERROR unresolved import `things::what` [E0432]
+            //~| ERROR unresolved import `things::what2` [E0432]
+            $thing
+        };
+    }};
+}
+
+fn stuff() {
+    mac!(what);
+    //~^ NOTE you did the bad thing
+    //~| NOTE in this expansion of mac!
+
+    mac!(//~ NOTE in this expansion of mac!
+
+        what2
+        //~^ NOTE you did the bad thing
+
+    );
+}
diff --git a/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.stderr b/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.stderr
new file mode 100644
index 0000000..9cd6f17
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.stderr
@@ -0,0 +1,33 @@
+error[E0432]: unresolved import `things::what`
+  --> $DIR/point_at_macro_argument.rs:12:17
+   |
+LL |             use things::$thing;
+   |                 ^^^^^^^^^^^^^^
+...
+LL |     mac!(what);
+   |     ----------
+   |     |    |
+   |     |    you did the bad thing
+   |     in this macro invocation
+   |
+   = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0432]: unresolved import `things::what2`
+  --> $DIR/point_at_macro_argument.rs:12:17
+   |
+LL |               use things::$thing;
+   |                   ^^^^^^^^^^^^^^
+...
+LL | /     mac!(
+LL | |
+LL | |         what2
+   | |         ----- you did the bad thing
+...  |
+LL | |     );
+   | |_____- in this macro invocation
+   |
+   = note: this error originates in the macro `mac` (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 E0432`.
diff --git a/tests/ui/diagnostic_namespace/on_unknown/this_format_argument.stderr b/tests/ui/diagnostic_namespace/on_unknown/this_format_argument.stderr
index aa6fd49..98e1278 100644
--- a/tests/ui/diagnostic_namespace/on_unknown/this_format_argument.stderr
+++ b/tests/ui/diagnostic_namespace/on_unknown/this_format_argument.stderr
@@ -2,7 +2,9 @@
   --> $DIR/this_format_argument.rs:7:5
    |
 LL | use foo::Foo;
-   |     ^^^^^^^^ no `Foo` in `foo`
+   |     ^^^^^---
+   |          |
+   |          no `Foo` in `foo`
    |
    = note: the name of this item is a single ident: `Foo`
 
@@ -51,7 +53,9 @@
   --> $DIR/this_format_argument.rs:42:5
    |
 LL | use foo::Foo as DoNotUseForThisParam;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `Foo` in `foo`
+   |     ^^^^^---^^^^^^^^^^^^^^^^^^^^^^^^
+   |          |
+   |          no `Foo` in `foo`
    |
    = note: the name of this item is a single ident: `Foo`
 
diff --git a/tests/ui/diagnostic_namespace/on_unknown/unknown_import.stderr b/tests/ui/diagnostic_namespace/on_unknown/unknown_import.stderr
index a9867fd..09609f3 100644
--- a/tests/ui/diagnostic_namespace/on_unknown/unknown_import.stderr
+++ b/tests/ui/diagnostic_namespace/on_unknown/unknown_import.stderr
@@ -2,7 +2,9 @@
   --> $DIR/unknown_import.rs:12:5
    |
 LL | use foo::Foo;
-   |     ^^^^^^^^ first label
+   |     ^^^^^---
+   |          |
+   |          first label
    |
    = note: unresolved import `foo::Foo`
    = note: custom note
diff --git a/tests/ui/issues/issue-19380.rs b/tests/ui/dyn-compatibility/dyn-incompat-const-slice.rs
similarity index 76%
rename from tests/ui/issues/issue-19380.rs
rename to tests/ui/dyn-compatibility/dyn-incompat-const-slice.rs
index fce737c..d4cb281 100644
--- a/tests/ui/issues/issue-19380.rs
+++ b/tests/ui/dyn-compatibility/dyn-incompat-const-slice.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19380>.
+
 trait Qiz {
   fn qiz();
 }
diff --git a/tests/ui/issues/issue-19380.stderr b/tests/ui/dyn-compatibility/dyn-incompat-const-slice.stderr
similarity index 90%
rename from tests/ui/issues/issue-19380.stderr
rename to tests/ui/dyn-compatibility/dyn-incompat-const-slice.stderr
index 4c41d41..46ed6a4 100644
--- a/tests/ui/issues/issue-19380.stderr
+++ b/tests/ui/dyn-compatibility/dyn-incompat-const-slice.stderr
@@ -1,12 +1,12 @@
 error[E0038]: the trait `Qiz` is not dyn compatible
-  --> $DIR/issue-19380.rs:11:29
+  --> $DIR/dyn-incompat-const-slice.rs:13:29
    |
 LL |   foos: &'static [&'static (dyn Qiz + 'static)]
    |                             ^^^^^^^^^^^^^^^^^ `Qiz` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/issue-19380.rs:2:6
+  --> $DIR/dyn-incompat-const-slice.rs:4:6
    |
 LL | trait Qiz {
    |       --- this trait is not dyn compatible...
@@ -23,14 +23,14 @@
    |            +++++++++++++++++
 
 error[E0038]: the trait `Qiz` is not dyn compatible
-  --> $DIR/issue-19380.rs:16:31
+  --> $DIR/dyn-incompat-const-slice.rs:18:31
    |
 LL | const BAR : Bar = Bar { foos: &[&FOO]};
    |                               ^^^^^^^ `Qiz` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/issue-19380.rs:2:6
+  --> $DIR/dyn-incompat-const-slice.rs:4:6
    |
 LL | trait Qiz {
    |       --- this trait is not dyn compatible...
diff --git a/tests/ui/error-emitter/multiline-removal-suggestion.svg b/tests/ui/error-emitter/multiline-removal-suggestion.svg
index 1e86213..de54859 100644
--- a/tests/ui/error-emitter/multiline-removal-suggestion.svg
+++ b/tests/ui/error-emitter/multiline-removal-suggestion.svg
@@ -1,4 +1,4 @@
-<svg width="2288px" height="3890px" xmlns="http://www.w3.org/2000/svg">
+<svg width="1952px" height="3890px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { fill: #000000 }
diff --git a/tests/ui/expr/if/if-let-missing-else-clause.rs b/tests/ui/expr/if/if-let-missing-else-clause.rs
new file mode 100644
index 0000000..ca4912e
--- /dev/null
+++ b/tests/ui/expr/if/if-let-missing-else-clause.rs
@@ -0,0 +1,13 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19991>.
+//!
+//! Test if the sugared `if let` construct correctly prints "missing an else clause" when an else
+//! clause does not exist, instead of the unsympathetic "`match` arms have incompatible types"
+
+//@ dont-require-annotations: NOTE
+
+fn main() {
+    if let Some(homura) = Some("madoka") { //~  ERROR missing an `else` clause
+                                           //~| NOTE expected integer, found `()`
+        765
+    };
+}
diff --git a/tests/ui/issues/issue-19991.stderr b/tests/ui/expr/if/if-let-missing-else-clause.stderr
similarity index 90%
rename from tests/ui/issues/issue-19991.stderr
rename to tests/ui/expr/if/if-let-missing-else-clause.stderr
index 1449bab..b190786 100644
--- a/tests/ui/issues/issue-19991.stderr
+++ b/tests/ui/expr/if/if-let-missing-else-clause.stderr
@@ -1,5 +1,5 @@
 error[E0317]: `if` may be missing an `else` clause
-  --> $DIR/issue-19991.rs:7:5
+  --> $DIR/if-let-missing-else-clause.rs:9:5
    |
 LL | /     if let Some(homura) = Some("madoka") {
 LL | |
diff --git a/tests/ui/feature-gates/feature-gate-diagnostic-on-unknown.stderr b/tests/ui/feature-gates/feature-gate-diagnostic-on-unknown.stderr
index d9c8071..6e9d35a 100644
--- a/tests/ui/feature-gates/feature-gate-diagnostic-on-unknown.stderr
+++ b/tests/ui/feature-gates/feature-gate-diagnostic-on-unknown.stderr
@@ -2,7 +2,9 @@
   --> $DIR/feature-gate-diagnostic-on-unknown.rs:5:5
    |
 LL | use std::vec::NotExisting;
-   |     ^^^^^^^^^^^^^^^^^^^^^ no `NotExisting` in `vec`
+   |     ^^^^^^^^^^-----------
+   |               |
+   |               no `NotExisting` in `vec`
 
 error: unknown diagnostic attribute
   --> $DIR/feature-gate-diagnostic-on-unknown.rs:3:15
diff --git a/tests/ui/feature-gates/feature-gate-rust-tail-cc.rs b/tests/ui/feature-gates/feature-gate-rust-tail-cc.rs
new file mode 100644
index 0000000..b2bbf60
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-rust-tail-cc.rs
@@ -0,0 +1,21 @@
+#![crate_type = "lib"]
+
+extern "tail" fn apple() {} //~ ERROR "tail" ABI is experimental
+
+trait T {
+    extern "tail" fn banana(); //~ ERROR "tail" ABI is experimental
+    extern "tail" fn citrus() {} //~ ERROR "tail" ABI is experimental
+}
+
+struct S;
+impl T for S {
+    extern "tail" fn banana() {} //~ ERROR "tail" ABI is experimental
+}
+
+impl S {
+    extern "tail" fn durian() {} //~ ERROR "tail" ABI is experimental
+}
+
+type Fig = extern "tail" fn(); //~ ERROR "tail" ABI is experimental
+
+extern "tail" {} //~ ERROR "tail" ABI is experimental
diff --git a/tests/ui/feature-gates/feature-gate-rust-tail-cc.stderr b/tests/ui/feature-gates/feature-gate-rust-tail-cc.stderr
new file mode 100644
index 0000000..e588569
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-rust-tail-cc.stderr
@@ -0,0 +1,73 @@
+error[E0658]: the extern "tail" ABI is experimental and subject to change
+  --> $DIR/feature-gate-rust-tail-cc.rs:3:8
+   |
+LL | extern "tail" fn apple() {}
+   |        ^^^^^^
+   |
+   = note: see issue #157427 <https://github.com/rust-lang/rust/issues/157427> for more information
+   = help: add `#![feature(rust_tail_cc)]` 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]: the extern "tail" ABI is experimental and subject to change
+  --> $DIR/feature-gate-rust-tail-cc.rs:6:12
+   |
+LL |     extern "tail" fn banana();
+   |            ^^^^^^
+   |
+   = note: see issue #157427 <https://github.com/rust-lang/rust/issues/157427> for more information
+   = help: add `#![feature(rust_tail_cc)]` 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]: the extern "tail" ABI is experimental and subject to change
+  --> $DIR/feature-gate-rust-tail-cc.rs:7:12
+   |
+LL |     extern "tail" fn citrus() {}
+   |            ^^^^^^
+   |
+   = note: see issue #157427 <https://github.com/rust-lang/rust/issues/157427> for more information
+   = help: add `#![feature(rust_tail_cc)]` 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]: the extern "tail" ABI is experimental and subject to change
+  --> $DIR/feature-gate-rust-tail-cc.rs:12:12
+   |
+LL |     extern "tail" fn banana() {}
+   |            ^^^^^^
+   |
+   = note: see issue #157427 <https://github.com/rust-lang/rust/issues/157427> for more information
+   = help: add `#![feature(rust_tail_cc)]` 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]: the extern "tail" ABI is experimental and subject to change
+  --> $DIR/feature-gate-rust-tail-cc.rs:16:12
+   |
+LL |     extern "tail" fn durian() {}
+   |            ^^^^^^
+   |
+   = note: see issue #157427 <https://github.com/rust-lang/rust/issues/157427> for more information
+   = help: add `#![feature(rust_tail_cc)]` 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]: the extern "tail" ABI is experimental and subject to change
+  --> $DIR/feature-gate-rust-tail-cc.rs:19:19
+   |
+LL | type Fig = extern "tail" fn();
+   |                   ^^^^^^
+   |
+   = note: see issue #157427 <https://github.com/rust-lang/rust/issues/157427> for more information
+   = help: add `#![feature(rust_tail_cc)]` 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]: the extern "tail" ABI is experimental and subject to change
+  --> $DIR/feature-gate-rust-tail-cc.rs:21:8
+   |
+LL | extern "tail" {}
+   |        ^^^^^^
+   |
+   = note: see issue #157427 <https://github.com/rust-lang/rust/issues/157427> for more information
+   = help: add `#![feature(rust_tail_cc)]` 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: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-xtensa-target-feature.rs b/tests/ui/feature-gates/feature-gate-xtensa-target-feature.rs
new file mode 100644
index 0000000..e9d6a35
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-xtensa-target-feature.rs
@@ -0,0 +1,14 @@
+//@ add-minicore
+//@ needs-llvm-components: xtensa
+//@ min-llvm-version: 22
+//@ compile-flags: --target=xtensa-esp32-none-elf --crate-type=rlib
+//@ ignore-backends: gcc
+#![no_core]
+#![feature(no_core, lang_items)]
+
+extern crate minicore;
+use minicore::*;
+
+#[target_feature(enable = "bool")]
+//~^ ERROR: currently unstable
+unsafe fn foo() {}
diff --git a/tests/ui/feature-gates/feature-gate-xtensa-target-feature.stderr b/tests/ui/feature-gates/feature-gate-xtensa-target-feature.stderr
new file mode 100644
index 0000000..1854fbb
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-xtensa-target-feature.stderr
@@ -0,0 +1,13 @@
+error[E0658]: the target feature `bool` is currently unstable
+  --> $DIR/feature-gate-xtensa-target-feature.rs:12:18
+   |
+LL | #[target_feature(enable = "bool")]
+   |                  ^^^^^^^^^^^^^^^
+   |
+   = note: see issue #157063 <https://github.com/rust-lang/rust/issues/157063> for more information
+   = help: add `#![feature(xtensa_target_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: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
index 093fb3a..180e44d 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
@@ -42,7 +42,10 @@
 #![allow(x5300)] //~ WARN unknown lint: `x5300`
 #![forbid(x5200)] //~ WARN unknown lint: `x5200`
 #![deny(x5100)] //~ WARN unknown lint: `x5100`
-#![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs)
+#![macro_use] //~ WARN attribute cannot be used on
+//~| WARN previously accepted
+//~| HELP can be applied to
+//~| HELP remove the attribute
 // skipping testing of cfg
 // skipping testing of cfg_attr
 #![should_panic] //~ WARN attribute cannot be used on
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
index 14d1ed6..cce3286 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
@@ -1,5 +1,5 @@
 warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:472:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:475:17
    |
 LL |     mod inner { #![macro_escape] }
    |                 ^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@
    = help: try an outer attribute: `#[macro_use]`
 
 warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:469:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:472:1
    |
 LL | #[macro_escape]
    | ^^^^^^^^^^^^^^^
@@ -43,151 +43,151 @@
    |         ^^^^^
 
 warning: unknown lint: `x5400`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:110:8
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:113:8
    |
 LL | #[warn(x5400)]
    |        ^^^^^
 
 warning: unknown lint: `x5400`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:113:25
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:116:25
    |
 LL |     mod inner { #![warn(x5400)] }
    |                         ^^^^^
 
 warning: unknown lint: `x5400`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:116:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:119:12
    |
 LL |     #[warn(x5400)] fn f() { }
    |            ^^^^^
 
 warning: unknown lint: `x5400`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:119:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:122:12
    |
 LL |     #[warn(x5400)] struct S;
    |            ^^^^^
 
 warning: unknown lint: `x5400`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:122:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:125:12
    |
 LL |     #[warn(x5400)] type T = S;
    |            ^^^^^
 
 warning: unknown lint: `x5400`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:125:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:128:12
    |
 LL |     #[warn(x5400)] impl S { }
    |            ^^^^^
 
 warning: unknown lint: `x5300`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:129:9
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:132:9
    |
 LL | #[allow(x5300)]
    |         ^^^^^
 
 warning: unknown lint: `x5300`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:132:26
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:135:26
    |
 LL |     mod inner { #![allow(x5300)] }
    |                          ^^^^^
 
 warning: unknown lint: `x5300`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:135:13
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:138:13
    |
 LL |     #[allow(x5300)] fn f() { }
    |             ^^^^^
 
 warning: unknown lint: `x5300`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:138:13
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:141:13
    |
 LL |     #[allow(x5300)] struct S;
    |             ^^^^^
 
 warning: unknown lint: `x5300`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:141:13
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:144:13
    |
 LL |     #[allow(x5300)] type T = S;
    |             ^^^^^
 
 warning: unknown lint: `x5300`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:144:13
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:147:13
    |
 LL |     #[allow(x5300)] impl S { }
    |             ^^^^^
 
 warning: unknown lint: `x5200`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:148:10
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:151:10
    |
 LL | #[forbid(x5200)]
    |          ^^^^^
 
 warning: unknown lint: `x5200`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:151:27
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:154:27
    |
 LL |     mod inner { #![forbid(x5200)] }
    |                           ^^^^^
 
 warning: unknown lint: `x5200`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:154:14
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:157:14
    |
 LL |     #[forbid(x5200)] fn f() { }
    |              ^^^^^
 
 warning: unknown lint: `x5200`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:157:14
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:160:14
    |
 LL |     #[forbid(x5200)] struct S;
    |              ^^^^^
 
 warning: unknown lint: `x5200`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:160:14
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:163:14
    |
 LL |     #[forbid(x5200)] type T = S;
    |              ^^^^^
 
 warning: unknown lint: `x5200`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:163:14
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:166:14
    |
 LL |     #[forbid(x5200)] impl S { }
    |              ^^^^^
 
 warning: unknown lint: `x5100`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:167:8
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:170:8
    |
 LL | #[deny(x5100)]
    |        ^^^^^
 
 warning: unknown lint: `x5100`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:170:25
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:173:25
    |
 LL |     mod inner { #![deny(x5100)] }
    |                         ^^^^^
 
 warning: unknown lint: `x5100`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:173:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:176:12
    |
 LL |     #[deny(x5100)] fn f() { }
    |            ^^^^^
 
 warning: unknown lint: `x5100`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:176:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:179:12
    |
 LL |     #[deny(x5100)] struct S;
    |            ^^^^^
 
 warning: unknown lint: `x5100`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:179:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:182:12
    |
 LL |     #[deny(x5100)] type T = S;
    |            ^^^^^
 
 warning: unknown lint: `x5100`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:182:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:185:12
    |
 LL |     #[deny(x5100)] impl S { }
    |            ^^^^^
 
 warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:99:12
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:102:12
    |
 LL | #![feature(rust1)]
    |            ^^^^^
@@ -195,7 +195,7 @@
    = note: `#[warn(stable_features)]` on by default
 
 warning: attribute should be applied to an `extern` block with non-Rust ABI
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:722:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:5
    |
 LL |     #[link(name = "x")] extern "Rust" {}
    |     ^^^^^^^^^^^^^^^^^^^
@@ -208,43 +208,43 @@
    |         ^^^^^^^^^^^^^^^^^
 
 warning: `#[macro_use]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:190:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:193:5
    |
 LL |     #[macro_use] fn f() { }
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_use]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:196:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:199:5
    |
 LL |     #[macro_use] struct S;
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_use]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:202:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:205:5
    |
 LL |     #[macro_use] type T = S;
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_use]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:208:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:211:5
    |
 LL |     #[macro_use] impl S { }
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_export]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:215:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:218:1
    |
 LL | #[macro_export]
    | ^^^^^^^^^^^^^^^
@@ -253,7 +253,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_export]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:221:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:224:17
    |
 LL |     mod inner { #![macro_export] }
    |                 ^^^^^^^^^^^^^^^^
@@ -262,7 +262,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_export]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:227:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:230:5
    |
 LL |     #[macro_export] fn f() { }
    |     ^^^^^^^^^^^^^^^
@@ -271,7 +271,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_export]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:233:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:236:5
    |
 LL |     #[macro_export] struct S;
    |     ^^^^^^^^^^^^^^^
@@ -280,7 +280,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_export]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:239:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:242:5
    |
 LL |     #[macro_export] type T = S;
    |     ^^^^^^^^^^^^^^^
@@ -289,7 +289,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_export]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:245:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:248:5
    |
 LL |     #[macro_export] impl S { }
    |     ^^^^^^^^^^^^^^^
@@ -298,7 +298,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[path]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:256:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5
    |
 LL |     #[path = "3800"] fn f() { }
    |     ^^^^^^^^^^^^^^^^
@@ -307,7 +307,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[path]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:262:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:265:5
    |
 LL |     #[path = "3800"]  struct S;
    |     ^^^^^^^^^^^^^^^^
@@ -316,7 +316,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[path]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:268:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5
    |
 LL |     #[path = "3800"] type T = S;
    |     ^^^^^^^^^^^^^^^^
@@ -325,7 +325,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[path]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5
    |
 LL |     #[path = "3800"] impl S { }
    |     ^^^^^^^^^^^^^^^^
@@ -334,7 +334,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[automatically_derived]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:281:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:284:1
    |
 LL | #[automatically_derived]
    | ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -343,7 +343,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[automatically_derived]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:287:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:290:17
    |
 LL |     mod inner { #![automatically_derived] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -352,7 +352,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[automatically_derived]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:293:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:296:5
    |
 LL |     #[automatically_derived] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -361,7 +361,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[automatically_derived]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:299:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:302:5
    |
 LL |     #[automatically_derived] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -370,7 +370,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[automatically_derived]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:305:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:5
    |
 LL |     #[automatically_derived] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -379,7 +379,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[automatically_derived]` attribute cannot be used on traits
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:311:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:314:5
    |
 LL |     #[automatically_derived] trait W { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -388,7 +388,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[automatically_derived]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:320:5
    |
 LL |     #[automatically_derived] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -397,7 +397,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_mangle]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:326:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:1
    |
 LL | #[no_mangle]
    | ^^^^^^^^^^^^
@@ -406,7 +406,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_mangle]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:332:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:17
    |
 LL |     mod inner { #![no_mangle] }
    |                 ^^^^^^^^^^^^^
@@ -415,7 +415,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_mangle]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:340:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:343:5
    |
 LL |     #[no_mangle] struct S;
    |     ^^^^^^^^^^^^
@@ -424,7 +424,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_mangle]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:346:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:5
    |
 LL |     #[no_mangle] type T = S;
    |     ^^^^^^^^^^^^
@@ -433,7 +433,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_mangle]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:352:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5
    |
 LL |     #[no_mangle] impl S { }
    |     ^^^^^^^^^^^^
@@ -442,7 +442,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_mangle]` attribute cannot be used on required trait methods
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:359:9
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:9
    |
 LL |         #[no_mangle] fn foo();
    |         ^^^^^^^^^^^^
@@ -451,7 +451,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_mangle]` attribute cannot be used on provided trait methods
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:9
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:9
    |
 LL |         #[no_mangle] fn bar() {}
    |         ^^^^^^^^^^^^
@@ -460,7 +460,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[should_panic]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:373:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:1
    |
 LL | #[should_panic]
    | ^^^^^^^^^^^^^^^
@@ -469,7 +469,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[should_panic]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:17
    |
 LL |     mod inner { #![should_panic] }
    |                 ^^^^^^^^^^^^^^^^
@@ -478,7 +478,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[should_panic]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:387:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:390:5
    |
 LL |     #[should_panic] struct S;
    |     ^^^^^^^^^^^^^^^
@@ -487,7 +487,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[should_panic]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:393:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:396:5
    |
 LL |     #[should_panic] type T = S;
    |     ^^^^^^^^^^^^^^^
@@ -496,7 +496,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[should_panic]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:399:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:5
    |
 LL |     #[should_panic] impl S { }
    |     ^^^^^^^^^^^^^^^
@@ -505,7 +505,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[ignore]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:406:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:1
    |
 LL | #[ignore]
    | ^^^^^^^^^
@@ -514,7 +514,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[ignore]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:412:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:415:17
    |
 LL |     mod inner { #![ignore] }
    |                 ^^^^^^^^^^
@@ -523,7 +523,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[ignore]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:420:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5
    |
 LL |     #[ignore] struct S;
    |     ^^^^^^^^^
@@ -532,7 +532,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[ignore]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:426:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:5
    |
 LL |     #[ignore] type T = S;
    |     ^^^^^^^^^
@@ -541,7 +541,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[ignore]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5
    |
 LL |     #[ignore] impl S { }
    |     ^^^^^^^^^
@@ -550,7 +550,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_implicit_prelude]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:443:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:5
    |
 LL |     #[no_implicit_prelude] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
@@ -559,7 +559,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_implicit_prelude]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:449:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5
    |
 LL |     #[no_implicit_prelude] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
@@ -568,7 +568,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_implicit_prelude]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:455:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:5
    |
 LL |     #[no_implicit_prelude] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
@@ -577,7 +577,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[no_implicit_prelude]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:461:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:5
    |
 LL |     #[no_implicit_prelude] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
@@ -586,49 +586,49 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_escape]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:5
    |
 LL |     #[macro_escape] fn f() { }
    |     ^^^^^^^^^^^^^^^
    |
-   = help: `#[macro_escape]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_escape]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_escape]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:482:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:485:5
    |
 LL |     #[macro_escape] struct S;
    |     ^^^^^^^^^^^^^^^
    |
-   = help: `#[macro_escape]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_escape]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_escape]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:491:5
    |
 LL |     #[macro_escape] type T = S;
    |     ^^^^^^^^^^^^^^^
    |
-   = help: `#[macro_escape]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_escape]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_escape]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:497:5
    |
 LL |     #[macro_escape] impl S { }
    |     ^^^^^^^^^^^^^^^
    |
-   = help: `#[macro_escape]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_escape]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:501:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:504:1
    |
 LL | #[no_std]
    | ^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:503:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:506:1
    |
 LL | / mod no_std {
 LL | |
@@ -638,61 +638,61 @@
    | |_^
 
 warning: the `#![no_std]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:505:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:508:17
    |
 LL |     mod inner { #![no_std] }
    |                 ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:508:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:511:5
    |
 LL |     #[no_std] fn f() { }
    |     ^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:508:15
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:511:15
    |
 LL |     #[no_std] fn f() { }
    |               ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:5
    |
 LL |     #[no_std] struct S;
    |     ^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:15
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:15
    |
 LL |     #[no_std] struct S;
    |               ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:516:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:5
    |
 LL |     #[no_std] type T = S;
    |     ^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:516:15
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:15
    |
 LL |     #[no_std] type T = S;
    |               ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:520:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:5
    |
 LL |     #[no_std] impl S { }
    |     ^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:520:15
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:15
    |
 LL |     #[no_std] impl S { }
    |               ^^^^^^^^^^
 
 warning: `#[cold]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:542:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:545:1
    |
 LL | #[cold]
    | ^^^^^^^
@@ -701,7 +701,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[cold]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:549:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:552:17
    |
 LL |     mod inner { #![cold] }
    |                 ^^^^^^^^
@@ -710,7 +710,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[cold]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:557:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:560:5
    |
 LL |     #[cold] struct S;
    |     ^^^^^^^
@@ -719,7 +719,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[cold]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:563:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:566:5
    |
 LL |     #[cold] type T = S;
    |     ^^^^^^^
@@ -728,7 +728,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[cold]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:569:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:572:5
    |
 LL |     #[cold] impl S { }
    |     ^^^^^^^
@@ -737,7 +737,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_name]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:576:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:579:1
    |
 LL | #[link_name = "1900"]
    | ^^^^^^^^^^^^^^^^^^^^^
@@ -746,7 +746,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_name]` attribute cannot be used on foreign modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:582:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:585:5
    |
 LL |     #[link_name = "1900"]
    |     ^^^^^^^^^^^^^^^^^^^^^
@@ -755,7 +755,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_name]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:589:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:592:17
    |
 LL |     mod inner { #![link_name="1900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^
@@ -764,7 +764,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_name]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:595:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:598:5
    |
 LL |     #[link_name = "1900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^
@@ -773,7 +773,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_name]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:601:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:604:5
    |
 LL |     #[link_name = "1900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^
@@ -782,7 +782,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_name]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:607:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:610:5
    |
 LL |     #[link_name = "1900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^
@@ -791,7 +791,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_name]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:613:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:616:5
    |
 LL |     #[link_name = "1900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^
@@ -800,7 +800,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_section]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:1
    |
 LL | #[link_section = ",1800"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -809,7 +809,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_section]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:626:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:629:17
    |
 LL |     mod inner { #![link_section=",1800"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -818,7 +818,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_section]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:634:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:637:5
    |
 LL |     #[link_section = ",1800"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -827,7 +827,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_section]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:640:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5
    |
 LL |     #[link_section = ",1800"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -836,7 +836,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_section]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:5
    |
 LL |     #[link_section = ",1800"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -845,7 +845,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_section]` attribute cannot be used on traits
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5
    |
 LL |     #[link_section = ",1800"]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -854,7 +854,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_section]` attribute cannot be used on required trait methods
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:9
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:661:9
    |
 LL |         #[link_section = ",1800"]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -863,7 +863,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:1
    |
 LL | #[link(name = "x")]
    | ^^^^^^^^^^^^^^^^^^^
@@ -872,7 +872,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:692:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:17
    |
 LL |     mod inner { #![link(name = "x")] }
    |                 ^^^^^^^^^^^^^^^^^^^^
@@ -881,7 +881,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:698:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5
    |
 LL |     #[link(name = "x")] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^
@@ -890,7 +890,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5
    |
 LL |     #[link(name = "x")] struct S;
    |     ^^^^^^^^^^^^^^^^^^^
@@ -899,7 +899,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:713:5
    |
 LL |     #[link(name = "x")] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^
@@ -908,7 +908,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5
    |
 LL |     #[link(name = "x")] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^
@@ -917,7 +917,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[must_use]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:742:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:1
    |
 LL | #[must_use]
    | ^^^^^^^^^^^
@@ -926,7 +926,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[must_use]` attribute cannot be used on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:747:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:17
    |
 LL |     mod inner { #![must_use] }
    |                 ^^^^^^^^^^^^
@@ -935,7 +935,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[must_use]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5
    |
 LL |     #[must_use] type T = S;
    |     ^^^^^^^^^^^
@@ -944,7 +944,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[must_use]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:5
    |
 LL |     #[must_use] impl S { }
    |     ^^^^^^^^^^^
@@ -953,13 +953,13 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1
    |
 LL | #[windows_subsystem = "windows"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:769:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:772:1
    |
 LL | / mod windows_subsystem {
 LL | |
@@ -969,67 +969,67 @@
    | |_^
 
 warning: the `#![windows_subsystem]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:771:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17
    |
 LL |     mod inner { #![windows_subsystem="windows"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:5
    |
 LL |     #[windows_subsystem = "windows"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:38
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:38
    |
 LL |     #[windows_subsystem = "windows"] fn f() { }
    |                                      ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:5
    |
 LL |     #[windows_subsystem = "windows"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:38
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:38
    |
 LL |     #[windows_subsystem = "windows"] struct S;
    |                                      ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:5
    |
 LL |     #[windows_subsystem = "windows"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:38
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:38
    |
 LL |     #[windows_subsystem = "windows"] type T = S;
    |                                      ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:5
    |
 LL |     #[windows_subsystem = "windows"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:38
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:38
    |
 LL |     #[windows_subsystem = "windows"] impl S { }
    |                                      ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:1
    |
 LL | #[crate_name = "0900"]
    | ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:795:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:798:1
    |
 LL | / mod crate_name {
 LL | |
@@ -1039,67 +1039,67 @@
    | |_^
 
 warning: the `#![crate_name]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:17
    |
 LL |     mod inner { #![crate_name="0900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:803:5
    |
 LL |     #[crate_name = "0900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:28
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:803:28
    |
 LL |     #[crate_name = "0900"] fn f() { }
    |                            ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:5
    |
 LL |     #[crate_name = "0900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:28
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:28
    |
 LL |     #[crate_name = "0900"] struct S;
    |                            ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:5
    |
 LL |     #[crate_name = "0900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:28
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:28
    |
 LL |     #[crate_name = "0900"] type T = S;
    |                            ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:812:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:815:5
    |
 LL |     #[crate_name = "0900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:812:28
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:815:28
    |
 LL |     #[crate_name = "0900"] impl S { }
    |                            ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:820:1
    |
 LL | #[crate_type = "0800"]
    | ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:819:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:822:1
    |
 LL | / mod crate_type {
 LL | |
@@ -1109,67 +1109,67 @@
    | |_^
 
 warning: the `#![crate_type]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:824:17
    |
 LL |     mod inner { #![crate_type="0800"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:824:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:827:5
    |
 LL |     #[crate_type = "0800"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:824:28
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:827:28
    |
 LL |     #[crate_type = "0800"] fn f() { }
    |                            ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:828:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:831:5
    |
 LL |     #[crate_type = "0800"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:828:28
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:831:28
    |
 LL |     #[crate_type = "0800"] struct S;
    |                            ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:832:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:835:5
    |
 LL |     #[crate_type = "0800"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:832:28
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:835:28
    |
 LL |     #[crate_type = "0800"] type T = S;
    |                            ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:836:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:839:5
    |
 LL |     #[crate_type = "0800"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:836:28
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:839:28
    |
 LL |     #[crate_type = "0800"] impl S { }
    |                            ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:841:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:844:1
    |
 LL | #[feature(x0600)]
    | ^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:843:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:846:1
    |
 LL | / mod feature {
 LL | |
@@ -1179,67 +1179,67 @@
    | |_^
 
 warning: the `#![feature]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:845:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:848:17
    |
 LL |     mod inner { #![feature(x0600)] }
    |                 ^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:848:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:851:5
    |
 LL |     #[feature(x0600)] fn f() { }
    |     ^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:848:23
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:851:23
    |
 LL |     #[feature(x0600)] fn f() { }
    |                       ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:852:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:855:5
    |
 LL |     #[feature(x0600)] struct S;
    |     ^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:852:23
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:855:23
    |
 LL |     #[feature(x0600)] struct S;
    |                       ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:856:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:859:5
    |
 LL |     #[feature(x0600)] type T = S;
    |     ^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:856:23
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:859:23
    |
 LL |     #[feature(x0600)] type T = S;
    |                       ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:860:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:863:5
    |
 LL |     #[feature(x0600)] impl S { }
    |     ^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:860:23
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:863:23
    |
 LL |     #[feature(x0600)] impl S { }
    |                       ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:866:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:869:1
    |
 LL | #[no_main]
    | ^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:868:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:871:1
    |
 LL | / mod no_main_1 {
 LL | |
@@ -1249,67 +1249,67 @@
    | |_^
 
 warning: the `#![no_main]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:870:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:873:17
    |
 LL |     mod inner { #![no_main] }
    |                 ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:873:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:876:5
    |
 LL |     #[no_main] fn f() { }
    |     ^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:873:16
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:876:16
    |
 LL |     #[no_main] fn f() { }
    |                ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:877:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:880:5
    |
 LL |     #[no_main] struct S;
    |     ^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:877:16
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:880:16
    |
 LL |     #[no_main] struct S;
    |                ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:881:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:884:5
    |
 LL |     #[no_main] type T = S;
    |     ^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:881:16
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:884:16
    |
 LL |     #[no_main] type T = S;
    |                ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:885:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:888:5
    |
 LL |     #[no_main] impl S { }
    |     ^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:885:16
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:888:16
    |
 LL |     #[no_main] impl S { }
    |                ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:890:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:893:1
    |
 LL | #[no_builtins]
    | ^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:892:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:895:1
    |
 LL | / mod no_builtins {
 LL | |
@@ -1319,67 +1319,67 @@
    | |_^
 
 warning: the `#![no_builtins]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:894:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:897:17
    |
 LL |     mod inner { #![no_builtins] }
    |                 ^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:897:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:900:5
    |
 LL |     #[no_builtins] fn f() { }
    |     ^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:897:20
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:900:20
    |
 LL |     #[no_builtins] fn f() { }
    |                    ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:901:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:904:5
    |
 LL |     #[no_builtins] struct S;
    |     ^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:901:20
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:904:20
    |
 LL |     #[no_builtins] struct S;
    |                    ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:905:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:908:5
    |
 LL |     #[no_builtins] type T = S;
    |     ^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:905:20
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:908:20
    |
 LL |     #[no_builtins] type T = S;
    |                    ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:909:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:912:5
    |
 LL |     #[no_builtins] impl S { }
    |     ^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:909:20
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:912:20
    |
 LL |     #[no_builtins] impl S { }
    |                    ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:914:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:917:1
    |
 LL | #[recursion_limit="0200"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:916:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:919:1
    |
 LL | / mod recursion_limit {
 LL | |
@@ -1389,67 +1389,67 @@
    | |_^
 
 warning: the `#![recursion_limit]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:918:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:921:17
    |
 LL |     mod inner { #![recursion_limit="0200"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:921:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:924:5
    |
 LL |     #[recursion_limit="0200"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:921:31
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:924:31
    |
 LL |     #[recursion_limit="0200"] fn f() { }
    |                               ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:925:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:928:5
    |
 LL |     #[recursion_limit="0200"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:925:31
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:928:31
    |
 LL |     #[recursion_limit="0200"] struct S;
    |                               ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:929:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:932:5
    |
 LL |     #[recursion_limit="0200"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:929:31
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:932:31
    |
 LL |     #[recursion_limit="0200"] type T = S;
    |                               ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:933:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:936:5
    |
 LL |     #[recursion_limit="0200"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:933:31
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:936:31
    |
 LL |     #[recursion_limit="0200"] impl S { }
    |                               ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:938:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:941:1
    |
 LL | #[type_length_limit="0100"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:940:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:943:1
    |
 LL | / mod type_length_limit {
 LL | |
@@ -1459,61 +1459,70 @@
    | |_^
 
 warning: the `#![type_length_limit]` attribute can only be used at the crate root
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:942:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:945:17
    |
 LL |     mod inner { #![type_length_limit="0100"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:945:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:948:5
    |
 LL |     #[type_length_limit="0100"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:945:33
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:948:33
    |
 LL |     #[type_length_limit="0100"] fn f() { }
    |                                 ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:949:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:952:5
    |
 LL |     #[type_length_limit="0100"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this struct
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:949:33
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:952:33
    |
 LL |     #[type_length_limit="0100"] struct S;
    |                                 ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:953:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:956:5
    |
 LL |     #[type_length_limit="0100"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this type alias
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:953:33
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:956:33
    |
 LL |     #[type_length_limit="0100"] type T = S;
    |                                 ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:957:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:960:5
    |
 LL |     #[type_length_limit="0100"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: this attribute does not have an `!`, which means it is applied to this implementation block
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:957:33
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:960:33
    |
 LL |     #[type_length_limit="0100"] impl S { }
    |                                 ^^^^^^^^^^
 
+warning: `#[macro_use]` attribute cannot be used on crates
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:45:1
+   |
+LL | #![macro_use]
+   | ^^^^^^^^^^^^^
+   |
+   = help: `#[macro_use]` can be applied to extern crates and modules
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
 warning: `#[should_panic]` attribute cannot be used on crates
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:48:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:1
    |
 LL | #![should_panic]
    | ^^^^^^^^^^^^^^^^
@@ -1522,7 +1531,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[ignore]` attribute cannot be used on crates
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1
    |
 LL | #![ignore]
    | ^^^^^^^^^^
@@ -1531,7 +1540,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[proc_macro_derive]` attribute cannot be used on crates
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1
    |
 LL | #![proc_macro_derive(Test)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1540,7 +1549,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[cold]` attribute cannot be used on crates
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1
    |
 LL | #![cold]
    | ^^^^^^^^
@@ -1549,7 +1558,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link]` attribute cannot be used on crates
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:69:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1
    |
 LL | #![link(name = "x")]
    | ^^^^^^^^^^^^^^^^^^^^
@@ -1558,7 +1567,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_name]` attribute cannot be used on crates
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:73:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:76:1
    |
 LL | #![link_name = "1900"]
    | ^^^^^^^^^^^^^^^^^^^^^^
@@ -1567,7 +1576,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[link_section]` attribute cannot be used on crates
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:78:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:81:1
    |
 LL | #![link_section = ",1800"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1576,7 +1585,7 @@
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[must_use]` attribute cannot be used on crates
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:83:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:86:1
    |
 LL | #![must_use]
    | ^^^^^^^^^^^^
@@ -1584,5 +1593,5 @@
    = help: `#[must_use]` can be applied to data types, functions, and traits
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-warning: 169 warnings emitted
+warning: 170 warnings emitted
 
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_escape.rs b/tests/ui/feature-gates/issue-43106-gating-of-macro_escape.rs
index f976e46..5f8903a 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-macro_escape.rs
+++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_escape.rs
@@ -7,5 +7,7 @@
 
 #![macro_escape]
 //~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
+//~| WARN cannot be used on crates
+//~| WARN previously accepted
 
 fn main() {}
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_escape.stderr b/tests/ui/feature-gates/issue-43106-gating-of-macro_escape.stderr
index 0eaec52..6a8c4b1 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-macro_escape.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_escape.stderr
@@ -6,5 +6,15 @@
    |
    = help: try an outer attribute: `#[macro_use]`
 
-warning: 1 warning emitted
+warning: `#[macro_escape]` attribute cannot be used on crates
+  --> $DIR/issue-43106-gating-of-macro_escape.rs:8:1
+   |
+LL | #![macro_escape]
+   | ^^^^^^^^^^^^^^^^
+   |
+   = help: `#[macro_escape]` can be applied to extern crates and modules
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: requested on the command line with `-W unused-attributes`
+
+warning: 2 warnings emitted
 
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs
index 274faa4..32cde9e 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs
+++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs
@@ -5,6 +5,8 @@
 
 #![macro_use(my_macro)]
 //~^ ERROR arguments to `macro_use` are not allowed here
+//~| WARN cannot be used on
+//~| WARN previously accepted
 
 #[macro_use(my_macro)]
 //~^ ERROR arguments to `macro_use` are not allowed here
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr
index 65d2b70..cae6a9a 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr
@@ -1,11 +1,11 @@
 error: arguments to `macro_use` are not allowed here
-  --> $DIR/issue-43106-gating-of-macro_use.rs:12:17
+  --> $DIR/issue-43106-gating-of-macro_use.rs:14:17
    |
 LL |     mod inner { #![macro_use(my_macro)] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^
 
 error: arguments to `macro_use` are not allowed here
-  --> $DIR/issue-43106-gating-of-macro_use.rs:9:1
+  --> $DIR/issue-43106-gating-of-macro_use.rs:11:1
    |
 LL | #[macro_use(my_macro)]
    | ^^^^^^^^^^^^^^^^^^^^^^
@@ -17,7 +17,7 @@
    | ^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0539]: malformed `macro_use` attribute input
-  --> $DIR/issue-43106-gating-of-macro_use.rs:15:5
+  --> $DIR/issue-43106-gating-of-macro_use.rs:17:5
    |
 LL |     #[macro_use = "2700"] struct S;
    |     ^^^^^^^^^^^^--------^
@@ -35,42 +35,51 @@
    |
 
 warning: `#[macro_use]` attribute cannot be used on structs
-  --> $DIR/issue-43106-gating-of-macro_use.rs:15:5
+  --> $DIR/issue-43106-gating-of-macro_use.rs:17:5
    |
 LL |     #[macro_use = "2700"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: requested on the command line with `-W unused-attributes`
 
 warning: `#[macro_use]` attribute cannot be used on functions
-  --> $DIR/issue-43106-gating-of-macro_use.rs:20:5
+  --> $DIR/issue-43106-gating-of-macro_use.rs:22:5
    |
 LL |     #[macro_use] fn f() { }
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_use]` attribute cannot be used on type aliases
-  --> $DIR/issue-43106-gating-of-macro_use.rs:24:5
+  --> $DIR/issue-43106-gating-of-macro_use.rs:26:5
    |
 LL |     #[macro_use] type T = S;
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[macro_use]` attribute cannot be used on inherent impl blocks
-  --> $DIR/issue-43106-gating-of-macro_use.rs:28:5
+  --> $DIR/issue-43106-gating-of-macro_use.rs:30:5
    |
 LL |     #[macro_use] impl S { }
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
-error: aborting due to 4 previous errors; 4 warnings emitted
+warning: `#[macro_use]` attribute cannot be used on crates
+  --> $DIR/issue-43106-gating-of-macro_use.rs:6:1
+   |
+LL | #![macro_use(my_macro)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: `#[macro_use]` can be applied to extern crates and modules
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: aborting due to 4 previous errors; 5 warnings emitted
 
 For more information about this error, try `rustc --explain E0539`.
diff --git a/tests/ui/issues/issue-20313-rpass.rs b/tests/ui/feature-gates/link-llvm-intrinsics-enabled.rs
similarity index 73%
rename from tests/ui/issues/issue-20313-rpass.rs
rename to tests/ui/feature-gates/link-llvm-intrinsics-enabled.rs
index a9cd0cb..9118950 100644
--- a/tests/ui/issues/issue-20313-rpass.rs
+++ b/tests/ui/feature-gates/link-llvm-intrinsics-enabled.rs
@@ -1,3 +1,5 @@
+//! <https://github.com/rust-lang/rust/issues/20313>.
+
 //@ run-pass
 #![allow(dead_code)]
 #![feature(link_llvm_intrinsics)]
diff --git a/tests/ui/issues/issue-20313.rs b/tests/ui/feature-gates/link-llvm-intrinsics-no-gate.rs
similarity index 71%
rename from tests/ui/issues/issue-20313.rs
rename to tests/ui/feature-gates/link-llvm-intrinsics-no-gate.rs
index a72af65..2b50e16 100644
--- a/tests/ui/issues/issue-20313.rs
+++ b/tests/ui/feature-gates/link-llvm-intrinsics-no-gate.rs
@@ -1,3 +1,5 @@
+//! <https://github.com/rust-lang/rust/issues/20313>.
+
 extern "C" {
     #[link_name = "llvm.sqrt.f32"]
     fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental
diff --git a/tests/ui/issues/issue-20313.stderr b/tests/ui/feature-gates/link-llvm-intrinsics-no-gate.stderr
similarity index 91%
rename from tests/ui/issues/issue-20313.stderr
rename to tests/ui/feature-gates/link-llvm-intrinsics-no-gate.stderr
index a614954..26e756f 100644
--- a/tests/ui/issues/issue-20313.stderr
+++ b/tests/ui/feature-gates/link-llvm-intrinsics-no-gate.stderr
@@ -1,5 +1,5 @@
 error[E0658]: linking to LLVM intrinsics is experimental
-  --> $DIR/issue-20313.rs:3:5
+  --> $DIR/link-llvm-intrinsics-no-gate.rs:5:5
    |
 LL |     fn sqrt(x: f32) -> f32;
    |     ^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/issues/issue-20225.rs b/tests/ui/fn_traits/fn-impl-mismatched-param-type.rs
similarity index 86%
rename from tests/ui/issues/issue-20225.rs
rename to tests/ui/fn_traits/fn-impl-mismatched-param-type.rs
index 0c8e6e4..87f1279 100644
--- a/tests/ui/issues/issue-20225.rs
+++ b/tests/ui/fn_traits/fn-impl-mismatched-param-type.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/20225>.
+
 #![feature(fn_traits, unboxed_closures)]
 
 struct Foo;
diff --git a/tests/ui/issues/issue-20225.stderr b/tests/ui/fn_traits/fn-impl-mismatched-param-type.stderr
similarity index 92%
rename from tests/ui/issues/issue-20225.stderr
rename to tests/ui/fn_traits/fn-impl-mismatched-param-type.stderr
index 775f23d..b7aa3d2 100644
--- a/tests/ui/issues/issue-20225.stderr
+++ b/tests/ui/fn_traits/fn-impl-mismatched-param-type.stderr
@@ -1,5 +1,5 @@
 error[E0053]: method `call` has an incompatible type for trait
-  --> $DIR/issue-20225.rs:6:43
+  --> $DIR/fn-impl-mismatched-param-type.rs:8:43
    |
 LL | impl<'a, T> Fn<(&'a T,)> for Foo {
    |          - found this type parameter
@@ -14,7 +14,7 @@
    |                                            +++
 
 error[E0053]: method `call_mut` has an incompatible type for trait
-  --> $DIR/issue-20225.rs:11:51
+  --> $DIR/fn-impl-mismatched-param-type.rs:13:51
    |
 LL | impl<'a, T> FnMut<(&'a T,)> for Foo {
    |          - found this type parameter
@@ -29,7 +29,7 @@
    |                                                    +++
 
 error[E0053]: method `call_once` has an incompatible type for trait
-  --> $DIR/issue-20225.rs:18:47
+  --> $DIR/fn-impl-mismatched-param-type.rs:20:47
    |
 LL | impl<'a, T> FnOnce<(&'a T,)> for Foo {
    |          - found this type parameter
diff --git a/tests/ui/issues/issue-19982.rs b/tests/ui/fn_traits/manual-fn-impl-lifetime-elision.rs
similarity index 83%
rename from tests/ui/issues/issue-19982.rs
rename to tests/ui/fn_traits/manual-fn-impl-lifetime-elision.rs
index 4bace6d..550f917 100644
--- a/tests/ui/issues/issue-19982.rs
+++ b/tests/ui/fn_traits/manual-fn-impl-lifetime-elision.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19982>.
+
 //@ check-pass
 
 #![feature(fn_traits, unboxed_closures)]
diff --git a/tests/ui/generic-associated-types/equality-bound.rs b/tests/ui/generic-associated-types/equality-bound.rs
deleted file mode 100644
index c136a6d..0000000
--- a/tests/ui/generic-associated-types/equality-bound.rs
+++ /dev/null
@@ -1,82 +0,0 @@
-fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 {
-//~^ ERROR equality constraints are not yet supported in `where` clauses
-    panic!()
-}
-fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 {
-//~^ ERROR equality constraints are not yet supported in `where` clauses
-    panic!()
-}
-fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 {
-//~^ ERROR equality constraints are not yet supported in `where` clauses
-//~| ERROR cannot find type `I`
-    panic!()
-}
-
-use std::iter::FromIterator;
-
-struct X {}
-
-impl FromIterator<bool> for X {
-    fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A,
-        //~^ ERROR equality constraints are not yet supported in `where` clauses
-        //~| ERROR cannot find type `A` in this scope
-    {
-        todo!()
-    }
-}
-
-struct Y {}
-
-impl FromIterator<bool> for Y {
-    fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A,
-        //~^ ERROR equality constraints are not yet supported in `where` clauses
-        //~| ERROR cannot find type `A` in this scope
-    {
-        todo!()
-    }
-}
-
-struct Z {}
-
-impl FromIterator<bool> for Z {
-    fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A,
-        //~^ ERROR equality constraints are not yet supported in `where` clauses
-        //~| ERROR cannot find type `A` in this scope
-    {
-        todo!()
-    }
-}
-
-struct K {}
-
-impl FromIterator<bool> for K {
-    fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A,
-        //~^ ERROR equality constraints are not yet supported in `where` clauses
-        //~| ERROR cannot find type `A` in this scope
-    {
-        todo!()
-    }
-}
-
-struct L {}
-
-impl FromIterator<bool> for L {
-    fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator,
-        //~^ ERROR equality constraints are not yet supported in `where` clauses
-        //~| ERROR cannot find type `A` in this scope
-    {
-        todo!()
-    }
-}
-
-struct M {}
-
-impl FromIterator<bool> for M {
-    fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator,
-        //~^ ERROR equality constraints are not yet supported in `where` clauses
-        //~| ERROR cannot find type `A` in this scope
-    {
-        todo!()
-    }
-}
-fn main() {}
diff --git a/tests/ui/generic-associated-types/equality-bound.stderr b/tests/ui/generic-associated-types/equality-bound.stderr
deleted file mode 100644
index 0ceb5e3..0000000
--- a/tests/ui/generic-associated-types/equality-bound.stderr
+++ /dev/null
@@ -1,218 +0,0 @@
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:1:51
-   |
-LL | fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 {
-   |                                                   ^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `Iterator::Item` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL - fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 {
-LL + fn sum<I: Iterator<Item = (), Item = i32>>(i: I) -> i32  {
-   |
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:5:41
-   |
-LL | fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 {
-   |                                         ^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `Iterator::Item` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL - fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 {
-LL + fn sum2<I: Iterator<Item = i32>>(i: I) -> i32  {
-   |
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:9:41
-   |
-LL | fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 {
-   |                                         ^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:20:58
-   |
-LL |     fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A,
-   |                                                          ^^^^^^^^^^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL -     fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A,
-LL +     fn from_iter<T>(_: T) -> Self where T: IntoIterator<Item = A>,
-   |
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:31:58
-   |
-LL |     fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A,
-   |                                                          ^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL -     fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A,
-LL +     fn from_iter<T>(_: T) -> Self where T: IntoIterator<Item = A>,
-   |
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:42:55
-   |
-LL |     fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A,
-   |                                                       ^^^^^^^^^^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL -     fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A,
-LL +     fn from_iter<T: IntoIterator<Item = A>>(_: T) -> Self 
-   |
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:53:55
-   |
-LL |     fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A,
-   |                                                       ^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL -     fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A,
-LL +     fn from_iter<T: IntoIterator<Item = A>>(_: T) -> Self 
-   |
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:64:41
-   |
-LL |     fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator,
-   |                                         ^^^^^^^^^^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL -     fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator,
-LL +     fn from_iter<T>(_: T) -> Self where T: IntoIterator<Item = A>,
-   |
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/equality-bound.rs:75:41
-   |
-LL |     fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator,
-   |                                         ^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL -     fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator,
-LL +     fn from_iter<T>(_: T) -> Self where T: IntoIterator<Item = A>,
-   |
-
-error[E0425]: cannot find type `A` in this scope
-  --> $DIR/equality-bound.rs:20:79
-   |
-LL |     fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A,
-   |                                                                               ^
-...
-LL | struct K {}
-   | -------- similarly named struct `K` defined here
-   |
-help: a struct with a similar name exists
-   |
-LL -     fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A,
-LL +     fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = K,
-   |
-
-error[E0425]: cannot find type `A` in this scope
-  --> $DIR/equality-bound.rs:31:68
-   |
-LL |     fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A,
-   |                                                                    ^
-...
-LL | struct K {}
-   | -------- similarly named struct `K` defined here
-   |
-help: a struct with a similar name exists
-   |
-LL -     fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A,
-LL +     fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = K,
-   |
-
-error[E0425]: cannot find type `A` in this scope
-  --> $DIR/equality-bound.rs:42:76
-   |
-LL |     fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A,
-   |                                                                            ^
-...
-LL | struct K {}
-   | -------- similarly named struct `K` defined here
-   |
-help: a struct with a similar name exists
-   |
-LL -     fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A,
-LL +     fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = K,
-   |
-
-error[E0425]: cannot find type `A` in this scope
-  --> $DIR/equality-bound.rs:53:65
-   |
-LL | struct K {}
-   | -------- similarly named struct `K` defined here
-...
-LL |     fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A,
-   |                                                                 ^
-   |
-help: a struct with a similar name exists
-   |
-LL -     fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A,
-LL +     fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = K,
-   |
-
-error[E0425]: cannot find type `A` in this scope
-  --> $DIR/equality-bound.rs:64:62
-   |
-LL | struct K {}
-   | -------- similarly named struct `K` defined here
-...
-LL |     fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator,
-   |                                                              ^
-   |
-help: a struct with a similar name exists
-   |
-LL -     fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator,
-LL +     fn from_iter<T>(_: T) -> Self where IntoIterator::Item = K, T: IntoIterator,
-   |
-
-error[E0425]: cannot find type `A` in this scope
-  --> $DIR/equality-bound.rs:75:51
-   |
-LL | struct K {}
-   | -------- similarly named struct `K` defined here
-...
-LL |     fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator,
-   |                                                   ^
-   |
-help: a struct with a similar name exists
-   |
-LL -     fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator,
-LL +     fn from_iter<T>(_: T) -> Self where T::Item = K, T: IntoIterator,
-   |
-
-error[E0433]: cannot find type `I` in this scope
-  --> $DIR/equality-bound.rs:9:41
-   |
-LL | fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 {
-   |                                         ^ use of undeclared type `I`
-   |
-help: a type parameter with a similar name exists
-   |
-LL - fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 {
-LL + fn sum3<J: Iterator>(i: J) -> i32 where J::Item = i32 {
-   |
-
-error: aborting due to 16 previous errors
-
-Some errors have detailed explanations: E0425, E0433.
-For more information about an error, try `rustc --explain E0425`.
diff --git a/tests/ui/generic-associated-types/missing-bounds.fixed b/tests/ui/generic-associated-types/missing-bounds.fixed
index 15cdd44..7735031 100644
--- a/tests/ui/generic-associated-types/missing-bounds.fixed
+++ b/tests/ui/generic-associated-types/missing-bounds.fixed
@@ -36,12 +36,11 @@
 
 struct E<B>(B);
 
-impl<B: Add<Output = B>> Add for E<B> where B: Add<Output = B> {
-    //~^ ERROR equality constraints are not yet supported in `where` clauses
+impl<B: Add> Add for E<B> where B: Add<Output = B> {
     type Output = Self;
 
     fn add(self, rhs: Self) -> Self {
-        Self(self.0 + rhs.0) //~ ERROR mismatched types
+        Self(self.0 + rhs.0)
     }
 }
 
diff --git a/tests/ui/generic-associated-types/missing-bounds.rs b/tests/ui/generic-associated-types/missing-bounds.rs
index dad111c..0957674 100644
--- a/tests/ui/generic-associated-types/missing-bounds.rs
+++ b/tests/ui/generic-associated-types/missing-bounds.rs
@@ -36,12 +36,11 @@ fn add(self, rhs: Self) -> Self {
 
 struct E<B>(B);
 
-impl<B: Add> Add for E<B> where <B as Add>::Output = B {
-    //~^ ERROR equality constraints are not yet supported in `where` clauses
+impl<B: Add> Add for E<B> where B: Add<Output = B> {
     type Output = Self;
 
     fn add(self, rhs: Self) -> Self {
-        Self(self.0 + rhs.0) //~ ERROR mismatched types
+        Self(self.0 + rhs.0)
     }
 }
 
diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr
index 97b88c2..b930cfb 100644
--- a/tests/ui/generic-associated-types/missing-bounds.stderr
+++ b/tests/ui/generic-associated-types/missing-bounds.stderr
@@ -1,16 +1,3 @@
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/missing-bounds.rs:39:33
-   |
-LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
-   |                                 ^^^^^^^^^^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-help: if `Output` is an associated type you're trying to set, use the associated type binding syntax
-   |
-LL - impl<B: Add> Add for E<B> where <B as Add>::Output = B {
-LL + impl<B: Add> Add for E<B> where B: Add<Output = B> {
-   |
-
 error[E0308]: mismatched types
   --> $DIR/missing-bounds.rs:13:11
    |
@@ -77,30 +64,7 @@
 LL | impl<B: std::ops::Add<Output = B>> Add for D<B> {
    |       +++++++++++++++++++++++++++
 
-error[E0308]: mismatched types
-  --> $DIR/missing-bounds.rs:44:14
-   |
-LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
-   |      - expected this type parameter
-...
-LL |         Self(self.0 + rhs.0)
-   |         ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
-   |         |
-   |         arguments to this function are incorrect
-   |
-   = note: expected type parameter `B`
-             found associated type `<B as Add>::Output`
-note: tuple struct defined here
-  --> $DIR/missing-bounds.rs:37:8
-   |
-LL | struct E<B>(B);
-   |        ^
-help: consider further restricting this bound
-   |
-LL | impl<B: Add<Output = B>> Add for E<B> where <B as Add>::Output = B {
-   |            ++++++++++++
-
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0308, E0369.
 For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/issues/issue-19135.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-closure-lifetime-infer.rs
similarity index 78%
rename from tests/ui/issues/issue-19135.rs
rename to tests/ui/higher-ranked/trait-bounds/hrtb-closure-lifetime-infer.rs
index 4228851..d4d81a3 100644
--- a/tests/ui/issues/issue-19135.rs
+++ b/tests/ui/higher-ranked/trait-bounds/hrtb-closure-lifetime-infer.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19135>.
+
 //@ run-pass
 use std::marker::PhantomData;
 
diff --git a/tests/ui/issues/issue-19098.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-unused-lifetime.rs
similarity index 61%
rename from tests/ui/issues/issue-19098.rs
rename to tests/ui/higher-ranked/trait-bounds/hrtb-unused-lifetime.rs
index 97e8ca1..576d59d 100644
--- a/tests/ui/issues/issue-19098.rs
+++ b/tests/ui/higher-ranked/trait-bounds/hrtb-unused-lifetime.rs
@@ -1,3 +1,6 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19098>.
+//! Tests that we don't ICE from unused lifetime in HRTB.
+
 //@ check-pass
 pub trait Handler {
     fn handle(&self, _: &mut String);
diff --git a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg
index 6e68356..e3faf43 100644
--- a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg
+++ b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg
@@ -1,4 +1,4 @@
-<svg width="1188px" height="470px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="470px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { fill: #000000 }
diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs
index dd94458..4c3ec86 100644
--- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs
+++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs
@@ -29,7 +29,7 @@ impl X for Y {
     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {}
     //~^ ERROR method `line_stream` is not a member of trait `X`
     //[current]~^^ ERROR `()` is not a future
-    //[next]~^^^ ERROR: type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _`
+    //[next]~^^^ ERROR type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _` [E0271]
 }
 
 pub fn main() {}
diff --git a/tests/ui/imports/ambiguous-14.rs b/tests/ui/imports/ambiguous-14.rs
index ba2d7dc..b7203a2 100644
--- a/tests/ui/imports/ambiguous-14.rs
+++ b/tests/ui/imports/ambiguous-14.rs
@@ -22,5 +22,4 @@ mod g {
 fn main() {
     g::foo();
     //~^ ERROR `foo` is ambiguous
-    //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 }
diff --git a/tests/ui/imports/ambiguous-14.stderr b/tests/ui/imports/ambiguous-14.stderr
index 2ca10d2..327dd07 100644
--- a/tests/ui/imports/ambiguous-14.stderr
+++ b/tests/ui/imports/ambiguous-14.stderr
@@ -1,4 +1,4 @@
-error: `foo` is ambiguous
+error[E0659]: `foo` is ambiguous
   --> $DIR/ambiguous-14.rs:23:8
    |
 LL |     g::foo();
@@ -6,44 +6,18 @@
    |
    = note: ambiguous because of multiple glob imports of a name in the same module
 note: `foo` could refer to the function imported here
-  --> $DIR/ambiguous-14.rs:18:13
+  --> $DIR/ambiguous-14.rs:13:13
    |
 LL |     pub use a::*;
    |             ^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 note: `foo` could also refer to the function imported here
-  --> $DIR/ambiguous-14.rs:19:13
+  --> $DIR/ambiguous-14.rs:14:13
    |
-LL |     pub use f::*;
+LL |     pub use b::*;
    |             ^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
-   = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default
 
 error: aborting due to 1 previous error
 
-Future incompatibility report: Future breakage diagnostic:
-error: `foo` is ambiguous
-  --> $DIR/ambiguous-14.rs:23:8
-   |
-LL |     g::foo();
-   |        ^^^ ambiguous name
-   |
-   = note: ambiguous because of multiple glob imports of a name in the same module
-note: `foo` could refer to the function imported here
-  --> $DIR/ambiguous-14.rs:18:13
-   |
-LL |     pub use a::*;
-   |             ^^^^
-   = help: consider adding an explicit import of `foo` to disambiguate
-note: `foo` could also refer to the function imported here
-  --> $DIR/ambiguous-14.rs:19:13
-   |
-LL |     pub use f::*;
-   |             ^^^^
-   = help: consider adding an explicit import of `foo` to disambiguate
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
-   = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default
-
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/ambiguous-9.rs b/tests/ui/imports/ambiguous-9.rs
index 5879603..0e60a29 100644
--- a/tests/ui/imports/ambiguous-9.rs
+++ b/tests/ui/imports/ambiguous-9.rs
@@ -4,16 +4,16 @@ pub mod dsl {
     mod range {
         pub fn date_range() {}
     }
-    pub use self::range::*; //~ WARNING ambiguous glob re-exports
+    pub use self::range::*;
     use super::prelude::*;
 }
 
 pub mod prelude {
     mod t {
-      pub fn date_range() {}
+        pub fn date_range() {}
     }
-    pub use self::t::*; //~ WARNING ambiguous glob re-exports
-    pub use super::dsl::*;
+    pub use self::t::*;
+    pub use super::dsl::*; //~ WARNING ambiguous glob re-exports
 }
 
 use dsl::*;
@@ -22,5 +22,4 @@ pub fn date_range() {}
 fn main() {
     date_range();
     //~^ ERROR `date_range` is ambiguous
-    //~| ERROR `date_range` is ambiguous
 }
diff --git a/tests/ui/imports/ambiguous-9.stderr b/tests/ui/imports/ambiguous-9.stderr
index b6e4c30..0ffbeb7 100644
--- a/tests/ui/imports/ambiguous-9.stderr
+++ b/tests/ui/imports/ambiguous-9.stderr
@@ -6,56 +6,28 @@
    |
    = note: ambiguous because of multiple glob imports of a name in the same module
 note: `date_range` could refer to the function imported here
-  --> $DIR/ambiguous-9.rs:19:5
+  --> $DIR/ambiguous-9.rs:16:13
    |
-LL | use dsl::*;
-   |     ^^^^^^
+LL |     pub use super::dsl::*;
+   |             ^^^^^^^^^^^^^
    = help: consider adding an explicit import of `date_range` to disambiguate
 note: `date_range` could also refer to the function imported here
-  --> $DIR/ambiguous-9.rs:20:5
-   |
-LL | use prelude::*;
-   |     ^^^^^^^^^^
-   = help: consider adding an explicit import of `date_range` to disambiguate
-
-error[E0659]: `date_range` is ambiguous
-  --> $DIR/ambiguous-9.rs:23:5
-   |
-LL |     date_range();
-   |     ^^^^^^^^^^ ambiguous name
-   |
-   = note: ambiguous because of multiple glob imports of a name in the same module
-note: `date_range` could refer to the function imported here
-  --> $DIR/ambiguous-9.rs:7:13
-   |
-LL |     pub use self::range::*;
-   |             ^^^^^^^^^^^^^^
-   = help: consider adding an explicit import of `date_range` to disambiguate
-note: `date_range` could also refer to the function imported here
-  --> $DIR/ambiguous-9.rs:8:9
-   |
-LL |     use super::prelude::*;
-   |         ^^^^^^^^^^^^^^^^^
-   = help: consider adding an explicit import of `date_range` to disambiguate
-
-warning: ambiguous glob re-exports
-  --> $DIR/ambiguous-9.rs:7:13
-   |
-LL |     pub use self::range::*;
-   |             ^^^^^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here
-LL |     use super::prelude::*;
-   |         ----------------- but the name `date_range` in the value namespace is also re-exported here
-   |
-   = note: `#[warn(ambiguous_glob_reexports)]` on by default
-
-warning: ambiguous glob re-exports
   --> $DIR/ambiguous-9.rs:15:13
    |
 LL |     pub use self::t::*;
-   |             ^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here
-LL |     pub use super::dsl::*;
-   |             ------------- but the name `date_range` in the value namespace is also re-exported here
+   |             ^^^^^^^^^^
+   = help: consider adding an explicit import of `date_range` to disambiguate
 
-error: aborting due to 2 previous errors; 2 warnings emitted
+warning: ambiguous glob re-exports
+  --> $DIR/ambiguous-9.rs:16:13
+   |
+LL |     pub use self::t::*;
+   |             ---------- but the name `date_range` in the value namespace is also re-exported here
+LL |     pub use super::dsl::*;
+   |             ^^^^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here
+   |
+   = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+error: aborting due to 1 previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/bad-import-in-nested.stderr b/tests/ui/imports/bad-import-in-nested.stderr
index b6b1bc5..afd9c34 100644
--- a/tests/ui/imports/bad-import-in-nested.stderr
+++ b/tests/ui/imports/bad-import-in-nested.stderr
@@ -2,7 +2,9 @@
   --> $DIR/bad-import-in-nested.rs:10:21
    |
 LL |         use super::{super::C::D::AA, AA as _};
-   |                     ^^^^^^^^^^^^^^^ no `AA` in `C::D`
+   |                     ^^^^^^^^^^^^^--
+   |                                  |
+   |                                  no `AA` in `C::D`
    |
    = help: consider importing this type alias instead:
            crate::A::AA
@@ -20,7 +22,9 @@
   --> $DIR/bad-import-in-nested.rs:23:20
    |
 LL |     use crate::{A, C::BB};
-   |                    ^^^^^ no `BB` in `C`
+   |                    ^^^--
+   |                       |
+   |                       no `BB` in `C`
    |
    = help: consider importing this type alias instead:
            crate::A::BB
diff --git a/tests/ui/imports/bad-import-with-rename.stderr b/tests/ui/imports/bad-import-with-rename.stderr
index 45e359a..c50df45 100644
--- a/tests/ui/imports/bad-import-with-rename.stderr
+++ b/tests/ui/imports/bad-import-with-rename.stderr
@@ -2,7 +2,9 @@
   --> $DIR/bad-import-with-rename.rs:8:9
    |
 LL |     use crate::D::B as _;
-   |         ^^^^^^^^^^^^^^^^ no `B` in `D`
+   |         ^^^^^^^^^^-^^^^^
+   |                   |
+   |                   no `B` in `D`
    |
 help: consider importing this type alias instead
    |
@@ -14,7 +16,9 @@
   --> $DIR/bad-import-with-rename.rs:11:9
    |
 LL |     use crate::D::B2;
-   |         ^^^^^^^^^^^^ no `B2` in `D`
+   |         ^^^^^^^^^^--
+   |                   |
+   |                   no `B2` in `D`
    |
 help: consider importing this type alias instead
    |
diff --git a/tests/ui/imports/duplicate.rs b/tests/ui/imports/duplicate.rs
index 0a65288..be089db 100644
--- a/tests/ui/imports/duplicate.rs
+++ b/tests/ui/imports/duplicate.rs
@@ -35,7 +35,6 @@ fn main() {
     f::foo(); //~ ERROR `foo` is ambiguous
     g::foo();
     //~^ ERROR `foo` is ambiguous
-    //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 }
 
 mod ambiguous_module_errors {
diff --git a/tests/ui/imports/duplicate.stderr b/tests/ui/imports/duplicate.stderr
index f02d35b..7bff441 100644
--- a/tests/ui/imports/duplicate.stderr
+++ b/tests/ui/imports/duplicate.stderr
@@ -9,20 +9,20 @@
    = note: `foo` must be defined only once in the value namespace of this module
 
 error[E0659]: `foo` is ambiguous
-  --> $DIR/duplicate.rs:48:15
+  --> $DIR/duplicate.rs:47:15
    |
 LL |     use self::foo::bar;
    |               ^^^ ambiguous name
    |
    = note: ambiguous because of multiple glob imports of a name in the same module
 note: `foo` could refer to the module imported here
-  --> $DIR/duplicate.rs:45:9
+  --> $DIR/duplicate.rs:44:9
    |
 LL |     use self::m1::*;
    |         ^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 note: `foo` could also refer to the module imported here
-  --> $DIR/duplicate.rs:46:9
+  --> $DIR/duplicate.rs:45:9
    |
 LL |     use self::m2::*;
    |         ^^^^^^^^^^^
@@ -49,73 +49,46 @@
    = help: consider adding an explicit import of `foo` to disambiguate
 
 error[E0659]: `foo` is ambiguous
-  --> $DIR/duplicate.rs:51:9
+  --> $DIR/duplicate.rs:36:8
+   |
+LL |     g::foo();
+   |        ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple glob imports of a name in the same module
+note: `foo` could refer to the function imported here
+  --> $DIR/duplicate.rs:24:13
+   |
+LL |     pub use crate::a::*;
+   |             ^^^^^^^^^^^
+   = help: consider adding an explicit import of `foo` to disambiguate
+note: `foo` could also refer to the function imported here
+  --> $DIR/duplicate.rs:25:13
+   |
+LL |     pub use crate::b::*;
+   |             ^^^^^^^^^^^
+   = help: consider adding an explicit import of `foo` to disambiguate
+
+error[E0659]: `foo` is ambiguous
+  --> $DIR/duplicate.rs:50:9
    |
 LL |         foo::bar();
    |         ^^^ ambiguous name
    |
    = note: ambiguous because of multiple glob imports of a name in the same module
 note: `foo` could refer to the module imported here
-  --> $DIR/duplicate.rs:45:9
+  --> $DIR/duplicate.rs:44:9
    |
 LL |     use self::m1::*;
    |         ^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 note: `foo` could also refer to the module imported here
-  --> $DIR/duplicate.rs:46:9
+  --> $DIR/duplicate.rs:45:9
    |
 LL |     use self::m2::*;
    |         ^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 
-error: `foo` is ambiguous
-  --> $DIR/duplicate.rs:36:8
-   |
-LL |     g::foo();
-   |        ^^^ ambiguous name
-   |
-   = note: ambiguous because of multiple glob imports of a name in the same module
-note: `foo` could refer to the function imported here
-  --> $DIR/duplicate.rs:29:13
-   |
-LL |     pub use crate::a::*;
-   |             ^^^^^^^^^^^
-   = help: consider adding an explicit import of `foo` to disambiguate
-note: `foo` could also refer to the function imported here
-  --> $DIR/duplicate.rs:30:13
-   |
-LL |     pub use crate::f::*;
-   |             ^^^^^^^^^^^
-   = help: consider adding an explicit import of `foo` to disambiguate
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
-   = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default
-
 error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0252, E0659.
 For more information about an error, try `rustc --explain E0252`.
-Future incompatibility report: Future breakage diagnostic:
-error: `foo` is ambiguous
-  --> $DIR/duplicate.rs:36:8
-   |
-LL |     g::foo();
-   |        ^^^ ambiguous name
-   |
-   = note: ambiguous because of multiple glob imports of a name in the same module
-note: `foo` could refer to the function imported here
-  --> $DIR/duplicate.rs:29:13
-   |
-LL |     pub use crate::a::*;
-   |             ^^^^^^^^^^^
-   = help: consider adding an explicit import of `foo` to disambiguate
-note: `foo` could also refer to the function imported here
-  --> $DIR/duplicate.rs:30:13
-   |
-LL |     pub use crate::f::*;
-   |             ^^^^^^^^^^^
-   = help: consider adding an explicit import of `foo` to disambiguate
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
-   = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default
-
diff --git a/tests/ui/imports/import-loop-2.rs b/tests/ui/imports/import-loop-2.rs
index 42f9a07..af5c650 100644
--- a/tests/ui/imports/import-loop-2.rs
+++ b/tests/ui/imports/import-loop-2.rs
@@ -1,9 +1,9 @@
 mod a {
-    pub use crate::b::x;
+    pub use crate::b::x; //~ ERROR unresolved import `crate::b::x`
 }
 
 mod b {
-    pub use crate::a::x; //~ ERROR unresolved import `crate::a::x`
+    pub use crate::a::x;
 
     fn main() { let y = x; }
 }
diff --git a/tests/ui/imports/import-loop-2.stderr b/tests/ui/imports/import-loop-2.stderr
index 2ef40c4..2843c82 100644
--- a/tests/ui/imports/import-loop-2.stderr
+++ b/tests/ui/imports/import-loop-2.stderr
@@ -1,8 +1,10 @@
-error[E0432]: unresolved import `crate::a::x`
-  --> $DIR/import-loop-2.rs:6:13
+error[E0432]: unresolved import `crate::b::x`
+  --> $DIR/import-loop-2.rs:2:13
    |
-LL |     pub use crate::a::x;
-   |             ^^^^^^^^^^^ no `x` in `a`
+LL |     pub use crate::b::x;
+   |             ^^^^^^^^^^-
+   |                       |
+   |                       no `x` in `b`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/import-loop.stderr b/tests/ui/imports/import-loop.stderr
index 888ca11..f309dda 100644
--- a/tests/ui/imports/import-loop.stderr
+++ b/tests/ui/imports/import-loop.stderr
@@ -2,7 +2,9 @@
   --> $DIR/import-loop.rs:4:13
    |
 LL |     pub use crate::y::x;
-   |             ^^^^^^^^^^^ no `x` in `y`
+   |             ^^^^^^^^^^-
+   |                       |
+   |                       no `x` in `y`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/import.stderr b/tests/ui/imports/import.stderr
index f6c69d1..b04905f 100644
--- a/tests/ui/imports/import.stderr
+++ b/tests/ui/imports/import.stderr
@@ -2,7 +2,9 @@
   --> $DIR/import.rs:5:5
    |
 LL | use zed::baz;
-   |     ^^^^^^^^ no `baz` in `zed`
+   |     ^^^^^---
+   |          |
+   |          no `baz` in `zed`
    |
 help: a similar name exists in the module
    |
diff --git a/tests/ui/imports/import4.rs b/tests/ui/imports/import4.rs
index f670cc0..76a9887 100644
--- a/tests/ui/imports/import4.rs
+++ b/tests/ui/imports/import4.rs
@@ -1,4 +1,4 @@
-mod a { pub use crate::b::foo; }
-mod b { pub use crate::a::foo; } //~ ERROR unresolved import `crate::a::foo`
+mod a { pub use crate::b::foo; } //~ ERROR unresolved import `crate::b::foo`
+mod b { pub use crate::a::foo; }
 
 fn main() { println!("loop"); }
diff --git a/tests/ui/imports/import4.stderr b/tests/ui/imports/import4.stderr
index 4faa5f0..62e15ec 100644
--- a/tests/ui/imports/import4.stderr
+++ b/tests/ui/imports/import4.stderr
@@ -1,8 +1,10 @@
-error[E0432]: unresolved import `crate::a::foo`
-  --> $DIR/import4.rs:2:17
+error[E0432]: unresolved import `crate::b::foo`
+  --> $DIR/import4.rs:1:17
    |
-LL | mod b { pub use crate::a::foo; }
-   |                 ^^^^^^^^^^^^^ no `foo` in `a`
+LL | mod a { pub use crate::b::foo; }
+   |                 ^^^^^^^^^^---
+   |                           |
+   |                           no `foo` in `b`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-113953.stderr b/tests/ui/imports/issue-113953.stderr
index 9daa73a..a0da9c0 100644
--- a/tests/ui/imports/issue-113953.stderr
+++ b/tests/ui/imports/issue-113953.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-113953.rs:3:5
    |
 LL | use unresolved as u8;
-   |     ^^^^^^^^^^^^^^^^ no external crate `unresolved`
+   |     ----------^^^^^^
+   |     |
+   |     no external crate `unresolved`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-114682-5.stderr b/tests/ui/imports/issue-114682-5.stderr
index 66b0744..6c7f1e2 100644
--- a/tests/ui/imports/issue-114682-5.stderr
+++ b/tests/ui/imports/issue-114682-5.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-114682-5.rs:10:5
    |
 LL | use issue_114682_5_extern_1::Url;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `Url` in `types::issue_114682_5_extern_1`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^---
+   |                              |
+   |                              no `Url` in `types::issue_114682_5_extern_1`
    |
 help: consider importing this struct instead
    |
diff --git a/tests/ui/imports/issue-13404.stderr b/tests/ui/imports/issue-13404.stderr
index a77f399..84cd29f 100644
--- a/tests/ui/imports/issue-13404.stderr
+++ b/tests/ui/imports/issue-13404.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-13404.rs:2:5
    |
 LL | use b::f;
-   |     ^^^^ no `f` in `b`
+   |     ^^^-
+   |        |
+   |        no `f` in `b`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-2937.stderr b/tests/ui/imports/issue-2937.stderr
index 15622f2..8967d42 100644
--- a/tests/ui/imports/issue-2937.stderr
+++ b/tests/ui/imports/issue-2937.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-2937.rs:1:5
    |
 LL | use m::f as x;
-   |     ^^^^^^^^^ no `f` in `m`
+   |     ^^^-^^^^^
+   |        |
+   |        no `f` in `m`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-32833.stderr b/tests/ui/imports/issue-32833.stderr
index 1d346c7..4e02968 100644
--- a/tests/ui/imports/issue-32833.stderr
+++ b/tests/ui/imports/issue-32833.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-32833.rs:2:5
    |
 LL | use bar::Foo;
-   |     ^^^^^^^^ no `Foo` in `bar`
+   |     ^^^^^---
+   |          |
+   |          no `Foo` in `bar`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-53512.stderr b/tests/ui/imports/issue-53512.stderr
index 6bcba1a..f935c05 100644
--- a/tests/ui/imports/issue-53512.stderr
+++ b/tests/ui/imports/issue-53512.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-53512.rs:4:5
    |
 LL | use m::assert;
-   |     ^^^^^^^^^ no `assert` in `m`
+   |     ^^^------
+   |        |
+   |        no `assert` in `m`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-56125.stderr b/tests/ui/imports/issue-56125.stderr
index f9a169b..8c8c45a 100644
--- a/tests/ui/imports/issue-56125.stderr
+++ b/tests/ui/imports/issue-56125.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-56125.rs:17:9
    |
 LL |     use empty::issue_56125;
-   |         ^^^^^^^^^^^^^^^^^^ no `issue_56125` in `m3::empty`
+   |         ^^^^^^^-----------
+   |                |
+   |                no `issue_56125` in `m3::empty`
    |
 help: consider importing one of these modules instead
    |
diff --git a/tests/ui/imports/issue-57015.stderr b/tests/ui/imports/issue-57015.stderr
index 409007c..a27f5d8 100644
--- a/tests/ui/imports/issue-57015.stderr
+++ b/tests/ui/imports/issue-57015.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-57015.rs:11:5
    |
 LL | use single_err::something;
-   |     ^^^^^^^^^^^^^^^^^^^^^ no `something` in `single_err`
+   |     ^^^^^^^^^^^^---------
+   |                 |
+   |                 no `something` in `single_err`
    |
 help: consider importing this module instead
    |
diff --git a/tests/ui/imports/issue-59764.stderr b/tests/ui/imports/issue-59764.stderr
index 1d31e3b..d0f1cff 100644
--- a/tests/ui/imports/issue-59764.stderr
+++ b/tests/ui/imports/issue-59764.stderr
@@ -90,7 +90,9 @@
   --> $DIR/issue-59764.rs:54:31
    |
 LL |     use issue_59764::{foobaz, foo::makro};
-   |                               ^^^^^^^^^^ no `makro` in `foo`
+   |                               ^^^^^-----
+   |                                    |
+   |                                    no `makro` in `foo`
    |
    = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
 help: a macro with this name exists at the root of the crate
@@ -177,7 +179,9 @@
   --> $DIR/issue-59764.rs:102:9
    |
 LL |     use issue_59764::foo::makro as baz;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `makro` in `foo`
+   |         ^^^^^^^^^^^^^^^^^^-----^^^^^^^
+   |                           |
+   |                           no `makro` in `foo`
    |
    = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
 help: a macro with this name exists at the root of the crate
@@ -190,7 +194,9 @@
   --> $DIR/issue-59764.rs:107:33
    |
 LL |     use issue_59764::foo::{baz, makro as foobar};
-   |                                 ^^^^^^^^^^^^^^^ no `makro` in `foo`
+   |                                 -----^^^^^^^^^^
+   |                                 |
+   |                                 no `makro` in `foo`
    |
    = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
 help: a macro with this name exists at the root of the crate
@@ -203,7 +209,9 @@
   --> $DIR/issue-59764.rs:120:17
    |
 LL |                 makro as foobar}
-   |                 ^^^^^^^^^^^^^^^ no `makro` in `foo`
+   |                 -----^^^^^^^^^^
+   |                 |
+   |                 no `makro` in `foo`
    |
    = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
 help: a macro with this name exists at the root of the crate
@@ -219,7 +227,9 @@
   --> $DIR/issue-59764.rs:127:5
    |
 LL | use issue_59764::foo::makro;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^ no `makro` in `foo`
+   |     ^^^^^^^^^^^^^^^^^^-----
+   |                       |
+   |                       no `makro` in `foo`
    |
    = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
 help: a macro with this name exists at the root of the crate
diff --git a/tests/ui/imports/issue-85992.stderr b/tests/ui/imports/issue-85992.stderr
index 490b2d4..2bf42d8 100644
--- a/tests/ui/imports/issue-85992.stderr
+++ b/tests/ui/imports/issue-85992.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-85992.rs:8:5
    |
 LL | use crate::empty;
-   |     ^^^^^^^^^^^^ no `empty` in the root
+   |     ^^^^^^^-----
+   |            |
+   |            no `empty` in the root
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/point_macro_input.rs b/tests/ui/imports/point_macro_input.rs
new file mode 100644
index 0000000..fc4167c
--- /dev/null
+++ b/tests/ui/imports/point_macro_input.rs
@@ -0,0 +1,36 @@
+#![crate_type = "lib"]
+
+mod things { }
+
+macro_rules! mac1 {
+    ($thing: ident) => {{
+        const _x: u32 = things::$thing;
+        //~^ NOTE due to this macro variable
+    }}
+}
+
+macro_rules! mac2 {
+    ($thing: ident) => {{
+        const _x: u32 = {
+            use things::$thing;
+            //~^ ERROR unresolved import `things::what2` [E0432]
+            $thing
+        };
+    }}
+}
+
+
+fn foo(){
+    mac1!(
+
+        what1
+        //~^ ERROR cannot find value `what1` in module `things` [E0425]
+        //~| NOTE not found in `things`
+
+    );
+    mac2!(//~ NOTE in this expansion of mac2!
+
+        what2
+        //~^ NOTE no `what2` in `things`
+    );
+}
diff --git a/tests/ui/imports/point_macro_input.stderr b/tests/ui/imports/point_macro_input.stderr
new file mode 100644
index 0000000..f063c8c
--- /dev/null
+++ b/tests/ui/imports/point_macro_input.stderr
@@ -0,0 +1,29 @@
+error[E0432]: unresolved import `things::what2`
+  --> $DIR/point_macro_input.rs:15:17
+   |
+LL |               use things::$thing;
+   |                   ^^^^^^^^^^^^^^
+...
+LL | /     mac2!(
+LL | |
+LL | |         what2
+   | |         ----- no `what2` in `things`
+LL | |
+LL | |     );
+   | |_____- in this macro invocation
+   |
+   = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0425]: cannot find value `what1` in module `things`
+  --> $DIR/point_macro_input.rs:26:9
+   |
+LL |         const _x: u32 = things::$thing;
+   |                                 ------ due to this macro variable
+...
+LL |         what1
+   |         ^^^^^ not found in `things`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0425, E0432.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/tests/ui/imports/same-res-ambigious.fail.stderr b/tests/ui/imports/same-res-ambigious.fail.stderr
deleted file mode 100644
index dfd7c5a..0000000
--- a/tests/ui/imports/same-res-ambigious.fail.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0603]: derive macro `Embed` is private
-  --> $DIR/same-res-ambigious.rs:8:28
-   |
-LL | #[derive(ambigious_extern::Embed)]
-   |                            ^^^^^ private derive macro
-   |
-note: the derive macro `Embed` is defined here
-  --> $DIR/auxiliary/same-res-ambigious-extern-fail.rs:16:9
-   |
-LL | pub use RustEmbed as Embed;
-   |         ^^^^^^^^^
-help: import `Embed` directly
-   |
-LL - #[derive(ambigious_extern::Embed)]
-LL + #[derive(same_res_ambigious_extern_macro::RustEmbed)]
-   |
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0603`.
diff --git a/tests/ui/imports/same-res-ambigious.rs b/tests/ui/imports/same-res-ambigious.rs
index b5c13a1..0bfd10f 100644
--- a/tests/ui/imports/same-res-ambigious.rs
+++ b/tests/ui/imports/same-res-ambigious.rs
@@ -1,11 +1,11 @@
+//@ check-pass
 //@ edition: 2018
 //@ revisions: fail pass
-//@[pass] check-pass
 //@[pass] aux-crate: ambigious_extern=same-res-ambigious-extern.rs
 //@[fail] aux-crate: ambigious_extern=same-res-ambigious-extern-fail.rs
 // see https://github.com/rust-lang/rust/pull/147196
 
-#[derive(ambigious_extern::Embed)] //[fail]~ ERROR: derive macro `Embed` is private
+#[derive(ambigious_extern::Embed)]
 struct Foo{}
 
 fn main(){}
diff --git a/tests/ui/imports/shadow-glob-module-resolution-2.stderr b/tests/ui/imports/shadow-glob-module-resolution-2.stderr
index ba8a2ce..205459e 100644
--- a/tests/ui/imports/shadow-glob-module-resolution-2.stderr
+++ b/tests/ui/imports/shadow-glob-module-resolution-2.stderr
@@ -2,7 +2,9 @@
   --> $DIR/shadow-glob-module-resolution-2.rs:14:5
    |
 LL | use e as b;
-   |     ^^^^^^ no `e` in the root
+   |     -^^^^^
+   |     |
+   |     no `e` in the root
    |
 help: a similar name exists in the module
    |
diff --git a/tests/ui/imports/show-private-items-issue-138626.stderr b/tests/ui/imports/show-private-items-issue-138626.stderr
index 2fa4a56..c241d76 100644
--- a/tests/ui/imports/show-private-items-issue-138626.stderr
+++ b/tests/ui/imports/show-private-items-issue-138626.stderr
@@ -2,7 +2,9 @@
   --> $DIR/show-private-items-issue-138626.rs:17:13
    |
 LL |     pub use crate::two::foo::Foo;
-   |             ^^^^^^^^^^^^^^^^^^^^ no `Foo` in `two::foo`
+   |             ^^^^^^^^^^^^^^^^^---
+   |                              |
+   |                              no `Foo` in `two::foo`
    |
 note: struct `two::foo::bar::Foo` exists but is inaccessible
   --> $DIR/show-private-items-issue-138626.rs:13:13
diff --git a/tests/ui/imports/unresolved-imports-used.stderr b/tests/ui/imports/unresolved-imports-used.stderr
index 5febca8..f6af143 100644
--- a/tests/ui/imports/unresolved-imports-used.stderr
+++ b/tests/ui/imports/unresolved-imports-used.stderr
@@ -2,13 +2,17 @@
   --> $DIR/unresolved-imports-used.rs:11:5
    |
 LL | use qux::bar;
-   |     ^^^^^^^^ no `bar` in `qux`
+   |     ^^^^^---
+   |          |
+   |          no `bar` in `qux`
 
 error[E0432]: unresolved import `qux::bar2`
   --> $DIR/unresolved-imports-used.rs:14:5
    |
 LL | use qux::bar2;
-   |     ^^^^^^^^^ no `bar2` in `qux`
+   |     ^^^^^----
+   |          |
+   |          no `bar2` in `qux`
 
 error[E0432]: unresolved import `foo`
   --> $DIR/unresolved-imports-used.rs:12:5
diff --git a/tests/ui/issues/issue-20261.rs b/tests/ui/inference/need_type_info/for-loop-ref-pattern-inference.rs
similarity index 71%
rename from tests/ui/issues/issue-20261.rs
rename to tests/ui/inference/need_type_info/for-loop-ref-pattern-inference.rs
index 5283936..0c5b6b7 100644
--- a/tests/ui/issues/issue-20261.rs
+++ b/tests/ui/inference/need_type_info/for-loop-ref-pattern-inference.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/20261>.
+
 fn main() {
     // N.B., this (almost) typechecks when default binding modes are enabled.
     for (ref i,) in [].iter() {
diff --git a/tests/ui/issues/issue-20261.stderr b/tests/ui/inference/need_type_info/for-loop-ref-pattern-inference.stderr
similarity index 80%
rename from tests/ui/issues/issue-20261.stderr
rename to tests/ui/inference/need_type_info/for-loop-ref-pattern-inference.stderr
index c5348ab..074db2e 100644
--- a/tests/ui/issues/issue-20261.stderr
+++ b/tests/ui/inference/need_type_info/for-loop-ref-pattern-inference.stderr
@@ -1,5 +1,5 @@
 error[E0282]: type annotations needed
-  --> $DIR/issue-20261.rs:4:9
+  --> $DIR/for-loop-ref-pattern-inference.rs:6:9
    |
 LL |         i.clone();
    |         ^ cannot infer type
diff --git a/tests/ui/issues/auxiliary/cgu_test.rs b/tests/ui/issues/auxiliary/cgu_test.rs
deleted file mode 100644
index 1103fcb..0000000
--- a/tests/ui/issues/auxiliary/cgu_test.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ no-prefer-dynamic
-//@ compile-flags: --crate-type=lib
-
-pub fn id<T>(t: T) -> T {
-  t
-}
diff --git a/tests/ui/issues/auxiliary/cgu_test_a.rs b/tests/ui/issues/auxiliary/cgu_test_a.rs
deleted file mode 100644
index 7998f18..0000000
--- a/tests/ui/issues/auxiliary/cgu_test_a.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//@ no-prefer-dynamic
-//@ compile-flags: -Ccodegen-units=2 --crate-type=lib
-
-extern crate cgu_test;
-
-pub mod a {
-    pub fn a() {
-        ::cgu_test::id(0);
-    }
-}
-pub mod b {
-    pub fn a() {
-        ::cgu_test::id(0);
-    }
-}
diff --git a/tests/ui/issues/auxiliary/cgu_test_b.rs b/tests/ui/issues/auxiliary/cgu_test_b.rs
deleted file mode 100644
index 7998f18..0000000
--- a/tests/ui/issues/auxiliary/cgu_test_b.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//@ no-prefer-dynamic
-//@ compile-flags: -Ccodegen-units=2 --crate-type=lib
-
-extern crate cgu_test;
-
-pub mod a {
-    pub fn a() {
-        ::cgu_test::id(0);
-    }
-}
-pub mod b {
-    pub fn a() {
-        ::cgu_test::id(0);
-    }
-}
diff --git a/tests/ui/issues/auxiliary/issue-19293.rs b/tests/ui/issues/auxiliary/issue-19293.rs
deleted file mode 100644
index 31359e8..0000000
--- a/tests/ui/issues/auxiliary/issue-19293.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-pub struct Foo (pub isize);
-pub enum MyEnum {
-    Foo(Foo),
-}
diff --git a/tests/ui/issues/auxiliary/issue-20389.rs b/tests/ui/issues/auxiliary/issue-20389.rs
deleted file mode 100644
index ae6d44e..0000000
--- a/tests/ui/issues/auxiliary/issue-20389.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-pub trait T {
-    type C;
-    fn dummy(&self) { }
-}
diff --git a/tests/ui/issues/auxiliary/issue-2170-lib.rs b/tests/ui/issues/auxiliary/issue-2170-lib.rs
deleted file mode 100644
index a99385a..0000000
--- a/tests/ui/issues/auxiliary/issue-2170-lib.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-fn foo(_x: i32) {
-}
-
-pub struct rsrc {
-  x: i32,
-}
-
-impl Drop for rsrc {
-    fn drop(&mut self) {
-        foo(self.x);
-    }
-}
-
-pub fn rsrc(x: i32) -> rsrc {
-    rsrc {
-        x: x
-    }
-}
diff --git a/tests/ui/issues/auxiliary/issue-2414-b.rs b/tests/ui/issues/auxiliary/issue-2414-b.rs
deleted file mode 100644
index fc01834..0000000
--- a/tests/ui/issues/auxiliary/issue-2414-b.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#![crate_name="b"]
-#![crate_type = "lib"]
-
-extern crate a;
diff --git a/tests/ui/issues/auxiliary/issue-2723-a.rs b/tests/ui/issues/auxiliary/issue-2723-a.rs
deleted file mode 100644
index 661b46d..0000000
--- a/tests/ui/issues/auxiliary/issue-2723-a.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-pub unsafe fn f(xs: Vec<isize> ) {
-    xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::<Vec<()>>();
-}
diff --git a/tests/ui/issues/auxiliary/issue-29485.rs b/tests/ui/issues/auxiliary/issue-29485.rs
deleted file mode 100644
index 1e8891c..0000000
--- a/tests/ui/issues/auxiliary/issue-29485.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-#![crate_name="a"]
-#![crate_type = "lib"]
-
-pub struct X(pub u8);
-
-impl Drop for X {
-    fn drop(&mut self) {
-        assert_eq!(self.0, 1)
-    }
-}
-
-pub fn f(x: &mut X, g: fn()) {
-    x.0 = 1;
-    g();
-    x.0 = 0;
-}
diff --git a/tests/ui/issues/auxiliary/issue-36954.rs b/tests/ui/issues/auxiliary/issue-36954.rs
deleted file mode 100644
index bc444a3..0000000
--- a/tests/ui/issues/auxiliary/issue-36954.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-#![crate_type = "lib"]
-
-const fn foo(i: i32) -> i32 {
-    i
-}
-
-pub const FOO: i32 = foo(1);
diff --git a/tests/ui/issues/auxiliary/issue-38190.rs b/tests/ui/issues/auxiliary/issue-38190.rs
deleted file mode 100644
index 373e646..0000000
--- a/tests/ui/issues/auxiliary/issue-38190.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#[macro_export]
-macro_rules! m { ([$i:item]) => {} }
diff --git a/tests/ui/issues/auxiliary/issue-41053.rs b/tests/ui/issues/auxiliary/issue-41053.rs
deleted file mode 100644
index ae73c3e..0000000
--- a/tests/ui/issues/auxiliary/issue-41053.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub struct Test;
diff --git a/tests/ui/issues/auxiliary/issue-41549.rs b/tests/ui/issues/auxiliary/issue-41549.rs
deleted file mode 100644
index b7bd375..0000000
--- a/tests/ui/issues/auxiliary/issue-41549.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-pub trait Trait {
-    const CONST: u32;
-}
diff --git a/tests/ui/issues/auxiliary/issue-42007-s.rs b/tests/ui/issues/auxiliary/issue-42007-s.rs
deleted file mode 100644
index 95119a58..0000000
--- a/tests/ui/issues/auxiliary/issue-42007-s.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#[repr(u8)]
-pub enum E {
-    B = 1 as u8,
-}
diff --git a/tests/ui/issues/auxiliary/issue-4208-cc.rs b/tests/ui/issues/auxiliary/issue-4208-cc.rs
deleted file mode 100644
index 7b4c8b0..0000000
--- a/tests/ui/issues/auxiliary/issue-4208-cc.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#![crate_name="numeric"]
-#![crate_type = "lib"]
-
-pub trait Trig<T> {
-    fn sin(&self) -> T;
-}
-
-pub fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() }
-
-pub trait Angle<T>: Trig<T> {}
diff --git a/tests/ui/issues/auxiliary/issue-4545.rs b/tests/ui/issues/auxiliary/issue-4545.rs
deleted file mode 100644
index 2f60947..0000000
--- a/tests/ui/issues/auxiliary/issue-4545.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-pub struct S<T>(Option<T>);
-pub fn mk<T>() -> S<T> { S(None) }
diff --git a/tests/ui/issues/auxiliary/issue-48984-aux.rs b/tests/ui/issues/auxiliary/issue-48984-aux.rs
deleted file mode 100644
index 7cc888c..0000000
--- a/tests/ui/issues/auxiliary/issue-48984-aux.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-#![crate_type = "lib"]
-#![crate_name = "issue48984aux"]
-
-pub trait Foo { type Item; }
-
-pub trait Bar: Foo<Item=[u8;1]> {  }
diff --git a/tests/ui/issues/auxiliary/issue-51798.rs b/tests/ui/issues/auxiliary/issue-51798.rs
deleted file mode 100644
index fef5213..0000000
--- a/tests/ui/issues/auxiliary/issue-51798.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-#![crate_type = "lib"]
-
-pub fn vec() -> Vec<u8> { vec![] }
diff --git a/tests/ui/issues/issue-19293.rs b/tests/ui/issues/issue-19293.rs
deleted file mode 100644
index 42effe3..0000000
--- a/tests/ui/issues/issue-19293.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-19293.rs
-
-extern crate issue_19293;
-use issue_19293::{Foo, MyEnum};
-
-fn main() {
-    MyEnum::Foo(Foo(5));
-}
diff --git a/tests/ui/issues/issue-19991.rs b/tests/ui/issues/issue-19991.rs
deleted file mode 100644
index cb558b5..0000000
--- a/tests/ui/issues/issue-19991.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// Test if the sugared `if let` construct correctly prints "missing an else clause" when an else
-// clause does not exist, instead of the unsympathetic "`match` arms have incompatible types"
-
-//@ dont-require-annotations: NOTE
-
-fn main() {
-    if let Some(homura) = Some("madoka") { //~  ERROR missing an `else` clause
-                                           //~| NOTE expected integer, found `()`
-        765
-    };
-}
diff --git a/tests/ui/issues/issue-20389.rs b/tests/ui/issues/issue-20389.rs
deleted file mode 100644
index e201663..0000000
--- a/tests/ui/issues/issue-20389.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//@ run-pass
-#![allow(dead_code)]
-//@ aux-build:issue-20389.rs
-
-
-extern crate issue_20389;
-
-struct Foo;
-
-impl issue_20389::T for Foo {
-    type C = ();
-}
-
-fn main() {}
diff --git a/tests/ui/issues/issue-2170-exe.rs b/tests/ui/issues/issue-2170-exe.rs
deleted file mode 100644
index b66843d..0000000
--- a/tests/ui/issues/issue-2170-exe.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-2170-lib.rs
-
-extern crate issue_2170_lib;
-
-pub fn main() {
-   // let _ = issue_2170_lib::rsrc(2);
-}
diff --git a/tests/ui/issues/issue-2380-b.rs b/tests/ui/issues/issue-2380-b.rs
deleted file mode 100644
index 503698f..0000000
--- a/tests/ui/issues/issue-2380-b.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-2380.rs
-
-
-extern crate a;
-
-pub fn main() {
-    a::f::<()>();
-}
diff --git a/tests/ui/issues/issue-2414-c.rs b/tests/ui/issues/issue-2414-c.rs
deleted file mode 100644
index ac75c5c..0000000
--- a/tests/ui/issues/issue-2414-c.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-2414-a.rs
-//@ aux-build:issue-2414-b.rs
-
-
-extern crate b;
-
-pub fn main() {}
diff --git a/tests/ui/issues/issue-2526-a.rs b/tests/ui/issues/issue-2526-a.rs
deleted file mode 100644
index 379146d..0000000
--- a/tests/ui/issues/issue-2526-a.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-2526.rs
-
-
-#![allow(unused_imports)]
-
-extern crate issue_2526;
-use issue_2526::*;
-
-pub fn main() {}
diff --git a/tests/ui/issues/issue-25467.rs b/tests/ui/issues/issue-25467.rs
deleted file mode 100644
index 1ba5a0e..0000000
--- a/tests/ui/issues/issue-25467.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ run-pass
-#![allow(unused_variables)]
-//@ aux-build:issue-25467.rs
-
-pub type Issue25467BarT = ();
-pub type Issue25467FooT = ();
-
-extern crate issue_25467 as aux;
-
-fn main() {
-    let o: aux::Object = None;
-}
diff --git a/tests/ui/issues/issue-2723-b.rs b/tests/ui/issues/issue-2723-b.rs
deleted file mode 100644
index 731e521..0000000
--- a/tests/ui/issues/issue-2723-b.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-2723-a.rs
-
-extern crate issue_2723_a;
-use issue_2723_a::f;
-
-pub fn main() {
-    unsafe {
-        f(vec![2]);
-    }
-}
diff --git a/tests/ui/issues/issue-29265.rs b/tests/ui/issues/issue-29265.rs
deleted file mode 100644
index a3da9be..0000000
--- a/tests/ui/issues/issue-29265.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ aux-build:issue-29265.rs
-//@ check-pass
-
-extern crate issue_29265 as lib;
-
-static _UNUSED: &'static lib::SomeType = &lib::SOME_VALUE;
-
-fn main() {
-    vec![0u8; lib::SOME_VALUE.some_member];
-}
diff --git a/tests/ui/issues/issue-29485.rs b/tests/ui/issues/issue-29485.rs
deleted file mode 100644
index 8e6436c..0000000
--- a/tests/ui/issues/issue-29485.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-//@ run-pass
-#![allow(unused_attributes)]
-//@ aux-build:issue-29485.rs
-//@ needs-unwind
-//@ needs-threads
-//@ ignore-backends: gcc
-
-#[feature(recover)]
-
-extern crate a;
-
-fn main() {
-    let _ = std::thread::spawn(move || {
-        a::f(&mut a::X(0), g);
-    }).join();
-}
-
-fn g() {
-    panic!();
-}
diff --git a/tests/ui/issues/issue-3012-2.rs b/tests/ui/issues/issue-3012-2.rs
deleted file mode 100644
index fd090d5..0000000
--- a/tests/ui/issues/issue-3012-2.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-3012-1.rs
-
-
-extern crate socketlib;
-
-use socketlib::socket;
-
-pub fn main() {
-    let fd: u32 = 1 as u32;
-    let _sock: Box<_> = Box::new(socket::socket_handle(fd));
-}
diff --git a/tests/ui/issues/issue-30123.rs b/tests/ui/issues/issue-30123.rs
deleted file mode 100644
index 88fab44..0000000
--- a/tests/ui/issues/issue-30123.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ aux-build:issue-30123-aux.rs
-
-extern crate issue_30123_aux;
-use issue_30123_aux::*;
-
-fn main() {
-    let ug = Graph::<i32, i32>::new_undirected();
-    //~^ ERROR no associated function or constant named `new_undirected` found
-}
diff --git a/tests/ui/issues/issue-30123.stderr b/tests/ui/issues/issue-30123.stderr
deleted file mode 100644
index 1e27474..0000000
--- a/tests/ui/issues/issue-30123.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0599]: no associated function or constant named `new_undirected` found for struct `issue_30123_aux::Graph<i32, i32>` in the current scope
-  --> $DIR/issue-30123.rs:7:33
-   |
-LL |     let ug = Graph::<i32, i32>::new_undirected();
-   |                                 ^^^^^^^^^^^^^^ associated function or constant not found in `issue_30123_aux::Graph<i32, i32>`
-   |
-note: if you're trying to build a new `issue_30123_aux::Graph<i32, i32>`, consider using `issue_30123_aux::Graph::<N, E>::new` which returns `issue_30123_aux::Graph<_, _>`
-  --> $DIR/auxiliary/issue-30123-aux.rs:14:5
-   |
-LL |     pub fn new() -> Self {
-   |     ^^^^^^^^^^^^^^^^^^^^
-   = note: the associated function or constant was found for `issue_30123_aux::Graph<N, E, Undirected>`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/issues/issue-3136-b.rs b/tests/ui/issues/issue-3136-b.rs
deleted file mode 100644
index bd6ea73..0000000
--- a/tests/ui/issues/issue-3136-b.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-3136-a.rs
-
-
-extern crate issue_3136_a;
-
-pub fn main() {}
diff --git a/tests/ui/issues/issue-31702.rs b/tests/ui/issues/issue-31702.rs
deleted file mode 100644
index 1cf01f7..0000000
--- a/tests/ui/issues/issue-31702.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-31702-1.rs
-//@ aux-build:issue-31702-2.rs
-
-// this test is actually entirely in the linked library crates
-
-extern crate issue_31702_1;
-extern crate issue_31702_2;
-
-fn main() {}
diff --git a/tests/ui/issues/issue-32518.rs b/tests/ui/issues/issue-32518.rs
deleted file mode 100644
index 45a8828..0000000
--- a/tests/ui/issues/issue-32518.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ run-pass
-//@ no-prefer-dynamic
-//@ aux-build:cgu_test.rs
-//@ aux-build:cgu_test_a.rs
-//@ aux-build:cgu_test_b.rs
-
-extern crate cgu_test_a;
-extern crate cgu_test_b;
-
-fn main() {
-    cgu_test_a::a::a();
-    cgu_test_b::a::a();
-}
diff --git a/tests/ui/issues/issue-36954.rs b/tests/ui/issues/issue-36954.rs
deleted file mode 100644
index 411e99b..0000000
--- a/tests/ui/issues/issue-36954.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-36954.rs
-
-extern crate issue_36954 as lib;
-
-fn main() {
-    let _ = lib::FOO;
-}
diff --git a/tests/ui/issues/issue-38190.rs b/tests/ui/issues/issue-38190.rs
deleted file mode 100644
index 539d7f2..0000000
--- a/tests/ui/issues/issue-38190.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-38190.rs
-
-#[macro_use]
-extern crate issue_38190;
-
-mod auxiliary {
-    m!([
-        #[path = "issue-38190.rs"]
-        mod issue_38190;
-    ]);
-}
-
-fn main() {}
diff --git a/tests/ui/issues/issue-3979-xcrate.rs b/tests/ui/issues/issue-3979-xcrate.rs
deleted file mode 100644
index 7660405..0000000
--- a/tests/ui/issues/issue-3979-xcrate.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-//@ run-pass
-#![allow(dead_code)]
-//@ aux-build:issue-3979-traits.rs
-
-extern crate issue_3979_traits;
-use issue_3979_traits::{Positioned, Movable};
-
-struct Point { x: isize, y: isize }
-
-impl Positioned for Point {
-    fn SetX(&mut self, x: isize) {
-        self.x = x;
-    }
-    fn X(&self) -> isize {
-        self.x
-    }
-}
-
-impl Movable for Point {}
-
-pub fn main() {
-    let mut p = Point{ x: 1, y: 2};
-    p.translate(3);
-    assert_eq!(p.X(), 4);
-}
diff --git a/tests/ui/issues/issue-41053.rs b/tests/ui/issues/issue-41053.rs
deleted file mode 100644
index 42b0b00..0000000
--- a/tests/ui/issues/issue-41053.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-41053.rs
-
-#![allow(non_local_definitions)]
-
-pub trait Trait { fn foo(&self) {} }
-
-pub struct Foo;
-
-impl Iterator for Foo {
-    type Item = Box<dyn Trait>;
-    fn next(&mut self) -> Option<Box<dyn Trait>> {
-        extern crate issue_41053;
-        impl crate::Trait for issue_41053::Test {
-            fn foo(&self) {}
-        }
-        Some(Box::new(issue_41053::Test))
-    }
-}
-
-fn main() {
-    Foo.next().unwrap().foo();
-}
diff --git a/tests/ui/issues/issue-41549.rs b/tests/ui/issues/issue-41549.rs
deleted file mode 100644
index 8f57515..0000000
--- a/tests/ui/issues/issue-41549.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ aux-build:issue-41549.rs
-
-
-extern crate issue_41549;
-
-struct S;
-
-impl issue_41549::Trait for S {
-    const CONST: () = (); //~ ERROR incompatible type for trait
-}
-
-fn main() {}
diff --git a/tests/ui/issues/issue-42007.rs b/tests/ui/issues/issue-42007.rs
deleted file mode 100644
index b8ea7e8..0000000
--- a/tests/ui/issues/issue-42007.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ run-pass
-#![allow(dead_code)]
-//@ aux-build:issue-42007-s.rs
-
-extern crate issue_42007_s;
-
-enum I {
-    E(issue_42007_s::E),
-}
-
-fn main() {}
diff --git a/tests/ui/issues/issue-4208.rs b/tests/ui/issues/issue-4208.rs
deleted file mode 100644
index 84938be..0000000
--- a/tests/ui/issues/issue-4208.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ run-pass
-#![allow(dead_code)]
-//@ aux-build:issue-4208-cc.rs
-
-
-extern crate numeric;
-use numeric::{sin, Angle};
-
-fn foo<T, A:Angle<T>>(theta: A) -> T { sin(&theta) }
-
-pub fn main() {}
diff --git a/tests/ui/issues/issue-4545.rs b/tests/ui/issues/issue-4545.rs
deleted file mode 100644
index dfb8913..0000000
--- a/tests/ui/issues/issue-4545.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-4545.rs
-
-
-extern crate issue_4545 as somelib;
-pub fn main() { somelib::mk::<isize>(); }
diff --git a/tests/ui/issues/issue-48984.rs b/tests/ui/issues/issue-48984.rs
deleted file mode 100644
index 0440789..0000000
--- a/tests/ui/issues/issue-48984.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ run-pass
-#![allow(dead_code)]
-//@ aux-build:issue-48984-aux.rs
-extern crate issue48984aux;
-use issue48984aux::Bar;
-
-fn do_thing<T: Bar>() { }
-
-fn main() { }
diff --git a/tests/ui/issues/issue-51798.rs b/tests/ui/issues/issue-51798.rs
deleted file mode 100644
index f4d59f3..0000000
--- a/tests/ui/issues/issue-51798.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//@ edition:2018
-//@ aux-build:issue-51798.rs
-//@ check-pass
-
-extern crate issue_51798;
-
-mod server {
-    fn f() {
-        let mut v = issue_51798::vec();
-        v.clear();
-    }
-}
-
-fn main() {}
diff --git a/tests/ui/layout/too-big-no-dce.rs b/tests/ui/layout/too-big-no-dce.rs
new file mode 100644
index 0000000..7ea714f
--- /dev/null
+++ b/tests/ui/layout/too-big-no-dce.rs
@@ -0,0 +1,20 @@
+//! Ensure that we do not dead-code-eliminate `size_of` calls. That might hide "type too big"
+//! errors!
+//@ build-fail (test needs codegen)
+//@ compile-flags: -O
+//@ normalize-stderr: "\d{5}\d*" -> "NUMBER"
+
+//~? ERROR too big for the target
+
+#![crate_type = "lib"]
+
+const PTR_BITS_MINUS_1: usize = std::mem::size_of::<*const ()>() * 8 - 1;
+
+#[unsafe(no_mangle)] // ensure this gets monomorphized
+pub fn f() {
+    assert_valid_type::<[u32; 1 << PTR_BITS_MINUS_1]>();
+}
+
+pub fn assert_valid_type<T>() {
+    std::mem::size_of::<T>();
+}
diff --git a/tests/ui/layout/too-big-no-dce.stderr b/tests/ui/layout/too-big-no-dce.stderr
new file mode 100644
index 0000000..a4b01dd
--- /dev/null
+++ b/tests/ui/layout/too-big-no-dce.stderr
@@ -0,0 +1,8 @@
+error[E0080]: values of the type `[u32; NUMBER]` are too big for the target architecture
+  --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+   |
+   = note: evaluation of `<[u32; NUMBER] as std::mem::SizedTypeProperties>::SIZE` failed here
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime-distinct.rs b/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime-distinct.rs
new file mode 100644
index 0000000..a6995df
--- /dev/null
+++ b/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime-distinct.rs
@@ -0,0 +1,10 @@
+// Regression test for #156682
+// When the suggested type would NOT alias the outer reference's lifetime with one
+// already used inside the pointee, the normal suggestion should still apply.
+
+pub fn push<'a>(x: &mut Vec<&'a u8>, y: &u8) {
+    x.push(y);
+    //~^ ERROR explicit lifetime required in the type of `y`
+}
+
+fn main() {}
diff --git a/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime-distinct.stderr b/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime-distinct.stderr
new file mode 100644
index 0000000..fdc087a
--- /dev/null
+++ b/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime-distinct.stderr
@@ -0,0 +1,14 @@
+error[E0621]: explicit lifetime required in the type of `y`
+  --> $DIR/e0621-mut-ref-aliases-pointee-lifetime-distinct.rs:6:5
+   |
+LL |     x.push(y);
+   |     ^^^^^^^^^ lifetime `'a` required
+   |
+help: add explicit lifetime `'a` to the type of `y`
+   |
+LL | pub fn push<'a>(x: &mut Vec<&'a u8>, y: &'a u8) {
+   |                                          ++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime.rs b/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime.rs
new file mode 100644
index 0000000..5b78d56
--- /dev/null
+++ b/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime.rs
@@ -0,0 +1,23 @@
+// Regression test for #156682
+// E0621 should not suggest `&'a mut Buffer<'a>`, which would alias the outer
+// reference's lifetime with one already used inside the pointee.
+
+pub struct Buffer<'a> {
+    buf: &'a mut [u8],
+}
+
+pub fn foo<'a>(buffer: &mut Buffer<'a>) {
+    buffer.buf = &mut buffer.buf[..];
+    //~^ ERROR explicit lifetime required in the type of `buffer`
+}
+
+pub struct Wrapper<'a> {
+    inner: Buffer<'a>,
+}
+
+pub fn baz<'a>(wrapper: &mut Wrapper<'a>) {
+    wrapper.inner.buf = &mut wrapper.inner.buf[..];
+    //~^ ERROR explicit lifetime required in the type of `wrapper`
+}
+
+fn main() {}
diff --git a/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime.stderr b/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime.stderr
new file mode 100644
index 0000000..488c960
--- /dev/null
+++ b/tests/ui/lifetimes/lifetime-errors/e0621-mut-ref-aliases-pointee-lifetime.stderr
@@ -0,0 +1,19 @@
+error[E0621]: explicit lifetime required in the type of `buffer`
+  --> $DIR/e0621-mut-ref-aliases-pointee-lifetime.rs:10:5
+   |
+LL |     buffer.buf = &mut buffer.buf[..];
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
+   |
+   = help: see <https://doc.rust-lang.org/nomicon/borrow-splitting.html> for more information about lifetime errors related to mutable references
+
+error[E0621]: explicit lifetime required in the type of `wrapper`
+  --> $DIR/e0621-mut-ref-aliases-pointee-lifetime.rs:19:5
+   |
+LL |     wrapper.inner.buf = &mut wrapper.inner.buf[..];
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
+   |
+   = help: see <https://doc.rust-lang.org/nomicon/borrow-splitting.html> for more information about lifetime errors related to mutable references
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs
index 7b2bfbb..bac086b 100644
--- a/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs
+++ b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs
@@ -1,5 +1,4 @@
-//! Auxiliary crate for <https://github.com/rust-lang/rust/issues/18913>.
-
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/18913
 //@ no-prefer-dynamic
 
 #![crate_type = "rlib"]
diff --git a/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs
index fc0d3d6ea..05dba52 100644
--- a/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs
+++ b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs
@@ -1,5 +1,4 @@
-//! Auxiliary crate for <https://github.com/rust-lang/rust/issues/18913>.
-
+//! Auxiliary crate testing this issue https://github.com/rust-lang/rust/issues/18913
 //@ no-prefer-dynamic
 
 #![crate_type = "rlib"]
diff --git a/tests/ui/linking/staticlib-hide-internal-symbols-wrong-crate-type.rs b/tests/ui/linking/staticlib-hide-internal-symbols-wrong-crate-type.rs
new file mode 100644
index 0000000..26b8005
--- /dev/null
+++ b/tests/ui/linking/staticlib-hide-internal-symbols-wrong-crate-type.rs
@@ -0,0 +1,8 @@
+//@ check-pass
+//@ compile-flags: -Zstaticlib-hide-internal-symbols --crate-type bin
+
+#![feature(no_core)]
+#![no_core]
+#![no_main]
+
+//~? WARN has no effect without `--crate-type staticlib`
diff --git a/tests/ui/linking/staticlib-hide-internal-symbols-wrong-crate-type.stderr b/tests/ui/linking/staticlib-hide-internal-symbols-wrong-crate-type.stderr
new file mode 100644
index 0000000..b206dbf
--- /dev/null
+++ b/tests/ui/linking/staticlib-hide-internal-symbols-wrong-crate-type.stderr
@@ -0,0 +1,2 @@
+warning: -Zstaticlib-hide-internal-symbols has no effect without `--crate-type staticlib`
+
diff --git a/tests/ui/lint/non-snake-case/lint-uppercase-variables.rs b/tests/ui/lint/non-snake-case/lint-uppercase-variables.rs
index be34504..aefbe63 100644
--- a/tests/ui/lint/non-snake-case/lint-uppercase-variables.rs
+++ b/tests/ui/lint/non-snake-case/lint-uppercase-variables.rs
@@ -1,7 +1,7 @@
 #![warn(unused)]
 #![allow(dead_code)]
 #![deny(non_snake_case)]
-//@ ignore-parallel-frontend `note`s on different source lines
+
 mod foo {
     pub enum Foo { Foo }
 }
diff --git a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs
index 3b8cbe9..7a3e4fa 100644
--- a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs
+++ b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs
@@ -2,12 +2,11 @@
 //@ compile-flags: --force-warn unused_variables
 //@ compile-flags: --force-warn unused_mut
 //@ check-pass
-//@ ignore-parallel-frontend `note`s on different source lines
+
 fn expect_early_pass_lint() {
     #[expect(while_true)]
     while true {
         //~^ WARNING denote infinite loops with `loop { ... }` [while_true]
-        //~| NOTE requested on the command line with `--force-warn while-true`
         //~| HELP use `loop`
         println!("I never stop")
     }
@@ -17,7 +16,6 @@ fn expect_early_pass_lint() {
 fn check_specific_lint() {
     let x = 2;
     //~^ WARNING unused variable: `x` [unused_variables]
-    //~| NOTE requested on the command line with `--force-warn unused-variables`
     //~| HELP if this is intentional, prefix it with an underscore
 }
 
@@ -29,7 +27,6 @@ fn check_multiple_lints_with_lint_group() {
 
     let mut what_does_the_fox_say = "*ding* *deng* *dung*";
     //~^ WARNING variable does not need to be mutable [unused_mut]
-    //~| NOTE requested on the command line with `--force-warn unused-mut`
     //~| HELP remove this `mut`
 
     println!("The fox says: {what_does_the_fox_say}");
diff --git a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr
index dbfdfc7..60ab04f 100644
--- a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr
+++ b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr
@@ -7,7 +7,7 @@
    = note: requested on the command line with `--force-warn while-true`
 
 warning: unused variable: `x`
-  --> $DIR/force_warn_expected_lints_fulfilled.rs:18:9
+  --> $DIR/force_warn_expected_lints_fulfilled.rs:17:9
    |
 LL |     let x = 2;
    |         ^ help: if this is intentional, prefix it with an underscore: `_x`
@@ -15,7 +15,7 @@
    = note: requested on the command line with `--force-warn unused-variables`
 
 warning: variable does not need to be mutable
-  --> $DIR/force_warn_expected_lints_fulfilled.rs:30:9
+  --> $DIR/force_warn_expected_lints_fulfilled.rs:28:9
    |
 LL |     let mut what_does_the_fox_say = "*ding* *deng* *dung*";
    |         ----^^^^^^^^^^^^^^^^^^^^^
@@ -25,13 +25,13 @@
    = note: requested on the command line with `--force-warn unused-mut`
 
 warning: unused variable: `fox_name`
-  --> $DIR/force_warn_expected_lints_fulfilled.rs:26:9
+  --> $DIR/force_warn_expected_lints_fulfilled.rs:24:9
    |
 LL |     let fox_name = "Sir Nibbles";
    |         ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_fox_name`
 
 warning: unused variable: `this_should_fulfill_the_expectation`
-  --> $DIR/force_warn_expected_lints_fulfilled.rs:41:9
+  --> $DIR/force_warn_expected_lints_fulfilled.rs:38:9
    |
 LL |     let this_should_fulfill_the_expectation = "The `#[allow]` has no power here";
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_this_should_fulfill_the_expectation`
diff --git a/tests/ui/lint/unused/unused-assign-148960.rs b/tests/ui/lint/unused/unused-assign-148960.rs
index b7e129a..1adca15 100644
--- a/tests/ui/lint/unused/unused-assign-148960.rs
+++ b/tests/ui/lint/unused/unused-assign-148960.rs
@@ -1,5 +1,5 @@
 //@ check-fail
-//@ ignore-parallel-frontend unstable liveness diagnostics
+
 #![deny(unused)]
 #![allow(dead_code)]
 
diff --git a/tests/ui/lint/unused/unused-attr-macro-rules.stderr b/tests/ui/lint/unused/unused-attr-macro-rules.stderr
index b90054b..b736235 100644
--- a/tests/ui/lint/unused/unused-attr-macro-rules.stderr
+++ b/tests/ui/lint/unused/unused-attr-macro-rules.stderr
@@ -4,7 +4,7 @@
 LL | #[macro_use]
    | ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 note: the lint level is defined here
   --> $DIR/unused-attr-macro-rules.rs:1:9
diff --git a/tests/ui/liveness/liveness-consts.rs b/tests/ui/liveness/liveness-consts.rs
index b239e12..5079c46 100644
--- a/tests/ui/liveness/liveness-consts.rs
+++ b/tests/ui/liveness/liveness-consts.rs
@@ -1,5 +1,5 @@
 //@ check-pass
-//@ ignore-parallel-frontend unstable liveness diagnostics
+
 #![warn(unused)]
 #![allow(unreachable_code)]
 
diff --git a/tests/ui/liveness/liveness-dead.rs b/tests/ui/liveness/liveness-dead.rs
index c48b28e..004663c8 100644
--- a/tests/ui/liveness/liveness-dead.rs
+++ b/tests/ui/liveness/liveness-dead.rs
@@ -1,4 +1,3 @@
-//@ ignore-parallel-frontend unstable liveness diagnostics
 #![allow(dead_code)]
 #![deny(unused_assignments)]
 
diff --git a/tests/ui/liveness/liveness-dead.stderr b/tests/ui/liveness/liveness-dead.stderr
index 2288fae..ade0e04 100644
--- a/tests/ui/liveness/liveness-dead.stderr
+++ b/tests/ui/liveness/liveness-dead.stderr
@@ -1,5 +1,5 @@
 error: value assigned to `x` is never read
-  --> $DIR/liveness-dead.rs:10:24
+  --> $DIR/liveness-dead.rs:9:24
    |
 LL |     let mut x: isize = 3;
    |                        ^ this value is reassigned later and never used
@@ -7,13 +7,13 @@
    |     ----- `x` is overwritten here before the previous value is read
    |
 note: the lint level is defined here
-  --> $DIR/liveness-dead.rs:3:9
+  --> $DIR/liveness-dead.rs:2:9
    |
 LL | #![deny(unused_assignments)]
    |         ^^^^^^^^^^^^^^^^^^
 
 error: value assigned to `x` is never read
-  --> $DIR/liveness-dead.rs:18:5
+  --> $DIR/liveness-dead.rs:17:5
    |
 LL |     x = 4;
    |     ^^^^^
@@ -21,7 +21,7 @@
    = help: maybe it is overwritten before being read?
 
 error: value passed to `x` is never read
-  --> $DIR/liveness-dead.rs:21:7
+  --> $DIR/liveness-dead.rs:20:7
    |
 LL | fn f4(mut x: i32) {
    |       ^^^^^
@@ -29,7 +29,7 @@
    = help: maybe it is overwritten before being read?
 
 error: value assigned to `x` is never read
-  --> $DIR/liveness-dead.rs:28:5
+  --> $DIR/liveness-dead.rs:27:5
    |
 LL |     x = 4;
    |     ^^^^^
diff --git a/tests/ui/liveness/liveness-unused.rs b/tests/ui/liveness/liveness-unused.rs
index 95345c2..a291d24 100644
--- a/tests/ui/liveness/liveness-unused.rs
+++ b/tests/ui/liveness/liveness-unused.rs
@@ -3,7 +3,7 @@
 #![deny(unused_assignments)]
 #![allow(dead_code, non_camel_case_types, trivial_numeric_casts, dropping_copy_types)]
 #![feature(intrinsics)]
-//@ ignore-parallel-frontend `note`s on different source lines
+
 use std::ops::AddAssign;
 
 fn f1(x: isize) {
diff --git a/tests/ui/liveness/liveness-upvars.rs b/tests/ui/liveness/liveness-upvars.rs
index 1a3d0e5..0d24fa1 100644
--- a/tests/ui/liveness/liveness-upvars.rs
+++ b/tests/ui/liveness/liveness-upvars.rs
@@ -1,6 +1,6 @@
 //@ edition:2018
 //@ check-pass
-//@ ignore-parallel-frontend unstable liveness diagnostics
+
 #![feature(coroutines, stmt_expr_attributes)]
 #![warn(unused)]
 #![allow(unreachable_code)]
diff --git a/tests/ui/liveness/unused-assignments-diverging-branch-issue-156416.rs b/tests/ui/liveness/unused-assignments-diverging-branch-issue-156416.rs
index d1fb55d..9c7bca0 100644
--- a/tests/ui/liveness/unused-assignments-diverging-branch-issue-156416.rs
+++ b/tests/ui/liveness/unused-assignments-diverging-branch-issue-156416.rs
@@ -1,5 +1,5 @@
 //@ run-pass
-//@ ignore-parallel-frontend unstable liveness diagnostics
+
 #![allow(dead_code)]
 #![warn(unused_assignments)]
 
diff --git a/tests/ui/macros/compile_error_macro-suppress-errors.stderr b/tests/ui/macros/compile_error_macro-suppress-errors.stderr
index bda1deb9..ec895c2 100644
--- a/tests/ui/macros/compile_error_macro-suppress-errors.stderr
+++ b/tests/ui/macros/compile_error_macro-suppress-errors.stderr
@@ -14,7 +14,9 @@
   --> $DIR/compile_error_macro-suppress-errors.rs:11:13
    |
 LL |         use crate::another_module::NotExist;
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `NotExist` in `another_module`
+   |             ^^^^^^^^^^^^^^^^^^^^^^^--------
+   |                                    |
+   |                                    no `NotExist` in `another_module`
 
 error[E0433]: cannot find `Hello` in `another_module`
   --> $DIR/compile_error_macro-suppress-errors.rs:37:55
diff --git a/tests/ui/macros/issue-35450.rs b/tests/ui/macros/issue-35450.rs
index ac4c163..0eb741e 100644
--- a/tests/ui/macros/issue-35450.rs
+++ b/tests/ui/macros/issue-35450.rs
@@ -1,5 +1,5 @@
 macro_rules! m { ($($t:tt)*) => { $($t)* } }
 
 fn main() {
-    m!($t); //~ ERROR expected expression
+    m!($t); //~ ERROR cannot find macro parameter `$t` in this scope
 }
diff --git a/tests/ui/macros/issue-35450.stderr b/tests/ui/macros/issue-35450.stderr
index 6f06df3..4a6325deb 100644
--- a/tests/ui/macros/issue-35450.stderr
+++ b/tests/ui/macros/issue-35450.stderr
@@ -1,8 +1,8 @@
-error: expected expression, found `$`
+error: cannot find macro parameter `$t` in this scope
   --> $DIR/issue-35450.rs:4:8
    |
 LL |     m!($t);
-   |        ^ expected expression
+   |        ^^ not found in this scope
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/macros/issue-6596-1.rs b/tests/ui/macros/issue-6596-1.rs
index 25f1d65..1182af4 100644
--- a/tests/ui/macros/issue-6596-1.rs
+++ b/tests/ui/macros/issue-6596-1.rs
@@ -1,10 +1,18 @@
 macro_rules! e {
     ($inp:ident) => (
         $nonexistent
-        //~^ ERROR expected expression, found `$`
+        //~^ ERROR cannot find macro parameter `$nonexistent` in this scope
+    );
+}
+
+macro_rules! m {
+    () => (
+        $x
+        //~^ ERROR cannot find macro parameter `$x` in this scope
     );
 }
 
 fn main() {
     e!(foo);
+    m!();
 }
diff --git a/tests/ui/macros/issue-6596-1.stderr b/tests/ui/macros/issue-6596-1.stderr
index cb66dcc..92998ab 100644
--- a/tests/ui/macros/issue-6596-1.stderr
+++ b/tests/ui/macros/issue-6596-1.stderr
@@ -1,11 +1,8 @@
-error: expected expression, found `$`
+error: cannot find macro parameter `$nonexistent` in this scope
   --> $DIR/issue-6596-1.rs:3:9
    |
 LL |         $nonexistent
-   |         ^-----------
-   |         ||
-   |         |macro metavariable not found
-   |         expected expression
+   |         ^^^^^^^^^^^^ not found in this scope
 ...
 LL |     e!(foo);
    |     ------- in this macro invocation
@@ -13,5 +10,16 @@
    = note: available metavariable names are: $inp
    = note: this error originates in the macro `e` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 1 previous error
+error: cannot find macro parameter `$x` in this scope
+  --> $DIR/issue-6596-1.rs:10:9
+   |
+LL |         $x
+   |         ^^ not found in this scope
+...
+LL |     m!();
+   |     ---- in this macro invocation
+   |
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/macros/typo-in-norepeat-expr-2.rs b/tests/ui/macros/typo-in-norepeat-expr-2.rs
index 48b64c2..eba9f7d 100644
--- a/tests/ui/macros/typo-in-norepeat-expr-2.rs
+++ b/tests/ui/macros/typo-in-norepeat-expr-2.rs
@@ -3,9 +3,9 @@
         [$arg]
     };
     (begin1 $arg1:ident end $agr2:expr) => {
-        [$follow] //~ ERROR: expected expression, found `$`
-        //~^ NOTE: there is an macro metavariable with this name in another macro matcher
-        //~| NOTE: expected expression
+        [$follow] //~ ERROR: cannot find macro parameter `$follow` in this scope
+        //~^ NOTE: not found in this scope
+        //~| NOTE: there is an macro metavariable with this name in another macro matcher
     };
 }
 
@@ -14,8 +14,8 @@ macro_rules! err1 {
         [$arg]
     };
     (begin1 $arg1:ident end) => {
-        [$follo] //~ ERROR: expected expression, found `$`
-        //~| NOTE: expected expression
+        [$follo] //~ ERROR: cannot find macro parameter `$follo` in this scope
+        //~^ NOTE: not found in this scope
         //~| HELP: there is a macro metavariable with a similar name in another macro matcher
     };
 }
@@ -25,10 +25,9 @@ macro_rules! err2 {
         [$arg]
     };
     (begin1 $arg1:ident end) => {
-        [$xyz] //~ ERROR: expected expression, found `$`
-        //~^ NOTE: expected expression
+        [$xyz] //~ ERROR: cannot find macro parameter `$xyz` in this scope
+        //~^ NOTE: not found in this scope
         //~| NOTE available metavariable names are: $arg1
-        //~| NOTE: macro metavariable not found
     };
 }
 
diff --git a/tests/ui/macros/typo-in-norepeat-expr-2.stderr b/tests/ui/macros/typo-in-norepeat-expr-2.stderr
index 20390cc..50d5dea 100644
--- a/tests/ui/macros/typo-in-norepeat-expr-2.stderr
+++ b/tests/ui/macros/typo-in-norepeat-expr-2.stderr
@@ -1,22 +1,22 @@
-error: expected expression, found `$`
+error: cannot find macro parameter `$follow` in this scope
   --> $DIR/typo-in-norepeat-expr-2.rs:6:10
    |
 LL |         [$follow]
    |          ^------
    |          ||
    |          |there is an macro metavariable with this name in another macro matcher
-   |          expected expression
+   |          not found in this scope
 ...
 LL |     let _ = err![begin1 x  end ig];
    |             ---------------------- in this macro invocation
    |
    = note: this error originates in the macro `err` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: expected expression, found `$`
+error: cannot find macro parameter `$follo` in this scope
   --> $DIR/typo-in-norepeat-expr-2.rs:17:10
    |
 LL |         [$follo]
-   |          ^^^^^^ expected expression
+   |          ^^^^^^ not found in this scope
 ...
 LL |     let _ = err1![begin1 x  end];
    |             -------------------- in this macro invocation
@@ -27,14 +27,11 @@
 LL |         [$follow]
    |                +
 
-error: expected expression, found `$`
+error: cannot find macro parameter `$xyz` in this scope
   --> $DIR/typo-in-norepeat-expr-2.rs:28:10
    |
 LL |         [$xyz]
-   |          ^---
-   |          ||
-   |          |macro metavariable not found
-   |          expected expression
+   |          ^^^^ not found in this scope
 ...
 LL |     let _ = err2![begin1 x  end];
    |             -------------------- in this macro invocation
diff --git a/tests/ui/macros/typo-in-norepeat-expr.fixed b/tests/ui/macros/typo-in-norepeat-expr.fixed
index b06337e..64742d6 100644
--- a/tests/ui/macros/typo-in-norepeat-expr.fixed
+++ b/tests/ui/macros/typo-in-norepeat-expr.fixed
@@ -1,12 +1,14 @@
 //@ run-rustfix
 macro_rules! m {
     (begin $ard:ident end) => {
-        [$ard] //~ ERROR: expected expression, found `$`
-        //~^ HELP: there is a macro metavariable with a similar name
+        [$ard] //~ ERROR: cannot find macro parameter `$arg` in this scope
+        //~^ NOTE: not found in this scope
+        //~| HELP: there is a macro metavariable with a similar name
     };
 }
 
 fn main() {
     let x = 1;
-    let _ = m![begin x end];
+    let _ = m![begin x end]; //~ NOTE: in this expansion of m!
+    //~| NOTE: in this expansion of m!
 }
diff --git a/tests/ui/macros/typo-in-norepeat-expr.rs b/tests/ui/macros/typo-in-norepeat-expr.rs
index 8a155c5..8799d87 100644
--- a/tests/ui/macros/typo-in-norepeat-expr.rs
+++ b/tests/ui/macros/typo-in-norepeat-expr.rs
@@ -1,12 +1,14 @@
 //@ run-rustfix
 macro_rules! m {
     (begin $ard:ident end) => {
-        [$arg] //~ ERROR: expected expression, found `$`
-        //~^ HELP: there is a macro metavariable with a similar name
+        [$arg] //~ ERROR: cannot find macro parameter `$arg` in this scope
+        //~^ NOTE: not found in this scope
+        //~| HELP: there is a macro metavariable with a similar name
     };
 }
 
 fn main() {
     let x = 1;
-    let _ = m![begin x end];
+    let _ = m![begin x end]; //~ NOTE: in this expansion of m!
+    //~| NOTE: in this expansion of m!
 }
diff --git a/tests/ui/macros/typo-in-norepeat-expr.stderr b/tests/ui/macros/typo-in-norepeat-expr.stderr
index 9a25e36..72fdac0 100644
--- a/tests/ui/macros/typo-in-norepeat-expr.stderr
+++ b/tests/ui/macros/typo-in-norepeat-expr.stderr
@@ -1,8 +1,8 @@
-error: expected expression, found `$`
+error: cannot find macro parameter `$arg` in this scope
   --> $DIR/typo-in-norepeat-expr.rs:4:10
    |
 LL |         [$arg]
-   |          ^^^^ expected expression
+   |          ^^^^ not found in this scope
 ...
 LL |     let _ = m![begin x end];
    |             --------------- in this macro invocation
diff --git a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs
index b69b893..000826c 100644
--- a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs
+++ b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs
@@ -1,12 +1,12 @@
-//@ known-bug: #109481
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
 //
-// While the `T: Copy` is always applicable when checking
-// that the impl `impl<T: Copy> F for T {}` is well formed,
-// the old trait solver can only approximate this by checking
-// that there are no inference variables in the obligation and
-// no region constraints in the evaluation result.
+// Regression test for #109481 and #84917.  See #153847.
 //
-// Because of this we end up with ambiguity here.
+// A bug previously made marker trait winnowing order-dependent,
+// producing a spurious E0310 here.
 #![feature(marker_trait_attr)]
 
 #[marker]
diff --git a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
deleted file mode 100644
index daee4e6..0000000
--- a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/overlapping-impl-1-modulo-regions.rs:14:21
-   |
-LL | impl<T: Copy> F for T {}
-   |                     ^
-   |                     |
-   |                     the parameter type `T` must be valid for the static lifetime...
-   |                     ...so that the type `T` will meet its required lifetime bounds
-   |
-help: consider adding an explicit lifetime bound
-   |
-LL | impl<T: Copy + 'static> F for T {}
-   |              +++++++++
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0310`.
diff --git a/tests/ui/marker_trait_attr/overlapping-impl-assoc-ty-binding-static.rs b/tests/ui/marker_trait_attr/overlapping-impl-assoc-ty-binding-static.rs
new file mode 100644
index 0000000..7fbb632
--- /dev/null
+++ b/tests/ui/marker_trait_attr/overlapping-impl-assoc-ty-binding-static.rs
@@ -0,0 +1,79 @@
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+//
+// This demonstrates that the `has_non_region_infer()`
+// disjunctive check in the `TypeOutlives` handler in
+// `evaluate_predicate_recursively` is load bearing with respect to
+// marker trait winnowing.
+//
+// It's harder than one might imagine to demonstrate this.  The outer
+// obligation must be a marker trait predicate, otherwise winnowing
+// gives up on any nontrivial multi-candidate case.  This prevents us
+// from simply making the outer obligation a type-outlives obligation.
+//
+// But the outer obligation must also be free of nonregion infer
+// vars.  Otherwise, when we're considering candidates, each
+// call to `prefer_lhs_over_victim` will return `false` and
+// we'll get ambiguity.
+//
+// Together, these imply that the infer var must come from the
+// impl.  It can't come from our starting obligation.  So we need a
+// subobligation, produced by candidate evaluation, that is both 1) a
+// `TypeOutlives` predicate and 2) has an infer var.
+//
+// To make the would-be bug visible, we need 1) the candidate with the
+// infer var to be picked as the winner, 2) the winner's WCs to fail,
+// and 3) at least one other candidate in the winnowing set that gets
+// marked `EvaluatedToOK`.
+//
+// How do we introduce an inference variable from an impl?  All
+// inference variables used in the trait ref (the trait and its
+// generic arguments, including `Self`) will have been resolved
+// and substituted by this point.  We can't simply constrain a type
+// parameter only by a lifetime -- that will produce an error about
+// the parameter not being constrained (E0207).  Fortunately, if
+// we bind that parameter to a trait associated type it will be
+// treated as constrained.  Then, we can add a type-outlives bound
+// on it.  This then survives as an infer var all the way to the
+// `TypeOutlives` handler.
+//
+// Without the `has_non_region_infer()` check in the `TypeOutlives`
+// handler, this `?U: 'static` would produce `EvaluatedToOk` rather
+// than `EvaluatedToOkModuloRegions`.  Because this impl appears
+// second, marker trait winnowing would pick it as the winner and we'd
+// register the `?U: 'static` obligation.  That would then fail, after
+// we substitute `?U = X`, and we'd get a spurious "may not live long
+// enough" (E0310) error.
+//
+// With the check, the second impl gets `EvaluatedToOkModuloRegions`,
+// so the first impl correctly wins.
+//
+// See #153847.
+#![feature(marker_trait_attr)]
+
+trait Assoc {
+    type Ty;
+}
+impl<T> Assoc for T {
+    type Ty = T;
+}
+
+#[marker]
+trait Marker {}
+
+impl<T> Marker for T where T: Assoc {}
+impl<T, U> Marker for T
+where
+    T: Assoc<Ty = U>,
+    U: 'static,
+{
+}
+
+fn requires<T: Marker>() {}
+fn use_marker<X>() {
+    requires::<X>();
+}
+
+fn main() {}
diff --git a/tests/ui/marker_trait_attr/overlapping-impl-infer-resolved-to-param.rs b/tests/ui/marker_trait_attr/overlapping-impl-infer-resolved-to-param.rs
new file mode 100644
index 0000000..49b2249
--- /dev/null
+++ b/tests/ui/marker_trait_attr/overlapping-impl-infer-resolved-to-param.rs
@@ -0,0 +1,52 @@
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+//
+// This demonstrates that the `has_non_region_param()`
+// disjunctive check in the `TypeOutlives` handler in
+// `evaluate_predicate_recursively` is load bearing with respect to
+// marker trait winnowing.
+//
+// Conversely, this does *not* show that the `has_non_region_infer()`
+// check is load bearing -- you could be forgiven for thinking that
+// it would.  The `f::<u8, _>` will result in a `u8: Marker<?U>`
+// obligation; candidate evaluation will produce a `?U: 'static`
+// subobligation.  The infer var *will* reach the check in
+// question.  But then, in `prefer_lhs_over_victim`, we check for
+// `!has_non_region_infer` (there's a long comment there describing
+// the subtle reason why).  This causes us to defer making a
+// selection.  At a later point, when we check again, we'll have
+// equated and substituted `?U = X`, so there won't be an infer var,
+// but there will be a type parameter.
+//
+// Without the `has_non_region_param()` check in the
+// `TypeOutlives` handler, the substituted `X: 'static` obligation
+// from the impl would produce `EvaluatedToOk` rather than
+// `EvaluatedToOkModuloRegions`.  Because this impl appears second,
+// marker trait winnowing would pick it as the winner and we'd
+// register the `X: 'static` obligation.  That would then fail, and
+// we'd get a spurious "may not live long enough" (E0310) error.
+//
+// With the check, the second impl gets `EvaluatedToOkModuloRegions`,
+// so the first impl correctly wins.
+//
+// See #153847.
+#![feature(marker_trait_attr)]
+
+#[marker]
+trait Marker<T> {}
+
+impl<T> Marker<T> for u8 {}
+impl<T: 'static> Marker<T> for u8 {}
+
+fn f<T: Marker<U>, U>() -> U {
+    loop {}
+}
+
+fn g<X>() {
+    let x = f::<u8, _>();
+    let _: X = x;
+}
+
+fn main() {}
diff --git a/tests/ui/marker_trait_attr/overlapping-impl-projection-static.rs b/tests/ui/marker_trait_attr/overlapping-impl-projection-static.rs
new file mode 100644
index 0000000..d23fc16
--- /dev/null
+++ b/tests/ui/marker_trait_attr/overlapping-impl-projection-static.rs
@@ -0,0 +1,41 @@
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+//
+// This demonstrates that the `has_non_region_param()`
+// disjunctive check in the `TypeOutlives` handler in
+// `evaluate_predicate_recursively` is load bearing with respect to
+// marker trait winnowing.
+//
+// This test is interesting because the projection reaches the
+// `TypeOutlives` handler unnormalized.
+//
+// If not for the `has_non_region_param()` disjunct, the
+// `<T as Assoc>::Ty: 'static` would get `EvaluatedToOk` rather
+// than `EvaluatedToOkModuloRegions` and cause winnowing to select
+// the second impl.  The `'static` bound then gets registered as
+// a region obligation that borrowck can't discharge, causing a
+// spurious "may not live long enough" (E0310) error to be reported
+// against the first impl.
+//
+// With the check, the second impl gets `EvaluatedToOkModuloRegions`,
+// so the first impl correctly wins.
+//
+// See #153847.
+#![feature(marker_trait_attr)]
+
+#[marker]
+trait Marker {}
+
+trait Assoc {
+    type Ty;
+}
+impl<T> Assoc for T {
+    type Ty = T;
+}
+
+impl<T: Assoc> Marker for T where <T as Assoc>::Ty: Copy {}
+impl<T: Assoc> Marker for T where <T as Assoc>::Ty: 'static {}
+
+fn main() {}
diff --git a/tests/ui/issues/issue-19367.rs b/tests/ui/match/match-field-reassign.rs
similarity index 73%
rename from tests/ui/issues/issue-19367.rs
rename to tests/ui/match/match-field-reassign.rs
index 1cd6c48..c7135ac 100644
--- a/tests/ui/issues/issue-19367.rs
+++ b/tests/ui/match/match-field-reassign.rs
@@ -1,3 +1,8 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19367>.
+//!
+//! Make sure we don't reuse the same alloca when matching
+//! on field of struct or tuple which we reassign in the match body.
+
 //@ run-pass
 
 #![allow(unused_assignments)]
@@ -6,9 +11,6 @@ struct S {
     o: Option<String>
 }
 
-// Make sure we don't reuse the same alloca when matching
-// on field of struct or tuple which we reassign in the match body.
-
 fn main() {
     let mut a = (0, Some("right".to_string()));
     let b = match a.1 {
diff --git a/tests/ui/issues/issue-20414.rs b/tests/ui/methods/calling-conventions-with-where-clause-ref-bound.rs
similarity index 62%
rename from tests/ui/issues/issue-20414.rs
rename to tests/ui/methods/calling-conventions-with-where-clause-ref-bound.rs
index 070e0f4..b5dc8b4 100644
--- a/tests/ui/issues/issue-20414.rs
+++ b/tests/ui/methods/calling-conventions-with-where-clause-ref-bound.rs
@@ -1,3 +1,8 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/20414>.
+//!
+//! Test both UFCS and dot syntax should work for trait methods when the
+//! impl has a where-clause bound on a reference type.
+
 //@ check-pass
 #![allow(dead_code)]
 
diff --git a/tests/ui/issues/issue-20186.rs b/tests/ui/methods/method-call-in-iter-str-bytes.rs
similarity index 75%
rename from tests/ui/issues/issue-20186.rs
rename to tests/ui/methods/method-call-in-iter-str-bytes.rs
index 79dad71..1049c40 100644
--- a/tests/ui/issues/issue-20186.rs
+++ b/tests/ui/methods/method-call-in-iter-str-bytes.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/20186>.
+
 //@ check-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
diff --git a/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.rs b/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.rs
new file mode 100644
index 0000000..0a98cde
--- /dev/null
+++ b/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.rs
@@ -0,0 +1,24 @@
+//! Regression test for #157189.
+//!
+//! When a method call fails to resolve, the "trait which provides `<method>` is
+//! implemented but not in scope" diagnostic probes all traits for a method of the
+//! same name. Here `.borrow()` matches `std::borrow::Borrow::borrow`, and `Borrow`
+//! has a generic parameter (`Borrowed`) besides `Self`. Building the trait
+//! reference for the diagnostic used to pass only the receiver type as the single
+//! argument, which mismatched the trait's generics and ICEd in
+//! `debug_assert_args_compatible`. It should just report the error.
+
+trait Foo {
+    extern "C" fn borrow(&self);
+}
+
+struct Bar;
+
+fn main() {
+    let foo: Box<dyn Fn(bool) -> usize> = Box::new(Bar);
+    //~^ ERROR expected a `Fn(bool)` closure, found `Bar`
+    foo.borrow();
+    //~^ ERROR no method named `borrow` found
+    foo.take()
+    //~^ ERROR `Box<dyn Fn(bool) -> usize>` is not an iterator
+}
diff --git a/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.stderr b/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.stderr
new file mode 100644
index 0000000..aa46a41
--- /dev/null
+++ b/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.stderr
@@ -0,0 +1,65 @@
+error[E0599]: no method named `borrow` found for struct `Box<dyn Fn(bool) -> usize>` in the current scope
+  --> $DIR/method-suggestion-trait-with-extra-generics-no-ice.rs:20:9
+   |
+LL |     foo.borrow();
+   |         ^^^^^^
+   |
+  --> $SRC_DIR/core/src/borrow.rs:LL:COL
+   |
+   = note: the method is available for `Box<dyn Fn(bool) -> usize>` here
+   |
+   = help: items from traits can only be used if the trait is in scope
+help: use parentheses to call this trait object
+   |
+LL |     foo(/* bool */).borrow();
+   |        ++++++++++++
+help: trait `Borrow` which provides `borrow` is implemented but not in scope; perhaps you want to import it
+   |
+LL + use std::borrow::Borrow;
+   |
+help: there is a method `borrow_mut` with a similar name
+   |
+LL |     foo.borrow_mut();
+   |               ++++
+
+error[E0277]: expected a `Fn(bool)` closure, found `Bar`
+  --> $DIR/method-suggestion-trait-with-extra-generics-no-ice.rs:18:43
+   |
+LL |     let foo: Box<dyn Fn(bool) -> usize> = Box::new(Bar);
+   |                                           ^^^^^^^^^^^^^ expected an `Fn(bool)` closure, found `Bar`
+   |
+help: the trait `Fn(bool)` is not implemented for `Bar`
+  --> $DIR/method-suggestion-trait-with-extra-generics-no-ice.rs:15:1
+   |
+LL | struct Bar;
+   | ^^^^^^^^^^
+   = note: required for the cast from `Box<Bar>` to `Box<dyn Fn(bool) -> usize>`
+
+error[E0599]: `Box<dyn Fn(bool) -> usize>` is not an iterator
+  --> $DIR/method-suggestion-trait-with-extra-generics-no-ice.rs:22:9
+   |
+LL |     foo.take()
+   |         ^^^^
+   |         |
+   |         this is an associated function, not a method
+   |         `Box<dyn Fn(bool) -> usize>` is not an iterator
+   |
+   = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
+   = note: the candidate is defined in an impl for the type `Box<T, A>`
+   = note: the following trait bounds were not satisfied:
+           `dyn Fn(bool) -> usize: Iterator`
+           which is required by `Box<dyn Fn(bool) -> usize>: Iterator`
+           `Box<dyn Fn(bool) -> usize>: Iterator`
+           which is required by `&mut Box<dyn Fn(bool) -> usize>: Iterator`
+           `dyn Fn(bool) -> usize: Iterator`
+           which is required by `&mut dyn Fn(bool) -> usize: Iterator`
+help: use associated function syntax instead
+   |
+LL -     foo.take()
+LL +     Box::<dyn Fn(bool) -> usize>::take(foo)
+   |
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0277, E0599.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/methods/option-cloned-copied-non-ref-excluded.rs b/tests/ui/methods/option-cloned-copied-non-ref-excluded.rs
new file mode 100644
index 0000000..317ec4b
--- /dev/null
+++ b/tests/ui/methods/option-cloned-copied-non-ref-excluded.rs
@@ -0,0 +1,27 @@
+// Tests that the guard for `.cloned()`/`.copied()` on `Option<T>` correctly
+// excludes inner types where the targeted diagnostic would be wrong:
+//
+// - `Option<&T>`: `Option<&T>` has inherent `cloned()`/`copied()` methods,
+//   so these compile successfully and the guard must not fire.
+// - `Option<T>` (generic param): falls through to the standard "not an
+//   iterator / call .into_iter() first" diagnostic.
+//
+// See https://github.com/rust-lang/rust/issues/151147
+
+// Reference inner type: these should compile without error.
+pub fn cloned_on_ref(x: Option<&i32>) -> Option<i32> {
+    x.cloned()
+}
+
+pub fn copied_on_ref(x: Option<&i32>) -> Option<i32> {
+    x.copied()
+}
+
+// Generic param inner type: falls through to the standard diagnostic.
+pub fn cloned_on_param<T: Clone>(x: Option<T>) {
+    x.cloned();
+    //~^ ERROR no method named `cloned` found for enum `Option<T>` in the current scope
+    //~| HELP call `.into_iter()` first
+}
+
+fn main() {}
diff --git a/tests/ui/methods/option-cloned-copied-non-ref-excluded.stderr b/tests/ui/methods/option-cloned-copied-non-ref-excluded.stderr
new file mode 100644
index 0000000..7d44234
--- /dev/null
+++ b/tests/ui/methods/option-cloned-copied-non-ref-excluded.stderr
@@ -0,0 +1,14 @@
+error[E0599]: no method named `cloned` found for enum `Option<T>` in the current scope
+  --> $DIR/option-cloned-copied-non-ref-excluded.rs:22:7
+   |
+LL |     x.cloned();
+   |       ^^^^^^ `Option<T>` is not an iterator
+   |
+help: call `.into_iter()` first
+   |
+LL |     x.into_iter().cloned();
+   |       ++++++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/methods/option-cloned-copied-non-ref.fixed b/tests/ui/methods/option-cloned-copied-non-ref.fixed
new file mode 100644
index 0000000..203edf8
--- /dev/null
+++ b/tests/ui/methods/option-cloned-copied-non-ref.fixed
@@ -0,0 +1,26 @@
+// Tests that calling `.cloned()` or `.copied()` on `Option<T>` where `T` is an
+// owned (non-reference) type gives a targeted diagnostic instead of the
+// misleading "not an iterator / call .into_iter() first" suggestion.
+// See https://github.com/rust-lang/rust/issues/151147
+
+//@ run-rustfix
+
+pub fn cloned_on_owned(x: Option<i32>) -> i32 {
+    x.unwrap()
+    //~^ ERROR no method named `cloned` found for enum `Option<i32>` in the current scope
+    //~| HELP consider removing the `.cloned()` call
+}
+
+pub fn copied_on_owned(x: Option<i32>) -> i32 {
+    x.unwrap()
+    //~^ ERROR no method named `copied` found for enum `Option<i32>` in the current scope
+    //~| HELP consider removing the `.copied()` call
+}
+
+pub fn cloned_on_string(x: Option<String>) -> String {
+    x.unwrap()
+    //~^ ERROR no method named `cloned` found for enum `Option<String>` in the current scope
+    //~| HELP consider removing the `.cloned()` call
+}
+
+fn main() {}
diff --git a/tests/ui/methods/option-cloned-copied-non-ref.rs b/tests/ui/methods/option-cloned-copied-non-ref.rs
new file mode 100644
index 0000000..bf0c68e
--- /dev/null
+++ b/tests/ui/methods/option-cloned-copied-non-ref.rs
@@ -0,0 +1,26 @@
+// Tests that calling `.cloned()` or `.copied()` on `Option<T>` where `T` is an
+// owned (non-reference) type gives a targeted diagnostic instead of the
+// misleading "not an iterator / call .into_iter() first" suggestion.
+// See https://github.com/rust-lang/rust/issues/151147
+
+//@ run-rustfix
+
+pub fn cloned_on_owned(x: Option<i32>) -> i32 {
+    x.cloned().unwrap()
+    //~^ ERROR no method named `cloned` found for enum `Option<i32>` in the current scope
+    //~| HELP consider removing the `.cloned()` call
+}
+
+pub fn copied_on_owned(x: Option<i32>) -> i32 {
+    x.copied().unwrap()
+    //~^ ERROR no method named `copied` found for enum `Option<i32>` in the current scope
+    //~| HELP consider removing the `.copied()` call
+}
+
+pub fn cloned_on_string(x: Option<String>) -> String {
+    x.cloned().unwrap()
+    //~^ ERROR no method named `cloned` found for enum `Option<String>` in the current scope
+    //~| HELP consider removing the `.cloned()` call
+}
+
+fn main() {}
diff --git a/tests/ui/methods/option-cloned-copied-non-ref.stderr b/tests/ui/methods/option-cloned-copied-non-ref.stderr
new file mode 100644
index 0000000..81072c2
--- /dev/null
+++ b/tests/ui/methods/option-cloned-copied-non-ref.stderr
@@ -0,0 +1,30 @@
+error[E0599]: no method named `cloned` found for enum `Option<i32>` in the current scope
+  --> $DIR/option-cloned-copied-non-ref.rs:9:7
+   |
+LL |     x.cloned().unwrap()
+   |      -^^^^^^--
+   |      ||
+   |      |this method is only available on `Option<&_>`
+   |      help: consider removing the `.cloned()` call
+
+error[E0599]: no method named `copied` found for enum `Option<i32>` in the current scope
+  --> $DIR/option-cloned-copied-non-ref.rs:15:7
+   |
+LL |     x.copied().unwrap()
+   |      -^^^^^^--
+   |      ||
+   |      |this method is only available on `Option<&_>`
+   |      help: consider removing the `.copied()` call
+
+error[E0599]: no method named `cloned` found for enum `Option<String>` in the current scope
+  --> $DIR/option-cloned-copied-non-ref.rs:21:7
+   |
+LL |     x.cloned().unwrap()
+   |      -^^^^^^--
+   |      ||
+   |      |this method is only available on `Option<&_>`
+   |      help: consider removing the `.cloned()` call
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/moves/moves-based-on-type-block-bad.fixed b/tests/ui/moves/moves-based-on-type-block-bad.fixed
new file mode 100644
index 0000000..c272203
--- /dev/null
+++ b/tests/ui/moves/moves-based-on-type-block-bad.fixed
@@ -0,0 +1,31 @@
+//@ run-rustfix
+#![feature(box_patterns)]
+#![allow(dead_code)]
+
+
+struct S {
+    x: Box<E>
+}
+
+enum E {
+    Foo(Box<S>),
+    Bar(Box<isize>),
+    Baz
+}
+
+fn f<G>(s: &S, g: G) where G: FnOnce(&S) {
+    g(s)
+}
+
+fn main() {
+    let s = S { x: Box::new(E::Bar(Box::new(42))) };
+    loop {
+        f(&s, |hellothere| {
+            match hellothere.x { //~ ERROR cannot move out
+                box E::Foo(_) => {}
+                box E::Bar(ref x) => println!("{}", x.to_string()),
+                box E::Baz => {}
+            }
+        })
+    }
+}
diff --git a/tests/ui/moves/moves-based-on-type-block-bad.rs b/tests/ui/moves/moves-based-on-type-block-bad.rs
index eca3316..e036e10 100644
--- a/tests/ui/moves/moves-based-on-type-block-bad.rs
+++ b/tests/ui/moves/moves-based-on-type-block-bad.rs
@@ -1,4 +1,6 @@
+//@ run-rustfix
 #![feature(box_patterns)]
+#![allow(dead_code)]
 
 
 struct S {
diff --git a/tests/ui/moves/moves-based-on-type-block-bad.stderr b/tests/ui/moves/moves-based-on-type-block-bad.stderr
index 31417b5..8e93b62 100644
--- a/tests/ui/moves/moves-based-on-type-block-bad.stderr
+++ b/tests/ui/moves/moves-based-on-type-block-bad.stderr
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of `hellothere.x` as enum variant `Bar` which is behind a shared reference
-  --> $DIR/moves-based-on-type-block-bad.rs:22:19
+  --> $DIR/moves-based-on-type-block-bad.rs:24:19
    |
 LL |             match hellothere.x {
    |                   ^^^^^^^^^^^^
@@ -7,10 +7,10 @@
 LL |                 box E::Bar(x) => println!("{}", x.to_string()),
    |                            - data moved here because `x` has type `Box<isize>`, which does not implement the `Copy` trait
    |
-help: consider borrowing here
+help: consider borrowing the pattern binding
    |
-LL |             match &hellothere.x {
-   |                   +
+LL |                 box E::Bar(ref x) => println!("{}", x.to_string()),
+   |                            +++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/nll/move-errors.stderr b/tests/ui/nll/move-errors.stderr
index c1ec357..ea186fd 100644
--- a/tests/ui/nll/move-errors.stderr
+++ b/tests/ui/nll/move-errors.stderr
@@ -156,10 +156,14 @@
    |              - ...and here
    |
    = note: move occurs because these variables have types that don't implement the `Copy` trait
-help: consider borrowing here
+help: consider borrowing the pattern binding
    |
-LL |     match &x[0] {
-   |           +
+LL |         B::U(ref d) => (),
+   |              +++
+help: consider borrowing the pattern binding
+   |
+LL |         B::V(ref s) => (),
+   |              +++
 
 error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
   --> $DIR/move-errors.rs:83:11
diff --git a/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs b/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs
index 6db6682..807e5a6 100644
--- a/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs
@@ -1,6 +1,6 @@
 //@ run-fail
 //@ regex-error-pattern: thread 'main'.*panicked
-//@ error-pattern: attempt to multiply with overflow
+//@ regex-error-pattern: attempt to exponentiate with overflow
 //@ needs-subprocess
 //@ compile-flags: -C debug-assertions
 
diff --git a/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs b/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs
index bde0de6..75672dd 100644
--- a/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs
@@ -1,6 +1,6 @@
 //@ run-fail
 //@ regex-error-pattern: thread 'main'.*panicked
-//@ error-pattern: attempt to multiply with overflow
+//@ regex-error-pattern: attempt to exponentiate with overflow
 //@ needs-subprocess
 //@ compile-flags: -C debug-assertions
 
diff --git a/tests/ui/on-unimplemented/expected-comma-found-token.rs b/tests/ui/on-unimplemented/expected-comma-found-token.rs
index d60ab33..09c293f 100644
--- a/tests/ui/on-unimplemented/expected-comma-found-token.rs
+++ b/tests/ui/on-unimplemented/expected-comma-found-token.rs
@@ -4,7 +4,7 @@
 #![feature(rustc_attrs)]
 
 #[rustc_on_unimplemented(
-    message="the message"
-    label="the label" //~ ERROR expected `,`, found `label`
+    message="the message" //~ ERROR attribute items not separated with `,`
+    label="the label"
 )]
 trait T {}
diff --git a/tests/ui/on-unimplemented/expected-comma-found-token.stderr b/tests/ui/on-unimplemented/expected-comma-found-token.stderr
index 2717100..cdc80a4 100644
--- a/tests/ui/on-unimplemented/expected-comma-found-token.stderr
+++ b/tests/ui/on-unimplemented/expected-comma-found-token.stderr
@@ -1,10 +1,8 @@
-error: expected `,`, found `label`
-  --> $DIR/expected-comma-found-token.rs:8:5
+error: attribute items not separated with `,`
+  --> $DIR/expected-comma-found-token.rs:7:26
    |
 LL |     message="the message"
-   |                          - expected `,`
-LL |     label="the label"
-   |     ^^^^^ unexpected token
+   |                          ^ help: try adding `,` here
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parallel-rustc/recursive-trait-fn-sig-issue-142064.stderr b/tests/ui/parallel-rustc/recursive-trait-fn-sig-issue-142064.stderr
index 540f70e..0b49389 100644
--- a/tests/ui/parallel-rustc/recursive-trait-fn-sig-issue-142064.stderr
+++ b/tests/ui/parallel-rustc/recursive-trait-fn-sig-issue-142064.stderr
@@ -13,19 +13,6 @@
    |                       +++
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/recursive-trait-fn-sig-issue-142064.rs:13:23
-   |
-LL | trait B { fn foo() -> A; }
-   |                       ^
-   |
-   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
-   = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
-help: if this is a dyn-compatible trait, use `dyn`
-   |
-LL | trait B { fn foo() -> dyn A; }
-   |                       +++
-
-warning: trait objects without an explicit `dyn` are deprecated
   --> $DIR/recursive-trait-fn-sig-issue-142064.rs:7:23
    |
 LL | trait A { fn foo() -> A; }
@@ -47,6 +34,19 @@
    |
    = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
    = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: if this is a dyn-compatible trait, use `dyn`
+   |
+LL | trait B { fn foo() -> dyn A; }
+   |                       +++
+
+warning: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/recursive-trait-fn-sig-issue-142064.rs:13:23
+   |
+LL | trait B { fn foo() -> A; }
+   |                       ^
+   |
+   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+   = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 help: if this is a dyn-compatible trait, use `dyn`
    |
diff --git a/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr b/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr
index 2246a22..cf0b5f3 100644
--- a/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr
+++ b/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr
@@ -244,18 +244,18 @@
    |                                    ^^^ not found in this scope
 
 error[E0224]: at least one trait is required for an object type
-  --> $DIR/ty-variance-issue-124423.rs:41:40
-   |
-LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
-   |                                        ^^^^^^
-
-error[E0224]: at least one trait is required for an object type
   --> $DIR/ty-variance-issue-124423.rs:55:40
    |
 LL | impl<'a> LifetimeTrait<'a> for &'a Box<dyn 'a> {}
    |                                        ^^^^^^
 
 error[E0224]: at least one trait is required for an object type
+  --> $DIR/ty-variance-issue-124423.rs:41:40
+   |
+LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
+   |                                        ^^^^^^
+
+error[E0224]: at least one trait is required for an object type
   --> $DIR/ty-variance-issue-124423.rs:35:39
    |
 LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
diff --git a/tests/ui/parser/attribute/attr-missing-comma.rs b/tests/ui/parser/attribute/attr-missing-comma.rs
new file mode 100644
index 0000000..9c1aef8
--- /dev/null
+++ b/tests/ui/parser/attribute/attr-missing-comma.rs
@@ -0,0 +1,14 @@
+fn main() {}
+
+#[deprecated(
+    since = "since" //~ ERROR attribute items not separated with `,`
+    note = "note"
+)]
+fn f0() {}
+
+#[link(
+    name = "name" //~ ERROR attribute items not separated with `,`
+    kind = "static"
+    modifiers = "modifiers"
+)]
+fn f1() {}
diff --git a/tests/ui/parser/attribute/attr-missing-comma.stderr b/tests/ui/parser/attribute/attr-missing-comma.stderr
new file mode 100644
index 0000000..2ba17f4
--- /dev/null
+++ b/tests/ui/parser/attribute/attr-missing-comma.stderr
@@ -0,0 +1,23 @@
+error: attribute items not separated with `,`
+  --> $DIR/attr-missing-comma.rs:4:20
+   |
+LL |     since = "since"
+   |                    ^ help: try adding `,` here
+
+error: attribute items not separated with `,`
+  --> $DIR/attr-missing-comma.rs:10:18
+   |
+LL |     name = "name"
+   |                  ^
+   |
+help: try adding `,` here
+   |
+LL |     name = "name",
+   |                  +
+help: try adding `,` here
+   |
+LL |     kind = "static",
+   |                    +
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/equality-predicates-0.rs b/tests/ui/parser/equality-predicates-0.rs
new file mode 100644
index 0000000..a720d96
--- /dev/null
+++ b/tests/ui/parser/equality-predicates-0.rs
@@ -0,0 +1,20 @@
+// Test that we syntactically reject *equality predicates*.
+//
+// It's a feature that was originally proposed as part of accepted RFC 135 (2014). It's never been
+// fully implemented and in the meantime design & implementation concerns have been raised.
+// Between Feb 2017 and Jun 2026 we accidentally accepted such predicates syntactically
+// (indeed, without any pre-expansion feature gate).
+//
+// We *might* add a more restricted version of this feature to the language in the future.
+// See discussions in tracking issue <https://github.com/rust-lang/rust/issues/20041> for details.
+
+#[cfg(false)]
+fn f<T: Iterator>(mut xs: T) -> Option<u8>
+where
+    T::Item = u8
+    //~^ ERROR general type equality constraints are not supported
+{
+    xs.next()
+}
+
+fn main() {}
diff --git a/tests/ui/parser/equality-predicates-0.stderr b/tests/ui/parser/equality-predicates-0.stderr
new file mode 100644
index 0000000..f5be5d1
--- /dev/null
+++ b/tests/ui/parser/equality-predicates-0.stderr
@@ -0,0 +1,15 @@
+error: general type equality constraints are not supported
+  --> $DIR/equality-predicates-0.rs:14:5
+   |
+LL |     T::Item = u8
+   |     ^^^^^^^^^^^^ not supported
+   |
+   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
+help: replace it with an associated item constraint if possible
+   |
+LL -     T::Item = u8
+LL +     T: /* Trait */</* ... */Item = u8>
+   |
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/parser/equality-predicates-1.rs b/tests/ui/parser/equality-predicates-1.rs
new file mode 100644
index 0000000..b5dcc56
--- /dev/null
+++ b/tests/ui/parser/equality-predicates-1.rs
@@ -0,0 +1,20 @@
+// Test that we syntactically reject *equality predicates*.
+//
+// It's a feature that was originally proposed as part of accepted RFC 135 (2014). It's never been
+// fully implemented and in the meantime design & implementation concerns have been raised.
+// Between Feb 2017 and Jun 2026 we accidentally accepted such predicates syntactically
+// (indeed, without any pre-expansion feature gate).
+//
+// We *might* add a more restricted version of this feature to the language in the future.
+// See discussions in tracking issue <https://github.com/rust-lang/rust/issues/20041> for details.
+
+#[cfg(false)]
+fn f<T: Iterator>(mut xs: T) -> Option<u8>
+where
+    <T as Iterator>::Item == u8
+    //~^ ERROR general type equality constraints are not supported
+{
+    xs.next()
+}
+
+fn main() {}
diff --git a/tests/ui/parser/equality-predicates-1.stderr b/tests/ui/parser/equality-predicates-1.stderr
new file mode 100644
index 0000000..9e7a0b7
--- /dev/null
+++ b/tests/ui/parser/equality-predicates-1.stderr
@@ -0,0 +1,15 @@
+error: general type equality constraints are not supported
+  --> $DIR/equality-predicates-1.rs:14:5
+   |
+LL |     <T as Iterator>::Item == u8
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not supported
+   |
+   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
+help: replace it with an associated item constraint if possible
+   |
+LL -     <T as Iterator>::Item == u8
+LL +     T: Iterator<Item = u8>
+   |
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/pattern/mut-pattern-of-immutable-borrow.stderr b/tests/ui/pattern/mut-pattern-of-immutable-borrow.stderr
index f9ef1ef..afbf67f 100644
--- a/tests/ui/pattern/mut-pattern-of-immutable-borrow.stderr
+++ b/tests/ui/pattern/mut-pattern-of-immutable-borrow.stderr
@@ -6,10 +6,10 @@
 LL |         Some(s) => s.push('a'),
    |              - data moved here because `s` has type `String`, which does not implement the `Copy` trait
    |
-help: consider borrowing here
+help: consider borrowing the pattern binding
    |
-LL |     match &arg.field {
-   |           +
+LL |         Some(ref s) => s.push('a'),
+   |              +++
 
 error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
   --> $DIR/mut-pattern-of-immutable-borrow.rs:7:20
diff --git a/tests/ui/issues/issue-19086.rs b/tests/ui/pattern/struct-variant-as-tuple-variant.rs
similarity index 76%
rename from tests/ui/issues/issue-19086.rs
rename to tests/ui/pattern/struct-variant-as-tuple-variant.rs
index 42148c5..944371a 100644
--- a/tests/ui/issues/issue-19086.rs
+++ b/tests/ui/pattern/struct-variant-as-tuple-variant.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19086>.
+
 use Foo::FooB;
 
 enum Foo {
diff --git a/tests/ui/issues/issue-19086.stderr b/tests/ui/pattern/struct-variant-as-tuple-variant.stderr
similarity index 88%
rename from tests/ui/issues/issue-19086.stderr
rename to tests/ui/pattern/struct-variant-as-tuple-variant.stderr
index 03b9249..1cd063e 100644
--- a/tests/ui/issues/issue-19086.stderr
+++ b/tests/ui/pattern/struct-variant-as-tuple-variant.stderr
@@ -1,5 +1,5 @@
 error[E0532]: expected tuple struct or tuple variant, found variant `FooB`
-  --> $DIR/issue-19086.rs:10:9
+  --> $DIR/struct-variant-as-tuple-variant.rs:12:9
    |
 LL |     FooB { x: i32, y: i32 }
    |     ----------------------- `FooB` defined here
diff --git a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
index d26ba93..55a1b2e 100644
--- a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr
@@ -9,7 +9,7 @@
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
-  --> $DIR/empty-types.rs:14:9
+  --> $DIR/empty-types.rs:8:9
    |
 LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
index 4dcbe6c..507bc50 100644
--- a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr
@@ -9,7 +9,7 @@
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
-  --> $DIR/empty-types.rs:14:9
+  --> $DIR/empty-types.rs:8:9
    |
 LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/pattern/usefulness/empty-types.normal.stderr b/tests/ui/pattern/usefulness/empty-types.normal.stderr
index a49050c..d8bbce9 100644
--- a/tests/ui/pattern/usefulness/empty-types.normal.stderr
+++ b/tests/ui/pattern/usefulness/empty-types.normal.stderr
@@ -9,7 +9,7 @@
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
 note: the lint level is defined here
-  --> $DIR/empty-types.rs:14:9
+  --> $DIR/empty-types.rs:8:9
    |
 LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/pattern/usefulness/empty-types.rs b/tests/ui/pattern/usefulness/empty-types.rs
index cb0f181..0a9913f 100644
--- a/tests/ui/pattern/usefulness/empty-types.rs
+++ b/tests/ui/pattern/usefulness/empty-types.rs
@@ -1,18 +1,18 @@
 //@ revisions: normal exhaustive_patterns never_pats
 //@ edition: 2024
-//@ ignore-parallel-frontend pattern matching error message mismatch
-//
-// This tests correct handling of empty types in exhaustiveness checking.
-//
-// Most of the subtlety of this file happens in scrutinee places which are not required to hold
-// valid data, namely dereferences and union field accesses. In these cases, empty arms can
-// generally not be omitted, except with `exhaustive_patterns` which ignores this..
+
 #![feature(never_type)]
 #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
 #![cfg_attr(never_pats, feature(never_patterns))]
 #![allow(dead_code, unreachable_code)]
 #![deny(unreachable_patterns)]
 
+// This tests correct handling of empty types in exhaustiveness checking.
+//
+// Most of the subtlety of this file happens in scrutinee places which are not required to hold
+// valid data, namely dereferences and union field accesses. In these cases, empty arms can
+// generally not be omitted, except with `exhaustive_patterns` which ignores this..
+
 #[derive(Copy, Clone)]
 enum Void {}
 
diff --git a/tests/ui/pin-ergonomics/pin_v2-packed.rs b/tests/ui/pin-ergonomics/pin_v2-packed.rs
new file mode 100644
index 0000000..b10c756
--- /dev/null
+++ b/tests/ui/pin-ergonomics/pin_v2-packed.rs
@@ -0,0 +1,42 @@
+//! `#[pin_v2]` is not allowed on `#[repr(packed)]` types.
+//!
+//! Drop glue for a packed type moves an over-aligned field to an aligned location before running
+//! its destructor. That move carries along any structurally pinned leaf, so a value handed out as
+//! `Pin<&mut _>` would be moved before it is dropped, violating `Pin`'s invariant.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/157011>.
+
+#![feature(pin_ergonomics)]
+#![allow(incomplete_features)]
+
+use std::marker::PhantomPinned;
+
+#[pin_v2]
+#[repr(packed)]
+struct Packed { //~ ERROR `#[pin_v2]` types may not have `#[repr(packed)]`
+    field: PhantomPinned,
+}
+
+// The generic case from the issue: alignment of `T` is unknown at definition time, so this is
+// rejected regardless of how it is later monomorphized.
+#[pin_v2]
+#[repr(C, packed(4))]
+struct PackedN<T>(T);
+//~^ ERROR `#[pin_v2]` types may not have `#[repr(packed)]`
+
+#[pin_v2]
+#[repr(packed)]
+union PackedUnion { //~ ERROR `#[pin_v2]` types may not have `#[repr(packed)]`
+    field: (),
+}
+
+// Allowed: `#[pin_v2]` without `#[repr(packed)]` still compiles.
+#[pin_v2]
+#[repr(C)]
+struct Unpacked<T>(T);
+
+// Allowed: `#[repr(packed)]` without `#[pin_v2]` is unaffected by the ban.
+#[repr(packed)]
+struct PackedNoPin(u8);
+
+fn main() {}
diff --git a/tests/ui/pin-ergonomics/pin_v2-packed.stderr b/tests/ui/pin-ergonomics/pin_v2-packed.stderr
new file mode 100644
index 0000000..975b74e4
--- /dev/null
+++ b/tests/ui/pin-ergonomics/pin_v2-packed.stderr
@@ -0,0 +1,41 @@
+error: `#[pin_v2]` types may not have `#[repr(packed)]`
+  --> $DIR/pin_v2-packed.rs:16:1
+   |
+LL | struct Packed {
+   | ^^^^^^^^^^^^^
+   |
+   = note: fields of a `#[repr(packed)]` type can be under-aligned, so a structurally pinned field may be moved to a properly aligned location, which `Pin` does not allow
+note: `Packed` is marked `#[pin_v2]` here
+  --> $DIR/pin_v2-packed.rs:14:1
+   |
+LL | #[pin_v2]
+   | ^^^^^^^^^
+
+error: `#[pin_v2]` types may not have `#[repr(packed)]`
+  --> $DIR/pin_v2-packed.rs:24:1
+   |
+LL | struct PackedN<T>(T);
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = note: fields of a `#[repr(packed)]` type can be under-aligned, so a structurally pinned field may be moved to a properly aligned location, which `Pin` does not allow
+note: `PackedN` is marked `#[pin_v2]` here
+  --> $DIR/pin_v2-packed.rs:22:1
+   |
+LL | #[pin_v2]
+   | ^^^^^^^^^
+
+error: `#[pin_v2]` types may not have `#[repr(packed)]`
+  --> $DIR/pin_v2-packed.rs:29:1
+   |
+LL | union PackedUnion {
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = note: fields of a `#[repr(packed)]` type can be under-aligned, so a structurally pinned field may be moved to a properly aligned location, which `Pin` does not allow
+note: `PackedUnion` is marked `#[pin_v2]` here
+  --> $DIR/pin_v2-packed.rs:27:1
+   |
+LL | #[pin_v2]
+   | ^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/print-request/print-calling-conventions.stdout b/tests/ui/print-request/print-calling-conventions.stdout
index 506bbea..af4f491 100644
--- a/tests/ui/print-request/print-calling-conventions.stdout
+++ b/tests/ui/print-request/print-calling-conventions.stdout
@@ -29,6 +29,7 @@
 system-unwind
 sysv64
 sysv64-unwind
+tail
 thiscall
 thiscall-unwind
 unadjusted
diff --git a/tests/ui/print_type_sizes/async.rs b/tests/ui/print_type_sizes/async.rs
index 70da909..36c85be 100644
--- a/tests/ui/print_type_sizes/async.rs
+++ b/tests/ui/print_type_sizes/async.rs
@@ -5,7 +5,7 @@
 //@ edition:2021
 //@ build-pass
 //@ no-pass-override (codegen affects -Zprint-type-sizes)
-//@ only-x86_64
+//@ only-64bit
 
 #![allow(dropping_copy_types)]
 
diff --git a/tests/ui/print_type_sizes/async.stdout b/tests/ui/print_type_sizes/async.stdout
index d2adff8..c068818 100644
--- a/tests/ui/print_type_sizes/async.stdout
+++ b/tests/ui/print_type_sizes/async.stdout
@@ -38,6 +38,8 @@
 print-type-size     field `.0`: 16 bytes
 print-type-size type: `std::ptr::NonNull<str>`: 16 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 16 bytes
+print-type-size type: `std::future::ResumeTy`: 8 bytes, alignment: 8 bytes
+print-type-size     field `.0`: 8 bytes
 print-type-size type: `std::pin::Pin<&mut {async fn body of test()}>`: 8 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 8 bytes
 print-type-size type: `std::pin::Pin<&mut {async fn body of wait()}>`: 8 bytes, alignment: 8 bytes
@@ -47,6 +49,8 @@
 print-type-size     field `._phantom`: 0 bytes
 print-type-size type: `std::ptr::NonNull<std::ptr::metadata::VTable>`: 8 bytes, alignment: 8 bytes
 print-type-size     field `.pointer`: 8 bytes
+print-type-size type: `std::ptr::NonNull<std::task::Context<'_>>`: 8 bytes, alignment: 8 bytes
+print-type-size     field `.pointer`: 8 bytes
 print-type-size type: `std::mem::ManuallyDrop<{async fn body of wait()}>`: 1 bytes, alignment: 1 bytes
 print-type-size     field `.value`: 1 bytes
 print-type-size type: `std::mem::MaybeDangling<{async fn body of wait()}>`: 1 bytes, alignment: 1 bytes
diff --git a/tests/ui/privacy/privacy1.stderr b/tests/ui/privacy/privacy1.stderr
index 5d1e003..22cc16b 100644
--- a/tests/ui/privacy/privacy1.stderr
+++ b/tests/ui/privacy/privacy1.stderr
@@ -34,18 +34,6 @@
 LL |     mod baz {
    |     ^^^^^^^
 
-error[E0603]: module `baz` is private
-  --> $DIR/privacy1.rs:148:18
-   |
-LL |         use bar::baz;
-   |                  ^^^ private module
-   |
-note: the module `baz` is defined here
-  --> $DIR/privacy1.rs:57:5
-   |
-LL |     mod baz {
-   |     ^^^^^^^
-
 error[E0603]: module `i` is private
   --> $DIR/privacy1.rs:172:20
    |
@@ -61,6 +49,18 @@
    |         ^^^^^
 
 error[E0603]: module `baz` is private
+  --> $DIR/privacy1.rs:148:18
+   |
+LL |         use bar::baz;
+   |                  ^^^ private module
+   |
+note: the module `baz` is defined here
+  --> $DIR/privacy1.rs:57:5
+   |
+LL |     mod baz {
+   |     ^^^^^^^
+
+error[E0603]: module `baz` is private
   --> $DIR/privacy1.rs:111:21
    |
 LL |         crate::bar::baz::A::foo();
diff --git a/tests/ui/privacy/privacy2.stderr b/tests/ui/privacy/privacy2.stderr
index cef8fdb..e4fd7fd 100644
--- a/tests/ui/privacy/privacy2.stderr
+++ b/tests/ui/privacy/privacy2.stderr
@@ -2,7 +2,9 @@
   --> $DIR/privacy2.rs:22:9
    |
 LL |     use bar::foo;
-   |         ^^^^^^^^ no `foo` in `bar`
+   |         ^^^^^---
+   |              |
+   |              no `foo` in `bar`
 
 error[E0603]: function import `foo` is private
   --> $DIR/privacy2.rs:29:20
diff --git a/tests/ui/privacy/privacy3.stderr b/tests/ui/privacy/privacy3.stderr
index 4530dfe..5c7984e 100644
--- a/tests/ui/privacy/privacy3.stderr
+++ b/tests/ui/privacy/privacy3.stderr
@@ -2,7 +2,9 @@
   --> $DIR/privacy3.rs:23:9
    |
 LL |     use bar::gpriv;
-   |         ^^^^^^^^^^ no `gpriv` in `bar`
+   |         ^^^^^-----
+   |              |
+   |              no `gpriv` in `bar`
 
 error: requires `sized` lang_item
   --> $DIR/privacy3.rs:13:20
diff --git a/tests/ui/proc-macro/auxiliary/api/literal.rs b/tests/ui/proc-macro/auxiliary/api/literal.rs
index 7109340..6a95dcf 100644
--- a/tests/ui/proc-macro/auxiliary/api/literal.rs
+++ b/tests/ui/proc-macro/auxiliary/api/literal.rs
@@ -5,6 +5,7 @@
 pub fn test() {
     test_display_literal();
     test_parse_literal();
+    test_literal_value();
 }
 
 fn test_display_literal() {
@@ -81,3 +82,33 @@ fn test_parse_literal() {
     assert!("- 10".parse::<Literal>().is_err());
     assert!("-'x'".parse::<Literal>().is_err());
 }
+
+fn test_literal_value() {
+    assert!(Literal::u32_suffixed(10).u8_value().is_err());
+    assert!(Literal::u32_suffixed(11).f32_value().is_err());
+    assert!(Literal::u32_suffixed(12).u64_value().is_err());
+    assert_eq!(Literal::u32_suffixed(13).u32_value(), Ok(13u32));
+    assert_eq!(Literal::u32_unsuffixed(14).u64_value(), Ok(14u64));
+    assert_eq!(Literal::u32_unsuffixed(15).u8_value(), Ok(15u8));
+    assert!(Literal::u32_unsuffixed(400).u8_value().is_err());
+    assert_eq!(Literal::u32_unsuffixed(401).u16_value(), Ok(401u16));
+    assert!(Literal::i32_unsuffixed(-402).u16_value().is_err());
+    assert_eq!(Literal::i32_unsuffixed(-403).i16_value(), Ok(-403i16));
+    assert_eq!(Literal::u32_unsuffixed(0xff).u16_value(), Ok(0xffu16));
+    assert_eq!(Literal::u32_unsuffixed(0b11).u16_value(), Ok(0b11u16));
+    assert_eq!(Literal::u32_unsuffixed(0o11).u16_value(), Ok(0o11u16));
+
+    assert!(Literal::f32_suffixed(9.).u8_value().is_err());
+    assert!(Literal::f32_suffixed(10.).f64_value().is_err());
+    #[cfg(target_has_reliable_f16)]
+    {
+        assert!(Literal::f32_suffixed(11.).f16_value().is_err());
+    }
+    assert_eq!(Literal::f32_suffixed(12.).f32_value().map(|f| f.to_string()), Ok("12".to_string()));
+    assert_eq!(Literal::f32_unsuffixed(13.).f32_value().map(|f| f.to_string()), Ok("13".to_string()));
+    assert_eq!(Literal::f32_unsuffixed(14.).f64_value().map(|f| f.to_string()), Ok("14".to_string()));
+    #[cfg(target_has_reliable_f16)]
+    {
+        assert_eq!(Literal::f32_unsuffixed(15.).f16_value().map(|f| f.to_string()), Ok("15".to_string()));
+    }
+}
diff --git a/tests/ui/proc-macro/auxiliary/api/proc_macro_api_tests.rs b/tests/ui/proc-macro/auxiliary/api/proc_macro_api_tests.rs
index d778e46..c72e58c 100644
--- a/tests/ui/proc-macro/auxiliary/api/proc_macro_api_tests.rs
+++ b/tests/ui/proc-macro/auxiliary/api/proc_macro_api_tests.rs
@@ -1,6 +1,9 @@
 //@ edition: 2021
 
 #![feature(proc_macro_span)]
+#![feature(proc_macro_value)]
+#![feature(f16)]
+#![feature(cfg_target_has_reliable_f16_f128)]
 #![deny(dead_code)] // catch if a test function is never called
 
 extern crate proc_macro;
diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr
index 5b472d4..73981b6 100644
--- a/tests/ui/proc-macro/bad-projection.stderr
+++ b/tests/ui/proc-macro/bad-projection.stderr
@@ -33,7 +33,7 @@
    | takes 0 arguments
    | required by a bound introduced by this call
    |
-note: required by a bound in `proc_macro::bridge::client::ProcMacro::bang`
+note: required by a bound in `proc_macro::bridge::client::Client::expand1`
   --> $SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL
 
 error[E0277]: the trait bound `(): Project` is not satisfied
diff --git a/tests/ui/proc-macro/import.stderr b/tests/ui/proc-macro/import.stderr
index c5d1648..77a378e 100644
--- a/tests/ui/proc-macro/import.stderr
+++ b/tests/ui/proc-macro/import.stderr
@@ -2,7 +2,9 @@
   --> $DIR/import.rs:5:5
    |
 LL | use test_macros::empty_derive;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `empty_derive` in the root
+   |     ^^^^^^^^^^^^^------------
+   |                  |
+   |                  no `empty_derive` in the root
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/proc-macro/mixed-site-span.stderr b/tests/ui/proc-macro/mixed-site-span.stderr
index 62c441e..10af6b4 100644
--- a/tests/ui/proc-macro/mixed-site-span.stderr
+++ b/tests/ui/proc-macro/mixed-site-span.stderr
@@ -2,7 +2,9 @@
   --> $DIR/mixed-site-span.rs:49:5
    |
 LL |     invoke_with_crate!{input proc_macro_item}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                              |
+   |                              no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -10,7 +12,9 @@
   --> $DIR/mixed-site-span.rs:50:5
    |
 LL |     invoke_with_ident!{input proc_macro_item}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                              |
+   |                              no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -18,7 +22,9 @@
   --> $DIR/mixed-site-span.rs:51:5
    |
 LL |     invoke_with_crate!{call proc_macro_item}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                             |
+   |                             no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -26,7 +32,9 @@
   --> $DIR/mixed-site-span.rs:52:5
    |
 LL |     invoke_with_ident!{call proc_macro_item}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                             |
+   |                             no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -34,7 +42,9 @@
   --> $DIR/mixed-site-span.rs:53:5
    |
 LL |     invoke_with_ident!{hello call proc_macro_item}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                                   |
+   |                                   no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -42,7 +52,9 @@
   --> $DIR/mixed-site-span.rs:56:5
    |
 LL |     invoke_with_ident!{krate input proc_macro_item}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                                    |
+   |                                    no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: a similar name exists in the module
@@ -55,7 +67,9 @@
   --> $DIR/mixed-site-span.rs:57:5
    |
 LL |     with_crate!{krate input proc_macro_item}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                             |
+   |                             no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: a similar name exists in the module
@@ -68,7 +82,9 @@
   --> $DIR/mixed-site-span.rs:58:5
    |
 LL |     with_crate!{krate call proc_macro_item}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                            |
+   |                            no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: a similar name exists in the module
@@ -81,7 +97,9 @@
   --> $DIR/mixed-site-span.rs:62:28
    |
 LL |         invoke_with_ident!{$crate input proc_macro_item}
-   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |                            ^^^^^^^^^^^^^---------------
+   |                                         |
+   |                                         no `proc_macro_item` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -97,7 +115,9 @@
   --> $DIR/mixed-site-span.rs:63:21
    |
 LL |         with_crate!{$crate input proc_macro_item}
-   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |                     ^^^^^^^^^^^^^---------------
+   |                                  |
+   |                                  no `proc_macro_item` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -113,7 +133,9 @@
   --> $DIR/mixed-site-span.rs:64:9
    |
 LL |         with_crate!{$crate call proc_macro_item}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                                 |
+   |                                 no `proc_macro_item` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -129,7 +151,9 @@
   --> $DIR/mixed-site-span.rs:67:9
    |
 LL |         invoke_with_ident!{$crate call proc_macro_item}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
+   |                                        |
+   |                                        no `proc_macro_item` in the root
 LL |     }}
 LL |     test!();
    |     ------- in this macro invocation
@@ -140,7 +164,9 @@
   --> $DIR/mixed-site-span.rs:89:5
    |
 LL |     invoke_with_ident!{krate input TokenItem}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                                    |
+   |                                    no `TokenItem` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -153,7 +179,9 @@
   --> $DIR/mixed-site-span.rs:90:5
    |
 LL |     with_crate!{krate input TokenItem}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                             |
+   |                             no `TokenItem` in the root
    |
    = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -166,7 +194,9 @@
   --> $DIR/mixed-site-span.rs:91:5
    |
 LL |     with_crate!{krate call TokenItem}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                            |
+   |                            no `TokenItem` in the root
    |
    = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -179,7 +209,9 @@
   --> $DIR/mixed-site-span.rs:94:5
    |
 LL |     invoke_with_crate!{mixed TokenItem}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                              |
+   |                              no `TokenItem` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -193,7 +225,9 @@
   --> $DIR/mixed-site-span.rs:95:5
    |
 LL |     invoke_with_ident!{mixed TokenItem}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                              |
+   |                              no `TokenItem` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -207,7 +241,9 @@
   --> $DIR/mixed-site-span.rs:96:5
    |
 LL |     invoke_with_ident!{krate mixed TokenItem}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                                    |
+   |                                    no `TokenItem` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -221,7 +257,9 @@
   --> $DIR/mixed-site-span.rs:97:5
    |
 LL |     with_crate!{krate mixed TokenItem}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                             |
+   |                             no `TokenItem` in the root
    |
    = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -234,7 +272,9 @@
   --> $DIR/mixed-site-span.rs:101:28
    |
 LL |         invoke_with_ident!{$crate input TokenItem}
-   |                            ^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |                            ^^^^^^^^^^^^^---------
+   |                                         |
+   |                                         no `TokenItem` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -250,7 +290,9 @@
   --> $DIR/mixed-site-span.rs:102:21
    |
 LL |         with_crate!{$crate input TokenItem}
-   |                     ^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |                     ^^^^^^^^^^^^^---------
+   |                                  |
+   |                                  no `TokenItem` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -266,7 +308,9 @@
   --> $DIR/mixed-site-span.rs:103:9
    |
 LL |         with_crate!{$crate call TokenItem}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                                 |
+   |                                 no `TokenItem` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -282,7 +326,9 @@
   --> $DIR/mixed-site-span.rs:106:9
    |
 LL |         invoke_with_ident!{$crate mixed TokenItem}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                                         |
+   |                                         no `TokenItem` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -299,7 +345,9 @@
   --> $DIR/mixed-site-span.rs:107:9
    |
 LL |         with_crate!{$crate mixed TokenItem}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^---------^
+   |                                  |
+   |                                  no `TokenItem` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -315,7 +363,9 @@
   --> $DIR/mixed-site-span.rs:131:5
    |
 LL |     invoke_with_crate!{input ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                              |
+   |                              no `ItemUse` in the root
    |
    = note: this error originates in the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -329,7 +379,9 @@
   --> $DIR/mixed-site-span.rs:132:5
    |
 LL |     invoke_with_ident!{input ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                              |
+   |                              no `ItemUse` in the root
    |
    = note: this error originates in the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -343,7 +395,9 @@
   --> $DIR/mixed-site-span.rs:135:5
    |
 LL |     invoke_with_crate!{mixed ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                              |
+   |                              no `ItemUse` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -357,7 +411,9 @@
   --> $DIR/mixed-site-span.rs:136:5
    |
 LL |     invoke_with_ident!{mixed ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                              |
+   |                              no `ItemUse` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -371,7 +427,9 @@
   --> $DIR/mixed-site-span.rs:137:5
    |
 LL |     invoke_with_ident!{krate mixed ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                                    |
+   |                                    no `ItemUse` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -385,7 +443,9 @@
   --> $DIR/mixed-site-span.rs:138:5
    |
 LL |     with_crate!{krate mixed ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                             |
+   |                             no `ItemUse` in the root
    |
    = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -398,7 +458,9 @@
   --> $DIR/mixed-site-span.rs:140:5
    |
 LL |     invoke_with_crate!{call ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                             |
+   |                             no `ItemUse` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -412,7 +474,9 @@
   --> $DIR/mixed-site-span.rs:141:5
    |
 LL |     invoke_with_ident!{call ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                             |
+   |                             no `ItemUse` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -426,7 +490,9 @@
   --> $DIR/mixed-site-span.rs:142:5
    |
 LL |     invoke_with_ident!{hello call ItemUse}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                                   |
+   |                                   no `ItemUse` in the root
    |
    = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -440,7 +506,9 @@
   --> $DIR/mixed-site-span.rs:145:9
    |
 LL |         invoke_with_ident!{$crate mixed ItemUse}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                                         |
+   |                                         no `ItemUse` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -457,7 +525,9 @@
   --> $DIR/mixed-site-span.rs:146:9
    |
 LL |         with_crate!{$crate mixed ItemUse}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                                  |
+   |                                  no `ItemUse` in the root
 ...
 LL |     test!();
    |     ------- in this macro invocation
@@ -473,7 +543,9 @@
   --> $DIR/mixed-site-span.rs:148:9
    |
 LL |         invoke_with_ident!{$crate call ItemUse}
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^
+   |                                        |
+   |                                        no `ItemUse` in the root
 LL |     }}
 LL |     test!();
    |     ------- in this macro invocation
@@ -490,7 +562,9 @@
   --> $DIR/mixed-site-span.rs:155:1
    |
 LL | use_input_crate!{proc_macro_item}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   | ^^^^^^^^^^^^^^^^^---------------^
+   |                  |
+   |                  no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `use_input_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -498,7 +572,9 @@
   --> $DIR/mixed-site-span.rs:156:1
    |
 LL | use_input_krate!{proc_macro_item}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   | ^^^^^^^^^^^^^^^^^---------------^
+   |                  |
+   |                  no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `use_input_krate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -506,7 +582,9 @@
   --> $DIR/mixed-site-span.rs:159:1
    |
 LL | use_call_crate!{proc_macro_item}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   | ^^^^^^^^^^^^^^^^---------------^
+   |                 |
+   |                 no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `use_call_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -514,7 +592,9 @@
   --> $DIR/mixed-site-span.rs:160:1
    |
 LL | use_call_krate!{proc_macro_item}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root
+   | ^^^^^^^^^^^^^^^^---------------^
+   |                 |
+   |                 no `proc_macro_item` in the root
    |
    = note: this error originates in the macro `use_call_krate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -522,7 +602,9 @@
   --> $DIR/mixed-site-span.rs:165:1
    |
 LL | use_mixed_crate!{TokenItem}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   | ^^^^^^^^^^^^^^^^^---------^
+   |                  |
+   |                  no `TokenItem` in the root
    |
    = note: this error originates in the macro `use_mixed_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -536,7 +618,9 @@
   --> $DIR/mixed-site-span.rs:166:1
    |
 LL | use_mixed_krate!{TokenItem}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root
+   | ^^^^^^^^^^^^^^^^^---------^
+   |                  |
+   |                  no `TokenItem` in the root
    |
    = note: this error originates in the macro `use_mixed_krate` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct instead
@@ -550,7 +634,9 @@
   --> $DIR/mixed-site-span.rs:171:1
    |
 LL | use_input_crate!{ItemUse}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   | ^^^^^^^^^^^^^^^^^-------^
+   |                  |
+   |                  no `ItemUse` in the root
    |
    = note: this error originates in the macro `use_input_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -558,7 +644,9 @@
   --> $DIR/mixed-site-span.rs:172:1
    |
 LL | use_input_krate!{ItemUse}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   | ^^^^^^^^^^^^^^^^^-------^
+   |                  |
+   |                  no `ItemUse` in the root
    |
    = note: this error originates in the macro `use_input_krate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -566,7 +654,9 @@
   --> $DIR/mixed-site-span.rs:173:1
    |
 LL | use_mixed_crate!{ItemUse}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   | ^^^^^^^^^^^^^^^^^-------^
+   |                  |
+   |                  no `ItemUse` in the root
    |
    = note: this error originates in the macro `use_mixed_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -574,7 +664,9 @@
   --> $DIR/mixed-site-span.rs:174:1
    |
 LL | use_mixed_krate!{ItemUse}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   | ^^^^^^^^^^^^^^^^^-------^
+   |                  |
+   |                  no `ItemUse` in the root
    |
    = note: this error originates in the macro `use_mixed_krate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -582,7 +674,9 @@
   --> $DIR/mixed-site-span.rs:175:1
    |
 LL | use_call_crate!{ItemUse}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   | ^^^^^^^^^^^^^^^^-------^
+   |                 |
+   |                 no `ItemUse` in the root
    |
    = note: this error originates in the macro `use_call_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
@@ -590,7 +684,9 @@
   --> $DIR/mixed-site-span.rs:176:1
    |
 LL | use_call_krate!{ItemUse}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root
+   | ^^^^^^^^^^^^^^^^-------^
+   |                 |
+   |                 no `ItemUse` in the root
    |
    = note: this error originates in the macro `use_call_krate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/tests/ui/proc-macro/proc-macro-decls.rs b/tests/ui/proc-macro/proc-macro-decls.rs
new file mode 100644
index 0000000..135cc76
--- /dev/null
+++ b/tests/ui/proc-macro/proc-macro-decls.rs
@@ -0,0 +1,27 @@
+//@ check-pass
+//@ force-host
+//@ no-prefer-dynamic
+//@ compile-flags: -Z unpretty=expanded
+//@ needs-unwind compiling proc macros with panic=abort causes a warning
+//@ edition: 2015
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro]
+pub fn a(x: TokenStream) -> TokenStream {
+    x
+}
+
+#[proc_macro_derive(B, attributes(attr_a, attr_b))]
+pub fn b(x: TokenStream) -> TokenStream {
+    x
+}
+
+#[proc_macro_attribute]
+pub fn c(x: TokenStream, y: TokenStream) -> TokenStream {
+    y
+}
diff --git a/tests/ui/proc-macro/proc-macro-decls.stdout b/tests/ui/proc-macro/proc-macro-decls.stdout
new file mode 100644
index 0000000..14df9c2
--- /dev/null
+++ b/tests/ui/proc-macro/proc-macro-decls.stdout
@@ -0,0 +1,37 @@
+#![feature(prelude_import)]
+#![no_std]
+//@ check-pass
+//@ force-host
+//@ no-prefer-dynamic
+//@ compile-flags: -Z unpretty=expanded
+//@ needs-unwind compiling proc macros with panic=abort causes a warning
+//@ edition: 2015
+
+#![crate_type = "proc-macro"]
+extern crate std;
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro]
+pub fn a(x: TokenStream) -> TokenStream { x }
+
+#[proc_macro_derive(B, attributes(attr_a, attr_b))]
+pub fn b(x: TokenStream) -> TokenStream { x }
+
+#[proc_macro_attribute]
+pub fn c(x: TokenStream, y: TokenStream) -> TokenStream { y }
+const _: () =
+    {
+        extern crate proc_macro;
+        #[rustc_proc_macro_decls]
+        #[used]
+        #[allow(deprecated)]
+        static _DECLS: &[proc_macro::bridge::client::Client] =
+            &[proc_macro::bridge::client::Client::expand1(a),
+                        proc_macro::bridge::client::Client::expand1(b),
+                        proc_macro::bridge::client::Client::expand2(c)];
+    };
diff --git a/tests/ui/proc-macro/quote/debug.stdout b/tests/ui/proc-macro/quote/debug.stdout
index 896c809..097cf75 100644
--- a/tests/ui/proc-macro/quote/debug.stdout
+++ b/tests/ui/proc-macro/quote/debug.stdout
@@ -68,5 +68,5 @@
         #[rustc_proc_macro_decls]
         #[used]
         #[allow(deprecated)]
-        static _DECLS: &[proc_macro::bridge::client::ProcMacro] = &[];
+        static _DECLS: &[proc_macro::bridge::client::Client] = &[];
     };
diff --git a/tests/ui/proc-macro/test.rs b/tests/ui/proc-macro/test.rs
index b36910a..d935dbe 100644
--- a/tests/ui/proc-macro/test.rs
+++ b/tests/ui/proc-macro/test.rs
@@ -1,6 +1,9 @@
 //@ check-pass
 //@ proc-macro: api/proc_macro_api_tests.rs
 //@ edition: 2021
+// Because of a (known) proc-macro ABI issue with GCC backend, this test
+// fails because of it.
+//@ ignore-backends: gcc
 
 //! This is for everything that *would* be a #[test] inside of libproc_macro,
 //! except for the fact that proc_macro objects are not capable of existing
diff --git a/tests/ui/resolve/import-suggestion-duplicated-importing-same-item.rs b/tests/ui/resolve/import-suggestion-duplicated-importing-same-item.rs
new file mode 100644
index 0000000..bd2692a
--- /dev/null
+++ b/tests/ui/resolve/import-suggestion-duplicated-importing-same-item.rs
@@ -0,0 +1,16 @@
+mod A {
+    pub struct A;
+    //~^ NOTE ...and refers to the unit struct `A` which is defined here
+    //~| NOTE you could import this directly
+}
+
+mod B {
+    use crate::A::A;
+    //~^ NOTE the unit struct import `A` is defined here...
+}
+
+fn main() {
+    B::A;
+    //~^ ERROR unit struct import `A` is private [E0603]
+    //~| NOTE private unit struct import
+}
diff --git a/tests/ui/resolve/import-suggestion-duplicated-importing-same-item.stderr b/tests/ui/resolve/import-suggestion-duplicated-importing-same-item.stderr
new file mode 100644
index 0000000..f7760d1
--- /dev/null
+++ b/tests/ui/resolve/import-suggestion-duplicated-importing-same-item.stderr
@@ -0,0 +1,25 @@
+error[E0603]: unit struct import `A` is private
+  --> $DIR/import-suggestion-duplicated-importing-same-item.rs:13:8
+   |
+LL |     B::A;
+   |        ^ private unit struct import
+   |
+note: the unit struct import `A` is defined here...
+  --> $DIR/import-suggestion-duplicated-importing-same-item.rs:8:9
+   |
+LL |     use crate::A::A;
+   |         ^^^^^^^^^^^
+note: ...and refers to the unit struct `A` which is defined here
+  --> $DIR/import-suggestion-duplicated-importing-same-item.rs:2:5
+   |
+LL |     pub struct A;
+   |     ^^^^^^^^^^^^^ you could import this directly
+help: consider importing this unit struct instead
+   |
+LL -     B::A;
+LL +     A::A;
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/tests/ui/resolve/issue-5035.stderr b/tests/ui/resolve/issue-5035.stderr
index b26c962..7475d691 100644
--- a/tests/ui/resolve/issue-5035.stderr
+++ b/tests/ui/resolve/issue-5035.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-5035.rs:7:5
    |
 LL | use crate::ImportError;
-   |     ^^^^^^^^^^^^^^^^^^ no `ImportError` in the root
+   |     ^^^^^^^-----------
+   |            |
+   |            no `ImportError` in the root
 
 error[E0404]: expected trait, found type alias `K`
   --> $DIR/issue-5035.rs:5:6
diff --git a/tests/ui/resolve/underscore-bindings-disambiguators.stderr b/tests/ui/resolve/underscore-bindings-disambiguators.stderr
index ec1dec8..d55c840 100644
--- a/tests/ui/resolve/underscore-bindings-disambiguators.stderr
+++ b/tests/ui/resolve/underscore-bindings-disambiguators.stderr
@@ -2,13 +2,17 @@
   --> $DIR/underscore-bindings-disambiguators.rs:25:5
    |
 LL | use X as Y;
-   |     ^^^^^^ no `X` in the root
+   |     -^^^^^
+   |     |
+   |     no `X` in the root
 
 error[E0432]: unresolved import `Z`
   --> $DIR/underscore-bindings-disambiguators.rs:26:5
    |
 LL | use Z as W;
-   |     ^^^^^^ no `Z` in the root
+   |     -^^^^^
+   |     |
+   |     no `Z` in the root
 
 error[E0080]: evaluation panicked: not yet implemented
   --> $DIR/underscore-bindings-disambiguators.rs:19:19
diff --git a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.fixed b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.fixed
index e7c10f7..4358572 100644
--- a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.fixed
+++ b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.fixed
@@ -1,7 +1,7 @@
 //@ edition:2018
 //@ aux-build:edition-lint-infer-outlives-macro.rs
 //@ run-rustfix
-//@ ignore-parallel-frontend `note`s on different source lines
+
 #![deny(explicit_outlives_requirements)]
 #![allow(dead_code)]
 
diff --git a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs
index a39d766..6c87923 100644
--- a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs
+++ b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs
@@ -1,7 +1,7 @@
 //@ edition:2018
 //@ aux-build:edition-lint-infer-outlives-macro.rs
 //@ run-rustfix
-//@ ignore-parallel-frontend `note`s on different source lines
+
 #![deny(explicit_outlives_requirements)]
 #![allow(dead_code)]
 
diff --git a/tests/ui/rust-2018/uniform-paths/issue-54253.stderr b/tests/ui/rust-2018/uniform-paths/issue-54253.stderr
index 7a1c55a..0d1923d 100644
--- a/tests/ui/rust-2018/uniform-paths/issue-54253.stderr
+++ b/tests/ui/rust-2018/uniform-paths/issue-54253.stderr
@@ -2,7 +2,9 @@
   --> $DIR/issue-54253.rs:10:9
    |
 LL |     use crate::version;
-   |         ^^^^^^^^^^^^^^ no `version` in the root
+   |         ^^^^^^^-------
+   |                |
+   |                no `version` in the root
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/rustc_public-ir-print/async-closure.stdout b/tests/ui/rustc_public-ir-print/async-closure.stdout
index 6dbc1dd..8a473d5 100644
--- a/tests/ui/rustc_public-ir-print/async-closure.stdout
+++ b/tests/ui/rustc_public-ir-print/async-closure.stdout
@@ -42,10 +42,14 @@
     let mut _5: ();
     let mut _6: u32;
     let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
-    debug _task_context => _2;
+    let mut _8: std::future::ResumeTy;
+    let mut _9: NonNull<Context<'_>>;
+    debug _task_context => _8;
     debug y => (*((*_7).0: &i32));
     debug y => _3;
     bb0: {
+        _9 = move _2 as NonNull<Context<'_>>;
+        _8 = ResumeTy(move _9);
         _7 = (_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6});
         _6 = discriminant((*_7));
         switchInt(move _6) -> [0: bb3, 1: bb1, otherwise: bb2];
@@ -74,10 +78,14 @@
     let mut _5: ();
     let mut _6: u32;
     let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
-    debug _task_context => _2;
+    let mut _8: std::future::ResumeTy;
+    let mut _9: NonNull<Context<'_>>;
+    debug _task_context => _8;
     debug y => (*((*_7).0: &i32));
     debug y => _3;
     bb0: {
+        _9 = move _2 as NonNull<Context<'_>>;
+        _8 = ResumeTy(move _9);
         _7 = (_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6});
         _6 = discriminant((*_7));
         switchInt(move _6) -> [0: bb3, 1: bb1, otherwise: bb2];
diff --git a/tests/ui/self/self_type_keyword-2.stderr b/tests/ui/self/self_type_keyword-2.stderr
index 4e931f9..fdc3b72 100644
--- a/tests/ui/self/self_type_keyword-2.stderr
+++ b/tests/ui/self/self_type_keyword-2.stderr
@@ -2,7 +2,9 @@
   --> $DIR/self_type_keyword-2.rs:1:5
    |
 LL | use self::Self as Foo;
-   |     ^^^^^^^^^^^^^^^^^ no `Self` in the root
+   |     ^^^^^^----^^^^^^^
+   |           |
+   |           no `Self` in the root
 
 error[E0531]: cannot find unit struct, unit variant or constant `Self` in this scope
   --> $DIR/self_type_keyword-2.rs:4:9
diff --git a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr
index c7c36c8..0f58d3e 100644
--- a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr
+++ b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr
@@ -14,7 +14,9 @@
   --> $DIR/portable-intrinsics-arent-exposed.rs:6:5
    |
 LL | use std::simd::intrinsics;
-   |     ^^^^^^^^^^^^^^^^^^^^^ no `intrinsics` in `simd`
+   |     ^^^^^^^^^^^----------
+   |                |
+   |                no `intrinsics` in `simd`
    |
 help: consider importing this module instead
    |
diff --git a/tests/ui/issues/issue-19811-escape-unicode.rs b/tests/ui/str/char-escape-unicode.rs
similarity index 70%
rename from tests/ui/issues/issue-19811-escape-unicode.rs
rename to tests/ui/str/char-escape-unicode.rs
index 7be77b8..11975e1 100644
--- a/tests/ui/issues/issue-19811-escape-unicode.rs
+++ b/tests/ui/str/char-escape-unicode.rs
@@ -1,3 +1,4 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19811>.
 //@ run-pass
 
 fn main() {
diff --git a/tests/ui/suggestions/dont-suggest-ref/simple.rs b/tests/ui/suggestions/dont-suggest-ref/simple.rs
index 4dea531..07f2dca 100644
--- a/tests/ui/suggestions/dont-suggest-ref/simple.rs
+++ b/tests/ui/suggestions/dont-suggest-ref/simple.rs
@@ -10,6 +10,26 @@ enum Either {
 #[derive(Clone)]
 struct Y;
 
+struct Wrap<T>(T);
+
+struct WrappedField {
+    field: Option<X>,
+}
+
+impl<T> std::ops::Deref for Wrap<T> {
+    type Target = T;
+
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+
+impl<T> std::ops::DerefMut for Wrap<T> {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.0
+    }
+}
+
 pub fn main() {
     let e = Either::One(X(Y));
     let mut em = Either::One(X(Y));
@@ -141,6 +161,14 @@ pub fn main() {
         // FIXME: should suggest removing `ref` too
     }
 
+    let wrapped_field = Wrap(WrappedField { field: Some(X(Y)) });
+    if let Some(mut _t) = (&wrapped_field).field { }
+    //~^ ERROR cannot move
+
+    let wrapped_index = Wrap([Some(X(Y))]);
+    if let Some(mut _t) = (&wrapped_index)[0] { }
+    //~^ ERROR cannot move
+
     // move from &Either/&X place
 
     let &X(_t) = s;
diff --git a/tests/ui/suggestions/dont-suggest-ref/simple.stderr b/tests/ui/suggestions/dont-suggest-ref/simple.stderr
index 8e7582f..b41ebcb 100644
--- a/tests/ui/suggestions/dont-suggest-ref/simple.stderr
+++ b/tests/ui/suggestions/dont-suggest-ref/simple.stderr
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of `s` which is behind a shared reference
-  --> $DIR/simple.rs:38:17
+  --> $DIR/simple.rs:58:17
    |
 LL |     let X(_t) = *s;
    |           --    ^^
@@ -13,7 +13,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:41:30
+  --> $DIR/simple.rs:61:30
    |
 LL |     if let Either::One(_t) = *r { }
    |                        --    ^^
@@ -27,7 +27,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:44:33
+  --> $DIR/simple.rs:64:33
    |
 LL |     while let Either::One(_t) = *r { }
    |                           --    ^^
@@ -41,7 +41,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:47:11
+  --> $DIR/simple.rs:67:11
    |
 LL |     match *r {
    |           ^^
@@ -56,7 +56,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:53:11
+  --> $DIR/simple.rs:73:11
    |
 LL |     match *r {
    |           ^^
@@ -71,7 +71,7 @@
    |
 
 error[E0507]: cannot move out of `sm` which is behind a mutable reference
-  --> $DIR/simple.rs:61:17
+  --> $DIR/simple.rs:81:17
    |
 LL |     let X(_t) = *sm;
    |           --    ^^^
@@ -85,7 +85,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:64:30
+  --> $DIR/simple.rs:84:30
    |
 LL |     if let Either::One(_t) = *rm { }
    |                        --    ^^^
@@ -99,7 +99,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:67:33
+  --> $DIR/simple.rs:87:33
    |
 LL |     while let Either::One(_t) = *rm { }
    |                           --    ^^^
@@ -113,7 +113,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:70:11
+  --> $DIR/simple.rs:90:11
    |
 LL |     match *rm {
    |           ^^^
@@ -128,7 +128,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:76:11
+  --> $DIR/simple.rs:96:11
    |
 LL |     match *rm {
    |           ^^^
@@ -143,7 +143,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:83:11
+  --> $DIR/simple.rs:103:11
    |
 LL |     match *rm {
    |           ^^^
@@ -158,7 +158,7 @@
    |
 
 error[E0507]: cannot move out of index of `Vec<X>`
-  --> $DIR/simple.rs:91:17
+  --> $DIR/simple.rs:111:17
    |
 LL |     let X(_t) = vs[0];
    |           --    ^^^^^
@@ -171,7 +171,7 @@
    |                 +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:94:30
+  --> $DIR/simple.rs:114:30
    |
 LL |     if let Either::One(_t) = vr[0] { }
    |                        --    ^^^^^
@@ -184,7 +184,7 @@
    |                              +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:97:33
+  --> $DIR/simple.rs:117:33
    |
 LL |     while let Either::One(_t) = vr[0] { }
    |                           --    ^^^^^
@@ -197,7 +197,7 @@
    |                                 +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:100:11
+  --> $DIR/simple.rs:120:11
    |
 LL |     match vr[0] {
    |           ^^^^^
@@ -211,7 +211,7 @@
    |           +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:106:11
+  --> $DIR/simple.rs:126:11
    |
 LL |     match vr[0] {
    |           ^^^^^
@@ -225,7 +225,7 @@
    |           +
 
 error[E0507]: cannot move out of index of `Vec<X>`
-  --> $DIR/simple.rs:114:17
+  --> $DIR/simple.rs:134:17
    |
 LL |     let X(_t) = vsm[0];
    |           --    ^^^^^^
@@ -238,7 +238,7 @@
    |                 +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:117:30
+  --> $DIR/simple.rs:137:30
    |
 LL |     if let Either::One(_t) = vrm[0] { }
    |                        --    ^^^^^^
@@ -251,7 +251,7 @@
    |                              +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:120:33
+  --> $DIR/simple.rs:140:33
    |
 LL |     while let Either::One(_t) = vrm[0] { }
    |                           --    ^^^^^^
@@ -264,7 +264,7 @@
    |                                 +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:123:11
+  --> $DIR/simple.rs:143:11
    |
 LL |     match vrm[0] {
    |           ^^^^^^
@@ -278,7 +278,7 @@
    |           +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:129:11
+  --> $DIR/simple.rs:149:11
    |
 LL |     match vrm[0] {
    |           ^^^^^^
@@ -292,7 +292,7 @@
    |           +
 
 error[E0507]: cannot move out of index of `Vec<Either>`
-  --> $DIR/simple.rs:136:11
+  --> $DIR/simple.rs:156:11
    |
 LL |     match vrm[0] {
    |           ^^^^^^
@@ -305,8 +305,24 @@
 LL |     match &vrm[0] {
    |           +
 
+error[E0507]: cannot move out of dereference of `Wrap<WrappedField>`
+  --> $DIR/simple.rs:165:27
+   |
+LL |     if let Some(mut _t) = (&wrapped_field).field { }
+   |                 ------    ^^^^^^^^^^^^^^^^^^^^^^
+   |                 |
+   |                 data moved here because `_t` has type `X`, which does not implement the `Copy` trait
+
+error[E0508]: cannot move out of type `[Option<X>; 1]`, a non-copy array
+  --> $DIR/simple.rs:169:27
+   |
+LL |     if let Some(mut _t) = (&wrapped_index)[0] { }
+   |                 ------    ^^^^^^^^^^^^^^^^^^^ cannot move out of here
+   |                 |
+   |                 data moved here because `_t` has type `X`, which does not implement the `Copy` trait
+
 error[E0507]: cannot move out of `s` which is behind a shared reference
-  --> $DIR/simple.rs:146:18
+  --> $DIR/simple.rs:174:18
    |
 LL |     let &X(_t) = s;
    |            --    ^
@@ -320,7 +336,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:149:31
+  --> $DIR/simple.rs:177:31
    |
 LL |     if let &Either::One(_t) = r { }
    |                         --    ^
@@ -334,7 +350,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:152:34
+  --> $DIR/simple.rs:180:34
    |
 LL |     while let &Either::One(_t) = r { }
    |                            --    ^
@@ -348,7 +364,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:155:11
+  --> $DIR/simple.rs:183:11
    |
 LL |     match r {
    |           ^
@@ -363,7 +379,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:162:11
+  --> $DIR/simple.rs:190:11
    |
 LL |     match r {
    |           ^
@@ -378,7 +394,7 @@
    |
 
 error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
-  --> $DIR/simple.rs:168:11
+  --> $DIR/simple.rs:196:11
    |
 LL |     match r {
    |           ^
@@ -393,7 +409,7 @@
    |
 
 error[E0507]: cannot move out of `sm` which is behind a mutable reference
-  --> $DIR/simple.rs:178:22
+  --> $DIR/simple.rs:206:22
    |
 LL |     let &mut X(_t) = sm;
    |                --    ^^
@@ -407,7 +423,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:181:35
+  --> $DIR/simple.rs:209:35
    |
 LL |     if let &mut Either::One(_t) = rm { }
    |                             --    ^^
@@ -421,7 +437,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:184:38
+  --> $DIR/simple.rs:212:38
    |
 LL |     while let &mut Either::One(_t) = rm { }
    |                                --    ^^
@@ -435,7 +451,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:187:11
+  --> $DIR/simple.rs:215:11
    |
 LL |     match rm {
    |           ^^
@@ -459,7 +475,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:194:11
+  --> $DIR/simple.rs:222:11
    |
 LL |     match rm {
    |           ^^
@@ -474,7 +490,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:200:11
+  --> $DIR/simple.rs:228:11
    |
 LL |     match rm {
    |           ^^
@@ -489,7 +505,7 @@
    |
 
 error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
-  --> $DIR/simple.rs:206:11
+  --> $DIR/simple.rs:234:11
    |
 LL |     match rm {
    |           ^^
@@ -504,7 +520,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:220:21
+  --> $DIR/simple.rs:248:21
    |
 LL |     let (&X(_t),) = (&x.clone(),);
    |             --      ^^^^^^^^^^^^^
@@ -518,7 +534,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:223:34
+  --> $DIR/simple.rs:251:34
    |
 LL |     if let (&Either::One(_t),) = (&e.clone(),) { }
    |                          --      ^^^^^^^^^^^^^
@@ -532,7 +548,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:226:37
+  --> $DIR/simple.rs:254:37
    |
 LL |     while let (&Either::One(_t),) = (&e.clone(),) { }
    |                             --      ^^^^^^^^^^^^^
@@ -546,7 +562,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:229:11
+  --> $DIR/simple.rs:257:11
    |
 LL |     match (&e.clone(),) {
    |           ^^^^^^^^^^^^^
@@ -561,7 +577,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:239:25
+  --> $DIR/simple.rs:267:25
    |
 LL |     let (&mut X(_t),) = (&mut xm.clone(),);
    |                 --      ^^^^^^^^^^^^^^^^^^
@@ -575,7 +591,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:242:38
+  --> $DIR/simple.rs:270:38
    |
 LL |     if let (&mut Either::One(_t),) = (&mut em.clone(),) { }
    |                              --      ^^^^^^^^^^^^^^^^^^
@@ -589,7 +605,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:245:41
+  --> $DIR/simple.rs:273:41
    |
 LL |     while let (&mut Either::One(_t),) = (&mut em.clone(),) { }
    |                                 --      ^^^^^^^^^^^^^^^^^^
@@ -603,7 +619,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:248:11
+  --> $DIR/simple.rs:276:11
    |
 LL |     match (&mut em.clone(),) {
    |           ^^^^^^^^^^^^^^^^^^
@@ -627,7 +643,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:261:18
+  --> $DIR/simple.rs:289:18
    |
 LL |     let &X(_t) = &x;
    |            --    ^^
@@ -641,7 +657,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:264:31
+  --> $DIR/simple.rs:292:31
    |
 LL |     if let &Either::One(_t) = &e { }
    |                         --    ^^
@@ -655,7 +671,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:267:34
+  --> $DIR/simple.rs:295:34
    |
 LL |     while let &Either::One(_t) = &e { }
    |                            --    ^^
@@ -669,7 +685,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:270:11
+  --> $DIR/simple.rs:298:11
    |
 LL |     match &e {
    |           ^^
@@ -684,7 +700,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:277:11
+  --> $DIR/simple.rs:305:11
    |
 LL |     match &e {
    |           ^^
@@ -699,7 +715,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:283:11
+  --> $DIR/simple.rs:311:11
    |
 LL |     match &e {
    |           ^^
@@ -714,7 +730,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:290:22
+  --> $DIR/simple.rs:318:22
    |
 LL |     let &mut X(_t) = &mut xm;
    |                --    ^^^^^^^
@@ -728,7 +744,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:293:35
+  --> $DIR/simple.rs:321:35
    |
 LL |     if let &mut Either::One(_t) = &mut em { }
    |                             --    ^^^^^^^
@@ -742,7 +758,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:296:38
+  --> $DIR/simple.rs:324:38
    |
 LL |     while let &mut Either::One(_t) = &mut em { }
    |                                --    ^^^^^^^
@@ -756,7 +772,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:299:11
+  --> $DIR/simple.rs:327:11
    |
 LL |     match &mut em {
    |           ^^^^^^^
@@ -771,7 +787,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:306:11
+  --> $DIR/simple.rs:334:11
    |
 LL |     match &mut em {
    |           ^^^^^^^
@@ -786,7 +802,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:312:11
+  --> $DIR/simple.rs:340:11
    |
 LL |     match &mut em {
    |           ^^^^^^^
@@ -801,7 +817,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:318:11
+  --> $DIR/simple.rs:346:11
    |
 LL |     match &mut em {
    |           ^^^^^^^
@@ -816,7 +832,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:174:11
+  --> $DIR/simple.rs:202:11
    |
 LL |     fn f1(&X(_t): &X) { }
    |           ^^^--^
@@ -830,7 +846,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:212:11
+  --> $DIR/simple.rs:240:11
    |
 LL |     fn f2(&mut X(_t): &mut X) { }
    |           ^^^^^^^--^
@@ -844,7 +860,7 @@
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/simple.rs:235:11
+  --> $DIR/simple.rs:263:11
    |
 LL |     fn f3((&X(_t),): (&X,)) { }
    |           ^^^^--^^^
@@ -858,7 +874,7 @@
    |
 
 error[E0507]: cannot move out of a mutable reference
-  --> $DIR/simple.rs:255:11
+  --> $DIR/simple.rs:283:11
    |
 LL |     fn f4((&mut X(_t),): (&mut X,)) { }
    |           ^^^^^^^^--^^^
@@ -872,7 +888,7 @@
    |
 
 error[E0507]: cannot move out of `a.a` as enum variant `Some` which is behind a shared reference
-  --> $DIR/simple.rs:331:20
+  --> $DIR/simple.rs:359:20
    |
 LL |     let Some(_s) = a.a else {
    |              --    ^^^
@@ -884,6 +900,7 @@
 LL |     let Some(ref _s) = a.a else {
    |              +++
 
-error: aborting due to 61 previous errors
+error: aborting due to 63 previous errors
 
-For more information about this error, try `rustc --explain E0507`.
+Some errors have detailed explanations: E0507, E0508.
+For more information about an error, try `rustc --explain E0507`.
diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr
index 11ec86b..2183513 100644
--- a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr
+++ b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.riscv.stderr
@@ -1,6 +1,6 @@
 warning: unstable feature specified for `-Ctarget-feature`: `d`
    |
-   = note: this feature is not stably supported; its behavior can change in the future
+   = note: this feature is allowed in cfg but unstable otherwise; its behavior can change in the future
 
 warning: target feature `d` must be disabled to ensure that the ABI of the current target can be implemented correctly
    |
diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr b/tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr
index cc225b3..7fa1cc2 100644
--- a/tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr
+++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.riscv.stderr
@@ -1,6 +1,6 @@
 warning: unstable feature specified for `-Ctarget-feature`: `d`
    |
-   = note: this feature is not stably supported; its behavior can change in the future
+   = note: this feature is allowed in cfg but unstable otherwise; its behavior can change in the future
 
 warning: target feature `d` must be enabled to ensure that the ABI of the current target can be implemented correctly
    |
diff --git a/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-attribute-riscv.rs b/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-attribute-riscv.rs
new file mode 100644
index 0000000..24d42e3
--- /dev/null
+++ b/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-attribute-riscv.rs
@@ -0,0 +1,17 @@
+//! Ensure cfg-only stable target_features trigger errors when enabled via attribute.
+//@ compile-flags: --crate-type=lib
+//@ compile-flags: --target=riscv64gc-unknown-none-elf
+//@ needs-llvm-components: riscv
+//@ add-minicore
+//@ ignore-backends: gcc
+#![feature(no_core)]
+#![no_core]
+
+extern crate minicore;
+use minicore::*;
+
+#[target_feature(enable = "v")]
+//~^ERROR: the target feature `v` is currently unstable
+#[target_feature(enable = "f")]
+//~^ERROR: the target feature `f` is allowed in cfg but unstable otherwise
+pub unsafe fn my_fun() {}
diff --git a/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-attribute-riscv.stderr b/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-attribute-riscv.stderr
new file mode 100644
index 0000000..7f13c11
--- /dev/null
+++ b/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-attribute-riscv.stderr
@@ -0,0 +1,23 @@
+error[E0658]: the target feature `v` is currently unstable
+  --> $DIR/cfg-stable-toggle-unstable-target-feature-attribute-riscv.rs:13:18
+   |
+LL | #[target_feature(enable = "v")]
+   |                  ^^^^^^^^^^^^
+   |
+   = note: see issue #150257 <https://github.com/rust-lang/rust/issues/150257> for more information
+   = help: add `#![feature(riscv_target_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]: the target feature `f` is allowed in cfg but unstable otherwise
+  --> $DIR/cfg-stable-toggle-unstable-target-feature-attribute-riscv.rs:15:18
+   |
+LL | #[target_feature(enable = "f")]
+   |                  ^^^^^^^^^^^^
+   |
+   = note: see issue #150257 <https://github.com/rust-lang/rust/issues/150257> for more information
+   = help: add `#![feature(riscv_target_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: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-flag-enable-riscv.rs b/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-flag-enable-riscv.rs
new file mode 100644
index 0000000..ab2b75e
--- /dev/null
+++ b/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-flag-enable-riscv.rs
@@ -0,0 +1,17 @@
+//! Ensure cfg-only stable target_features trigger warnings when enabled via compile flag.
+//@ check-pass
+//@ compile-flags: --crate-type=lib
+//@ compile-flags: --target=riscv64gc-unknown-none-elf -Ctarget-feature=+v -Ctarget-feature=+f
+// FIXME(#147881): *disable* the feature again for minicore as otherwise that will fail to build.
+//@ minicore-compile-flags: -Ctarget-feature=-v -Ctarget-feature=-f
+//@ needs-llvm-components: riscv
+//@ ignore-backends: gcc
+//@ add-minicore
+#![feature(no_core)]
+#![no_core]
+
+extern crate minicore;
+use minicore::*;
+
+//~? WARN unstable feature specified for `-Ctarget-feature`
+//~? WARN unstable feature specified for `-Ctarget-feature`
diff --git a/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-flag-enable-riscv.stderr b/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-flag-enable-riscv.stderr
new file mode 100644
index 0000000..b016722
--- /dev/null
+++ b/tests/ui/target-feature/cfg-stable-toggle-unstable-target-feature-flag-enable-riscv.stderr
@@ -0,0 +1,10 @@
+warning: unstable feature specified for `-Ctarget-feature`: `v`
+   |
+   = note: this feature is not stably supported; its behavior can change in the future
+
+warning: unstable feature specified for `-Ctarget-feature`: `f`
+   |
+   = note: this feature is allowed in cfg but unstable otherwise; its behavior can change in the future
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr
index 6ad6a04..246a68c 100644
--- a/tests/ui/test-attrs/inaccessible-test-modules.stderr
+++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr
@@ -2,13 +2,17 @@
   --> $DIR/inaccessible-test-modules.rs:6:5
    |
 LL | use main as x;
-   |     ^^^^^^^^^ no `main` in the root
+   |     ----^^^^^
+   |     |
+   |     no `main` in the root
 
 error[E0432]: unresolved import `test`
   --> $DIR/inaccessible-test-modules.rs:7:5
    |
 LL | use test as y;
-   |     ^^^^^^^^^ no `test` in the root
+   |     ----^^^^^
+   |     |
+   |     no `test` in the root
    |
 help: consider importing this module instead
    |
diff --git a/tests/ui/issues/issue-21332.rs b/tests/ui/traits/error-reporting/incompatible-method-multiline.rs
similarity index 63%
rename from tests/ui/issues/issue-21332.rs
rename to tests/ui/traits/error-reporting/incompatible-method-multiline.rs
index ad764f8..950ee9d 100644
--- a/tests/ui/issues/issue-21332.rs
+++ b/tests/ui/traits/error-reporting/incompatible-method-multiline.rs
@@ -1,3 +1,6 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/21332>.
+//! Ensure multi-line error formatting for "method has incompatible type for trait" diagnostics.
+
 struct S;
 
 impl Iterator for S {
diff --git a/tests/ui/issues/issue-21332.stderr b/tests/ui/traits/error-reporting/incompatible-method-multiline.stderr
similarity index 92%
rename from tests/ui/issues/issue-21332.stderr
rename to tests/ui/traits/error-reporting/incompatible-method-multiline.stderr
index 237b3ac..4f797de 100644
--- a/tests/ui/issues/issue-21332.stderr
+++ b/tests/ui/traits/error-reporting/incompatible-method-multiline.stderr
@@ -1,5 +1,5 @@
 error[E0053]: method `next` has an incompatible type for trait
-  --> $DIR/issue-21332.rs:5:27
+  --> $DIR/incompatible-method-multiline.rs:8:27
    |
 LL |     fn next(&mut self) -> Result<i32, i32> { Ok(7) }
    |                           ^^^^^^^^^^^^^^^^ expected `Option<i32>`, found `Result<i32, i32>`
diff --git a/tests/ui/issues/issue-19404.rs b/tests/ui/traits/object/inherent-method-on-dyn-with-rc-coercion.rs
similarity index 89%
rename from tests/ui/issues/issue-19404.rs
rename to tests/ui/traits/object/inherent-method-on-dyn-with-rc-coercion.rs
index ff9bb1f..fc8715e 100644
--- a/tests/ui/issues/issue-19404.rs
+++ b/tests/ui/traits/object/inherent-method-on-dyn-with-rc-coercion.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/19404>
+
 //@ build-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
diff --git a/tests/ui/issues/issue-21361.rs b/tests/ui/traits/object/iterator-methods-on-boxed-trait-object.rs
similarity index 79%
rename from tests/ui/issues/issue-21361.rs
rename to tests/ui/traits/object/iterator-methods-on-boxed-trait-object.rs
index 6f0bafc..f7a49f6 100644
--- a/tests/ui/issues/issue-21361.rs
+++ b/tests/ui/traits/object/iterator-methods-on-boxed-trait-object.rs
@@ -1,3 +1,4 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/21361>.
 //@ run-pass
 
 fn main() {
diff --git a/tests/ui/issues/issue-20396.rs b/tests/ui/traits/object/trait-object-with-nested-generics.rs
similarity index 70%
rename from tests/ui/issues/issue-20396.rs
rename to tests/ui/traits/object/trait-object-with-nested-generics.rs
index 4a7b579..37b3d8b 100644
--- a/tests/ui/issues/issue-20396.rs
+++ b/tests/ui/traits/object/trait-object-with-nested-generics.rs
@@ -1,3 +1,4 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/20396>.
 //@ check-pass
 
 #![allow(dead_code)]
diff --git a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr
index f96cf69..566c26b 100644
--- a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr
+++ b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr
@@ -2,7 +2,9 @@
   --> $DIR/unresolved-import-avoid-suggesting-global-path.rs:18:9
    |
 LL |     use module::SomeUsefulType;
-   |         ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `hygiene::module`
+   |         ^^^^^^^^--------------
+   |                 |
+   |                 no `SomeUsefulType` in `hygiene::module`
    |
 help: consider importing this struct instead
    |
@@ -14,7 +16,9 @@
   --> $DIR/unresolved-import-avoid-suggesting-global-path.rs:28:9
    |
 LL |     use module::SomeUsefulType;
-   |         ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `glob::module`
+   |         ^^^^^^^^--------------
+   |                 |
+   |                 no `SomeUsefulType` in `glob::module`
    |
 help: consider importing this struct instead
    |
diff --git a/tests/ui/unresolved/unresolved-import-recovery.stderr b/tests/ui/unresolved/unresolved-import-recovery.stderr
index ec41c9e..699fd35 100644
--- a/tests/ui/unresolved/unresolved-import-recovery.stderr
+++ b/tests/ui/unresolved/unresolved-import-recovery.stderr
@@ -2,7 +2,9 @@
   --> $DIR/unresolved-import-recovery.rs:4:13
    |
 LL |     pub use crate::unresolved;
-   |             ^^^^^^^^^^^^^^^^^ no `unresolved` in the root
+   |             ^^^^^^^----------
+   |                    |
+   |                    no `unresolved` in the root
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr
index 31b943d..e2b259b 100644
--- a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr
+++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr
@@ -2,7 +2,9 @@
   --> $DIR/unresolved-import-suggest-disambiguated-crate-name.rs:19:9
    |
 LL | pub use module::SomeUsefulType;
-   |         ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `module`
+   |         ^^^^^^^^--------------
+   |                 |
+   |                 no `SomeUsefulType` in `module`
    |
 help: consider importing this struct instead
    |
diff --git a/tests/ui/unresolved/unresolved-import.stderr b/tests/ui/unresolved/unresolved-import.stderr
index 8bd3698..a570478 100644
--- a/tests/ui/unresolved/unresolved-import.stderr
+++ b/tests/ui/unresolved/unresolved-import.stderr
@@ -13,7 +13,9 @@
   --> $DIR/unresolved-import.rs:8:5
    |
 LL | use bar::Baz as x;
-   |     ^^^^^^^^^^^^^ no `Baz` in `bar`
+   |     ^^^^^---^^^^^
+   |          |
+   |          no `Baz` in `bar`
    |
 help: a similar name exists in the module
    |
@@ -25,7 +27,9 @@
   --> $DIR/unresolved-import.rs:14:5
    |
 LL | use food::baz;
-   |     ^^^^^^^^^ no `baz` in `food`
+   |     ^^^^^^---
+   |           |
+   |           no `baz` in `food`
    |
 note: module `food::zug::baz` exists but is inaccessible
   --> $DIR/unresolved-import.rs:34:9
@@ -42,7 +46,9 @@
   --> $DIR/unresolved-import.rs:20:12
    |
 LL | use food::{beens as Foo};
-   |            ^^^^^^^^^^^^ no `beens` in `food`
+   |            -----^^^^^^^
+   |            |
+   |            no `beens` in `food`
    |
 help: a similar name exists in the module
    |
diff --git a/tests/ui/issues/issue-20433.rs b/tests/ui/unsized/vec-of-unsized-type.rs
similarity index 60%
rename from tests/ui/issues/issue-20433.rs
rename to tests/ui/unsized/vec-of-unsized-type.rs
index a663239..19df0a7 100644
--- a/tests/ui/issues/issue-20433.rs
+++ b/tests/ui/unsized/vec-of-unsized-type.rs
@@ -1,3 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/20433>.
+
 fn main() {}
 
 struct The;
diff --git a/tests/ui/issues/issue-20433.stderr b/tests/ui/unsized/vec-of-unsized-type.stderr
similarity index 91%
rename from tests/ui/issues/issue-20433.stderr
rename to tests/ui/unsized/vec-of-unsized-type.stderr
index 3730a67..414f945 100644
--- a/tests/ui/issues/issue-20433.stderr
+++ b/tests/ui/unsized/vec-of-unsized-type.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
-  --> $DIR/issue-20433.rs:6:18
+  --> $DIR/vec-of-unsized-type.rs:8:18
    |
 LL |     fn iceman(c: Vec<[i32]>) {}
    |                  ^^^^^^^^^^ doesn't have a size known at compile-time
diff --git a/tests/ui/use/use-from-trait-xc.stderr b/tests/ui/use/use-from-trait-xc.stderr
index c8ee29b..0575257 100644
--- a/tests/ui/use/use-from-trait-xc.stderr
+++ b/tests/ui/use/use-from-trait-xc.stderr
@@ -50,7 +50,9 @@
   --> $DIR/use-from-trait-xc.rs:23:5
    |
 LL | use use_from_trait_xc::Baz::new as baznew;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `new` in `sub::Baz`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^---^^^^^^^^^^
+   |                             |
+   |                             no `new` in `sub::Baz`
 
 error[E0603]: struct `Foo` is private
   --> $DIR/use-from-trait-xc.rs:14:24
diff --git a/tests/ui/where-clauses/unsupported_attribute.stderr b/tests/ui/where-clauses/unsupported_attribute.stderr
index 11f13ff..fbd0e01 100644
--- a/tests/ui/where-clauses/unsupported_attribute.stderr
+++ b/tests/ui/where-clauses/unsupported_attribute.stderr
@@ -64,7 +64,7 @@
 LL |     #[macro_use] T: Trait,
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
 
 error: `#[macro_use]` attribute cannot be used on where predicates
   --> $DIR/unsupported_attribute.rs:20:5
@@ -72,7 +72,7 @@
 LL |     #[macro_use] 'a: 'static,
    |     ^^^^^^^^^^^^
    |
-   = help: `#[macro_use]` can be applied to crates, extern crates, and modules
+   = help: `#[macro_use]` can be applied to extern crates and modules
 
 error: most attributes are not supported in `where` clauses
   --> $DIR/unsupported_attribute.rs:21:5
diff --git a/tests/ui/where-clauses/where-equality-constraints.rs b/tests/ui/where-clauses/where-equality-constraints.rs
deleted file mode 100644
index 8828f09..0000000
--- a/tests/ui/where-clauses/where-equality-constraints.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-fn f() where u8 = u16 {}
-//~^ ERROR equality constraints are not yet supported in `where` clauses
-fn g() where for<'a> &'static (u8,) == u16, {}
-//~^ ERROR equality constraints are not yet supported in `where` clauses
-
-fn main() {}
diff --git a/tests/ui/where-clauses/where-equality-constraints.stderr b/tests/ui/where-clauses/where-equality-constraints.stderr
deleted file mode 100644
index 9d8fac0..0000000
--- a/tests/ui/where-clauses/where-equality-constraints.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/where-equality-constraints.rs:1:14
-   |
-LL | fn f() where u8 = u16 {}
-   |              ^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-
-error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/where-equality-constraints.rs:3:14
-   |
-LL | fn g() where for<'a> &'static (u8,) == u16, {}
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not supported
-   |
-   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
-
-error: aborting due to 2 previous errors
-
diff --git a/triagebot.toml b/triagebot.toml
index 36ea68c..d50d742 100644
--- a/triagebot.toml
+++ b/triagebot.toml
@@ -951,11 +951,21 @@
 # ------------------------------------------------------------------------------
 
 [mentions."compiler/rustc_codegen_cranelift"]
-message = "The Cranelift subtree was changed"
+message = """
+`rustc_codegen_cranelift` is developed in its own repository. If possible, consider \
+making this change to \
+[rust-lang/rustc_codegen_cranelift](https://github.com/rust-lang/rustc_codegen_cranelift) \
+instead.
+"""
 cc = ["@bjorn3"]
 
 [mentions."compiler/rustc_codegen_gcc"]
-message = "The GCC codegen subtree was changed"
+message = """
+`rustc_codegen_gcc` is developed in its own repository. If possible, consider \
+making this change to \
+[rust-lang/rustc_codegen_gcc](https://github.com/rust-lang/rustc_codegen_gcc) \
+instead.
+"""
 cc = ["@antoyo", "@GuillaumeGomez"]
 
 [mentions."compiler/rustc_const_eval/src/"]
@@ -1109,8 +1119,9 @@
 
 [mentions."library/portable-simd"]
 message = """
-Portable SIMD is developed in its own repository. If possible, consider \
-making this change to [rust-lang/portable-simd](https://github.com/rust-lang/portable-simd) \
+`portable-simd` is developed in its own repository. If possible, consider \
+making this change to \
+[rust-lang/portable-simd](https://github.com/rust-lang/portable-simd) \
 instead.
 """
 cc = ["@calebzulawski", "@programmerjake"]
@@ -1153,7 +1164,12 @@
 cc = ["@ehuss"]
 
 [mentions."src/tools/clippy"]
-message = "The Clippy subtree was changed"
+message = """
+`clippy` is developed in its own repository. If possible, consider \
+making this change to \
+[rust-lang/rust-clippy](https://github.com/rust-lang/rust-clippy) \
+instead.
+"""
 cc = ["@rust-lang/clippy"]
 
 [mentions."src/tools/compiletest"]
@@ -1166,7 +1182,12 @@
 """
 
 [mentions."src/tools/miri"]
-message = "The Miri subtree was changed"
+message = """
+`miri` is developed in its own repository. If possible, consider \
+making this change to \
+[rust-lang/miri](https://github.com/rust-lang/miri) \
+instead.
+"""
 cc = ["@rust-lang/miri"]
 
 [mentions."src/tools/run-make-support"]
@@ -1175,15 +1196,20 @@
 
 [mentions."src/tools/rust-analyzer"]
 message = """
-rust-analyzer is developed in its own repository. If possible, consider making \
-this change to [rust-lang/rust-analyzer] instead.
-
-[rust-lang/rust-analyzer]: https://github.com/rust-lang/rust-analyzer
+`rust-analyzer` is developed in its own repository. If possible, consider \
+making this change to \
+[rust-lang/rust-analyzer](https://github.com/rust-lang/rust-analyzer) \
+instead.
 """
 cc = ["@rust-lang/rust-analyzer"]
 
 [mentions."src/tools/rustfmt"]
-message = "The Rustfmt subtree was changed"
+message = """
+`rustfmt` is developed in its own repository. If possible, consider \
+making this change to \
+[rust-lang/rustfmt](https://github.com/rust-lang/rustfmt) \
+instead.
+"""
 cc = ["@rust-lang/rustfmt"]
 
 [mentions."compiler/rustc_middle/src/mir/syntax.rs"]
@@ -1395,7 +1421,12 @@
 cc = ["@ehuss"]
 
 [mentions."src/doc/rustc-dev-guide"]
-message = "The rustc-dev-guide subtree was changed. If this PR *only* touches the dev guide consider submitting a PR directly to [rust-lang/rustc-dev-guide](https://github.com/rust-lang/rustc-dev-guide/pulls) otherwise thank you for updating the dev guide with your changes."
+message = """
+`rustc-dev-guide` is developed in its own repository. If possible, consider \
+making this change to \
+[rust-lang/rustc-dev-guide](https://github.com/rust-lang/rustc-dev-guide) \
+instead.
+"""
 cc = ["@BoxyUwU", "@tshepang"]
 
 [mentions."compiler/rustc_passes/src/check_attr.rs"]
@@ -1498,6 +1529,7 @@
     "@nia-e",
     "@LawnGnome",
     "@clarfonthey",
+    "@aapoalas",
 ]
 infra-ci = [
     "@Mark-Simulacrum",
diff --git a/typos.toml b/typos.toml
index 8e14ce5..f680f5b 100644
--- a/typos.toml
+++ b/typos.toml
@@ -13,6 +13,7 @@
     # generated lorem ipsum texts
     "library/alloctests/benches/str.rs",
     "library/alloctests/tests/str.rs",
+    "library/coretests/benches/pattern.rs",
 ]
 
 [default.extend-words]