diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
index a561496b02639..b5d5071dc0536 100644
--- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
+++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
@@ -61,7 +61,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
     pub(crate) fn infer_opaque_types(
         &self,
         infcx: &InferCtxt<'tcx>,
-        opaque_ty_decls: FxIndexMap<OpaqueTypeKey<'tcx>, (OpaqueHiddenType<'tcx>, OpaqueTyOrigin)>,
+        opaque_ty_decls: FxIndexMap<OpaqueTypeKey<'tcx>, OpaqueHiddenType<'tcx>>,
     ) -> FxIndexMap<LocalDefId, OpaqueHiddenType<'tcx>> {
         let mut result: FxIndexMap<LocalDefId, OpaqueHiddenType<'tcx>> = FxIndexMap::default();
 
@@ -72,7 +72,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
             .collect();
         debug!(?member_constraints);
 
-        for (opaque_type_key, (concrete_type, origin)) in opaque_ty_decls {
+        for (opaque_type_key, concrete_type) in opaque_ty_decls {
             let substs = opaque_type_key.substs;
             debug!(?concrete_type, ?substs);
 
@@ -143,7 +143,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
             let ty = infcx.infer_opaque_definition_from_instantiation(
                 opaque_type_key,
                 universal_concrete_type,
-                origin,
             );
             // Sometimes two opaque types are the same only after we remap the generic parameters
             // back to the opaque type definition. E.g. we may have `OpaqueType<X, Y>` mapped to `(X, Y)`
@@ -215,7 +214,6 @@ pub trait InferCtxtExt<'tcx> {
         &self,
         opaque_type_key: OpaqueTypeKey<'tcx>,
         instantiated_ty: OpaqueHiddenType<'tcx>,
-        origin: OpaqueTyOrigin,
     ) -> Ty<'tcx>;
 }
 
@@ -248,109 +246,115 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
         &self,
         opaque_type_key: OpaqueTypeKey<'tcx>,
         instantiated_ty: OpaqueHiddenType<'tcx>,
-        origin: OpaqueTyOrigin,
     ) -> Ty<'tcx> {
         if let Some(e) = self.tainted_by_errors() {
             return self.tcx.ty_error(e);
         }
 
+        if let Err(guar) =
+            check_opaque_type_parameter_valid(self.tcx, opaque_type_key, instantiated_ty.span)
+        {
+            return self.tcx.ty_error(guar);
+        }
+
         let definition_ty = instantiated_ty
             .remap_generic_params_to_declaration_params(opaque_type_key, self.tcx, false)
             .ty;
 
-        if let Err(guar) = check_opaque_type_parameter_valid(
+        // `definition_ty` does not live in of the current inference context,
+        // so lets make sure that we don't accidentally misuse our current `infcx`.
+        match check_opaque_type_well_formed(
             self.tcx,
-            opaque_type_key,
-            origin,
+            self.next_trait_solver(),
+            opaque_type_key.def_id,
             instantiated_ty.span,
+            definition_ty,
         ) {
-            return self.tcx.ty_error(guar);
+            Ok(hidden_ty) => hidden_ty,
+            Err(guar) => self.tcx.ty_error(guar),
         }
+    }
+}
 
-        // Only check this for TAIT. RPIT already supports `tests/ui/impl-trait/nested-return-type2.rs`
-        // on stable and we'd break that.
-        let OpaqueTyOrigin::TyAlias { .. } = origin else {
-            return definition_ty;
-        };
-        let def_id = opaque_type_key.def_id;
-        // This logic duplicates most of `check_opaque_meets_bounds`.
-        // FIXME(oli-obk): Also do region checks here and then consider removing `check_opaque_meets_bounds` entirely.
-        let param_env = self.tcx.param_env(def_id);
-        // HACK This bubble is required for this tests to pass:
-        // nested-return-type2-tait2.rs
-        // nested-return-type2-tait3.rs
-        // FIXME(-Ztrait-solver=next): We probably should use `DefiningAnchor::Error`
-        // and prepopulate this `InferCtxt` with known opaque values, rather than
-        // using the `Bind` anchor here. For now it's fine.
-        let infcx = self
-            .tcx
-            .infer_ctxt()
-            .with_opaque_type_inference(if self.next_trait_solver() {
-                DefiningAnchor::Bind(def_id)
-            } else {
-                DefiningAnchor::Bubble
-            })
-            .build();
-        let ocx = ObligationCtxt::new(&infcx);
-        // Require the hidden type to be well-formed with only the generics of the opaque type.
-        // Defining use functions may have more bounds than the opaque type, which is ok, as long as the
-        // hidden type is well formed even without those bounds.
-        let predicate = ty::Binder::dummy(ty::PredicateKind::WellFormed(definition_ty.into()));
-
-        let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id);
+/// This logic duplicates most of `check_opaque_meets_bounds`.
+/// FIXME(oli-obk): Also do region checks here and then consider removing
+/// `check_opaque_meets_bounds` entirely.
+fn check_opaque_type_well_formed<'tcx>(
+    tcx: TyCtxt<'tcx>,
+    next_trait_solver: bool,
+    def_id: LocalDefId,
+    definition_span: Span,
+    definition_ty: Ty<'tcx>,
+) -> Result<Ty<'tcx>, ErrorGuaranteed> {
+    // Only check this for TAIT. RPIT already supports `tests/ui/impl-trait/nested-return-type2.rs`
+    // on stable and we'd break that.
+    let opaque_ty_hir = tcx.hir().expect_item(def_id);
+    let OpaqueTyOrigin::TyAlias { .. } = opaque_ty_hir.expect_opaque_ty().origin else {
+        return Ok(definition_ty);
+    };
+    let param_env = tcx.param_env(def_id);
+    // HACK This bubble is required for this tests to pass:
+    // nested-return-type2-tait2.rs
+    // nested-return-type2-tait3.rs
+    // FIXME(-Ztrait-solver=next): We probably should use `DefiningAnchor::Error`
+    // and prepopulate this `InferCtxt` with known opaque values, rather than
+    // using the `Bind` anchor here. For now it's fine.
+    let infcx = tcx
+        .infer_ctxt()
+        .with_next_trait_solver(next_trait_solver)
+        .with_opaque_type_inference(if next_trait_solver {
+            DefiningAnchor::Bind(def_id)
+        } else {
+            DefiningAnchor::Bubble
+        })
+        .build();
+    let ocx = ObligationCtxt::new(&infcx);
+    let identity_substs = InternalSubsts::identity_for_item(tcx, def_id);
 
-        // Require that the hidden type actually fulfills all the bounds of the opaque type, even without
-        // the bounds that the function supplies.
-        let opaque_ty = self.tcx.mk_opaque(def_id.to_def_id(), id_substs);
-        if let Err(err) = ocx.eq(
-            &ObligationCause::misc(instantiated_ty.span, def_id),
-            param_env,
-            opaque_ty,
-            definition_ty,
-        ) {
+    // Require that the hidden type actually fulfills all the bounds of the opaque type, even without
+    // the bounds that the function supplies.
+    let opaque_ty = tcx.mk_opaque(def_id.to_def_id(), identity_substs);
+    ocx.eq(&ObligationCause::misc(definition_span, def_id), param_env, opaque_ty, definition_ty)
+        .map_err(|err| {
             infcx
                 .err_ctxt()
                 .report_mismatched_types(
-                    &ObligationCause::misc(instantiated_ty.span, def_id),
+                    &ObligationCause::misc(definition_span, def_id),
                     opaque_ty,
                     definition_ty,
                     err,
                 )
-                .emit();
-        }
+                .emit()
+        })?;
 
-        ocx.register_obligation(Obligation::misc(
-            infcx.tcx,
-            instantiated_ty.span,
-            def_id,
-            param_env,
-            predicate,
-        ));
+    // Require the hidden type to be well-formed with only the generics of the opaque type.
+    // Defining use functions may have more bounds than the opaque type, which is ok, as long as the
+    // hidden type is well formed even without those bounds.
+    let predicate = ty::Binder::dummy(ty::PredicateKind::WellFormed(definition_ty.into()));
+    ocx.register_obligation(Obligation::misc(tcx, definition_span, def_id, param_env, predicate));
 
-        // Check that all obligations are satisfied by the implementation's
-        // version.
-        let errors = ocx.select_all_or_error();
+    // Check that all obligations are satisfied by the implementation's
+    // version.
+    let errors = ocx.select_all_or_error();
 
-        // This is still required for many(half of the tests in ui/type-alias-impl-trait)
-        // tests to pass
-        let _ = infcx.take_opaque_types();
+    // This is still required for many(half of the tests in ui/type-alias-impl-trait)
+    // tests to pass
+    let _ = infcx.take_opaque_types();
 
-        if errors.is_empty() {
-            definition_ty
-        } else {
-            let reported = infcx.err_ctxt().report_fulfillment_errors(&errors);
-            self.tcx.ty_error(reported)
-        }
+    if errors.is_empty() {
+        Ok(definition_ty)
+    } else {
+        Err(infcx.err_ctxt().report_fulfillment_errors(&errors))
     }
 }
 
 fn check_opaque_type_parameter_valid(
     tcx: TyCtxt<'_>,
     opaque_type_key: OpaqueTypeKey<'_>,
-    origin: OpaqueTyOrigin,
     span: Span,
 ) -> Result<(), ErrorGuaranteed> {
-    match origin {
+    let opaque_ty_hir = tcx.hir().expect_item(opaque_type_key.def_id);
+    match opaque_ty_hir.expect_opaque_ty().origin {
         // No need to check return position impl trait (RPIT)
         // because for type and const parameters they are correct
         // by construction: we convert
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index 00fd3762fa773..6697e1aff7dd0 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -7,7 +7,6 @@ use std::{fmt, iter, mem};
 
 use either::Either;
 
-use hir::OpaqueTyOrigin;
 use rustc_data_structures::frozen::Frozen;
 use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
 use rustc_errors::ErrorGuaranteed;
@@ -28,6 +27,7 @@ use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
 use rustc_middle::mir::AssertKind;
 use rustc_middle::mir::*;
 use rustc_middle::traits::query::NoSolution;
+use rustc_middle::traits::ObligationCause;
 use rustc_middle::ty::adjustment::PointerCast;
 use rustc_middle::ty::cast::CastTy;
 use rustc_middle::ty::subst::{SubstsRef, UserSubsts};
@@ -241,7 +241,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
                 hidden_type.ty = infcx.tcx.ty_error(reported);
             }
 
-            (opaque_type_key, (hidden_type, decl.origin))
+            (opaque_type_key, hidden_type)
         })
         .collect();
 
@@ -878,8 +878,7 @@ struct BorrowCheckContext<'a, 'tcx> {
 pub(crate) struct MirTypeckResults<'tcx> {
     pub(crate) constraints: MirTypeckRegionConstraints<'tcx>,
     pub(crate) universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
-    pub(crate) opaque_type_values:
-        FxIndexMap<OpaqueTypeKey<'tcx>, (OpaqueHiddenType<'tcx>, OpaqueTyOrigin)>,
+    pub(crate) opaque_type_values: FxIndexMap<OpaqueTypeKey<'tcx>, OpaqueHiddenType<'tcx>>,
 }
 
 /// A collection of region constraints that must be satisfied for the
@@ -1053,15 +1052,28 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
             ConstraintCategory::OpaqueType,
             CustomTypeOp::new(
                 |ocx| {
-                    for (key, hidden_ty) in renumbered_opaques {
-                        ocx.register_infer_ok_obligations(
-                            ocx.infcx.register_hidden_type_in_new_solver(
-                                key,
-                                param_env,
-                                hidden_ty.ty,
-                            )?,
+                    let mut obligations = Vec::new();
+                    for (opaque_type_key, hidden_ty) in renumbered_opaques {
+                        let cause = ObligationCause::dummy();
+                        ocx.infcx.insert_hidden_type(
+                            opaque_type_key,
+                            &cause,
+                            param_env,
+                            hidden_ty.ty,
+                            true,
+                            &mut obligations,
+                        )?;
+
+                        ocx.infcx.add_item_bounds_for_hidden_type(
+                            opaque_type_key,
+                            cause,
+                            param_env,
+                            hidden_ty.ty,
+                            &mut obligations,
                         );
                     }
+
+                    ocx.register_obligations(obligations);
                     Ok(())
                 },
                 "register pre-defined opaques",
diff --git a/compiler/rustc_codegen_cranelift/src/codegen_i128.rs b/compiler/rustc_codegen_cranelift/src/codegen_i128.rs
index f751d8c179db5..13568b198db1b 100644
--- a/compiler/rustc_codegen_cranelift/src/codegen_i128.rs
+++ b/compiler/rustc_codegen_cranelift/src/codegen_i128.rs
@@ -22,8 +22,8 @@ pub(crate) fn maybe_codegen<'tcx>(
 
     match bin_op {
         BinOp::BitAnd | BinOp::BitOr | BinOp::BitXor => None,
-        BinOp::Add | BinOp::Sub => None,
-        BinOp::Mul => {
+        BinOp::Add | BinOp::AddUnchecked | BinOp::Sub | BinOp::SubUnchecked => None,
+        BinOp::Mul | BinOp::MulUnchecked => {
             let args = [lhs.load_scalar(fx), rhs.load_scalar(fx)];
             let ret_val = fx.lib_call(
                 "__multi3",
@@ -69,7 +69,7 @@ pub(crate) fn maybe_codegen<'tcx>(
             }
         }
         BinOp::Lt | BinOp::Le | BinOp::Eq | BinOp::Ge | BinOp::Gt | BinOp::Ne => None,
-        BinOp::Shl | BinOp::Shr => None,
+        BinOp::Shl | BinOp::ShlUnchecked | BinOp::Shr | BinOp::ShrUnchecked => None,
     }
 }
 
@@ -131,9 +131,10 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
             fx.lib_call(name, param_types, vec![], &args);
             Some(out_place.to_cvalue(fx))
         }
+        BinOp::AddUnchecked | BinOp::SubUnchecked | BinOp::MulUnchecked => unreachable!(),
         BinOp::Offset => unreachable!("offset should only be used on pointers, not 128bit ints"),
         BinOp::Div | BinOp::Rem => unreachable!(),
         BinOp::Lt | BinOp::Le | BinOp::Eq | BinOp::Ge | BinOp::Gt | BinOp::Ne => unreachable!(),
-        BinOp::Shl | BinOp::Shr => unreachable!(),
+        BinOp::Shl | BinOp::ShlUnchecked | BinOp::Shr | BinOp::ShrUnchecked => unreachable!(),
     }
 }
diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
index 1e83c30bd677a..5862f18299e90 100644
--- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
@@ -472,25 +472,11 @@ fn codegen_regular_intrinsic_call<'tcx>(
             ret.write_cvalue(fx, CValue::by_val(align, usize_layout));
         }
 
-        sym::unchecked_add
-        | sym::unchecked_sub
-        | sym::unchecked_mul
-        | sym::exact_div
-        | sym::unchecked_shl
-        | sym::unchecked_shr => {
+        sym::exact_div => {
             intrinsic_args!(fx, args => (x, y); intrinsic);
 
-            // FIXME trap on overflow
-            let bin_op = match intrinsic {
-                sym::unchecked_add => BinOp::Add,
-                sym::unchecked_sub => BinOp::Sub,
-                sym::unchecked_mul => BinOp::Mul,
-                sym::exact_div => BinOp::Div,
-                sym::unchecked_shl => BinOp::Shl,
-                sym::unchecked_shr => BinOp::Shr,
-                _ => unreachable!(),
-            };
-            let res = crate::num::codegen_int_binop(fx, bin_op, x, y);
+            // FIXME trap on inexact
+            let res = crate::num::codegen_int_binop(fx, BinOp::Div, x, y);
             ret.write_cvalue(fx, res);
         }
         sym::saturating_add | sym::saturating_sub => {
diff --git a/compiler/rustc_codegen_cranelift/src/num.rs b/compiler/rustc_codegen_cranelift/src/num.rs
index ba53e01c7a212..ac1a6cce096f4 100644
--- a/compiler/rustc_codegen_cranelift/src/num.rs
+++ b/compiler/rustc_codegen_cranelift/src/num.rs
@@ -128,10 +128,11 @@ pub(crate) fn codegen_int_binop<'tcx>(
     let rhs = in_rhs.load_scalar(fx);
 
     let b = fx.bcx.ins();
+    // FIXME trap on overflow for the Unchecked versions
     let val = match bin_op {
-        BinOp::Add => b.iadd(lhs, rhs),
-        BinOp::Sub => b.isub(lhs, rhs),
-        BinOp::Mul => b.imul(lhs, rhs),
+        BinOp::Add | BinOp::AddUnchecked => b.iadd(lhs, rhs),
+        BinOp::Sub | BinOp::SubUnchecked => b.isub(lhs, rhs),
+        BinOp::Mul | BinOp::MulUnchecked => b.imul(lhs, rhs),
         BinOp::Div => {
             if signed {
                 b.sdiv(lhs, rhs)
@@ -149,16 +150,19 @@ pub(crate) fn codegen_int_binop<'tcx>(
         BinOp::BitXor => b.bxor(lhs, rhs),
         BinOp::BitAnd => b.band(lhs, rhs),
         BinOp::BitOr => b.bor(lhs, rhs),
-        BinOp::Shl => b.ishl(lhs, rhs),
-        BinOp::Shr => {
+        BinOp::Shl | BinOp::ShlUnchecked => b.ishl(lhs, rhs),
+        BinOp::Shr | BinOp::ShrUnchecked => {
             if signed {
                 b.sshr(lhs, rhs)
             } else {
                 b.ushr(lhs, rhs)
             }
         }
+        BinOp::Offset => unreachable!("Offset is not an integer operation"),
         // Compare binops handles by `codegen_binop`.
-        _ => unreachable!("{:?}({:?}, {:?})", bin_op, in_lhs.layout().ty, in_rhs.layout().ty),
+        BinOp::Eq | BinOp::Ne | BinOp::Lt | BinOp::Le | BinOp::Gt | BinOp::Ge => {
+            unreachable!("{:?}({:?}, {:?})", bin_op, in_lhs.layout().ty, in_rhs.layout().ty);
+        }
     };
 
     CValue::by_val(val, in_lhs.layout())
diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs
index e1abb73a504a3..5a68075991f16 100644
--- a/compiler/rustc_codegen_ssa/src/common.rs
+++ b/compiler/rustc_codegen_ssa/src/common.rs
@@ -132,7 +132,7 @@ pub fn build_langcall<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
 // all shifts). For 32- and 64-bit types, this matches the semantics
 // of Java. (See related discussion on #1877 and #10183.)
 
-pub fn build_unchecked_lshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
+pub fn build_masked_lshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
     bx: &mut Bx,
     lhs: Bx::Value,
     rhs: Bx::Value,
@@ -143,7 +143,7 @@ pub fn build_unchecked_lshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
     bx.shl(lhs, rhs)
 }
 
-pub fn build_unchecked_rshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
+pub fn build_masked_rshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
     bx: &mut Bx,
     lhs_t: Ty<'tcx>,
     lhs: Bx::Value,
diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
index 9ac2424e76be0..8a65dd593b8c1 100644
--- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
@@ -211,52 +211,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 args[1].val.unaligned_volatile_store(bx, dst);
                 return;
             }
-            | sym::unchecked_shl
-            | sym::unchecked_shr
-            | sym::unchecked_add
-            | sym::unchecked_sub
-            | sym::unchecked_mul
-            | sym::exact_div => {
+            sym::exact_div => {
                 let ty = arg_tys[0];
                 match int_type_width_signed(ty, bx.tcx()) {
-                    Some((_width, signed)) => match name {
-                        sym::exact_div => {
-                            if signed {
-                                bx.exactsdiv(args[0].immediate(), args[1].immediate())
-                            } else {
-                                bx.exactudiv(args[0].immediate(), args[1].immediate())
-                            }
-                        }
-                        sym::unchecked_shl => bx.shl(args[0].immediate(), args[1].immediate()),
-                        sym::unchecked_shr => {
-                            if signed {
-                                bx.ashr(args[0].immediate(), args[1].immediate())
-                            } else {
-                                bx.lshr(args[0].immediate(), args[1].immediate())
-                            }
-                        }
-                        sym::unchecked_add => {
-                            if signed {
-                                bx.unchecked_sadd(args[0].immediate(), args[1].immediate())
-                            } else {
-                                bx.unchecked_uadd(args[0].immediate(), args[1].immediate())
-                            }
-                        }
-                        sym::unchecked_sub => {
-                            if signed {
-                                bx.unchecked_ssub(args[0].immediate(), args[1].immediate())
-                            } else {
-                                bx.unchecked_usub(args[0].immediate(), args[1].immediate())
-                            }
-                        }
-                        sym::unchecked_mul => {
-                            if signed {
-                                bx.unchecked_smul(args[0].immediate(), args[1].immediate())
-                            } else {
-                                bx.unchecked_umul(args[0].immediate(), args[1].immediate())
-                            }
+                    Some((_width, signed)) => {
+                        if signed {
+                            bx.exactsdiv(args[0].immediate(), args[1].immediate())
+                        } else {
+                            bx.exactudiv(args[0].immediate(), args[1].immediate())
                         }
-                        _ => bug!(),
                     },
                     None => {
                         bx.tcx().sess.emit_err(InvalidMonomorphization::BasicIntegerType { span, name, ty });
diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
index 5241a5aee008e..2d3d0ec68b81c 100644
--- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
@@ -798,6 +798,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                     bx.add(lhs, rhs)
                 }
             }
+            mir::BinOp::AddUnchecked => {
+                if is_signed {
+                    bx.unchecked_sadd(lhs, rhs)
+                } else {
+                    bx.unchecked_uadd(lhs, rhs)
+                }
+            }
             mir::BinOp::Sub => {
                 if is_float {
                     bx.fsub(lhs, rhs)
@@ -805,6 +812,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                     bx.sub(lhs, rhs)
                 }
             }
+            mir::BinOp::SubUnchecked => {
+                if is_signed {
+                    bx.unchecked_ssub(lhs, rhs)
+                } else {
+                    bx.unchecked_usub(lhs, rhs)
+                }
+            }
             mir::BinOp::Mul => {
                 if is_float {
                     bx.fmul(lhs, rhs)
@@ -812,6 +826,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                     bx.mul(lhs, rhs)
                 }
             }
+            mir::BinOp::MulUnchecked => {
+                if is_signed {
+                    bx.unchecked_smul(lhs, rhs)
+                } else {
+                    bx.unchecked_umul(lhs, rhs)
+                }
+            }
             mir::BinOp::Div => {
                 if is_float {
                     bx.fdiv(lhs, rhs)
@@ -848,8 +869,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                     bx.inbounds_gep(llty, lhs, &[rhs])
                 }
             }
-            mir::BinOp::Shl => common::build_unchecked_lshift(bx, lhs, rhs),
-            mir::BinOp::Shr => common::build_unchecked_rshift(bx, input_ty, lhs, rhs),
+            mir::BinOp::Shl => common::build_masked_lshift(bx, lhs, rhs),
+            mir::BinOp::ShlUnchecked => {
+                let rhs = base::cast_shift_expr_rhs(bx, lhs, rhs);
+                bx.shl(lhs, rhs)
+            }
+            mir::BinOp::Shr => common::build_masked_rshift(bx, input_ty, lhs, rhs),
+            mir::BinOp::ShrUnchecked => {
+                let rhs = base::cast_shift_expr_rhs(bx, lhs, rhs);
+                if is_signed { bx.ashr(lhs, rhs) } else { bx.lshr(lhs, rhs) }
+            }
             mir::BinOp::Ne
             | mir::BinOp::Lt
             | mir::BinOp::Gt
diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs
index 7192bbc00d556..8f4cf23770e3d 100644
--- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs
+++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs
@@ -234,37 +234,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 let r = self.read_immediate(&args[1])?;
                 self.exact_div(&l, &r, dest)?;
             }
-            sym::unchecked_shl
-            | sym::unchecked_shr
-            | sym::unchecked_add
-            | sym::unchecked_sub
-            | sym::unchecked_mul => {
-                let l = self.read_immediate(&args[0])?;
-                let r = self.read_immediate(&args[1])?;
-                let bin_op = match intrinsic_name {
-                    sym::unchecked_shl => BinOp::Shl,
-                    sym::unchecked_shr => BinOp::Shr,
-                    sym::unchecked_add => BinOp::Add,
-                    sym::unchecked_sub => BinOp::Sub,
-                    sym::unchecked_mul => BinOp::Mul,
-                    _ => bug!(),
-                };
-                let (val, overflowed, _ty) = self.overflowing_binary_op(bin_op, &l, &r)?;
-                if overflowed {
-                    let layout = self.layout_of(substs.type_at(0))?;
-                    let r_val = r.to_scalar().to_bits(layout.size)?;
-                    if let sym::unchecked_shl | sym::unchecked_shr = intrinsic_name {
-                        throw_ub_custom!(
-                            fluent::const_eval_overflow_shift,
-                            val = r_val,
-                            name = intrinsic_name
-                        );
-                    } else {
-                        throw_ub_custom!(fluent::const_eval_overflow, name = intrinsic_name);
-                    }
-                }
-                self.write_scalar(val, dest)?;
-            }
             sym::rotate_left | sym::rotate_right => {
                 // rotate_left: (X << (S % BW)) | (X >> ((BW - S) % BW))
                 // rotate_right: (X << ((BW - S) % BW)) | (X >> (S % BW))
diff --git a/compiler/rustc_const_eval/src/interpret/operator.rs b/compiler/rustc_const_eval/src/interpret/operator.rs
index 7186148daf0ba..7bca7efdf5a83 100644
--- a/compiler/rustc_const_eval/src/interpret/operator.rs
+++ b/compiler/rustc_const_eval/src/interpret/operator.rs
@@ -3,10 +3,13 @@ use rustc_middle::mir;
 use rustc_middle::mir::interpret::{InterpResult, Scalar};
 use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
 use rustc_middle::ty::{self, FloatTy, Ty};
+use rustc_span::symbol::sym;
 use rustc_target::abi::Abi;
 
 use super::{ImmTy, Immediate, InterpCx, Machine, PlaceTy};
 
+use crate::fluent_generated as fluent;
+
 impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
     /// Applies the binary operation `op` to the two operands and writes a tuple of the result
     /// and a boolean signifying the potential overflow to the destination.
@@ -139,8 +142,17 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
     ) -> InterpResult<'tcx, (Scalar<M::Provenance>, bool, Ty<'tcx>)> {
         use rustc_middle::mir::BinOp::*;
 
+        let throw_ub_on_overflow = match bin_op {
+            AddUnchecked => Some(sym::unchecked_add),
+            SubUnchecked => Some(sym::unchecked_sub),
+            MulUnchecked => Some(sym::unchecked_mul),
+            ShlUnchecked => Some(sym::unchecked_shl),
+            ShrUnchecked => Some(sym::unchecked_shr),
+            _ => None,
+        };
+
         // Shift ops can have an RHS with a different numeric type.
-        if bin_op == Shl || bin_op == Shr {
+        if matches!(bin_op, Shl | ShlUnchecked | Shr | ShrUnchecked) {
             let size = u128::from(left_layout.size.bits());
             // Even if `r` is signed, we treat it as if it was unsigned (i.e., we use its
             // zero-extended form). This matches the codegen backend:
@@ -155,6 +167,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
             // integers are maximally 128bits wide, so negative shifts *always* overflow and we have
             // consistent results for the same value represented at different bit widths.
             assert!(size <= 128);
+            let original_r = r;
             let overflow = r >= size;
             // The shift offset is implicitly masked to the type size, to make sure this operation
             // is always defined. This is the one MIR operator that does *not* directly map to a
@@ -166,19 +179,28 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
             let result = if left_layout.abi.is_signed() {
                 let l = self.sign_extend(l, left_layout) as i128;
                 let result = match bin_op {
-                    Shl => l.checked_shl(r).unwrap(),
-                    Shr => l.checked_shr(r).unwrap(),
+                    Shl | ShlUnchecked => l.checked_shl(r).unwrap(),
+                    Shr | ShrUnchecked => l.checked_shr(r).unwrap(),
                     _ => bug!(),
                 };
                 result as u128
             } else {
                 match bin_op {
-                    Shl => l.checked_shl(r).unwrap(),
-                    Shr => l.checked_shr(r).unwrap(),
+                    Shl | ShlUnchecked => l.checked_shl(r).unwrap(),
+                    Shr | ShrUnchecked => l.checked_shr(r).unwrap(),
                     _ => bug!(),
                 }
             };
             let truncated = self.truncate(result, left_layout);
+
+            if overflow && let Some(intrinsic_name) = throw_ub_on_overflow {
+                throw_ub_custom!(
+                    fluent::const_eval_overflow_shift,
+                    val = original_r,
+                    name = intrinsic_name
+                );
+            }
+
             return Ok((Scalar::from_uint(truncated, left_layout.size), overflow, left_layout.ty));
         }
 
@@ -216,9 +238,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 Rem if r == 0 => throw_ub!(RemainderByZero),
                 Div => Some(i128::overflowing_div),
                 Rem => Some(i128::overflowing_rem),
-                Add => Some(i128::overflowing_add),
-                Sub => Some(i128::overflowing_sub),
-                Mul => Some(i128::overflowing_mul),
+                Add | AddUnchecked => Some(i128::overflowing_add),
+                Sub | SubUnchecked => Some(i128::overflowing_sub),
+                Mul | MulUnchecked => Some(i128::overflowing_mul),
                 _ => None,
             };
             if let Some(op) = op {
@@ -242,11 +264,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 // If that truncation loses any information, we have an overflow.
                 let result = result as u128;
                 let truncated = self.truncate(result, left_layout);
-                return Ok((
-                    Scalar::from_uint(truncated, size),
-                    oflo || self.sign_extend(truncated, left_layout) != result,
-                    left_layout.ty,
-                ));
+                let overflow = oflo || self.sign_extend(truncated, left_layout) != result;
+                if overflow && let Some(intrinsic_name) = throw_ub_on_overflow {
+                    throw_ub_custom!(fluent::const_eval_overflow, name = intrinsic_name);
+                }
+                return Ok((Scalar::from_uint(truncated, size), overflow, left_layout.ty));
             }
         }
 
@@ -263,12 +285,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
             BitAnd => (Scalar::from_uint(l & r, size), left_layout.ty),
             BitXor => (Scalar::from_uint(l ^ r, size), left_layout.ty),
 
-            Add | Sub | Mul | Rem | Div => {
+            Add | AddUnchecked | Sub | SubUnchecked | Mul | MulUnchecked | Rem | Div => {
                 assert!(!left_layout.abi.is_signed());
                 let op: fn(u128, u128) -> (u128, bool) = match bin_op {
-                    Add => u128::overflowing_add,
-                    Sub => u128::overflowing_sub,
-                    Mul => u128::overflowing_mul,
+                    Add | AddUnchecked => u128::overflowing_add,
+                    Sub | SubUnchecked => u128::overflowing_sub,
+                    Mul | MulUnchecked => u128::overflowing_mul,
                     Div if r == 0 => throw_ub!(DivisionByZero),
                     Rem if r == 0 => throw_ub!(RemainderByZero),
                     Div => u128::overflowing_div,
@@ -279,11 +301,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 // Truncate to target type.
                 // If that truncation loses any information, we have an overflow.
                 let truncated = self.truncate(result, left_layout);
-                return Ok((
-                    Scalar::from_uint(truncated, size),
-                    oflo || truncated != result,
-                    left_layout.ty,
-                ));
+                let overflow = oflo || truncated != result;
+                if overflow && let Some(intrinsic_name) = throw_ub_on_overflow {
+                    throw_ub_custom!(fluent::const_eval_overflow, name = intrinsic_name);
+                }
+                return Ok((Scalar::from_uint(truncated, size), overflow, left_layout.ty));
             }
 
             _ => span_bug!(
diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs
index 1e60a1e72ea07..619da8abb7d22 100644
--- a/compiler/rustc_const_eval/src/interpret/step.rs
+++ b/compiler/rustc_const_eval/src/interpret/step.rs
@@ -9,27 +9,7 @@ use rustc_middle::mir::interpret::{InterpResult, Scalar};
 use rustc_middle::ty::layout::LayoutOf;
 
 use super::{ImmTy, InterpCx, Machine};
-
-/// Classify whether an operator is "left-homogeneous", i.e., the LHS has the
-/// same type as the result.
-#[inline]
-fn binop_left_homogeneous(op: mir::BinOp) -> bool {
-    use rustc_middle::mir::BinOp::*;
-    match op {
-        Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Offset | Shl | Shr => true,
-        Eq | Ne | Lt | Le | Gt | Ge => false,
-    }
-}
-/// Classify whether an operator is "right-homogeneous", i.e., the RHS has the
-/// same type as the LHS.
-#[inline]
-fn binop_right_homogeneous(op: mir::BinOp) -> bool {
-    use rustc_middle::mir::BinOp::*;
-    match op {
-        Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Eq | Ne | Lt | Le | Gt | Ge => true,
-        Offset | Shl | Shr => false,
-    }
-}
+use crate::util;
 
 impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
     /// Returns `true` as long as there are more things to do.
@@ -179,9 +159,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
             }
 
             BinaryOp(bin_op, box (ref left, ref right)) => {
-                let layout = binop_left_homogeneous(bin_op).then_some(dest.layout);
+                let layout = util::binop_left_homogeneous(bin_op).then_some(dest.layout);
                 let left = self.read_immediate(&self.eval_operand(left, layout)?)?;
-                let layout = binop_right_homogeneous(bin_op).then_some(left.layout);
+                let layout = util::binop_right_homogeneous(bin_op).then_some(left.layout);
                 let right = self.read_immediate(&self.eval_operand(right, layout)?)?;
                 self.binop_ignore_overflow(bin_op, &left, &right, &dest)?;
             }
@@ -189,7 +169,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
             CheckedBinaryOp(bin_op, box (ref left, ref right)) => {
                 // Due to the extra boolean in the result, we can never reuse the `dest.layout`.
                 let left = self.read_immediate(&self.eval_operand(left, None)?)?;
-                let layout = binop_right_homogeneous(bin_op).then_some(left.layout);
+                let layout = util::binop_right_homogeneous(bin_op).then_some(left.layout);
                 let right = self.read_immediate(&self.eval_operand(right, layout)?)?;
                 self.binop_with_overflow(bin_op, &left, &right, &dest)?;
             }
diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs
index 0e2d9ee8fb2fb..219a71fa5b5e3 100644
--- a/compiler/rustc_const_eval/src/transform/promote_consts.rs
+++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs
@@ -572,13 +572,18 @@ impl<'tcx> Validator<'_, 'tcx> {
                     | BinOp::Gt
                     | BinOp::Offset
                     | BinOp::Add
+                    | BinOp::AddUnchecked
                     | BinOp::Sub
+                    | BinOp::SubUnchecked
                     | BinOp::Mul
+                    | BinOp::MulUnchecked
                     | BinOp::BitXor
                     | BinOp::BitAnd
                     | BinOp::BitOr
                     | BinOp::Shl
-                    | BinOp::Shr => {}
+                    | BinOp::ShlUnchecked
+                    | BinOp::Shr
+                    | BinOp::ShrUnchecked => {}
                 }
 
                 self.validate_operand(lhs)?;
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs
index 3c350e25ba6ec..f197541da5bea 100644
--- a/compiler/rustc_const_eval/src/transform/validate.rs
+++ b/compiler/rustc_const_eval/src/transform/validate.rs
@@ -498,8 +498,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
 
     fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
         macro_rules! check_kinds {
-            ($t:expr, $text:literal, $($patterns:tt)*) => {
-                if !matches!(($t).kind(), $($patterns)*) {
+            ($t:expr, $text:literal, $typat:pat) => {
+                if !matches!(($t).kind(), $typat) {
                     self.fail(location, format!($text, $t));
                 }
             };
@@ -527,6 +527,25 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
                 use BinOp::*;
                 let a = vals.0.ty(&self.body.local_decls, self.tcx);
                 let b = vals.1.ty(&self.body.local_decls, self.tcx);
+                if crate::util::binop_right_homogeneous(*op) {
+                    if let Eq | Lt | Le | Ne | Ge | Gt = op {
+                        // The function pointer types can have lifetimes
+                        if !self.mir_assign_valid_types(a, b) {
+                            self.fail(
+                                location,
+                                format!("Cannot {op:?} compare incompatible types {a:?} and {b:?}"),
+                            );
+                        }
+                    } else if a != b {
+                        self.fail(
+                            location,
+                            format!(
+                                "Cannot perform binary op {op:?} on unequal types {a:?} and {b:?}"
+                            ),
+                        );
+                    }
+                }
+
                 match op {
                     Offset => {
                         check_kinds!(a, "Cannot offset non-pointer type {:?}", ty::RawPtr(..));
@@ -538,7 +557,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
                         for x in [a, b] {
                             check_kinds!(
                                 x,
-                                "Cannot compare type {:?}",
+                                "Cannot {op:?} compare type {:?}",
                                 ty::Bool
                                     | ty::Char
                                     | ty::Int(..)
@@ -548,19 +567,13 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
                                     | ty::FnPtr(..)
                             )
                         }
-                        // The function pointer types can have lifetimes
-                        if !self.mir_assign_valid_types(a, b) {
-                            self.fail(
-                                location,
-                                format!("Cannot compare unequal types {:?} and {:?}", a, b),
-                            );
-                        }
                     }
-                    Shl | Shr => {
+                    AddUnchecked | SubUnchecked | MulUnchecked | Shl | ShlUnchecked | Shr
+                    | ShrUnchecked => {
                         for x in [a, b] {
                             check_kinds!(
                                 x,
-                                "Cannot shift non-integer type {:?}",
+                                "Cannot {op:?} non-integer type {:?}",
                                 ty::Uint(..) | ty::Int(..)
                             )
                         }
@@ -569,37 +582,19 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
                         for x in [a, b] {
                             check_kinds!(
                                 x,
-                                "Cannot perform bitwise op on type {:?}",
+                                "Cannot perform bitwise op {op:?} on type {:?}",
                                 ty::Uint(..) | ty::Int(..) | ty::Bool
                             )
                         }
-                        if a != b {
-                            self.fail(
-                                location,
-                                format!(
-                                    "Cannot perform bitwise op on unequal types {:?} and {:?}",
-                                    a, b
-                                ),
-                            );
-                        }
                     }
                     Add | Sub | Mul | Div | Rem => {
                         for x in [a, b] {
                             check_kinds!(
                                 x,
-                                "Cannot perform arithmetic on type {:?}",
+                                "Cannot perform arithmetic {op:?} on type {:?}",
                                 ty::Uint(..) | ty::Int(..) | ty::Float(..)
                             )
                         }
-                        if a != b {
-                            self.fail(
-                                location,
-                                format!(
-                                    "Cannot perform arithmetic on unequal types {:?} and {:?}",
-                                    a, b
-                                ),
-                            );
-                        }
                     }
                 }
             }
diff --git a/compiler/rustc_const_eval/src/util/mod.rs b/compiler/rustc_const_eval/src/util/mod.rs
index 7641f560714d4..289e342259547 100644
--- a/compiler/rustc_const_eval/src/util/mod.rs
+++ b/compiler/rustc_const_eval/src/util/mod.rs
@@ -1,3 +1,5 @@
+use rustc_middle::mir;
+
 mod alignment;
 mod check_validity_requirement;
 mod compare_types;
@@ -7,3 +9,27 @@ pub use self::alignment::is_disaligned;
 pub use self::check_validity_requirement::check_validity_requirement;
 pub use self::compare_types::{is_equal_up_to_subtyping, is_subtype};
 pub use self::type_name::type_name;
+
+/// Classify whether an operator is "left-homogeneous", i.e., the LHS has the
+/// same type as the result.
+#[inline]
+pub(crate) fn binop_left_homogeneous(op: mir::BinOp) -> bool {
+    use rustc_middle::mir::BinOp::*;
+    match op {
+        Add | AddUnchecked | Sub | SubUnchecked | Mul | MulUnchecked | Div | Rem | BitXor
+        | BitAnd | BitOr | Offset | Shl | ShlUnchecked | Shr | ShrUnchecked => true,
+        Eq | Ne | Lt | Le | Gt | Ge => false,
+    }
+}
+
+/// Classify whether an operator is "right-homogeneous", i.e., the RHS has the
+/// same type as the LHS.
+#[inline]
+pub(crate) fn binop_right_homogeneous(op: mir::BinOp) -> bool {
+    use rustc_middle::mir::BinOp::*;
+    match op {
+        Add | AddUnchecked | Sub | SubUnchecked | Mul | MulUnchecked | Div | Rem | BitXor
+        | BitAnd | BitOr | Eq | Ne | Lt | Le | Gt | Ge => true,
+        Offset | Shl | ShlUnchecked | Shr | ShrUnchecked => false,
+    }
+}
diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs
index a9ead429f4c71..6b8293f90f10a 100644
--- a/compiler/rustc_infer/src/infer/opaque_types.rs
+++ b/compiler/rustc_infer/src/infer/opaque_types.rs
@@ -33,9 +33,6 @@ pub struct OpaqueTypeDecl<'tcx> {
     /// There can be multiple, but they are all `lub`ed together at the end
     /// to obtain the canonical hidden type.
     pub hidden_type: OpaqueHiddenType<'tcx>,
-
-    /// The origin of the opaque type.
-    pub origin: hir::OpaqueTyOrigin,
 }
 
 impl<'tcx> InferCtxt<'tcx> {
@@ -108,7 +105,7 @@ impl<'tcx> InferCtxt<'tcx> {
         let process = |a: Ty<'tcx>, b: Ty<'tcx>, a_is_expected| match *a.kind() {
             ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) if def_id.is_local() => {
                 let def_id = def_id.expect_local();
-                let origin = match self.defining_use_anchor {
+                match self.defining_use_anchor {
                     DefiningAnchor::Bind(_) => {
                         // Check that this is `impl Trait` type is
                         // declared by `parent_def_id` -- i.e., one whose
@@ -144,9 +141,11 @@ impl<'tcx> InferCtxt<'tcx> {
                         //     let x = || foo(); // returns the Opaque assoc with `foo`
                         // }
                         // ```
-                        self.opaque_type_origin(def_id)?
+                        if self.opaque_type_origin(def_id).is_none() {
+                            return None;
+                        }
                     }
-                    DefiningAnchor::Bubble => self.opaque_type_origin_unchecked(def_id),
+                    DefiningAnchor::Bubble => {}
                     DefiningAnchor::Error => return None,
                 };
                 if let ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }) = *b.kind() {
@@ -170,7 +169,6 @@ impl<'tcx> InferCtxt<'tcx> {
                     cause.clone(),
                     param_env,
                     b,
-                    origin,
                     a_is_expected,
                 ))
             }
@@ -524,72 +522,78 @@ impl<'tcx> InferCtxt<'tcx> {
         cause: ObligationCause<'tcx>,
         param_env: ty::ParamEnv<'tcx>,
         hidden_ty: Ty<'tcx>,
-        origin: hir::OpaqueTyOrigin,
         a_is_expected: bool,
     ) -> InferResult<'tcx, ()> {
+        let mut obligations = Vec::new();
+
+        self.insert_hidden_type(
+            opaque_type_key,
+            &cause,
+            param_env,
+            hidden_ty,
+            a_is_expected,
+            &mut obligations,
+        )?;
+
+        self.add_item_bounds_for_hidden_type(
+            opaque_type_key,
+            cause,
+            param_env,
+            hidden_ty,
+            &mut obligations,
+        );
+
+        Ok(InferOk { value: (), obligations })
+    }
+
+    /// Insert a hidden type into the opaque type storage, equating it
+    /// with any previous entries if necessary.
+    ///
+    /// This **does not** add the item bounds of the opaque as nested
+    /// obligations. That is only necessary when normalizing the opaque
+    /// itself, not when getting the opaque type constraints from
+    /// somewhere else.
+    pub fn insert_hidden_type(
+        &self,
+        opaque_type_key: OpaqueTypeKey<'tcx>,
+        cause: &ObligationCause<'tcx>,
+        param_env: ty::ParamEnv<'tcx>,
+        hidden_ty: Ty<'tcx>,
+        a_is_expected: bool,
+        obligations: &mut Vec<PredicateObligation<'tcx>>,
+    ) -> Result<(), TypeError<'tcx>> {
         // Ideally, we'd get the span where *this specific `ty` came
         // from*, but right now we just use the span from the overall
         // value being folded. In simple cases like `-> impl Foo`,
         // these are the same span, but not in cases like `-> (impl
         // Foo, impl Bar)`.
         let span = cause.span;
-        let mut obligations = if self.intercrate {
+        if self.intercrate {
             // During intercrate we do not define opaque types but instead always
             // force ambiguity unless the hidden type is known to not implement
             // our trait.
-            vec![traits::Obligation::new(
+            obligations.push(traits::Obligation::new(
                 self.tcx,
                 cause.clone(),
                 param_env,
                 ty::PredicateKind::Ambiguous,
-            )]
+            ))
         } else {
-            let prev = self.inner.borrow_mut().opaque_types().register(
-                opaque_type_key,
-                OpaqueHiddenType { ty: hidden_ty, span },
-                origin,
-            );
+            let prev = self
+                .inner
+                .borrow_mut()
+                .opaque_types()
+                .register(opaque_type_key, OpaqueHiddenType { ty: hidden_ty, span });
             if let Some(prev) = prev {
-                self.at(&cause, param_env)
-                    .eq_exp(DefineOpaqueTypes::Yes, a_is_expected, prev, hidden_ty)?
-                    .obligations
-            } else {
-                Vec::new()
+                obligations.extend(
+                    self.at(&cause, param_env)
+                        .eq_exp(DefineOpaqueTypes::Yes, a_is_expected, prev, hidden_ty)?
+                        .obligations,
+                );
             }
         };
 
-        self.add_item_bounds_for_hidden_type(
-            opaque_type_key,
-            cause,
-            param_env,
-            hidden_ty,
-            &mut obligations,
-        );
-
-        Ok(InferOk { value: (), obligations })
-    }
-
-    /// Registers an opaque's hidden type -- only should be used when the opaque
-    /// can be defined. For something more fallible -- checks the anchors, tries
-    /// to unify opaques in both dirs, etc. -- use `InferCtxt::handle_opaque_type`.
-    pub fn register_hidden_type_in_new_solver(
-        &self,
-        opaque_type_key: OpaqueTypeKey<'tcx>,
-        param_env: ty::ParamEnv<'tcx>,
-        hidden_ty: Ty<'tcx>,
-    ) -> InferResult<'tcx, ()> {
-        assert!(self.next_trait_solver());
-        let origin = self
-            .opaque_type_origin(opaque_type_key.def_id)
-            .expect("should be called for defining usages only");
-        self.register_hidden_type(
-            opaque_type_key,
-            ObligationCause::dummy(),
-            param_env,
-            hidden_ty,
-            origin,
-            true,
-        )
+        Ok(())
     }
 
     pub fn add_item_bounds_for_hidden_type(
diff --git a/compiler/rustc_infer/src/infer/opaque_types/table.rs b/compiler/rustc_infer/src/infer/opaque_types/table.rs
index a0f6d7ecab70f..a737761ba2282 100644
--- a/compiler/rustc_infer/src/infer/opaque_types/table.rs
+++ b/compiler/rustc_infer/src/infer/opaque_types/table.rs
@@ -1,5 +1,4 @@
 use rustc_data_structures::undo_log::UndoLogs;
-use rustc_hir::OpaqueTyOrigin;
 use rustc_middle::ty::{self, OpaqueHiddenType, OpaqueTypeKey, Ty};
 use rustc_span::DUMMY_SP;
 
@@ -60,14 +59,13 @@ impl<'a, 'tcx> OpaqueTypeTable<'a, 'tcx> {
         &mut self,
         key: OpaqueTypeKey<'tcx>,
         hidden_type: OpaqueHiddenType<'tcx>,
-        origin: OpaqueTyOrigin,
     ) -> Option<Ty<'tcx>> {
         if let Some(decl) = self.storage.opaque_types.get_mut(&key) {
             let prev = std::mem::replace(&mut decl.hidden_type, hidden_type);
             self.undo_log.push(UndoLog::OpaqueTypes(key, Some(prev)));
             return Some(prev.ty);
         }
-        let decl = OpaqueTypeDecl { hidden_type, origin };
+        let decl = OpaqueTypeDecl { hidden_type };
         self.storage.opaque_types.insert(key, decl);
         self.undo_log.push(UndoLog::OpaqueTypes(key, None));
         None
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs
index 1a65f74f4fe22..ddc9fdc9a4239 100644
--- a/compiler/rustc_middle/src/mir/syntax.rs
+++ b/compiler/rustc_middle/src/mir/syntax.rs
@@ -1267,10 +1267,16 @@ pub enum UnOp {
 pub enum BinOp {
     /// The `+` operator (addition)
     Add,
+    /// Like `Add`, but with UB on overflow.  (Integers only.)
+    AddUnchecked,
     /// The `-` operator (subtraction)
     Sub,
+    /// Like `Sub`, but with UB on overflow.  (Integers only.)
+    SubUnchecked,
     /// The `*` operator (multiplication)
     Mul,
+    /// Like `Mul`, but with UB on overflow.  (Integers only.)
+    MulUnchecked,
     /// The `/` operator (division)
     ///
     /// For integer types, division by zero is UB, as is `MIN / -1` for signed.
@@ -1296,10 +1302,17 @@ pub enum BinOp {
     ///
     /// The offset is truncated to the size of the first operand before shifting.
     Shl,
+    /// Like `Shl`, but is UB if the RHS >= LHS::BITS
+    ShlUnchecked,
     /// The `>>` operator (shift right)
     ///
     /// The offset is truncated to the size of the first operand before shifting.
+    ///
+    /// This is an arithmetic shift if the LHS is signed
+    /// and a logical shift if the LHS is unsigned.
     Shr,
+    /// Like `Shl`, but is UB if the RHS >= LHS::BITS
+    ShrUnchecked,
     /// The `==` operator (equality)
     Eq,
     /// The `<` operator (less than)
diff --git a/compiler/rustc_middle/src/mir/tcx.rs b/compiler/rustc_middle/src/mir/tcx.rs
index 5ca8241344832..4a16abdd4e38f 100644
--- a/compiler/rustc_middle/src/mir/tcx.rs
+++ b/compiler/rustc_middle/src/mir/tcx.rs
@@ -235,8 +235,11 @@ impl<'tcx> BinOp {
         // FIXME: handle SIMD correctly
         match self {
             &BinOp::Add
+            | &BinOp::AddUnchecked
             | &BinOp::Sub
+            | &BinOp::SubUnchecked
             | &BinOp::Mul
+            | &BinOp::MulUnchecked
             | &BinOp::Div
             | &BinOp::Rem
             | &BinOp::BitXor
@@ -246,7 +249,11 @@ impl<'tcx> BinOp {
                 assert_eq!(lhs_ty, rhs_ty);
                 lhs_ty
             }
-            &BinOp::Shl | &BinOp::Shr | &BinOp::Offset => {
+            &BinOp::Shl
+            | &BinOp::ShlUnchecked
+            | &BinOp::Shr
+            | &BinOp::ShrUnchecked
+            | &BinOp::Offset => {
                 lhs_ty // lhs_ty can be != rhs_ty
             }
             &BinOp::Eq | &BinOp::Lt | &BinOp::Le | &BinOp::Ne | &BinOp::Ge | &BinOp::Gt => {
@@ -293,7 +300,14 @@ impl BinOp {
             BinOp::Gt => hir::BinOpKind::Gt,
             BinOp::Le => hir::BinOpKind::Le,
             BinOp::Ge => hir::BinOpKind::Ge,
-            BinOp::Offset => unreachable!(),
+            BinOp::AddUnchecked
+            | BinOp::SubUnchecked
+            | BinOp::MulUnchecked
+            | BinOp::ShlUnchecked
+            | BinOp::ShrUnchecked
+            | BinOp::Offset => {
+                unreachable!()
+            }
         }
     }
 }
diff --git a/compiler/rustc_mir_transform/src/lower_intrinsics.rs b/compiler/rustc_mir_transform/src/lower_intrinsics.rs
index 3a7d58f712568..ce98e9b0c8432 100644
--- a/compiler/rustc_mir_transform/src/lower_intrinsics.rs
+++ b/compiler/rustc_mir_transform/src/lower_intrinsics.rs
@@ -85,8 +85,13 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
                     sym::wrapping_add
                     | sym::wrapping_sub
                     | sym::wrapping_mul
+                    | sym::unchecked_add
+                    | sym::unchecked_sub
+                    | sym::unchecked_mul
                     | sym::unchecked_div
-                    | sym::unchecked_rem => {
+                    | sym::unchecked_rem
+                    | sym::unchecked_shl
+                    | sym::unchecked_shr => {
                         let target = target.unwrap();
                         let lhs;
                         let rhs;
@@ -99,8 +104,13 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
                             sym::wrapping_add => BinOp::Add,
                             sym::wrapping_sub => BinOp::Sub,
                             sym::wrapping_mul => BinOp::Mul,
+                            sym::unchecked_add => BinOp::AddUnchecked,
+                            sym::unchecked_sub => BinOp::SubUnchecked,
+                            sym::unchecked_mul => BinOp::MulUnchecked,
                             sym::unchecked_div => BinOp::Div,
                             sym::unchecked_rem => BinOp::Rem,
+                            sym::unchecked_shl => BinOp::ShlUnchecked,
+                            sym::unchecked_shr => BinOp::ShrUnchecked,
                             _ => bug!("unexpected intrinsic"),
                         };
                         block.statements.push(Statement {
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 15c8a690530e7..ca811c9ed7d98 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -1352,6 +1352,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         macro_kind: MacroKind,
         parent_scope: &ParentScope<'a>,
         ident: Ident,
+        krate: &Crate,
     ) {
         let is_expected = &|res: Res| res.macro_kind() == Some(macro_kind);
         let suggestion = self.early_lookup_typo_candidate(
@@ -1364,13 +1365,17 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
 
         let import_suggestions =
             self.lookup_import_candidates(ident, Namespace::MacroNS, parent_scope, is_expected);
+        let (span, found_use) = match parent_scope.module.nearest_parent_mod().as_local() {
+            Some(def_id) => UsePlacementFinder::check(krate, self.def_id_to_node_id[def_id]),
+            None => (None, FoundUse::No),
+        };
         show_candidates(
             self.tcx,
             err,
-            None,
+            span,
             &import_suggestions,
             Instead::No,
-            FoundUse::Yes,
+            found_use,
             DiagnosticMode::Normal,
             vec![],
             "",
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs
index dd8d01e35e5de..db97039b907c4 100644
--- a/compiler/rustc_resolve/src/lib.rs
+++ b/compiler/rustc_resolve/src/lib.rs
@@ -1522,7 +1522,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
             self.tcx.sess.time("check_hidden_glob_reexports", || {
                 self.check_hidden_glob_reexports(exported_ambiguities)
             });
-            self.tcx.sess.time("finalize_macro_resolutions", || self.finalize_macro_resolutions());
+            self.tcx
+                .sess
+                .time("finalize_macro_resolutions", || self.finalize_macro_resolutions(krate));
             self.tcx.sess.time("late_resolve_crate", || self.late_resolve_crate(krate));
             self.tcx.sess.time("resolve_main", || self.resolve_main());
             self.tcx.sess.time("resolve_check_unused", || self.check_unused(krate));
diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs
index 805c804e5759f..ca4f3331b9a2d 100644
--- a/compiler/rustc_resolve/src/macros.rs
+++ b/compiler/rustc_resolve/src/macros.rs
@@ -7,7 +7,7 @@ use crate::{BuiltinMacroState, Determinacy};
 use crate::{DeriveData, Finalize, ParentScope, ResolutionError, Resolver, ScopeSet};
 use crate::{ModuleKind, ModuleOrUniformRoot, NameBinding, PathResult, Segment};
 use rustc_ast::expand::StrippedCfgItem;
-use rustc_ast::{self as ast, attr, Inline, ItemKind, ModKind, NodeId};
+use rustc_ast::{self as ast, attr, Crate, Inline, ItemKind, ModKind, NodeId};
 use rustc_ast_pretty::pprust;
 use rustc_attr::StabilityLevel;
 use rustc_data_structures::intern::Interned;
@@ -674,7 +674,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         res.map(|res| (self.get_macro(res).map(|macro_data| macro_data.ext), res))
     }
 
-    pub(crate) fn finalize_macro_resolutions(&mut self) {
+    pub(crate) fn finalize_macro_resolutions(&mut self, krate: &Crate) {
         let check_consistency = |this: &mut Self,
                                  path: &[Segment],
                                  span,
@@ -795,7 +795,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                     let expected = kind.descr_expected();
                     let msg = format!("cannot find {} `{}` in this scope", expected, ident);
                     let mut err = self.tcx.sess.struct_span_err(ident.span, msg);
-                    self.unresolved_macro_suggestions(&mut err, kind, &parent_scope, ident);
+                    self.unresolved_macro_suggestions(&mut err, kind, &parent_scope, ident, krate);
                     err.emit();
                 }
             }
diff --git a/compiler/rustc_smir/src/rustc_smir/mod.rs b/compiler/rustc_smir/src/rustc_smir/mod.rs
index 6d8d99cfb5f1f..10ac6fa917fa5 100644
--- a/compiler/rustc_smir/src/rustc_smir/mod.rs
+++ b/compiler/rustc_smir/src/rustc_smir/mod.rs
@@ -243,15 +243,20 @@ fn rustc_bin_op_to_bin_op(bin_op: &rustc_middle::mir::BinOp) -> stable_mir::mir:
     use rustc_middle::mir::BinOp;
     match bin_op {
         BinOp::Add => stable_mir::mir::BinOp::Add,
+        BinOp::AddUnchecked => stable_mir::mir::BinOp::AddUnchecked,
         BinOp::Sub => stable_mir::mir::BinOp::Sub,
+        BinOp::SubUnchecked => stable_mir::mir::BinOp::SubUnchecked,
         BinOp::Mul => stable_mir::mir::BinOp::Mul,
+        BinOp::MulUnchecked => stable_mir::mir::BinOp::MulUnchecked,
         BinOp::Div => stable_mir::mir::BinOp::Div,
         BinOp::Rem => stable_mir::mir::BinOp::Rem,
         BinOp::BitXor => stable_mir::mir::BinOp::BitXor,
         BinOp::BitAnd => stable_mir::mir::BinOp::BitAnd,
         BinOp::BitOr => stable_mir::mir::BinOp::BitOr,
         BinOp::Shl => stable_mir::mir::BinOp::Shl,
+        BinOp::ShlUnchecked => stable_mir::mir::BinOp::ShlUnchecked,
         BinOp::Shr => stable_mir::mir::BinOp::Shr,
+        BinOp::ShrUnchecked => stable_mir::mir::BinOp::ShrUnchecked,
         BinOp::Eq => stable_mir::mir::BinOp::Eq,
         BinOp::Lt => stable_mir::mir::BinOp::Lt,
         BinOp::Le => stable_mir::mir::BinOp::Le,
diff --git a/compiler/rustc_smir/src/stable_mir/mir/body.rs b/compiler/rustc_smir/src/stable_mir/mir/body.rs
index 9df7b4945b70a..468e915d1a073 100644
--- a/compiler/rustc_smir/src/stable_mir/mir/body.rs
+++ b/compiler/rustc_smir/src/stable_mir/mir/body.rs
@@ -88,15 +88,20 @@ pub enum AssertMessage {
 #[derive(Clone, Debug)]
 pub enum BinOp {
     Add,
+    AddUnchecked,
     Sub,
+    SubUnchecked,
     Mul,
+    MulUnchecked,
     Div,
     Rem,
     BitXor,
     BitAnd,
     BitOr,
     Shl,
+    ShlUnchecked,
     Shr,
+    ShrUnchecked,
     Eq,
     Lt,
     Le,
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs
index 3001d9f1b1f3f..e01187bcd3c2a 100644
--- a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs
+++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs
@@ -15,8 +15,8 @@ use rustc_middle::traits::solve::{
 };
 use rustc_middle::traits::DefiningAnchor;
 use rustc_middle::ty::{
-    self, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
-    TypeVisitor,
+    self, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable,
+    TypeVisitableExt, TypeVisitor,
 };
 use rustc_span::DUMMY_SP;
 use std::ops::ControlFlow;
@@ -191,16 +191,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
                 .with_opaque_type_inference(canonical_input.value.anchor)
                 .build_with_canonical(DUMMY_SP, &canonical_input);
 
-            for &(a, b) in &input.predefined_opaques_in_body.opaque_types {
-                let InferOk { value: (), obligations } = infcx
-                    .register_hidden_type_in_new_solver(a, input.goal.param_env, b)
-                    .expect("expected opaque type instantiation to succeed");
-                // We're only registering opaques already defined by the caller,
-                // so we're not responsible for proving that they satisfy their
-                // item bounds, unless we use them in a normalizes-to goal,
-                // which is handled in `EvalCtxt::unify_existing_opaque_tys`.
-                let _ = obligations;
-            }
             let mut ecx = EvalCtxt {
                 infcx,
                 var_values,
@@ -211,6 +201,15 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
                 tainted: Ok(()),
             };
 
+            for &(key, ty) in &input.predefined_opaques_in_body.opaque_types {
+                ecx.insert_hidden_type(key, input.goal.param_env, ty)
+                    .expect("failed to prepopulate opaque types");
+            }
+
+            if !ecx.nested_goals.is_empty() {
+                panic!("prepopulating opaque types shouldn't add goals: {:?}", ecx.nested_goals);
+            }
+
             let result = ecx.compute_goal(input.goal);
 
             // When creating a query response we clone the opaque type constraints
@@ -729,18 +728,42 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
         self.infcx.opaque_type_origin(def_id).is_some()
     }
 
-    pub(super) fn register_opaque_ty(
+    pub(super) fn insert_hidden_type(
         &mut self,
-        a: ty::OpaqueTypeKey<'tcx>,
-        b: Ty<'tcx>,
+        opaque_type_key: OpaqueTypeKey<'tcx>,
         param_env: ty::ParamEnv<'tcx>,
+        hidden_ty: Ty<'tcx>,
     ) -> Result<(), NoSolution> {
-        let InferOk { value: (), obligations } =
-            self.infcx.register_hidden_type_in_new_solver(a, param_env, b)?;
-        self.add_goals(obligations.into_iter().map(|obligation| obligation.into()));
+        let mut obligations = Vec::new();
+        self.infcx.insert_hidden_type(
+            opaque_type_key,
+            &ObligationCause::dummy(),
+            param_env,
+            hidden_ty,
+            true,
+            &mut obligations,
+        )?;
+        self.add_goals(obligations.into_iter().map(|o| o.into()));
         Ok(())
     }
 
+    pub(super) fn add_item_bounds_for_hidden_type(
+        &mut self,
+        opaque_type_key: OpaqueTypeKey<'tcx>,
+        param_env: ty::ParamEnv<'tcx>,
+        hidden_ty: Ty<'tcx>,
+    ) {
+        let mut obligations = Vec::new();
+        self.infcx.add_item_bounds_for_hidden_type(
+            opaque_type_key,
+            ObligationCause::dummy(),
+            param_env,
+            hidden_ty,
+            &mut obligations,
+        );
+        self.add_goals(obligations.into_iter().map(|o| o.into()));
+    }
+
     // Do something for each opaque/hidden pair defined with `def_id` in the
     // current inference context.
     pub(super) fn unify_existing_opaque_tys(
@@ -762,15 +785,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
                     ecx.eq(param_env, a, b)?;
                 }
                 ecx.eq(param_env, candidate_ty, ty)?;
-                let mut obl = vec![];
-                ecx.infcx.add_item_bounds_for_hidden_type(
-                    candidate_key,
-                    ObligationCause::dummy(),
-                    param_env,
-                    candidate_ty,
-                    &mut obl,
-                );
-                ecx.add_goals(obl.into_iter().map(Into::into));
+                ecx.add_item_bounds_for_hidden_type(candidate_key, param_env, candidate_ty);
                 ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
             }));
         }
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
index 72b3c3d01804a..851edf1fa1cb6 100644
--- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
+++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
@@ -16,7 +16,6 @@ use rustc_index::IndexVec;
 use rustc_infer::infer::canonical::query_response::make_query_region_constraints;
 use rustc_infer::infer::canonical::CanonicalVarValues;
 use rustc_infer::infer::canonical::{CanonicalExt, QueryRegionConstraints};
-use rustc_infer::infer::InferOk;
 use rustc_middle::traits::query::NoSolution;
 use rustc_middle::traits::solve::{
     ExternalConstraints, ExternalConstraintsData, MaybeCause, PredefinedOpaquesData, QueryInput,
@@ -321,12 +320,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
         param_env: ty::ParamEnv<'tcx>,
         opaque_types: &[(ty::OpaqueTypeKey<'tcx>, Ty<'tcx>)],
     ) -> Result<(), NoSolution> {
-        for &(a, b) in opaque_types {
-            let InferOk { value: (), obligations } =
-                self.infcx.register_hidden_type_in_new_solver(a, param_env, b)?;
-            // It's sound to drop these obligations, since the normalizes-to goal
-            // is responsible for proving these obligations.
-            let _ = obligations;
+        for &(key, ty) in opaque_types {
+            self.insert_hidden_type(key, param_env, ty)?;
         }
         Ok(())
     }
diff --git a/compiler/rustc_trait_selection/src/solve/opaques.rs b/compiler/rustc_trait_selection/src/solve/opaques.rs
index a5de4ddee82ba..538c16c8ce2cd 100644
--- a/compiler/rustc_trait_selection/src/solve/opaques.rs
+++ b/compiler/rustc_trait_selection/src/solve/opaques.rs
@@ -50,7 +50,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
                     }
                 }
                 // Otherwise, define a new opaque type
-                self.register_opaque_ty(opaque_ty, expected, goal.param_env)?;
+                self.insert_hidden_type(opaque_ty, goal.param_env, expected)?;
+                self.add_item_bounds_for_hidden_type(opaque_ty, goal.param_env, expected);
                 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
             }
             (Reveal::UserFacing, SolverMode::Coherence) => {
diff --git a/compiler/rustc_ty_utils/src/consts.rs b/compiler/rustc_ty_utils/src/consts.rs
index ce77df0df5dcf..387adda8f579f 100644
--- a/compiler/rustc_ty_utils/src/consts.rs
+++ b/compiler/rustc_ty_utils/src/consts.rs
@@ -78,8 +78,9 @@ pub(crate) fn destructure_const<'tcx>(
 fn check_binop(op: mir::BinOp) -> bool {
     use mir::BinOp::*;
     match op {
-        Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr | Eq | Lt | Le | Ne
-        | Ge | Gt => true,
+        Add | AddUnchecked | Sub | SubUnchecked | Mul | MulUnchecked | Div | Rem | BitXor
+        | BitAnd | BitOr | Shl | ShlUnchecked | Shr | ShrUnchecked | Eq | Lt | Le | Ne | Ge
+        | Gt => true,
         Offset => false,
     }
 }
diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js
index 270704ebffde6..416517d15f5db 100644
--- a/src/tools/rustdoc-js/tester.js
+++ b/src/tools/rustdoc-js/tester.js
@@ -22,6 +22,10 @@ function contentToDiffLine(key, value) {
     return `"${key}": "${value}",`;
 }
 
+function shouldIgnoreField(fieldName) {
+    return fieldName === "query" || fieldName === "correction";
+}
+
 // This function is only called when no matching result was found and therefore will only display
 // the diff between the two items.
 function betterLookingDiff(entry, data) {
@@ -135,6 +139,9 @@ function valueCheck(fullPath, expected, result, error_text, queryName) {
     } else if (expected !== null && typeof expected !== "undefined" &&
                expected.constructor == Object) { // eslint-disable-line eqeqeq
         for (const key in expected) {
+            if (shouldIgnoreField(key)) {
+                continue;
+            }
             if (!Object.prototype.hasOwnProperty.call(expected, key)) {
                 continue;
             }
@@ -184,6 +191,9 @@ function runSearch(query, expected, doSearch, loadedFile, queryName) {
     const error_text = [];
 
     for (const key in expected) {
+        if (shouldIgnoreField(key)) {
+            continue;
+        }
         if (!Object.prototype.hasOwnProperty.call(expected, key)) {
             continue;
         }
@@ -260,41 +270,49 @@ function checkResult(error_text, loadedFile, displaySuccess) {
     return 1;
 }
 
-function runCheck(loadedFile, key, callback) {
-    const expected = loadedFile[key];
-    const query = loadedFile.QUERY;
-
-    if (Array.isArray(query)) {
-        if (!Array.isArray(expected)) {
-            console.log("FAILED");
-            console.log(`==> If QUERY variable is an array, ${key} should be an array too`);
-            return 1;
-        } else if (query.length !== expected.length) {
-            console.log("FAILED");
-            console.log(`==> QUERY variable should have the same length as ${key}`);
-            return 1;
+function runCheckInner(callback, loadedFile, entry, getCorrections, extra) {
+    if (typeof entry.query !== "string") {
+        console.log("FAILED");
+        console.log("==> Missing `query` field");
+        return false;
+    }
+    let error_text = callback(entry.query, entry, extra ? "[ query `" + entry.query + "`]" : "");
+    if (checkResult(error_text, loadedFile, false) !== 0) {
+        return false;
+    }
+    if (entry.correction !== undefined) {
+        error_text = runCorrections(entry.query, entry.correction, getCorrections, loadedFile);
+        if (checkResult(error_text, loadedFile, false) !== 0) {
+            return false;
         }
-        for (let i = 0; i < query.length; ++i) {
-            const error_text = callback(query[i], expected[i], "[ query `" + query[i] + "`]");
-            if (checkResult(error_text, loadedFile, false) !== 0) {
+    }
+    return true;
+}
+
+function runCheck(loadedFile, key, getCorrections, callback) {
+    const expected = loadedFile[key];
+
+    if (Array.isArray(expected)) {
+        for (const entry of expected) {
+            if (!runCheckInner(callback, loadedFile, entry, getCorrections, true)) {
                 return 1;
             }
         }
-        console.log("OK");
-    } else {
-        const error_text = callback(query, expected, "");
-        if (checkResult(error_text, loadedFile, true) !== 0) {
-            return 1;
-        }
+    } else if (!runCheckInner(callback, loadedFile, expected, getCorrections, false)) {
+        return 1;
     }
+    console.log("OK");
     return 0;
 }
 
+function hasCheck(content, checkName) {
+    return content.startsWith(`const ${checkName}`) || content.includes(`\nconst ${checkName}`);
+}
+
 function runChecks(testFile, doSearch, parseQuery, getCorrections) {
     let checkExpected = false;
     let checkParsed = false;
-    let checkCorrections = false;
-    let testFileContent = readFile(testFile) + "exports.QUERY = QUERY;";
+    let testFileContent = readFile(testFile);
 
     if (testFileContent.indexOf("FILTER_CRATE") !== -1) {
         testFileContent += "exports.FILTER_CRATE = FILTER_CRATE;";
@@ -302,21 +320,17 @@ function runChecks(testFile, doSearch, parseQuery, getCorrections) {
         testFileContent += "exports.FILTER_CRATE = null;";
     }
 
-    if (testFileContent.indexOf("\nconst EXPECTED") !== -1) {
+    if (hasCheck(testFileContent, "EXPECTED")) {
         testFileContent += "exports.EXPECTED = EXPECTED;";
         checkExpected = true;
     }
-    if (testFileContent.indexOf("\nconst PARSED") !== -1) {
+    if (hasCheck(testFileContent, "PARSED")) {
         testFileContent += "exports.PARSED = PARSED;";
         checkParsed = true;
     }
-    if (testFileContent.indexOf("\nconst CORRECTIONS") !== -1) {
-        testFileContent += "exports.CORRECTIONS = CORRECTIONS;";
-        checkCorrections = true;
-    }
-    if (!checkParsed && !checkExpected && !checkCorrections) {
+    if (!checkParsed && !checkExpected) {
         console.log("FAILED");
-        console.log("==> At least `PARSED`, `EXPECTED`, or `CORRECTIONS` is needed!");
+        console.log("==> At least `PARSED` or `EXPECTED` is needed!");
         return 1;
     }
 
@@ -324,20 +338,15 @@ function runChecks(testFile, doSearch, parseQuery, getCorrections) {
     let res = 0;
 
     if (checkExpected) {
-        res += runCheck(loadedFile, "EXPECTED", (query, expected, text) => {
+        res += runCheck(loadedFile, "EXPECTED", getCorrections, (query, expected, text) => {
             return runSearch(query, expected, doSearch, loadedFile, text);
         });
     }
     if (checkParsed) {
-        res += runCheck(loadedFile, "PARSED", (query, expected, text) => {
+        res += runCheck(loadedFile, "PARSED", getCorrections, (query, expected, text) => {
             return runParser(query, expected, parseQuery, text);
         });
     }
-    if (checkCorrections) {
-        res += runCheck(loadedFile, "CORRECTIONS", (query, expected) => {
-            return runCorrections(query, expected, getCorrections, loadedFile);
-        });
-    }
     return res;
 }
 
@@ -367,8 +376,7 @@ function loadSearchJS(doc_folder, resource_suffix) {
         },
         getCorrections: function(queryStr, filterCrate, currentCrate) {
             const parsedQuery = searchModule.parseQuery(queryStr);
-            searchModule.execQuery(parsedQuery, searchWords,
-                filterCrate, currentCrate);
+            searchModule.execQuery(parsedQuery, searchWords, filterCrate, currentCrate);
             return parsedQuery.correction;
         },
         parseQuery: searchModule.parseQuery,
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
index e82e3f1881153..5d8fe44bc5964 100644
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
@@ -75,70 +75,64 @@
 +         _9 = const 65535_u32;            // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         _8 = Gt(_4, move _9);            // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         StorageDead(_9);                 // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+         switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++         switchInt(move _8) -> [0: bb2, otherwise: bb1]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
       }
   
       bb1: {
-+         StorageDead(_5);                 // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-          StorageDead(_4);                 // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
-          StorageDead(_3);                 // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
-          return;                          // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
-+     }
-+ 
-+     bb2: {
 +         _7 = Result::<u16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +                                          // mir::Constant
 +                                          // + span: no-location
 +                                          // + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
-+         goto -> bb4;                     // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++         goto -> bb3;                     // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +     }
 + 
-+     bb3: {
++     bb2: {
 +         StorageLive(_10);                // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         _10 = _4 as u16 (IntToInt);      // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         _7 = Result::<u16, TryFromIntError>::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         StorageDead(_10);                // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+         goto -> bb4;                     // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++         goto -> bb3;                     // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +     }
 + 
-+     bb4: {
++     bb3: {
 +         StorageDead(_8);                 // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         StorageLive(_12);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         _11 = discriminant(_7);          // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+         switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++         switchInt(move _11) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +     }
 + 
-+     bb5: {
++     bb4: {
 +         _6 = Option::<u16>::None;        // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+         goto -> bb8;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++         goto -> bb7;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +     }
 + 
-+     bb6: {
++     bb5: {
 +         unreachable;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +     }
 + 
-+     bb7: {
++     bb6: {
 +         _12 = move ((_7 as Ok).0: u16);  // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +         _6 = Option::<u16>::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-+         goto -> bb8;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++         goto -> bb7;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +     }
 + 
-+     bb8: {
++     bb7: {
 +         StorageDead(_12);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         StorageDead(_7);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         StorageLive(_13);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         _14 = discriminant(_6);          // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+         switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++         switchInt(move _14) -> [1: bb8, otherwise: bb5]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
 +     }
 + 
-+     bb9: {
++     bb8: {
 +         _5 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
 +         StorageDead(_13);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         StorageDead(_6);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+         _0 = unchecked_shl::<u16>(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+                                          // mir::Constant
-+                                          // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::<u16>}, val: Value(<ZST>) }
++         _0 = ShlUnchecked(_3, move _5);  // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
++         StorageDead(_5);                 // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+          StorageDead(_4);                 // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
+          StorageDead(_3);                 // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
+          return;                          // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
       }
   }
   
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
index 8fa4fdaa49aed..fd90cbd654f15 100644
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
@@ -87,7 +87,7 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
         StorageDead(_4);                 // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
         StorageLive(_8);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         _7 = discriminant(_6);           // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-        switchInt(move _7) -> [0: bb4, 1: bb5, otherwise: bb9]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+        switchInt(move _7) -> [0: bb4, 1: bb5, otherwise: bb8]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
     }
 
     bb4: {
@@ -106,25 +106,19 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
         StorageDead(_6);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         StorageLive(_12);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         _10 = discriminant(_9);          // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-        switchInt(move _10) -> [1: bb7, otherwise: bb9]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+        switchInt(move _10) -> [1: bb7, otherwise: bb8]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
     }
 
     bb7: {
         _11 = move ((_9 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
         StorageDead(_12);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         StorageDead(_9);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-        _0 = unchecked_shl::<u16>(_1, move _11) -> [return: bb8, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-                                         // mir::Constant
-                                         // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-                                         // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::<u16>}, val: Value(<ZST>) }
-    }
-
-    bb8: {
+        _0 = ShlUnchecked(_1, move _11); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         StorageDead(_11);                // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         return;                          // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
     }
 
-    bb9: {
+    bb8: {
         unreachable;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
     }
 }
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
index f20c7da4747c8..65c6db8a3c48b 100644
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
@@ -75,70 +75,64 @@
 +         _9 = const 32767_u32;            // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         _8 = Gt(_4, move _9);            // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         StorageDead(_9);                 // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+         switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++         switchInt(move _8) -> [0: bb2, otherwise: bb1]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
       }
   
       bb1: {
-+         StorageDead(_5);                 // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-          StorageDead(_4);                 // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
-          StorageDead(_3);                 // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
-          return;                          // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
-+     }
-+ 
-+     bb2: {
 +         _7 = Result::<i16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +                                          // mir::Constant
 +                                          // + span: no-location
 +                                          // + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
-+         goto -> bb4;                     // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++         goto -> bb3;                     // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +     }
 + 
-+     bb3: {
++     bb2: {
 +         StorageLive(_10);                // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         _10 = _4 as i16 (IntToInt);      // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         _7 = Result::<i16, TryFromIntError>::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         StorageDead(_10);                // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+         goto -> bb4;                     // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++         goto -> bb3;                     // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +     }
 + 
-+     bb4: {
++     bb3: {
 +         StorageDead(_8);                 // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
 +         StorageLive(_12);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         _11 = discriminant(_7);          // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+         switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++         switchInt(move _11) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +     }
 + 
-+     bb5: {
++     bb4: {
 +         _6 = Option::<i16>::None;        // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+         goto -> bb8;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++         goto -> bb7;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +     }
 + 
-+     bb6: {
++     bb5: {
 +         unreachable;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +     }
 + 
-+     bb7: {
++     bb6: {
 +         _12 = move ((_7 as Ok).0: i16);  // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +         _6 = Option::<i16>::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-+         goto -> bb8;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++         goto -> bb7;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
 +     }
 + 
-+     bb8: {
++     bb7: {
 +         StorageDead(_12);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         StorageDead(_7);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         StorageLive(_13);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         _14 = discriminant(_6);          // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+         switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++         switchInt(move _14) -> [1: bb8, otherwise: bb5]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
 +     }
 + 
-+     bb9: {
++     bb8: {
 +         _5 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
 +         StorageDead(_13);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
 +         StorageDead(_6);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+         _0 = unchecked_shr::<i16>(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+                                          // mir::Constant
-+                                          // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::<i16>}, val: Value(<ZST>) }
++         _0 = ShrUnchecked(_3, move _5);  // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
++         StorageDead(_5);                 // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
+          StorageDead(_4);                 // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
+          StorageDead(_3);                 // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
+          return;                          // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
       }
   }
   
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
index 7f737abb9360d..69543937aa606 100644
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
@@ -87,7 +87,7 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
         StorageDead(_4);                 // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
         StorageLive(_8);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         _7 = discriminant(_6);           // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-        switchInt(move _7) -> [0: bb4, 1: bb5, otherwise: bb9]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+        switchInt(move _7) -> [0: bb4, 1: bb5, otherwise: bb8]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
     }
 
     bb4: {
@@ -106,25 +106,19 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
         StorageDead(_6);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         StorageLive(_12);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         _10 = discriminant(_9);          // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-        switchInt(move _10) -> [1: bb7, otherwise: bb9]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+        switchInt(move _10) -> [1: bb7, otherwise: bb8]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
     }
 
     bb7: {
         _11 = move ((_9 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
         StorageDead(_12);                // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         StorageDead(_9);                 // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-        _0 = unchecked_shr::<i16>(_1, move _11) -> [return: bb8, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-                                         // mir::Constant
-                                         // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-                                         // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::<i16>}, val: Value(<ZST>) }
-    }
-
-    bb8: {
+        _0 = ShrUnchecked(_1, move _11); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
         StorageDead(_11);                // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
         return;                          // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
     }
 
-    bb9: {
+    bb8: {
         unreachable;                     // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
     }
 }
diff --git a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff
index 3530f4a807f2c..98cfef4442a70 100644
--- a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff
@@ -7,7 +7,7 @@
       bb0: {
 -         _0 = std::intrinsics::min_align_of::<T>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:27:5: 27:40
+-                                          // + span: $DIR/lower_intrinsics.rs:32:5: 32:40
 -                                          // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::min_align_of::<T>}, val: Value(<ZST>) }
 +         _0 = AlignOf(T);                 // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42
diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff
index 158ce62e209c2..987f927f808a5 100644
--- a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff
@@ -11,7 +11,7 @@
           StorageLive(_1);                 // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38
 -         _1 = std::intrinsics::assume(const true) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:112:9: 112:32
+-                                          // + span: $DIR/lower_intrinsics.rs:117:9: 117:32
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(bool) {std::intrinsics::assume}, val: Value(<ZST>) }
 +         assume(const true);              // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38
 +         goto -> bb1;                     // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38
diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff
index 6fc9616d85540..caf47f4c8b49e 100644
--- a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff
@@ -31,7 +31,7 @@
           _3 = &(*_4);                     // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
 -         _2 = discriminant_value::<T>(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:88:5: 88:41
+-                                          // + span: $DIR/lower_intrinsics.rs:93:5: 93:41
 -                                          // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a T) -> <T as DiscriminantKind>::Discriminant {discriminant_value::<T>}, val: Value(<ZST>) }
 +         _2 = discriminant((*_3));        // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
@@ -46,13 +46,13 @@
           StorageLive(_7);                 // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
           _19 = const _;                   // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
                                            // mir::Constant
-                                           // + span: $DIR/lower_intrinsics.rs:89:42: 89:44
+                                           // + span: $DIR/lower_intrinsics.rs:94:42: 94:44
                                            // + literal: Const { ty: &i32, val: Unevaluated(discriminant, [T], Some(promoted[2])) }
           _7 = &(*_19);                    // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
           _6 = &(*_7);                     // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
 -         _5 = discriminant_value::<i32>(move _6) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:89:5: 89:41
+-                                          // + span: $DIR/lower_intrinsics.rs:94:5: 94:41
 -                                          // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a i32) -> <i32 as DiscriminantKind>::Discriminant {discriminant_value::<i32>}, val: Value(<ZST>) }
 +         _5 = discriminant((*_6));        // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
 +         goto -> bb2;                     // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
@@ -67,13 +67,13 @@
           StorageLive(_11);                // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
           _18 = const _;                   // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
                                            // mir::Constant
-                                           // + span: $DIR/lower_intrinsics.rs:90:42: 90:45
+                                           // + span: $DIR/lower_intrinsics.rs:95:42: 95:45
                                            // + literal: Const { ty: &(), val: Unevaluated(discriminant, [T], Some(promoted[1])) }
           _11 = &(*_18);                   // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
           _10 = &(*_11);                   // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
 -         _9 = discriminant_value::<()>(move _10) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:90:5: 90:41
+-                                          // + span: $DIR/lower_intrinsics.rs:95:5: 95:41
 -                                          // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a ()) -> <() as DiscriminantKind>::Discriminant {discriminant_value::<()>}, val: Value(<ZST>) }
 +         _9 = discriminant((*_10));       // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
 +         goto -> bb3;                     // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
@@ -88,13 +88,13 @@
           StorageLive(_15);                // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
           _17 = const _;                   // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
                                            // mir::Constant
-                                           // + span: $DIR/lower_intrinsics.rs:91:42: 91:47
+                                           // + span: $DIR/lower_intrinsics.rs:96:42: 96:47
                                            // + literal: Const { ty: &E, val: Unevaluated(discriminant, [T], Some(promoted[0])) }
           _15 = &(*_17);                   // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
           _14 = &(*_15);                   // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
 -         _13 = discriminant_value::<E>(move _14) -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:91:5: 91:41
+-                                          // + span: $DIR/lower_intrinsics.rs:96:5: 96:41
 -                                          // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a E) -> <E as DiscriminantKind>::Discriminant {discriminant_value::<E>}, val: Value(<ZST>) }
 +         _13 = discriminant((*_14));      // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
 +         goto -> bb4;                     // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
index 5b870ccf5ee28..818425a306ef4 100644
--- a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
@@ -49,7 +49,7 @@
           StorageDead(_9);                 // scope 3 at $DIR/lower_intrinsics.rs:+4:90: +4:91
 -         _3 = copy_nonoverlapping::<i32>(move _4, move _8, const 0_usize) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:105:9: 105:28
+-                                          // + span: $DIR/lower_intrinsics.rs:110:9: 110:28
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, *mut i32, usize) {copy_nonoverlapping::<i32>}, val: Value(<ZST>) }
 +         copy_nonoverlapping(dst = move _8, src = move _4, count = const 0_usize); // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95
 +         goto -> bb1;                     // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95
diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff
index 582a79f48d8c8..61a0ffa7aa87c 100644
--- a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff
@@ -11,7 +11,7 @@
           _2 = move _1;                    // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
 -         _0 = std::intrinsics::forget::<T>(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:32:5: 32:29
+-                                          // + span: $DIR/lower_intrinsics.rs:37:5: 37:29
 -                                          // + literal: Const { ty: extern "rust-intrinsic" fn(T) {std::intrinsics::forget::<T>}, val: Value(<ZST>) }
 +         _0 = const ();                   // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32
diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff
index 81ad97077b428..ee06564df3dbf 100644
--- a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff
@@ -13,7 +13,7 @@
           StorageLive(_1);                 // scope 0 at $DIR/lower_intrinsics.rs:+2:9: +2:18
           _1 = std::intrinsics::size_of::<T>; // scope 0 at $DIR/lower_intrinsics.rs:+2:21: +2:51
                                            // mir::Constant
-                                           // + span: $DIR/lower_intrinsics.rs:43:21: 43:51
+                                           // + span: $DIR/lower_intrinsics.rs:48:21: 48:51
                                            // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}, val: Value(<ZST>) }
           StorageLive(_2);                 // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:14
           _2 = _1;                         // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:14
diff --git a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff
index edc66e2c75ce4..e9fb25674572c 100644
--- a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff
@@ -24,7 +24,7 @@
           _4 = &raw const (*_1);           // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56
 -         _3 = option_payload_ptr::<usize>(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:143:18: 143:54
+-                                          // + span: $DIR/lower_intrinsics.rs:148:18: 148:54
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option<usize>) -> *const usize {option_payload_ptr::<usize>}, val: Value(<ZST>) }
 +         _3 = &raw const (((*_4) as Some).0: usize); // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
 +         goto -> bb1;                     // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
@@ -37,7 +37,7 @@
           _6 = &raw const (*_2);           // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56
 -         _5 = option_payload_ptr::<String>(move _6) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:144:18: 144:54
+-                                          // + span: $DIR/lower_intrinsics.rs:149:18: 149:54
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option<String>) -> *const String {option_payload_ptr::<String>}, val: Value(<ZST>) }
 +         _5 = &raw const (((*_6) as Some).0: std::string::String); // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
 +         goto -> bb2;                     // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff
index 1760efe77d98f..03e8655ed3c32 100644
--- a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff
@@ -15,7 +15,7 @@
           _4 = _2;                         // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34
 -         _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:150:5: 150:29
+-                                          // + span: $DIR/lower_intrinsics.rs:155:5: 155:29
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, isize) -> *const i32 {offset::<*const i32, isize>}, val: Value(<ZST>) }
 +         _0 = Offset(move _3, move _4);   // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff
index 8583766348a6e..94c47bbc9d9b1 100644
--- a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff
@@ -13,7 +13,7 @@
           _2 = &raw const (*_1);           // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47
 -         _0 = read_via_copy::<i32>(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:125:14: 125:45
+-                                          // + span: $DIR/lower_intrinsics.rs:130:14: 130:45
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32) -> i32 {read_via_copy::<i32>}, val: Value(<ZST>) }
 +         _0 = (*_2);                      // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
 +         goto -> bb1;                     // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff
index f64bc9dcf620c..92fc9b23eba1d 100644
--- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff
@@ -13,7 +13,7 @@
           _2 = &raw const (*_1);           // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47
 -         _0 = read_via_copy::<Never>(move _2) -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:130:14: 130:45
+-                                          // + span: $DIR/lower_intrinsics.rs:135:14: 135:45
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Never) -> Never {read_via_copy::<Never>}, val: Value(<ZST>) }
 +         unreachable;                     // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
       }
diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs
index 30b5c78e647c8..150b13f8d90d0 100644
--- a/tests/mir-opt/lower_intrinsics.rs
+++ b/tests/mir-opt/lower_intrinsics.rs
@@ -13,8 +13,13 @@ pub fn wrapping(a: i32, b: i32) {
 
 // EMIT_MIR lower_intrinsics.unchecked.LowerIntrinsics.diff
 pub unsafe fn unchecked(a: i32, b: i32) {
+    let _a = core::intrinsics::unchecked_add(a, b);
+    let _b = core::intrinsics::unchecked_sub(a, b);
+    let _c = core::intrinsics::unchecked_mul(a, b);
     let _x = core::intrinsics::unchecked_div(a, b);
     let _y = core::intrinsics::unchecked_rem(a, b);
+    let _i = core::intrinsics::unchecked_shl(a, b);
+    let _j = core::intrinsics::unchecked_shr(a, b);
 }
 
 // EMIT_MIR lower_intrinsics.size_of.LowerIntrinsics.diff
diff --git a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff
index a880df6a5c236..2d72fd748884d 100644
--- a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff
@@ -7,7 +7,7 @@
       bb0: {
 -         _0 = std::intrinsics::size_of::<T>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:22:5: 22:35
+-                                          // + span: $DIR/lower_intrinsics.rs:27:5: 27:35
 -                                          // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}, val: Value(<ZST>) }
 +         _0 = SizeOf(T);                  // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37
diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff
index cde7c64c57a56..1e50857516ff2 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff
@@ -13,7 +13,7 @@
           _2 = _1;                         // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35
 -         _0 = transmute::<std::cmp::Ordering, i8>(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:49:14: 49:33
+-                                          // + span: $DIR/lower_intrinsics.rs:54:14: 54:33
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(std::cmp::Ordering) -> i8 {transmute::<std::cmp::Ordering, i8>}, val: Value(<ZST>) }
 +         _0 = move _2 as i8 (Transmute);  // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
 +         goto -> bb1;                     // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff
index 6fc0f3d3e3fee..096fd1b1ae5d3 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff
@@ -13,7 +13,7 @@
           _2 = _1;                         // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35
 -         _0 = transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:59:14: 59:33
+-                                          // + span: $DIR/lower_intrinsics.rs:64:14: 64:33
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&T) -> *const T {transmute::<&T, *const T>}, val: Value(<ZST>) }
 +         _0 = move _2 as *const T (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
 +         goto -> bb1;                     // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
index e6887a382a2d6..2fe254b2f2e17 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
@@ -12,7 +12,7 @@
           StorageLive(_1);                 // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
 -         _1 = transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:76:25: 76:44
+-                                          // + span: $DIR/lower_intrinsics.rs:81:25: 81:44
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> Box<Never> {transmute::<usize, Box<Never>>}, val: Value(<ZST>) }
 +         _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
index b2a44b7c56114..c7eb4a8c94ec8 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
@@ -12,7 +12,7 @@
           StorageLive(_1);                 // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
 -         _1 = transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:70:25: 70:44
+-                                          // + span: $DIR/lower_intrinsics.rs:75:25: 75:44
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &mut Never {transmute::<usize, &mut Never>}, val: Value(<ZST>) }
 +         _1 = const 1_usize as &mut Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
index c49d3aeff70b6..cf98776b66958 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
@@ -12,7 +12,7 @@
           StorageLive(_1);                 // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
 -         _1 = transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:64:21: 64:40
+-                                          // + span: $DIR/lower_intrinsics.rs:69:21: 69:40
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &Never {transmute::<usize, &Never>}, val: Value(<ZST>) }
 +         _1 = const 1_usize as &Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff
index 06759d74a3205..f9e8076979a2f 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff
@@ -13,7 +13,7 @@
           _2 = _1;                         // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48
 -         _0 = transmute::<(), Never>(move _2) -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:54:14: 54:46
+-                                          // + span: $DIR/lower_intrinsics.rs:59:14: 59:46
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(()) -> Never {transmute::<(), Never>}, val: Value(<ZST>) }
 +         _0 = move _2 as Never (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49
 +         unreachable;                     // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49
diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.diff
index 9bb43d850ebf3..ebb5b664a51e4 100644
--- a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.diff
@@ -10,11 +10,41 @@
       let mut _5: i32;                     // in scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50
       let mut _7: i32;                     // in scope 0 at $DIR/lower_intrinsics.rs:+2:46: +2:47
       let mut _8: i32;                     // in scope 0 at $DIR/lower_intrinsics.rs:+2:49: +2:50
+      let mut _10: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+3:46: +3:47
+      let mut _11: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+3:49: +3:50
+      let mut _13: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+4:46: +4:47
+      let mut _14: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+4:49: +4:50
+      let mut _16: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+5:46: +5:47
+      let mut _17: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+5:49: +5:50
+      let mut _19: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+6:46: +6:47
+      let mut _20: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+6:49: +6:50
+      let mut _22: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+7:46: +7:47
+      let mut _23: i32;                    // in scope 0 at $DIR/lower_intrinsics.rs:+7:49: +7:50
       scope 1 {
-          debug _x => _3;                  // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:11
+          debug _a => _3;                  // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:11
           let _6: i32;                     // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11
           scope 2 {
-              debug _y => _6;              // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:11
+              debug _b => _6;              // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:11
+              let _9: i32;                 // in scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11
+              scope 3 {
+                  debug _c => _9;          // in scope 3 at $DIR/lower_intrinsics.rs:+3:9: +3:11
+                  let _12: i32;            // in scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:11
+                  scope 4 {
+                      debug _x => _12;     // in scope 4 at $DIR/lower_intrinsics.rs:+4:9: +4:11
+                      let _15: i32;        // in scope 4 at $DIR/lower_intrinsics.rs:+5:9: +5:11
+                      scope 5 {
+                          debug _y => _15; // in scope 5 at $DIR/lower_intrinsics.rs:+5:9: +5:11
+                          let _18: i32;    // in scope 5 at $DIR/lower_intrinsics.rs:+6:9: +6:11
+                          scope 6 {
+                              debug _i => _18; // in scope 6 at $DIR/lower_intrinsics.rs:+6:9: +6:11
+                              let _21: i32; // in scope 6 at $DIR/lower_intrinsics.rs:+7:9: +7:11
+                              scope 7 {
+                                  debug _j => _21; // in scope 7 at $DIR/lower_intrinsics.rs:+7:9: +7:11
+                              }
+                          }
+                      }
+                  }
+              }
           }
       }
   
@@ -24,11 +54,11 @@
           _4 = _1;                         // scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47
           StorageLive(_5);                 // scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50
           _5 = _2;                         // scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50
--         _3 = unchecked_div::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:51
+-         _3 = unchecked_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:51
 -                                          // mir::Constant
 -                                          // + span: $DIR/lower_intrinsics.rs:16:14: 16:45
--                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_div::<i32>}, val: Value(<ZST>) }
-+         _3 = Div(move _4, move _5);      // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:51
+-                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_add::<i32>}, val: Value(<ZST>) }
++         _3 = AddUnchecked(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:51
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:51
       }
   
@@ -40,21 +70,106 @@
           _7 = _1;                         // scope 1 at $DIR/lower_intrinsics.rs:+2:46: +2:47
           StorageLive(_8);                 // scope 1 at $DIR/lower_intrinsics.rs:+2:49: +2:50
           _8 = _2;                         // scope 1 at $DIR/lower_intrinsics.rs:+2:49: +2:50
--         _6 = unchecked_rem::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:51
+-         _6 = unchecked_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:51
 -                                          // mir::Constant
 -                                          // + span: $DIR/lower_intrinsics.rs:17:14: 17:45
--                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_rem::<i32>}, val: Value(<ZST>) }
-+         _6 = Rem(move _7, move _8);      // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:51
+-                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_sub::<i32>}, val: Value(<ZST>) }
++         _6 = SubUnchecked(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:51
 +         goto -> bb2;                     // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:51
       }
   
       bb2: {
           StorageDead(_8);                 // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51
           StorageDead(_7);                 // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51
-          _0 = const ();                   // scope 0 at $DIR/lower_intrinsics.rs:+0:41: +3:2
-          StorageDead(_6);                 // scope 1 at $DIR/lower_intrinsics.rs:+3:1: +3:2
-          StorageDead(_3);                 // scope 0 at $DIR/lower_intrinsics.rs:+3:1: +3:2
-          return;                          // scope 0 at $DIR/lower_intrinsics.rs:+3:2: +3:2
+          StorageLive(_9);                 // scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11
+          StorageLive(_10);                // scope 2 at $DIR/lower_intrinsics.rs:+3:46: +3:47
+          _10 = _1;                        // scope 2 at $DIR/lower_intrinsics.rs:+3:46: +3:47
+          StorageLive(_11);                // scope 2 at $DIR/lower_intrinsics.rs:+3:49: +3:50
+          _11 = _2;                        // scope 2 at $DIR/lower_intrinsics.rs:+3:49: +3:50
+-         _9 = unchecked_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:51
+-                                          // mir::Constant
+-                                          // + span: $DIR/lower_intrinsics.rs:18:14: 18:45
+-                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_mul::<i32>}, val: Value(<ZST>) }
++         _9 = MulUnchecked(move _10, move _11); // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:51
++         goto -> bb3;                     // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:51
+      }
+  
+      bb3: {
+          StorageDead(_11);                // scope 2 at $DIR/lower_intrinsics.rs:+3:50: +3:51
+          StorageDead(_10);                // scope 2 at $DIR/lower_intrinsics.rs:+3:50: +3:51
+          StorageLive(_12);                // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:11
+          StorageLive(_13);                // scope 3 at $DIR/lower_intrinsics.rs:+4:46: +4:47
+          _13 = _1;                        // scope 3 at $DIR/lower_intrinsics.rs:+4:46: +4:47
+          StorageLive(_14);                // scope 3 at $DIR/lower_intrinsics.rs:+4:49: +4:50
+          _14 = _2;                        // scope 3 at $DIR/lower_intrinsics.rs:+4:49: +4:50
+-         _12 = unchecked_div::<i32>(move _13, move _14) -> [return: bb4, unwind unreachable]; // scope 3 at $DIR/lower_intrinsics.rs:+4:14: +4:51
+-                                          // mir::Constant
+-                                          // + span: $DIR/lower_intrinsics.rs:19:14: 19:45
+-                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_div::<i32>}, val: Value(<ZST>) }
++         _12 = Div(move _13, move _14);   // scope 3 at $DIR/lower_intrinsics.rs:+4:14: +4:51
++         goto -> bb4;                     // scope 3 at $DIR/lower_intrinsics.rs:+4:14: +4:51
+      }
+  
+      bb4: {
+          StorageDead(_14);                // scope 3 at $DIR/lower_intrinsics.rs:+4:50: +4:51
+          StorageDead(_13);                // scope 3 at $DIR/lower_intrinsics.rs:+4:50: +4:51
+          StorageLive(_15);                // scope 4 at $DIR/lower_intrinsics.rs:+5:9: +5:11
+          StorageLive(_16);                // scope 4 at $DIR/lower_intrinsics.rs:+5:46: +5:47
+          _16 = _1;                        // scope 4 at $DIR/lower_intrinsics.rs:+5:46: +5:47
+          StorageLive(_17);                // scope 4 at $DIR/lower_intrinsics.rs:+5:49: +5:50
+          _17 = _2;                        // scope 4 at $DIR/lower_intrinsics.rs:+5:49: +5:50
+-         _15 = unchecked_rem::<i32>(move _16, move _17) -> [return: bb5, unwind unreachable]; // scope 4 at $DIR/lower_intrinsics.rs:+5:14: +5:51
+-                                          // mir::Constant
+-                                          // + span: $DIR/lower_intrinsics.rs:20:14: 20:45
+-                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_rem::<i32>}, val: Value(<ZST>) }
++         _15 = Rem(move _16, move _17);   // scope 4 at $DIR/lower_intrinsics.rs:+5:14: +5:51
++         goto -> bb5;                     // scope 4 at $DIR/lower_intrinsics.rs:+5:14: +5:51
+      }
+  
+      bb5: {
+          StorageDead(_17);                // scope 4 at $DIR/lower_intrinsics.rs:+5:50: +5:51
+          StorageDead(_16);                // scope 4 at $DIR/lower_intrinsics.rs:+5:50: +5:51
+          StorageLive(_18);                // scope 5 at $DIR/lower_intrinsics.rs:+6:9: +6:11
+          StorageLive(_19);                // scope 5 at $DIR/lower_intrinsics.rs:+6:46: +6:47
+          _19 = _1;                        // scope 5 at $DIR/lower_intrinsics.rs:+6:46: +6:47
+          StorageLive(_20);                // scope 5 at $DIR/lower_intrinsics.rs:+6:49: +6:50
+          _20 = _2;                        // scope 5 at $DIR/lower_intrinsics.rs:+6:49: +6:50
+-         _18 = unchecked_shl::<i32>(move _19, move _20) -> [return: bb6, unwind unreachable]; // scope 5 at $DIR/lower_intrinsics.rs:+6:14: +6:51
+-                                          // mir::Constant
+-                                          // + span: $DIR/lower_intrinsics.rs:21:14: 21:45
+-                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_shl::<i32>}, val: Value(<ZST>) }
++         _18 = ShlUnchecked(move _19, move _20); // scope 5 at $DIR/lower_intrinsics.rs:+6:14: +6:51
++         goto -> bb6;                     // scope 5 at $DIR/lower_intrinsics.rs:+6:14: +6:51
+      }
+  
+      bb6: {
+          StorageDead(_20);                // scope 5 at $DIR/lower_intrinsics.rs:+6:50: +6:51
+          StorageDead(_19);                // scope 5 at $DIR/lower_intrinsics.rs:+6:50: +6:51
+          StorageLive(_21);                // scope 6 at $DIR/lower_intrinsics.rs:+7:9: +7:11
+          StorageLive(_22);                // scope 6 at $DIR/lower_intrinsics.rs:+7:46: +7:47
+          _22 = _1;                        // scope 6 at $DIR/lower_intrinsics.rs:+7:46: +7:47
+          StorageLive(_23);                // scope 6 at $DIR/lower_intrinsics.rs:+7:49: +7:50
+          _23 = _2;                        // scope 6 at $DIR/lower_intrinsics.rs:+7:49: +7:50
+-         _21 = unchecked_shr::<i32>(move _22, move _23) -> [return: bb7, unwind unreachable]; // scope 6 at $DIR/lower_intrinsics.rs:+7:14: +7:51
+-                                          // mir::Constant
+-                                          // + span: $DIR/lower_intrinsics.rs:22:14: 22:45
+-                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_shr::<i32>}, val: Value(<ZST>) }
++         _21 = ShrUnchecked(move _22, move _23); // scope 6 at $DIR/lower_intrinsics.rs:+7:14: +7:51
++         goto -> bb7;                     // scope 6 at $DIR/lower_intrinsics.rs:+7:14: +7:51
+      }
+  
+      bb7: {
+          StorageDead(_23);                // scope 6 at $DIR/lower_intrinsics.rs:+7:50: +7:51
+          StorageDead(_22);                // scope 6 at $DIR/lower_intrinsics.rs:+7:50: +7:51
+          _0 = const ();                   // scope 0 at $DIR/lower_intrinsics.rs:+0:41: +8:2
+          StorageDead(_21);                // scope 6 at $DIR/lower_intrinsics.rs:+8:1: +8:2
+          StorageDead(_18);                // scope 5 at $DIR/lower_intrinsics.rs:+8:1: +8:2
+          StorageDead(_15);                // scope 4 at $DIR/lower_intrinsics.rs:+8:1: +8:2
+          StorageDead(_12);                // scope 3 at $DIR/lower_intrinsics.rs:+8:1: +8:2
+          StorageDead(_9);                 // scope 2 at $DIR/lower_intrinsics.rs:+8:1: +8:2
+          StorageDead(_6);                 // scope 1 at $DIR/lower_intrinsics.rs:+8:1: +8:2
+          StorageDead(_3);                 // scope 0 at $DIR/lower_intrinsics.rs:+8:1: +8:2
+          return;                          // scope 0 at $DIR/lower_intrinsics.rs:+8:2: +8:2
       }
   }
   
diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff
index 83c9c508bc0b0..74e889d28fa0b 100644
--- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff
@@ -13,7 +13,7 @@
           StorageLive(_2);                 // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
 -         _2 = std::intrinsics::unreachable() -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:37:14: 37:43
+-                                          // + span: $DIR/lower_intrinsics.rs:42:14: 42:43
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value(<ZST>) }
 +         unreachable;                     // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
       }
diff --git a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff
index 4ae4466a60038..f802d567efa56 100644
--- a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff
@@ -32,7 +32,7 @@
           _5 = _2;                         // scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54
 -         _3 = add_with_overflow::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:118:14: 118:49
+-                                          // + span: $DIR/lower_intrinsics.rs:123:14: 123:49
 -                                          // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {add_with_overflow::<i32>}, val: Value(<ZST>) }
 +         _3 = CheckedAdd(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55
 +         goto -> bb1;                     // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55
@@ -48,7 +48,7 @@
           _8 = _2;                         // scope 1 at $DIR/lower_intrinsics.rs:+2:53: +2:54
 -         _6 = sub_with_overflow::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:119:14: 119:49
+-                                          // + span: $DIR/lower_intrinsics.rs:124:14: 124:49
 -                                          // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {sub_with_overflow::<i32>}, val: Value(<ZST>) }
 +         _6 = CheckedSub(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55
 +         goto -> bb2;                     // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55
@@ -64,7 +64,7 @@
           _11 = _2;                        // scope 2 at $DIR/lower_intrinsics.rs:+3:53: +3:54
 -         _9 = mul_with_overflow::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:120:14: 120:49
+-                                          // + span: $DIR/lower_intrinsics.rs:125:14: 125:49
 -                                          // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {mul_with_overflow::<i32>}, val: Value(<ZST>) }
 +         _9 = CheckedMul(move _10, move _11); // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55
 +         goto -> bb3;                     // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55
diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
index 2eabd7f626b69..39dd3037bf663 100644
--- a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
@@ -17,7 +17,7 @@
           _4 = move _2;                    // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51
 -         _0 = write_via_move::<String>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
 -                                          // mir::Constant
--                                          // + span: $DIR/lower_intrinsics.rs:135:14: 135:46
+-                                          // + span: $DIR/lower_intrinsics.rs:140:14: 140:46
 -                                          // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*mut String, String) {write_via_move::<String>}, val: Value(<ZST>) }
 +         (*_3) = move _4;                 // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
 +         goto -> bb1;                     // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir
index dff3cbbe76d22..7161fe9bfdc5b 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir
@@ -7,10 +7,9 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
     scope 1 (inlined core::num::<impl u32>::checked_shl) { // at $DIR/checked_ops.rs:16:7: 16:23
         debug self => _1;                // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         debug rhs => _2;                 // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-        let mut _11: u32;                // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-        let mut _12: bool;               // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        let mut _11: bool;               // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         scope 2 {
-            debug a => _11;              // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+            debug a => _9;               // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
             debug b => _10;              // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         }
         scope 3 (inlined core::num::<impl u32>::overflowing_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
@@ -55,7 +54,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
                                     }
                                     scope 16 (inlined #[track_caller] Option::<u32>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
                                         debug self => _7; // in scope 16 at $SRC_DIR/core/src/option.rs:LL:COL
-                                        let mut _13: &std::option::Option<u32>; // in scope 16 at $SRC_DIR/core/src/option.rs:LL:COL
+                                        let mut _12: &std::option::Option<u32>; // in scope 16 at $SRC_DIR/core/src/option.rs:LL:COL
                                         scope 17 {
                                             debug val => _8; // in scope 17 at $SRC_DIR/core/src/option.rs:LL:COL
                                         }
@@ -68,7 +67,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
                                             }
                                         }
                                         scope 19 (inlined Option::<u32>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
-                                            debug self => _13; // in scope 19 at $SRC_DIR/core/src/option.rs:LL:COL
+                                            debug self => _12; // in scope 19 at $SRC_DIR/core/src/option.rs:LL:COL
                                         }
                                     }
                                 }
@@ -81,9 +80,8 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
     }
 
     bb0: {
+        StorageLive(_9);                 // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
         StorageLive(_10);                // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
-        StorageLive(_11);                // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
-        StorageLive(_9);                 // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         StorageLive(_4);                 // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         StorageLive(_3);                 // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         _3 = const 31_u32;               // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
@@ -98,47 +96,39 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
         _7 = Option::<u32>::Some(move _6); // scope 15 at $SRC_DIR/core/src/result.rs:LL:COL
         StorageDead(_6);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         StorageDead(_5);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-        StorageLive(_13);                // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        StorageLive(_12);                // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         _8 = move ((_7 as Some).0: u32); // scope 16 at $SRC_DIR/core/src/option.rs:LL:COL
-        StorageDead(_13);                // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        StorageDead(_12);                // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
         StorageDead(_7);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-        _9 = unchecked_shl::<u32>(_1, move _8) -> [return: bb1, unwind unreachable]; // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-                                         // mir::Constant
-                                         // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-                                         // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32, u32) -> u32 {unchecked_shl::<u32>}, val: Value(<ZST>) }
-    }
-
-    bb1: {
+        _9 = ShlUnchecked(_1, move _8);  // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         StorageDead(_8);                 // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         StorageDead(_4);                 // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         _10 = Ge(_2, const _);           // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-        _11 = move _9;                   // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-        StorageDead(_9);                 // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-        StorageLive(_12);                // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-        _12 = unlikely(_10) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        StorageLive(_11);                // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        _11 = unlikely(_10) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
                                          // mir::Constant
                                          // + span: $SRC_DIR/core/src/num/mod.rs:LL:COL
                                          // + literal: Const { ty: extern "rust-intrinsic" fn(bool) -> bool {unlikely}, val: Value(<ZST>) }
     }
 
-    bb2: {
-        switchInt(move _12) -> [0: bb3, otherwise: bb4]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+    bb1: {
+        switchInt(move _11) -> [0: bb2, otherwise: bb3]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
     }
 
-    bb3: {
-        _0 = Option::<u32>::Some(_11);   // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-        goto -> bb5;                     // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+    bb2: {
+        _0 = Option::<u32>::Some(_9);    // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        goto -> bb4;                     // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
     }
 
-    bb4: {
+    bb3: {
         _0 = Option::<u32>::None;        // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-        goto -> bb5;                     // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        goto -> bb4;                     // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
     }
 
-    bb5: {
-        StorageDead(_12);                // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-        StorageDead(_11);                // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
+    bb4: {
+        StorageDead(_11);                // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
         StorageDead(_10);                // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
+        StorageDead(_9);                 // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
         return;                          // scope 0 at $DIR/checked_ops.rs:+2:2: +2:2
     }
 }
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir
index 727ccc1de5350..d8d6958850eda 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir
@@ -10,18 +10,17 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
         debug self => _1;                // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         let mut _5: *mut [u32];          // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
-        let mut _14: *mut [u32];         // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        let mut _13: *mut [u32];         // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         scope 2 {
             scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
                 debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
                 debug slice => _5;       // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
                 let mut _7: *mut u32;    // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
                 let mut _8: *mut u32;    // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-                let mut _9: usize;       // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+                let _15: usize;          // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
                 let _16: usize;          // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-                let _17: usize;          // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
                 scope 4 {
-                    debug this => std::ops::Range<usize>{ .0 => _16, .1 => _17, }; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+                    debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, }; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
                     scope 5 {
                         let _6: usize;   // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
                         scope 6 {
@@ -37,30 +36,30 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
                             }
                             scope 14 (inlined slice_from_raw_parts_mut::<u32>) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
                                 debug data => _8; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-                                debug len => _9; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-                                let mut _10: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+                                debug len => _6; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+                                let mut _9: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
                                 scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
                                     debug self => _8; // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
                                 }
                                 scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-                                    debug data_address => _10; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-                                    debug metadata => _9; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-                                    let mut _11: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-                                    let mut _12: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-                                    let mut _13: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+                                    debug data_address => _9; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+                                    debug metadata => _6; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+                                    let mut _10: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+                                    let mut _11: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+                                    let mut _12: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
                                     scope 17 {
                                     }
                                 }
                             }
                         }
                         scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
-                            debug this => std::ops::Range<usize>{ .0 => _16, .1 => _17, }; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                            debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, }; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
                             debug slice => _5; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
                             scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
                                 debug self => _5; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-                                let mut _15: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                let mut _14: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
                                 scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-                                    debug ptr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+                                    debug ptr => _14; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
                                     scope 10 {
                                     }
                                 }
@@ -75,49 +74,40 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
     bb0: {
         _3 = move (_2.0: usize);         // scope 0 at $DIR/slice_index.rs:+1:29: +1:34
         _4 = move (_2.1: usize);         // scope 0 at $DIR/slice_index.rs:+1:29: +1:34
-        StorageLive(_14);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_13);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         StorageLive(_5);                 // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         _5 = &raw mut (*_1);             // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_6);                 // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_14);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         StorageLive(_15);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         StorageLive(_16);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
-        StorageLive(_17);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
-        StorageLive(_6);                 // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-        _6 = unchecked_sub::<usize>(_4, _3) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-                                         // mir::Constant
-                                         // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL
-                                         // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize, usize) -> usize {unchecked_sub::<usize>}, val: Value(<ZST>) }
-    }
-
-    bb1: {
+        _6 = SubUnchecked(_4, _3);       // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         StorageLive(_8);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         StorageLive(_7);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         _7 = _5 as *mut u32 (PtrToPtr);  // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
         _8 = Offset(_7, _3);             // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
         StorageDead(_7);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-        StorageLive(_9);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-        _9 = _6;                         // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-        StorageLive(_10);                // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-        _10 = _8 as *mut () (PtrToPtr);  // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageLive(_13);                // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+        StorageLive(_9);                 // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+        _9 = _8 as *mut () (PtrToPtr);   // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
         StorageLive(_12);                // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
         StorageLive(_11);                // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-        _11 = _10 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-        _12 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _11, metadata: _9 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+        StorageLive(_10);                // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+        _10 = _9 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+        _11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+        StorageDead(_10);                // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+        _12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
         StorageDead(_11);                // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-        _13 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _12 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-        StorageDead(_12);                // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-        _14 = (_13.1: *mut [u32]);       // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-        StorageDead(_13);                // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
-        StorageDead(_10);                // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-        StorageDead(_9);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+        _13 = (_12.1: *mut [u32]);       // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+        StorageDead(_12);                // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+        StorageDead(_9);                 // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
         StorageDead(_8);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-        StorageDead(_6);                 // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
-        StorageDead(_17);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         StorageDead(_16);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         StorageDead(_15);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageDead(_14);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageDead(_6);                 // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         StorageDead(_5);                 // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
-        _0 = &mut (*_14);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
-        StorageDead(_14);                // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _0 = &mut (*_13);                // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageDead(_13);                // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
         return;                          // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
     }
 }
diff --git a/tests/rustdoc-js-std/alias-1.js b/tests/rustdoc-js-std/alias-1.js
index 7c6327fcdd7ca..b27b3da217966 100644
--- a/tests/rustdoc-js-std/alias-1.js
+++ b/tests/rustdoc-js-std/alias-1.js
@@ -1,6 +1,5 @@
-const QUERY = '&';
-
 const EXPECTED = {
+    'query': '&',
     'others': [
         { 'path': 'std', 'name': 'reference' },
     ],
diff --git a/tests/rustdoc-js-std/alias-2.js b/tests/rustdoc-js-std/alias-2.js
index 798fa29efbd2d..5735b573bcbda 100644
--- a/tests/rustdoc-js-std/alias-2.js
+++ b/tests/rustdoc-js-std/alias-2.js
@@ -1,6 +1,5 @@
-const QUERY = '+';
-
 const EXPECTED = {
+    'query': '+',
     'others': [
         { 'path': 'std::ops', 'name': 'AddAssign' },
         { 'path': 'std::ops', 'name': 'Add' },
diff --git a/tests/rustdoc-js-std/alias-3.js b/tests/rustdoc-js-std/alias-3.js
index 392b1e8183786..ed3776b3c2ae0 100644
--- a/tests/rustdoc-js-std/alias-3.js
+++ b/tests/rustdoc-js-std/alias-3.js
@@ -1,6 +1,5 @@
-const QUERY = '!';
-
 const EXPECTED = {
+    'query': '!',
     'others': [
         { 'path': 'std', 'name': 'never' },
     ],
diff --git a/tests/rustdoc-js-std/alias-4.js b/tests/rustdoc-js-std/alias-4.js
index bf2bb4d2981fc..35840a472c10b 100644
--- a/tests/rustdoc-js-std/alias-4.js
+++ b/tests/rustdoc-js-std/alias-4.js
@@ -1,6 +1,5 @@
-const QUERY = '<';
-
 const EXPECTED = {
+    'query': '<',
     'others': [
         { 'name': 'Ord' },
     ],
diff --git a/tests/rustdoc-js-std/alias.js b/tests/rustdoc-js-std/alias.js
index 2b709c99119ae..bf707fa03dc2a 100644
--- a/tests/rustdoc-js-std/alias.js
+++ b/tests/rustdoc-js-std/alias.js
@@ -1,8 +1,7 @@
 // ignore-order
 
-const QUERY = '[';
-
 const EXPECTED = {
+    'query': '[',
     'others': [
         { 'path': 'std', 'name': 'slice' },
         { 'path': 'std::ops', 'name': 'IndexMut' },
diff --git a/tests/rustdoc-js-std/asrawfd.js b/tests/rustdoc-js-std/asrawfd.js
index 369a34f9c6eb7..5b3cfeabbcdd2 100644
--- a/tests/rustdoc-js-std/asrawfd.js
+++ b/tests/rustdoc-js-std/asrawfd.js
@@ -1,8 +1,7 @@
 // ignore-order
 
-const QUERY = 'RawFd::as_raw_fd';
-
 const EXPECTED = {
+    'query': 'RawFd::as_raw_fd',
     'others': [
         // Reproduction test for https://github.com/rust-lang/rust/issues/78724
         // Validate that type alias methods get the correct path.
diff --git a/tests/rustdoc-js-std/basic.js b/tests/rustdoc-js-std/basic.js
index 824cac7108332..baff24b0af699 100644
--- a/tests/rustdoc-js-std/basic.js
+++ b/tests/rustdoc-js-std/basic.js
@@ -1,6 +1,5 @@
-const QUERY = 'String';
-
 const EXPECTED = {
+    'query': 'String',
     'others': [
         { 'path': 'std::string', 'name': 'String' },
         { 'path': 'std::ffi', 'name': 'CString' },
diff --git a/tests/rustdoc-js-std/deduplication.js b/tests/rustdoc-js-std/deduplication.js
index f02f6cf55ed21..51279dd5ed467 100644
--- a/tests/rustdoc-js-std/deduplication.js
+++ b/tests/rustdoc-js-std/deduplication.js
@@ -1,8 +1,7 @@
 // ignore-order
 
-const QUERY = 'is_nan';
-
 const EXPECTED = {
+    'query': 'is_nan',
     'others': [
         { 'path': 'std::f32', 'name': 'is_nan' },
         { 'path': 'std::f64', 'name': 'is_nan' },
diff --git a/tests/rustdoc-js-std/enum-option.js b/tests/rustdoc-js-std/enum-option.js
index 902e09069108d..216dafe3b129e 100644
--- a/tests/rustdoc-js-std/enum-option.js
+++ b/tests/rustdoc-js-std/enum-option.js
@@ -1,6 +1,5 @@
-const QUERY = 'enum:Option';
-
 const EXPECTED = {
+    'query': 'enum:Option',
     'others': [
         { 'path': 'std::option', 'name': 'Option' },
     ],
diff --git a/tests/rustdoc-js-std/filter-crate.js b/tests/rustdoc-js-std/filter-crate.js
index b47a1fefa41d0..95f2969d29924 100644
--- a/tests/rustdoc-js-std/filter-crate.js
+++ b/tests/rustdoc-js-std/filter-crate.js
@@ -1,9 +1,9 @@
 // exact-check
 
-const QUERY = '"hashmap"';
 const FILTER_CRATE = 'core';
 
 const EXPECTED = {
+    'query': 'hashmap',
     'others': [
     ],
 };
diff --git a/tests/rustdoc-js-std/fn-forget.js b/tests/rustdoc-js-std/fn-forget.js
index 66a5fcaa7813d..addecf4e44fe4 100644
--- a/tests/rustdoc-js-std/fn-forget.js
+++ b/tests/rustdoc-js-std/fn-forget.js
@@ -1,6 +1,5 @@
-const QUERY = 'fn:forget';
-
 const EXPECTED = {
+    'query': 'fn:forget',
     'others': [
         { 'path': 'std::mem', 'name': 'forget' },
         { 'path': 'std::fmt', 'name': 'format' },
diff --git a/tests/rustdoc-js-std/from_u.js b/tests/rustdoc-js-std/from_u.js
index e3f3cd436aa6a..7c9375ba529a8 100644
--- a/tests/rustdoc-js-std/from_u.js
+++ b/tests/rustdoc-js-std/from_u.js
@@ -1,6 +1,5 @@
-const QUERY = 'from_u';
-
 const EXPECTED = {
+    'query': 'from_u',
     'others': [
         { 'path': 'std::char', 'name': 'from_u32' },
         { 'path': 'std::str', 'name': 'from_utf8' },
diff --git a/tests/rustdoc-js-std/keyword.js b/tests/rustdoc-js-std/keyword.js
index 868ddd7b6dceb..b85ba34138bae 100644
--- a/tests/rustdoc-js-std/keyword.js
+++ b/tests/rustdoc-js-std/keyword.js
@@ -1,8 +1,7 @@
 // ignore-order
 
-const QUERY = 'fn';
-
 const EXPECTED = {
+    'query': 'fn',
     'others': [
         { 'path': 'std', 'name': 'fn', ty: 15 }, // 15 is for primitive types
         { 'path': 'std', 'name': 'fn', ty: 21 }, // 21 is for keywords
diff --git a/tests/rustdoc-js-std/macro-check.js b/tests/rustdoc-js-std/macro-check.js
index 242e0cbf5f4de..c22b1753fd71b 100644
--- a/tests/rustdoc-js-std/macro-check.js
+++ b/tests/rustdoc-js-std/macro-check.js
@@ -1,8 +1,7 @@
 // ignore-order
 
-const QUERY = 'panic';
-
 const EXPECTED = {
+    'query': 'panic',
     'others': [
         { 'path': 'std', 'name': 'panic', ty: 14 }, // 15 is for macros
         { 'path': 'std', 'name': 'panic', ty: 0 }, // 0 is for modules
diff --git a/tests/rustdoc-js-std/macro-print.js b/tests/rustdoc-js-std/macro-print.js
index 1b4c7b4057020..2ef1c89e49b0f 100644
--- a/tests/rustdoc-js-std/macro-print.js
+++ b/tests/rustdoc-js-std/macro-print.js
@@ -1,6 +1,5 @@
-const QUERY = 'macro:print';
-
 const EXPECTED = {
+    'query': 'macro:print',
     'others': [
         { 'path': 'std', 'name': 'print' },
         { 'path': 'std', 'name': 'println' },
diff --git a/tests/rustdoc-js-std/never.js b/tests/rustdoc-js-std/never.js
index 392b1e8183786..ed3776b3c2ae0 100644
--- a/tests/rustdoc-js-std/never.js
+++ b/tests/rustdoc-js-std/never.js
@@ -1,6 +1,5 @@
-const QUERY = '!';
-
 const EXPECTED = {
+    'query': '!',
     'others': [
         { 'path': 'std', 'name': 'never' },
     ],
diff --git a/tests/rustdoc-js-std/option-type-signatures.js b/tests/rustdoc-js-std/option-type-signatures.js
index 6bf421a213560..8f6b0450dd319 100644
--- a/tests/rustdoc-js-std/option-type-signatures.js
+++ b/tests/rustdoc-js-std/option-type-signatures.js
@@ -1,15 +1,12 @@
-const QUERY = [
-    'option, fnonce -> option',
-    'option -> default',
-];
-
 const EXPECTED = [
     {
+        'query': 'option, fnonce -> option',
         'others': [
             { 'path': 'std::option::Option', 'name': 'map' },
         ],
     },
     {
+        'query': 'option -> default',
         'others': [
             { 'path': 'std::option::Option', 'name': 'unwrap_or_default' },
             { 'path': 'std::option::Option', 'name': 'get_or_insert_default' },
diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js
index d1aa840ab08a2..aa8ee86d67247 100644
--- a/tests/rustdoc-js-std/parser-errors.js
+++ b/tests/rustdoc-js-std/parser-errors.js
@@ -1,50 +1,6 @@
-const QUERY = [
-    '<P>',
-    '-> <P>',
-    'a<"P">',
-    '"P" "P"',
-    'P "P"',
-    '"p" p',
-    '"const": p',
-    "a<:a>",
-    "a<::a>",
-    "((a))",
-    "(p -> p",
-    "::a::b",
-    "a::::b",
-    "a::b::",
-    ":a",
-    "a b:",
-    "a (b:",
-    "_:",
-    "_:a",
-    "a-bb",
-    "a>bb",
-    "ab'",
-    "a->",
-    '"p" <a>',
-    '"p" a<a>',
-    "a,<",
-    "aaaaa<>b",
-    "fn:aaaaa<>b",
-    "->a<>b",
-    "a<->",
-    "a:: a",
-    "a ::a",
-    "a<a>:",
-    "a<>:",
-    "a,:",
-    "  a<>  :",
-    "mod : :",
-    "a!a",
-    "a!!",
-    "mod:a!",
-    "a!::a",
-    "a<",
-];
-
 const PARSED = [
     {
+        query: '<P>',
         elems: [],
         foundElems: 0,
         original: "<P>",
@@ -53,6 +9,7 @@ const PARSED = [
         error: "Found generics without a path",
     },
     {
+        query: '-> <P>',
         elems: [],
         foundElems: 0,
         original: "-> <P>",
@@ -61,6 +18,7 @@ const PARSED = [
         error: "Found generics without a path",
     },
     {
+        query: 'a<"P">',
         elems: [],
         foundElems: 0,
         original: "a<\"P\">",
@@ -69,6 +27,7 @@ const PARSED = [
         error: "Unexpected `\"` in generics",
     },
     {
+        query: '"P" "P"',
         elems: [],
         foundElems: 0,
         original: "\"P\" \"P\"",
@@ -77,6 +36,7 @@ const PARSED = [
         error: "Cannot have more than one literal search element",
     },
     {
+        query: 'P "P"',
         elems: [],
         foundElems: 0,
         original: "P \"P\"",
@@ -85,6 +45,7 @@ const PARSED = [
         error: "Cannot use literal search when there is more than one element",
     },
     {
+        query: '"p" p',
         elems: [],
         foundElems: 0,
         original: "\"p\" p",
@@ -93,6 +54,7 @@ const PARSED = [
         error: "You cannot have more than one element if you use quotes",
     },
     {
+        query: '"const": p',
         elems: [],
         foundElems: 0,
         original: "\"const\": p",
@@ -101,6 +63,7 @@ const PARSED = [
         error: "You cannot use quotes on type filter",
     },
     {
+        query: "a<:a>",
         elems: [],
         foundElems: 0,
         original: "a<:a>",
@@ -109,6 +72,7 @@ const PARSED = [
         error: "Expected type filter before `:`",
     },
     {
+        query: "a<::a>",
         elems: [],
         foundElems: 0,
         original: "a<::a>",
@@ -117,6 +81,7 @@ const PARSED = [
         error: "Unexpected `::`: paths cannot start with `::`",
     },
     {
+        query: "((a))",
         elems: [],
         foundElems: 0,
         original: "((a))",
@@ -125,6 +90,7 @@ const PARSED = [
         error: "Unexpected `(`",
     },
     {
+        query: "(p -> p",
         elems: [],
         foundElems: 0,
         original: "(p -> p",
@@ -133,6 +99,7 @@ const PARSED = [
         error: "Unexpected `(`",
     },
     {
+        query: "::a::b",
         elems: [],
         foundElems: 0,
         original: "::a::b",
@@ -141,6 +108,7 @@ const PARSED = [
         error: "Paths cannot start with `::`",
     },
     {
+        query: "a::::b",
         elems: [],
         foundElems: 0,
         original: "a::::b",
@@ -149,6 +117,7 @@ const PARSED = [
         error: "Unexpected `::::`",
     },
     {
+        query: "a::b::",
         elems: [],
         foundElems: 0,
         original: "a::b::",
@@ -157,6 +126,7 @@ const PARSED = [
         error: "Paths cannot end with `::`",
     },
     {
+        query: ":a",
         elems: [],
         foundElems: 0,
         original: ":a",
@@ -165,6 +135,7 @@ const PARSED = [
         error: "Expected type filter before `:`",
     },
     {
+        query: "a b:",
         elems: [],
         foundElems: 0,
         original: "a b:",
@@ -173,6 +144,7 @@ const PARSED = [
         error: "Unexpected `:` (expected path after type filter)",
     },
     {
+        query: "a (b:",
         elems: [],
         foundElems: 0,
         original: "a (b:",
@@ -181,6 +153,7 @@ const PARSED = [
         error: "Unexpected `(`",
     },
     {
+        query: "_:",
         elems: [],
         foundElems: 0,
         original: "_:",
@@ -189,6 +162,7 @@ const PARSED = [
         error: "Unexpected `:` (expected path after type filter)",
     },
     {
+        query: "_:a",
         elems: [],
         foundElems: 0,
         original: "_:a",
@@ -197,6 +171,7 @@ const PARSED = [
         error: "Unknown type filter `_`",
     },
     {
+        query: "a-bb",
         elems: [],
         foundElems: 0,
         original: "a-bb",
@@ -205,6 +180,7 @@ const PARSED = [
         error: "Unexpected `-` (did you mean `->`?)",
     },
     {
+        query: "a>bb",
         elems: [],
         foundElems: 0,
         original: "a>bb",
@@ -213,6 +189,7 @@ const PARSED = [
         error: "Unexpected `>` (did you mean `->`?)",
     },
     {
+        query: "ab'",
         elems: [],
         foundElems: 0,
         original: "ab'",
@@ -221,6 +198,7 @@ const PARSED = [
         error: "Unexpected `'`",
     },
     {
+        query: "a->",
         elems: [],
         foundElems: 0,
         original: "a->",
@@ -229,6 +207,7 @@ const PARSED = [
         error: "Expected at least one item after `->`",
     },
     {
+        query: '"p" <a>',
         elems: [],
         foundElems: 0,
         original: '"p" <a>',
@@ -237,6 +216,7 @@ const PARSED = [
         error: "Found generics without a path",
     },
     {
+        query: '"p" a<a>',
         elems: [],
         foundElems: 0,
         original: '"p" a<a>',
@@ -245,6 +225,7 @@ const PARSED = [
         error: "You cannot have more than one element if you use quotes",
     },
     {
+        query: "a,<",
         elems: [],
         foundElems: 0,
         original: 'a,<',
@@ -253,6 +234,7 @@ const PARSED = [
         error: 'Found generics without a path',
     },
     {
+        query: "aaaaa<>b",
         elems: [],
         foundElems: 0,
         original: 'aaaaa<>b',
@@ -261,6 +243,7 @@ const PARSED = [
         error: 'Expected `,`, ` `, `:` or `->`, found `b`',
     },
     {
+        query: "fn:aaaaa<>b",
         elems: [],
         foundElems: 0,
         original: 'fn:aaaaa<>b',
@@ -269,6 +252,7 @@ const PARSED = [
         error: 'Expected `,`, ` `, `:` or `->`, found `b`',
     },
     {
+        query: "->a<>b",
         elems: [],
         foundElems: 0,
         original: '->a<>b',
@@ -277,6 +261,7 @@ const PARSED = [
         error: 'Expected `,` or ` `, found `b`',
     },
     {
+        query: "a<->",
         elems: [],
         foundElems: 0,
         original: 'a<->',
@@ -285,6 +270,7 @@ const PARSED = [
         error: 'Unexpected `-` after `<`',
     },
     {
+        query: "a:: a",
         elems: [],
         foundElems: 0,
         original: 'a:: a',
@@ -293,6 +279,7 @@ const PARSED = [
         error: 'Paths cannot end with `::`',
     },
     {
+        query: "a ::a",
         elems: [],
         foundElems: 0,
         original: 'a ::a',
@@ -301,6 +288,7 @@ const PARSED = [
         error: 'Paths cannot start with `::`',
     },
     {
+        query: "a<a>:",
         elems: [],
         foundElems: 0,
         original: "a<a>:",
@@ -309,6 +297,7 @@ const PARSED = [
         error: 'Unexpected `<` in type filter',
     },
     {
+        query: "a<>:",
         elems: [],
         foundElems: 0,
         original: "a<>:",
@@ -317,6 +306,7 @@ const PARSED = [
         error: 'Unexpected `<` in type filter',
     },
     {
+        query: "a,:",
         elems: [],
         foundElems: 0,
         original: "a,:",
@@ -325,6 +315,7 @@ const PARSED = [
         error: 'Unexpected `,` in type filter',
     },
     {
+        query: "  a<>  :",
         elems: [],
         foundElems: 0,
         original: "a<>  :",
@@ -333,6 +324,7 @@ const PARSED = [
         error: 'Unexpected `<` in type filter',
     },
     {
+        query: "mod : :",
         elems: [],
         foundElems: 0,
         original: "mod : :",
@@ -341,6 +333,7 @@ const PARSED = [
         error: 'Unexpected `:`',
     },
     {
+        query: "a!a",
         elems: [],
         foundElems: 0,
         original: "a!a",
@@ -349,6 +342,7 @@ const PARSED = [
         error: 'Unexpected `!`: it can only be at the end of an ident',
     },
     {
+        query: "a!!",
         elems: [],
         foundElems: 0,
         original: "a!!",
@@ -357,6 +351,7 @@ const PARSED = [
         error: 'Cannot have more than one `!` in an ident',
     },
     {
+        query: "mod:a!",
         elems: [],
         foundElems: 0,
         original: "mod:a!",
@@ -365,6 +360,7 @@ const PARSED = [
         error: 'Invalid search type: macro `!` and `mod` both specified',
     },
     {
+        query: "a!::a",
         elems: [],
         foundElems: 0,
         original: "a!::a",
@@ -373,6 +369,7 @@ const PARSED = [
         error: 'Cannot have associated items in macros',
     },
     {
+        query: "a<",
         elems: [],
         foundElems: 0,
         original: "a<",
diff --git a/tests/rustdoc-js-std/parser-filter.js b/tests/rustdoc-js-std/parser-filter.js
index e23447ab75dc4..6f5d66e57ba0c 100644
--- a/tests/rustdoc-js-std/parser-filter.js
+++ b/tests/rustdoc-js-std/parser-filter.js
@@ -1,17 +1,6 @@
-const QUERY = [
-    'fn:foo',
-    'enum : foo',
-    'macro<f>:foo',
-    'macro!',
-    'macro:mac!',
-    'a::mac!',
-    '-> fn:foo',
-    '-> fn:foo<fn:bar>',
-    '-> fn:foo<fn:bar, enum : baz::fuzz>',
-];
-
 const PARSED = [
     {
+        query: 'fn:foo',
         elems: [{
             name: "foo",
             fullPath: ["foo"],
@@ -27,6 +16,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'enum : foo',
         elems: [{
             name: "foo",
             fullPath: ["foo"],
@@ -42,6 +32,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'macro<f>:foo',
         elems: [],
         foundElems: 0,
         original: "macro<f>:foo",
@@ -50,6 +41,7 @@ const PARSED = [
         error: "Unexpected `<` in type filter",
     },
     {
+        query: 'macro!',
         elems: [{
             name: "macro",
             fullPath: ["macro"],
@@ -65,6 +57,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'macro:mac!',
         elems: [{
             name: "mac",
             fullPath: ["mac"],
@@ -80,6 +73,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a::mac!',
         elems: [{
             name: "a::mac",
             fullPath: ["a", "mac"],
@@ -95,6 +89,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: '-> fn:foo',
         elems: [],
         foundElems: 1,
         original: "-> fn:foo",
@@ -110,6 +105,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: '-> fn:foo<fn:bar>',
         elems: [],
         foundElems: 1,
         original: "-> fn:foo<fn:bar>",
@@ -134,6 +130,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: '-> fn:foo<fn:bar, enum : baz::fuzz>',
         elems: [],
         foundElems: 1,
         original: "-> fn:foo<fn:bar, enum : baz::fuzz>",
diff --git a/tests/rustdoc-js-std/parser-generics.js b/tests/rustdoc-js-std/parser-generics.js
index 5a2266dbe3697..eb3cf45515576 100644
--- a/tests/rustdoc-js-std/parser-generics.js
+++ b/tests/rustdoc-js-std/parser-generics.js
@@ -1,14 +1,6 @@
-const QUERY = [
-    'A<B<C<D>,  E>',
-    'p<> u8',
-    '"p"<a>',
-    'p<u<x>>',
-    'p<u<x>, r>',
-    'p<u<x, r>>',
-];
-
 const PARSED = [
     {
+        query: 'A<B<C<D>,  E>',
         elems: [],
         foundElems: 0,
         original: 'A<B<C<D>,  E>',
@@ -17,6 +9,7 @@ const PARSED = [
         error: 'Unclosed `<`',
     },
     {
+        query: 'p<> u8',
         elems: [
             {
                 name: "p",
@@ -42,6 +35,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: '"p"<a>',
         elems: [
             {
                 name: "p",
@@ -67,6 +61,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'p<u<x>>',
         elems: [
             {
                 name: "p",
@@ -100,6 +95,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'p<u<x>, r>',
         elems: [
             {
                 name: "p",
@@ -140,6 +136,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'p<u<x, r>>',
         elems: [
             {
                 name: "p",
diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js
index be42b7aa46307..d9ee5fb564b68 100644
--- a/tests/rustdoc-js-std/parser-ident.js
+++ b/tests/rustdoc-js-std/parser-ident.js
@@ -1,14 +1,6 @@
-const QUERY = [
-    "R<!>",
-    "!",
-    "a!",
-    "a!::b",
-    "!::b",
-    "a!::b!",
-];
-
 const PARSED = [
     {
+        query: "R<!>",
         elems: [{
             name: "r",
             fullPath: ["r"],
@@ -32,6 +24,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: "!",
         elems: [{
             name: "!",
             fullPath: ["!"],
@@ -47,6 +40,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: "a!",
         elems: [{
             name: "a",
             fullPath: ["a"],
@@ -62,6 +56,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: "a!::b",
         elems: [],
         foundElems: 0,
         original: "a!::b",
@@ -70,6 +65,7 @@ const PARSED = [
         error: "Cannot have associated items in macros",
     },
     {
+        query: "!::b",
         elems: [{
             name: "!::b",
             fullPath: ["!", "b"],
@@ -85,6 +81,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: "a!::b!",
         elems: [],
         foundElems: 0,
         original: "a!::b!",
diff --git a/tests/rustdoc-js-std/parser-literal.js b/tests/rustdoc-js-std/parser-literal.js
index 3a31d1bddfff5..87c06224dbf2d 100644
--- a/tests/rustdoc-js-std/parser-literal.js
+++ b/tests/rustdoc-js-std/parser-literal.js
@@ -1,7 +1,6 @@
-const QUERY = ['R<P>'];
-
 const PARSED = [
     {
+        query: 'R<P>',
         elems: [{
             name: "r",
             fullPath: ["r"],
diff --git a/tests/rustdoc-js-std/parser-paths.js b/tests/rustdoc-js-std/parser-paths.js
index f3e421f5ffa50..8d4dedf3f46c8 100644
--- a/tests/rustdoc-js-std/parser-paths.js
+++ b/tests/rustdoc-js-std/parser-paths.js
@@ -1,7 +1,6 @@
-const QUERY = ['A::B', 'A::B,C',  'A::B<f>,C', 'mod::a'];
-
 const PARSED = [
     {
+        query: 'A::B',
         elems: [{
             name: "a::b",
             fullPath: ["a", "b"],
@@ -17,6 +16,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'A::B,C',
         elems: [
             {
                 name: "a::b",
@@ -42,6 +42,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'A::B<f>,C',
         elems: [
             {
                 name: "a::b",
@@ -75,6 +76,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'mod::a',
         elems: [{
             name: "mod::a",
             fullPath: ["mod", "a"],
diff --git a/tests/rustdoc-js-std/parser-quote.js b/tests/rustdoc-js-std/parser-quote.js
index d5d67cac892f5..9d2a3620ed7a3 100644
--- a/tests/rustdoc-js-std/parser-quote.js
+++ b/tests/rustdoc-js-std/parser-quote.js
@@ -1,15 +1,6 @@
-const QUERY = [
-    '-> "p"',
-    '"p",',
-    '"p" -> a',
-    '"a" -> "p"',
-    '->"-"',
-    '"a',
-    '""',
-];
-
 const PARSED = [
     {
+        query: '-> "p"',
         elems: [],
         foundElems: 1,
         original: '-> "p"',
@@ -25,6 +16,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: '"p",',
         elems: [{
             name: "p",
             fullPath: ["p"],
@@ -40,6 +32,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: '"p" -> a',
         elems: [],
         foundElems: 0,
         original: '"p" -> a',
@@ -48,6 +41,7 @@ const PARSED = [
         error: "You cannot have more than one element if you use quotes",
     },
     {
+        query: '"a" -> "p"',
         elems: [],
         foundElems: 0,
         original: '"a" -> "p"',
@@ -56,6 +50,7 @@ const PARSED = [
         error: "Cannot have more than one literal search element",
     },
     {
+        query: '->"-"',
         elems: [],
         foundElems: 0,
         original: '->"-"',
@@ -64,6 +59,7 @@ const PARSED = [
         error: 'Unexpected `-` in a string element',
     },
     {
+        query: '"a',
         elems: [],
         foundElems: 0,
         original: '"a',
@@ -72,6 +68,7 @@ const PARSED = [
         error: 'Unclosed `"`',
     },
     {
+        query: '""',
         elems: [],
         foundElems: 0,
         original: '""',
diff --git a/tests/rustdoc-js-std/parser-returned.js b/tests/rustdoc-js-std/parser-returned.js
index c2981319055db..665e2a9b2e3d7 100644
--- a/tests/rustdoc-js-std/parser-returned.js
+++ b/tests/rustdoc-js-std/parser-returned.js
@@ -1,13 +1,6 @@
-const QUERY = [
-    "-> F<P>",
-    "-> P",
-    "->,a",
-    "aaaaa->a",
-    "-> !",
-];
-
 const PARSED = [
     {
+        query: "-> F<P>",
         elems: [],
         foundElems: 1,
         original: "-> F<P>",
@@ -31,6 +24,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: "-> P",
         elems: [],
         foundElems: 1,
         original: "-> P",
@@ -46,6 +40,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: "->,a",
         elems: [],
         foundElems: 1,
         original: "->,a",
@@ -61,6 +56,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: "aaaaa->a",
         elems: [{
             name: "aaaaa",
             fullPath: ["aaaaa"],
@@ -83,6 +79,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: "-> !",
         elems: [],
         foundElems: 1,
         original: "-> !",
diff --git a/tests/rustdoc-js-std/parser-separators.js b/tests/rustdoc-js-std/parser-separators.js
index fc8c5114c4e96..69f9ac29ad3ce 100644
--- a/tests/rustdoc-js-std/parser-separators.js
+++ b/tests/rustdoc-js-std/parser-separators.js
@@ -1,17 +1,8 @@
 // ignore-tidy-tab
 
-const QUERY = [
-    'aaaaaa	b',
-    'a b',
-    'a,b',
-    'a\tb',
-    'a<b c>',
-    'a<b,c>',
-    'a<b\tc>',
-];
-
 const PARSED = [
     {
+        query: 'aaaaaa	b',
         elems: [
             {
                 name: 'aaaaaa',
@@ -37,6 +28,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a b',
         elems: [
             {
                 name: 'a',
@@ -62,6 +54,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a,b',
         elems: [
             {
                 name: 'a',
@@ -87,6 +80,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a\tb',
         elems: [
             {
                 name: 'a',
@@ -112,6 +106,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a<b c>',
         elems: [
             {
                 name: 'a',
@@ -144,6 +139,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a<b,c>',
         elems: [
             {
                 name: 'a',
@@ -176,6 +172,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a<b\tc>',
         elems: [
             {
                 name: 'a',
diff --git a/tests/rustdoc-js-std/parser-weird-queries.js b/tests/rustdoc-js-std/parser-weird-queries.js
index dc1049a70bc38..0e08eaf73c876 100644
--- a/tests/rustdoc-js-std/parser-weird-queries.js
+++ b/tests/rustdoc-js-std/parser-weird-queries.js
@@ -1,18 +1,10 @@
 // This test is mostly to check that the parser still kinda outputs something
 // (and doesn't enter an infinite loop!) even though the query is completely
 // invalid.
-const QUERY = [
-    'a b',
-    'a   b',
-    'a,b(c)',
-    'aaa,a',
-    ',,,,',
-    'mod    :',
-    'mod\t:',
-];
 
 const PARSED = [
     {
+        query: 'a b',
         elems: [
             {
                 name: "a",
@@ -38,6 +30,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a   b',
         elems: [
             {
                 name: "a",
@@ -63,6 +56,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'a,b(c)',
         elems: [],
         foundElems: 0,
         original: "a,b(c)",
@@ -71,6 +65,7 @@ const PARSED = [
         error: "Unexpected `(`",
     },
     {
+        query: 'aaa,a',
         elems: [
             {
                 name: "aaa",
@@ -96,6 +91,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: ',,,,',
         elems: [],
         foundElems: 0,
         original: ",,,,",
@@ -104,6 +100,7 @@ const PARSED = [
         error: null,
     },
     {
+        query: 'mod    :',
         elems: [],
         foundElems: 0,
         original: 'mod    :',
@@ -112,6 +109,7 @@ const PARSED = [
         error: "Unexpected `:` (expected path after type filter)",
     },
     {
+        query: 'mod\t:',
         elems: [],
         foundElems: 0,
         original: 'mod\t:',
diff --git a/tests/rustdoc-js-std/path-ordering.js b/tests/rustdoc-js-std/path-ordering.js
index 7dcdd40231248..c3d61d238cc35 100644
--- a/tests/rustdoc-js-std/path-ordering.js
+++ b/tests/rustdoc-js-std/path-ordering.js
@@ -1,7 +1,6 @@
-const QUERY = 'hashset::insert';
-
 const EXPECTED = {
-    'others': [
+    query: 'hashset::insert',
+    others: [
         // ensure hashset::insert comes first
         { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
         { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
diff --git a/tests/rustdoc-js-std/primitive.js b/tests/rustdoc-js-std/primitive.js
index e5690383e4f0b..737e429bf5514 100644
--- a/tests/rustdoc-js-std/primitive.js
+++ b/tests/rustdoc-js-std/primitive.js
@@ -1,15 +1,6 @@
-const QUERY = [
-    'i8',
-    'u32',
-    'str',
-    'char',
-    'unit',
-    'tuple',
-    'fn',
-];
-
 const EXPECTED = [
     {
+        'query': 'i8',
         'others': [
             {
                 'path': 'std',
@@ -19,6 +10,7 @@ const EXPECTED = [
         ]
     },
     {
+        'query': 'u32',
         'others': [
             {
                 'path': 'std',
@@ -28,6 +20,7 @@ const EXPECTED = [
         ]
     },
     {
+        'query': 'str',
         'others': [
             {
                 'path': 'std',
@@ -37,6 +30,7 @@ const EXPECTED = [
         ]
     },
     {
+        'query': 'char',
         'others': [
             {
                 'path': 'std',
@@ -46,6 +40,7 @@ const EXPECTED = [
         ]
     },
     {
+        'query': 'unit',
         'others': [
             {
                 'path': 'std',
@@ -55,6 +50,7 @@ const EXPECTED = [
         ]
     },
     {
+        'query': 'tuple',
         'others': [
             {
                 'path': 'std',
@@ -64,6 +60,7 @@ const EXPECTED = [
         ]
     },
     {
+        'query': 'fn',
         'others': [
             {
                 'path': 'std',
diff --git a/tests/rustdoc-js-std/println-typo.js b/tests/rustdoc-js-std/println-typo.js
index 7ca3ab8e56333..a4dd90a44d5ba 100644
--- a/tests/rustdoc-js-std/println-typo.js
+++ b/tests/rustdoc-js-std/println-typo.js
@@ -1,9 +1,9 @@
 // exact-check
 
-const QUERY = 'prinltn';
 const FILTER_CRATE = 'std';
 
 const EXPECTED = {
+    'query': 'prinltn',
     'others': [
         { 'path': 'std', 'name': 'println' },
         { 'path': 'std', 'name': 'print' },
diff --git a/tests/rustdoc-js-std/quoted.js b/tests/rustdoc-js-std/quoted.js
index aec8484a41f6d..8a9275019255c 100644
--- a/tests/rustdoc-js-std/quoted.js
+++ b/tests/rustdoc-js-std/quoted.js
@@ -1,9 +1,9 @@
 // ignore-order
 
-const QUERY = '"error"';
 const FILTER_CRATE = 'std';
 
 const EXPECTED = {
+    'query': '"error"',
     'others': [
         { 'path': 'std', 'name': 'error' },
         { 'path': 'std::fmt', 'name': 'Error' },
diff --git a/tests/rustdoc-js-std/reference-shrink.js b/tests/rustdoc-js-std/reference-shrink.js
index f90be6d1bfd35..b602bbdca188d 100644
--- a/tests/rustdoc-js-std/reference-shrink.js
+++ b/tests/rustdoc-js-std/reference-shrink.js
@@ -1,8 +1,7 @@
 // exact-check
 
-const QUERY = 'reference::shrink';
-
 const EXPECTED = {
+    'query': 'reference::shrink',
     // avoid including the method that's not going to be in the HTML
     'others': [],
 };
diff --git a/tests/rustdoc-js-std/regex.js b/tests/rustdoc-js-std/regex.js
index a6843c595f7ad..7dc38939a17d4 100644
--- a/tests/rustdoc-js-std/regex.js
+++ b/tests/rustdoc-js-std/regex.js
@@ -1,9 +1,8 @@
 // exact-check
 
 // https://github.com/rust-lang/rust/issues/103357
-const QUERY = 'regex';
-
 const EXPECTED = {
+    'query': 'regex',
     'others': [],
     'in_args': [],
     'returned': [],
diff --git a/tests/rustdoc-js-std/return-specific-literal.js b/tests/rustdoc-js-std/return-specific-literal.js
index c7c347240b751..86ed3aceb4e84 100644
--- a/tests/rustdoc-js-std/return-specific-literal.js
+++ b/tests/rustdoc-js-std/return-specific-literal.js
@@ -1,6 +1,5 @@
-const QUERY = 'struct:"string"';
-
 const EXPECTED = {
+    'query': 'struct:"string"',
     'in_args': [
         { 'path': 'std::string::String', 'name': 'ne' },
     ],
diff --git a/tests/rustdoc-js-std/return-specific.js b/tests/rustdoc-js-std/return-specific.js
index d9a910553b8de..be54a1c977254 100644
--- a/tests/rustdoc-js-std/return-specific.js
+++ b/tests/rustdoc-js-std/return-specific.js
@@ -1,6 +1,5 @@
-const QUERY = 'struct:string';
-
 const EXPECTED = {
+    'query': 'struct:string',
     'in_args': [
         { 'path': 'std::string::String', 'name': 'ne' },
     ],
diff --git a/tests/rustdoc-js-std/should-fail.js b/tests/rustdoc-js-std/should-fail.js
index b85a47dc08a88..94f82efd9b497 100644
--- a/tests/rustdoc-js-std/should-fail.js
+++ b/tests/rustdoc-js-std/should-fail.js
@@ -1,8 +1,7 @@
 // should-fail
 
-const QUERY = 'fn';
-
 const EXPECTED = {
+    'query': 'fn',
     'others': [
         { 'path': 'std', 'name': 'fn', ty: 14 },
     ],
diff --git a/tests/rustdoc-js-std/string-from_ut.js b/tests/rustdoc-js-std/string-from_ut.js
index f9edf4408db85..1fff6ee28bb42 100644
--- a/tests/rustdoc-js-std/string-from_ut.js
+++ b/tests/rustdoc-js-std/string-from_ut.js
@@ -1,6 +1,5 @@
-const QUERY = 'String::from_ut';
-
 const EXPECTED = {
+    'query': 'String::from_ut',
     'others': [
         { 'path': 'std::string::String', 'name': 'from_utf8' },
         { 'path': 'std::string::String', 'name': 'from_utf8' },
diff --git a/tests/rustdoc-js-std/struct-vec.js b/tests/rustdoc-js-std/struct-vec.js
index 29609904b1957..dd72aaa1ab86c 100644
--- a/tests/rustdoc-js-std/struct-vec.js
+++ b/tests/rustdoc-js-std/struct-vec.js
@@ -1,6 +1,5 @@
-const QUERY = 'struct:VecD';
-
 const EXPECTED = {
+    'query': 'struct:VecD',
     'others': [
         { 'path': 'std::collections', 'name': 'VecDeque' },
         { 'path': 'std::vec', 'name': 'Vec' },
diff --git a/tests/rustdoc-js-std/typed-query.js b/tests/rustdoc-js-std/typed-query.js
index eeb3e18886959..8e84645889adf 100644
--- a/tests/rustdoc-js-std/typed-query.js
+++ b/tests/rustdoc-js-std/typed-query.js
@@ -1,9 +1,9 @@
 // exact-check
 
-const QUERY = 'macro:print';
 const FILTER_CRATE = 'std';
 
 const EXPECTED = {
+    'query': 'macro:print',
     'others': [
         { 'path': 'std', 'name': 'print' },
         { 'path': 'std', 'name': 'println' },
diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js
index fc44a566af21f..309f3543faffe 100644
--- a/tests/rustdoc-js-std/vec-new.js
+++ b/tests/rustdoc-js-std/vec-new.js
@@ -1,6 +1,5 @@
-const QUERY = 'Vec::new';
-
 const EXPECTED = {
+    'query': 'Vec::new',
     'others': [
         { 'path': 'std::vec::Vec', 'name': 'new' },
         { 'path': 'alloc::vec::Vec', 'name': 'new' },
diff --git a/tests/rustdoc-js/basic.js b/tests/rustdoc-js/basic.js
index d99b23468b60c..e186d510887cb 100644
--- a/tests/rustdoc-js/basic.js
+++ b/tests/rustdoc-js/basic.js
@@ -1,6 +1,5 @@
-const QUERY = 'Fo';
-
 const EXPECTED = {
+    'query': 'Fo',
     'others': [
         { 'path': 'basic', 'name': 'Foo' },
     ],
diff --git a/tests/rustdoc-js/doc-alias-filter-out.js b/tests/rustdoc-js/doc-alias-filter-out.js
index 46a089d06ebef..fd25370dff3c1 100644
--- a/tests/rustdoc-js/doc-alias-filter-out.js
+++ b/tests/rustdoc-js/doc-alias-filter-out.js
@@ -1,9 +1,8 @@
 // exact-check
 
-const QUERY = 'true';
-
 const FILTER_CRATE = 'some_other_crate';
 
 const EXPECTED = {
+    'query': 'true',
     'others': [],
 };
diff --git a/tests/rustdoc-js/doc-alias-filter.js b/tests/rustdoc-js/doc-alias-filter.js
index e06047ba7606e..1d2dd8b9a8cde 100644
--- a/tests/rustdoc-js/doc-alias-filter.js
+++ b/tests/rustdoc-js/doc-alias-filter.js
@@ -1,10 +1,9 @@
 // exact-check
 
-const QUERY = '"true"';
-
 const FILTER_CRATE = 'doc_alias_filter';
 
 const EXPECTED = {
+    'query': '"true"',
     'others': [
         {
             'path': 'doc_alias_filter',
diff --git a/tests/rustdoc-js/doc-alias-whitespace.js b/tests/rustdoc-js/doc-alias-whitespace.js
index c9fc0c4311f19..64784b5698be9 100644
--- a/tests/rustdoc-js/doc-alias-whitespace.js
+++ b/tests/rustdoc-js/doc-alias-whitespace.js
@@ -1,11 +1,8 @@
 // exact-check
 
-const QUERY = [
-    'Demon Lord',
-];
-
 const EXPECTED = [
     {
+        'query': 'Demon Lord',
         'others': [
             {
                 'path': 'doc_alias_whitespace',
diff --git a/tests/rustdoc-js/doc-alias.js b/tests/rustdoc-js/doc-alias.js
index 62c8e7a74b940..7e4e8a776d899 100644
--- a/tests/rustdoc-js/doc-alias.js
+++ b/tests/rustdoc-js/doc-alias.js
@@ -1,31 +1,6 @@
-const QUERY = [
-    'StructItem',
-    'StructFieldItem',
-    'StructMethodItem',
-    'ImplTraitItem',
-    'StructImplConstItem',
-    'ImplTraitFunction',
-    'EnumItem',
-    'VariantItem',
-    'EnumMethodItem',
-    'TypedefItem',
-    'TraitItem',
-    'TraitTypeItem',
-    'AssociatedConstItem',
-    'TraitFunctionItem',
-    'FunctionItem',
-    'ModuleItem',
-    'ConstItem',
-    'StaticItem',
-    'UnionItem',
-    'UnionFieldItem',
-    'UnionMethodItem',
-    'MacroItem',
-];
-
 const EXPECTED = [
     {
-        // StructItem
+        'query': 'StructItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -37,7 +12,7 @@ const EXPECTED = [
         ],
     },
     {
-        // StructFieldItem
+        'query': 'StructFieldItem',
         'others': [
             {
                 'path': 'doc_alias::Struct',
@@ -49,7 +24,7 @@ const EXPECTED = [
         ],
     },
     {
-        // StructMethodItem
+        'query': 'StructMethodItem',
         'others': [
             {
                 'path': 'doc_alias::Struct',
@@ -61,11 +36,11 @@ const EXPECTED = [
         ],
     },
     {
-        // ImplTraitItem
+        'query': 'ImplTraitItem',
         'others': [],
     },
     {
-        // StructImplConstItem
+        'query': 'StructImplConstItem',
         'others': [
             {
                 'path': 'doc_alias::Struct',
@@ -77,7 +52,7 @@ const EXPECTED = [
         ],
     },
     {
-        // ImplTraitFunction
+        'query': 'ImplTraitFunction',
         'others': [
             {
                 'path': 'doc_alias::Struct',
@@ -89,7 +64,7 @@ const EXPECTED = [
         ],
     },
     {
-        // EnumItem
+        'query': 'EnumItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -101,7 +76,7 @@ const EXPECTED = [
         ],
     },
     {
-        // VariantItem
+        'query': 'VariantItem',
         'others': [
             {
                 'path': 'doc_alias::Enum',
@@ -113,7 +88,7 @@ const EXPECTED = [
         ],
     },
     {
-        // EnumMethodItem
+        'query': 'EnumMethodItem',
         'others': [
             {
                 'path': 'doc_alias::Enum',
@@ -125,7 +100,7 @@ const EXPECTED = [
         ],
     },
     {
-        // TypedefItem
+        'query': 'TypedefItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -137,7 +112,7 @@ const EXPECTED = [
         ],
     },
     {
-        // TraitItem
+        'query': 'TraitItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -149,7 +124,7 @@ const EXPECTED = [
         ],
     },
     {
-        // TraitTypeItem
+        'query': 'TraitTypeItem',
         'others': [
             {
                 'path': 'doc_alias::Trait',
@@ -161,7 +136,7 @@ const EXPECTED = [
         ],
     },
     {
-        // AssociatedConstItem
+        'query': 'AssociatedConstItem',
         'others': [
             {
                 'path': 'doc_alias::Trait',
@@ -173,7 +148,7 @@ const EXPECTED = [
         ],
     },
     {
-        // TraitFunctionItem
+        'query': 'TraitFunctionItem',
         'others': [
             {
                 'path': 'doc_alias::Trait',
@@ -185,7 +160,7 @@ const EXPECTED = [
         ],
     },
     {
-        // FunctionItem
+        'query': 'FunctionItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -197,7 +172,7 @@ const EXPECTED = [
         ],
     },
     {
-        // ModuleItem
+        'query': 'ModuleItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -209,7 +184,7 @@ const EXPECTED = [
         ],
     },
     {
-        // ConstItem
+        'query': 'ConstItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -225,7 +200,7 @@ const EXPECTED = [
         ],
     },
     {
-        // StaticItem
+        'query': 'StaticItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -237,7 +212,7 @@ const EXPECTED = [
         ],
     },
     {
-        // UnionItem
+        'query': 'UnionItem',
         'others': [
             {
                 'path': 'doc_alias',
@@ -255,7 +230,7 @@ const EXPECTED = [
         ],
     },
     {
-        // UnionFieldItem
+        'query': 'UnionFieldItem',
         'others': [
             {
                 'path': 'doc_alias::Union',
@@ -267,7 +242,7 @@ const EXPECTED = [
         ],
     },
     {
-        // UnionMethodItem
+        'query': 'UnionMethodItem',
         'others': [
             {
                 'path': 'doc_alias::Union',
@@ -279,7 +254,7 @@ const EXPECTED = [
         ],
     },
     {
-        // MacroItem
+        'query': 'MacroItem',
         'others': [
             {
                 'path': 'doc_alias',
diff --git a/tests/rustdoc-js/exact-match.js b/tests/rustdoc-js/exact-match.js
index b0a411bee5829..ce3a76f9b7dd3 100644
--- a/tests/rustdoc-js/exact-match.js
+++ b/tests/rustdoc-js/exact-match.js
@@ -1,6 +1,5 @@
-const QUERY = 'si::pc';
-
 const EXPECTED = {
+    'query': 'si::pc',
     'others': [
         { 'path': 'exact_match::Si', 'name': 'pc' },
         { 'path': 'exact_match::Psi', 'name': 'pc' },
diff --git a/tests/rustdoc-js/foreign-type-path.js b/tests/rustdoc-js/foreign-type-path.js
index 334761badcab1..b11123d3ed9b1 100644
--- a/tests/rustdoc-js/foreign-type-path.js
+++ b/tests/rustdoc-js/foreign-type-path.js
@@ -1,6 +1,5 @@
-const QUERY = 'MyForeignType::my_method';
-
 const EXPECTED = {
+    'query': 'MyForeignType::my_method',
     'others': [
         // Test case for https://github.com/rust-lang/rust/pull/96887#pullrequestreview-967154358
         // Validates that the parent path for a foreign type method is correct.
diff --git a/tests/rustdoc-js/generics-impl.js b/tests/rustdoc-js/generics-impl.js
index 5051743bda2d1..5e33e224876fe 100644
--- a/tests/rustdoc-js/generics-impl.js
+++ b/tests/rustdoc-js/generics-impl.js
@@ -1,68 +1,56 @@
 // exact-check
 
-const QUERY = [
-    'Aaaaaaa -> u32',
-    'Aaaaaaa -> bool',
-    'Aaaaaaa -> usize',
-    'Read -> u64',
-    'trait:Read -> u64',
-    'struct:Read -> u64',
-    'bool -> u64',
-    'Ddddddd -> u64',
-    '-> Ddddddd'
-];
-
 const EXPECTED = [
     {
-        // Aaaaaaa -> u32
+        'query': 'Aaaaaaa -> u32',
         'others': [
             { 'path': 'generics_impl::Aaaaaaa', 'name': 'bbbbbbb' },
         ],
     },
     {
-        // Aaaaaaa -> bool
+        'query': 'Aaaaaaa -> bool',
         'others': [
             { 'path': 'generics_impl::Aaaaaaa', 'name': 'ccccccc' },
         ],
     },
     {
-        // Aaaaaaa -> usize
+        'query': 'Aaaaaaa -> usize',
         'others': [
             { 'path': 'generics_impl::Aaaaaaa', 'name': 'read' },
         ],
     },
     {
-        // Read -> u64
+        'query': 'Read -> u64',
         'others': [
             { 'path': 'generics_impl::Ddddddd', 'name': 'eeeeeee' },
             { 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' },
         ],
     },
     {
-        // trait:Read -> u64
+        'query': 'trait:Read -> u64',
         'others': [
             { 'path': 'generics_impl::Ddddddd', 'name': 'eeeeeee' },
             { 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' },
         ],
     },
     {
-        // struct:Read -> u64
+        'query': 'struct:Read -> u64',
         'others': [],
     },
     {
-        // bool -> u64
+        'query': 'bool -> u64',
         'others': [
             { 'path': 'generics_impl::Ddddddd', 'name': 'fffffff' },
         ],
     },
     {
-        // Ddddddd -> u64
+        'query': 'Ddddddd -> u64',
         'others': [
             { 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' },
         ],
     },
     {
-        // -> Ddddddd
+        'query': '-> Ddddddd',
         'others': [
             { 'path': 'generics_impl::Ddddddd', 'name': 'hhhhhhh' },
         ],
diff --git a/tests/rustdoc-js/generics-multi-trait.js b/tests/rustdoc-js/generics-multi-trait.js
index e7fcea876c85c..7097cabe7a21f 100644
--- a/tests/rustdoc-js/generics-multi-trait.js
+++ b/tests/rustdoc-js/generics-multi-trait.js
@@ -1,14 +1,9 @@
 // exact-check
 
-const QUERY = [
-    'Result<SomeTrait>',
-    'Zzzzzzzzzzzzzzzzzz',
-    'Nonononononononono',
-];
-
 const EXPECTED = [
     // check one of the generic items
     {
+        'query': 'Result<SomeTrait>',
         'in_args': [
             { 'path': 'generics_multi_trait', 'name': 'beta' },
         ],
@@ -17,6 +12,7 @@ const EXPECTED = [
         ],
     },
     {
+        'query': 'Zzzzzzzzzzzzzzzzzz',
         'in_args': [
             { 'path': 'generics_multi_trait', 'name': 'beta' },
         ],
@@ -26,6 +22,7 @@ const EXPECTED = [
     },
     // ignore the name of the generic itself
     {
+        'query': 'Nonononononononono',
         'in_args': [],
         'returned': [],
     },
diff --git a/tests/rustdoc-js/generics-nested.js b/tests/rustdoc-js/generics-nested.js
index 8701f2d49861a..294c194907489 100644
--- a/tests/rustdoc-js/generics-nested.js
+++ b/tests/rustdoc-js/generics-nested.js
@@ -1,31 +1,24 @@
 // exact-check
 
-const QUERY = [
-    '-> Out<First<Second>>',
-    '-> Out<Second<First>>',
-    '-> Out<First, Second>',
-    '-> Out<Second, First>',
-];
-
 const EXPECTED = [
     {
-        // -> Out<First<Second>>
+        'query': '-> Out<First<Second>>',
         'others': [
             { 'path': 'generics_nested', 'name': 'alef' },
         ],
     },
     {
-        // -> Out<Second<First>>
+        'query': '-> Out<Second<First>>',
         'others': [],
     },
     {
-        // -> Out<First, Second>
+        'query': '-> Out<First, Second>',
         'others': [
             { 'path': 'generics_nested', 'name': 'bet' },
         ],
     },
     {
-        // -> Out<Second, First>
+        'query': '-> Out<Second, First>',
         'others': [
             { 'path': 'generics_nested', 'name': 'bet' },
         ],
diff --git a/tests/rustdoc-js/generics-trait.js b/tests/rustdoc-js/generics-trait.js
index 0e84751603ed6..4ccfb8f4e4d02 100644
--- a/tests/rustdoc-js/generics-trait.js
+++ b/tests/rustdoc-js/generics-trait.js
@@ -1,22 +1,9 @@
 // exact-check
 
-const QUERY = [
-    'Result<SomeTrait>',
-    'Result<SomeTraiz>',
-    'OtherThingxxxxxxxx',
-    'OtherThingxxxxxxxy',
-];
-
-const CORRECTIONS = [
-    null,
-    null,
-    null,
-    'OtherThingxxxxxxxx',
-];
-
 const EXPECTED = [
-    // Result<SomeTrait>
     {
+        'query': 'Result<SomeTrait>',
+        'correction': null,
         'in_args': [
             { 'path': 'generics_trait', 'name': 'beta' },
         ],
@@ -24,13 +11,15 @@ const EXPECTED = [
             { 'path': 'generics_trait', 'name': 'bet' },
         ],
     },
-    // Result<SomeTraiz>
     {
+        'query': 'Result<SomeTraiz>',
+        'correction': null,
         'in_args': [],
         'returned': [],
     },
-    // OtherThingxxxxxxxx
     {
+        'query': 'OtherThingxxxxxxxx',
+        'correction': null,
         'in_args': [
             { 'path': 'generics_trait', 'name': 'alpha' },
         ],
@@ -38,8 +27,9 @@ const EXPECTED = [
             { 'path': 'generics_trait', 'name': 'alef' },
         ],
     },
-    // OtherThingxxxxxxxy
     {
+        'query': 'OtherThingxxxxxxxy',
+        'correction': 'OtherThingxxxxxxxx',
         'in_args': [
             { 'path': 'generics_trait', 'name': 'alpha' },
         ],
diff --git a/tests/rustdoc-js/generics.js b/tests/rustdoc-js/generics.js
index f79c709ad6cf0..ebc92ccfc0575 100644
--- a/tests/rustdoc-js/generics.js
+++ b/tests/rustdoc-js/generics.js
@@ -1,20 +1,8 @@
 // exact-check
 
-const QUERY = [
-    'R<P>',
-    'R<struct:P>',
-    'R<enum:P>',
-    '"P"',
-    'P',
-    'ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>',
-    'TraitCat',
-    'TraitDog',
-    'Result<String>',
-];
-
 const EXPECTED = [
     {
-        // R<P>
+        'query': 'R<P>',
         'returned': [
             { 'path': 'generics', 'name': 'alef' },
         ],
@@ -23,7 +11,7 @@ const EXPECTED = [
         ],
     },
     {
-        // R<struct:P>
+        'query': 'R<struct:P>',
         'returned': [
             { 'path': 'generics', 'name': 'alef' },
         ],
@@ -32,12 +20,12 @@ const EXPECTED = [
         ],
     },
     {
-        // R<enum:P>
+        'query': 'R<enum:P>',
         'returned': [],
         'in_args': [],
     },
     {
-        // "P"
+        'query': '"P"',
         'others': [
             { 'path': 'generics', 'name': 'P' },
         ],
@@ -49,7 +37,7 @@ const EXPECTED = [
         ],
     },
     {
-        // P
+        'query': 'P',
         'returned': [
             { 'path': 'generics', 'name': 'alef' },
         ],
@@ -58,26 +46,26 @@ const EXPECTED = [
         ],
     },
     {
-        // "ExtraCreditStructMulti"<ExtraCreditInnerMulti, ExtraCreditInnerMulti>
+        'query': '"ExtraCreditStructMulti"<ExtraCreditInnerMulti, ExtraCreditInnerMulti>',
         'in_args': [
             { 'path': 'generics', 'name': 'extracreditlabhomework' },
         ],
         'returned': [],
     },
     {
-        // TraitCat
+        'query': 'TraitCat',
         'in_args': [
             { 'path': 'generics', 'name': 'gamma' },
         ],
     },
     {
-        // TraitDog
+        'query': 'TraitDog',
         'in_args': [
             { 'path': 'generics', 'name': 'gamma' },
         ],
     },
     {
-        // Result<String>
+        'query': 'Result<String>',
         'others': [],
         'returned': [
             { 'path': 'generics', 'name': 'super_soup' },
diff --git a/tests/rustdoc-js/impl-trait.js b/tests/rustdoc-js/impl-trait.js
index 8d594bf8aea75..710e594b54774 100644
--- a/tests/rustdoc-js/impl-trait.js
+++ b/tests/rustdoc-js/impl-trait.js
@@ -1,32 +1,24 @@
 // ignore-order
 
-const QUERY = [
-    'Aaaaaaa -> i32',
-    'Aaaaaaa -> Aaaaaaa',
-    'Aaaaaaa -> usize',
-    '-> Aaaaaaa',
-    'Aaaaaaa',
-];
-
 const EXPECTED = [
     {
-        // Aaaaaaa -> i32
+        'query': 'Aaaaaaa -> i32',
         'others': [
             { 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' },
         ],
     },
     {
-        // Aaaaaaa -> Aaaaaaa
+        'query': 'Aaaaaaa -> Aaaaaaa',
         'others': [
             { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
         ],
     },
     {
-        // Aaaaaaa -> usize
+        'query': 'Aaaaaaa -> usize',
         'others': [],
     },
     {
-        // -> Aaaaaaa
+        'query': '-> Aaaaaaa',
         'others': [
             { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
             { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
@@ -34,7 +26,7 @@ const EXPECTED = [
         ],
     },
     {
-        // Aaaaaaa
+        'query': 'Aaaaaaa',
         'others': [
             { 'path': 'impl_trait', 'name': 'Aaaaaaa' },
         ],
diff --git a/tests/rustdoc-js/macro-search.js b/tests/rustdoc-js/macro-search.js
index 2b179ce146bf0..241f7f1728859 100644
--- a/tests/rustdoc-js/macro-search.js
+++ b/tests/rustdoc-js/macro-search.js
@@ -1,8 +1,7 @@
 // exact-check
 
-const QUERY = 'abracadabra!';
-
 const EXPECTED = {
+    'query': 'abracadabra!',
     'others': [
         { 'path': 'macro_search', 'name': 'abracadabra' },
         { 'path': 'macro_search', 'name': 'abracadabra_b' },
diff --git a/tests/rustdoc-js/module-substring.js b/tests/rustdoc-js/module-substring.js
index f17a97f13dc7e..7a10397ebc620 100644
--- a/tests/rustdoc-js/module-substring.js
+++ b/tests/rustdoc-js/module-substring.js
@@ -1,6 +1,5 @@
-const QUERY = 'ig::pc';
-
 const EXPECTED = {
+    'query': 'ig::pc',
     'others': [
         { 'path': 'module_substring::Sig', 'name': 'pc' },
         { 'path': 'module_substring::Si', 'name': 'pc' },
diff --git a/tests/rustdoc-js/path-ordering.js b/tests/rustdoc-js/path-ordering.js
index 4aee569b0f481..f2e6fe2fa61c4 100644
--- a/tests/rustdoc-js/path-ordering.js
+++ b/tests/rustdoc-js/path-ordering.js
@@ -1,8 +1,7 @@
 // exact-check
 
-const QUERY = 'b::ccccccc';
-
 const EXPECTED = {
+    'query': 'b::ccccccc',
     'others': [
         // `ccccccc` is an exact match for all three of these.
         // However `b` is a closer match for `bb` than for any
diff --git a/tests/rustdoc-js/primitive.js b/tests/rustdoc-js/primitive.js
index 4aec98c340379..ad8f6663aad12 100644
--- a/tests/rustdoc-js/primitive.js
+++ b/tests/rustdoc-js/primitive.js
@@ -1,33 +1,30 @@
 // exact-check
 
-const QUERY = [
-    "i32",
-    "str",
-    "primitive:str",
-    "struct:str",
-    "TotoIsSomewhere",
-];
-
 const EXPECTED = [
     {
+        'query': 'i32',
         'in_args': [
             { 'path': 'primitive', 'name': 'foo' },
         ],
     },
     {
+        'query': 'str',
         'returned': [
             { 'path': 'primitive', 'name': 'foo' },
         ],
     },
     {
+        'query': 'primitive:str',
         'returned': [
             { 'path': 'primitive', 'name': 'foo' },
         ],
     },
     {
+        'query': 'struct:str',
         'returned': [],
     },
     {
+        'query': 'TotoIsSomewhere',
         'others': [],
         'in_args': [],
         'returned': [],
diff --git a/tests/rustdoc-js/prototype.js b/tests/rustdoc-js/prototype.js
index 2f1d841c3be19..da72fdce3db93 100644
--- a/tests/rustdoc-js/prototype.js
+++ b/tests/rustdoc-js/prototype.js
@@ -1,14 +1,14 @@
 // exact-check
 
-const QUERY = ['constructor', '__proto__'];
-
 const EXPECTED = [
     {
+        'query': 'constructor',
         'others': [],
         'returned': [],
         'in_args': [],
     },
     {
+        'query': '__proto__',
         'others': [],
         'returned': [],
         'in_args': [],
diff --git a/tests/rustdoc-js/raw-pointer.js b/tests/rustdoc-js/raw-pointer.js
index 140b955ea713a..f2b1294ee3c86 100644
--- a/tests/rustdoc-js/raw-pointer.js
+++ b/tests/rustdoc-js/raw-pointer.js
@@ -1,33 +1,25 @@
 // ignore-order
 
-const QUERY = [
-    'Aaaaaaa -> i32',
-    'Aaaaaaa -> Aaaaaaa',
-    'Aaaaaaa -> usize',
-    '-> Aaaaaaa',
-    'Aaaaaaa',
-];
-
 const EXPECTED = [
     {
-        // Aaaaaaa -> i32
+        'query': 'Aaaaaaa -> i32',
         'others': [
             { 'path': 'raw_pointer::Ccccccc', 'name': 'eeeeeee' },
         ],
     },
     {
-        // Aaaaaaa -> Aaaaaaa
+        'query': 'Aaaaaaa -> Aaaaaaa',
         'others': [
             { 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' },
             { 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' },
         ],
     },
     {
-        // Aaaaaaa -> usize
+        'query': 'Aaaaaaa -> usize',
         'others': [],
     },
     {
-        // -> Aaaaaaa
+        'query': '-> Aaaaaaa',
         'others': [
             { 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' },
             { 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' },
@@ -36,7 +28,7 @@ const EXPECTED = [
         ],
     },
     {
-        // Aaaaaaa
+        'query': 'Aaaaaaa',
         'others': [
             { 'path': 'raw_pointer', 'name': 'Aaaaaaa' },
         ],
diff --git a/tests/rustdoc-js/reexport.js b/tests/rustdoc-js/reexport.js
index 871e75d9b2b31..9021cc2e90fe0 100644
--- a/tests/rustdoc-js/reexport.js
+++ b/tests/rustdoc-js/reexport.js
@@ -1,15 +1,15 @@
 // exact-check
 
-const QUERY = ['Subscriber', 'AnotherOne'];
-
 const EXPECTED = [
     {
+        'query': 'Subscriber',
         'others': [
             { 'path': 'reexport::fmt', 'name': 'Subscriber' },
             { 'path': 'reexport', 'name': 'FmtSubscriber' },
         ],
     },
     {
+        'query': 'AnotherOne',
         'others': [
             { 'path': 'reexport', 'name': 'AnotherOne' },
         ],
diff --git a/tests/rustdoc-js/search-bag-semantics.js b/tests/rustdoc-js/search-bag-semantics.js
index c56a3df5f904c..4b598cd80cc07 100644
--- a/tests/rustdoc-js/search-bag-semantics.js
+++ b/tests/rustdoc-js/search-bag-semantics.js
@@ -1,18 +1,15 @@
 // exact-check
 
-const QUERY = [
-    'P',
-    'P, P',
-];
-
 const EXPECTED = [
     {
+        'query': 'P',
         'in_args': [
             { 'path': 'search_bag_semantics', 'name': 'alacazam' },
             { 'path': 'search_bag_semantics', 'name': 'abracadabra' },
         ],
     },
     {
+        'query': 'P, P',
         'others': [
             { 'path': 'search_bag_semantics', 'name': 'abracadabra' },
         ],
diff --git a/tests/rustdoc-js/search-short-types.js b/tests/rustdoc-js/search-short-types.js
index 3b2f15a40bf87..5048e0443c1c2 100644
--- a/tests/rustdoc-js/search-short-types.js
+++ b/tests/rustdoc-js/search-short-types.js
@@ -1,6 +1,5 @@
-const QUERY = 'P';
-
 const EXPECTED = {
+    'query': 'P',
     'others': [
         { 'path': 'search_short_types', 'name': 'P' },
         { 'path': 'search_short_types::VeryLongTypeName', 'name': 'p' },
diff --git a/tests/rustdoc-js/slice-array.js b/tests/rustdoc-js/slice-array.js
index 8c21e06dc4e4f..1c06566920c2b 100644
--- a/tests/rustdoc-js/slice-array.js
+++ b/tests/rustdoc-js/slice-array.js
@@ -1,63 +1,52 @@
 // exact-check
 
-const QUERY = [
-    'R<primitive:slice<P>>',
-    'primitive:slice<R<P>>',
-    'R<primitive:slice<Q>>',
-    'primitive:slice<R<Q>>',
-    'R<primitive:array<Q>>',
-    'primitive:array<R<Q>>',
-    'primitive:array<TraitCat>',
-    'primitive:array<TraitDog>',
-];
-
 const EXPECTED = [
     {
-        // R<primitive:slice<P>>
+        'query': 'R<primitive:slice<P>>',
         'returned': [],
         'in_args': [
             { 'path': 'slice_array', 'name': 'alpha' },
         ],
     },
     {
-        // primitive:slice<R<P>>
+        'query': 'primitive:slice<R<P>>',
         'returned': [
             { 'path': 'slice_array', 'name': 'alef' },
         ],
         'in_args': [],
     },
     {
-        // R<primitive:slice<Q>>
+        'query': 'R<primitive:slice<Q>>',
         'returned': [],
         'in_args': [],
     },
     {
-        // primitive:slice<R<Q>>
+        'query': 'primitive:slice<R<Q>>',
         'returned': [],
         'in_args': [],
     },
     {
-        // R<primitive:array<Q>>
+        'query': 'R<primitive:array<Q>>',
         'returned': [
             { 'path': 'slice_array', 'name': 'bet' },
         ],
         'in_args': [],
     },
     {
-        // primitive:array<R<Q>>
+        'query': 'primitive:array<R<Q>>',
         'returned': [],
         'in_args': [
             { 'path': 'slice_array', 'name': 'beta' },
         ],
     },
     {
-        // primitive::array<TraitCat>
+        'query': 'primitive:array<TraitCat>',
         'in_args': [
             { 'path': 'slice_array', 'name': 'gamma' },
         ],
     },
     {
-        // primitive::array<TraitDog>
+        'query': 'primitive:array<TraitDog>',
         'in_args': [
             { 'path': 'slice_array', 'name': 'gamma' },
         ],
diff --git a/tests/rustdoc-js/struct-like-variant.js b/tests/rustdoc-js/struct-like-variant.js
index f6deea51e7d4d..7b9bec7aea832 100644
--- a/tests/rustdoc-js/struct-like-variant.js
+++ b/tests/rustdoc-js/struct-like-variant.js
@@ -1,6 +1,5 @@
-const QUERY = 'name';
-
 const EXPECTED = {
+    'query': 'name',
     'others': [
         { 'path': 'struct_like_variant::Enum::Bar', 'name': 'name', 'desc': 'This is a name.' },
     ],
diff --git a/tests/rustdoc-js/substring.js b/tests/rustdoc-js/substring.js
index af05cd1ad34d1..96efa992bb685 100644
--- a/tests/rustdoc-js/substring.js
+++ b/tests/rustdoc-js/substring.js
@@ -1,6 +1,5 @@
-const QUERY = 'waker_from';
-
 const EXPECTED = {
+    'query': 'waker_from',
     'others': [
         { 'path': 'substring::SuperWaker', 'name': 'local_waker_from_nonlocal' },
         { 'path': 'substring::SuperWakerTask', 'name': 'local_waker_from_nonlocal' },
diff --git a/tests/rustdoc-js/summaries.js b/tests/rustdoc-js/summaries.js
index dfb11e80414c1..ae3aefb0c48a0 100644
--- a/tests/rustdoc-js/summaries.js
+++ b/tests/rustdoc-js/summaries.js
@@ -1,19 +1,20 @@
 // ignore-tidy-linelength
 
-const QUERY = ['summaries', 'summaries::Sidebar', 'summaries::Sidebar2'];
-
 const EXPECTED = [
     {
+        'query': 'summaries',
         'others': [
            { 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link, [<code>code</code>], and <code>Sidebar2</code> intra-doc.' },
         ],
     },
     {
+        'query': 'summaries::Sidebar',
         'others': [
             { 'path': 'summaries', 'name': 'Sidebar', 'desc': 'This <code>code</code> will be rendered in a code tag.' },
         ],
     },
     {
+        'query': 'summaries::Sidebar2',
         'others': [
             { 'path': 'summaries', 'name': 'Sidebar2', 'desc': '' },
         ],
diff --git a/tests/rustdoc-js/where-clause.js b/tests/rustdoc-js/where-clause.js
index 86254a80e20f3..8dccf197be060 100644
--- a/tests/rustdoc-js/where-clause.js
+++ b/tests/rustdoc-js/where-clause.js
@@ -1,28 +1,31 @@
-const QUERY = ['trait<nested>', '-> trait<nested>', 't1, t2', '-> shazam', 'drizzel -> shazam'];
-
 const EXPECTED = [
     {
+        'query': 'trait<nested>',
         'in_args': [
            { 'path': 'where_clause', 'name': 'abracadabra' },
         ],
     },
     {
+        'query': '-> trait<nested>',
         'others': [
             { 'path': 'where_clause', 'name': 'alacazam' },
         ],
     },
     {
+        'query': 't1, t2',
         'others': [
             { 'path': 'where_clause', 'name': 'presto' },
         ],
     },
     {
+        'query': '-> shazam',
         'others': [
             { 'path': 'where_clause', 'name': 'bippety' },
             { 'path': 'where_clause::Drizzel', 'name': 'boppety' },
         ],
     },
     {
+        'query': 'drizzel -> shazam',
         'others': [
             { 'path': 'where_clause::Drizzel', 'name': 'boppety' },
         ],
diff --git a/tests/ui/empty/empty-macro-use.stderr b/tests/ui/empty/empty-macro-use.stderr
index e0b3b8685d6eb..5d552e4c40846 100644
--- a/tests/ui/empty/empty-macro-use.stderr
+++ b/tests/ui/empty/empty-macro-use.stderr
@@ -4,8 +4,10 @@ error: cannot find macro `macro_two` in this scope
 LL |     macro_two!();
    |     ^^^^^^^^^
    |
-   = help: consider importing this macro:
-           two_macros::macro_two
+help: consider importing this macro
+   |
+LL + use two_macros::macro_two;
+   |
 
 error: aborting due to previous error
 
diff --git a/tests/ui/hygiene/no_implicit_prelude-2018.stderr b/tests/ui/hygiene/no_implicit_prelude-2018.stderr
index 3f31b041b6203..b22f3e75b6f4f 100644
--- a/tests/ui/hygiene/no_implicit_prelude-2018.stderr
+++ b/tests/ui/hygiene/no_implicit_prelude-2018.stderr
@@ -4,8 +4,10 @@ error: cannot find macro `print` in this scope
 LL |         print!();
    |         ^^^^^
    |
-   = help: consider importing this macro:
-           std::print
+help: consider importing this macro
+   |
+LL +     use std::print;
+   |
 
 error: aborting due to previous error
 
diff --git a/tests/ui/macros/issue-88228.rs b/tests/ui/macros/issue-88228.rs
index 60ba2eab7a7bf..ec55a262509aa 100644
--- a/tests/ui/macros/issue-88228.rs
+++ b/tests/ui/macros/issue-88228.rs
@@ -1,14 +1,14 @@
 // compile-flags: -Z deduplicate-diagnostics=yes
 // edition:2018
 
-mod hey {
+mod hey { //~ HELP consider importing this derive macro
+    //~^ HELP consider importing this macro
     pub use Copy as Bla;
     pub use std::println as bla;
 }
 
 #[derive(Bla)]
 //~^ ERROR cannot find derive macro `Bla`
-//~| HELP consider importing this derive macro
 struct A;
 
 #[derive(println)]
@@ -19,5 +19,4 @@ struct B;
 fn main() {
     bla!();
     //~^ ERROR cannot find macro `bla`
-    //~| HELP consider importing this macro
 }
diff --git a/tests/ui/macros/issue-88228.stderr b/tests/ui/macros/issue-88228.stderr
index fe8a1deaedd77..1dbe2b77be2d9 100644
--- a/tests/ui/macros/issue-88228.stderr
+++ b/tests/ui/macros/issue-88228.stderr
@@ -4,8 +4,10 @@ error: cannot find macro `bla` in this scope
 LL |     bla!();
    |     ^^^
    |
-   = help: consider importing this macro:
-           crate::hey::bla
+help: consider importing this macro
+   |
+LL + use crate::hey::bla;
+   |
 
 error: cannot find derive macro `println` in this scope
   --> $DIR/issue-88228.rs:14:10
@@ -16,13 +18,15 @@ LL | #[derive(println)]
    = note: `println` is in scope, but it is a function-like macro
 
 error: cannot find derive macro `Bla` in this scope
-  --> $DIR/issue-88228.rs:9:10
+  --> $DIR/issue-88228.rs:10:10
    |
 LL | #[derive(Bla)]
    |          ^^^
    |
-   = help: consider importing this derive macro:
-           crate::hey::Bla
+help: consider importing this derive macro
+   |
+LL + use crate::hey::Bla;
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/macros/macro-use-wrong-name.stderr b/tests/ui/macros/macro-use-wrong-name.stderr
index ca5f0f190e8ba..36339542ac61f 100644
--- a/tests/ui/macros/macro-use-wrong-name.stderr
+++ b/tests/ui/macros/macro-use-wrong-name.stderr
@@ -2,15 +2,21 @@ error: cannot find macro `macro_two` in this scope
   --> $DIR/macro-use-wrong-name.rs:7:5
    |
 LL |     macro_two!();
-   |     ^^^^^^^^^ help: a macro with a similar name exists: `macro_one`
+   |     ^^^^^^^^^
    |
   ::: $DIR/auxiliary/two_macros.rs:2:1
    |
 LL | macro_rules! macro_one { () => ("one") }
    | ---------------------- similarly named macro `macro_one` defined here
    |
-   = help: consider importing this macro:
-           two_macros::macro_two
+help: a macro with a similar name exists
+   |
+LL |     macro_one!();
+   |     ~~~~~~~~~
+help: consider importing this macro
+   |
+LL + use two_macros::macro_two;
+   |
 
 error: aborting due to previous error
 
diff --git a/tests/ui/missing/missing-macro-use.stderr b/tests/ui/missing/missing-macro-use.stderr
index 99e291cda0377..e1d80f52daddc 100644
--- a/tests/ui/missing/missing-macro-use.stderr
+++ b/tests/ui/missing/missing-macro-use.stderr
@@ -4,8 +4,10 @@ error: cannot find macro `macro_two` in this scope
 LL |     macro_two!();
    |     ^^^^^^^^^
    |
-   = help: consider importing this macro:
-           two_macros::macro_two
+help: consider importing this macro
+   |
+LL + use two_macros::macro_two;
+   |
 
 error: aborting due to previous error
 
diff --git a/tests/ui/proc-macro/derive-helper-shadowing.stderr b/tests/ui/proc-macro/derive-helper-shadowing.stderr
index de2c27a878c67..7e7870b295127 100644
--- a/tests/ui/proc-macro/derive-helper-shadowing.stderr
+++ b/tests/ui/proc-macro/derive-helper-shadowing.stderr
@@ -16,9 +16,11 @@ error: cannot find attribute `empty_helper` in this scope
 LL |             #[derive(GenHelperUse)]
    |                      ^^^^^^^^^^^^
    |
-   = help: consider importing this attribute macro:
-           empty_helper
    = note: this error originates in the derive macro `GenHelperUse` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider importing this attribute macro
+   |
+LL +             use empty_helper;
+   |
 
 error: cannot find attribute `empty_helper` in this scope
   --> $DIR/derive-helper-shadowing.rs:14:11
@@ -29,9 +31,11 @@ LL |         #[empty_helper]
 LL |             gen_helper_use!();
    |             ----------------- in this macro invocation
    |
-   = help: consider importing this attribute macro:
-           crate::empty_helper
    = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider importing this attribute macro
+   |
+LL +             use crate::empty_helper;
+   |
 
 error[E0659]: `empty_helper` is ambiguous
   --> $DIR/derive-helper-shadowing.rs:26:13