diff --git a/Cargo.lock b/Cargo.lock
index 856d293d610e4..a62bd618d409c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1925,7 +1925,7 @@ version = "0.1.0"
 dependencies = [
  "fs-err",
  "getopts",
- "jsonpath_lib",
+ "jsonpath-rust",
  "regex",
  "serde_json",
  "shlex",
@@ -1945,14 +1945,16 @@ dependencies = [
 ]
 
 [[package]]
-name = "jsonpath_lib"
-version = "0.3.0"
+name = "jsonpath-rust"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eaa63191d68230cccb81c5aa23abd53ed64d83337cacbb25a7b8c7979523774f"
+checksum = "9b0231bb404a6cd6c8f0ab41b907049063a089fc02aa7636cc5cd9a4d87364c9"
 dependencies = [
- "log",
- "serde",
+ "pest",
+ "pest_derive",
+ "regex",
  "serde_json",
+ "thiserror 2.0.11",
 ]
 
 [[package]]
@@ -2645,6 +2647,51 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "pest"
+version = "2.7.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc"
+dependencies = [
+ "memchr",
+ "thiserror 2.0.11",
+ "ucd-trie",
+]
+
+[[package]]
+name = "pest_derive"
+version = "2.7.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e"
+dependencies = [
+ "pest",
+ "pest_generator",
+]
+
+[[package]]
+name = "pest_generator"
+version = "2.7.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b"
+dependencies = [
+ "pest",
+ "pest_meta",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.96",
+]
+
+[[package]]
+name = "pest_meta"
+version = "2.7.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea"
+dependencies = [
+ "once_cell",
+ "pest",
+ "sha2",
+]
+
 [[package]]
 name = "phf"
 version = "0.11.3"
@@ -4780,7 +4827,6 @@ version = "1.0.135"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9"
 dependencies = [
- "indexmap",
  "itoa",
  "memchr",
  "ryu",
@@ -5486,6 +5532,12 @@ dependencies = [
  "regex-lite",
 ]
 
+[[package]]
+name = "ucd-trie"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
+
 [[package]]
 name = "ui_test"
 version = "0.28.0"
diff --git a/compiler/rustc_builtin_macros/src/autodiff.rs b/compiler/rustc_builtin_macros/src/autodiff.rs
index dcd3c1ce8d917..6591ed151cf6e 100644
--- a/compiler/rustc_builtin_macros/src/autodiff.rs
+++ b/compiler/rustc_builtin_macros/src/autodiff.rs
@@ -26,6 +26,16 @@ mod llvm_enzyme {
 
     use crate::errors;
 
+    pub(crate) fn outer_normal_attr(
+        kind: &P<rustc_ast::NormalAttr>,
+        id: rustc_ast::AttrId,
+        span: Span,
+    ) -> rustc_ast::Attribute {
+        let style = rustc_ast::AttrStyle::Outer;
+        let kind = rustc_ast::AttrKind::Normal(kind.clone());
+        rustc_ast::Attribute { kind, id, style, span }
+    }
+
     // If we have a default `()` return type or explicitley `()` return type,
     // then we often can skip doing some work.
     fn has_ret(ty: &FnRetTy) -> bool {
@@ -224,20 +234,8 @@ mod llvm_enzyme {
             .filter(|a| **a == DiffActivity::Active || **a == DiffActivity::ActiveOnly)
             .count() as u32;
         let (d_sig, new_args, idents, errored) = gen_enzyme_decl(ecx, &sig, &x, span);
-        let new_decl_span = d_sig.span;
         let d_body = gen_enzyme_body(
-            ecx,
-            &x,
-            n_active,
-            &sig,
-            &d_sig,
-            primal,
-            &new_args,
-            span,
-            sig_span,
-            new_decl_span,
-            idents,
-            errored,
+            ecx, &x, n_active, &sig, &d_sig, primal, &new_args, span, sig_span, idents, errored,
         );
         let d_ident = first_ident(&meta_item_vec[0]);
 
@@ -270,36 +268,39 @@ mod llvm_enzyme {
         };
         let inline_never_attr = P(ast::NormalAttr { item: inline_item, tokens: None });
         let new_id = ecx.sess.psess.attr_id_generator.mk_attr_id();
-        let attr: ast::Attribute = ast::Attribute {
-            kind: ast::AttrKind::Normal(rustc_ad_attr.clone()),
-            id: new_id,
-            style: ast::AttrStyle::Outer,
-            span,
-        };
+        let attr = outer_normal_attr(&rustc_ad_attr, new_id, span);
         let new_id = ecx.sess.psess.attr_id_generator.mk_attr_id();
-        let inline_never: ast::Attribute = ast::Attribute {
-            kind: ast::AttrKind::Normal(inline_never_attr),
-            id: new_id,
-            style: ast::AttrStyle::Outer,
-            span,
-        };
+        let inline_never = outer_normal_attr(&inline_never_attr, new_id, span);
+
+        // We're avoid duplicating the attributes `#[rustc_autodiff]` and `#[inline(never)]`.
+        fn same_attribute(attr: &ast::AttrKind, item: &ast::AttrKind) -> bool {
+            match (attr, item) {
+                (ast::AttrKind::Normal(a), ast::AttrKind::Normal(b)) => {
+                    let a = &a.item.path;
+                    let b = &b.item.path;
+                    a.segments.len() == b.segments.len()
+                        && a.segments.iter().zip(b.segments.iter()).all(|(a, b)| a.ident == b.ident)
+                }
+                _ => false,
+            }
+        }
 
         // Don't add it multiple times:
         let orig_annotatable: Annotatable = match item {
             Annotatable::Item(ref mut iitem) => {
-                if !iitem.attrs.iter().any(|a| a.id == attr.id) {
+                if !iitem.attrs.iter().any(|a| same_attribute(&a.kind, &attr.kind)) {
                     iitem.attrs.push(attr);
                 }
-                if !iitem.attrs.iter().any(|a| a.id == inline_never.id) {
+                if !iitem.attrs.iter().any(|a| same_attribute(&a.kind, &inline_never.kind)) {
                     iitem.attrs.push(inline_never.clone());
                 }
                 Annotatable::Item(iitem.clone())
             }
             Annotatable::AssocItem(ref mut assoc_item, i @ Impl) => {
-                if !assoc_item.attrs.iter().any(|a| a.id == attr.id) {
+                if !assoc_item.attrs.iter().any(|a| same_attribute(&a.kind, &attr.kind)) {
                     assoc_item.attrs.push(attr);
                 }
-                if !assoc_item.attrs.iter().any(|a| a.id == inline_never.id) {
+                if !assoc_item.attrs.iter().any(|a| same_attribute(&a.kind, &inline_never.kind)) {
                     assoc_item.attrs.push(inline_never.clone());
                 }
                 Annotatable::AssocItem(assoc_item.clone(), i)
@@ -314,13 +315,7 @@ mod llvm_enzyme {
             delim: rustc_ast::token::Delimiter::Parenthesis,
             tokens: ts,
         });
-        let d_attr: ast::Attribute = ast::Attribute {
-            kind: ast::AttrKind::Normal(rustc_ad_attr.clone()),
-            id: new_id,
-            style: ast::AttrStyle::Outer,
-            span,
-        };
-
+        let d_attr = outer_normal_attr(&rustc_ad_attr, new_id, span);
         let d_annotatable = if is_impl {
             let assoc_item: AssocItemKind = ast::AssocItemKind::Fn(asdf);
             let d_fn = P(ast::AssocItem {
@@ -361,30 +356,27 @@ mod llvm_enzyme {
         ty
     }
 
-    /// We only want this function to type-check, since we will replace the body
-    /// later on llvm level. Using `loop {}` does not cover all return types anymore,
-    /// so instead we build something that should pass. We also add a inline_asm
-    /// line, as one more barrier for rustc to prevent inlining of this function.
-    /// FIXME(ZuseZ4): We still have cases of incorrect inlining across modules, see
-    /// <https://github.com/EnzymeAD/rust/issues/173>, so this isn't sufficient.
-    /// It also triggers an Enzyme crash if we due to a bug ever try to differentiate
-    /// this function (which should never happen, since it is only a placeholder).
-    /// Finally, we also add back_box usages of all input arguments, to prevent rustc
-    /// from optimizing any arguments away.
-    fn gen_enzyme_body(
+    // Will generate a body of the type:
+    // ```
+    // {
+    //   unsafe {
+    //   asm!("NOP");
+    //   }
+    //   ::core::hint::black_box(primal(args));
+    //   ::core::hint::black_box((args, ret));
+    //   <This part remains to be done by following function>
+    // }
+    // ```
+    fn init_body_helper(
         ecx: &ExtCtxt<'_>,
-        x: &AutoDiffAttrs,
-        n_active: u32,
-        sig: &ast::FnSig,
-        d_sig: &ast::FnSig,
+        span: Span,
         primal: Ident,
         new_names: &[String],
-        span: Span,
         sig_span: Span,
         new_decl_span: Span,
-        idents: Vec<Ident>,
+        idents: &[Ident],
         errored: bool,
-    ) -> P<ast::Block> {
+    ) -> (P<ast::Block>, P<ast::Expr>, P<ast::Expr>, P<ast::Expr>) {
         let blackbox_path = ecx.std_path(&[sym::hint, sym::black_box]);
         let noop = ast::InlineAsm {
             asm_macro: ast::AsmMacro::Asm,
@@ -433,6 +425,51 @@ mod llvm_enzyme {
         }
         body.stmts.push(ecx.stmt_semi(black_box_remaining_args));
 
+        (body, primal_call, black_box_primal_call, blackbox_call_expr)
+    }
+
+    /// We only want this function to type-check, since we will replace the body
+    /// later on llvm level. Using `loop {}` does not cover all return types anymore,
+    /// so instead we manually build something that should pass the type checker.
+    /// We also add a inline_asm line, as one more barrier for rustc to prevent inlining
+    /// or const propagation. inline_asm will also triggers an Enzyme crash if due to another
+    /// bug would ever try to accidentially differentiate this placeholder function body.
+    /// Finally, we also add back_box usages of all input arguments, to prevent rustc
+    /// from optimizing any arguments away.
+    fn gen_enzyme_body(
+        ecx: &ExtCtxt<'_>,
+        x: &AutoDiffAttrs,
+        n_active: u32,
+        sig: &ast::FnSig,
+        d_sig: &ast::FnSig,
+        primal: Ident,
+        new_names: &[String],
+        span: Span,
+        sig_span: Span,
+        idents: Vec<Ident>,
+        errored: bool,
+    ) -> P<ast::Block> {
+        let new_decl_span = d_sig.span;
+
+        // Just adding some default inline-asm and black_box usages to prevent early inlining
+        // and optimizations which alter the function signature.
+        //
+        // The bb_primal_call is the black_box call of the primal function. We keep it around,
+        // since it has the convenient property of returning the type of the primal function,
+        // Remember, we only care to match types here.
+        // No matter which return we pick, we always wrap it into a std::hint::black_box call,
+        // to prevent rustc from propagating it into the caller.
+        let (mut body, primal_call, bb_primal_call, bb_call_expr) = init_body_helper(
+            ecx,
+            span,
+            primal,
+            new_names,
+            sig_span,
+            new_decl_span,
+            &idents,
+            errored,
+        );
+
         if !has_ret(&d_sig.decl.output) {
             // there is no return type that we have to match, () works fine.
             return body;
@@ -444,7 +481,7 @@ mod llvm_enzyme {
 
         if primal_ret && n_active == 0 && x.mode.is_rev() {
             // We only have the primal ret.
-            body.stmts.push(ecx.stmt_expr(black_box_primal_call));
+            body.stmts.push(ecx.stmt_expr(bb_primal_call));
             return body;
         }
 
@@ -536,11 +573,11 @@ mod llvm_enzyme {
                 return body;
             }
             [arg] => {
-                ret = ecx.expr_call(new_decl_span, blackbox_call_expr, thin_vec![arg.clone()]);
+                ret = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![arg.clone()]);
             }
             args => {
                 let ret_tuple: P<ast::Expr> = ecx.expr_tuple(span, args.into());
-                ret = ecx.expr_call(new_decl_span, blackbox_call_expr, thin_vec![ret_tuple]);
+                ret = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![ret_tuple]);
             }
         }
         assert!(has_ret(&d_sig.decl.output));
@@ -553,7 +590,7 @@ mod llvm_enzyme {
         ecx: &ExtCtxt<'_>,
         span: Span,
         primal: Ident,
-        idents: Vec<Ident>,
+        idents: &[Ident],
     ) -> P<ast::Expr> {
         let has_self = idents.len() > 0 && idents[0].name == kw::SelfLower;
         if has_self {
diff --git a/compiler/rustc_codegen_llvm/src/builder/autodiff.rs b/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
index 71705ecb4d0f5..7cd4ee539d875 100644
--- a/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
+++ b/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
@@ -28,6 +28,113 @@ fn get_params(fnc: &Value) -> Vec<&Value> {
     }
 }
 
+fn match_args_from_caller_to_enzyme<'ll>(
+    cx: &SimpleCx<'ll>,
+    args: &mut Vec<&'ll llvm::Value>,
+    inputs: &[DiffActivity],
+    outer_args: &[&'ll llvm::Value],
+) {
+    debug!("matching autodiff arguments");
+    // We now handle the issue that Rust level arguments not always match the llvm-ir level
+    // arguments. A slice, `&[f32]`, for example, is represented as a pointer and a length on
+    // llvm-ir level. The number of activities matches the number of Rust level arguments, so we
+    // need to match those.
+    // FIXME(ZuseZ4): This logic is a bit more complicated than it should be, can we simplify it
+    // using iterators and peek()?
+    let mut outer_pos: usize = 0;
+    let mut activity_pos = 0;
+
+    let enzyme_const = cx.create_metadata("enzyme_const".to_string()).unwrap();
+    let enzyme_out = cx.create_metadata("enzyme_out".to_string()).unwrap();
+    let enzyme_dup = cx.create_metadata("enzyme_dup".to_string()).unwrap();
+    let enzyme_dupnoneed = cx.create_metadata("enzyme_dupnoneed".to_string()).unwrap();
+
+    while activity_pos < inputs.len() {
+        let diff_activity = inputs[activity_pos as usize];
+        // Duplicated arguments received a shadow argument, into which enzyme will write the
+        // gradient.
+        let (activity, duplicated): (&Metadata, bool) = match diff_activity {
+            DiffActivity::None => panic!("not a valid input activity"),
+            DiffActivity::Const => (enzyme_const, false),
+            DiffActivity::Active => (enzyme_out, false),
+            DiffActivity::ActiveOnly => (enzyme_out, false),
+            DiffActivity::Dual => (enzyme_dup, true),
+            DiffActivity::DualOnly => (enzyme_dupnoneed, true),
+            DiffActivity::Duplicated => (enzyme_dup, true),
+            DiffActivity::DuplicatedOnly => (enzyme_dupnoneed, true),
+            DiffActivity::FakeActivitySize => (enzyme_const, false),
+        };
+        let outer_arg = outer_args[outer_pos];
+        args.push(cx.get_metadata_value(activity));
+        args.push(outer_arg);
+        if duplicated {
+            // We know that duplicated args by construction have a following argument,
+            // so this can not be out of bounds.
+            let next_outer_arg = outer_args[outer_pos + 1];
+            let next_outer_ty = cx.val_ty(next_outer_arg);
+            // FIXME(ZuseZ4): We should add support for Vec here too, but it's less urgent since
+            // vectors behind references (&Vec<T>) are already supported. Users can not pass a
+            // Vec by value for reverse mode, so this would only help forward mode autodiff.
+            let slice = {
+                if activity_pos + 1 >= inputs.len() {
+                    // If there is no arg following our ptr, it also can't be a slice,
+                    // since that would lead to a ptr, int pair.
+                    false
+                } else {
+                    let next_activity = inputs[activity_pos + 1];
+                    // We analyze the MIR types and add this dummy activity if we visit a slice.
+                    next_activity == DiffActivity::FakeActivitySize
+                }
+            };
+            if slice {
+                // A duplicated slice will have the following two outer_fn arguments:
+                // (..., ptr1, int1, ptr2, int2, ...). We add the following llvm-ir to our __enzyme call:
+                // (..., metadata! enzyme_dup, ptr, ptr, int1, ...).
+                // FIXME(ZuseZ4): We will upstream a safety check later which asserts that
+                // int2 >= int1, which means the shadow vector is large enough to store the gradient.
+                assert!(unsafe {
+                    llvm::LLVMRustGetTypeKind(next_outer_ty) == llvm::TypeKind::Integer
+                });
+                let next_outer_arg2 = outer_args[outer_pos + 2];
+                let next_outer_ty2 = cx.val_ty(next_outer_arg2);
+                assert!(unsafe {
+                    llvm::LLVMRustGetTypeKind(next_outer_ty2) == llvm::TypeKind::Pointer
+                });
+                let next_outer_arg3 = outer_args[outer_pos + 3];
+                let next_outer_ty3 = cx.val_ty(next_outer_arg3);
+                assert!(unsafe {
+                    llvm::LLVMRustGetTypeKind(next_outer_ty3) == llvm::TypeKind::Integer
+                });
+                args.push(next_outer_arg2);
+                args.push(cx.get_metadata_value(enzyme_const));
+                args.push(next_outer_arg);
+                outer_pos += 4;
+                activity_pos += 2;
+            } else {
+                // A duplicated pointer will have the following two outer_fn arguments:
+                // (..., ptr, ptr, ...). We add the following llvm-ir to our __enzyme call:
+                // (..., metadata! enzyme_dup, ptr, ptr, ...).
+                if matches!(diff_activity, DiffActivity::Duplicated | DiffActivity::DuplicatedOnly)
+                {
+                    assert!(
+                        unsafe { llvm::LLVMRustGetTypeKind(next_outer_ty) }
+                            == llvm::TypeKind::Pointer
+                    );
+                }
+                // In the case of Dual we don't have assumptions, e.g. f32 would be valid.
+                args.push(next_outer_arg);
+                outer_pos += 2;
+                activity_pos += 1;
+            }
+        } else {
+            // We do not differentiate with resprect to this argument.
+            // We already added the metadata and argument above, so just increase the counters.
+            outer_pos += 1;
+            activity_pos += 1;
+        }
+    }
+}
+
 /// When differentiating `fn_to_diff`, take a `outer_fn` and generate another
 /// function with expected naming and calling conventions[^1] which will be
 /// discovered by the enzyme LLVM pass and its body populated with the differentiated
@@ -43,9 +150,6 @@ fn generate_enzyme_call<'ll>(
     outer_fn: &'ll Value,
     attrs: AutoDiffAttrs,
 ) {
-    let inputs = attrs.input_activity;
-    let output = attrs.ret_activity;
-
     // We have to pick the name depending on whether we want forward or reverse mode autodiff.
     let mut ad_name: String = match attrs.mode {
         DiffMode::Forward => "__enzyme_fwddiff",
@@ -132,111 +236,13 @@ fn generate_enzyme_call<'ll>(
         let mut args = Vec::with_capacity(num_args as usize + 1);
         args.push(fn_to_diff);
 
-        let enzyme_const = cx.create_metadata("enzyme_const".to_string()).unwrap();
-        let enzyme_out = cx.create_metadata("enzyme_out".to_string()).unwrap();
-        let enzyme_dup = cx.create_metadata("enzyme_dup".to_string()).unwrap();
-        let enzyme_dupnoneed = cx.create_metadata("enzyme_dupnoneed".to_string()).unwrap();
         let enzyme_primal_ret = cx.create_metadata("enzyme_primal_return".to_string()).unwrap();
-
-        match output {
-            DiffActivity::Dual => {
-                args.push(cx.get_metadata_value(enzyme_primal_ret));
-            }
-            DiffActivity::Active => {
-                args.push(cx.get_metadata_value(enzyme_primal_ret));
-            }
-            _ => {}
+        if matches!(attrs.ret_activity, DiffActivity::Dual | DiffActivity::Active) {
+            args.push(cx.get_metadata_value(enzyme_primal_ret));
         }
 
-        debug!("matching autodiff arguments");
-        // We now handle the issue that Rust level arguments not always match the llvm-ir level
-        // arguments. A slice, `&[f32]`, for example, is represented as a pointer and a length on
-        // llvm-ir level. The number of activities matches the number of Rust level arguments, so we
-        // need to match those.
-        // FIXME(ZuseZ4): This logic is a bit more complicated than it should be, can we simplify it
-        // using iterators and peek()?
-        let mut outer_pos: usize = 0;
-        let mut activity_pos = 0;
         let outer_args: Vec<&llvm::Value> = get_params(outer_fn);
-        while activity_pos < inputs.len() {
-            let diff_activity = inputs[activity_pos as usize];
-            // Duplicated arguments received a shadow argument, into which enzyme will write the
-            // gradient.
-            let (activity, duplicated): (&Metadata, bool) = match diff_activity {
-                DiffActivity::None => panic!("not a valid input activity"),
-                DiffActivity::Const => (enzyme_const, false),
-                DiffActivity::Active => (enzyme_out, false),
-                DiffActivity::ActiveOnly => (enzyme_out, false),
-                DiffActivity::Dual => (enzyme_dup, true),
-                DiffActivity::DualOnly => (enzyme_dupnoneed, true),
-                DiffActivity::Duplicated => (enzyme_dup, true),
-                DiffActivity::DuplicatedOnly => (enzyme_dupnoneed, true),
-                DiffActivity::FakeActivitySize => (enzyme_const, false),
-            };
-            let outer_arg = outer_args[outer_pos];
-            args.push(cx.get_metadata_value(activity));
-            args.push(outer_arg);
-            if duplicated {
-                // We know that duplicated args by construction have a following argument,
-                // so this can not be out of bounds.
-                let next_outer_arg = outer_args[outer_pos + 1];
-                let next_outer_ty = cx.val_ty(next_outer_arg);
-                // FIXME(ZuseZ4): We should add support for Vec here too, but it's less urgent since
-                // vectors behind references (&Vec<T>) are already supported. Users can not pass a
-                // Vec by value for reverse mode, so this would only help forward mode autodiff.
-                let slice = {
-                    if activity_pos + 1 >= inputs.len() {
-                        // If there is no arg following our ptr, it also can't be a slice,
-                        // since that would lead to a ptr, int pair.
-                        false
-                    } else {
-                        let next_activity = inputs[activity_pos + 1];
-                        // We analyze the MIR types and add this dummy activity if we visit a slice.
-                        next_activity == DiffActivity::FakeActivitySize
-                    }
-                };
-                if slice {
-                    // A duplicated slice will have the following two outer_fn arguments:
-                    // (..., ptr1, int1, ptr2, int2, ...). We add the following llvm-ir to our __enzyme call:
-                    // (..., metadata! enzyme_dup, ptr, ptr, int1, ...).
-                    // FIXME(ZuseZ4): We will upstream a safety check later which asserts that
-                    // int2 >= int1, which means the shadow vector is large enough to store the gradient.
-                    assert!(llvm::LLVMRustGetTypeKind(next_outer_ty) == llvm::TypeKind::Integer);
-                    let next_outer_arg2 = outer_args[outer_pos + 2];
-                    let next_outer_ty2 = cx.val_ty(next_outer_arg2);
-                    assert!(llvm::LLVMRustGetTypeKind(next_outer_ty2) == llvm::TypeKind::Pointer);
-                    let next_outer_arg3 = outer_args[outer_pos + 3];
-                    let next_outer_ty3 = cx.val_ty(next_outer_arg3);
-                    assert!(llvm::LLVMRustGetTypeKind(next_outer_ty3) == llvm::TypeKind::Integer);
-                    args.push(next_outer_arg2);
-                    args.push(cx.get_metadata_value(enzyme_const));
-                    args.push(next_outer_arg);
-                    outer_pos += 4;
-                    activity_pos += 2;
-                } else {
-                    // A duplicated pointer will have the following two outer_fn arguments:
-                    // (..., ptr, ptr, ...). We add the following llvm-ir to our __enzyme call:
-                    // (..., metadata! enzyme_dup, ptr, ptr, ...).
-                    if matches!(
-                        diff_activity,
-                        DiffActivity::Duplicated | DiffActivity::DuplicatedOnly
-                    ) {
-                        assert!(
-                            llvm::LLVMRustGetTypeKind(next_outer_ty) == llvm::TypeKind::Pointer
-                        );
-                    }
-                    // In the case of Dual we don't have assumptions, e.g. f32 would be valid.
-                    args.push(next_outer_arg);
-                    outer_pos += 2;
-                    activity_pos += 1;
-                }
-            } else {
-                // We do not differentiate with resprect to this argument.
-                // We already added the metadata and argument above, so just increase the counters.
-                outer_pos += 1;
-                activity_pos += 1;
-            }
-        }
+        match_args_from_caller_to_enzyme(&cx, &mut args, &attrs.input_activity, &outer_args);
 
         let call = builder.call(enzyme_ty, ad_fn, &args, None);
 
diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
index d5972b5c9e649..d16d4ed228389 100644
--- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
+++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
@@ -790,16 +790,10 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
 
     // check for exactly one autodiff attribute on placeholder functions.
     // There should only be one, since we generate a new placeholder per ad macro.
-    // FIXME(ZuseZ4): re-enable this check. Currently we add multiple, which doesn't cause harm but
-    // looks strange e.g. under cargo-expand.
     let attr = match &attrs[..] {
         [] => return None,
         [attr] => attr,
-        // These two attributes are the same and unfortunately duplicated due to a previous bug.
-        [attr, _attr2] => attr,
         _ => {
-            //FIXME(ZuseZ4): Once we fixed our parser, we should also prohibit the two-attribute
-            //branch above.
             span_bug!(attrs[1].span(), "cg_ssa: rustc_autodiff should only exist once per source");
         }
     };
diff --git a/compiler/rustc_middle/src/hir/map.rs b/compiler/rustc_middle/src/hir/map.rs
index f17efab81ec53..52f155a16b868 100644
--- a/compiler/rustc_middle/src/hir/map.rs
+++ b/compiler/rustc_middle/src/hir/map.rs
@@ -1176,15 +1176,14 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, _: LocalCrate) -> Svh {
         debugger_visualizers.hash_stable(&mut hcx, &mut stable_hasher);
         if tcx.sess.opts.incremental.is_some() {
             let definitions = tcx.untracked().definitions.freeze();
-            let mut owner_spans: Vec<_> = krate
-                .owners
-                .iter_enumerated()
-                .filter_map(|(def_id, info)| {
-                    let _ = info.as_owner()?;
+            let mut owner_spans: Vec<_> = tcx
+                .hir_crate_items(())
+                .definitions()
+                .map(|def_id| {
                     let def_path_hash = definitions.def_path_hash(def_id);
                     let span = tcx.source_span(def_id);
                     debug_assert_eq!(span.parent(), None);
-                    Some((def_path_hash, span))
+                    (def_path_hash, span)
                 })
                 .collect();
             owner_spans.sort_unstable_by_key(|bn| bn.0);
diff --git a/compiler/rustc_mir_build/src/builder/expr/as_constant.rs b/compiler/rustc_mir_build/src/builder/expr/as_constant.rs
index f743ea60a456c..64d092e035451 100644
--- a/compiler/rustc_mir_build/src/builder/expr/as_constant.rs
+++ b/compiler/rustc_mir_build/src/builder/expr/as_constant.rs
@@ -105,23 +105,19 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx>
         return Const::Ty(Ty::new_error(tcx, guar), ty::Const::new_error(tcx, guar));
     }
 
-    let trunc = |n, width: ty::UintTy| {
-        let width = width
-            .normalize(tcx.data_layout.pointer_size.bits().try_into().unwrap())
-            .bit_width()
-            .unwrap();
-        let width = Size::from_bits(width);
+    let lit_ty = match *ty.kind() {
+        ty::Pat(base, _) => base,
+        _ => ty,
+    };
+
+    let trunc = |n| {
+        let width = lit_ty.primitive_size(tcx);
         trace!("trunc {} with size {} and shift {}", n, width.bits(), 128 - width.bits());
         let result = width.truncate(n);
         trace!("trunc result: {}", result);
         ConstValue::Scalar(Scalar::from_uint(result, width))
     };
 
-    let lit_ty = match *ty.kind() {
-        ty::Pat(base, _) => base,
-        _ => ty,
-    };
-
     let value = match (lit, lit_ty.kind()) {
         (ast::LitKind::Str(s, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_str() => {
             let s = s.as_str();
@@ -149,11 +145,10 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx>
         (ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => {
             ConstValue::Scalar(Scalar::from_uint(*n, Size::from_bytes(1)))
         }
-        (ast::LitKind::Int(n, _), ty::Uint(ui)) if !neg => trunc(n.get(), *ui),
-        (ast::LitKind::Int(n, _), ty::Int(i)) => trunc(
-            if neg { (n.get() as i128).overflowing_neg().0 as u128 } else { n.get() },
-            i.to_unsigned(),
-        ),
+        (ast::LitKind::Int(n, _), ty::Uint(_)) if !neg => trunc(n.get()),
+        (ast::LitKind::Int(n, _), ty::Int(_)) => {
+            trunc(if neg { (n.get() as i128).overflowing_neg().0 as u128 } else { n.get() })
+        }
         (ast::LitKind::Float(n, _), ty::Float(fty)) => {
             parse_float_into_constval(*n, *fty, neg).unwrap()
         }
diff --git a/compiler/rustc_mir_build/src/builder/scope.rs b/compiler/rustc_mir_build/src/builder/scope.rs
index 27ff01b48034b..e56c0ae92cac6 100644
--- a/compiler/rustc_mir_build/src/builder/scope.rs
+++ b/compiler/rustc_mir_build/src/builder/scope.rs
@@ -305,27 +305,25 @@ impl DropTree {
     }
 
     /// Builds the MIR for a given drop tree.
-    ///
-    /// `blocks` should have the same length as `self.drops`, and may have its
-    /// first value set to some already existing block.
     fn build_mir<'tcx, T: DropTreeBuilder<'tcx>>(
         &mut self,
         cfg: &mut CFG<'tcx>,
-        blocks: &mut IndexVec<DropIdx, Option<BasicBlock>>,
-    ) {
+        root_node: Option<BasicBlock>,
+    ) -> IndexVec<DropIdx, Option<BasicBlock>> {
         debug!("DropTree::build_mir(drops = {:#?})", self);
-        assert_eq!(blocks.len(), self.drops.len());
 
-        self.assign_blocks::<T>(cfg, blocks);
-        self.link_blocks(cfg, blocks)
+        let mut blocks = self.assign_blocks::<T>(cfg, root_node);
+        self.link_blocks(cfg, &mut blocks);
+
+        blocks
     }
 
     /// Assign blocks for all of the drops in the drop tree that need them.
     fn assign_blocks<'tcx, T: DropTreeBuilder<'tcx>>(
         &mut self,
         cfg: &mut CFG<'tcx>,
-        blocks: &mut IndexVec<DropIdx, Option<BasicBlock>>,
-    ) {
+        root_node: Option<BasicBlock>,
+    ) -> IndexVec<DropIdx, Option<BasicBlock>> {
         // StorageDead statements can share blocks with each other and also with
         // a Drop terminator. We iterate through the drops to find which drops
         // need their own block.
@@ -342,8 +340,11 @@ impl DropTree {
             Own,
         }
 
+        let mut blocks = IndexVec::from_elem(None, &self.drops);
+        blocks[ROOT_NODE] = root_node;
+
         let mut needs_block = IndexVec::from_elem(Block::None, &self.drops);
-        if blocks[ROOT_NODE].is_some() {
+        if root_node.is_some() {
             // In some cases (such as drops for `continue`) the root node
             // already has a block. In this case, make sure that we don't
             // override it.
@@ -385,6 +386,8 @@ impl DropTree {
 
         debug!("assign_blocks: blocks = {:#?}", blocks);
         assert!(entry_points.is_empty());
+
+        blocks
     }
 
     fn link_blocks<'tcx>(
@@ -1574,10 +1577,7 @@ impl<'a, 'tcx: 'a> Builder<'a, 'tcx> {
         span: Span,
         continue_block: Option<BasicBlock>,
     ) -> Option<BlockAnd<()>> {
-        let mut blocks = IndexVec::from_elem(None, &drops.drops);
-        blocks[ROOT_NODE] = continue_block;
-
-        drops.build_mir::<ExitScopes>(&mut self.cfg, &mut blocks);
+        let blocks = drops.build_mir::<ExitScopes>(&mut self.cfg, continue_block);
         let is_coroutine = self.coroutine.is_some();
 
         // Link the exit drop tree to unwind drop tree.
@@ -1633,8 +1633,7 @@ impl<'a, 'tcx: 'a> Builder<'a, 'tcx> {
         let drops = &mut self.scopes.coroutine_drops;
         let cfg = &mut self.cfg;
         let fn_span = self.fn_span;
-        let mut blocks = IndexVec::from_elem(None, &drops.drops);
-        drops.build_mir::<CoroutineDrop>(cfg, &mut blocks);
+        let blocks = drops.build_mir::<CoroutineDrop>(cfg, None);
         if let Some(root_block) = blocks[ROOT_NODE] {
             cfg.terminate(
                 root_block,
@@ -1670,9 +1669,7 @@ impl<'a, 'tcx: 'a> Builder<'a, 'tcx> {
         fn_span: Span,
         resume_block: &mut Option<BasicBlock>,
     ) {
-        let mut blocks = IndexVec::from_elem(None, &drops.drops);
-        blocks[ROOT_NODE] = *resume_block;
-        drops.build_mir::<Unwind>(cfg, &mut blocks);
+        let blocks = drops.build_mir::<Unwind>(cfg, *resume_block);
         if let (None, Some(resume)) = (*resume_block, blocks[ROOT_NODE]) {
             cfg.terminate(resume, SourceInfo::outermost(fn_span), TerminatorKind::UnwindResume);
 
diff --git a/compiler/stable_mir/src/mir.rs b/compiler/stable_mir/src/mir.rs
index 82555461d644e..413b5152bb3b3 100644
--- a/compiler/stable_mir/src/mir.rs
+++ b/compiler/stable_mir/src/mir.rs
@@ -5,4 +5,4 @@ pub mod pretty;
 pub mod visit;
 
 pub use body::*;
-pub use visit::MirVisitor;
+pub use visit::{MirVisitor, MutMirVisitor};
diff --git a/compiler/stable_mir/src/mir/body.rs b/compiler/stable_mir/src/mir/body.rs
index f8b46f50a5298..b1bf7bce828c3 100644
--- a/compiler/stable_mir/src/mir/body.rs
+++ b/compiler/stable_mir/src/mir/body.rs
@@ -77,6 +77,22 @@ impl Body {
         &self.locals[self.arg_count + 1..]
     }
 
+    /// Returns a mutable reference to the local that holds this function's return value.
+    pub(crate) fn ret_local_mut(&mut self) -> &mut LocalDecl {
+        &mut self.locals[RETURN_LOCAL]
+    }
+
+    /// Returns a mutable slice of locals corresponding to this function's arguments.
+    pub(crate) fn arg_locals_mut(&mut self) -> &mut [LocalDecl] {
+        &mut self.locals[1..][..self.arg_count]
+    }
+
+    /// Returns a mutable slice of inner locals for this function.
+    /// Inner locals are those that are neither the return local nor the argument locals.
+    pub(crate) fn inner_locals_mut(&mut self) -> &mut [LocalDecl] {
+        &mut self.locals[self.arg_count + 1..]
+    }
+
     /// Convenience function to get all the locals in this function.
     ///
     /// Locals are typically accessed via the more specific methods `ret_local`,
diff --git a/compiler/stable_mir/src/mir/visit.rs b/compiler/stable_mir/src/mir/visit.rs
index d985a98fcbf01..09447e70dfb18 100644
--- a/compiler/stable_mir/src/mir/visit.rs
+++ b/compiler/stable_mir/src/mir/visit.rs
@@ -39,406 +39,486 @@ use crate::mir::*;
 use crate::ty::{GenericArgs, MirConst, Region, Ty, TyConst};
 use crate::{Error, Opaque, Span};
 
-pub trait MirVisitor {
-    fn visit_body(&mut self, body: &Body) {
-        self.super_body(body)
-    }
-
-    fn visit_basic_block(&mut self, bb: &BasicBlock) {
-        self.super_basic_block(bb)
-    }
-
-    fn visit_ret_decl(&mut self, local: Local, decl: &LocalDecl) {
-        self.super_ret_decl(local, decl)
-    }
-
-    fn visit_arg_decl(&mut self, local: Local, decl: &LocalDecl) {
-        self.super_arg_decl(local, decl)
-    }
-
-    fn visit_local_decl(&mut self, local: Local, decl: &LocalDecl) {
-        self.super_local_decl(local, decl)
-    }
-
-    fn visit_statement(&mut self, stmt: &Statement, location: Location) {
-        self.super_statement(stmt, location)
-    }
-
-    fn visit_terminator(&mut self, term: &Terminator, location: Location) {
-        self.super_terminator(term, location)
-    }
-
-    fn visit_span(&mut self, span: &Span) {
-        self.super_span(span)
-    }
+macro_rules! make_mir_visitor {
+    ($visitor_trait_name:ident, $($mutability:ident)?) => {
+        pub trait $visitor_trait_name {
+            fn visit_body(&mut self, body: &$($mutability)? Body) {
+                self.super_body(body)
+            }
 
-    fn visit_place(&mut self, place: &Place, ptx: PlaceContext, location: Location) {
-        self.super_place(place, ptx, location)
-    }
+            fn visit_basic_block(&mut self, bb: &$($mutability)? BasicBlock) {
+                self.super_basic_block(bb)
+            }
 
-    fn visit_projection_elem(
-        &mut self,
-        place_ref: PlaceRef<'_>,
-        elem: &ProjectionElem,
-        ptx: PlaceContext,
-        location: Location,
-    ) {
-        let _ = place_ref;
-        self.super_projection_elem(elem, ptx, location);
-    }
+            fn visit_ret_decl(&mut self, local: Local, decl: &$($mutability)? LocalDecl) {
+                self.super_ret_decl(local, decl)
+            }
 
-    fn visit_local(&mut self, local: &Local, ptx: PlaceContext, location: Location) {
-        let _ = (local, ptx, location);
-    }
+            fn visit_arg_decl(&mut self, local: Local, decl: &$($mutability)? LocalDecl) {
+                self.super_arg_decl(local, decl)
+            }
 
-    fn visit_rvalue(&mut self, rvalue: &Rvalue, location: Location) {
-        self.super_rvalue(rvalue, location)
-    }
+            fn visit_local_decl(&mut self, local: Local, decl: &$($mutability)? LocalDecl) {
+                self.super_local_decl(local, decl)
+            }
 
-    fn visit_operand(&mut self, operand: &Operand, location: Location) {
-        self.super_operand(operand, location)
-    }
+            fn visit_statement(&mut self, stmt: &$($mutability)? Statement, location: Location) {
+                self.super_statement(stmt, location)
+            }
 
-    fn visit_user_type_projection(&mut self, projection: &UserTypeProjection) {
-        self.super_user_type_projection(projection)
-    }
+            fn visit_terminator(&mut self, term: &$($mutability)? Terminator, location: Location) {
+                self.super_terminator(term, location)
+            }
 
-    fn visit_ty(&mut self, ty: &Ty, location: Location) {
-        let _ = location;
-        self.super_ty(ty)
-    }
+            fn visit_span(&mut self, span: &$($mutability)? Span) {
+                self.super_span(span)
+            }
 
-    fn visit_const_operand(&mut self, constant: &ConstOperand, location: Location) {
-        self.super_const_operand(constant, location)
-    }
+            fn visit_place(&mut self, place: &$($mutability)? Place, ptx: PlaceContext, location: Location) {
+                self.super_place(place, ptx, location)
+            }
 
-    fn visit_mir_const(&mut self, constant: &MirConst, location: Location) {
-        self.super_mir_const(constant, location)
-    }
+            visit_place_fns!($($mutability)?);
 
-    fn visit_ty_const(&mut self, constant: &TyConst, location: Location) {
-        let _ = location;
-        self.super_ty_const(constant)
-    }
+            fn visit_local(&mut self, local: &$($mutability)? Local, ptx: PlaceContext, location: Location) {
+                let _ = (local, ptx, location);
+            }
 
-    fn visit_region(&mut self, region: &Region, location: Location) {
-        let _ = location;
-        self.super_region(region)
-    }
+            fn visit_rvalue(&mut self, rvalue: &$($mutability)? Rvalue, location: Location) {
+                self.super_rvalue(rvalue, location)
+            }
 
-    fn visit_args(&mut self, args: &GenericArgs, location: Location) {
-        let _ = location;
-        self.super_args(args)
-    }
+            fn visit_operand(&mut self, operand: &$($mutability)? Operand, location: Location) {
+                self.super_operand(operand, location)
+            }
 
-    fn visit_assert_msg(&mut self, msg: &AssertMessage, location: Location) {
-        self.super_assert_msg(msg, location)
-    }
+            fn visit_user_type_projection(&mut self, projection: &$($mutability)? UserTypeProjection) {
+                self.super_user_type_projection(projection)
+            }
 
-    fn visit_var_debug_info(&mut self, var_debug_info: &VarDebugInfo) {
-        self.super_var_debug_info(var_debug_info);
-    }
+            fn visit_ty(&mut self, ty: &$($mutability)? Ty, location: Location) {
+                let _ = location;
+                self.super_ty(ty)
+            }
 
-    fn super_body(&mut self, body: &Body) {
-        let Body { blocks, locals: _, arg_count, var_debug_info, spread_arg: _, span } = body;
+            fn visit_const_operand(&mut self, constant: &$($mutability)? ConstOperand, location: Location) {
+                self.super_const_operand(constant, location)
+            }
 
-        for bb in blocks {
-            self.visit_basic_block(bb);
-        }
+            fn visit_mir_const(&mut self, constant: &$($mutability)? MirConst, location: Location) {
+                self.super_mir_const(constant, location)
+            }
 
-        self.visit_ret_decl(RETURN_LOCAL, body.ret_local());
+            fn visit_ty_const(&mut self, constant: &$($mutability)? TyConst, location: Location) {
+                let _ = location;
+                self.super_ty_const(constant)
+            }
 
-        for (idx, arg) in body.arg_locals().iter().enumerate() {
-            self.visit_arg_decl(idx + 1, arg)
-        }
+            fn visit_region(&mut self, region: &$($mutability)? Region, location: Location) {
+                let _ = location;
+                self.super_region(region)
+            }
 
-        let local_start = arg_count + 1;
-        for (idx, arg) in body.inner_locals().iter().enumerate() {
-            self.visit_local_decl(idx + local_start, arg)
-        }
+            fn visit_args(&mut self, args: &$($mutability)? GenericArgs, location: Location) {
+                let _ = location;
+                self.super_args(args)
+            }
 
-        for info in var_debug_info.iter() {
-            self.visit_var_debug_info(info);
-        }
+            fn visit_assert_msg(&mut self, msg: &$($mutability)? AssertMessage, location: Location) {
+                self.super_assert_msg(msg, location)
+            }
 
-        self.visit_span(span)
-    }
+            fn visit_var_debug_info(&mut self, var_debug_info: &$($mutability)? VarDebugInfo) {
+                self.super_var_debug_info(var_debug_info);
+            }
 
-    fn super_basic_block(&mut self, bb: &BasicBlock) {
-        let BasicBlock { statements, terminator } = bb;
-        for stmt in statements {
-            self.visit_statement(stmt, Location(stmt.span));
-        }
-        self.visit_terminator(terminator, Location(terminator.span));
-    }
+            fn super_body(&mut self, body: &$($mutability)? Body) {
+                super_body!(self, body, $($mutability)?);
+            }
 
-    fn super_local_decl(&mut self, local: Local, decl: &LocalDecl) {
-        let _ = local;
-        let LocalDecl { ty, span, .. } = decl;
-        self.visit_ty(ty, Location(*span));
-    }
+            fn super_basic_block(&mut self, bb: &$($mutability)? BasicBlock) {
+                let BasicBlock { statements, terminator } = bb;
+                for stmt in statements {
+                    self.visit_statement(stmt, Location(stmt.span));
+                }
+                self.visit_terminator(terminator, Location(terminator.span));
+            }
 
-    fn super_ret_decl(&mut self, local: Local, decl: &LocalDecl) {
-        self.super_local_decl(local, decl)
-    }
+            fn super_local_decl(&mut self, local: Local, decl: &$($mutability)? LocalDecl) {
+                let _ = local;
+                let LocalDecl { ty, span, .. } = decl;
+                self.visit_ty(ty, Location(*span));
+            }
 
-    fn super_arg_decl(&mut self, local: Local, decl: &LocalDecl) {
-        self.super_local_decl(local, decl)
-    }
+            fn super_ret_decl(&mut self, local: Local, decl: &$($mutability)? LocalDecl) {
+                self.super_local_decl(local, decl)
+            }
 
-    fn super_statement(&mut self, stmt: &Statement, location: Location) {
-        let Statement { kind, span } = stmt;
-        self.visit_span(span);
-        match kind {
-            StatementKind::Assign(place, rvalue) => {
-                self.visit_place(place, PlaceContext::MUTATING, location);
-                self.visit_rvalue(rvalue, location);
-            }
-            StatementKind::FakeRead(_, place) | StatementKind::PlaceMention(place) => {
-                self.visit_place(place, PlaceContext::NON_MUTATING, location);
-            }
-            StatementKind::SetDiscriminant { place, .. }
-            | StatementKind::Deinit(place)
-            | StatementKind::Retag(_, place) => {
-                self.visit_place(place, PlaceContext::MUTATING, location);
-            }
-            StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => {
-                self.visit_local(local, PlaceContext::NON_USE, location);
-            }
-            StatementKind::AscribeUserType { place, projections, variance: _ } => {
-                self.visit_place(place, PlaceContext::NON_USE, location);
-                self.visit_user_type_projection(projections);
-            }
-            StatementKind::Coverage(coverage) => visit_opaque(coverage),
-            StatementKind::Intrinsic(intrisic) => match intrisic {
-                NonDivergingIntrinsic::Assume(operand) => {
-                    self.visit_operand(operand, location);
-                }
-                NonDivergingIntrinsic::CopyNonOverlapping(CopyNonOverlapping {
-                    src,
-                    dst,
-                    count,
-                }) => {
-                    self.visit_operand(src, location);
-                    self.visit_operand(dst, location);
-                    self.visit_operand(count, location);
-                }
-            },
-            StatementKind::ConstEvalCounter | StatementKind::Nop => {}
-        }
-    }
+            fn super_arg_decl(&mut self, local: Local, decl: &$($mutability)? LocalDecl) {
+                self.super_local_decl(local, decl)
+            }
 
-    fn super_terminator(&mut self, term: &Terminator, location: Location) {
-        let Terminator { kind, span } = term;
-        self.visit_span(span);
-        match kind {
-            TerminatorKind::Goto { .. }
-            | TerminatorKind::Resume
-            | TerminatorKind::Abort
-            | TerminatorKind::Unreachable => {}
-            TerminatorKind::Assert { cond, expected: _, msg, target: _, unwind: _ } => {
-                self.visit_operand(cond, location);
-                self.visit_assert_msg(msg, location);
-            }
-            TerminatorKind::Drop { place, target: _, unwind: _ } => {
-                self.visit_place(place, PlaceContext::MUTATING, location);
-            }
-            TerminatorKind::Call { func, args, destination, target: _, unwind: _ } => {
-                self.visit_operand(func, location);
-                for arg in args {
-                    self.visit_operand(arg, location);
+            fn super_statement(&mut self, stmt: &$($mutability)? Statement, location: Location) {
+                let Statement { kind, span } = stmt;
+                self.visit_span(span);
+                match kind {
+                    StatementKind::Assign(place, rvalue) => {
+                        self.visit_place(place, PlaceContext::MUTATING, location);
+                        self.visit_rvalue(rvalue, location);
+                    }
+                    StatementKind::FakeRead(_, place) | StatementKind::PlaceMention(place) => {
+                        self.visit_place(place, PlaceContext::NON_MUTATING, location);
+                    }
+                    StatementKind::SetDiscriminant { place, .. }
+                    | StatementKind::Deinit(place)
+                    | StatementKind::Retag(_, place) => {
+                        self.visit_place(place, PlaceContext::MUTATING, location);
+                    }
+                    StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => {
+                        self.visit_local(local, PlaceContext::NON_USE, location);
+                    }
+                    StatementKind::AscribeUserType { place, projections, variance: _ } => {
+                        self.visit_place(place, PlaceContext::NON_USE, location);
+                        self.visit_user_type_projection(projections);
+                    }
+                    StatementKind::Coverage(coverage) => visit_opaque(coverage),
+                    StatementKind::Intrinsic(intrisic) => match intrisic {
+                        NonDivergingIntrinsic::Assume(operand) => {
+                            self.visit_operand(operand, location);
+                        }
+                        NonDivergingIntrinsic::CopyNonOverlapping(CopyNonOverlapping {
+                            src,
+                            dst,
+                            count,
+                        }) => {
+                            self.visit_operand(src, location);
+                            self.visit_operand(dst, location);
+                            self.visit_operand(count, location);
+                        }
+                    },
+                    StatementKind::ConstEvalCounter | StatementKind::Nop => {}
                 }
-                self.visit_place(destination, PlaceContext::MUTATING, location);
             }
-            TerminatorKind::InlineAsm { operands, .. } => {
-                for op in operands {
-                    let InlineAsmOperand { in_value, out_place, raw_rpr: _ } = op;
-                    if let Some(input) = in_value {
-                        self.visit_operand(input, location);
+
+            fn super_terminator(&mut self, term: &$($mutability)? Terminator, location: Location) {
+                let Terminator { kind, span } = term;
+                self.visit_span(span);
+                match kind {
+                    TerminatorKind::Goto { .. }
+                    | TerminatorKind::Resume
+                    | TerminatorKind::Abort
+                    | TerminatorKind::Unreachable => {}
+                    TerminatorKind::Assert { cond, expected: _, msg, target: _, unwind: _ } => {
+                        self.visit_operand(cond, location);
+                        self.visit_assert_msg(msg, location);
+                    }
+                    TerminatorKind::Drop { place, target: _, unwind: _ } => {
+                        self.visit_place(place, PlaceContext::MUTATING, location);
+                    }
+                    TerminatorKind::Call { func, args, destination, target: _, unwind: _ } => {
+                        self.visit_operand(func, location);
+                        for arg in args {
+                            self.visit_operand(arg, location);
+                        }
+                        self.visit_place(destination, PlaceContext::MUTATING, location);
+                    }
+                    TerminatorKind::InlineAsm { operands, .. } => {
+                        for op in operands {
+                            let InlineAsmOperand { in_value, out_place, raw_rpr: _ } = op;
+                            if let Some(input) = in_value {
+                                self.visit_operand(input, location);
+                            }
+                            if let Some(output) = out_place {
+                                self.visit_place(output, PlaceContext::MUTATING, location);
+                            }
+                        }
                     }
-                    if let Some(output) = out_place {
-                        self.visit_place(output, PlaceContext::MUTATING, location);
+                    TerminatorKind::Return => {
+                        let $($mutability)? local = RETURN_LOCAL;
+                        self.visit_local(&$($mutability)? local, PlaceContext::NON_MUTATING, location);
+                    }
+                    TerminatorKind::SwitchInt { discr, targets: _ } => {
+                        self.visit_operand(discr, location);
                     }
                 }
             }
-            TerminatorKind::Return => {
-                let local = RETURN_LOCAL;
-                self.visit_local(&local, PlaceContext::NON_MUTATING, location);
-            }
-            TerminatorKind::SwitchInt { discr, targets: _ } => {
-                self.visit_operand(discr, location);
-            }
-        }
-    }
 
-    fn super_span(&mut self, span: &Span) {
-        let _ = span;
-    }
-
-    fn super_place(&mut self, place: &Place, ptx: PlaceContext, location: Location) {
-        let _ = location;
-        let _ = ptx;
-        self.visit_local(&place.local, ptx, location);
+            fn super_span(&mut self, span: &$($mutability)? Span) {
+                let _ = span;
+            }
 
-        for (idx, elem) in place.projection.iter().enumerate() {
-            let place_ref = PlaceRef { local: place.local, projection: &place.projection[..idx] };
-            self.visit_projection_elem(place_ref, elem, ptx, location);
-        }
-    }
+            fn super_rvalue(&mut self, rvalue: &$($mutability)? Rvalue, location: Location) {
+                match rvalue {
+                    Rvalue::AddressOf(mutability, place) => {
+                        let pcx = PlaceContext { is_mut: *mutability == RawPtrKind::Mut };
+                        self.visit_place(place, pcx, location);
+                    }
+                    Rvalue::Aggregate(_, operands) => {
+                        for op in operands {
+                            self.visit_operand(op, location);
+                        }
+                    }
+                    Rvalue::BinaryOp(_, lhs, rhs) | Rvalue::CheckedBinaryOp(_, lhs, rhs) => {
+                        self.visit_operand(lhs, location);
+                        self.visit_operand(rhs, location);
+                    }
+                    Rvalue::Cast(_, op, ty) => {
+                        self.visit_operand(op, location);
+                        self.visit_ty(ty, location);
+                    }
+                    Rvalue::CopyForDeref(place) | Rvalue::Discriminant(place) | Rvalue::Len(place) => {
+                        self.visit_place(place, PlaceContext::NON_MUTATING, location);
+                    }
+                    Rvalue::Ref(region, kind, place) => {
+                        self.visit_region(region, location);
+                        let pcx = PlaceContext { is_mut: matches!(kind, BorrowKind::Mut { .. }) };
+                        self.visit_place(place, pcx, location);
+                    }
+                    Rvalue::Repeat(op, constant) => {
+                        self.visit_operand(op, location);
+                        self.visit_ty_const(constant, location);
+                    }
+                    Rvalue::ShallowInitBox(op, ty) => {
+                        self.visit_ty(ty, location);
+                        self.visit_operand(op, location)
+                    }
+                    Rvalue::ThreadLocalRef(_) => {}
+                    Rvalue::NullaryOp(_, ty) => {
+                        self.visit_ty(ty, location);
+                    }
+                    Rvalue::UnaryOp(_, op) | Rvalue::Use(op) => {
+                        self.visit_operand(op, location);
+                    }
+                }
+            }
 
-    fn super_projection_elem(
-        &mut self,
-        elem: &ProjectionElem,
-        ptx: PlaceContext,
-        location: Location,
-    ) {
-        match elem {
-            ProjectionElem::Downcast(_idx) => {}
-            ProjectionElem::ConstantIndex { offset: _, min_length: _, from_end: _ }
-            | ProjectionElem::Deref
-            | ProjectionElem::Subslice { from: _, to: _, from_end: _ } => {}
-            ProjectionElem::Field(_idx, ty) => self.visit_ty(ty, location),
-            ProjectionElem::Index(local) => self.visit_local(local, ptx, location),
-            ProjectionElem::OpaqueCast(ty) | ProjectionElem::Subtype(ty) => {
-                self.visit_ty(ty, location)
+            fn super_operand(&mut self, operand: &$($mutability)? Operand, location: Location) {
+                match operand {
+                    Operand::Copy(place) | Operand::Move(place) => {
+                        self.visit_place(place, PlaceContext::NON_MUTATING, location)
+                    }
+                    Operand::Constant(constant) => {
+                        self.visit_const_operand(constant, location);
+                    }
+                }
             }
-        }
-    }
 
-    fn super_rvalue(&mut self, rvalue: &Rvalue, location: Location) {
-        match rvalue {
-            Rvalue::AddressOf(mutability, place) => {
-                let pcx = PlaceContext { is_mut: *mutability == RawPtrKind::Mut };
-                self.visit_place(place, pcx, location);
+            fn super_user_type_projection(&mut self, projection: &$($mutability)? UserTypeProjection) {
+                // This is a no-op on mir::Visitor.
+                let _ = projection;
             }
-            Rvalue::Aggregate(_, operands) => {
-                for op in operands {
-                    self.visit_operand(op, location);
-                }
+
+            fn super_ty(&mut self, ty: &$($mutability)? Ty) {
+                let _ = ty;
             }
-            Rvalue::BinaryOp(_, lhs, rhs) | Rvalue::CheckedBinaryOp(_, lhs, rhs) => {
-                self.visit_operand(lhs, location);
-                self.visit_operand(rhs, location);
+
+            fn super_const_operand(&mut self, constant: &$($mutability)? ConstOperand, location: Location) {
+                let ConstOperand { span, user_ty: _, const_ } = constant;
+                self.visit_span(span);
+                self.visit_mir_const(const_, location);
             }
-            Rvalue::Cast(_, op, ty) => {
-                self.visit_operand(op, location);
+
+            fn super_mir_const(&mut self, constant: &$($mutability)? MirConst, location: Location) {
+                let MirConst { kind: _, ty, id: _ } = constant;
                 self.visit_ty(ty, location);
             }
-            Rvalue::CopyForDeref(place) | Rvalue::Discriminant(place) | Rvalue::Len(place) => {
-                self.visit_place(place, PlaceContext::NON_MUTATING, location);
-            }
-            Rvalue::Ref(region, kind, place) => {
-                self.visit_region(region, location);
-                let pcx = PlaceContext { is_mut: matches!(kind, BorrowKind::Mut { .. }) };
-                self.visit_place(place, pcx, location);
+
+            fn super_ty_const(&mut self, constant: &$($mutability)? TyConst) {
+                let _ = constant;
             }
-            Rvalue::Repeat(op, constant) => {
-                self.visit_operand(op, location);
-                self.visit_ty_const(constant, location);
+
+            fn super_region(&mut self, region: &$($mutability)? Region) {
+                let _ = region;
             }
-            Rvalue::ShallowInitBox(op, ty) => {
-                self.visit_ty(ty, location);
-                self.visit_operand(op, location)
+
+            fn super_args(&mut self, args: &$($mutability)? GenericArgs) {
+                let _ = args;
             }
-            Rvalue::ThreadLocalRef(_) => {}
-            Rvalue::NullaryOp(_, ty) => {
-                self.visit_ty(ty, location);
+
+            fn super_var_debug_info(&mut self, var_debug_info: &$($mutability)? VarDebugInfo) {
+                let VarDebugInfo { source_info, composite, value, name: _, argument_index: _ } =
+                    var_debug_info;
+                self.visit_span(&$($mutability)? source_info.span);
+                let location = Location(source_info.span);
+                if let Some(composite) = composite {
+                    self.visit_ty(&$($mutability)? composite.ty, location);
+                }
+                match value {
+                    VarDebugInfoContents::Place(place) => {
+                        self.visit_place(place, PlaceContext::NON_USE, location);
+                    }
+                    VarDebugInfoContents::Const(constant) => {
+                        self.visit_mir_const(&$($mutability)? constant.const_, location);
+                    }
+                }
             }
-            Rvalue::UnaryOp(_, op) | Rvalue::Use(op) => {
-                self.visit_operand(op, location);
+
+            fn super_assert_msg(&mut self, msg: &$($mutability)? AssertMessage, location: Location) {
+                match msg {
+                    AssertMessage::BoundsCheck { len, index } => {
+                        self.visit_operand(len, location);
+                        self.visit_operand(index, location);
+                    }
+                    AssertMessage::Overflow(_, left, right) => {
+                        self.visit_operand(left, location);
+                        self.visit_operand(right, location);
+                    }
+                    AssertMessage::OverflowNeg(op)
+                    | AssertMessage::DivisionByZero(op)
+                    | AssertMessage::RemainderByZero(op) => {
+                        self.visit_operand(op, location);
+                    }
+                    AssertMessage::ResumedAfterReturn(_)
+                    | AssertMessage::ResumedAfterPanic(_)
+                    | AssertMessage::NullPointerDereference => {
+                        //nothing to visit
+                    }
+                    AssertMessage::MisalignedPointerDereference { required, found } => {
+                        self.visit_operand(required, location);
+                        self.visit_operand(found, location);
+                    }
+                }
             }
         }
-    }
+    };
+}
 
-    fn super_operand(&mut self, operand: &Operand, location: Location) {
-        match operand {
-            Operand::Copy(place) | Operand::Move(place) => {
-                self.visit_place(place, PlaceContext::NON_MUTATING, location)
-            }
-            Operand::Constant(constant) => {
-                self.visit_const_operand(constant, location);
-            }
+macro_rules! super_body {
+    ($self:ident, $body:ident, mut) => {
+        for bb in $body.blocks.iter_mut() {
+            $self.visit_basic_block(bb);
         }
-    }
 
-    fn super_user_type_projection(&mut self, projection: &UserTypeProjection) {
-        // This is a no-op on mir::Visitor.
-        let _ = projection;
-    }
+        $self.visit_ret_decl(RETURN_LOCAL, $body.ret_local_mut());
 
-    fn super_ty(&mut self, ty: &Ty) {
-        let _ = ty;
-    }
+        for (idx, arg) in $body.arg_locals_mut().iter_mut().enumerate() {
+            $self.visit_arg_decl(idx + 1, arg)
+        }
 
-    fn super_const_operand(&mut self, constant: &ConstOperand, location: Location) {
-        let ConstOperand { span, user_ty: _, const_ } = constant;
-        self.visit_span(span);
-        self.visit_mir_const(const_, location);
-    }
+        let local_start = $body.arg_count + 1;
+        for (idx, arg) in $body.inner_locals_mut().iter_mut().enumerate() {
+            $self.visit_local_decl(idx + local_start, arg)
+        }
 
-    fn super_mir_const(&mut self, constant: &MirConst, location: Location) {
-        let MirConst { kind: _, ty, id: _ } = constant;
-        self.visit_ty(ty, location);
-    }
+        for info in $body.var_debug_info.iter_mut() {
+            $self.visit_var_debug_info(info);
+        }
 
-    fn super_ty_const(&mut self, constant: &TyConst) {
-        let _ = constant;
-    }
+        $self.visit_span(&mut $body.span)
+    };
 
-    fn super_region(&mut self, region: &Region) {
-        let _ = region;
-    }
+    ($self:ident, $body:ident, ) => {
+        let Body { blocks, locals: _, arg_count, var_debug_info, spread_arg: _, span } = $body;
 
-    fn super_args(&mut self, args: &GenericArgs) {
-        let _ = args;
-    }
+        for bb in blocks {
+            $self.visit_basic_block(bb);
+        }
 
-    fn super_var_debug_info(&mut self, var_debug_info: &VarDebugInfo) {
-        let VarDebugInfo { source_info, composite, value, name: _, argument_index: _ } =
-            var_debug_info;
-        self.visit_span(&source_info.span);
-        let location = Location(source_info.span);
-        if let Some(composite) = composite {
-            self.visit_ty(&composite.ty, location);
+        $self.visit_ret_decl(RETURN_LOCAL, $body.ret_local());
+
+        for (idx, arg) in $body.arg_locals().iter().enumerate() {
+            $self.visit_arg_decl(idx + 1, arg)
         }
-        match value {
-            VarDebugInfoContents::Place(place) => {
-                self.visit_place(place, PlaceContext::NON_USE, location);
-            }
-            VarDebugInfoContents::Const(constant) => {
-                self.visit_mir_const(&constant.const_, location);
-            }
+
+        let local_start = arg_count + 1;
+        for (idx, arg) in $body.inner_locals().iter().enumerate() {
+            $self.visit_local_decl(idx + local_start, arg)
         }
-    }
 
-    fn super_assert_msg(&mut self, msg: &AssertMessage, location: Location) {
-        match msg {
-            AssertMessage::BoundsCheck { len, index } => {
-                self.visit_operand(len, location);
-                self.visit_operand(index, location);
-            }
-            AssertMessage::Overflow(_, left, right) => {
-                self.visit_operand(left, location);
-                self.visit_operand(right, location);
+        for info in var_debug_info.iter() {
+            $self.visit_var_debug_info(info);
+        }
+
+        $self.visit_span(span)
+    };
+}
+
+macro_rules! visit_place_fns {
+    (mut) => {
+        fn super_place(&mut self, place: &mut Place, ptx: PlaceContext, location: Location) {
+            self.visit_local(&mut place.local, ptx, location);
+
+            for elem in place.projection.iter_mut() {
+                self.visit_projection_elem(elem, ptx, location);
             }
-            AssertMessage::OverflowNeg(op)
-            | AssertMessage::DivisionByZero(op)
-            | AssertMessage::RemainderByZero(op) => {
-                self.visit_operand(op, location);
+        }
+
+        // We don't have to replicate the `process_projection()` like we did in
+        // `rustc_middle::mir::visit.rs` here because the `projection` field in `Place`
+        // of Stable-MIR is not an immutable borrow, unlike in `Place` of MIR.
+        fn visit_projection_elem(
+            &mut self,
+            elem: &mut ProjectionElem,
+            ptx: PlaceContext,
+            location: Location,
+        ) {
+            self.super_projection_elem(elem, ptx, location)
+        }
+
+        fn super_projection_elem(
+            &mut self,
+            elem: &mut ProjectionElem,
+            ptx: PlaceContext,
+            location: Location,
+        ) {
+            match elem {
+                ProjectionElem::Deref => {}
+                ProjectionElem::Field(_idx, ty) => self.visit_ty(ty, location),
+                ProjectionElem::Index(local) => self.visit_local(local, ptx, location),
+                ProjectionElem::ConstantIndex { offset: _, min_length: _, from_end: _ } => {}
+                ProjectionElem::Subslice { from: _, to: _, from_end: _ } => {}
+                ProjectionElem::Downcast(_idx) => {}
+                ProjectionElem::OpaqueCast(ty) => self.visit_ty(ty, location),
+                ProjectionElem::Subtype(ty) => self.visit_ty(ty, location),
             }
-            AssertMessage::ResumedAfterReturn(_)
-            | AssertMessage::ResumedAfterPanic(_)
-            | AssertMessage::NullPointerDereference => {
-                //nothing to visit
+        }
+    };
+
+    () => {
+        fn super_place(&mut self, place: &Place, ptx: PlaceContext, location: Location) {
+            self.visit_local(&place.local, ptx, location);
+
+            for (idx, elem) in place.projection.iter().enumerate() {
+                let place_ref =
+                    PlaceRef { local: place.local, projection: &place.projection[..idx] };
+                self.visit_projection_elem(place_ref, elem, ptx, location);
             }
-            AssertMessage::MisalignedPointerDereference { required, found } => {
-                self.visit_operand(required, location);
-                self.visit_operand(found, location);
+        }
+
+        fn visit_projection_elem<'a>(
+            &mut self,
+            place_ref: PlaceRef<'a>,
+            elem: &ProjectionElem,
+            ptx: PlaceContext,
+            location: Location,
+        ) {
+            let _ = place_ref;
+            self.super_projection_elem(elem, ptx, location);
+        }
+
+        fn super_projection_elem(
+            &mut self,
+            elem: &ProjectionElem,
+            ptx: PlaceContext,
+            location: Location,
+        ) {
+            match elem {
+                ProjectionElem::Deref => {}
+                ProjectionElem::Field(_idx, ty) => self.visit_ty(ty, location),
+                ProjectionElem::Index(local) => self.visit_local(local, ptx, location),
+                ProjectionElem::ConstantIndex { offset: _, min_length: _, from_end: _ } => {}
+                ProjectionElem::Subslice { from: _, to: _, from_end: _ } => {}
+                ProjectionElem::Downcast(_idx) => {}
+                ProjectionElem::OpaqueCast(ty) => self.visit_ty(ty, location),
+                ProjectionElem::Subtype(ty) => self.visit_ty(ty, location),
             }
         }
-    }
+    };
 }
 
+make_mir_visitor!(MirVisitor,);
+make_mir_visitor!(MutMirVisitor, mut);
+
 /// This function is a no-op that gets used to ensure this visitor is kept up-to-date.
 ///
 /// The idea is that whenever we replace an Opaque type by a real type, the compiler will fail
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index f9a360585e852..7fc010d2ec3fb 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -1343,6 +1343,9 @@ impl Seek for Arc<File> {
     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
         (&**self).seek(pos)
     }
+    fn stream_position(&mut self) -> io::Result<u64> {
+        (&**self).stream_position()
+    }
 }
 
 impl OpenOptions {
diff --git a/library/std/src/sys/random/trusty.rs b/library/std/src/sys/random/trusty.rs
index da6ca3eea2426..e4db24695f8bd 100644
--- a/library/std/src/sys/random/trusty.rs
+++ b/library/std/src/sys/random/trusty.rs
@@ -1,4 +1,4 @@
-extern "C" {
+unsafe extern "C" {
     fn trusty_rng_secure_rand(randomBuffer: *mut core::ffi::c_void, randomBufferLen: libc::size_t);
 }
 
diff --git a/src/bootstrap/src/utils/proc_macro_deps.rs b/src/bootstrap/src/utils/proc_macro_deps.rs
index 34bf6bb7013ff..dbfd6f47dc67f 100644
--- a/src/bootstrap/src/utils/proc_macro_deps.rs
+++ b/src/bootstrap/src/utils/proc_macro_deps.rs
@@ -6,18 +6,25 @@ pub static CRATES: &[&str] = &[
     "annotate-snippets",
     "anstyle",
     "basic-toml",
+    "block-buffer",
     "bumpalo",
+    "cfg-if",
+    "cpufeatures",
+    "crypto-common",
     "darling",
     "darling_core",
     "derive_builder_core",
+    "digest",
     "fluent-bundle",
     "fluent-langneg",
     "fluent-syntax",
     "fnv",
+    "generic-array",
     "heck",
     "ident_case",
     "intl-memoizer",
     "intl_pluralrules",
+    "libc",
     "log",
     "memchr",
     "mime",
@@ -25,12 +32,17 @@ pub static CRATES: &[&str] = &[
     "minimal-lexical",
     "nom",
     "num-conv",
+    "once_cell",
+    "pest",
+    "pest_generator",
+    "pest_meta",
     "proc-macro2",
     "quote",
     "rinja_parser",
     "rustc-hash",
     "self_cell",
     "serde",
+    "sha2",
     "smallvec",
     "stable_deref_trait",
     "strsim",
@@ -40,12 +52,15 @@ pub static CRATES: &[&str] = &[
     "time-core",
     "tinystr",
     "type-map",
+    "typenum",
+    "ucd-trie",
     "unic-langid",
     "unic-langid-impl",
     "unic-langid-macros",
     "unicase",
     "unicode-ident",
     "unicode-width",
+    "version_check",
     "wasm-bindgen-backend",
     "wasm-bindgen-macro-support",
     "wasm-bindgen-shared",
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index b067dbf750e7d..5aab4199d43b1 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -1200,11 +1200,12 @@ impl LangString {
                         data.ignore = Ignore::All;
                         seen_rust_tags = !seen_other_tags;
                     }
-                    LangStringToken::LangToken(x) if x.starts_with("ignore-") => {
-                        if enable_per_target_ignores {
-                            ignores.push(x.trim_start_matches("ignore-").to_owned());
-                            seen_rust_tags = !seen_other_tags;
-                        }
+                    LangStringToken::LangToken(x)
+                        if let Some(ignore) = x.strip_prefix("ignore-")
+                            && enable_per_target_ignores =>
+                    {
+                        ignores.push(ignore.to_owned());
+                        seen_rust_tags = !seen_other_tags;
                     }
                     LangStringToken::LangToken("rust") => {
                         data.rust = true;
@@ -1226,37 +1227,39 @@ impl LangString {
                         data.standalone_crate = true;
                         seen_rust_tags = !seen_other_tags || seen_rust_tags;
                     }
-                    LangStringToken::LangToken(x) if x.starts_with("edition") => {
-                        data.edition = x[7..].parse::<Edition>().ok();
+                    LangStringToken::LangToken(x)
+                        if let Some(edition) = x.strip_prefix("edition") =>
+                    {
+                        data.edition = edition.parse::<Edition>().ok();
                     }
                     LangStringToken::LangToken(x)
-                        if x.starts_with("rust") && x[4..].parse::<Edition>().is_ok() =>
+                        if let Some(edition) = x.strip_prefix("rust")
+                            && edition.parse::<Edition>().is_ok()
+                            && let Some(extra) = extra =>
                     {
-                        if let Some(extra) = extra {
-                            extra.error_invalid_codeblock_attr_with_help(
-                                format!("unknown attribute `{x}`"),
-                                |lint| {
-                                    lint.help(format!(
-                                        "there is an attribute with a similar name: `edition{}`",
-                                        &x[4..],
-                                    ));
-                                },
-                            );
-                        }
+                        extra.error_invalid_codeblock_attr_with_help(
+                            format!("unknown attribute `{x}`"),
+                            |lint| {
+                                lint.help(format!(
+                                    "there is an attribute with a similar name: `edition{edition}`"
+                                ));
+                            },
+                        );
                     }
                     LangStringToken::LangToken(x)
-                        if allow_error_code_check && x.starts_with('E') && x.len() == 5 =>
+                        if allow_error_code_check
+                            && let Some(error_code) = x.strip_prefix('E')
+                            && error_code.len() == 4 =>
                     {
-                        if x[1..].parse::<u32>().is_ok() {
+                        if error_code.parse::<u32>().is_ok() {
                             data.error_codes.push(x.to_owned());
                             seen_rust_tags = !seen_other_tags || seen_rust_tags;
                         } else {
                             seen_other_tags = true;
                         }
                     }
-                    LangStringToken::LangToken(x) if extra.is_some() => {
-                        let s = x.to_lowercase();
-                        if let Some(help) = match s.as_str() {
+                    LangStringToken::LangToken(x) if let Some(extra) = extra => {
+                        if let Some(help) = match x.to_lowercase().as_str() {
                             "compile-fail" | "compile_fail" | "compilefail" => Some(
                                 "use `compile_fail` to invert the results of this test, so that it \
                                 passes if it cannot be compiled and fails if it can",
@@ -1273,33 +1276,27 @@ impl LangString {
                                 "use `test_harness` to run functions marked `#[test]` instead of a \
                                 potentially-implicit `main` function",
                             ),
-                            "standalone" | "standalone_crate" | "standalone-crate" => {
-                                if let Some(extra) = extra
-                                    && extra.sp.at_least_rust_2024()
-                                {
-                                    Some(
-                                        "use `standalone_crate` to compile this code block \
+                            "standalone" | "standalone_crate" | "standalone-crate"
+                                if extra.sp.at_least_rust_2024() =>
+                            {
+                                Some(
+                                    "use `standalone_crate` to compile this code block \
                                         separately",
-                                    )
-                                } else {
-                                    None
-                                }
+                                )
                             }
                             _ => None,
                         } {
-                            if let Some(extra) = extra {
-                                extra.error_invalid_codeblock_attr_with_help(
-                                    format!("unknown attribute `{x}`"),
-                                    |lint| {
-                                        lint.help(help).help(
-                                            "this code block may be skipped during testing, \
+                            extra.error_invalid_codeblock_attr_with_help(
+                                format!("unknown attribute `{x}`"),
+                                |lint| {
+                                    lint.help(help).help(
+                                        "this code block may be skipped during testing, \
                                             because unknown attributes are treated as markers for \
                                             code samples written in other programming languages, \
                                             unless it is also explicitly marked as `rust`",
-                                        );
-                                    },
-                                );
-                            }
+                                    );
+                                },
+                            );
                         }
                         seen_other_tags = true;
                         data.unknown.push(x.to_owned());
diff --git a/src/tools/jsondocck/Cargo.toml b/src/tools/jsondocck/Cargo.toml
index e1eb6d0566513..80fc26cbe6680 100644
--- a/src/tools/jsondocck/Cargo.toml
+++ b/src/tools/jsondocck/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.1.0"
 edition = "2021"
 
 [dependencies]
-jsonpath_lib = "0.3"
+jsonpath-rust = "1.0.0"
 getopts = "0.2"
 regex = "1.4"
 shlex = "1.0"
diff --git a/src/tools/jsondocck/src/cache.rs b/src/tools/jsondocck/src/cache.rs
index 47512039740b2..1369c8ded0070 100644
--- a/src/tools/jsondocck/src/cache.rs
+++ b/src/tools/jsondocck/src/cache.rs
@@ -30,6 +30,6 @@ impl Cache {
 
     // FIXME: Make this failible, so jsonpath syntax error has line number.
     pub fn select(&self, path: &str) -> Vec<&Value> {
-        jsonpath_lib::select(&self.value, path).unwrap()
+        jsonpath_rust::query::js_path_vals(path, &self.value).unwrap()
     }
 }
diff --git a/tests/pretty/autodiff_forward.pp b/tests/pretty/autodiff_forward.pp
index 23c3b5b34a82a..dc7a2712f4231 100644
--- a/tests/pretty/autodiff_forward.pp
+++ b/tests/pretty/autodiff_forward.pp
@@ -53,7 +53,7 @@
 pub fn f3(x: &[f64], y: f64) -> f64 {
     ::core::panicking::panic("not implemented")
 }
-#[rustc_autodiff(ForwardFirst, Dual, Const, Const,)]
+#[rustc_autodiff(Forward, Dual, Const, Const,)]
 #[inline(never)]
 pub fn df3(x: &[f64], bx: &[f64], y: f64) -> f64 {
     unsafe { asm!("NOP", options(pure, nomem)); };
@@ -73,10 +73,6 @@
 }
 #[rustc_autodiff]
 #[inline(never)]
-#[rustc_autodiff]
-#[inline(never)]
-#[rustc_autodiff]
-#[inline(never)]
 pub fn f5(x: &[f64], y: f64) -> f64 {
     ::core::panicking::panic("not implemented")
 }
diff --git a/tests/pretty/autodiff_forward.rs b/tests/pretty/autodiff_forward.rs
index 35108d0d6f111..bc5582116322b 100644
--- a/tests/pretty/autodiff_forward.rs
+++ b/tests/pretty/autodiff_forward.rs
@@ -19,7 +19,7 @@ pub fn f2(x: &[f64], y: f64) -> f64 {
     unimplemented!()
 }
 
-#[autodiff(df3, ForwardFirst, Dual, Const, Const)]
+#[autodiff(df3, Forward, Dual, Const, Const)]
 pub fn f3(x: &[f64], y: f64) -> f64 {
     unimplemented!()
 }
diff --git a/tests/pretty/autodiff_reverse.pp b/tests/pretty/autodiff_reverse.pp
index a98d3782c7034..b2cf0244af4c6 100644
--- a/tests/pretty/autodiff_reverse.pp
+++ b/tests/pretty/autodiff_reverse.pp
@@ -51,7 +51,7 @@
 pub fn f3(x: &[f64], y: f64) -> f64 {
     ::core::panicking::panic("not implemented")
 }
-#[rustc_autodiff(ReverseFirst, Duplicated, Const, Active,)]
+#[rustc_autodiff(Reverse, Duplicated, Const, Active,)]
 #[inline(never)]
 pub fn df3(x: &[f64], dx: &mut [f64], y: f64, dret: f64) -> f64 {
     unsafe { asm!("NOP", options(pure, nomem)); };
diff --git a/tests/pretty/autodiff_reverse.rs b/tests/pretty/autodiff_reverse.rs
index 657201caa9401..3c024272f407e 100644
--- a/tests/pretty/autodiff_reverse.rs
+++ b/tests/pretty/autodiff_reverse.rs
@@ -18,7 +18,7 @@ pub fn f1(x: &[f64], y: f64) -> f64 {
 #[autodiff(df2, Reverse)]
 pub fn f2() {}
 
-#[autodiff(df3, ReverseFirst, Duplicated, Const, Active)]
+#[autodiff(df3, Reverse, Duplicated, Const, Active)]
 pub fn f3(x: &[f64], y: f64) -> f64 {
     unimplemented!()
 }
diff --git a/tests/rustdoc-json/assoc_items.rs b/tests/rustdoc-json/assoc_items.rs
index f315f37966d0b..f47a522e81a4a 100644
--- a/tests/rustdoc-json/assoc_items.rs
+++ b/tests/rustdoc-json/assoc_items.rs
@@ -3,32 +3,32 @@
 pub struct Simple;
 
 impl Simple {
-    //@ has "$.index[*][?(@.name=='CONSTANT')].inner.assoc_const"
+    //@ has "$.index[?(@.name=='CONSTANT')].inner.assoc_const"
     pub const CONSTANT: usize = 0;
 }
 
 pub trait EasyToImpl {
-    //@ has "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type"
-    //@ is "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type.type" null
-    //@ is "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type.bounds" []
+    //@ has "$.index[?(@.docs=='ToDeclare trait')].inner.assoc_type"
+    //@ is "$.index[?(@.docs=='ToDeclare trait')].inner.assoc_type.type" null
+    //@ is "$.index[?(@.docs=='ToDeclare trait')].inner.assoc_type.bounds" []
     /// ToDeclare trait
     type ToDeclare;
-    //@ has "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const"
-    //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.value" null
-    //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.type.primitive" '"usize"'
+    //@ has "$.index[?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const"
+    //@ is "$.index[?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.value" null
+    //@ is "$.index[?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.type.primitive" '"usize"'
     /// AN_ATTRIBUTE trait
     const AN_ATTRIBUTE: usize;
 }
 
 impl EasyToImpl for Simple {
-    //@ has "$.index[*][?(@.docs=='ToDeclare impl')].inner.assoc_type"
-    //@ is "$.index[*][?(@.docs=='ToDeclare impl')].inner.assoc_type.type.primitive" \"usize\"
+    //@ has "$.index[?(@.docs=='ToDeclare impl')].inner.assoc_type"
+    //@ is "$.index[?(@.docs=='ToDeclare impl')].inner.assoc_type.type.primitive" \"usize\"
     /// ToDeclare impl
     type ToDeclare = usize;
 
-    //@ has "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const"
-    //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.type.primitive" \"usize\"
-    //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.value" \"12\"
+    //@ has "$.index[?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const"
+    //@ is "$.index[?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.type.primitive" \"usize\"
+    //@ is "$.index[?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.value" \"12\"
     /// AN_ATTRIBUTE impl
     const AN_ATTRIBUTE: usize = 12;
 }
diff --git a/tests/rustdoc-json/assoc_type.rs b/tests/rustdoc-json/assoc_type.rs
index 43b4d387d9249..816075ca17ae2 100644
--- a/tests/rustdoc-json/assoc_type.rs
+++ b/tests/rustdoc-json/assoc_type.rs
@@ -1,9 +1,9 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/98547>.
 
-//@ has "$.index[*][?(@.name=='Trait')]"
-//@ has "$.index[*][?(@.name=='AssocType')]"
-//@ has "$.index[*][?(@.name=='S')]"
-//@ has "$.index[*][?(@.name=='S2')]"
+//@ has "$.index[?(@.name=='Trait')]"
+//@ has "$.index[?(@.name=='AssocType')]"
+//@ has "$.index[?(@.name=='S')]"
+//@ has "$.index[?(@.name=='S2')]"
 
 pub trait Trait {
     type AssocType;
diff --git a/tests/rustdoc-json/attrs/deprecated.rs b/tests/rustdoc-json/attrs/deprecated.rs
index 5cde7af841f72..0799471fc8884 100644
--- a/tests/rustdoc-json/attrs/deprecated.rs
+++ b/tests/rustdoc-json/attrs/deprecated.rs
@@ -1,38 +1,38 @@
-//@ is "$.index[*][?(@.name=='not')].attrs" []
-//@ is "$.index[*][?(@.name=='not')].deprecation" null
+//@ is "$.index[?(@.name=='not')].attrs" []
+//@ is "$.index[?(@.name=='not')].deprecation" null
 pub fn not() {}
 
-//@ is "$.index[*][?(@.name=='raw')].attrs" []
-//@ is "$.index[*][?(@.name=='raw')].deprecation" '{"since": null, "note": null}'
+//@ is "$.index[?(@.name=='raw')].attrs" []
+//@ is "$.index[?(@.name=='raw')].deprecation" '{"since": null, "note": null}'
 #[deprecated]
 pub fn raw() {}
 
-//@ is "$.index[*][?(@.name=='equals_string')].attrs" []
-//@ is "$.index[*][?(@.name=='equals_string')].deprecation" '{"since": null, "note": "here is a reason"}'
+//@ is "$.index[?(@.name=='equals_string')].attrs" []
+//@ is "$.index[?(@.name=='equals_string')].deprecation" '{"since": null, "note": "here is a reason"}'
 #[deprecated = "here is a reason"]
 pub fn equals_string() {}
 
-//@ is "$.index[*][?(@.name=='since')].attrs" []
-//@ is "$.index[*][?(@.name=='since')].deprecation" '{"since": "yoinks ago", "note": null}'
+//@ is "$.index[?(@.name=='since')].attrs" []
+//@ is "$.index[?(@.name=='since')].deprecation" '{"since": "yoinks ago", "note": null}'
 #[deprecated(since = "yoinks ago")]
 pub fn since() {}
 
-//@ is "$.index[*][?(@.name=='note')].attrs" []
-//@ is "$.index[*][?(@.name=='note')].deprecation" '{"since": null, "note": "7"}'
+//@ is "$.index[?(@.name=='note')].attrs" []
+//@ is "$.index[?(@.name=='note')].deprecation" '{"since": null, "note": "7"}'
 #[deprecated(note = "7")]
 pub fn note() {}
 
-//@ is "$.index[*][?(@.name=='since_and_note')].attrs" []
-//@ is "$.index[*][?(@.name=='since_and_note')].deprecation" '{"since": "tomorrow", "note": "sorry"}'
+//@ is "$.index[?(@.name=='since_and_note')].attrs" []
+//@ is "$.index[?(@.name=='since_and_note')].deprecation" '{"since": "tomorrow", "note": "sorry"}'
 #[deprecated(since = "tomorrow", note = "sorry")]
 pub fn since_and_note() {}
 
-//@ is "$.index[*][?(@.name=='note_and_since')].attrs" []
-//@ is "$.index[*][?(@.name=='note_and_since')].deprecation" '{"since": "a year from tomorrow", "note": "your welcome"}'
+//@ is "$.index[?(@.name=='note_and_since')].attrs" []
+//@ is "$.index[?(@.name=='note_and_since')].deprecation" '{"since": "a year from tomorrow", "note": "your welcome"}'
 #[deprecated(note = "your welcome", since = "a year from tomorrow")]
 pub fn note_and_since() {}
 
-//@ is "$.index[*][?(@.name=='neither_but_parens')].attrs" []
-//@ is "$.index[*][?(@.name=='neither_but_parens')].deprecation" '{"since": null, "note": null}'
+//@ is "$.index[?(@.name=='neither_but_parens')].attrs" []
+//@ is "$.index[?(@.name=='neither_but_parens')].deprecation" '{"since": null, "note": null}'
 #[deprecated()]
 pub fn neither_but_parens() {}
diff --git a/tests/rustdoc-json/attrs/export_name_2021.rs b/tests/rustdoc-json/attrs/export_name_2021.rs
index badf124bdde36..254e9f6ef5bfd 100644
--- a/tests/rustdoc-json/attrs/export_name_2021.rs
+++ b/tests/rustdoc-json/attrs/export_name_2021.rs
@@ -1,6 +1,6 @@
 //@ edition: 2021
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
 #[export_name = "altered"]
 pub extern "C" fn example() {}
diff --git a/tests/rustdoc-json/attrs/export_name_2024.rs b/tests/rustdoc-json/attrs/export_name_2024.rs
index c5bb9dcc8f68a..8129c109306c0 100644
--- a/tests/rustdoc-json/attrs/export_name_2024.rs
+++ b/tests/rustdoc-json/attrs/export_name_2024.rs
@@ -4,6 +4,6 @@
 // The representation of `#[unsafe(export_name = ..)]` in rustdoc in edition 2024
 // is still `#[export_name = ..]` without the `unsafe` attribute wrapper.
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
 #[unsafe(export_name = "altered")]
 pub extern "C" fn example() {}
diff --git a/tests/rustdoc-json/attrs/must_use.rs b/tests/rustdoc-json/attrs/must_use.rs
index dca73abc76a1a..64df8e5f509ff 100644
--- a/tests/rustdoc-json/attrs/must_use.rs
+++ b/tests/rustdoc-json/attrs/must_use.rs
@@ -1,9 +1,9 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[must_use]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[must_use]"]'
 #[must_use]
 pub fn example() -> impl Iterator<Item = i64> {}
 
-//@ is "$.index[*][?(@.name=='explicit_message')].attrs" '["#[must_use = \"does nothing if you do not use it\"]"]'
+//@ is "$.index[?(@.name=='explicit_message')].attrs" '["#[must_use = \"does nothing if you do not use it\"]"]'
 #[must_use = "does nothing if you do not use it"]
 pub fn explicit_message() -> impl Iterator<Item = i64> {}
diff --git a/tests/rustdoc-json/attrs/no_mangle_2021.rs b/tests/rustdoc-json/attrs/no_mangle_2021.rs
index 258542086ec37..588be7256db5a 100644
--- a/tests/rustdoc-json/attrs/no_mangle_2021.rs
+++ b/tests/rustdoc-json/attrs/no_mangle_2021.rs
@@ -1,6 +1,6 @@
 //@ edition: 2021
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[no_mangle]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[no_mangle]"]'
 #[no_mangle]
 pub extern "C" fn example() {}
diff --git a/tests/rustdoc-json/attrs/no_mangle_2024.rs b/tests/rustdoc-json/attrs/no_mangle_2024.rs
index 4c01082d045ef..0d500e20e6c50 100644
--- a/tests/rustdoc-json/attrs/no_mangle_2024.rs
+++ b/tests/rustdoc-json/attrs/no_mangle_2024.rs
@@ -4,6 +4,6 @@
 // The representation of `#[unsafe(no_mangle)]` in rustdoc in edition 2024
 // is still `#[no_mangle]` without the `unsafe` attribute wrapper.
 
-//@ is "$.index[*][?(@.name=='example')].attrs" '["#[no_mangle]"]'
+//@ is "$.index[?(@.name=='example')].attrs" '["#[no_mangle]"]'
 #[unsafe(no_mangle)]
 pub extern "C" fn example() {}
diff --git a/tests/rustdoc-json/attrs/non_exhaustive.rs b/tests/rustdoc-json/attrs/non_exhaustive.rs
index 5d738fc0560da..b95f1a8171fd4 100644
--- a/tests/rustdoc-json/attrs/non_exhaustive.rs
+++ b/tests/rustdoc-json/attrs/non_exhaustive.rs
@@ -1,18 +1,18 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='MyEnum')].attrs" '["#[non_exhaustive]"]'
+//@ is "$.index[?(@.name=='MyEnum')].attrs" '["#[non_exhaustive]"]'
 #[non_exhaustive]
 pub enum MyEnum {
     First,
 }
 
 pub enum NonExhaustiveVariant {
-    //@ is "$.index[*][?(@.name=='Variant')].attrs" '["#[non_exhaustive]"]'
+    //@ is "$.index[?(@.name=='Variant')].attrs" '["#[non_exhaustive]"]'
     #[non_exhaustive]
     Variant(i64),
 }
 
-//@ is "$.index[*][?(@.name=='MyStruct')].attrs" '["#[non_exhaustive]"]'
+//@ is "$.index[?(@.name=='MyStruct')].attrs" '["#[non_exhaustive]"]'
 #[non_exhaustive]
 pub struct MyStruct {
     pub x: i64,
diff --git a/tests/rustdoc-json/attrs/repr_align.rs b/tests/rustdoc-json/attrs/repr_align.rs
index bebbe1fea349d..83506737b211a 100644
--- a/tests/rustdoc-json/attrs/repr_align.rs
+++ b/tests/rustdoc-json/attrs/repr_align.rs
@@ -1,6 +1,6 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='Aligned')].attrs" '["#[attr = Repr([ReprAlign(Align(4 bytes))])]\n"]'
+//@ is "$.index[?(@.name=='Aligned')].attrs" '["#[attr = Repr([ReprAlign(Align(4 bytes))])]\n"]'
 #[repr(align(4))]
 pub struct Aligned {
     a: i8,
diff --git a/tests/rustdoc-json/attrs/repr_c.rs b/tests/rustdoc-json/attrs/repr_c.rs
index 609d33d94de76..018086b3c1ffd 100644
--- a/tests/rustdoc-json/attrs/repr_c.rs
+++ b/tests/rustdoc-json/attrs/repr_c.rs
@@ -1,16 +1,16 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='ReprCStruct')].attrs" '["#[attr = Repr([ReprC])]\n"]'
+//@ is "$.index[?(@.name=='ReprCStruct')].attrs" '["#[attr = Repr([ReprC])]\n"]'
 #[repr(C)]
 pub struct ReprCStruct(pub i64);
 
-//@ is "$.index[*][?(@.name=='ReprCEnum')].attrs" '["#[attr = Repr([ReprC])]\n"]'
+//@ is "$.index[?(@.name=='ReprCEnum')].attrs" '["#[attr = Repr([ReprC])]\n"]'
 #[repr(C)]
 pub enum ReprCEnum {
     First,
 }
 
-//@ is "$.index[*][?(@.name=='ReprCUnion')].attrs" '["#[attr = Repr([ReprC])]\n"]'
+//@ is "$.index[?(@.name=='ReprCUnion')].attrs" '["#[attr = Repr([ReprC])]\n"]'
 #[repr(C)]
 pub union ReprCUnion {
     pub left: i64,
diff --git a/tests/rustdoc-json/attrs/repr_combination.rs b/tests/rustdoc-json/attrs/repr_combination.rs
index 662bfef67cb87..c3ef8becb7791 100644
--- a/tests/rustdoc-json/attrs/repr_combination.rs
+++ b/tests/rustdoc-json/attrs/repr_combination.rs
@@ -2,33 +2,33 @@
 
 // Combinations of `#[repr(..)]` attributes.
 
-//@ is "$.index[*][?(@.name=='ReprCI8')].attrs" '["#[attr = Repr([ReprC, ReprInt(SignedInt(I8))])]\n"]'
+//@ is "$.index[?(@.name=='ReprCI8')].attrs" '["#[attr = Repr([ReprC, ReprInt(SignedInt(I8))])]\n"]'
 #[repr(C, i8)]
 pub enum ReprCI8 {
     First,
 }
 
-//@ is "$.index[*][?(@.name=='SeparateReprCI16')].attrs" '["#[attr = Repr([ReprC, ReprInt(SignedInt(I16))])]\n"]'
+//@ is "$.index[?(@.name=='SeparateReprCI16')].attrs" '["#[attr = Repr([ReprC, ReprInt(SignedInt(I16))])]\n"]'
 #[repr(C)]
 #[repr(i16)]
 pub enum SeparateReprCI16 {
     First,
 }
 
-//@ is "$.index[*][?(@.name=='ReversedReprCUsize')].attrs" '["#[attr = Repr([ReprInt(UnsignedInt(Usize)), ReprC])]\n"]'
+//@ is "$.index[?(@.name=='ReversedReprCUsize')].attrs" '["#[attr = Repr([ReprInt(UnsignedInt(Usize)), ReprC])]\n"]'
 #[repr(usize, C)]
 pub enum ReversedReprCUsize {
     First,
 }
 
-//@ is "$.index[*][?(@.name=='ReprCPacked')].attrs" '["#[attr = Repr([ReprC, ReprPacked(Align(1 bytes))])]\n"]'
+//@ is "$.index[?(@.name=='ReprCPacked')].attrs" '["#[attr = Repr([ReprC, ReprPacked(Align(1 bytes))])]\n"]'
 #[repr(C, packed)]
 pub struct ReprCPacked {
     a: i8,
     b: i64,
 }
 
-//@ is "$.index[*][?(@.name=='SeparateReprCPacked')].attrs" '["#[attr = Repr([ReprC, ReprPacked(Align(2 bytes))])]\n"]'
+//@ is "$.index[?(@.name=='SeparateReprCPacked')].attrs" '["#[attr = Repr([ReprC, ReprPacked(Align(2 bytes))])]\n"]'
 #[repr(C)]
 #[repr(packed(2))]
 pub struct SeparateReprCPacked {
@@ -36,21 +36,21 @@ pub struct SeparateReprCPacked {
     b: i64,
 }
 
-//@ is "$.index[*][?(@.name=='ReversedReprCPacked')].attrs" '["#[attr = Repr([ReprPacked(Align(2 bytes)), ReprC])]\n"]'
+//@ is "$.index[?(@.name=='ReversedReprCPacked')].attrs" '["#[attr = Repr([ReprPacked(Align(2 bytes)), ReprC])]\n"]'
 #[repr(packed(2), C)]
 pub struct ReversedReprCPacked {
     a: i8,
     b: i64,
 }
 
-//@ is "$.index[*][?(@.name=='ReprCAlign')].attrs" '["#[attr = Repr([ReprC, ReprAlign(Align(16 bytes))])]\n"]'
+//@ is "$.index[?(@.name=='ReprCAlign')].attrs" '["#[attr = Repr([ReprC, ReprAlign(Align(16 bytes))])]\n"]'
 #[repr(C, align(16))]
 pub struct ReprCAlign {
     a: i8,
     b: i64,
 }
 
-//@ is "$.index[*][?(@.name=='SeparateReprCAlign')].attrs" '["#[attr = Repr([ReprC, ReprAlign(Align(2 bytes))])]\n"]'
+//@ is "$.index[?(@.name=='SeparateReprCAlign')].attrs" '["#[attr = Repr([ReprC, ReprAlign(Align(2 bytes))])]\n"]'
 #[repr(C)]
 #[repr(align(2))]
 pub struct SeparateReprCAlign {
@@ -58,20 +58,20 @@ pub struct SeparateReprCAlign {
     b: i64,
 }
 
-//@ is "$.index[*][?(@.name=='ReversedReprCAlign')].attrs" '["#[attr = Repr([ReprAlign(Align(2 bytes)), ReprC])]\n"]'
+//@ is "$.index[?(@.name=='ReversedReprCAlign')].attrs" '["#[attr = Repr([ReprAlign(Align(2 bytes)), ReprC])]\n"]'
 #[repr(align(2), C)]
 pub struct ReversedReprCAlign {
     a: i8,
     b: i64,
 }
 
-//@ is "$.index[*][?(@.name=='AlignedExplicitRepr')].attrs" '["#[attr = Repr([ReprC, ReprAlign(Align(16 bytes)), ReprInt(SignedInt(Isize))])]\n"]'
+//@ is "$.index[?(@.name=='AlignedExplicitRepr')].attrs" '["#[attr = Repr([ReprC, ReprAlign(Align(16 bytes)), ReprInt(SignedInt(Isize))])]\n"]'
 #[repr(C, align(16), isize)]
 pub enum AlignedExplicitRepr {
     First,
 }
 
-//@ is "$.index[*][?(@.name=='ReorderedAlignedExplicitRepr')].attrs" '["#[attr = Repr([ReprInt(SignedInt(Isize)), ReprC, ReprAlign(Align(16 bytes))])]\n"]'
+//@ is "$.index[?(@.name=='ReorderedAlignedExplicitRepr')].attrs" '["#[attr = Repr([ReprInt(SignedInt(Isize)), ReprC, ReprAlign(Align(16 bytes))])]\n"]'
 #[repr(isize, C, align(16))]
 pub enum ReorderedAlignedExplicitRepr {
     First,
diff --git a/tests/rustdoc-json/attrs/repr_int_enum.rs b/tests/rustdoc-json/attrs/repr_int_enum.rs
index 2ad57de279887..206cb7835f52c 100644
--- a/tests/rustdoc-json/attrs/repr_int_enum.rs
+++ b/tests/rustdoc-json/attrs/repr_int_enum.rs
@@ -1,18 +1,18 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='I8')].attrs" '["#[attr = Repr([ReprInt(SignedInt(I8))])]\n"]'
+//@ is "$.index[?(@.name=='I8')].attrs" '["#[attr = Repr([ReprInt(SignedInt(I8))])]\n"]'
 #[repr(i8)]
 pub enum I8 {
     First,
 }
 
-//@ is "$.index[*][?(@.name=='I32')].attrs" '["#[attr = Repr([ReprInt(SignedInt(I32))])]\n"]'
+//@ is "$.index[?(@.name=='I32')].attrs" '["#[attr = Repr([ReprInt(SignedInt(I32))])]\n"]'
 #[repr(i32)]
 pub enum I32 {
     First,
 }
 
-//@ is "$.index[*][?(@.name=='Usize')].attrs" '["#[attr = Repr([ReprInt(UnsignedInt(Usize))])]\n"]'
+//@ is "$.index[?(@.name=='Usize')].attrs" '["#[attr = Repr([ReprInt(UnsignedInt(Usize))])]\n"]'
 #[repr(usize)]
 pub enum Usize {
     First,
diff --git a/tests/rustdoc-json/attrs/repr_packed.rs b/tests/rustdoc-json/attrs/repr_packed.rs
index 33acc23b7c894..d4c400f72f811 100644
--- a/tests/rustdoc-json/attrs/repr_packed.rs
+++ b/tests/rustdoc-json/attrs/repr_packed.rs
@@ -3,14 +3,14 @@
 // Note the normalization:
 // `#[repr(packed)]` in has the implict "1" in rustdoc JSON.
 
-//@ is "$.index[*][?(@.name=='Packed')].attrs" '["#[attr = Repr([ReprPacked(Align(1 bytes))])]\n"]'
+//@ is "$.index[?(@.name=='Packed')].attrs" '["#[attr = Repr([ReprPacked(Align(1 bytes))])]\n"]'
 #[repr(packed)]
 pub struct Packed {
     a: i8,
     b: i64,
 }
 
-//@ is "$.index[*][?(@.name=='PackedAligned')].attrs" '["#[attr = Repr([ReprPacked(Align(4 bytes))])]\n"]'
+//@ is "$.index[?(@.name=='PackedAligned')].attrs" '["#[attr = Repr([ReprPacked(Align(4 bytes))])]\n"]'
 #[repr(packed(4))]
 pub struct PackedAligned {
     a: i8,
diff --git a/tests/rustdoc-json/attrs/repr_transparent.rs b/tests/rustdoc-json/attrs/repr_transparent.rs
index ef6e69f8703b1..3f57b21dcc52e 100644
--- a/tests/rustdoc-json/attrs/repr_transparent.rs
+++ b/tests/rustdoc-json/attrs/repr_transparent.rs
@@ -5,18 +5,18 @@
 //
 // https://doc.rust-lang.org/nomicon/other-reprs.html#reprtransparent
 
-//@ is "$.index[*][?(@.name=='Transparent')].attrs" '["#[attr = Repr([ReprTransparent])]\n"]'
+//@ is "$.index[?(@.name=='Transparent')].attrs" '["#[attr = Repr([ReprTransparent])]\n"]'
 #[repr(transparent)]
 pub struct Transparent(pub i64);
 
-//@ is "$.index[*][?(@.name=='TransparentNonPub')].attrs" '["#[attr = Repr([ReprTransparent])]\n"]'
+//@ is "$.index[?(@.name=='TransparentNonPub')].attrs" '["#[attr = Repr([ReprTransparent])]\n"]'
 #[repr(transparent)]
 pub struct TransparentNonPub(i64);
 
-//@ is "$.index[*][?(@.name=='AllZst')].attrs" '["#[attr = Repr([ReprTransparent])]\n"]'
+//@ is "$.index[?(@.name=='AllZst')].attrs" '["#[attr = Repr([ReprTransparent])]\n"]'
 #[repr(transparent)]
 pub struct AllZst<'a>(pub core::marker::PhantomData<&'a ()>, ());
 
-//@ is "$.index[*][?(@.name=='AllZstNotPublic')].attrs" '["#[attr = Repr([ReprTransparent])]\n"]'
+//@ is "$.index[?(@.name=='AllZstNotPublic')].attrs" '["#[attr = Repr([ReprTransparent])]\n"]'
 #[repr(transparent)]
 pub struct AllZstNotPublic<'a>(core::marker::PhantomData<&'a ()>, ());
diff --git a/tests/rustdoc-json/blanket_impls.rs b/tests/rustdoc-json/blanket_impls.rs
index bf0983e66a17f..d500bf5af6bd7 100644
--- a/tests/rustdoc-json/blanket_impls.rs
+++ b/tests/rustdoc-json/blanket_impls.rs
@@ -2,7 +2,7 @@
 
 #![no_std]
 
-//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type"
-//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path"
-//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path.path" \"Infallible\"
+//@ has "$.index[?(@.name=='Error')].inner.assoc_type"
+//@ has "$.index[?(@.name=='Error')].inner.assoc_type.type.resolved_path"
+//@ has "$.index[?(@.name=='Error')].inner.assoc_type.type.resolved_path.path" \"Infallible\"
 pub struct ForBlanketTryFromImpl;
diff --git a/tests/rustdoc-json/doc_hidden_failure.rs b/tests/rustdoc-json/doc_hidden_failure.rs
index 249e35b724365..e68df7e9c61db 100644
--- a/tests/rustdoc-json/doc_hidden_failure.rs
+++ b/tests/rustdoc-json/doc_hidden_failure.rs
@@ -11,8 +11,8 @@ mod auto {
     }
 }
 
-//@ count "$.index[*][?(@.name=='builders')]" 1
-//@ has "$.index[*][?(@.name == 'ActionRowBuilder')"]
+//@ count "$.index[?(@.name=='builders')]" 1
+//@ has "$.index[?(@.name == 'ActionRowBuilder')"]
 pub use auto::*;
 
 pub mod builders {
diff --git a/tests/rustdoc-json/enums/discriminant/basic.rs b/tests/rustdoc-json/enums/discriminant/basic.rs
index 06a240404fb7f..c7f164f340818 100644
--- a/tests/rustdoc-json/enums/discriminant/basic.rs
+++ b/tests/rustdoc-json/enums/discriminant/basic.rs
@@ -1,12 +1,12 @@
 #[repr(i8)]
 pub enum Ordering {
-    //@ is "$.index[*][?(@.name=='Less')].inner.variant.discriminant.expr" '"-1"'
-    //@ is "$.index[*][?(@.name=='Less')].inner.variant.discriminant.value" '"-1"'
+    //@ is "$.index[?(@.name=='Less')].inner.variant.discriminant.expr" '"-1"'
+    //@ is "$.index[?(@.name=='Less')].inner.variant.discriminant.value" '"-1"'
     Less = -1,
-    //@ is "$.index[*][?(@.name=='Equal')].inner.variant.discriminant.expr" '"0"'
-    //@ is "$.index[*][?(@.name=='Equal')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='Equal')].inner.variant.discriminant.expr" '"0"'
+    //@ is "$.index[?(@.name=='Equal')].inner.variant.discriminant.value" '"0"'
     Equal = 0,
-    //@ is "$.index[*][?(@.name=='Greater')].inner.variant.discriminant.expr" '"1"'
-    //@ is "$.index[*][?(@.name=='Greater')].inner.variant.discriminant.value" '"1"'
+    //@ is "$.index[?(@.name=='Greater')].inner.variant.discriminant.expr" '"1"'
+    //@ is "$.index[?(@.name=='Greater')].inner.variant.discriminant.value" '"1"'
     Greater = 1,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/expr.rs b/tests/rustdoc-json/enums/discriminant/expr.rs
index bf2bce8510806..3743b13fec805 100644
--- a/tests/rustdoc-json/enums/discriminant/expr.rs
+++ b/tests/rustdoc-json/enums/discriminant/expr.rs
@@ -1,30 +1,30 @@
 pub enum Foo {
-    //@ is "$.index[*][?(@.name=='Addition')].inner.variant.discriminant.value" '"0"'
-    //@ is "$.index[*][?(@.name=='Addition')].inner.variant.discriminant.expr" '"{ _ }"'
+    //@ is "$.index[?(@.name=='Addition')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='Addition')].inner.variant.discriminant.expr" '"{ _ }"'
     Addition = 0 + 0,
-    //@ is "$.index[*][?(@.name=='Bin')].inner.variant.discriminant.value" '"1"'
-    //@ is "$.index[*][?(@.name=='Bin')].inner.variant.discriminant.expr" '"0b1"'
+    //@ is "$.index[?(@.name=='Bin')].inner.variant.discriminant.value" '"1"'
+    //@ is "$.index[?(@.name=='Bin')].inner.variant.discriminant.expr" '"0b1"'
     Bin = 0b1,
-    //@ is "$.index[*][?(@.name=='Oct')].inner.variant.discriminant.value" '"2"'
-    //@ is "$.index[*][?(@.name=='Oct')].inner.variant.discriminant.expr" '"0o2"'
+    //@ is "$.index[?(@.name=='Oct')].inner.variant.discriminant.value" '"2"'
+    //@ is "$.index[?(@.name=='Oct')].inner.variant.discriminant.expr" '"0o2"'
     Oct = 0o2,
-    //@ is "$.index[*][?(@.name=='PubConst')].inner.variant.discriminant.value" '"3"'
-    //@ is "$.index[*][?(@.name=='PubConst')].inner.variant.discriminant.expr" '"THREE"'
+    //@ is "$.index[?(@.name=='PubConst')].inner.variant.discriminant.value" '"3"'
+    //@ is "$.index[?(@.name=='PubConst')].inner.variant.discriminant.expr" '"THREE"'
     PubConst = THREE,
-    //@ is "$.index[*][?(@.name=='Hex')].inner.variant.discriminant.value" '"4"'
-    //@ is "$.index[*][?(@.name=='Hex')].inner.variant.discriminant.expr" '"0x4"'
+    //@ is "$.index[?(@.name=='Hex')].inner.variant.discriminant.value" '"4"'
+    //@ is "$.index[?(@.name=='Hex')].inner.variant.discriminant.expr" '"0x4"'
     Hex = 0x4,
-    //@ is "$.index[*][?(@.name=='Cast')].inner.variant.discriminant.value" '"5"'
-    //@ is "$.index[*][?(@.name=='Cast')].inner.variant.discriminant.expr" '"{ _ }"'
+    //@ is "$.index[?(@.name=='Cast')].inner.variant.discriminant.value" '"5"'
+    //@ is "$.index[?(@.name=='Cast')].inner.variant.discriminant.expr" '"{ _ }"'
     Cast = 5 as isize,
-    //@ is "$.index[*][?(@.name=='PubCall')].inner.variant.discriminant.value" '"6"'
-    //@ is "$.index[*][?(@.name=='PubCall')].inner.variant.discriminant.expr" '"{ _ }"'
+    //@ is "$.index[?(@.name=='PubCall')].inner.variant.discriminant.value" '"6"'
+    //@ is "$.index[?(@.name=='PubCall')].inner.variant.discriminant.expr" '"{ _ }"'
     PubCall = six(),
-    //@ is "$.index[*][?(@.name=='PrivCall')].inner.variant.discriminant.value" '"7"'
-    //@ is "$.index[*][?(@.name=='PrivCall')].inner.variant.discriminant.expr" '"{ _ }"'
+    //@ is "$.index[?(@.name=='PrivCall')].inner.variant.discriminant.value" '"7"'
+    //@ is "$.index[?(@.name=='PrivCall')].inner.variant.discriminant.expr" '"{ _ }"'
     PrivCall = seven(),
-    //@ is "$.index[*][?(@.name=='PrivConst')].inner.variant.discriminant.value" '"8"'
-    //@ is "$.index[*][?(@.name=='PrivConst')].inner.variant.discriminant.expr" '"EIGHT"'
+    //@ is "$.index[?(@.name=='PrivConst')].inner.variant.discriminant.value" '"8"'
+    //@ is "$.index[?(@.name=='PrivConst')].inner.variant.discriminant.expr" '"EIGHT"'
     PrivConst = EIGHT,
 }
 
diff --git a/tests/rustdoc-json/enums/discriminant/limits.rs b/tests/rustdoc-json/enums/discriminant/limits.rs
index 7508490d6661e..c84181334e35d 100644
--- a/tests/rustdoc-json/enums/discriminant/limits.rs
+++ b/tests/rustdoc-json/enums/discriminant/limits.rs
@@ -3,40 +3,40 @@
 
 #[repr(u64)]
 pub enum U64 {
-    //@ is "$.index[*][?(@.name=='U64Min')].inner.variant.discriminant.value" '"0"'
-    //@ is "$.index[*][?(@.name=='U64Min')].inner.variant.discriminant.expr" '"u64::MIN"'
+    //@ is "$.index[?(@.name=='U64Min')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='U64Min')].inner.variant.discriminant.expr" '"u64::MIN"'
     U64Min = u64::MIN,
-    //@ is "$.index[*][?(@.name=='U64Max')].inner.variant.discriminant.value" '"18446744073709551615"'
-    //@ is "$.index[*][?(@.name=='U64Max')].inner.variant.discriminant.expr" '"u64::MAX"'
+    //@ is "$.index[?(@.name=='U64Max')].inner.variant.discriminant.value" '"18446744073709551615"'
+    //@ is "$.index[?(@.name=='U64Max')].inner.variant.discriminant.expr" '"u64::MAX"'
     U64Max = u64::MAX,
 }
 
 #[repr(i64)]
 pub enum I64 {
-    //@ is "$.index[*][?(@.name=='I64Min')].inner.variant.discriminant.value" '"-9223372036854775808"'
-    //@ is "$.index[*][?(@.name=='I64Min')].inner.variant.discriminant.expr" '"i64::MIN"'
+    //@ is "$.index[?(@.name=='I64Min')].inner.variant.discriminant.value" '"-9223372036854775808"'
+    //@ is "$.index[?(@.name=='I64Min')].inner.variant.discriminant.expr" '"i64::MIN"'
     I64Min = i64::MIN,
-    //@ is "$.index[*][?(@.name=='I64Max')].inner.variant.discriminant.value" '"9223372036854775807"'
-    //@ is "$.index[*][?(@.name=='I64Max')].inner.variant.discriminant.expr" '"i64::MAX"'
+    //@ is "$.index[?(@.name=='I64Max')].inner.variant.discriminant.value" '"9223372036854775807"'
+    //@ is "$.index[?(@.name=='I64Max')].inner.variant.discriminant.expr" '"i64::MAX"'
     I64Max = i64::MAX,
 }
 
 #[repr(u128)]
 pub enum U128 {
-    //@ is "$.index[*][?(@.name=='U128Min')].inner.variant.discriminant.value" '"0"'
-    //@ is "$.index[*][?(@.name=='U128Min')].inner.variant.discriminant.expr" '"u128::MIN"'
+    //@ is "$.index[?(@.name=='U128Min')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='U128Min')].inner.variant.discriminant.expr" '"u128::MIN"'
     U128Min = u128::MIN,
-    //@ is "$.index[*][?(@.name=='U128Max')].inner.variant.discriminant.value" '"340282366920938463463374607431768211455"'
-    //@ is "$.index[*][?(@.name=='U128Max')].inner.variant.discriminant.expr" '"u128::MAX"'
+    //@ is "$.index[?(@.name=='U128Max')].inner.variant.discriminant.value" '"340282366920938463463374607431768211455"'
+    //@ is "$.index[?(@.name=='U128Max')].inner.variant.discriminant.expr" '"u128::MAX"'
     U128Max = u128::MAX,
 }
 
 #[repr(i128)]
 pub enum I128 {
-    //@ is "$.index[*][?(@.name=='I128Min')].inner.variant.discriminant.value" '"-170141183460469231731687303715884105728"'
-    //@ is "$.index[*][?(@.name=='I128Min')].inner.variant.discriminant.expr" '"i128::MIN"'
+    //@ is "$.index[?(@.name=='I128Min')].inner.variant.discriminant.value" '"-170141183460469231731687303715884105728"'
+    //@ is "$.index[?(@.name=='I128Min')].inner.variant.discriminant.expr" '"i128::MIN"'
     I128Min = i128::MIN,
-    //@ is "$.index[*][?(@.name=='I128Max')].inner.variant.discriminant.value" '"170141183460469231731687303715884105727"'
-    //@ is "$.index[*][?(@.name=='I128Max')].inner.variant.discriminant.expr" '"i128::MAX"'
+    //@ is "$.index[?(@.name=='I128Max')].inner.variant.discriminant.value" '"170141183460469231731687303715884105727"'
+    //@ is "$.index[?(@.name=='I128Max')].inner.variant.discriminant.expr" '"i128::MAX"'
     I128Max = i128::MAX,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs b/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs
index 6f66495bed256..acf58048d3a63 100644
--- a/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs
+++ b/tests/rustdoc-json/enums/discriminant/num_underscore_and_suffix.rs
@@ -1,15 +1,15 @@
 #[repr(u32)]
 pub enum Foo {
-    //@ is "$.index[*][?(@.name=='Basic')].inner.variant.discriminant.value" '"0"'
-    //@ is "$.index[*][?(@.name=='Basic')].inner.variant.discriminant.expr" '"0"'
+    //@ is "$.index[?(@.name=='Basic')].inner.variant.discriminant.value" '"0"'
+    //@ is "$.index[?(@.name=='Basic')].inner.variant.discriminant.expr" '"0"'
     Basic = 0,
-    //@ is "$.index[*][?(@.name=='Suffix')].inner.variant.discriminant.value" '"10"'
-    //@ is "$.index[*][?(@.name=='Suffix')].inner.variant.discriminant.expr" '"10u32"'
+    //@ is "$.index[?(@.name=='Suffix')].inner.variant.discriminant.value" '"10"'
+    //@ is "$.index[?(@.name=='Suffix')].inner.variant.discriminant.expr" '"10u32"'
     Suffix = 10u32,
-    //@ is "$.index[*][?(@.name=='Underscore')].inner.variant.discriminant.value" '"100"'
-    //@ is "$.index[*][?(@.name=='Underscore')].inner.variant.discriminant.expr" '"1_0_0"'
+    //@ is "$.index[?(@.name=='Underscore')].inner.variant.discriminant.value" '"100"'
+    //@ is "$.index[?(@.name=='Underscore')].inner.variant.discriminant.expr" '"1_0_0"'
     Underscore = 1_0_0,
-    //@ is "$.index[*][?(@.name=='SuffixUnderscore')].inner.variant.discriminant.value" '"1000"'
-    //@ is "$.index[*][?(@.name=='SuffixUnderscore')].inner.variant.discriminant.expr" '"1_0_0_0u32"'
+    //@ is "$.index[?(@.name=='SuffixUnderscore')].inner.variant.discriminant.value" '"1000"'
+    //@ is "$.index[?(@.name=='SuffixUnderscore')].inner.variant.discriminant.expr" '"1_0_0_0u32"'
     SuffixUnderscore = 1_0_0_0u32,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs b/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs
index 8e7985f07f41c..d8b92cfabb3e9 100644
--- a/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs
+++ b/tests/rustdoc-json/enums/discriminant/only_some_have_discriminant.rs
@@ -1,10 +1,10 @@
 pub enum Foo {
-    //@ is "$.index[*][?(@.name=='Has')].inner.variant.discriminant" '{"expr":"0", "value":"0"}'
+    //@ is "$.index[?(@.name=='Has')].inner.variant.discriminant" '{"expr":"0", "value":"0"}'
     Has = 0,
-    //@ is "$.index[*][?(@.name=='Doesnt')].inner.variant.discriminant" null
+    //@ is "$.index[?(@.name=='Doesnt')].inner.variant.discriminant" null
     Doesnt,
-    //@ is "$.index[*][?(@.name=='AlsoDoesnt')].inner.variant.discriminant" null
+    //@ is "$.index[?(@.name=='AlsoDoesnt')].inner.variant.discriminant" null
     AlsoDoesnt,
-    //@ is "$.index[*][?(@.name=='AlsoHas')].inner.variant.discriminant" '{"expr":"44", "value":"44"}'
+    //@ is "$.index[?(@.name=='AlsoHas')].inner.variant.discriminant" '{"expr":"44", "value":"44"}'
     AlsoHas = 44,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/struct.rs b/tests/rustdoc-json/enums/discriminant/struct.rs
index f2bed77902b03..08fb80540fa99 100644
--- a/tests/rustdoc-json/enums/discriminant/struct.rs
+++ b/tests/rustdoc-json/enums/discriminant/struct.rs
@@ -1,13 +1,13 @@
 #[repr(i32)]
-//@ is "$.index[*][?(@.name=='Foo')].attrs" '["#[attr = Repr([ReprInt(SignedInt(I32))])]\n"]'
+//@ is "$.index[?(@.name=='Foo')].attrs" '["#[attr = Repr([ReprInt(SignedInt(I32))])]\n"]'
 pub enum Foo {
-    //@ is    "$.index[*][?(@.name=='Struct')].inner.variant.discriminant" null
-    //@ count "$.index[*][?(@.name=='Struct')].inner.variant.kind.struct.fields[*]" 0
+    //@ is    "$.index[?(@.name=='Struct')].inner.variant.discriminant" null
+    //@ count "$.index[?(@.name=='Struct')].inner.variant.kind.struct.fields[*]" 0
     Struct {},
-    //@ is    "$.index[*][?(@.name=='StructWithDiscr')].inner.variant.discriminant" '{"expr": "42", "value": "42"}'
-    //@ count "$.index[*][?(@.name=='StructWithDiscr')].inner.variant.kind.struct.fields[*]" 1
+    //@ is    "$.index[?(@.name=='StructWithDiscr')].inner.variant.discriminant" '{"expr": "42", "value": "42"}'
+    //@ count "$.index[?(@.name=='StructWithDiscr')].inner.variant.kind.struct.fields[*]" 1
     StructWithDiscr { x: i32 } = 42,
-    //@ is    "$.index[*][?(@.name=='StructWithHexDiscr')].inner.variant.discriminant"  '{"expr": "0x42", "value": "66"}'
-    //@ count "$.index[*][?(@.name=='StructWithHexDiscr')].inner.variant.kind.struct.fields[*]" 2
+    //@ is    "$.index[?(@.name=='StructWithHexDiscr')].inner.variant.discriminant"  '{"expr": "0x42", "value": "66"}'
+    //@ count "$.index[?(@.name=='StructWithHexDiscr')].inner.variant.kind.struct.fields[*]" 2
     StructWithHexDiscr { x: i32, y: bool } = 0x42,
 }
diff --git a/tests/rustdoc-json/enums/discriminant/tuple.rs b/tests/rustdoc-json/enums/discriminant/tuple.rs
index 201c1cdc88e7e..c74e9a2c58dd4 100644
--- a/tests/rustdoc-json/enums/discriminant/tuple.rs
+++ b/tests/rustdoc-json/enums/discriminant/tuple.rs
@@ -1,13 +1,13 @@
 #[repr(u32)]
-//@ is "$.index[*][?(@.name=='Foo')].attrs" '["#[attr = Repr([ReprInt(UnsignedInt(U32))])]\n"]'
+//@ is "$.index[?(@.name=='Foo')].attrs" '["#[attr = Repr([ReprInt(UnsignedInt(U32))])]\n"]'
 pub enum Foo {
-    //@ is    "$.index[*][?(@.name=='Tuple')].inner.variant.discriminant" null
-    //@ count "$.index[*][?(@.name=='Tuple')].inner.variant.kind.tuple[*]" 0
+    //@ is    "$.index[?(@.name=='Tuple')].inner.variant.discriminant" null
+    //@ count "$.index[?(@.name=='Tuple')].inner.variant.kind.tuple[*]" 0
     Tuple(),
-    //@ is    "$.index[*][?(@.name=='TupleWithDiscr')].inner.variant.discriminant" '{"expr": "1", "value": "1"}'
-    //@ count "$.index[*][?(@.name=='TupleWithDiscr')].inner.variant.kind.tuple[*]" 1
+    //@ is    "$.index[?(@.name=='TupleWithDiscr')].inner.variant.discriminant" '{"expr": "1", "value": "1"}'
+    //@ count "$.index[?(@.name=='TupleWithDiscr')].inner.variant.kind.tuple[*]" 1
     TupleWithDiscr(i32) = 1,
-    //@ is    "$.index[*][?(@.name=='TupleWithBinDiscr')].inner.variant.discriminant" '{"expr": "0b10", "value": "2"}'
-    //@ count "$.index[*][?(@.name=='TupleWithBinDiscr')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='TupleWithBinDiscr')].inner.variant.discriminant" '{"expr": "0b10", "value": "2"}'
+    //@ count "$.index[?(@.name=='TupleWithBinDiscr')].inner.variant.kind.tuple[*]" 2
     TupleWithBinDiscr(i32, i32) = 0b10,
 }
diff --git a/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs b/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs
index 6aec6960b5f6c..6ecd98fadf5b8 100644
--- a/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs
+++ b/tests/rustdoc-json/enums/doc_link_to_foreign_variant.rs
@@ -5,7 +5,7 @@
 extern crate color;
 use color::Color::Red;
 
-//@ set red = "$.index[*][?(@.inner.module.is_crate)].links.Red"
+//@ set red = "$.index[?(@.inner.module.is_crate)].links.Red"
 
-//@ !has "$.index[*][?(@.name == 'Red')]"
-//@ !has "$.index[*][?(@.name == 'Color')]"
+//@ !has "$.index[?(@.name == 'Red')]"
+//@ !has "$.index[?(@.name == 'Color')]"
diff --git a/tests/rustdoc-json/enums/field_hidden.rs b/tests/rustdoc-json/enums/field_hidden.rs
index b353678ac9232..07ee0e62ea91b 100644
--- a/tests/rustdoc-json/enums/field_hidden.rs
+++ b/tests/rustdoc-json/enums/field_hidden.rs
@@ -1,9 +1,9 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/100529>.
 
-//@ has "$.index[*][?(@.name=='ParseError')]"
-//@ has "$.index[*][?(@.name=='UnexpectedEndTag')]"
-//@ is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null]
-//@ is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.discriminant" null
+//@ has "$.index[?(@.name=='ParseError')]"
+//@ has "$.index[?(@.name=='UnexpectedEndTag')]"
+//@ is "$.index[?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null]
+//@ is "$.index[?(@.name=='UnexpectedEndTag')].inner.variant.discriminant" null
 
 pub enum ParseError {
     UnexpectedEndTag(#[doc(hidden)] u32),
diff --git a/tests/rustdoc-json/enums/field_order.rs b/tests/rustdoc-json/enums/field_order.rs
index a78be200b418e..e856068795401 100644
--- a/tests/rustdoc-json/enums/field_order.rs
+++ b/tests/rustdoc-json/enums/field_order.rs
@@ -17,24 +17,24 @@ pub enum Whatever {
     },
 }
 
-//@ set 0 = '$.index[*][?(@.name == "ews_0")].id'
-//@ set 1 = '$.index[*][?(@.name == "dik_1")].id'
-//@ set 2 = '$.index[*][?(@.name == "hsk_2")].id'
-//@ set 3 = '$.index[*][?(@.name == "djt_3")].id'
-//@ set 4 = '$.index[*][?(@.name == "jnr_4")].id'
-//@ set 5 = '$.index[*][?(@.name == "dfs_5")].id'
-//@ set 6 = '$.index[*][?(@.name == "bja_6")].id'
-//@ set 7 = '$.index[*][?(@.name == "lyc_7")].id'
-//@ set 8 = '$.index[*][?(@.name == "yqd_8")].id'
-//@ set 9 = '$.index[*][?(@.name == "vll_9")].id'
+//@ set 0 = '$.index[?(@.name == "ews_0")].id'
+//@ set 1 = '$.index[?(@.name == "dik_1")].id'
+//@ set 2 = '$.index[?(@.name == "hsk_2")].id'
+//@ set 3 = '$.index[?(@.name == "djt_3")].id'
+//@ set 4 = '$.index[?(@.name == "jnr_4")].id'
+//@ set 5 = '$.index[?(@.name == "dfs_5")].id'
+//@ set 6 = '$.index[?(@.name == "bja_6")].id'
+//@ set 7 = '$.index[?(@.name == "lyc_7")].id'
+//@ set 8 = '$.index[?(@.name == "yqd_8")].id'
+//@ set 9 = '$.index[?(@.name == "vll_9")].id'
 
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[0]' $0
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[1]' $1
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[2]' $2
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[3]' $3
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[4]' $4
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[5]' $5
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[6]' $6
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[7]' $7
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[8]' $8
-//@ is '$.index[*][?(@.name == "Foo")].inner.variant.kind.struct.fields[9]' $9
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[0]' $0
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[1]' $1
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[2]' $2
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[3]' $3
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[4]' $4
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[5]' $5
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[6]' $6
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[7]' $7
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[8]' $8
+//@ is '$.index[?(@.name == "Foo")].inner.variant.kind.struct.fields[9]' $9
diff --git a/tests/rustdoc-json/enums/kind.rs b/tests/rustdoc-json/enums/kind.rs
index 517a53828b78a..3c011858630ee 100644
--- a/tests/rustdoc-json/enums/kind.rs
+++ b/tests/rustdoc-json/enums/kind.rs
@@ -1,27 +1,27 @@
 pub enum Foo {
-    //@ set Unit = "$.index[*][?(@.name=='Unit')].id"
-    //@ is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"'
+    //@ set Unit = "$.index[?(@.name=='Unit')].id"
+    //@ is "$.index[?(@.name=='Unit')].inner.variant.kind" '"plain"'
     Unit,
-    //@ set Named = "$.index[*][?(@.name=='Named')].id"
-    //@ is "$.index[*][?(@.name=='Named')].inner.variant.kind.struct" '{"fields": [], "has_stripped_fields": false}'
+    //@ set Named = "$.index[?(@.name=='Named')].id"
+    //@ is "$.index[?(@.name=='Named')].inner.variant.kind.struct" '{"fields": [], "has_stripped_fields": false}'
     Named {},
-    //@ set Tuple = "$.index[*][?(@.name=='Tuple')].id"
-    //@ is "$.index[*][?(@.name=='Tuple')].inner.variant.kind.tuple" []
+    //@ set Tuple = "$.index[?(@.name=='Tuple')].id"
+    //@ is "$.index[?(@.name=='Tuple')].inner.variant.kind.tuple" []
     Tuple(),
-    //@ set NamedField = "$.index[*][?(@.name=='NamedField')].id"
-    //@ set x = "$.index[*][?(@.name=='x' && @.inner.struct_field)].id"
-    //@ is "$.index[*][?(@.name=='NamedField')].inner.variant.kind.struct.fields[*]" $x
-    //@ is "$.index[*][?(@.name=='NamedField')].inner.variant.kind.struct.has_stripped_fields" false
+    //@ set NamedField = "$.index[?(@.name=='NamedField')].id"
+    //@ set x = "$.index[?(@.name=='x' && @.inner.struct_field)].id"
+    //@ is "$.index[?(@.name=='NamedField')].inner.variant.kind.struct.fields[*]" $x
+    //@ is "$.index[?(@.name=='NamedField')].inner.variant.kind.struct.has_stripped_fields" false
     NamedField { x: i32 },
-    //@ set TupleField = "$.index[*][?(@.name=='TupleField')].id"
-    //@ set tup_field = "$.index[*][?(@.name=='0' && @.inner.struct_field)].id"
-    //@ is "$.index[*][?(@.name=='TupleField')].inner.variant.kind.tuple[*]" $tup_field
+    //@ set TupleField = "$.index[?(@.name=='TupleField')].id"
+    //@ set tup_field = "$.index[?(@.name=='0' && @.inner.struct_field)].id"
+    //@ is "$.index[?(@.name=='TupleField')].inner.variant.kind.tuple[*]" $tup_field
     TupleField(i32),
 }
 
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[0]" $Unit
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[1]" $Named
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[2]" $Tuple
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[3]" $NamedField
-//@ is    "$.index[*][?(@.name=='Foo')].inner.enum.variants[4]" $TupleField
-//@ count "$.index[*][?(@.name=='Foo')].inner.enum.variants[*]" 5
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[0]" $Unit
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[1]" $Named
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[2]" $Tuple
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[3]" $NamedField
+//@ is    "$.index[?(@.name=='Foo')].inner.enum.variants[4]" $TupleField
+//@ count "$.index[?(@.name=='Foo')].inner.enum.variants[*]" 5
diff --git a/tests/rustdoc-json/enums/struct_field_hidden.rs b/tests/rustdoc-json/enums/struct_field_hidden.rs
index 2184f58b1da80..cd9d2ce0b8a4d 100644
--- a/tests/rustdoc-json/enums/struct_field_hidden.rs
+++ b/tests/rustdoc-json/enums/struct_field_hidden.rs
@@ -2,15 +2,15 @@ pub enum Foo {
     Variant {
         #[doc(hidden)]
         a: i32,
-        //@ set b = "$.index[*][?(@.name=='b')].id"
+        //@ set b = "$.index[?(@.name=='b')].id"
         b: i32,
         #[doc(hidden)]
         x: i32,
-        //@ set y = "$.index[*][?(@.name=='y')].id"
+        //@ set y = "$.index[?(@.name=='y')].id"
         y: i32,
     },
-    //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.has_stripped_fields" true
-    //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[0]" $b
-    //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[1]" $y
-    //@ count "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[*]" 2
+    //@ is "$.index[?(@.name=='Variant')].inner.variant.kind.struct.has_stripped_fields" true
+    //@ is "$.index[?(@.name=='Variant')].inner.variant.kind.struct.fields[0]" $b
+    //@ is "$.index[?(@.name=='Variant')].inner.variant.kind.struct.fields[1]" $y
+    //@ count "$.index[?(@.name=='Variant')].inner.variant.kind.struct.fields[*]" 2
 }
diff --git a/tests/rustdoc-json/enums/tuple_fields_hidden.rs b/tests/rustdoc-json/enums/tuple_fields_hidden.rs
index 3ac7a3ce0fc13..aa25625b94cfa 100644
--- a/tests/rustdoc-json/enums/tuple_fields_hidden.rs
+++ b/tests/rustdoc-json/enums/tuple_fields_hidden.rs
@@ -1,80 +1,80 @@
-//@ set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id"
-//@ set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id"
-//@ set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id"
-//@ set 2.2.1 = "$.index[*][?(@.docs=='2.2.1')].id"
-//@ set 2.3.0 = "$.index[*][?(@.docs=='2.3.0')].id"
-//@ set 3.1.1 = "$.index[*][?(@.docs=='3.1.1')].id"
-//@ set 3.1.2 = "$.index[*][?(@.docs=='3.1.2')].id"
-//@ set 3.2.0 = "$.index[*][?(@.docs=='3.2.0')].id"
-//@ set 3.2.2 = "$.index[*][?(@.docs=='3.2.2')].id"
-//@ set 3.3.0 = "$.index[*][?(@.docs=='3.3.0')].id"
-//@ set 3.3.1 = "$.index[*][?(@.docs=='3.3.1')].id"
+//@ set 1.1.0 = "$.index[?(@.docs=='1.1.0')].id"
+//@ set 2.1.0 = "$.index[?(@.docs=='2.1.0')].id"
+//@ set 2.1.1 = "$.index[?(@.docs=='2.1.1')].id"
+//@ set 2.2.1 = "$.index[?(@.docs=='2.2.1')].id"
+//@ set 2.3.0 = "$.index[?(@.docs=='2.3.0')].id"
+//@ set 3.1.1 = "$.index[?(@.docs=='3.1.1')].id"
+//@ set 3.1.2 = "$.index[?(@.docs=='3.1.2')].id"
+//@ set 3.2.0 = "$.index[?(@.docs=='3.2.0')].id"
+//@ set 3.2.2 = "$.index[?(@.docs=='3.2.2')].id"
+//@ set 3.3.0 = "$.index[?(@.docs=='3.3.0')].id"
+//@ set 3.3.1 = "$.index[?(@.docs=='3.3.1')].id"
 
 pub enum EnumWithStrippedTupleVariants {
-    //@ count "$.index[*][?(@.name=='None')].inner.variant.kind.tuple[*]" 0
+    //@ count "$.index[?(@.name=='None')].inner.variant.kind.tuple[*]" 0
     None(),
 
-    //@ count "$.index[*][?(@.name=='One')].inner.variant.kind.tuple[*]" 1
-    //@ is    "$.index[*][?(@.name=='One')].inner.variant.kind.tuple[0]" $1.1.0
+    //@ count "$.index[?(@.name=='One')].inner.variant.kind.tuple[*]" 1
+    //@ is    "$.index[?(@.name=='One')].inner.variant.kind.tuple[0]" $1.1.0
     One(/** 1.1.0*/ bool),
-    //@ count "$.index[*][?(@.name=='OneHidden')].inner.variant.kind.tuple[*]" 1
-    //@ is    "$.index[*][?(@.name=='OneHidden')].inner.variant.kind.tuple[0]" null
+    //@ count "$.index[?(@.name=='OneHidden')].inner.variant.kind.tuple[*]" 1
+    //@ is    "$.index[?(@.name=='OneHidden')].inner.variant.kind.tuple[0]" null
     OneHidden(#[doc(hidden)] bool),
 
-    //@ count "$.index[*][?(@.name=='Two')].inner.variant.kind.tuple[*]" 2
-    //@ is    "$.index[*][?(@.name=='Two')].inner.variant.kind.tuple[0]" $2.1.0
-    //@ is    "$.index[*][?(@.name=='Two')].inner.variant.kind.tuple[1]" $2.1.1
+    //@ count "$.index[?(@.name=='Two')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='Two')].inner.variant.kind.tuple[0]" $2.1.0
+    //@ is    "$.index[?(@.name=='Two')].inner.variant.kind.tuple[1]" $2.1.1
     Two(/** 2.1.0*/ bool, /** 2.1.1*/ bool),
-    //@ count "$.index[*][?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[*]" 2
-    //@ is    "$.index[*][?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[0]" null
-    //@ is    "$.index[*][?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[1]" $2.2.1
+    //@ count "$.index[?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[0]" null
+    //@ is    "$.index[?(@.name=='TwoLeftHidden')].inner.variant.kind.tuple[1]" $2.2.1
     TwoLeftHidden(#[doc(hidden)] bool, /** 2.2.1*/ bool),
-    //@ count "$.index[*][?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[*]" 2
-    //@ is    "$.index[*][?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[0]" $2.3.0
-    //@ is    "$.index[*][?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[1]" null
+    //@ count "$.index[?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[0]" $2.3.0
+    //@ is    "$.index[?(@.name=='TwoRightHidden')].inner.variant.kind.tuple[1]" null
     TwoRightHidden(/** 2.3.0*/ bool, #[doc(hidden)] bool),
-    //@ count "$.index[*][?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[*]" 2
-    //@ is    "$.index[*][?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[0]" null
-    //@ is    "$.index[*][?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[1]" null
+    //@ count "$.index[?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[*]" 2
+    //@ is    "$.index[?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[0]" null
+    //@ is    "$.index[?(@.name=='TwoBothHidden')].inner.variant.kind.tuple[1]" null
     TwoBothHidden(#[doc(hidden)] bool, #[doc(hidden)] bool),
 
-    //@ count "$.index[*][?(@.name=='Three1')].inner.variant.kind.tuple[*]" 3
-    //@ is    "$.index[*][?(@.name=='Three1')].inner.variant.kind.tuple[0]" null
-    //@ is    "$.index[*][?(@.name=='Three1')].inner.variant.kind.tuple[1]" $3.1.1
-    //@ is    "$.index[*][?(@.name=='Three1')].inner.variant.kind.tuple[2]" $3.1.2
+    //@ count "$.index[?(@.name=='Three1')].inner.variant.kind.tuple[*]" 3
+    //@ is    "$.index[?(@.name=='Three1')].inner.variant.kind.tuple[0]" null
+    //@ is    "$.index[?(@.name=='Three1')].inner.variant.kind.tuple[1]" $3.1.1
+    //@ is    "$.index[?(@.name=='Three1')].inner.variant.kind.tuple[2]" $3.1.2
     Three1(#[doc(hidden)] bool, /** 3.1.1*/ bool, /** 3.1.2*/ bool),
-    //@ count "$.index[*][?(@.name=='Three2')].inner.variant.kind.tuple[*]" 3
-    //@ is    "$.index[*][?(@.name=='Three2')].inner.variant.kind.tuple[0]" $3.2.0
-    //@ is    "$.index[*][?(@.name=='Three2')].inner.variant.kind.tuple[1]" null
-    //@ is    "$.index[*][?(@.name=='Three2')].inner.variant.kind.tuple[2]" $3.2.2
+    //@ count "$.index[?(@.name=='Three2')].inner.variant.kind.tuple[*]" 3
+    //@ is    "$.index[?(@.name=='Three2')].inner.variant.kind.tuple[0]" $3.2.0
+    //@ is    "$.index[?(@.name=='Three2')].inner.variant.kind.tuple[1]" null
+    //@ is    "$.index[?(@.name=='Three2')].inner.variant.kind.tuple[2]" $3.2.2
     Three2(/** 3.2.0*/ bool, #[doc(hidden)] bool, /** 3.2.2*/ bool),
-    //@ count "$.index[*][?(@.name=='Three3')].inner.variant.kind.tuple[*]" 3
-    //@ is    "$.index[*][?(@.name=='Three3')].inner.variant.kind.tuple[0]" $3.3.0
-    //@ is    "$.index[*][?(@.name=='Three3')].inner.variant.kind.tuple[1]" $3.3.1
-    //@ is    "$.index[*][?(@.name=='Three3')].inner.variant.kind.tuple[2]" null
+    //@ count "$.index[?(@.name=='Three3')].inner.variant.kind.tuple[*]" 3
+    //@ is    "$.index[?(@.name=='Three3')].inner.variant.kind.tuple[0]" $3.3.0
+    //@ is    "$.index[?(@.name=='Three3')].inner.variant.kind.tuple[1]" $3.3.1
+    //@ is    "$.index[?(@.name=='Three3')].inner.variant.kind.tuple[2]" null
     Three3(/** 3.3.0*/ bool, /** 3.3.1*/ bool, #[doc(hidden)] bool),
 }
 
-//@ is "$.index[*][?(@.docs=='1.1.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='2.1.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='2.1.1')].name" '"1"'
-//@ is "$.index[*][?(@.docs=='2.2.1')].name" '"1"'
-//@ is "$.index[*][?(@.docs=='2.3.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='3.1.1')].name" '"1"'
-//@ is "$.index[*][?(@.docs=='3.1.2')].name" '"2"'
-//@ is "$.index[*][?(@.docs=='3.2.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='3.2.2')].name" '"2"'
-//@ is "$.index[*][?(@.docs=='3.3.0')].name" '"0"'
-//@ is "$.index[*][?(@.docs=='3.3.1')].name" '"1"'
+//@ is "$.index[?(@.docs=='1.1.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='2.1.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='2.1.1')].name" '"1"'
+//@ is "$.index[?(@.docs=='2.2.1')].name" '"1"'
+//@ is "$.index[?(@.docs=='2.3.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='3.1.1')].name" '"1"'
+//@ is "$.index[?(@.docs=='3.1.2')].name" '"2"'
+//@ is "$.index[?(@.docs=='3.2.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='3.2.2')].name" '"2"'
+//@ is "$.index[?(@.docs=='3.3.0')].name" '"0"'
+//@ is "$.index[?(@.docs=='3.3.1')].name" '"1"'
 
-//@ is "$.index[*][?(@.docs=='1.1.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='2.1.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='2.1.1')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='2.2.1')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='2.3.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.1.1')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.1.2')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.2.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.2.2')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.3.0')].inner.struct_field" '{"primitive": "bool"}'
-//@ is "$.index[*][?(@.docs=='3.3.1')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='1.1.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='2.1.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='2.1.1')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='2.2.1')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='2.3.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.1.1')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.1.2')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.2.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.2.2')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.3.0')].inner.struct_field" '{"primitive": "bool"}'
+//@ is "$.index[?(@.docs=='3.3.1')].inner.struct_field" '{"primitive": "bool"}'
diff --git a/tests/rustdoc-json/enums/use_glob.rs b/tests/rustdoc-json/enums/use_glob.rs
index 2631b43da8e0e..18f21ff090334 100644
--- a/tests/rustdoc-json/enums/use_glob.rs
+++ b/tests/rustdoc-json/enums/use_glob.rs
@@ -1,15 +1,15 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/104942>
 
-//@ set Color = "$.index[*][?(@.name == 'Color')].id"
+//@ set Color = "$.index[?(@.name == 'Color')].id"
 pub enum Color {
     Red,
     Green,
     Blue,
 }
 
-//@ set use_Color = "$.index[*][?(@.inner.use)].id"
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $Color
-//@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" true
+//@ set use_Color = "$.index[?(@.inner.use)].id"
+//@ is "$.index[?(@.inner.use)].inner.use.id" $Color
+//@ is "$.index[?(@.inner.use)].inner.use.is_glob" true
 pub use Color::*;
 
-//@ ismany "$.index[*][?(@.name == 'use_glob')].inner.module.items[*]" $Color $use_Color
+//@ ismany "$.index[?(@.name == 'use_glob')].inner.module.items[*]" $Color $use_Color
diff --git a/tests/rustdoc-json/enums/use_variant.rs b/tests/rustdoc-json/enums/use_variant.rs
index 6d3322e0ba9a1..26cca0743d923 100644
--- a/tests/rustdoc-json/enums/use_variant.rs
+++ b/tests/rustdoc-json/enums/use_variant.rs
@@ -1,12 +1,12 @@
-//@ set AlwaysNone = "$.index[*][?(@.name == 'AlwaysNone')].id"
+//@ set AlwaysNone = "$.index[?(@.name == 'AlwaysNone')].id"
 pub enum AlwaysNone {
-    //@ set None = "$.index[*][?(@.name == 'None')].id"
+    //@ set None = "$.index[?(@.name == 'None')].id"
     None,
 }
-//@ is "$.index[*][?(@.name == 'AlwaysNone')].inner.enum.variants[*]" $None
+//@ is "$.index[?(@.name == 'AlwaysNone')].inner.enum.variants[*]" $None
 
-//@ set use_None = "$.index[*][?(@.inner.use)].id"
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $None
+//@ set use_None = "$.index[?(@.inner.use)].id"
+//@ is "$.index[?(@.inner.use)].inner.use.id" $None
 pub use AlwaysNone::None;
 
-//@ ismany "$.index[*][?(@.name == 'use_variant')].inner.module.items[*]" $AlwaysNone $use_None
+//@ ismany "$.index[?(@.name == 'use_variant')].inner.module.items[*]" $AlwaysNone $use_None
diff --git a/tests/rustdoc-json/enums/use_variant_foreign.rs b/tests/rustdoc-json/enums/use_variant_foreign.rs
index a9ad61b9fe35e..14e07b4123e6e 100644
--- a/tests/rustdoc-json/enums/use_variant_foreign.rs
+++ b/tests/rustdoc-json/enums/use_variant_foreign.rs
@@ -2,8 +2,8 @@
 
 extern crate color;
 
-//@ has "$.index[*].inner.use[?(@.name == 'Red')]"
+//@ has "$.index[?(@.inner.use.name == 'Red')]"
 pub use color::Color::Red;
 
-//@ !has "$.index[*][?(@.name == 'Red')]"
-//@ !has "$.index[*][?(@.name == 'Color')]"
+//@ !has "$.index[?(@.name == 'Red')]"
+//@ !has "$.index[?(@.name == 'Color')]"
diff --git a/tests/rustdoc-json/enums/variant_order.rs b/tests/rustdoc-json/enums/variant_order.rs
index 6ebe28c94ca19..dd11c0963eed7 100644
--- a/tests/rustdoc-json/enums/variant_order.rs
+++ b/tests/rustdoc-json/enums/variant_order.rs
@@ -15,24 +15,24 @@ pub enum Foo {
     Vll9,
 }
 
-//@ set 0 = '$.index[*][?(@.name == "Ews0")].id'
-//@ set 1 = '$.index[*][?(@.name == "Dik1")].id'
-//@ set 2 = '$.index[*][?(@.name == "Hsk2")].id'
-//@ set 3 = '$.index[*][?(@.name == "Djt3")].id'
-//@ set 4 = '$.index[*][?(@.name == "Jnr4")].id'
-//@ set 5 = '$.index[*][?(@.name == "Dfs5")].id'
-//@ set 6 = '$.index[*][?(@.name == "Bja6")].id'
-//@ set 7 = '$.index[*][?(@.name == "Lyc7")].id'
-//@ set 8 = '$.index[*][?(@.name == "Yqd8")].id'
-//@ set 9 = '$.index[*][?(@.name == "Vll9")].id'
+//@ set 0 = '$.index[?(@.name == "Ews0")].id'
+//@ set 1 = '$.index[?(@.name == "Dik1")].id'
+//@ set 2 = '$.index[?(@.name == "Hsk2")].id'
+//@ set 3 = '$.index[?(@.name == "Djt3")].id'
+//@ set 4 = '$.index[?(@.name == "Jnr4")].id'
+//@ set 5 = '$.index[?(@.name == "Dfs5")].id'
+//@ set 6 = '$.index[?(@.name == "Bja6")].id'
+//@ set 7 = '$.index[?(@.name == "Lyc7")].id'
+//@ set 8 = '$.index[?(@.name == "Yqd8")].id'
+//@ set 9 = '$.index[?(@.name == "Vll9")].id'
 
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[0]' $0
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[1]' $1
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[2]' $2
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[3]' $3
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[4]' $4
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[5]' $5
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[6]' $6
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[7]' $7
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[8]' $8
-//@ is '$.index[*][?(@.name == "Foo")].inner.enum.variants[9]' $9
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[0]' $0
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[1]' $1
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[2]' $2
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[3]' $3
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[4]' $4
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[5]' $5
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[6]' $6
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[7]' $7
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[8]' $8
+//@ is '$.index[?(@.name == "Foo")].inner.enum.variants[9]' $9
diff --git a/tests/rustdoc-json/enums/variant_struct.rs b/tests/rustdoc-json/enums/variant_struct.rs
index 44a0c946711fb..730689c8afa0c 100644
--- a/tests/rustdoc-json/enums/variant_struct.rs
+++ b/tests/rustdoc-json/enums/variant_struct.rs
@@ -1,10 +1,10 @@
-//@ is "$.index[*][?(@.name=='EnumStruct')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='EnumStruct')].inner.enum"
+//@ is "$.index[?(@.name=='EnumStruct')].visibility" \"public\"
+//@ has "$.index[?(@.name=='EnumStruct')].inner.enum"
 pub enum EnumStruct {
-    //@ has "$.index[*][?(@.name=='x')].inner.struct_field"
-    //@ set x = "$.index[*][?(@.name=='x')].id"
-    //@ has "$.index[*][?(@.name=='y')].inner.struct_field"
-    //@ set y = "$.index[*][?(@.name=='y')].id"
-    //@ ismany "$.index[*][?(@.name=='VariantS')].inner.variant.kind.struct.fields[*]" $x $y
+    //@ has "$.index[?(@.name=='x')].inner.struct_field"
+    //@ set x = "$.index[?(@.name=='x')].id"
+    //@ has "$.index[?(@.name=='y')].inner.struct_field"
+    //@ set y = "$.index[?(@.name=='y')].id"
+    //@ ismany "$.index[?(@.name=='VariantS')].inner.variant.kind.struct.fields[*]" $x $y
     VariantS { x: u32, y: String },
 }
diff --git a/tests/rustdoc-json/enums/variant_tuple_struct.rs b/tests/rustdoc-json/enums/variant_tuple_struct.rs
index 04f0cbb40c4a2..0fc06920e4b2c 100644
--- a/tests/rustdoc-json/enums/variant_tuple_struct.rs
+++ b/tests/rustdoc-json/enums/variant_tuple_struct.rs
@@ -1,10 +1,10 @@
-//@ is "$.index[*][?(@.name=='EnumTupleStruct')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='EnumTupleStruct')].inner.enum"
+//@ is "$.index[?(@.name=='EnumTupleStruct')].visibility" \"public\"
+//@ has "$.index[?(@.name=='EnumTupleStruct')].inner.enum"
 pub enum EnumTupleStruct {
-    //@ has "$.index[*][?(@.name=='0')].inner.struct_field"
-    //@ set f0 = "$.index[*][?(@.name=='0')].id"
-    //@ has "$.index[*][?(@.name=='1')].inner.struct_field"
-    //@ set f1 = "$.index[*][?(@.name=='1')].id"
-    //@ ismany "$.index[*][?(@.name=='VariantA')].inner.variant.kind.tuple[*]" $f0 $f1
+    //@ has "$.index[?(@.name=='0')].inner.struct_field"
+    //@ set f0 = "$.index[?(@.name=='0')].id"
+    //@ has "$.index[?(@.name=='1')].inner.struct_field"
+    //@ set f1 = "$.index[?(@.name=='1')].id"
+    //@ ismany "$.index[?(@.name=='VariantA')].inner.variant.kind.tuple[*]" $f0 $f1
     VariantA(u32, String),
 }
diff --git a/tests/rustdoc-json/fn_pointer/abi.rs b/tests/rustdoc-json/fn_pointer/abi.rs
index 13a967bd35e2e..34150c0fe89e0 100644
--- a/tests/rustdoc-json/fn_pointer/abi.rs
+++ b/tests/rustdoc-json/fn_pointer/abi.rs
@@ -1,22 +1,22 @@
 #![feature(abi_vectorcall)]
 
-//@ is "$.index[*][?(@.name=='AbiRust')].inner.type_alias.type.function_pointer.header.abi" \"Rust\"
+//@ is "$.index[?(@.name=='AbiRust')].inner.type_alias.type.function_pointer.header.abi" \"Rust\"
 pub type AbiRust = fn();
 
-//@ is "$.index[*][?(@.name=='AbiC')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": false}}'
+//@ is "$.index[?(@.name=='AbiC')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": false}}'
 pub type AbiC = extern "C" fn();
 
-//@ is "$.index[*][?(@.name=='AbiSystem')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": false}}'
+//@ is "$.index[?(@.name=='AbiSystem')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": false}}'
 pub type AbiSystem = extern "system" fn();
 
-//@ is "$.index[*][?(@.name=='AbiCUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": true}}'
+//@ is "$.index[?(@.name=='AbiCUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"C": {"unwind": true}}'
 pub type AbiCUnwind = extern "C-unwind" fn();
 
-//@ is "$.index[*][?(@.name=='AbiSystemUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": true}}'
+//@ is "$.index[?(@.name=='AbiSystemUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": true}}'
 pub type AbiSystemUnwind = extern "system-unwind" fn();
 
-//@ is "$.index[*][?(@.name=='AbiVecorcall')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall\""'
+//@ is "$.index[?(@.name=='AbiVecorcall')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall\""'
 pub type AbiVecorcall = extern "vectorcall" fn();
 
-//@ is "$.index[*][?(@.name=='AbiVecorcallUnwind')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall-unwind\""'
+//@ is "$.index[?(@.name=='AbiVecorcallUnwind')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall-unwind\""'
 pub type AbiVecorcallUnwind = extern "vectorcall-unwind" fn();
diff --git a/tests/rustdoc-json/fn_pointer/generics.rs b/tests/rustdoc-json/fn_pointer/generics.rs
index c974b472297c3..960b91e7d8eab 100644
--- a/tests/rustdoc-json/fn_pointer/generics.rs
+++ b/tests/rustdoc-json/fn_pointer/generics.rs
@@ -1,8 +1,8 @@
-//@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][0]" '"val"'
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][1].borrowed_ref.lifetime" \"\'c\"
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.output.primitive" \"i32\"
-//@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[*]" 1
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].name" \"\'c\"
-//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
+//@ count "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][0]" '"val"'
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][1].borrowed_ref.lifetime" \"\'c\"
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.output.primitive" \"i32\"
+//@ count "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[*]" 1
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].name" \"\'c\"
+//@ is "$.index[?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
 pub type WithHigherRankTraitBounds = for<'c> fn(val: &'c i32) -> i32;
diff --git a/tests/rustdoc-json/fn_pointer/qualifiers.rs b/tests/rustdoc-json/fn_pointer/qualifiers.rs
index 398e31f72db06..769749d0dd4c9 100644
--- a/tests/rustdoc-json/fn_pointer/qualifiers.rs
+++ b/tests/rustdoc-json/fn_pointer/qualifiers.rs
@@ -1,9 +1,9 @@
-//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_unsafe" false
-//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_const" false
-//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_async" false
+//@ is "$.index[?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_unsafe" false
+//@ is "$.index[?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_const" false
+//@ is "$.index[?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_async" false
 pub type FnPointer = fn();
 
-//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_unsafe" true
-//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_const" false
-//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_async" false
+//@ is "$.index[?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_unsafe" true
+//@ is "$.index[?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_const" false
+//@ is "$.index[?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_async" false
 pub type UnsafePointer = unsafe fn();
diff --git a/tests/rustdoc-json/fns/abi.rs b/tests/rustdoc-json/fns/abi.rs
index 68957f7995214..7277bb1f59a40 100644
--- a/tests/rustdoc-json/fns/abi.rs
+++ b/tests/rustdoc-json/fns/abi.rs
@@ -1,22 +1,22 @@
 #![feature(abi_vectorcall)]
 
-//@ is "$.index[*][?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
+//@ is "$.index[?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
 pub fn abi_rust() {}
 
-//@ is "$.index[*][?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
+//@ is "$.index[?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
 pub extern "C" fn abi_c() {}
 
-//@ is "$.index[*][?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
+//@ is "$.index[?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
 pub extern "system" fn abi_system() {}
 
-//@ is "$.index[*][?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
+//@ is "$.index[?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
 pub extern "C-unwind" fn abi_c_unwind() {}
 
-//@ is "$.index[*][?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
+//@ is "$.index[?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
 pub extern "system-unwind" fn abi_system_unwind() {}
 
-//@ is "$.index[*][?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
+//@ is "$.index[?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
 pub extern "vectorcall" fn abi_vectorcall() {}
 
-//@ is "$.index[*][?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
+//@ is "$.index[?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
 pub extern "vectorcall-unwind" fn abi_vectorcall_unwind() {}
diff --git a/tests/rustdoc-json/fns/async_return.rs b/tests/rustdoc-json/fns/async_return.rs
index ddfd4ccf90d05..e7c6a2981aceb 100644
--- a/tests/rustdoc-json/fns/async_return.rs
+++ b/tests/rustdoc-json/fns/async_return.rs
@@ -4,30 +4,30 @@
 
 use std::future::Future;
 
-//@ is "$.index[*][?(@.name=='get_int')].inner.function.sig.output.primitive" \"i32\"
-//@ is "$.index[*][?(@.name=='get_int')].inner.function.header.is_async" false
+//@ is "$.index[?(@.name=='get_int')].inner.function.sig.output.primitive" \"i32\"
+//@ is "$.index[?(@.name=='get_int')].inner.function.header.is_async" false
 pub fn get_int() -> i32 {
     42
 }
 
-//@ is "$.index[*][?(@.name=='get_int_async')].inner.function.sig.output.primitive" \"i32\"
-//@ is "$.index[*][?(@.name=='get_int_async')].inner.function.header.is_async" true
+//@ is "$.index[?(@.name=='get_int_async')].inner.function.sig.output.primitive" \"i32\"
+//@ is "$.index[?(@.name=='get_int_async')].inner.function.header.is_async" true
 pub async fn get_int_async() -> i32 {
     42
 }
 
-//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
-//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
-//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive"  \"i32\"
-//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.header.is_async" false
+//@ is "$.index[?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
+//@ is "$.index[?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
+//@ is "$.index[?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive"  \"i32\"
+//@ is "$.index[?(@.name=='get_int_future')].inner.function.header.is_async" false
 pub fn get_int_future() -> impl Future<Output = i32> {
     async { 42 }
 }
 
-//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
-//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
-//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive" \"i32\"
-//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.header.is_async" true
+//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
+//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
+//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive" \"i32\"
+//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.header.is_async" true
 pub async fn get_int_future_async() -> impl Future<Output = i32> {
     async { 42 }
 }
diff --git a/tests/rustdoc-json/fns/extern_c_variadic.rs b/tests/rustdoc-json/fns/extern_c_variadic.rs
index 8e9085640e041..d90bb83d98ff7 100644
--- a/tests/rustdoc-json/fns/extern_c_variadic.rs
+++ b/tests/rustdoc-json/fns/extern_c_variadic.rs
@@ -1,6 +1,6 @@
 extern "C" {
-    //@ is "$.index[*][?(@.name == 'not_variadic')].inner.function.sig.is_c_variadic" false
+    //@ is "$.index[?(@.name == 'not_variadic')].inner.function.sig.is_c_variadic" false
     pub fn not_variadic(_: i32);
-    //@ is "$.index[*][?(@.name == 'variadic')].inner.function.sig.is_c_variadic" true
+    //@ is "$.index[?(@.name == 'variadic')].inner.function.sig.is_c_variadic" true
     pub fn variadic(_: i32, ...);
 }
diff --git a/tests/rustdoc-json/fns/extern_safe.rs b/tests/rustdoc-json/fns/extern_safe.rs
index b00f9f50bd2b2..bc217ae914c45 100644
--- a/tests/rustdoc-json/fns/extern_safe.rs
+++ b/tests/rustdoc-json/fns/extern_safe.rs
@@ -1,17 +1,17 @@
 extern "C" {
-    //@ is "$.index[*][?(@.name=='f1')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='f1')].inner.function.header.is_unsafe" true
     pub fn f1();
 
     // items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers
 }
 
 unsafe extern "C" {
-    //@ is "$.index[*][?(@.name=='f4')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='f4')].inner.function.header.is_unsafe" true
     pub fn f4();
 
-    //@ is "$.index[*][?(@.name=='f5')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='f5')].inner.function.header.is_unsafe" true
     pub unsafe fn f5();
 
-    //@ is "$.index[*][?(@.name=='f6')].inner.function.header.is_unsafe" false
+    //@ is "$.index[?(@.name=='f6')].inner.function.header.is_unsafe" false
     pub safe fn f6();
 }
diff --git a/tests/rustdoc-json/fns/generic_args.rs b/tests/rustdoc-json/fns/generic_args.rs
index 6a7124976f8b9..2ea68173d68d8 100644
--- a/tests/rustdoc-json/fns/generic_args.rs
+++ b/tests/rustdoc-json/fns/generic_args.rs
@@ -1,58 +1,58 @@
-//@ set foo = "$.index[*][?(@.name=='Foo')].id"
+//@ set foo = "$.index[?(@.name=='Foo')].id"
 pub trait Foo {}
 
-//@ set generic_foo = "$.index[*][?(@.name=='GenericFoo')].id"
+//@ set generic_foo = "$.index[?(@.name=='GenericFoo')].id"
 pub trait GenericFoo<'a> {}
 
-//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.where_predicates" "[]"
-//@ count "$.index[*][?(@.name=='generics')].inner.function.generics.params[*]" 1
-//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].name" '"F"'
-//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.default" 'null'
-//@ count "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" '$foo'
-//@ count "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[0][0]" '"f"'
-//@ is "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[0][1].generic" '"F"'
+//@ is "$.index[?(@.name=='generics')].inner.function.generics.where_predicates" "[]"
+//@ count "$.index[?(@.name=='generics')].inner.function.generics.params[*]" 1
+//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].name" '"F"'
+//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.default" 'null'
+//@ count "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[*]" 1
+//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" '$foo'
+//@ count "$.index[?(@.name=='generics')].inner.function.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='generics')].inner.function.sig.inputs[0][0]" '"f"'
+//@ is "$.index[?(@.name=='generics')].inner.function.sig.inputs[0][1].generic" '"F"'
 pub fn generics<F: Foo>(f: F) {}
 
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.where_predicates" "[]"
-//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[*]" 1
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[0].name" '"impl Foo"'
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $foo
-//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][0]" '"f"'
-//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[*]" 1
-//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $foo
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.where_predicates" "[]"
+//@ count "$.index[?(@.name=='impl_trait')].inner.function.generics.params[*]" 1
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.params[0].name" '"impl Foo"'
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $foo
+//@ count "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][0]" '"f"'
+//@ count "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[*]" 1
+//@ is "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $foo
 pub fn impl_trait(f: impl Foo) {}
 
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[*]" 3
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[0].name" '"F"'
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "is_synthetic": false}}'
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[*]" 3
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[0][0]" '"f"'
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[0][1].generic" '"F"'
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[*]" 3
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.params[*]" 3
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.params[0].name" '"F"'
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "is_synthetic": false}}'
+//@ count "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[*]" 3
+//@ is "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[0][0]" '"f"'
+//@ is "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[0][1].generic" '"F"'
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[*]" 3
 
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.type.generic" \"F\"
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].trait_bound.trait.id" $foo
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.type.generic" \"F\"
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].trait_bound.trait.id" $foo
 
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.type.generic" \"G\"
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.trait.id" $generic_foo
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].name" \"\'a\"
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].kind.lifetime.outlives" "[]"
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.generic_params" "[]"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.type.generic" \"G\"
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.trait.id" $generic_foo
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].name" \"\'a\"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].kind.lifetime.outlives" "[]"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.generic_params" "[]"
 
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.lifetime" \"\'b\"
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.type.generic" \"H\"
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.trait.id" $foo
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.generic_params" "[]"
-//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[*]" 1
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].name" \"\'b\"
-//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].kind.lifetime.outlives" "[]"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.lifetime" \"\'b\"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.type.generic" \"H\"
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.trait.id" $foo
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.generic_params" "[]"
+//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[*]" 1
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].name" \"\'b\"
+//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].kind.lifetime.outlives" "[]"
 pub fn where_clase<F, G, H>(f: F, g: G, h: H)
 where
     F: Foo,
diff --git a/tests/rustdoc-json/fns/generic_returns.rs b/tests/rustdoc-json/fns/generic_returns.rs
index 90e17525c4460..a0d4c745599cb 100644
--- a/tests/rustdoc-json/fns/generic_returns.rs
+++ b/tests/rustdoc-json/fns/generic_returns.rs
@@ -1,11 +1,11 @@
-//@ count "$.index[*][?(@.name=='generic_returns')].inner.module.items[*]" 2
+//@ count "$.index[?(@.name=='generic_returns')].inner.module.items[*]" 2
 
-//@ set foo = "$.index[*][?(@.name=='Foo')].id"
+//@ set foo = "$.index[?(@.name=='Foo')].id"
 pub trait Foo {}
 
-//@ is "$.index[*][?(@.name=='get_foo')].inner.function.sig.inputs" []
-//@ count "$.index[*][?(@.name=='get_foo')].inner.function.sig.output.impl_trait[*]" 1
-//@ is "$.index[*][?(@.name=='get_foo')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $foo
+//@ is "$.index[?(@.name=='get_foo')].inner.function.sig.inputs" []
+//@ count "$.index[?(@.name=='get_foo')].inner.function.sig.output.impl_trait[*]" 1
+//@ is "$.index[?(@.name=='get_foo')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $foo
 pub fn get_foo() -> impl Foo {
     Fooer {}
 }
diff --git a/tests/rustdoc-json/fns/generics.rs b/tests/rustdoc-json/fns/generics.rs
index b953094b5de61..3efd917309a0e 100644
--- a/tests/rustdoc-json/fns/generics.rs
+++ b/tests/rustdoc-json/fns/generics.rs
@@ -1,20 +1,20 @@
-//@ set wham_id = "$.index[*][?(@.name=='Wham')].id"
+//@ set wham_id = "$.index[?(@.name=='Wham')].id"
 pub trait Wham {}
 
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.where_predicates" []
-//@ count "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[*]" 1
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].name" '"T"'
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" false
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
-//@ is    "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.sig.inputs" '[["w", {"generic": "T"}]]'
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.where_predicates" []
+//@ count "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[*]" 1
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].name" '"T"'
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" false
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
+//@ is    "$.index[?(@.name=='one_generic_param_fn')].inner.function.sig.inputs" '[["w", {"generic": "T"}]]'
 pub fn one_generic_param_fn<T: Wham>(w: T) {}
 
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.where_predicates" []
-//@ count "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[*]" 1
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].name" '"impl Wham"'
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" true
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
-//@ count "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[*]" 1
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][0]" '"w"'
-//@ is    "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $wham_id
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.where_predicates" []
+//@ count "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[*]" 1
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].name" '"impl Wham"'
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" true
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
+//@ count "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[*]" 1
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][0]" '"w"'
+//@ is    "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $wham_id
 pub fn one_synthetic_generic_param_fn(w: impl Wham) {}
diff --git a/tests/rustdoc-json/fns/pattern_arg.rs b/tests/rustdoc-json/fns/pattern_arg.rs
index d2a00f47438e2..059318a42958e 100644
--- a/tests/rustdoc-json/fns/pattern_arg.rs
+++ b/tests/rustdoc-json/fns/pattern_arg.rs
@@ -1,7 +1,7 @@
-//@ is "$.index[*][?(@.name=='fst')].inner.function.sig.inputs[0][0]" '"(x, _)"'
+//@ is "$.index[?(@.name=='fst')].inner.function.sig.inputs[0][0]" '"(x, _)"'
 pub fn fst<X, Y>((x, _): (X, Y)) -> X {
     x
 }
 
-//@ is "$.index[*][?(@.name=='drop_int')].inner.function.sig.inputs[0][0]" '"_"'
+//@ is "$.index[?(@.name=='drop_int')].inner.function.sig.inputs[0][0]" '"_"'
 pub fn drop_int(_: i32) {}
diff --git a/tests/rustdoc-json/fns/qualifiers.rs b/tests/rustdoc-json/fns/qualifiers.rs
index 67e49f0780ae1..7d93a3bf2437d 100644
--- a/tests/rustdoc-json/fns/qualifiers.rs
+++ b/tests/rustdoc-json/fns/qualifiers.rs
@@ -1,33 +1,33 @@
 //@ edition:2018
 
-//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_async" false
-//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_const"  false
-//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_unsafe" false
+//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_async" false
+//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_const"  false
+//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_unsafe" false
 pub fn nothing_fn() {}
 
-//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_async"  false
-//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_const"  false
-//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_unsafe" true
+//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_async"  false
+//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_const"  false
+//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_unsafe" true
 pub unsafe fn unsafe_fn() {}
 
-//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_async"  false
-//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_const"  true
-//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_unsafe" false
+//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_async"  false
+//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_const"  true
+//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_unsafe" false
 pub const fn const_fn() {}
 
-//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_async"  true
-//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_const"  false
-//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_unsafe" false
+//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_async"  true
+//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_const"  false
+//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_unsafe" false
 pub async fn async_fn() {}
 
-//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_async"  true
-//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_const"  false
-//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_unsafe" true
+//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_async"  true
+//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_const"  false
+//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_unsafe" true
 pub async unsafe fn async_unsafe_fn() {}
 
-//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_async"  false
-//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_const"  true
-//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_unsafe" true
+//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_async"  false
+//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_const"  true
+//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_unsafe" true
 pub const unsafe fn const_unsafe_fn() {}
 
 // It's impossible for a function to be both const and async, so no test for that
diff --git a/tests/rustdoc-json/fns/return_type_alias.rs b/tests/rustdoc-json/fns/return_type_alias.rs
index d60c4b6825894..0aa1db47b7f91 100644
--- a/tests/rustdoc-json/fns/return_type_alias.rs
+++ b/tests/rustdoc-json/fns/return_type_alias.rs
@@ -1,9 +1,9 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/104851>
 
-///@ set foo = "$.index[*][?(@.name=='Foo')].id"
+///@ set foo = "$.index[?(@.name=='Foo')].id"
 pub type Foo = i32;
 
-//@ is "$.index[*][?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo
+//@ is "$.index[?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo
 pub fn demo() -> Foo {
     42
 }
diff --git a/tests/rustdoc-json/generic-associated-types/gats.rs b/tests/rustdoc-json/generic-associated-types/gats.rs
index d1172b35fda49..5218cc886e35b 100644
--- a/tests/rustdoc-json/generic-associated-types/gats.rs
+++ b/tests/rustdoc-json/generic-associated-types/gats.rs
@@ -1,32 +1,32 @@
 pub trait Display {}
 
 pub trait LendingIterator {
-    //@ count "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.params[*]" 1
-    //@ is "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.params[*].name" \"\'a\"
-    //@ count "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*]" 1
-    //@ is "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*].bound_predicate.type.generic" \"Self\"
-    //@ is "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*].bound_predicate.bounds[*].outlives" \"\'a\"
-    //@ count "$.index[*][?(@.name=='LendingItem')].inner.assoc_type.bounds[*]" 1
+    //@ count "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.params[*]" 1
+    //@ is "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.params[*].name" \"\'a\"
+    //@ count "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*]" 1
+    //@ is "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*].bound_predicate.type.generic" \"Self\"
+    //@ is "$.index[?(@.name=='LendingItem')].inner.assoc_type.generics.where_predicates[*].bound_predicate.bounds[*].outlives" \"\'a\"
+    //@ count "$.index[?(@.name=='LendingItem')].inner.assoc_type.bounds[*]" 1
     type LendingItem<'a>: Display
     where
         Self: 'a;
 
-    //@ count "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 1
-    //@ count "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
-    //@ is "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
-    //@ is "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.name" \"LendingItem\"
+    //@ count "$.index[?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 1
+    //@ count "$.index[?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
+    //@ is "$.index[?(@.name=='lending_next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
+    //@ is "$.index[?(@.name=='lending_next')].inner.function.sig.output.qualified_path.name" \"LendingItem\"
     fn lending_next<'a>(&'a self) -> Self::LendingItem<'a>;
 }
 
 pub trait Iterator {
-    //@ count "$.index[*][?(@.name=='Item')].inner.assoc_type.generics.params[*]" 0
-    //@ count "$.index[*][?(@.name=='Item')].inner.assoc_type.generics.where_predicates[*]" 0
-    //@ count "$.index[*][?(@.name=='Item')].inner.assoc_type.bounds[*]" 1
+    //@ count "$.index[?(@.name=='Item')].inner.assoc_type.generics.params[*]" 0
+    //@ count "$.index[?(@.name=='Item')].inner.assoc_type.generics.where_predicates[*]" 0
+    //@ count "$.index[?(@.name=='Item')].inner.assoc_type.bounds[*]" 1
     type Item: Display;
 
-    //@ count "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 0
-    //@ count "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
-    //@ is "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
-    //@ is "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.name" \"Item\"
+    //@ count "$.index[?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 0
+    //@ count "$.index[?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
+    //@ is "$.index[?(@.name=='next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
+    //@ is "$.index[?(@.name=='next')].inner.function.sig.output.qualified_path.name" \"Item\"
     fn next<'a>(&'a self) -> Self::Item;
 }
diff --git a/tests/rustdoc-json/generic_impl.rs b/tests/rustdoc-json/generic_impl.rs
index e7a5d2a78c15d..90bda1644ff8c 100644
--- a/tests/rustdoc-json/generic_impl.rs
+++ b/tests/rustdoc-json/generic_impl.rs
@@ -1,8 +1,8 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/97986>.
 
-//@ has "$.index[*][?(@.name=='f')]"
-//@ has "$.index[*][?(@.name=='AssocTy')]"
-//@ has "$.index[*][?(@.name=='AssocConst')]"
+//@ has "$.index[?(@.name=='f')]"
+//@ has "$.index[?(@.name=='AssocTy')]"
+//@ has "$.index[?(@.name=='AssocConst')]"
 
 pub mod m {
     pub struct S;
diff --git a/tests/rustdoc-json/glob_import.rs b/tests/rustdoc-json/glob_import.rs
index b63e5dadd9e74..6887f9ff63d18 100644
--- a/tests/rustdoc-json/glob_import.rs
+++ b/tests/rustdoc-json/glob_import.rs
@@ -2,8 +2,8 @@
 
 #![no_std]
 
-//@ has "$.index[*][?(@.name=='glob')]"
-//@ has "$.index[*][?(@.inner.use)].inner.use.name" \"*\"
+//@ has "$.index[?(@.name=='glob')]"
+//@ has "$.index[?(@.inner.use)].inner.use.name" \"*\"
 
 mod m1 {
     pub fn f() {}
diff --git a/tests/rustdoc-json/impl-trait-in-assoc-type.rs b/tests/rustdoc-json/impl-trait-in-assoc-type.rs
index fc12fc87e8da1..742a46e896746 100644
--- a/tests/rustdoc-json/impl-trait-in-assoc-type.rs
+++ b/tests/rustdoc-json/impl-trait-in-assoc-type.rs
@@ -4,25 +4,25 @@ pub struct AlwaysTrue;
 
 /// impl IntoIterator
 impl IntoIterator for AlwaysTrue {
-    //@ set Item = '$.index[*][?(@.docs=="type Item")].id'
+    //@ set Item = '$.index[?(@.docs=="type Item")].id'
     /// type Item
     type Item = bool;
 
-    //@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[*]' 1
-    //@ is    '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.path' '"Iterator"'
-    //@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[*]' 1
-    //@ is    '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name' '"Item"'
-    //@ is    '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive' '"bool"'
+    //@ count '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[*]' 1
+    //@ is    '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.path' '"Iterator"'
+    //@ count '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[*]' 1
+    //@ is    '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name' '"Item"'
+    //@ is    '$.index[?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive' '"bool"'
 
-    //@ set IntoIter = '$.index[*][?(@.docs=="type IntoIter")].id'
+    //@ set IntoIter = '$.index[?(@.docs=="type IntoIter")].id'
     /// type IntoIter
     type IntoIter = impl Iterator<Item = bool>;
 
-    //@ set into_iter = '$.index[*][?(@.docs=="fn into_iter")].id'
+    //@ set into_iter = '$.index[?(@.docs=="fn into_iter")].id'
     /// fn into_iter
     fn into_iter(self) -> Self::IntoIter {
         std::iter::repeat(true)
     }
 }
 
-//@ ismany '$.index[*][?(@.docs=="impl IntoIterator")].inner.impl.items[*]' $Item $IntoIter $into_iter
+//@ ismany '$.index[?(@.docs=="impl IntoIterator")].inner.impl.items[*]' $Item $IntoIter $into_iter
diff --git a/tests/rustdoc-json/impl-trait-precise-capturing.rs b/tests/rustdoc-json/impl-trait-precise-capturing.rs
index 06be95099b4d5..37adb514f55fb 100644
--- a/tests/rustdoc-json/impl-trait-precise-capturing.rs
+++ b/tests/rustdoc-json/impl-trait-precise-capturing.rs
@@ -1,4 +1,4 @@
-//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[0].lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[1].param" \"T\"
-//@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[2].param" \"N\"
+//@ is "$.index[?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[0].lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[1].param" \"T\"
+//@ is "$.index[?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[2].param" \"N\"
 pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}
diff --git a/tests/rustdoc-json/impls/auto.rs b/tests/rustdoc-json/impls/auto.rs
index f37dae4c1ed43..f94f7338480bb 100644
--- a/tests/rustdoc-json/impls/auto.rs
+++ b/tests/rustdoc-json/impls/auto.rs
@@ -15,8 +15,8 @@ impl Foo {
 }
 
 // Testing spans, so all tests below code
-//@ is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]"
-//@ is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]"
+//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 0]"
+//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 1]"
 // FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
-// is "$.index[*][?(@.inner.impl.is_synthetic==true)].span" null
+// is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
 pub struct Foo;
diff --git a/tests/rustdoc-json/impls/blanket_with_local.rs b/tests/rustdoc-json/impls/blanket_with_local.rs
index de92dafae0b46..24ee6cf667004 100644
--- a/tests/rustdoc-json/impls/blanket_with_local.rs
+++ b/tests/rustdoc-json/impls/blanket_with_local.rs
@@ -1,11 +1,11 @@
 // Test for the ICE in rust/83718
 // A blanket impl plus a local type together shouldn't result in mismatched ID issues
 
-//@ has "$.index[*][?(@.name=='Load')]"
+//@ has "$.index[?(@.name=='Load')]"
 pub trait Load {
-    //@ has "$.index[*][?(@.name=='load')]"
+    //@ has "$.index[?(@.name=='load')]"
     fn load() {}
-    //@ has "$.index[*][?(@.name=='write')]"
+    //@ has "$.index[?(@.name=='write')]"
     fn write(self) {}
 }
 
@@ -14,5 +14,5 @@ impl<P> Load for P {
     fn write(self) {}
 }
 
-//@ has "$.index[*][?(@.name=='Wrapper')]"
+//@ has "$.index[?(@.name=='Wrapper')]"
 pub struct Wrapper {}
diff --git a/tests/rustdoc-json/impls/foreign_for_local.rs b/tests/rustdoc-json/impls/foreign_for_local.rs
index 1347f954cade8..e46b158d80205 100644
--- a/tests/rustdoc-json/impls/foreign_for_local.rs
+++ b/tests/rustdoc-json/impls/foreign_for_local.rs
@@ -3,16 +3,16 @@ extern crate foreign_trait;
 
 /// ForeignTrait id hack
 pub use foreign_trait::ForeignTrait as _;
-//@ set ForeignTrait = "$.index[*][?(@.docs=='ForeignTrait id hack')].inner.use.id"
+//@ set ForeignTrait = "$.index[?(@.docs=='ForeignTrait id hack')].inner.use.id"
 
 pub struct LocalStruct;
-//@ set LocalStruct = "$.index[*][?(@.name=='LocalStruct')].id"
+//@ set LocalStruct = "$.index[?(@.name=='LocalStruct')].id"
 
 /// foreign for local
 impl foreign_trait::ForeignTrait for LocalStruct {}
 
-//@ set impl = "$.index[*][?(@.docs=='foreign for local')].id"
-//@ is "$.index[*][?(@.docs=='foreign for local')].inner.impl.for.resolved_path.id" $LocalStruct
-//@ is "$.index[*][?(@.docs=='foreign for local')].inner.impl.trait.id" $ForeignTrait
+//@ set impl = "$.index[?(@.docs=='foreign for local')].id"
+//@ is "$.index[?(@.docs=='foreign for local')].inner.impl.for.resolved_path.id" $LocalStruct
+//@ is "$.index[?(@.docs=='foreign for local')].inner.impl.trait.id" $ForeignTrait
 
-//@ has "$.index[*][?(@.name=='LocalStruct')].inner.struct.impls[*]" $impl
+//@ has "$.index[?(@.name=='LocalStruct')].inner.struct.impls[*]" $impl
diff --git a/tests/rustdoc-json/impls/impl_item_visibility.rs b/tests/rustdoc-json/impls/impl_item_visibility.rs
index 293dd965804a6..680ea175d0bb2 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility.rs
@@ -4,13 +4,13 @@ pub struct Foo;
 impl Foo {
     fn baz() {}
 }
-//@ !has '$.index[*][?(@.docs=="impl Foo priv")]'
+//@ !has '$.index[?(@.docs=="impl Foo priv")]'
 
 /// impl Foo pub
 impl Foo {
     pub fn qux() {}
 }
-//@ is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo pub")].visibility' '"default"'
 
 /// impl Foo hidden
 impl Foo {
@@ -18,4 +18,4 @@ impl Foo {
     pub fn __quazl() {}
 }
 // FIXME(#111564): Is this the right behaviour?
-//@ is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
index 77ee717b03a28..82d59b97b013d 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
@@ -7,13 +7,13 @@ impl Foo {
     fn baz() {}
 }
 // FIXME(#111564): Is this the right behaviour?
-//@ is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo priv")].visibility' '"default"'
 
 /// impl Foo pub
 impl Foo {
     pub fn qux() {}
 }
-//@ is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo pub")].visibility' '"default"'
 
 /// impl Foo hidden
 impl Foo {
@@ -21,4 +21,4 @@ impl Foo {
     pub fn __quazl() {}
 }
 // FIXME(#111564): Is this the right behaviour?
-//@ is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
index 80c47eee6cb70..a3b145adb869a 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
@@ -6,13 +6,13 @@ pub struct Foo;
 impl Foo {
     fn baz() {}
 }
-//@ is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo priv")].visibility' '"default"'
 
 /// impl Foo pub
 impl Foo {
     pub fn qux() {}
 }
-//@ is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo pub")].visibility' '"default"'
 
 /// impl Foo hidden
 impl Foo {
@@ -20,4 +20,4 @@ impl Foo {
     pub fn __quazl() {}
 }
 // FIXME(#111564): Is this the right behaviour?
-//@ is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
+//@ is '$.index[?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/import_from_private.rs b/tests/rustdoc-json/impls/import_from_private.rs
index 32b9abb0717cc..02262d9b65fac 100644
--- a/tests/rustdoc-json/impls/import_from_private.rs
+++ b/tests/rustdoc-json/impls/import_from_private.rs
@@ -1,20 +1,20 @@
 // https://github.com/rust-lang/rust/issues/100252
 
 mod bar {
-    //@ set baz = "$.index[*][?(@.name == 'Baz')].id"
+    //@ set baz = "$.index[?(@.name == 'Baz')].id"
     pub struct Baz;
-    //@ set impl = "$.index[*][?(@.docs == 'impl')].id"
+    //@ set impl = "$.index[?(@.docs == 'impl')].id"
     /// impl
     impl Baz {
-        //@ set doit = "$.index[*][?(@.name == 'doit')].id"
+        //@ set doit = "$.index[?(@.name == 'doit')].id"
         pub fn doit() {}
     }
 }
 
-//@ set import = "$.index[*][?(@.inner.use)].id"
+//@ set import = "$.index[?(@.inner.use)].id"
 pub use bar::Baz;
 
 //@ is "$.index[*].inner.module.items[*]" $import
 //@ is "$.index[*].inner.use.id" $baz
-//@ has "$.index[*][?(@.name == 'Baz')].inner.struct.impls[*]" $impl
-//@ is "$.index[*][?(@.docs=='impl')].inner.impl.items[*]" $doit
+//@ has "$.index[?(@.name == 'Baz')].inner.struct.impls[*]" $impl
+//@ is "$.index[?(@.docs=='impl')].inner.impl.items[*]" $doit
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
index 4a313044920a2..54ec08135be7f 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
@@ -1,8 +1,8 @@
-//@ has "$.index[*][?(@.docs=='Here')]"
-//@ !has "$.index[*][?(@.docs=='Not Here')]"
-//@ !has "$.index[*][?(@.name == 'HiddenPubStruct')]"
-//@ has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
-//@ has "$.index[*][?(@.name=='PubTrait')]"
+//@ has "$.index[?(@.docs=='Here')]"
+//@ !has "$.index[?(@.docs=='Not Here')]"
+//@ !has "$.index[?(@.name == 'HiddenPubStruct')]"
+//@ has "$.index[?(@.name == 'NotHiddenPubStruct')]"
+//@ has "$.index[?(@.name=='PubTrait')]"
 pub trait PubTrait {}
 
 #[doc(hidden)]
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
index d3f2180f22cf5..afb29fd631665 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
@@ -1,8 +1,8 @@
 //@ compile-flags: --document-hidden-items
 
-//@ has "$.index[*][?(@.name == 'HiddenPubStruct')]"
-//@ has "$.index[*][?(@.inner.impl)]"
-//@ has "$.index[*][?(@.name=='PubTrait')]"
+//@ has "$.index[?(@.name == 'HiddenPubStruct')]"
+//@ has "$.index[?(@.inner.impl)]"
+//@ has "$.index[?(@.name=='PubTrait')]"
 pub trait PubTrait {}
 
 #[doc(hidden)]
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
index a3f058188429a..7fc3f70fe5a65 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
@@ -1,21 +1,21 @@
-//@ has "$.index[*][?(@.name=='PubTrait')]"
+//@ has "$.index[?(@.name=='PubTrait')]"
 pub trait PubTrait {}
 
 #[doc(hidden)]
 pub mod hidden {
-    //@ !has "$.index[*][?(@.name == 'HiddenPubStruct')]"
+    //@ !has "$.index[?(@.name == 'HiddenPubStruct')]"
     pub struct HiddenPubStruct;
 
-    //@ !has "$.index[*][?(@.docs == 'Not Here')]"
+    //@ !has "$.index[?(@.docs == 'Not Here')]"
     /// Not Here
     impl crate::PubTrait for HiddenPubStruct {}
 }
 
 pub mod not_hidden {
-    //@ has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
+    //@ has "$.index[?(@.name == 'NotHiddenPubStruct')]"
     pub struct NotHiddenPubStruct;
 
-    //@ has "$.index[*][?(@.docs == 'Here')]"
+    //@ has "$.index[?(@.docs == 'Here')]"
     /// Here
     impl crate::PubTrait for NotHiddenPubStruct {}
 }
diff --git a/tests/rustdoc-json/impls/local_for_foreign.rs b/tests/rustdoc-json/impls/local_for_foreign.rs
index cd89c47534881..86c72a580b2e3 100644
--- a/tests/rustdoc-json/impls/local_for_foreign.rs
+++ b/tests/rustdoc-json/impls/local_for_foreign.rs
@@ -3,16 +3,16 @@ extern crate foreign_struct;
 
 /// ForeignStruct id hack
 pub use foreign_struct::ForeignStruct as _;
-//@ set ForeignStruct = "$.index[*][?(@.docs=='ForeignStruct id hack')].inner.use.id"
+//@ set ForeignStruct = "$.index[?(@.docs=='ForeignStruct id hack')].inner.use.id"
 
 pub trait LocalTrait {}
-//@ set LocalTrait = "$.index[*][?(@.name=='LocalTrait')].id"
+//@ set LocalTrait = "$.index[?(@.name=='LocalTrait')].id"
 
 /// local for foreign
 impl LocalTrait for foreign_struct::ForeignStruct {}
 
-//@ set impl = "$.index[*][?(@.docs=='local for foreign')].id"
-//@ is "$.index[*][?(@.docs=='local for foreign')].inner.impl.trait.id" $LocalTrait
-//@ is "$.index[*][?(@.docs=='local for foreign')].inner.impl.for.resolved_path.id" $ForeignStruct
+//@ set impl = "$.index[?(@.docs=='local for foreign')].id"
+//@ is "$.index[?(@.docs=='local for foreign')].inner.impl.trait.id" $LocalTrait
+//@ is "$.index[?(@.docs=='local for foreign')].inner.impl.for.resolved_path.id" $ForeignStruct
 
-//@ is "$.index[*][?(@.name=='LocalTrait')].inner.trait.implementations[*]" $impl
+//@ is "$.index[?(@.name=='LocalTrait')].inner.trait.implementations[*]" $impl
diff --git a/tests/rustdoc-json/impls/local_for_local.rs b/tests/rustdoc-json/impls/local_for_local.rs
index 1d141d6e4de35..876a7912f09b0 100644
--- a/tests/rustdoc-json/impls/local_for_local.rs
+++ b/tests/rustdoc-json/impls/local_for_local.rs
@@ -1,12 +1,12 @@
-//@ set struct = "$.index[*][?(@.name=='Struct')].id"
+//@ set struct = "$.index[?(@.name=='Struct')].id"
 pub struct Struct;
-//@ set trait = "$.index[*][?(@.name=='Trait')].id"
+//@ set trait = "$.index[?(@.name=='Trait')].id"
 pub trait Trait {}
-//@ set impl = "$.index[*][?(@.docs=='impl')].id"
+//@ set impl = "$.index[?(@.docs=='impl')].id"
 /// impl
 impl Trait for Struct {}
 
-//@ has "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
-//@ is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl
-//@ is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait
-//@ is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct
+//@ has "$.index[?(@.name=='Struct')].inner.struct.impls[*]" $impl
+//@ is "$.index[?(@.name=='Trait')].inner.trait.implementations[*]" $impl
+//@ is "$.index[?(@.docs=='impl')].inner.impl.trait.id" $trait
+//@ is "$.index[?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct
diff --git a/tests/rustdoc-json/impls/local_for_local_primitive.rs b/tests/rustdoc-json/impls/local_for_local_primitive.rs
index 8c1eb044eae71..859c0cb8ec82d 100644
--- a/tests/rustdoc-json/impls/local_for_local_primitive.rs
+++ b/tests/rustdoc-json/impls/local_for_local_primitive.rs
@@ -1,18 +1,18 @@
 #![feature(rustc_attrs)]
 
-//@ set Local = "$.index[*][?(@.name=='Local')].id"
+//@ set Local = "$.index[?(@.name=='Local')].id"
 pub trait Local {}
 
-//@ is "$.index[*][?(@.docs=='Local for bool')].inner.impl.trait.id" $Local
-//@ is "$.index[*][?(@.docs=='Local for bool')].inner.impl.for.primitive" '"bool"'
+//@ is "$.index[?(@.docs=='Local for bool')].inner.impl.trait.id" $Local
+//@ is "$.index[?(@.docs=='Local for bool')].inner.impl.for.primitive" '"bool"'
 /// Local for bool
 impl Local for bool {}
 
-//@ set impl =  "$.index[*][?(@.docs=='Local for bool')].id"
-//@ is "$.index[*][?(@.name=='Local')].inner.trait.implementations[*]" $impl
+//@ set impl =  "$.index[?(@.docs=='Local for bool')].id"
+//@ is "$.index[?(@.name=='Local')].inner.trait.implementations[*]" $impl
 
 // FIXME(#101695): Test bool's `impls` include "Local for bool"
-//@ has "$.index[*][?(@.name=='bool')]"
+//@ has "$.index[?(@.name=='bool')]"
 #[rustc_doc_primitive = "bool"]
 /// Boolean docs
 mod prim_bool {}
diff --git a/tests/rustdoc-json/impls/local_for_primitive.rs b/tests/rustdoc-json/impls/local_for_primitive.rs
index 56d930ca5c4ff..a5ab3ec8a1b79 100644
--- a/tests/rustdoc-json/impls/local_for_primitive.rs
+++ b/tests/rustdoc-json/impls/local_for_primitive.rs
@@ -1,7 +1,7 @@
-//@ set local = "$.index[*][?(@.name=='Local')]"
+//@ set local = "$.index[?(@.name=='Local')]"
 pub trait Local {}
 
-//@ set impl = "$.index[*][?(@.docs=='local for bool')].id"
-//@ is "$.index[*][?(@.name=='Local')].inner.trait.implementations[*]" $impl
+//@ set impl = "$.index[?(@.docs=='local for bool')].id"
+//@ is "$.index[?(@.name=='Local')].inner.trait.implementations[*]" $impl
 /// local for bool
 impl Local for bool {}
diff --git a/tests/rustdoc-json/impls/pub_for_hidden_private.rs b/tests/rustdoc-json/impls/pub_for_hidden_private.rs
index 261ffbfeb4a4c..eb89219022c77 100644
--- a/tests/rustdoc-json/impls/pub_for_hidden_private.rs
+++ b/tests/rustdoc-json/impls/pub_for_hidden_private.rs
@@ -5,6 +5,6 @@ pub trait TheTrait {}
 #[doc(hidden)]
 struct Value {}
 
-//@ has '$.index[*][?(@.docs=="THE IMPL")]'
+//@ has '$.index[?(@.docs=="THE IMPL")]'
 /// THE IMPL
 impl TheTrait for Value {}
diff --git a/tests/rustdoc-json/impls/trait-for-dyn-trait.rs b/tests/rustdoc-json/impls/trait-for-dyn-trait.rs
index 0fbb4df002847..17cb07f3571de 100644
--- a/tests/rustdoc-json/impls/trait-for-dyn-trait.rs
+++ b/tests/rustdoc-json/impls/trait-for-dyn-trait.rs
@@ -1,15 +1,15 @@
-//@ set t1 = '$.index[*][?(@.name=="T1")].id'
+//@ set t1 = '$.index[?(@.name=="T1")].id'
 pub trait T1 {}
 
-//@ set t2 = '$.index[*][?(@.name=="T2")].id'
+//@ set t2 = '$.index[?(@.name=="T2")].id'
 pub trait T2 {}
 
 /// Fun impl
 impl T1 for dyn T2 {}
 
-//@ set impl = '$.index[*][?(@.docs=="Fun impl")].id'
-//@ is '$.index[*][?(@.name=="T1")].inner.trait.implementations[*]' $impl
-//@ is '$.index[*][?(@.name=="T2")].inner.trait.implementations' []
+//@ set impl = '$.index[?(@.docs=="Fun impl")].id'
+//@ is '$.index[?(@.name=="T1")].inner.trait.implementations[*]' $impl
+//@ is '$.index[?(@.name=="T2")].inner.trait.implementations' []
 
-//@ is '$.index[*][?(@.docs=="Fun impl")].inner.impl.trait.id' $t1
-//@ is '$.index[*][?(@.docs=="Fun impl")].inner.impl.for.dyn_trait.traits[*].trait.id' $t2
+//@ is '$.index[?(@.docs=="Fun impl")].inner.impl.trait.id' $t1
+//@ is '$.index[?(@.docs=="Fun impl")].inner.impl.for.dyn_trait.traits[*].trait.id' $t2
diff --git a/tests/rustdoc-json/intra-doc-links/foreign_variant.rs b/tests/rustdoc-json/intra-doc-links/foreign_variant.rs
index 251c4884fbb5b..b3e6f51d23c1d 100644
--- a/tests/rustdoc-json/intra-doc-links/foreign_variant.rs
+++ b/tests/rustdoc-json/intra-doc-links/foreign_variant.rs
@@ -8,6 +8,6 @@ pub struct Local;
 /// local impl
 impl enum_variant_in_trait_method::Trait for Local {}
 
-//@ !has "$.index[*][?(@.name == 'Trait')]"
-//@ !has "$.index[*][?(@.name == 'method')]"
-//@ count "$.index[*][?(@.docs == 'local impl')].inner.items[*]" 0
+//@ !has "$.index[?(@.name == 'Trait')]"
+//@ !has "$.index[?(@.name == 'method')]"
+//@ count "$.index[?(@.docs == 'local impl')].inner.items[*]" 0
diff --git a/tests/rustdoc-json/intra-doc-links/non_page.rs b/tests/rustdoc-json/intra-doc-links/non_page.rs
index 00987d93c1e92..e2d00ee64e9c2 100644
--- a/tests/rustdoc-json/intra-doc-links/non_page.rs
+++ b/tests/rustdoc-json/intra-doc-links/non_page.rs
@@ -7,17 +7,17 @@
 //! [`Trait::ASSOC_CONST`]
 //! [`Trait::method`]
 
-//@ set struct_field = "$.index[*][?(@.name=='struct_field')].id"
-//@ set Variant = "$.index[*][?(@.name=='Variant')].id"
-//@ set AssocType = "$.index[*][?(@.name=='AssocType')].id"
-//@ set ASSOC_CONST = "$.index[*][?(@.name=='ASSOC_CONST')].id"
-//@ set method = "$.index[*][?(@.name=='method')].id"
+//@ set struct_field = "$.index[?(@.name=='struct_field')].id"
+//@ set Variant = "$.index[?(@.name=='Variant')].id"
+//@ set AssocType = "$.index[?(@.name=='AssocType')].id"
+//@ set ASSOC_CONST = "$.index[?(@.name=='ASSOC_CONST')].id"
+//@ set method = "$.index[?(@.name=='method')].id"
 
-//@ is "$.index[*][?(@.name=='non_page')].links['`Struct::struct_field`']" $struct_field
-//@ is "$.index[*][?(@.name=='non_page')].links['`Enum::Variant`']" $Variant
-//@ is "$.index[*][?(@.name=='non_page')].links['`Trait::AssocType`']" $AssocType
-//@ is "$.index[*][?(@.name=='non_page')].links['`Trait::ASSOC_CONST`']" $ASSOC_CONST
-//@ is "$.index[*][?(@.name=='non_page')].links['`Trait::method`']" $method
+//@ is "$.index[?(@.name=='non_page')].links['`Struct::struct_field`']" $struct_field
+//@ is "$.index[?(@.name=='non_page')].links['`Enum::Variant`']" $Variant
+//@ is "$.index[?(@.name=='non_page')].links['`Trait::AssocType`']" $AssocType
+//@ is "$.index[?(@.name=='non_page')].links['`Trait::ASSOC_CONST`']" $ASSOC_CONST
+//@ is "$.index[?(@.name=='non_page')].links['`Trait::method`']" $method
 
 pub struct Struct {
     pub struct_field: i32,
diff --git a/tests/rustdoc-json/intra-doc-links/user_written.rs b/tests/rustdoc-json/intra-doc-links/user_written.rs
index c3f9df95a8fab..97a643490e6c4 100644
--- a/tests/rustdoc-json/intra-doc-links/user_written.rs
+++ b/tests/rustdoc-json/intra-doc-links/user_written.rs
@@ -4,5 +4,5 @@
 /// To test rustdoc json
 pub fn foo() {}
 
-//@ set foo = "$.index[*][?(@.name=='foo')].id"
-//@ is "$.index[*][?(@.name=='user_written')].links['foo#reasons']" $foo
+//@ set foo = "$.index[?(@.name=='foo')].id"
+//@ is "$.index[?(@.name=='user_written')].links['foo#reasons']" $foo
diff --git a/tests/rustdoc-json/keyword.rs b/tests/rustdoc-json/keyword.rs
index 8a2130f197831..566b2c68bd5df 100644
--- a/tests/rustdoc-json/keyword.rs
+++ b/tests/rustdoc-json/keyword.rs
@@ -6,15 +6,15 @@
 #![feature(rustdoc_internals)]
 #![no_std]
 
-//@ !has "$.index[*][?(@.name=='match')]"
-//@ has "$.index[*][?(@.name=='foo')]"
+//@ !has "$.index[?(@.name=='match')]"
+//@ has "$.index[?(@.name=='foo')]"
 
 #[doc(keyword = "match")]
 /// this is a test!
 pub mod foo {}
 
-//@ !has "$.index[*][?(@.name=='break')]"
-//@ !has "$.index[*][?(@.name=='bar')]"
+//@ !has "$.index[?(@.name=='break')]"
+//@ !has "$.index[?(@.name=='bar')]"
 #[doc(keyword = "break")]
 /// hello
 mod bar {}
diff --git a/tests/rustdoc-json/keyword_private.rs b/tests/rustdoc-json/keyword_private.rs
index 2a13bf10d5d62..fea546c9fb605 100644
--- a/tests/rustdoc-json/keyword_private.rs
+++ b/tests/rustdoc-json/keyword_private.rs
@@ -3,18 +3,18 @@
 //@ compile-flags: --document-private-items
 #![feature(rustdoc_internals)]
 
-//@ !has "$.index[*][?(@.name=='match')]"
-//@ has  "$.index[*][?(@.name=='foo')]"
-//@ is   "$.index[*][?(@.name=='foo')].attrs" '["#[doc(keyword = \"match\")]"]'
-//@ is   "$.index[*][?(@.name=='foo')].docs" '"this is a test!"'
+//@ !has "$.index[?(@.name=='match')]"
+//@ has  "$.index[?(@.name=='foo')]"
+//@ is   "$.index[?(@.name=='foo')].attrs" '["#[doc(keyword = \"match\")]"]'
+//@ is   "$.index[?(@.name=='foo')].docs" '"this is a test!"'
 #[doc(keyword = "match")]
 /// this is a test!
 pub mod foo {}
 
-//@ !has "$.index[*][?(@.name=='break')]"
-//@ has "$.index[*][?(@.name=='bar')]"
-//@ is   "$.index[*][?(@.name=='bar')].attrs" '["#[doc(keyword = \"break\")]"]'
-//@ is   "$.index[*][?(@.name=='bar')].docs" '"hello"'
+//@ !has "$.index[?(@.name=='break')]"
+//@ has "$.index[?(@.name=='bar')]"
+//@ is   "$.index[?(@.name=='bar')].attrs" '["#[doc(keyword = \"break\")]"]'
+//@ is   "$.index[?(@.name=='bar')].docs" '"hello"'
 #[doc(keyword = "break")]
 /// hello
 mod bar {}
diff --git a/tests/rustdoc-json/lifetime/longest.rs b/tests/rustdoc-json/lifetime/longest.rs
index 2d4e098d696b7..50cf084c39873 100644
--- a/tests/rustdoc-json/lifetime/longest.rs
+++ b/tests/rustdoc-json/lifetime/longest.rs
@@ -1,24 +1,24 @@
-//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].name"  \"\'a\"
-//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind"  '{"lifetime": {"outlives": []}}'
-//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind"  '{"lifetime": {"outlives": []}}'
-//@ count "$.index[*][?(@.name=='longest')].inner.function.generics.params[*]" 1
-//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.where_predicates" []
+//@ is "$.index[?(@.name=='longest')].inner.function.generics.params[0].name"  \"\'a\"
+//@ is "$.index[?(@.name=='longest')].inner.function.generics.params[0].kind"  '{"lifetime": {"outlives": []}}'
+//@ is "$.index[?(@.name=='longest')].inner.function.generics.params[0].kind"  '{"lifetime": {"outlives": []}}'
+//@ count "$.index[?(@.name=='longest')].inner.function.generics.params[*]" 1
+//@ is "$.index[?(@.name=='longest')].inner.function.generics.where_predicates" []
 
-//@ count "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[*]" 2
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][0]" '"l"'
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][0]" '"r"'
+//@ count "$.index[?(@.name=='longest')].inner.function.sig.inputs[*]" 2
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[0][0]" '"l"'
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[1][0]" '"r"'
 
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.type.primitive" \"str\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.type.primitive" \"str\"
 
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.type.primitive" \"str\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.type.primitive" \"str\"
 
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.type.primitive" \"str\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.output.borrowed_ref.lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.output.borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='longest')].inner.function.sig.output.borrowed_ref.type.primitive" \"str\"
 
 pub fn longest<'a>(l: &'a str, r: &'a str) -> &'a str {
     if l.len() > r.len() { l } else { r }
diff --git a/tests/rustdoc-json/lifetime/outlives.rs b/tests/rustdoc-json/lifetime/outlives.rs
index 257e43985ac34..f191b386c6cae 100644
--- a/tests/rustdoc-json/lifetime/outlives.rs
+++ b/tests/rustdoc-json/lifetime/outlives.rs
@@ -1,16 +1,16 @@
-//@ count "$.index[*][?(@.name=='foo')].inner.function.generics.params[*]" 3
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates" []
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[1].name" \"\'b\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].name" '"T"'
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].kind.lifetime.outlives" []
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[1].kind.lifetime.outlives" [\"\'a\"]
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.default" null
-//@ count "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[*]" 1
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[0].outlives" \"\'b\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.lifetime" \"\'b\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.is_mutable" false
-//@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.type.generic" \"T\"
+//@ count "$.index[?(@.name=='foo')].inner.function.generics.params[*]" 3
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates" []
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\"
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[1].name" \"\'b\"
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[2].name" '"T"'
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[0].kind.lifetime.outlives" []
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[1].kind.lifetime.outlives" [\"\'a\"]
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[2].kind.type.default" null
+//@ count "$.index[?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[*]" 1
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[0].outlives" \"\'b\"
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.lifetime" \"\'b\"
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.is_mutable" false
+//@ is "$.index[?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.type.generic" \"T\"
 pub fn foo<'a, 'b: 'a, T: 'b>(_: &'a &'b T) {}
diff --git a/tests/rustdoc-json/lifetime/outlives_in_param.rs b/tests/rustdoc-json/lifetime/outlives_in_param.rs
index 55ff525054157..dc9f57ff8a10a 100644
--- a/tests/rustdoc-json/lifetime/outlives_in_param.rs
+++ b/tests/rustdoc-json/lifetime/outlives_in_param.rs
@@ -1,6 +1,6 @@
-//@ count '$.index[*][?(@.name=="outlives")].inner.function.generics.params[*]' 2
-//@ is    '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].name' \"\'a\"
-//@ is    '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].kind.lifetime.outlives' []
-//@ is    '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].name' '"T"'
-//@ is    '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].kind.type.bounds' '[{"outlives": "'\''a"}]'
+//@ count '$.index[?(@.name=="outlives")].inner.function.generics.params[*]' 2
+//@ is    '$.index[?(@.name=="outlives")].inner.function.generics.params[0].name' \"\'a\"
+//@ is    '$.index[?(@.name=="outlives")].inner.function.generics.params[0].kind.lifetime.outlives' []
+//@ is    '$.index[?(@.name=="outlives")].inner.function.generics.params[1].name' '"T"'
+//@ is    '$.index[?(@.name=="outlives")].inner.function.generics.params[1].kind.type.bounds' '[{"outlives": "'\''a"}]'
 pub fn outlives<'a, T: 'a>() {}
diff --git a/tests/rustdoc-json/lifetime/outlives_in_where.rs b/tests/rustdoc-json/lifetime/outlives_in_where.rs
index 5158ff118a07a..48faf8ff8306e 100644
--- a/tests/rustdoc-json/lifetime/outlives_in_where.rs
+++ b/tests/rustdoc-json/lifetime/outlives_in_where.rs
@@ -1,20 +1,20 @@
-//@ is '$.index[*][?(@.name=="on_lifetimes")].inner.function.generics.where_predicates' '[{"lifetime_predicate": {"lifetime": "'\''all", "outlives": ["'\''a", "'\''b", "'\''c"]}}]'
+//@ is '$.index[?(@.name=="on_lifetimes")].inner.function.generics.where_predicates' '[{"lifetime_predicate": {"lifetime": "'\''all", "outlives": ["'\''a", "'\''b", "'\''c"]}}]'
 pub fn on_lifetimes<'a, 'b, 'c, 'all>()
 where
     'all: 'a + 'b + 'c,
 {
 }
 
-//@ count '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[*]' 2
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].name' \"\'a\"
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].kind.lifetime.outlives' []
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].name' '"T"'
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
-//@ count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[*]' 1
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.type.generic' '"T"'
-//@ count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]' 1
-//@ is    '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].outlives' \"\'a\"
+//@ count '$.index[?(@.name=="on_trait")].inner.function.generics.params[*]' 2
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[0].name' \"\'a\"
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[0].kind.lifetime.outlives' []
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[1].name' '"T"'
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
+//@ count '$.index[?(@.name=="on_trait")].inner.function.generics.where_predicates[*]' 1
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.type.generic' '"T"'
+//@ count '$.index[?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]' 1
+//@ is    '$.index[?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].outlives' \"\'a\"
 pub fn on_trait<'a, T>()
 where
     T: 'a,
diff --git a/tests/rustdoc-json/methods/abi.rs b/tests/rustdoc-json/methods/abi.rs
index dac02a6ce3caf..fa2387ddf67a8 100644
--- a/tests/rustdoc-json/methods/abi.rs
+++ b/tests/rustdoc-json/methods/abi.rs
@@ -1,50 +1,50 @@
 #![feature(abi_vectorcall)]
 
-//@ has "$.index[*][?(@.name=='Foo')]"
+//@ has "$.index[?(@.name=='Foo')]"
 pub struct Foo;
 
 impl Foo {
-    //@ is "$.index[*][?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
+    //@ is "$.index[?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
     pub fn abi_rust() {}
 
-    //@ is "$.index[*][?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
+    //@ is "$.index[?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
     pub extern "C" fn abi_c() {}
 
-    //@ is "$.index[*][?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
+    //@ is "$.index[?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
     pub extern "system" fn abi_system() {}
 
-    //@ is "$.index[*][?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
+    //@ is "$.index[?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
     pub extern "C-unwind" fn abi_c_unwind() {}
 
-    //@ is "$.index[*][?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
+    //@ is "$.index[?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
     pub extern "system-unwind" fn abi_system_unwind() {}
 
-    //@ is "$.index[*][?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
+    //@ is "$.index[?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
     pub extern "vectorcall" fn abi_vectorcall() {}
 
-    //@ is "$.index[*][?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
+    //@ is "$.index[?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
     pub extern "vectorcall-unwind" fn abi_vectorcall_unwind() {}
 }
 
 pub trait Bar {
-    //@ is "$.index[*][?(@.name=='trait_abi_rust')].inner.function.header.abi" \"Rust\"
+    //@ is "$.index[?(@.name=='trait_abi_rust')].inner.function.header.abi" \"Rust\"
     fn trait_abi_rust() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
+    //@ is "$.index[?(@.name=='trait_abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
     extern "C" fn trait_abi_c() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
+    //@ is "$.index[?(@.name=='trait_abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
     extern "system" fn trait_abi_system() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
+    //@ is "$.index[?(@.name=='trait_abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
     extern "C-unwind" fn trait_abi_c_unwind() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
+    //@ is "$.index[?(@.name=='trait_abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
     extern "system-unwind" fn trait_abi_system_unwind() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
+    //@ is "$.index[?(@.name=='trait_abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
     extern "vectorcall" fn trait_abi_vectorcall() {}
 
-    //@ is "$.index[*][?(@.name=='trait_abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
+    //@ is "$.index[?(@.name=='trait_abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
     extern "vectorcall-unwind" fn trait_abi_vectorcall_unwind() {}
 }
diff --git a/tests/rustdoc-json/methods/qualifiers.rs b/tests/rustdoc-json/methods/qualifiers.rs
index ba7c2e60936b3..b1d9f0c1af3ae 100644
--- a/tests/rustdoc-json/methods/qualifiers.rs
+++ b/tests/rustdoc-json/methods/qualifiers.rs
@@ -3,34 +3,34 @@
 pub struct Foo;
 
 impl Foo {
-    //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_async" false
-    //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_const"  true
-    //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_unsafe" false
+    //@ is "$.index[?(@.name=='const_meth')].inner.function.header.is_async" false
+    //@ is "$.index[?(@.name=='const_meth')].inner.function.header.is_const"  true
+    //@ is "$.index[?(@.name=='const_meth')].inner.function.header.is_unsafe" false
     pub const fn const_meth() {}
 
-    //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_async"  false
-    //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_const"  false
-    //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_unsafe" false
+    //@ is "$.index[?(@.name=='nothing_meth')].inner.function.header.is_async"  false
+    //@ is "$.index[?(@.name=='nothing_meth')].inner.function.header.is_const"  false
+    //@ is "$.index[?(@.name=='nothing_meth')].inner.function.header.is_unsafe" false
     pub fn nothing_meth() {}
 
-    //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_async"  false
-    //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_const"  false
-    //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='unsafe_meth')].inner.function.header.is_async"  false
+    //@ is "$.index[?(@.name=='unsafe_meth')].inner.function.header.is_const"  false
+    //@ is "$.index[?(@.name=='unsafe_meth')].inner.function.header.is_unsafe" true
     pub unsafe fn unsafe_meth() {}
 
-    //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_async"  true
-    //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_const"  false
-    //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_unsafe" false
+    //@ is "$.index[?(@.name=='async_meth')].inner.function.header.is_async"  true
+    //@ is "$.index[?(@.name=='async_meth')].inner.function.header.is_const"  false
+    //@ is "$.index[?(@.name=='async_meth')].inner.function.header.is_unsafe" false
     pub async fn async_meth() {}
 
-    //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_async"  true
-    //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_const"  false
-    //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='async_unsafe_meth')].inner.function.header.is_async"  true
+    //@ is "$.index[?(@.name=='async_unsafe_meth')].inner.function.header.is_const"  false
+    //@ is "$.index[?(@.name=='async_unsafe_meth')].inner.function.header.is_unsafe" true
     pub async unsafe fn async_unsafe_meth() {}
 
-    //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_async"  false
-    //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_const"  true
-    //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_unsafe" true
+    //@ is "$.index[?(@.name=='const_unsafe_meth')].inner.function.header.is_async"  false
+    //@ is "$.index[?(@.name=='const_unsafe_meth')].inner.function.header.is_const"  true
+    //@ is "$.index[?(@.name=='const_unsafe_meth')].inner.function.header.is_unsafe" true
     pub const unsafe fn const_unsafe_meth() {}
 
     // It's impossible for a method to be both const and async, so no test for that
diff --git a/tests/rustdoc-json/nested.rs b/tests/rustdoc-json/nested.rs
index 10ec2831c212c..8cc564706d61f 100644
--- a/tests/rustdoc-json/nested.rs
+++ b/tests/rustdoc-json/nested.rs
@@ -2,31 +2,31 @@
 //@ compile-flags: --crate-version 1.0.0
 
 //@ is "$.crate_version" \"1.0.0\"
-//@ has "$.index[*][?(@.name=='nested')].inner.module"
-//@ is "$.index[*][?(@.name=='nested')].inner.module.is_crate" true
+//@ has "$.index[?(@.name=='nested')].inner.module"
+//@ is "$.index[?(@.name=='nested')].inner.module.is_crate" true
 
-//@ set l1_id = "$.index[*][?(@.name=='l1')].id"
-//@ ismany "$.index[*][?(@.name=='nested')].inner.module.items[*]" $l1_id
+//@ set l1_id = "$.index[?(@.name=='l1')].id"
+//@ ismany "$.index[?(@.name=='nested')].inner.module.items[*]" $l1_id
 
-//@ has "$.index[*][?(@.name=='l1')].inner.module"
-//@ is "$.index[*][?(@.name=='l1')].inner.module.is_crate" false
+//@ has "$.index[?(@.name=='l1')].inner.module"
+//@ is "$.index[?(@.name=='l1')].inner.module.is_crate" false
 pub mod l1 {
-    //@ has "$.index[*][?(@.name=='l3')].inner.module"
-    //@ is "$.index[*][?(@.name=='l3')].inner.module.is_crate" false
-    //@ set l3_id = "$.index[*][?(@.name=='l3')].id"
+    //@ has "$.index[?(@.name=='l3')].inner.module"
+    //@ is "$.index[?(@.name=='l3')].inner.module.is_crate" false
+    //@ set l3_id = "$.index[?(@.name=='l3')].id"
     pub mod l3 {
 
-        //@ has "$.index[*][?(@.name=='L4')].inner.struct"
-        //@ is "$.index[*][?(@.name=='L4')].inner.struct.kind" '"unit"'
-        //@ set l4_id = "$.index[*][?(@.name=='L4')].id"
-        //@ ismany "$.index[*][?(@.name=='l3')].inner.module.items[*]" $l4_id
+        //@ has "$.index[?(@.name=='L4')].inner.struct"
+        //@ is "$.index[?(@.name=='L4')].inner.struct.kind" '"unit"'
+        //@ set l4_id = "$.index[?(@.name=='L4')].id"
+        //@ ismany "$.index[?(@.name=='l3')].inner.module.items[*]" $l4_id
         pub struct L4;
     }
-    //@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" false
-    //@ is "$.index[*][?(@.inner.use)].inner.use.source" '"l3::L4"'
-    //@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" false
-    //@ is "$.index[*][?(@.inner.use)].inner.use.id" $l4_id
-    //@ set l4_use_id = "$.index[*][?(@.inner.use)].id"
+    //@ is "$.index[?(@.inner.use)].inner.use.is_glob" false
+    //@ is "$.index[?(@.inner.use)].inner.use.source" '"l3::L4"'
+    //@ is "$.index[?(@.inner.use)].inner.use.is_glob" false
+    //@ is "$.index[?(@.inner.use)].inner.use.id" $l4_id
+    //@ set l4_use_id = "$.index[?(@.inner.use)].id"
     pub use l3::L4;
 }
-//@ ismany "$.index[*][?(@.name=='l1')].inner.module.items[*]" $l3_id $l4_use_id
+//@ ismany "$.index[?(@.name=='l1')].inner.module.items[*]" $l3_id $l4_use_id
diff --git a/tests/rustdoc-json/non_lifetime_binders.rs b/tests/rustdoc-json/non_lifetime_binders.rs
index 7c518a8f5a7b2..84318821c5084 100644
--- a/tests/rustdoc-json/non_lifetime_binders.rs
+++ b/tests/rustdoc-json/non_lifetime_binders.rs
@@ -5,11 +5,11 @@ pub trait Trait {}
 
 pub struct Wrapper<T_>(std::marker::PhantomData<T_>);
 
-//@ count "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[*]" 2
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].name" \"\'a\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].name" \"T\"
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].kind" '{ "type": { "bounds": [], "default": null, "is_synthetic": false } }'
+//@ count "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[*]" 2
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].name" \"\'a\"
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].name" \"T\"
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].kind" '{ "type": { "bounds": [], "default": null, "is_synthetic": false } }'
 pub fn foo()
 where
     for<'a, T> &'a Wrapper<T>: Trait,
diff --git a/tests/rustdoc-json/output_generics.rs b/tests/rustdoc-json/output_generics.rs
index 3454f421636cb..4d4339ceb2395 100644
--- a/tests/rustdoc-json/output_generics.rs
+++ b/tests/rustdoc-json/output_generics.rs
@@ -2,11 +2,11 @@
 
 // This is a regression test for #98009.
 
-//@ has "$.index[*][?(@.name=='this_compiles')]"
-//@ has "$.index[*][?(@.name=='this_does_not')]"
-//@ has "$.index[*][?(@.name=='Events')]"
-//@ has "$.index[*][?(@.name=='Other')]"
-//@ has "$.index[*][?(@.name=='Trait')]"
+//@ has "$.index[?(@.name=='this_compiles')]"
+//@ has "$.index[?(@.name=='this_does_not')]"
+//@ has "$.index[?(@.name=='Events')]"
+//@ has "$.index[?(@.name=='Other')]"
+//@ has "$.index[?(@.name=='Trait')]"
 
 struct Events<R>(R);
 
diff --git a/tests/rustdoc-json/path_name.rs b/tests/rustdoc-json/path_name.rs
index a1b3ae294fa94..dcfaa0607c4c4 100644
--- a/tests/rustdoc-json/path_name.rs
+++ b/tests/rustdoc-json/path_name.rs
@@ -19,49 +19,49 @@ pub use priv_mod::{InPrivMod, InPrivMod as InPrivMod2};
 use pub_mod::InPubMod as InPubMod3;
 pub use pub_mod::{InPubMod, InPubMod as InPubMod2};
 
-//@ is "$.index[*][?(@.name=='T0')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
+//@ is "$.index[?(@.name=='T0')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
 pub type T0 = priv_mod::InPrivMod;
-//@ is "$.index[*][?(@.name=='T1')].inner.type_alias.type.resolved_path.path" '"InPrivMod"'
+//@ is "$.index[?(@.name=='T1')].inner.type_alias.type.resolved_path.path" '"InPrivMod"'
 pub type T1 = InPrivMod;
-//@ is "$.index[*][?(@.name=='T2')].inner.type_alias.type.resolved_path.path" '"InPrivMod2"'
+//@ is "$.index[?(@.name=='T2')].inner.type_alias.type.resolved_path.path" '"InPrivMod2"'
 pub type T2 = InPrivMod2;
-//@ is "$.index[*][?(@.name=='T3')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
+//@ is "$.index[?(@.name=='T3')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
 pub type T3 = InPrivMod3;
 
-//@ is "$.index[*][?(@.name=='U0')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
+//@ is "$.index[?(@.name=='U0')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
 pub type U0 = pub_mod::InPubMod;
-//@ is "$.index[*][?(@.name=='U1')].inner.type_alias.type.resolved_path.path" '"InPubMod"'
+//@ is "$.index[?(@.name=='U1')].inner.type_alias.type.resolved_path.path" '"InPubMod"'
 pub type U1 = InPubMod;
-//@ is "$.index[*][?(@.name=='U2')].inner.type_alias.type.resolved_path.path" '"InPubMod2"'
+//@ is "$.index[?(@.name=='U2')].inner.type_alias.type.resolved_path.path" '"InPubMod2"'
 pub type U2 = InPubMod2;
-//@ is "$.index[*][?(@.name=='U3')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
+//@ is "$.index[?(@.name=='U3')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
 pub type U3 = InPubMod3;
 
 // Check we only have paths for structs at their original path
-//@ ismany "$.paths[*][?(@.crate_id==0 && @.kind=='struct')].path" '["path_name", "priv_mod", "InPrivMod"]' '["path_name", "pub_mod", "InPubMod"]'
+//@ ismany "$.paths[?(@.crate_id==0 && @.kind=='struct')].path" '["path_name", "priv_mod", "InPrivMod"]' '["path_name", "pub_mod", "InPubMod"]'
 
 pub use defines_and_reexports::{InPrivMod as XPrivMod, InPubMod as XPubMod};
 use defines_and_reexports::{InPrivMod as XPrivMod2, InPubMod as XPubMod2};
 
-//@ is "$.index[*][?(@.name=='X0')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::m1::InPubMod"'
+//@ is "$.index[?(@.name=='X0')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::m1::InPubMod"'
 pub type X0 = defines_and_reexports::m1::InPubMod;
-//@ is "$.index[*][?(@.name=='X1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
+//@ is "$.index[?(@.name=='X1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
 pub type X1 = defines_and_reexports::InPubMod;
-//@ is "$.index[*][?(@.name=='X2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod2"'
+//@ is "$.index[?(@.name=='X2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod2"'
 pub type X2 = defines_and_reexports::InPubMod2;
-//@ is "$.index[*][?(@.name=='X3')].inner.type_alias.type.resolved_path.path" '"XPubMod"'
+//@ is "$.index[?(@.name=='X3')].inner.type_alias.type.resolved_path.path" '"XPubMod"'
 pub type X3 = XPubMod;
 // N.B. This isn't the path as used *or* the original path!
-//@ is "$.index[*][?(@.name=='X4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
+//@ is "$.index[?(@.name=='X4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
 pub type X4 = XPubMod2;
 
-//@ is "$.index[*][?(@.name=='Y1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
+//@ is "$.index[?(@.name=='Y1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
 pub type Y1 = defines_and_reexports::InPrivMod;
-//@ is "$.index[*][?(@.name=='Y2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod2"'
+//@ is "$.index[?(@.name=='Y2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod2"'
 pub type Y2 = defines_and_reexports::InPrivMod2;
-//@ is "$.index[*][?(@.name=='Y3')].inner.type_alias.type.resolved_path.path" '"XPrivMod"'
+//@ is "$.index[?(@.name=='Y3')].inner.type_alias.type.resolved_path.path" '"XPrivMod"'
 pub type Y3 = XPrivMod;
-//@ is "$.index[*][?(@.name=='Y4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
+//@ is "$.index[?(@.name=='Y4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
 pub type Y4 = XPrivMod2;
 
 // For foreign items, $.paths contains the *origional* path, even if it's not publicly
@@ -74,9 +74,9 @@ pub type Y4 = XPrivMod2;
 
 // Tests for the example in the docs of Path::name.
 // If these change, chage the docs.
-//@ is "$.index[*][?(@.name=='Vec1')].inner.type_alias.type.resolved_path.path" '"std::vec::Vec"'
+//@ is "$.index[?(@.name=='Vec1')].inner.type_alias.type.resolved_path.path" '"std::vec::Vec"'
 pub type Vec1 = std::vec::Vec<i32>;
-//@ is "$.index[*][?(@.name=='Vec2')].inner.type_alias.type.resolved_path.path" '"Vec"'
+//@ is "$.index[?(@.name=='Vec2')].inner.type_alias.type.resolved_path.path" '"Vec"'
 pub type Vec2 = Vec<i32>;
-//@ is "$.index[*][?(@.name=='Vec3')].inner.type_alias.type.resolved_path.path" '"std::prelude::v1::Vec"'
+//@ is "$.index[?(@.name=='Vec3')].inner.type_alias.type.resolved_path.path" '"std::prelude::v1::Vec"'
 pub type Vec3 = std::prelude::v1::Vec<i32>;
diff --git a/tests/rustdoc-json/primitives/local_primitive.rs b/tests/rustdoc-json/primitives/local_primitive.rs
index b10ae45f3ec07..b58120bae052f 100644
--- a/tests/rustdoc-json/primitives/local_primitive.rs
+++ b/tests/rustdoc-json/primitives/local_primitive.rs
@@ -11,11 +11,11 @@
 #[rustc_doc_primitive = "i32"]
 mod prim_i32 {}
 
-//@ set local_i32 = "$.index[*][?(@.name=='i32')].id"
+//@ set local_i32 = "$.index[?(@.name=='i32')].id"
 
-//@ has "$.index[*][?(@.name=='local_primitive')]"
-//@ ismany "$.index[*][?(@.name=='local_primitive')].inner.module.items[*]" $local_i32
-//@ is "$.index[*][?(@.name=='local_primitive')].links['prim@i32']" $local_i32
+//@ has "$.index[?(@.name=='local_primitive')]"
+//@ ismany "$.index[?(@.name=='local_primitive')].inner.module.items[*]" $local_i32
+//@ is "$.index[?(@.name=='local_primitive')].links['prim@i32']" $local_i32
 
 // Let's ensure the `prim_i32` module isn't present in the output JSON:
-//@ !has "$.index[*][?(@.name=='prim_i32')]"
+//@ !has "$.index[?(@.name=='prim_i32')]"
diff --git a/tests/rustdoc-json/primitives/primitive_impls.rs b/tests/rustdoc-json/primitives/primitive_impls.rs
index 58c222ce4f0b1..a1f0ebd11b636 100644
--- a/tests/rustdoc-json/primitives/primitive_impls.rs
+++ b/tests/rustdoc-json/primitives/primitive_impls.rs
@@ -4,26 +4,26 @@
 #![no_core]
 #![rustc_coherence_is_core]
 
-//@ set impl_i32 = "$.index[*][?(@.docs=='Only core can do this')].id"
+//@ set impl_i32 = "$.index[?(@.docs=='Only core can do this')].id"
 
 #[lang = "sized"]
 trait Sized {}
 
 /// Only core can do this
 impl i32 {
-    //@ set identity = "$.index[*][?(@.docs=='Do Nothing')].id"
+    //@ set identity = "$.index[?(@.docs=='Do Nothing')].id"
 
     /// Do Nothing
     pub fn identity(self) -> Self {
         self
     }
 
-    //@ is "$.index[*][?(@.docs=='Only core can do this')].inner.impl.items[*]" $identity
+    //@ is "$.index[?(@.docs=='Only core can do this')].inner.impl.items[*]" $identity
 }
 
-//@ set Trait = "$.index[*][?(@.name=='Trait')].id"
+//@ set Trait = "$.index[?(@.name=='Trait')].id"
 pub trait Trait {}
-//@ set impl_trait_for_i32 = "$.index[*][?(@.docs=='impl Trait for i32')].id"
+//@ set impl_trait_for_i32 = "$.index[?(@.docs=='impl Trait for i32')].id"
 /// impl Trait for i32
 impl Trait for i32 {}
 
@@ -31,7 +31,7 @@ impl Trait for i32 {}
 #[rustc_doc_primitive = "i32"]
 mod prim_i32 {}
 
-//@ set i32 = "$.index[*][?(@.docs=='i32')].id"
-//@ is "$.index[*][?(@.docs=='i32')].name" '"i32"'
-//@ is "$.index[*][?(@.docs=='i32')].inner.primitive.name" '"i32"'
-//@ ismany "$.index[*][?(@.docs=='i32')].inner.primitive.impls[*]" $impl_i32 $impl_trait_for_i32
+//@ set i32 = "$.index[?(@.docs=='i32')].id"
+//@ is "$.index[?(@.docs=='i32')].name" '"i32"'
+//@ is "$.index[?(@.docs=='i32')].inner.primitive.name" '"i32"'
+//@ ismany "$.index[?(@.docs=='i32')].inner.primitive.impls[*]" $impl_i32 $impl_trait_for_i32
diff --git a/tests/rustdoc-json/primitives/primitive_overloading.rs b/tests/rustdoc-json/primitives/primitive_overloading.rs
index 5e5f3974ab3cd..ae0306843c56d 100644
--- a/tests/rustdoc-json/primitives/primitive_overloading.rs
+++ b/tests/rustdoc-json/primitives/primitive_overloading.rs
@@ -4,8 +4,8 @@
 
 #![feature(rustc_attrs)]
 
-//@ has "$.index[*][?(@.name=='usize')]"
-//@ has "$.index[*][?(@.name=='prim')]"
+//@ has "$.index[?(@.name=='usize')]"
+//@ has "$.index[?(@.name=='prim')]"
 
 #[rustc_doc_primitive = "usize"]
 /// This is the built-in type `usize`.
diff --git a/tests/rustdoc-json/primitives/primitive_type.rs b/tests/rustdoc-json/primitives/primitive_type.rs
index 21ef5ab7196f0..a0d34218b805d 100644
--- a/tests/rustdoc-json/primitives/primitive_type.rs
+++ b/tests/rustdoc-json/primitives/primitive_type.rs
@@ -1,17 +1,17 @@
 #![feature(never_type)]
 
-//@ is "$.index[*][?(@.name=='PrimNever')].visibility" \"public\"
-//@ is "$.index[*][?(@.name=='PrimNever')].inner.type_alias.type.primitive" \"never\"
+//@ is "$.index[?(@.name=='PrimNever')].visibility" \"public\"
+//@ is "$.index[?(@.name=='PrimNever')].inner.type_alias.type.primitive" \"never\"
 pub type PrimNever = !;
 
-//@ is "$.index[*][?(@.name=='PrimStr')].inner.type_alias.type.primitive" \"str\"
+//@ is "$.index[?(@.name=='PrimStr')].inner.type_alias.type.primitive" \"str\"
 pub type PrimStr = str;
 
-//@ is "$.index[*][?(@.name=='PrimBool')].inner.type_alias.type.primitive" \"bool\"
+//@ is "$.index[?(@.name=='PrimBool')].inner.type_alias.type.primitive" \"bool\"
 pub type PrimBool = bool;
 
-//@ is "$.index[*][?(@.name=='PrimChar')].inner.type_alias.type.primitive" \"char\"
+//@ is "$.index[?(@.name=='PrimChar')].inner.type_alias.type.primitive" \"char\"
 pub type PrimChar = char;
 
-//@ is "$.index[*][?(@.name=='PrimU8')].inner.type_alias.type.primitive" \"u8\"
+//@ is "$.index[?(@.name=='PrimU8')].inner.type_alias.type.primitive" \"u8\"
 pub type PrimU8 = u8;
diff --git a/tests/rustdoc-json/primitives/use_primitive.rs b/tests/rustdoc-json/primitives/use_primitive.rs
index d4cdef84de845..2991cc1e47c21 100644
--- a/tests/rustdoc-json/primitives/use_primitive.rs
+++ b/tests/rustdoc-json/primitives/use_primitive.rs
@@ -5,15 +5,15 @@
 #[rustc_doc_primitive = "usize"]
 mod usize {}
 
-//@ set local_crate_id = "$.index[*][?(@.name=='use_primitive')].crate_id"
+//@ set local_crate_id = "$.index[?(@.name=='use_primitive')].crate_id"
 
-//@ has "$.index[*][?(@.name=='ilog10')]"
-//@ !is "$.index[*][?(@.name=='ilog10')].crate_id" $local_crate_id
-//@ has "$.index[*][?(@.name=='checked_add')]"
-//@ !is "$.index[*][?(@.name=='checked_add')]" $local_crate_id
-//@ !has "$.index[*][?(@.name=='is_ascii_uppercase')]"
+//@ has "$.index[?(@.name=='ilog10')]"
+//@ !is "$.index[?(@.name=='ilog10')].crate_id" $local_crate_id
+//@ has "$.index[?(@.name=='checked_add')]"
+//@ !is "$.index[?(@.name=='checked_add')]" $local_crate_id
+//@ !has "$.index[?(@.name=='is_ascii_uppercase')]"
 
-//@ is "$.index[*].inner.use[?(@.name=='my_i32')].id" null
+//@ is "$.index[?(@.inner.use.name=='my_i32')].inner.use.id" null
 pub use i32 as my_i32;
-//@ is "$.index[*].inner.use[?(@.name=='u32')].id" null
+//@ is "$.index[?(@.inner.use.name=='u32')].inner.use.id" null
 pub use u32;
diff --git a/tests/rustdoc-json/pub_mod_in_private_mod.rs b/tests/rustdoc-json/pub_mod_in_private_mod.rs
index 112ab9c68f002..8b31ad0bcfe28 100644
--- a/tests/rustdoc-json/pub_mod_in_private_mod.rs
+++ b/tests/rustdoc-json/pub_mod_in_private_mod.rs
@@ -1,6 +1,6 @@
 // See https://github.com/rust-lang/rust/issues/101105
 
-//@ !has "$.index[*][?(@.name=='nucleus')]"
+//@ !has "$.index[?(@.name=='nucleus')]"
 mod corpus {
     pub mod nucleus {}
 }
diff --git a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs
index 4debd395496be..f7067857ddf41 100644
--- a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs
+++ b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs
@@ -4,7 +4,7 @@
 #[doc(inline)]
 pub extern crate enum_with_discriminant;
 
-//@ !has '$.index[*][?(@.docs == "Should not be inlined")]'
-//@ has '$.index[*][?(@.name == "enum_with_discriminant")].inner.extern_crate'
-//@ set enum_with_discriminant = '$.index[*][?(@.name == "enum_with_discriminant")].id'
-//@ is '$.index[*][?(@.name == "doc_inline_external_crate")].inner.module.items[*]' $enum_with_discriminant
+//@ !has '$.index[?(@.docs == "Should not be inlined")]'
+//@ has '$.index[?(@.name == "enum_with_discriminant")].inner.extern_crate'
+//@ set enum_with_discriminant = '$.index[?(@.name == "enum_with_discriminant")].id'
+//@ is '$.index[?(@.name == "doc_inline_external_crate")].inner.module.items[*]' $enum_with_discriminant
diff --git a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
index 4efacd283ef78..746749e020422 100644
--- a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
+++ b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
@@ -2,5 +2,5 @@
 
 #![crate_name = "export_extern_crate_as_self"]
 
-//@ is "$.index[*][?(@.inner.module)].name" \"export_extern_crate_as_self\"
+//@ is "$.index[?(@.inner.module)].name" \"export_extern_crate_as_self\"
 pub extern crate self as export_extern_crate_as_self; // Must be the same name as the crate already has
diff --git a/tests/rustdoc-json/reexport/extern_crate_glob.rs b/tests/rustdoc-json/reexport/extern_crate_glob.rs
index dfe6e7a03b153..8a4388feaca65 100644
--- a/tests/rustdoc-json/reexport/extern_crate_glob.rs
+++ b/tests/rustdoc-json/reexport/extern_crate_glob.rs
@@ -5,7 +5,7 @@ extern crate enum_with_discriminant;
 #[doc(inline)]
 pub use enum_with_discriminant::*;
 
-//@ !has '$.index[*][?(@.docs == "Should not be inlined")]'
-//@ is '$.index[*][?(@.inner.use)].inner.use.name' \"enum_with_discriminant\"
-//@ set use = '$.index[*][?(@.inner.use)].id'
-//@ is '$.index[*][?(@.name == "extern_crate_glob")].inner.module.items[*]' $use
+//@ !has '$.index[?(@.docs == "Should not be inlined")]'
+//@ is '$.index[?(@.inner.use)].inner.use.name' \"enum_with_discriminant\"
+//@ set use = '$.index[?(@.inner.use)].id'
+//@ is '$.index[?(@.name == "extern_crate_glob")].inner.module.items[*]' $use
diff --git a/tests/rustdoc-json/reexport/glob_collision.rs b/tests/rustdoc-json/reexport/glob_collision.rs
index 8142c35f4c712..48de1b5e77213 100644
--- a/tests/rustdoc-json/reexport/glob_collision.rs
+++ b/tests/rustdoc-json/reexport/glob_collision.rs
@@ -1,27 +1,27 @@
 // Regression test for https://github.com/rust-lang/rust/issues/100973
 
-//@ set m1 = "$.index[*][?(@.name == 'm1' && @.inner.module)].id"
-//@ is "$.index[*][?(@.name == 'm1')].inner.module.items" []
-//@ is "$.index[*][?(@.name == 'm1')].inner.module.is_stripped" true
+//@ set m1 = "$.index[?(@.name == 'm1' && @.inner.module)].id"
+//@ is "$.index[?(@.name == 'm1')].inner.module.items" []
+//@ is "$.index[?(@.name == 'm1')].inner.module.is_stripped" true
 mod m1 {
     pub fn f() {}
 }
-//@ set m2 = "$.index[*][?(@.name == 'm2' && @.inner.module)].id"
-//@ is "$.index[*][?(@.name == 'm2')].inner.module.items" []
-//@ is "$.index[*][?(@.name == 'm2')].inner.module.is_stripped" true
+//@ set m2 = "$.index[?(@.name == 'm2' && @.inner.module)].id"
+//@ is "$.index[?(@.name == 'm2')].inner.module.items" []
+//@ is "$.index[?(@.name == 'm2')].inner.module.is_stripped" true
 mod m2 {
     pub fn f(_: u8) {}
 }
 
-//@ set m1_use = "$.index[*][?(@.docs=='m1 re-export')].id"
-//@ is "$.index[*].inner.use[?(@.name=='m1')].id" $m1
-//@ is "$.index[*].inner.use[?(@.name=='m1')].is_glob" true
+//@ set m1_use = "$.index[?(@.docs=='m1 re-export')].id"
+//@ is "$.index[?(@.inner.use.name=='m1')].inner.use.id" $m1
+//@ is "$.index[?(@.inner.use.name=='m1')].inner.use.is_glob" true
 /// m1 re-export
 pub use m1::*;
-//@ set m2_use = "$.index[*][?(@.docs=='m2 re-export')].id"
-//@ is "$.index[*].inner.use[?(@.name=='m2')].id" $m2
-//@ is "$.index[*].inner.use[?(@.name=='m2')].is_glob" true
+//@ set m2_use = "$.index[?(@.docs=='m2 re-export')].id"
+//@ is "$.index[?(@.inner.use.name=='m2')].inner.use.id" $m2
+//@ is "$.index[?(@.inner.use.name=='m2')].inner.use.is_glob" true
 /// m2 re-export
 pub use m2::*;
 
-//@ ismany "$.index[*].inner.module[?(@.is_crate==true)].items[*]" $m1_use $m2_use
+//@ ismany "$.index[?(@.name=='glob_collision')].inner.module.items[*]" $m1_use $m2_use
diff --git a/tests/rustdoc-json/reexport/glob_empty_mod.rs b/tests/rustdoc-json/reexport/glob_empty_mod.rs
index ee1779407f404..69c0c0e6d5f3b 100644
--- a/tests/rustdoc-json/reexport/glob_empty_mod.rs
+++ b/tests/rustdoc-json/reexport/glob_empty_mod.rs
@@ -1,8 +1,8 @@
 // Regression test for https://github.com/rust-lang/rust/issues/100973
 
-//@ is "$.index[*][?(@.name=='m1' && @.inner.module)].inner.module.is_stripped" true
-//@ set m1 = "$.index[*][?(@.name=='m1')].id"
+//@ is "$.index[?(@.name=='m1' && @.inner.module)].inner.module.is_stripped" true
+//@ set m1 = "$.index[?(@.name=='m1')].id"
 mod m1 {}
 
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $m1
+//@ is "$.index[?(@.inner.use)].inner.use.id" $m1
 pub use m1::*;
diff --git a/tests/rustdoc-json/reexport/glob_extern.rs b/tests/rustdoc-json/reexport/glob_extern.rs
index 98be47739413e..ccc6faffc8ed3 100644
--- a/tests/rustdoc-json/reexport/glob_extern.rs
+++ b/tests/rustdoc-json/reexport/glob_extern.rs
@@ -1,19 +1,19 @@
 //@ edition:2018
 
-//@ is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true"
+//@ is "$.index[?(@.name=='mod1')].inner.module.is_stripped" "true"
 mod mod1 {
     extern "C" {
-        //@ set public_fn_id = "$.index[*][?(@.name=='public_fn')].id"
+        //@ set public_fn_id = "$.index[?(@.name=='public_fn')].id"
         pub fn public_fn();
-        //@ !has "$.index[*][?(@.name=='private_fn')]"
+        //@ !has "$.index[?(@.name=='private_fn')]"
         fn private_fn();
     }
-    //@ ismany "$.index[*][?(@.name=='mod1')].inner.module.items[*]" $public_fn_id
-    //@ set mod1_id = "$.index[*][?(@.name=='mod1')].id"
+    //@ ismany "$.index[?(@.name=='mod1')].inner.module.items[*]" $public_fn_id
+    //@ set mod1_id = "$.index[?(@.name=='mod1')].id"
 }
 
-//@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" true
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $mod1_id
-//@ set use_id = "$.index[*][?(@.inner.use)].id"
-//@ ismany "$.index[*][?(@.name=='glob_extern')].inner.module.items[*]" $use_id
+//@ is "$.index[?(@.inner.use)].inner.use.is_glob" true
+//@ is "$.index[?(@.inner.use)].inner.use.id" $mod1_id
+//@ set use_id = "$.index[?(@.inner.use)].id"
+//@ ismany "$.index[?(@.name=='glob_extern')].inner.module.items[*]" $use_id
 pub use mod1::*;
diff --git a/tests/rustdoc-json/reexport/glob_private.rs b/tests/rustdoc-json/reexport/glob_private.rs
index 2084ffc356e2a..f232914787b22 100644
--- a/tests/rustdoc-json/reexport/glob_private.rs
+++ b/tests/rustdoc-json/reexport/glob_private.rs
@@ -1,32 +1,32 @@
 //@ edition:2018
 
-//@ is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true"
+//@ is "$.index[?(@.name=='mod1')].inner.module.is_stripped" "true"
 mod mod1 {
-    //@ is "$.index[*][?(@.name=='mod2')].inner.module.is_stripped" "true"
+    //@ is "$.index[?(@.name=='mod2')].inner.module.is_stripped" "true"
     mod mod2 {
-        //@ set m2pub_id = "$.index[*][?(@.name=='Mod2Public')].id"
+        //@ set m2pub_id = "$.index[?(@.name=='Mod2Public')].id"
         pub struct Mod2Public;
 
-        //@ !has "$.index[*][?(@.name=='Mod2Private')]"
+        //@ !has "$.index[?(@.name=='Mod2Private')]"
         struct Mod2Private;
     }
 
-    //@ set mod2_use_id = "$.index[*][?(@.docs=='Mod2 re-export')].id"
-    //@ is "$.index[*][?(@.docs=='Mod2 re-export')].inner.use.name" \"mod2\"
+    //@ set mod2_use_id = "$.index[?(@.docs=='Mod2 re-export')].id"
+    //@ is "$.index[?(@.docs=='Mod2 re-export')].inner.use.name" \"mod2\"
     /// Mod2 re-export
     pub use self::mod2::*;
 
-    //@ set m1pub_id = "$.index[*][?(@.name=='Mod1Public')].id"
+    //@ set m1pub_id = "$.index[?(@.name=='Mod1Public')].id"
     pub struct Mod1Public;
-    //@ !has "$.index[*][?(@.name=='Mod1Private')]"
+    //@ !has "$.index[?(@.name=='Mod1Private')]"
     struct Mod1Private;
 }
 
-//@ set mod1_use_id = "$.index[*][?(@.docs=='Mod1 re-export')].id"
-//@ is "$.index[*][?(@.docs=='Mod1 re-export')].inner.use.name" \"mod1\"
+//@ set mod1_use_id = "$.index[?(@.docs=='Mod1 re-export')].id"
+//@ is "$.index[?(@.docs=='Mod1 re-export')].inner.use.name" \"mod1\"
 /// Mod1 re-export
 pub use mod1::*;
 
-//@ ismany "$.index[*][?(@.name=='mod2')].inner.module.items[*]" $m2pub_id
-//@ ismany "$.index[*][?(@.name=='mod1')].inner.module.items[*]" $m1pub_id $mod2_use_id
-//@ ismany "$.index[*][?(@.name=='glob_private')].inner.module.items[*]" $mod1_use_id
+//@ ismany "$.index[?(@.name=='mod2')].inner.module.items[*]" $m2pub_id
+//@ ismany "$.index[?(@.name=='mod1')].inner.module.items[*]" $m1pub_id $mod2_use_id
+//@ ismany "$.index[?(@.name=='glob_private')].inner.module.items[*]" $mod1_use_id
diff --git a/tests/rustdoc-json/reexport/in_root_and_mod.rs b/tests/rustdoc-json/reexport/in_root_and_mod.rs
index a1d2080c06887..005004e3b8682 100644
--- a/tests/rustdoc-json/reexport/in_root_and_mod.rs
+++ b/tests/rustdoc-json/reexport/in_root_and_mod.rs
@@ -1,13 +1,13 @@
-//@ !has "$.index[*][?(@.name=='foo')]"
+//@ !has "$.index[*].name" '"foo"'
 mod foo {
-    //@ has "$.index[*][?(@.name=='Foo')]"
+    //@ has "$.index[*].name" '"Foo"'
     pub struct Foo;
 }
 
-//@ has "$.index[*].inner[?(@.use.source=='foo::Foo')]"
+//@ has "$.index[*].inner.use.source" '"foo::Foo"'
 pub use foo::Foo;
 
 pub mod bar {
-    //@ has "$.index[*].inner[?(@.use.source=='crate::foo::Foo')]"
+    //@ has "$.index[*].inner.use.source" '"crate::foo::Foo"'
     pub use crate::foo::Foo;
 }
diff --git a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
index 7d26d2a970d4a..54dda2a3cd099 100644
--- a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
+++ b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
@@ -1,19 +1,19 @@
 pub mod foo {
-    //@ set bar_id = "$.index[*][?(@.name=='Bar')].id"
-    //@ ismany "$.index[*][?(@.name=='foo')].inner.module.items[*]" $bar_id
+    //@ set bar_id = "$.index[?(@.name=='Bar')].id"
+    //@ ismany "$.index[?(@.name=='foo')].inner.module.items[*]" $bar_id
     pub struct Bar;
 }
 
-//@ set root_import_id = "$.index[*][?(@.docs=='Outer re-export')].id"
-//@ is "$.index[*].inner[?(@.use.source=='foo::Bar')].use.id" $bar_id
-//@ has "$.index[*][?(@.name=='in_root_and_mod_pub')].inner.module.items[*]" $root_import_id
+//@ set root_import_id = "$.index[?(@.docs=='Outer re-export')].id"
+//@ is "$.index[?(@.inner.use.source=='foo::Bar')].inner.use.id" $bar_id
+//@ has "$.index[?(@.name=='in_root_and_mod_pub')].inner.module.items[*]" $root_import_id
 /// Outer re-export
 pub use foo::Bar;
 
 pub mod baz {
-    //@ set baz_import_id = "$.index[*][?(@.docs=='Inner re-export')].id"
-    //@ is "$.index[*].inner[?(@.use.source=='crate::foo::Bar')].use.id" $bar_id
-    //@ ismany "$.index[*][?(@.name=='baz')].inner.module.items[*]" $baz_import_id
+    //@ set baz_import_id = "$.index[?(@.docs=='Inner re-export')].id"
+    //@ is "$.index[?(@.inner.use.source=='crate::foo::Bar')].inner.use.id" $bar_id
+    //@ ismany "$.index[?(@.name=='baz')].inner.module.items[*]" $baz_import_id
     /// Inner re-export
     pub use crate::foo::Bar;
 }
diff --git a/tests/rustdoc-json/reexport/macro.rs b/tests/rustdoc-json/reexport/macro.rs
index f182208c34170..0bd37768255bc 100644
--- a/tests/rustdoc-json/reexport/macro.rs
+++ b/tests/rustdoc-json/reexport/macro.rs
@@ -1,13 +1,13 @@
 //@ edition:2018
 
-//@ set repro_id = "$.index[*][?(@.name=='repro')].id"
+//@ set repro_id = "$.index[?(@.name=='repro')].id"
 #[macro_export]
 macro_rules! repro {
     () => {};
 }
 
-//@ set repro2_id = "$.index[*][?(@.docs=='Re-export')].id"
+//@ set repro2_id = "$.index[?(@.docs=='Re-export')].id"
 /// Re-export
 pub use crate::repro as repro2;
 
-//@ ismany "$.index[*][?(@.name=='macro')].inner.module.items[*]" $repro_id $repro2_id
+//@ ismany "$.index[?(@.name=='macro')].inner.module.items[*]" $repro_id $repro2_id
diff --git a/tests/rustdoc-json/reexport/mod_not_included.rs b/tests/rustdoc-json/reexport/mod_not_included.rs
index d0ce95749f1b4..59e5fff59c980 100644
--- a/tests/rustdoc-json/reexport/mod_not_included.rs
+++ b/tests/rustdoc-json/reexport/mod_not_included.rs
@@ -6,6 +6,6 @@ mod m1 {
 
 pub use m1::x;
 
-//@ has "$.index[*][?(@.name=='x' && @.inner.function)]"
-//@ has "$.index[*].inner[?(@.use.name=='x')].use.source" '"m1::x"'
-//@ !has "$.index[*][?(@.name=='m1')]"
+//@ has "$.index[?(@.name=='x' && @.inner.function)]"
+//@ has "$.index[?(@.inner.use.name=='x')].inner.use.source" '"m1::x"'
+//@ !has "$.index[?(@.name=='m1')]"
diff --git a/tests/rustdoc-json/reexport/private_twice_one_inline.rs b/tests/rustdoc-json/reexport/private_twice_one_inline.rs
index fdf8cda103bff..6b5d03e207eb4 100644
--- a/tests/rustdoc-json/reexport/private_twice_one_inline.rs
+++ b/tests/rustdoc-json/reexport/private_twice_one_inline.rs
@@ -5,19 +5,19 @@
 
 extern crate pub_struct as foo;
 #[doc(inline)]
-//@ set crate_use_id = "$.index[*][?(@.docs=='Hack A')].id"
-//@ set foo_id = "$.index[*][?(@.docs=='Hack A')].inner.use.id"
+//@ set crate_use_id = "$.index[?(@.docs=='Hack A')].id"
+//@ set foo_id = "$.index[?(@.docs=='Hack A')].inner.use.id"
 /// Hack A
 pub use foo::Foo;
 
-//@ set bar_id = "$.index[*][?(@.name=='bar')].id"
+//@ set bar_id = "$.index[?(@.name=='bar')].id"
 pub mod bar {
-    //@ is "$.index[*][?(@.docs=='Hack B')].inner.use.id" $foo_id
-    //@ set bar_use_id = "$.index[*][?(@.docs=='Hack B')].id"
-    //@ ismany "$.index[*][?(@.name=='bar')].inner.module.items[*]" $bar_use_id
+    //@ is "$.index[?(@.docs=='Hack B')].inner.use.id" $foo_id
+    //@ set bar_use_id = "$.index[?(@.docs=='Hack B')].id"
+    //@ ismany "$.index[?(@.name=='bar')].inner.module.items[*]" $bar_use_id
     /// Hack B
     pub use foo::Foo;
 }
 
-//@ ismany "$.index[*][?(@.inner.use)].id" $crate_use_id $bar_use_id
-//@ ismany "$.index[*][?(@.name=='private_twice_one_inline')].inner.module.items[*]" $bar_id $crate_use_id
+//@ ismany "$.index[?(@.inner.use)].id" $crate_use_id $bar_use_id
+//@ ismany "$.index[?(@.name=='private_twice_one_inline')].inner.module.items[*]" $bar_id $crate_use_id
diff --git a/tests/rustdoc-json/reexport/private_two_names.rs b/tests/rustdoc-json/reexport/private_two_names.rs
index 049100d7f497f..79af40b83a4f8 100644
--- a/tests/rustdoc-json/reexport/private_two_names.rs
+++ b/tests/rustdoc-json/reexport/private_two_names.rs
@@ -1,21 +1,21 @@
 // Test for the ICE in https://github.com/rust-lang/rust/issues/83720
 // A pub-in-private type re-exported under two different names shouldn't cause an error
 
-//@ !has "$.index[*][?(@.name=='style')]"
+//@ !has "$.index[?(@.name=='style')]"
 mod style {
-    //@ set color_struct_id = "$.index[*][?(@.inner.struct && @.name=='Color')].id"
+    //@ set color_struct_id = "$.index[?(@.inner.struct && @.name=='Color')].id"
     pub struct Color;
 }
 
-//@ is "$.index[*][?(@.docs=='First re-export')].inner.use.id" $color_struct_id
-//@ is "$.index[*][?(@.docs=='First re-export')].inner.use.name" \"Color\"
-//@ set color_export_id = "$.index[*][?(@.docs=='First re-export')].id"
+//@ is "$.index[?(@.docs=='First re-export')].inner.use.id" $color_struct_id
+//@ is "$.index[?(@.docs=='First re-export')].inner.use.name" \"Color\"
+//@ set color_export_id = "$.index[?(@.docs=='First re-export')].id"
 /// First re-export
 pub use style::Color;
-//@ is "$.index[*][?(@.docs=='Second re-export')].inner.use.id" $color_struct_id
-//@ is "$.index[*][?(@.docs=='Second re-export')].inner.use.name" \"Colour\"
-//@ set colour_export_id = "$.index[*][?(@.docs=='Second re-export')].id"
+//@ is "$.index[?(@.docs=='Second re-export')].inner.use.id" $color_struct_id
+//@ is "$.index[?(@.docs=='Second re-export')].inner.use.name" \"Colour\"
+//@ set colour_export_id = "$.index[?(@.docs=='Second re-export')].id"
 /// Second re-export
 pub use style::Color as Colour;
 
-//@ ismany "$.index[*][?(@.name=='private_two_names')].inner.module.items[*]" $color_export_id $colour_export_id
+//@ ismany "$.index[?(@.name=='private_two_names')].inner.module.items[*]" $color_export_id $colour_export_id
diff --git a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
index e021b51ab4beb..129ccb7e2ebe5 100644
--- a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
+++ b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
@@ -9,5 +9,5 @@ mod repeat_n {
 /// not here
 pub use repeat_n::RepeatN;
 
-//@ count "$.index[*][?(@.name=='pub_use_doc_hidden')].inner.items[*]" 0
-//@ !has "$.index[*][?(@.docs == 'not here')]"
+//@ count "$.index[?(@.name=='pub_use_doc_hidden')].inner.items[*]" 0
+//@ !has "$.index[?(@.docs == 'not here')]"
diff --git a/tests/rustdoc-json/reexport/reexport_method_from_private_module.rs b/tests/rustdoc-json/reexport/reexport_method_from_private_module.rs
index 25edd5dbb280b..56922340a6fbe 100644
--- a/tests/rustdoc-json/reexport/reexport_method_from_private_module.rs
+++ b/tests/rustdoc-json/reexport/reexport_method_from_private_module.rs
@@ -1,11 +1,11 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/102583>.
 
-//@ set impl_S = "$.index[*][?(@.docs=='impl S')].id"
-//@ has "$.index[*][?(@.name=='S')].inner.struct.impls[*]" $impl_S
-//@ set is_present = "$.index[*][?(@.name=='is_present')].id"
-//@ is "$.index[*][?(@.docs=='impl S')].inner.impl.items[*]" $is_present
-//@ !has "$.index[*][?(@.name=='hidden_impl')]"
-//@ !has "$.index[*][?(@.name=='hidden_fn')]"
+//@ set impl_S = "$.index[?(@.docs=='impl S')].id"
+//@ has "$.index[?(@.name=='S')].inner.struct.impls[*]" $impl_S
+//@ set is_present = "$.index[?(@.name=='is_present')].id"
+//@ is "$.index[?(@.docs=='impl S')].inner.impl.items[*]" $is_present
+//@ !has "$.index[?(@.name=='hidden_impl')]"
+//@ !has "$.index[?(@.name=='hidden_fn')]"
 
 #![no_std]
 
diff --git a/tests/rustdoc-json/reexport/reexport_of_hidden.rs b/tests/rustdoc-json/reexport/reexport_of_hidden.rs
index 80f171da888e3..119e699d81568 100644
--- a/tests/rustdoc-json/reexport/reexport_of_hidden.rs
+++ b/tests/rustdoc-json/reexport/reexport_of_hidden.rs
@@ -1,7 +1,7 @@
 //@ compile-flags: --document-hidden-items
 
-//@ has "$.index[*].inner[?(@.use.name=='UsedHidden')]"
-//@ has "$.index[*][?(@.name=='Hidden')]"
+//@ has "$.index[*].inner.use.name" '"UsedHidden"'
+//@ has "$.index[*].name" '"Hidden"'
 pub mod submodule {
     #[doc(hidden)]
     pub struct Hidden {}
diff --git a/tests/rustdoc-json/reexport/rename_private.rs b/tests/rustdoc-json/reexport/rename_private.rs
index 3f13f305d6448..0494dff5bca23 100644
--- a/tests/rustdoc-json/reexport/rename_private.rs
+++ b/tests/rustdoc-json/reexport/rename_private.rs
@@ -1,10 +1,10 @@
 //@ edition:2018
 
-//@ !has "$.index[*][?(@.name=='inner')]"
+//@ !has "$.index[?(@.name=='inner')]"
 mod inner {
-    //@ has "$.index[*][?(@.name=='Public')]"
+    //@ has "$.index[?(@.name=='Public')]"
     pub struct Public;
 }
 
-//@ is "$.index[*][?(@.inner.use)].inner.use.name" \"NewName\"
+//@ is "$.index[?(@.inner.use)].inner.use.name" \"NewName\"
 pub use inner::Public as NewName;
diff --git a/tests/rustdoc-json/reexport/rename_public.rs b/tests/rustdoc-json/reexport/rename_public.rs
index 81c003a51c4af..a3d712358f227 100644
--- a/tests/rustdoc-json/reexport/rename_public.rs
+++ b/tests/rustdoc-json/reexport/rename_public.rs
@@ -1,15 +1,15 @@
 //@ edition:2018
 
-//@ set inner_id = "$.index[*][?(@.name=='inner')].id"
+//@ set inner_id = "$.index[?(@.name=='inner')].id"
 pub mod inner {
-    //@ set public_id = "$.index[*][?(@.name=='Public')].id"
-    //@ ismany "$.index[*][?(@.name=='inner')].inner.module.items[*]" $public_id
+    //@ set public_id = "$.index[?(@.name=='Public')].id"
+    //@ ismany "$.index[?(@.name=='inner')].inner.module.items[*]" $public_id
     pub struct Public;
 }
-//@ set import_id = "$.index[*][?(@.docs=='Re-export')].id"
-//@ !has "$.index[*].inner[?(@.use.name=='Public')]"
-//@ is "$.index[*].inner[?(@.use.name=='NewName')].use.source" \"inner::Public\"
+//@ set import_id = "$.index[?(@.docs=='Re-export')].id"
+//@ !has "$.index[?(@.inner.use.name=='Public')]"
+//@ is "$.index[?(@.inner.use.name=='NewName')].inner.use.source" \"inner::Public\"
 /// Re-export
 pub use inner::Public as NewName;
 
-//@ ismany "$.index[*][?(@.name=='rename_public')].inner.module.items[*]" $inner_id $import_id
+//@ ismany "$.index[?(@.name=='rename_public')].inner.module.items[*]" $inner_id $import_id
diff --git a/tests/rustdoc-json/reexport/same_name_different_types.rs b/tests/rustdoc-json/reexport/same_name_different_types.rs
index 760e2c6f77502..6e7ad3393e5da 100644
--- a/tests/rustdoc-json/reexport/same_name_different_types.rs
+++ b/tests/rustdoc-json/reexport/same_name_different_types.rs
@@ -1,22 +1,22 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/107677>.
 
 pub mod nested {
-    //@ set foo_struct = "$.index[*][?(@.docs == 'Foo the struct')].id"
+    //@ set foo_struct = "$.index[?(@.docs == 'Foo the struct')].id"
 
     /// Foo the struct
     pub struct Foo {}
 
-    //@ set foo_fn = "$.index[*][?(@.docs == 'Foo the function')].id"
+    //@ set foo_fn = "$.index[?(@.docs == 'Foo the function')].id"
 
     #[allow(non_snake_case)]
     /// Foo the function
     pub fn Foo() {}
 }
 
-//@ ismany "$.index[*].inner[?(@.use.name == 'Foo')].use.id" $foo_fn $foo_struct
-//@ ismany "$.index[*].inner[?(@.use.name == 'Bar')].use.id" $foo_fn $foo_struct
+//@ ismany "$.index[?(@.inner.use.name == 'Foo')].inner.use.id" $foo_fn $foo_struct
+//@ ismany "$.index[?(@.inner.use.name == 'Bar')].inner.use.id" $foo_fn $foo_struct
 
-//@ count "$.index[*].inner[?(@.use.name == 'Foo')]" 2
-//@ count "$.index[*].inner[?(@.use.name == 'Bar')]" 2
+//@ count "$.index[?(@.inner.use.name == 'Foo')]" 2
+//@ count "$.index[?(@.inner.use.name == 'Bar')]" 2
 pub use Foo as Bar;
 pub use nested::Foo;
diff --git a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
index f313171afa59b..05b55c7b12a03 100644
--- a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
+++ b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
@@ -3,17 +3,17 @@
 #![no_std]
 
 mod inner {
-    //@ set trait_id = "$.index[*][?(@.name=='Trait')].id"
+    //@ set trait_id = "$.index[?(@.name=='Trait')].id"
     pub trait Trait {}
 }
 
-//@ set export_id = "$.index[*][?(@.docs=='First re-export')].id"
-//@ is "$.index[*].inner[?(@.use.name=='Trait')].use.id" $trait_id
+//@ set export_id = "$.index[?(@.docs=='First re-export')].id"
+//@ is "$.index[?(@.inner.use.name=='Trait')].inner.use.id" $trait_id
 /// First re-export
 pub use inner::Trait;
-//@ set reexport_id = "$.index[*][?(@.docs=='Second re-export')].id"
-//@ is "$.index[*].inner[?(@.use.name=='Reexport')].use.id" $trait_id
+//@ set reexport_id = "$.index[?(@.docs=='Second re-export')].id"
+//@ is "$.index[?(@.inner.use.name=='Reexport')].inner.use.id" $trait_id
 /// Second re-export
 pub use inner::Trait as Reexport;
 
-//@ ismany "$.index[*][?(@.name=='same_type_reexported_more_than_once')].inner.module.items[*]" $reexport_id $export_id
+//@ ismany "$.index[?(@.name=='same_type_reexported_more_than_once')].inner.module.items[*]" $reexport_id $export_id
diff --git a/tests/rustdoc-json/reexport/simple_private.rs b/tests/rustdoc-json/reexport/simple_private.rs
index 405d57d342e4a..40be1708dc69d 100644
--- a/tests/rustdoc-json/reexport/simple_private.rs
+++ b/tests/rustdoc-json/reexport/simple_private.rs
@@ -1,20 +1,20 @@
 //@ edition:2018
 
-//@ !has "$.index[*][?(@.name=='inner')]"
+//@ !has "$.index[?(@.name=='inner')]"
 mod inner {
-    //@ set pub_id = "$.index[*][?(@.name=='Public')].id"
+    //@ set pub_id = "$.index[?(@.name=='Public')].id"
     pub struct Public;
 }
 
-//@ is "$.index[*][?(@.inner.use)].inner.use.name" \"Public\"
-//@ is "$.index[*][?(@.inner.use)].inner.use.id" $pub_id
-//@ set use_id = "$.index[*][?(@.inner.use)].id"
+//@ is "$.index[?(@.inner.use)].inner.use.name" \"Public\"
+//@ is "$.index[?(@.inner.use)].inner.use.id" $pub_id
+//@ set use_id = "$.index[?(@.inner.use)].id"
 pub use inner::Public;
 
-//@ ismany "$.index[*][?(@.name=='simple_private')].inner.module.items[*]" $use_id
+//@ ismany "$.index[?(@.name=='simple_private')].inner.module.items[*]" $use_id
 
 // Test for https://github.com/rust-lang/rust/issues/135309
-//@ has  "$.paths[*][?(@.kind=='module')].path" '["simple_private"]'
+//@ has  "$.paths[?(@.kind=='module')].path" '["simple_private"]'
 //@ !has "$.paths[*].path"                      '["simple_private", "inner"]'
-//@ has  "$.paths[*][?(@.kind=='struct')].path" '["simple_private", "inner", "Public"]'
+//@ has  "$.paths[?(@.kind=='struct')].path" '["simple_private", "inner", "Public"]'
 //@ !has "$.paths[*].path"                      '["simple_private", "Public"]'
diff --git a/tests/rustdoc-json/reexport/simple_public.rs b/tests/rustdoc-json/reexport/simple_public.rs
index f133582831408..cdb6c0dc88a3b 100644
--- a/tests/rustdoc-json/reexport/simple_public.rs
+++ b/tests/rustdoc-json/reexport/simple_public.rs
@@ -1,21 +1,21 @@
 //@ edition:2018
 
-//@ set inner_id = "$.index[*][?(@.name=='inner')].id"
+//@ set inner_id = "$.index[?(@.name=='inner')].id"
 pub mod inner {
 
-    //@ set public_id = "$.index[*][?(@.name=='Public')].id"
-    //@ ismany "$.index[*][?(@.name=='inner')].inner.module.items[*]" $public_id
+    //@ set public_id = "$.index[?(@.name=='Public')].id"
+    //@ ismany "$.index[?(@.name=='inner')].inner.module.items[*]" $public_id
     pub struct Public;
 }
 
-//@ set import_id = "$.index[*][?(@.docs=='Outer')].id"
-//@ is "$.index[*][?(@.docs=='Outer')].inner.use.source" \"inner::Public\"
+//@ set import_id = "$.index[?(@.docs=='Outer')].id"
+//@ is "$.index[?(@.docs=='Outer')].inner.use.source" \"inner::Public\"
 /// Outer
 pub use inner::Public;
 
-//@ ismany "$.index[*][?(@.name=='simple_public')].inner.module.items[*]" $import_id $inner_id
+//@ ismany "$.index[?(@.name=='simple_public')].inner.module.items[*]" $import_id $inner_id
 
-//@ has  "$.paths[*][?(@.kind=='module')].path" '["simple_public"]'
-//@ has  "$.paths[*][?(@.kind=='module')].path" '["simple_public", "inner"]'
-//@ has  "$.paths[*][?(@.kind=='struct')].path" '["simple_public", "inner", "Public"]'
+//@ has  "$.paths[?(@.kind=='module')].path" '["simple_public"]'
+//@ has  "$.paths[?(@.kind=='module')].path" '["simple_public", "inner"]'
+//@ has  "$.paths[?(@.kind=='struct')].path" '["simple_public", "inner", "Public"]'
 //@ !has "$.paths[*].path"                      '["simple_public", "Public"]'
diff --git a/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs b/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs
index 59699e4861b4f..89591690bcafc 100644
--- a/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs
+++ b/tests/rustdoc-json/reexport/synthesize_trait_with_docs.rs
@@ -7,4 +7,4 @@ pub struct Local;
 
 impl trait_with_docs::HasDocs for Local {}
 
-//@ !has "$.index[*][?(@.name == 'HasDocs')]"
+//@ !has "$.index[?(@.name == 'HasDocs')]"
diff --git a/tests/rustdoc-json/return-type-notation.rs b/tests/rustdoc-json/return-type-notation.rs
index 2219642bfc51f..7943991616b99 100644
--- a/tests/rustdoc-json/return-type-notation.rs
+++ b/tests/rustdoc-json/return-type-notation.rs
@@ -8,8 +8,8 @@ pub trait Foo {
     async fn bar();
 }
 
-//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.args.angle_bracketed.constraints[0].args" '"return_type_notation"'
-//@ ismany "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[*].bound_predicate.type.qualified_path.args" '"return_type_notation"' '"return_type_notation"'
+//@ is "$.index[?(@.name=='foo')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.args.angle_bracketed.constraints[0].args" '"return_type_notation"'
+//@ ismany "$.index[?(@.name=='foo')].inner.function.generics.where_predicates[*].bound_predicate.type.qualified_path.args" '"return_type_notation"' '"return_type_notation"'
 pub fn foo<T: Foo<bar(..): Send>>()
 where
     <T as Foo>::bar(..): 'static,
diff --git a/tests/rustdoc-json/return_private.rs b/tests/rustdoc-json/return_private.rs
index 214fda14acada..8fbdb6be5c912 100644
--- a/tests/rustdoc-json/return_private.rs
+++ b/tests/rustdoc-json/return_private.rs
@@ -1,13 +1,13 @@
 // Regression test for <https://github.com/rust-lang/rust/issues/96161>.
 
 mod secret {
-    //@ set struct_secret = "$.index[*][?(@.name == 'Secret' && @.inner.struct)].id"
+    //@ set struct_secret = "$.index[?(@.name == 'Secret' && @.inner.struct)].id"
     pub struct Secret;
 }
 
-//@ has "$.index[*][?(@.name=='get_secret')].inner.function"
-//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.path" '"secret::Secret"'
-//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.id" $struct_secret
+//@ has "$.index[?(@.name=='get_secret')].inner.function"
+//@ is "$.index[?(@.name=='get_secret')].inner.function.sig.output.resolved_path.path" '"secret::Secret"'
+//@ is "$.index[?(@.name=='get_secret')].inner.function.sig.output.resolved_path.id" $struct_secret
 pub fn get_secret() -> secret::Secret {
     secret::Secret
 }
diff --git a/tests/rustdoc-json/statics/extern.rs b/tests/rustdoc-json/statics/extern.rs
index 9e0265da8e2ea..5be13c8b8fc49 100644
--- a/tests/rustdoc-json/statics/extern.rs
+++ b/tests/rustdoc-json/statics/extern.rs
@@ -1,38 +1,38 @@
 //@ edition: 2021
 
 extern "C" {
-    //@ is '$.index[*][?(@.name=="A")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="A")].inner.static.is_mutable' false
+    //@ is '$.index[?(@.name=="A")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="A")].inner.static.is_mutable' false
     pub static A: i32;
-    //@ is '$.index[*][?(@.name=="B")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="B")].inner.static.is_mutable' true
+    //@ is '$.index[?(@.name=="B")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="B")].inner.static.is_mutable' true
     pub static mut B: i32;
 
     // items in unadorned `extern` blocks cannot have safety qualifiers
 }
 
 unsafe extern "C" {
-    //@ is '$.index[*][?(@.name=="C")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="C")].inner.static.is_mutable' false
+    //@ is '$.index[?(@.name=="C")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="C")].inner.static.is_mutable' false
     pub static C: i32;
-    //@ is '$.index[*][?(@.name=="D")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="D")].inner.static.is_mutable' true
+    //@ is '$.index[?(@.name=="D")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="D")].inner.static.is_mutable' true
     pub static mut D: i32;
 
-    //@ is '$.index[*][?(@.name=="E")].inner.static.is_unsafe'  false
-    //@ is '$.index[*][?(@.name=="E")].inner.static.is_mutable' false
+    //@ is '$.index[?(@.name=="E")].inner.static.is_unsafe'  false
+    //@ is '$.index[?(@.name=="E")].inner.static.is_mutable' false
     pub safe static E: i32;
-    //@ is '$.index[*][?(@.name=="F")].inner.static.is_unsafe'  false
-    //@ is '$.index[*][?(@.name=="F")].inner.static.is_mutable' true
+    //@ is '$.index[?(@.name=="F")].inner.static.is_unsafe'  false
+    //@ is '$.index[?(@.name=="F")].inner.static.is_mutable' true
     pub safe static mut F: i32;
 
-    //@ is '$.index[*][?(@.name=="G")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="G")].inner.static.is_mutable' false
+    //@ is '$.index[?(@.name=="G")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="G")].inner.static.is_mutable' false
     pub unsafe static G: i32;
-    //@ is '$.index[*][?(@.name=="H")].inner.static.is_unsafe'  true
-    //@ is '$.index[*][?(@.name=="H")].inner.static.is_mutable' true
+    //@ is '$.index[?(@.name=="H")].inner.static.is_unsafe'  true
+    //@ is '$.index[?(@.name=="H")].inner.static.is_mutable' true
     pub unsafe static mut H: i32;
 }
 
-//@ ismany '$.index[*][?(@.inner.static)].inner.static.expr' '""' '""' '""' '""' '""' '""' '""' '""'
-//@ ismany '$.index[*][?(@.inner.static)].inner.static.type.primitive' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"'
+//@ ismany '$.index[?(@.inner.static)].inner.static.expr' '""' '""' '""' '""' '""' '""' '""' '""'
+//@ ismany '$.index[?(@.inner.static)].inner.static.type.primitive' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"'
diff --git a/tests/rustdoc-json/statics/statics.rs b/tests/rustdoc-json/statics/statics.rs
index a8af23cc87dcc..497a134c503dd 100644
--- a/tests/rustdoc-json/statics/statics.rs
+++ b/tests/rustdoc-json/statics/statics.rs
@@ -1,12 +1,12 @@
-//@ is '$.index[*][?(@.name=="A")].inner.static.type.primitive' '"i32"'
-//@ is '$.index[*][?(@.name=="A")].inner.static.is_mutable' false
-//@ is '$.index[*][?(@.name=="A")].inner.static.expr' '"5"'
-//@ is '$.index[*][?(@.name=="A")].inner.static.is_unsafe' false
+//@ is '$.index[?(@.name=="A")].inner.static.type.primitive' '"i32"'
+//@ is '$.index[?(@.name=="A")].inner.static.is_mutable' false
+//@ is '$.index[?(@.name=="A")].inner.static.expr' '"5"'
+//@ is '$.index[?(@.name=="A")].inner.static.is_unsafe' false
 pub static A: i32 = 5;
 
-//@ is '$.index[*][?(@.name=="B")].inner.static.type.primitive' '"u32"'
-//@ is '$.index[*][?(@.name=="B")].inner.static.is_mutable' true
+//@ is '$.index[?(@.name=="B")].inner.static.type.primitive' '"u32"'
+//@ is '$.index[?(@.name=="B")].inner.static.is_mutable' true
 // Expr value isn't gaurenteed, it'd be fine to change it.
-//@ is '$.index[*][?(@.name=="B")].inner.static.expr' '"_"'
-//@ is '$.index[*][?(@.name=="B")].inner.static.is_unsafe' false
+//@ is '$.index[?(@.name=="B")].inner.static.expr' '"_"'
+//@ is '$.index[?(@.name=="B")].inner.static.is_unsafe' false
 pub static mut B: u32 = 2 + 3;
diff --git a/tests/rustdoc-json/stripped_modules.rs b/tests/rustdoc-json/stripped_modules.rs
index d0db9c6588b00..ba6644190a2d7 100644
--- a/tests/rustdoc-json/stripped_modules.rs
+++ b/tests/rustdoc-json/stripped_modules.rs
@@ -1,17 +1,17 @@
-//@ !has "$.index[*][?(@.name=='no_pub_inner')]"
+//@ !has "$.index[?(@.name=='no_pub_inner')]"
 mod no_pub_inner {
     fn priv_inner() {}
 }
 
-//@ !has "$.index[*][?(@.name=='pub_inner_unreachable')]"
+//@ !has "$.index[?(@.name=='pub_inner_unreachable')]"
 mod pub_inner_unreachable {
-    //@ !has "$.index[*][?(@.name=='pub_inner_1')]"
+    //@ !has "$.index[?(@.name=='pub_inner_1')]"
     pub fn pub_inner_1() {}
 }
 
-//@ !has "$.index[*][?(@.name=='pub_inner_reachable')]"
+//@ !has "$.index[?(@.name=='pub_inner_reachable')]"
 mod pub_inner_reachable {
-    //@ has "$.index[*][?(@.name=='pub_inner_2')]"
+    //@ has "$.index[?(@.name=='pub_inner_2')]"
     pub fn pub_inner_2() {}
 }
 
diff --git a/tests/rustdoc-json/structs/field_order.rs b/tests/rustdoc-json/structs/field_order.rs
index 7e556df777f49..eb1740676a67e 100644
--- a/tests/rustdoc-json/structs/field_order.rs
+++ b/tests/rustdoc-json/structs/field_order.rs
@@ -15,24 +15,24 @@ pub struct Foo {
     pub vll_9: i32,
 }
 
-//@ set 0 = '$.index[*][?(@.name == "ews_0")].id'
-//@ set 1 = '$.index[*][?(@.name == "dik_1")].id'
-//@ set 2 = '$.index[*][?(@.name == "hsk_2")].id'
-//@ set 3 = '$.index[*][?(@.name == "djt_3")].id'
-//@ set 4 = '$.index[*][?(@.name == "jnr_4")].id'
-//@ set 5 = '$.index[*][?(@.name == "dfs_5")].id'
-//@ set 6 = '$.index[*][?(@.name == "bja_6")].id'
-//@ set 7 = '$.index[*][?(@.name == "lyc_7")].id'
-//@ set 8 = '$.index[*][?(@.name == "yqd_8")].id'
-//@ set 9 = '$.index[*][?(@.name == "vll_9")].id'
+//@ set 0 = '$.index[?(@.name == "ews_0")].id'
+//@ set 1 = '$.index[?(@.name == "dik_1")].id'
+//@ set 2 = '$.index[?(@.name == "hsk_2")].id'
+//@ set 3 = '$.index[?(@.name == "djt_3")].id'
+//@ set 4 = '$.index[?(@.name == "jnr_4")].id'
+//@ set 5 = '$.index[?(@.name == "dfs_5")].id'
+//@ set 6 = '$.index[?(@.name == "bja_6")].id'
+//@ set 7 = '$.index[?(@.name == "lyc_7")].id'
+//@ set 8 = '$.index[?(@.name == "yqd_8")].id'
+//@ set 9 = '$.index[?(@.name == "vll_9")].id'
 
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[0]' $0
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[1]' $1
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[2]' $2
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[3]' $3
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[4]' $4
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[5]' $5
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[6]' $6
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[7]' $7
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[8]' $8
-//@ is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[9]' $9
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[0]' $0
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[1]' $1
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[2]' $2
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[3]' $3
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[4]' $4
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[5]' $5
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[6]' $6
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[7]' $7
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[8]' $8
+//@ is '$.index[?(@.name == "Foo")].inner.struct.kind.plain.fields[9]' $9
diff --git a/tests/rustdoc-json/structs/plain_all_pub.rs b/tests/rustdoc-json/structs/plain_all_pub.rs
index 67d2a4a7a8cf8..501044f62cc5a 100644
--- a/tests/rustdoc-json/structs/plain_all_pub.rs
+++ b/tests/rustdoc-json/structs/plain_all_pub.rs
@@ -3,9 +3,9 @@ pub struct Demo {
     pub y: i32,
 }
 
-//@ set x = "$.index[*][?(@.name=='x')].id"
-//@ set y = "$.index[*][?(@.name=='y')].id"
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[1]" $y
-//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 2
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" false
+//@ set x = "$.index[?(@.name=='x')].id"
+//@ set y = "$.index[?(@.name=='y')].id"
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[1]" $y
+//@ count "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 2
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" false
diff --git a/tests/rustdoc-json/structs/plain_doc_hidden.rs b/tests/rustdoc-json/structs/plain_doc_hidden.rs
index 4573adc73fa1f..e62fb27ae86a3 100644
--- a/tests/rustdoc-json/structs/plain_doc_hidden.rs
+++ b/tests/rustdoc-json/structs/plain_doc_hidden.rs
@@ -4,8 +4,8 @@ pub struct Demo {
     pub y: i32,
 }
 
-//@ set x = "$.index[*][?(@.name=='x')].id"
-//@ !has "$.index[*][?(@.name=='y')].id"
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
-//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true
+//@ set x = "$.index[?(@.name=='x')].id"
+//@ !has "$.index[?(@.name=='y')].id"
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
+//@ count "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true
diff --git a/tests/rustdoc-json/structs/plain_empty.rs b/tests/rustdoc-json/structs/plain_empty.rs
index 30013021abef2..127f9ed197210 100644
--- a/tests/rustdoc-json/structs/plain_empty.rs
+++ b/tests/rustdoc-json/structs/plain_empty.rs
@@ -1,5 +1,5 @@
-//@ is "$.index[*][?(@.name=='PlainEmpty')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='PlainEmpty')].inner.struct"
-//@ is "$.index[*][?(@.name=='PlainEmpty')].inner.struct.kind.plain.has_stripped_fields" false
-//@ is "$.index[*][?(@.name=='PlainEmpty')].inner.struct.kind.plain.fields" []
+//@ is "$.index[?(@.name=='PlainEmpty')].visibility" \"public\"
+//@ has "$.index[?(@.name=='PlainEmpty')].inner.struct"
+//@ is "$.index[?(@.name=='PlainEmpty')].inner.struct.kind.plain.has_stripped_fields" false
+//@ is "$.index[?(@.name=='PlainEmpty')].inner.struct.kind.plain.fields" []
 pub struct PlainEmpty {}
diff --git a/tests/rustdoc-json/structs/plain_pub_priv.rs b/tests/rustdoc-json/structs/plain_pub_priv.rs
index 91079a30d42ea..181d5ea0de286 100644
--- a/tests/rustdoc-json/structs/plain_pub_priv.rs
+++ b/tests/rustdoc-json/structs/plain_pub_priv.rs
@@ -3,7 +3,7 @@ pub struct Demo {
     y: i32,
 }
 
-//@ set x = "$.index[*][?(@.name=='x')].id"
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
-//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
-//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true
+//@ set x = "$.index[?(@.name=='x')].id"
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
+//@ count "$.index[?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
+//@ is "$.index[?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true
diff --git a/tests/rustdoc-json/structs/tuple.rs b/tests/rustdoc-json/structs/tuple.rs
index 6c8dc79dfe224..115ce29bd7032 100644
--- a/tests/rustdoc-json/structs/tuple.rs
+++ b/tests/rustdoc-json/structs/tuple.rs
@@ -1,4 +1,4 @@
-//@ is "$.index[*][?(@.name=='Tuple')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Tuple')].inner.struct"
-//@ is "$.index[*][?(@.name=='Tuple')].inner.struct.kind.tuple" '[null, null]'
+//@ is "$.index[?(@.name=='Tuple')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Tuple')].inner.struct"
+//@ is "$.index[?(@.name=='Tuple')].inner.struct.kind.tuple" '[null, null]'
 pub struct Tuple(u32, String);
diff --git a/tests/rustdoc-json/structs/tuple_empty.rs b/tests/rustdoc-json/structs/tuple_empty.rs
index 137915e6c0540..af5b57fb133b3 100644
--- a/tests/rustdoc-json/structs/tuple_empty.rs
+++ b/tests/rustdoc-json/structs/tuple_empty.rs
@@ -1,2 +1,2 @@
-//@ is "$.index[*][?(@.name=='TupleUnit')].inner.struct.kind.tuple" []
+//@ is "$.index[?(@.name=='TupleUnit')].inner.struct.kind.tuple" []
 pub struct TupleUnit();
diff --git a/tests/rustdoc-json/structs/tuple_pub_priv.rs b/tests/rustdoc-json/structs/tuple_pub_priv.rs
index 11af26e6ea3a7..b97a17cc46ac2 100644
--- a/tests/rustdoc-json/structs/tuple_pub_priv.rs
+++ b/tests/rustdoc-json/structs/tuple_pub_priv.rs
@@ -5,9 +5,9 @@ pub struct Demo(
     #[doc(hidden)] i32,
 );
 
-//@ set field = "$.index[*][?(@.docs=='field')].id"
+//@ set field = "$.index[?(@.docs=='field')].id"
 
-//@ is    "$.index[*][?(@.name=='Demo')].inner.struct.kind.tuple[0]" null
-//@ is    "$.index[*][?(@.name=='Demo')].inner.struct.kind.tuple[1]" $field
-//@ is    "$.index[*][?(@.name=='Demo')].inner.struct.kind.tuple[2]" null
-//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.tuple[*]" 3
+//@ is    "$.index[?(@.name=='Demo')].inner.struct.kind.tuple[0]" null
+//@ is    "$.index[?(@.name=='Demo')].inner.struct.kind.tuple[1]" $field
+//@ is    "$.index[?(@.name=='Demo')].inner.struct.kind.tuple[2]" null
+//@ count "$.index[?(@.name=='Demo')].inner.struct.kind.tuple[*]" 3
diff --git a/tests/rustdoc-json/structs/unit.rs b/tests/rustdoc-json/structs/unit.rs
index ad6af65c0e0b4..6a96172520642 100644
--- a/tests/rustdoc-json/structs/unit.rs
+++ b/tests/rustdoc-json/structs/unit.rs
@@ -1,4 +1,4 @@
-//@ is "$.index[*][?(@.name=='Unit')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Unit')].inner.struct"
-//@ is "$.index[*][?(@.name=='Unit')].inner.struct.kind" \"unit\"
+//@ is "$.index[?(@.name=='Unit')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Unit')].inner.struct"
+//@ is "$.index[?(@.name=='Unit')].inner.struct.kind" \"unit\"
 pub struct Unit;
diff --git a/tests/rustdoc-json/structs/with_generics.rs b/tests/rustdoc-json/structs/with_generics.rs
index 3e7f175a5a1a5..979b002d0eee3 100644
--- a/tests/rustdoc-json/structs/with_generics.rs
+++ b/tests/rustdoc-json/structs/with_generics.rs
@@ -1,13 +1,13 @@
 use std::collections::HashMap;
 
-//@ is "$.index[*][?(@.name=='WithGenerics')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='WithGenerics')].inner.struct"
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[0].name" \"T\"
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[0].kind.type.bounds" []
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[1].name" \"U\"
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[1].kind.type.bounds" []
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.kind.plain.has_stripped_fields" true
-//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.kind.plain.fields" []
+//@ is "$.index[?(@.name=='WithGenerics')].visibility" \"public\"
+//@ has "$.index[?(@.name=='WithGenerics')].inner.struct"
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.generics.params[0].name" \"T\"
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.generics.params[0].kind.type.bounds" []
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.generics.params[1].name" \"U\"
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.generics.params[1].kind.type.bounds" []
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.kind.plain.has_stripped_fields" true
+//@ is "$.index[?(@.name=='WithGenerics')].inner.struct.kind.plain.fields" []
 pub struct WithGenerics<T, U> {
     stuff: Vec<T>,
     things: HashMap<U, U>,
diff --git a/tests/rustdoc-json/structs/with_primitives.rs b/tests/rustdoc-json/structs/with_primitives.rs
index fe99292456d64..4e856bda296c5 100644
--- a/tests/rustdoc-json/structs/with_primitives.rs
+++ b/tests/rustdoc-json/structs/with_primitives.rs
@@ -1,9 +1,9 @@
-//@ is "$.index[*][?(@.name=='WithPrimitives')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='WithPrimitives')].inner.struct"
-//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].name" \"\'a\"
-//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].kind.lifetime.outlives" []
-//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.kind.plain.has_stripped_fields" true
-//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.kind.plain.fields" []
+//@ is "$.index[?(@.name=='WithPrimitives')].visibility" \"public\"
+//@ has "$.index[?(@.name=='WithPrimitives')].inner.struct"
+//@ is "$.index[?(@.name=='WithPrimitives')].inner.struct.generics.params[0].name" \"\'a\"
+//@ is "$.index[?(@.name=='WithPrimitives')].inner.struct.generics.params[0].kind.lifetime.outlives" []
+//@ is "$.index[?(@.name=='WithPrimitives')].inner.struct.kind.plain.has_stripped_fields" true
+//@ is "$.index[?(@.name=='WithPrimitives')].inner.struct.kind.plain.fields" []
 pub struct WithPrimitives<'a> {
     num: u32,
     s: &'a str,
diff --git a/tests/rustdoc-json/trait_alias.rs b/tests/rustdoc-json/trait_alias.rs
index d9ef256b106fe..e7a586ee95a3e 100644
--- a/tests/rustdoc-json/trait_alias.rs
+++ b/tests/rustdoc-json/trait_alias.rs
@@ -1,17 +1,17 @@
 #![feature(trait_alias)]
 
-//@ set StrLike = "$.index[*][?(@.name=='StrLike')].id"
-//@ is "$.index[*][?(@.name=='StrLike')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='StrLike')].inner.trait_alias"
-//@ is "$.index[*][?(@.name=='StrLike')].span.filename" $FILE
+//@ set StrLike = "$.index[?(@.name=='StrLike')].id"
+//@ is "$.index[?(@.name=='StrLike')].visibility" \"public\"
+//@ has "$.index[?(@.name=='StrLike')].inner.trait_alias"
+//@ is "$.index[?(@.name=='StrLike')].span.filename" $FILE
 pub trait StrLike = AsRef<str>;
 
-//@ is "$.index[*][?(@.name=='f')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
+//@ is "$.index[?(@.name=='f')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
 pub fn f() -> impl StrLike {
     "heya"
 }
 
-//@ !is "$.index[*][?(@.name=='g')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
+//@ !is "$.index[?(@.name=='g')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
 pub fn g() -> impl AsRef<str> {
     "heya"
 }
diff --git a/tests/rustdoc-json/traits/has_body.rs b/tests/rustdoc-json/traits/has_body.rs
index 95e0f97b52cce..d17988474f921 100644
--- a/tests/rustdoc-json/traits/has_body.rs
+++ b/tests/rustdoc-json/traits/has_body.rs
@@ -1,21 +1,21 @@
-//@ has "$.index[*][?(@.name=='Foo')]"
+//@ has "$.index[?(@.name=='Foo')]"
 pub trait Foo {
-    //@ is "$.index[*][?(@.name=='no_self')].inner.function.has_body" false
+    //@ is "$.index[?(@.name=='no_self')].inner.function.has_body" false
     fn no_self();
-    //@ is "$.index[*][?(@.name=='move_self')].inner.function.has_body" false
+    //@ is "$.index[?(@.name=='move_self')].inner.function.has_body" false
     fn move_self(self);
-    //@ is "$.index[*][?(@.name=='ref_self')].inner.function.has_body" false
+    //@ is "$.index[?(@.name=='ref_self')].inner.function.has_body" false
     fn ref_self(&self);
 
-    //@ is "$.index[*][?(@.name=='no_self_def')].inner.function.has_body" true
+    //@ is "$.index[?(@.name=='no_self_def')].inner.function.has_body" true
     fn no_self_def() {}
-    //@ is "$.index[*][?(@.name=='move_self_def')].inner.function.has_body" true
+    //@ is "$.index[?(@.name=='move_self_def')].inner.function.has_body" true
     fn move_self_def(self) {}
-    //@ is "$.index[*][?(@.name=='ref_self_def')].inner.function.has_body" true
+    //@ is "$.index[?(@.name=='ref_self_def')].inner.function.has_body" true
     fn ref_self_def(&self) {}
 }
 
 pub trait Bar: Clone {
-    //@ is "$.index[*][?(@.name=='method')].inner.function.has_body" false
+    //@ is "$.index[?(@.name=='method')].inner.function.has_body" false
     fn method(&self, param: usize);
 }
diff --git a/tests/rustdoc-json/traits/implementors.rs b/tests/rustdoc-json/traits/implementors.rs
index 9fdb763b61ee3..499acefedb773 100644
--- a/tests/rustdoc-json/traits/implementors.rs
+++ b/tests/rustdoc-json/traits/implementors.rs
@@ -5,14 +5,14 @@ pub struct GeorgeMichael {}
 impl Wham for GeorgeMichael {}
 
 // Find IDs.
-//@ set wham = "$.index[*][?(@.name=='Wham')].id"
-//@ set gmWham = "$.index[*][?(@.docs=='Wham for George Michael')].id"
-//@ set gm = "$.index[*][?(@.name=='GeorgeMichael')].id"
+//@ set wham = "$.index[?(@.name=='Wham')].id"
+//@ set gmWham = "$.index[?(@.docs=='Wham for George Michael')].id"
+//@ set gm = "$.index[?(@.name=='GeorgeMichael')].id"
 
 // Both struct and trait point to impl.
-//@ has "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" $gmWham
-//@ is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" $gmWham
+//@ has "$.index[?(@.name=='GeorgeMichael')].inner.struct.impls[*]" $gmWham
+//@ is "$.index[?(@.name=='Wham')].inner.trait.implementations[*]" $gmWham
 
 // Impl points to both struct and trait.
-//@ is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.trait.id" $wham
-//@ is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.for.resolved_path.id" $gm
+//@ is "$.index[?(@.docs == 'Wham for George Michael')].inner.impl.trait.id" $wham
+//@ is "$.index[?(@.docs == 'Wham for George Michael')].inner.impl.for.resolved_path.id" $gm
diff --git a/tests/rustdoc-json/traits/is_dyn_compatible.rs b/tests/rustdoc-json/traits/is_dyn_compatible.rs
index bccf94d17d606..b172b53807b6b 100644
--- a/tests/rustdoc-json/traits/is_dyn_compatible.rs
+++ b/tests/rustdoc-json/traits/is_dyn_compatible.rs
@@ -1,19 +1,19 @@
 #![no_std]
 
-//@ has "$.index[*][?(@.name=='FooDynIncompatible')]"
-//@ is "$.index[*][?(@.name=='FooDynIncompatible')].inner.trait.is_dyn_compatible" false
+//@ has "$.index[?(@.name=='FooDynIncompatible')]"
+//@ is "$.index[?(@.name=='FooDynIncompatible')].inner.trait.is_dyn_compatible" false
 pub trait FooDynIncompatible {
     fn foo() -> Self;
 }
 
-//@ has "$.index[*][?(@.name=='BarDynIncompatible')]"
-//@ is "$.index[*][?(@.name=='BarDynIncompatible')].inner.trait.is_dyn_compatible" false
+//@ has "$.index[?(@.name=='BarDynIncompatible')]"
+//@ is "$.index[?(@.name=='BarDynIncompatible')].inner.trait.is_dyn_compatible" false
 pub trait BarDynIncompatible<T> {
     fn foo(i: T);
 }
 
-//@ has "$.index[*][?(@.name=='FooDynCompatible')]"
-//@ is "$.index[*][?(@.name=='FooDynCompatible')].inner.trait.is_dyn_compatible" true
+//@ has "$.index[?(@.name=='FooDynCompatible')]"
+//@ is "$.index[?(@.name=='FooDynCompatible')].inner.trait.is_dyn_compatible" true
 pub trait FooDynCompatible {
     fn foo(&self);
 }
diff --git a/tests/rustdoc-json/traits/private_supertrait.rs b/tests/rustdoc-json/traits/private_supertrait.rs
index ce0642278e084..1e11abaecdf55 100644
--- a/tests/rustdoc-json/traits/private_supertrait.rs
+++ b/tests/rustdoc-json/traits/private_supertrait.rs
@@ -1,9 +1,9 @@
-//@ !has "$.index[*][?(@.name == 'sealed')]"
+//@ !has "$.index[?(@.name == 'sealed')]"
 mod sealed {
-    //@ set sealed_id = "$.index[*][?(@.name=='Sealed')].id"
+    //@ set sealed_id = "$.index[?(@.name=='Sealed')].id"
     pub trait Sealed {}
 }
 
-//@ count "$.index[*][?(@.name=='Trait')].inner.trait.bounds[*]" 1
-//@ is    "$.index[*][?(@.name=='Trait')].inner.trait.bounds[0].trait_bound.trait.id" $sealed_id
+//@ count "$.index[?(@.name=='Trait')].inner.trait.bounds[*]" 1
+//@ is    "$.index[?(@.name=='Trait')].inner.trait.bounds[0].trait_bound.trait.id" $sealed_id
 pub trait Trait: sealed::Sealed {}
diff --git a/tests/rustdoc-json/traits/self.rs b/tests/rustdoc-json/traits/self.rs
index efd9efd556fae..018bda9cc3c5a 100644
--- a/tests/rustdoc-json/traits/self.rs
+++ b/tests/rustdoc-json/traits/self.rs
@@ -7,29 +7,29 @@ pub struct Foo;
 // Each assertion matches 3 times, and should be the same each time.
 
 impl Foo {
-    //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
-    //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
-    //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
-    //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
+    //@ ismany '$.index[?(@.name=="by_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
+    //@ ismany '$.index[?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
+    //@ ismany '$.index[?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
     pub fn by_ref(&self) {}
 
-    //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
-    //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
-    //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
-    //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' true true true
+    //@ ismany '$.index[?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
+    //@ ismany '$.index[?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
+    //@ ismany '$.index[?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' true true true
     pub fn by_exclusive_ref(&mut self) {}
 
-    //@ ismany '$.index[*][?(@.name=="by_value")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
-    //@ ismany '$.index[*][?(@.name=="by_value")].inner.function.sig.inputs[0][1].generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="by_value")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
+    //@ ismany '$.index[?(@.name=="by_value")].inner.function.sig.inputs[0][1].generic' '"Self"' '"Self"' '"Self"'
     pub fn by_value(self) {}
 
-    //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
-    //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
-    //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' \"\'a\" \"\'a\" \"\'a\"
-    //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
+    //@ ismany '$.index[?(@.name=="with_lifetime")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
+    //@ ismany '$.index[?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' \"\'a\" \"\'a\" \"\'a\"
+    //@ ismany '$.index[?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
     pub fn with_lifetime<'a>(&'a self) {}
 
-    //@ ismany '$.index[*][?(@.name=="build")].inner.function.sig.output.generic' '"Self"' '"Self"' '"Self"'
+    //@ ismany '$.index[?(@.name=="build")].inner.function.sig.output.generic' '"Self"' '"Self"' '"Self"'
     pub fn build() -> Self {
         Self
     }
diff --git a/tests/rustdoc-json/traits/supertrait.rs b/tests/rustdoc-json/traits/supertrait.rs
index 4b6199d4b26f2..3accb0ff8581b 100644
--- a/tests/rustdoc-json/traits/supertrait.rs
+++ b/tests/rustdoc-json/traits/supertrait.rs
@@ -1,20 +1,20 @@
-//@ set loud_id = "$.index[*][?(@.name=='Loud')].id"
+//@ set loud_id = "$.index[?(@.name=='Loud')].id"
 pub trait Loud {}
 
-//@ set very_loud_id = "$.index[*][?(@.name=='VeryLoud')].id"
-//@ count "$.index[*][?(@.name=='VeryLoud')].inner.trait.bounds[*]" 1
-//@ is    "$.index[*][?(@.name=='VeryLoud')].inner.trait.bounds[0].trait_bound.trait.id" $loud_id
+//@ set very_loud_id = "$.index[?(@.name=='VeryLoud')].id"
+//@ count "$.index[?(@.name=='VeryLoud')].inner.trait.bounds[*]" 1
+//@ is    "$.index[?(@.name=='VeryLoud')].inner.trait.bounds[0].trait_bound.trait.id" $loud_id
 pub trait VeryLoud: Loud {}
 
-//@ set sounds_good_id = "$.index[*][?(@.name=='SoundsGood')].id"
+//@ set sounds_good_id = "$.index[?(@.name=='SoundsGood')].id"
 pub trait SoundsGood {}
 
-//@ count "$.index[*][?(@.name=='MetalBand')].inner.trait.bounds[*]" 2
-//@ is    "$.index[*][?(@.name=='MetalBand')].inner.trait.bounds[0].trait_bound.trait.id" $very_loud_id
-//@ is    "$.index[*][?(@.name=='MetalBand')].inner.trait.bounds[1].trait_bound.trait.id" $sounds_good_id
+//@ count "$.index[?(@.name=='MetalBand')].inner.trait.bounds[*]" 2
+//@ is    "$.index[?(@.name=='MetalBand')].inner.trait.bounds[0].trait_bound.trait.id" $very_loud_id
+//@ is    "$.index[?(@.name=='MetalBand')].inner.trait.bounds[1].trait_bound.trait.id" $sounds_good_id
 pub trait MetalBand: VeryLoud + SoundsGood {}
 
-//@ count "$.index[*][?(@.name=='DnabLatem')].inner.trait.bounds[*]" 2
-//@ is    "$.index[*][?(@.name=='DnabLatem')].inner.trait.bounds[1].trait_bound.trait.id" $very_loud_id
-//@ is    "$.index[*][?(@.name=='DnabLatem')].inner.trait.bounds[0].trait_bound.trait.id" $sounds_good_id
+//@ count "$.index[?(@.name=='DnabLatem')].inner.trait.bounds[*]" 2
+//@ is    "$.index[?(@.name=='DnabLatem')].inner.trait.bounds[1].trait_bound.trait.id" $very_loud_id
+//@ is    "$.index[?(@.name=='DnabLatem')].inner.trait.bounds[0].trait_bound.trait.id" $sounds_good_id
 pub trait DnabLatem: SoundsGood + VeryLoud {}
diff --git a/tests/rustdoc-json/traits/trait_alias.rs b/tests/rustdoc-json/traits/trait_alias.rs
index 137b8947e2393..497930a67c832 100644
--- a/tests/rustdoc-json/traits/trait_alias.rs
+++ b/tests/rustdoc-json/traits/trait_alias.rs
@@ -2,25 +2,25 @@
 
 #![feature(trait_alias)]
 
-//@ set Orig = "$.index[*][?(@.name == 'Orig')].id"
-//@ has "$.index[*][?(@.name == 'Orig')].inner.trait"
+//@ set Orig = "$.index[?(@.name == 'Orig')].id"
+//@ has "$.index[?(@.name == 'Orig')].inner.trait"
 pub trait Orig<T> {}
 
-//@ set Alias = "$.index[*][?(@.name == 'Alias')].id"
-//@ has "$.index[*][?(@.name == 'Alias')].inner.trait_alias"
-//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.generics" '{"params": [], "where_predicates": []}'
-//@ count "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[*]" 1
-//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.id" $Orig
-//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.args.angle_bracketed.args[0].type.primitive" '"i32"'
+//@ set Alias = "$.index[?(@.name == 'Alias')].id"
+//@ has "$.index[?(@.name == 'Alias')].inner.trait_alias"
+//@ is "$.index[?(@.name == 'Alias')].inner.trait_alias.generics" '{"params": [], "where_predicates": []}'
+//@ count "$.index[?(@.name == 'Alias')].inner.trait_alias.params[*]" 1
+//@ is "$.index[?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.id" $Orig
+//@ is "$.index[?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.args.angle_bracketed.args[0].type.primitive" '"i32"'
 pub trait Alias = Orig<i32>;
 
 pub struct Struct;
 
 impl Orig<i32> for Struct {}
 
-//@ has "$.index[*][?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait"
-//@ is "$.index[*][?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $Alias
-//@ is "$.index[*][?(@.name=='takes_alias')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $Alias
+//@ has "$.index[?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait"
+//@ is "$.index[?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $Alias
+//@ is "$.index[?(@.name=='takes_alias')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $Alias
 pub fn takes_alias(_: impl Alias) {}
 // FIXME: Should the trait be mentioned in both the decl and generics?
 
diff --git a/tests/rustdoc-json/traits/uses_extern_trait.rs b/tests/rustdoc-json/traits/uses_extern_trait.rs
index 3a93bcaefd4b7..52983527f08c8 100644
--- a/tests/rustdoc-json/traits/uses_extern_trait.rs
+++ b/tests/rustdoc-json/traits/uses_extern_trait.rs
@@ -1,5 +1,5 @@
 #![no_std]
 pub fn drop_default<T: core::default::Default>(_x: T) {}
 
-//@ !has "$.index[*][?(@.name=='Debug')]"
-//@ !has "$.index[*][?(@.name=='Default')]"
+//@ !has "$.index[?(@.name=='Debug')]"
+//@ !has "$.index[?(@.name=='Default')]"
diff --git a/tests/rustdoc-json/type/dyn.rs b/tests/rustdoc-json/type/dyn.rs
index d8686d4e2fb1d..4e533a67f8b4d 100644
--- a/tests/rustdoc-json/type/dyn.rs
+++ b/tests/rustdoc-json/type/dyn.rs
@@ -1,45 +1,45 @@
 use std::fmt::Debug;
 
-//@ count "$.index[*][?(@.name=='dyn')].inner.module.items[*]" 3
-//@ set sync_int_gen = "$.index[*][?(@.name=='SyncIntGen')].id"
-//@ set ref_fn       = "$.index[*][?(@.name=='RefFn')].id"
-//@ set weird_order  = "$.index[*][?(@.name=='WeirdOrder')].id"
-//@ ismany "$.index[*][?(@.name=='dyn')].inner.module.items[*]" $sync_int_gen $ref_fn $weird_order
+//@ count "$.index[?(@.name=='dyn')].inner.module.items[*]" 3
+//@ set sync_int_gen = "$.index[?(@.name=='SyncIntGen')].id"
+//@ set ref_fn       = "$.index[?(@.name=='RefFn')].id"
+//@ set weird_order  = "$.index[?(@.name=='WeirdOrder')].id"
+//@ ismany "$.index[?(@.name=='dyn')].inner.module.items[*]" $sync_int_gen $ref_fn $weird_order
 
-//@ has    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias"
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.generics" '{"params": [], "where_predicates": []}'
-//@ has    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path"
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.path" \"Box\"
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
-//@ count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args" 1
-//@ has    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait"
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.lifetime" \"\'static\"
-//@ count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[*]" 3
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].generic_params" []
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].generic_params" []
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].generic_params" []
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Fn"'
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Send"'
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].trait.path" '"Sync"'
-//@ is    "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.args" '{"parenthesized": {"inputs": [],"output": {"primitive": "i32"}}}'
+//@ has    "$.index[?(@.name=='SyncIntGen')].inner.type_alias"
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.generics" '{"params": [], "where_predicates": []}'
+//@ has    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path"
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.path" \"Box\"
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
+//@ count "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args" 1
+//@ has    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait"
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.lifetime" \"\'static\"
+//@ count "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[*]" 3
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].generic_params" []
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].generic_params" []
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].generic_params" []
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Fn"'
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Send"'
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].trait.path" '"Sync"'
+//@ is    "$.index[?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.args" '{"parenthesized": {"inputs": [],"output": {"primitive": "i32"}}}'
 pub type SyncIntGen = Box<dyn Fn() -> i32 + Send + Sync + 'static>;
 
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.generics" '{"params": [{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"}],"where_predicates": []}'
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.is_mutable" 'false'
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.lifetime" "\"'a\""
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.lifetime" null
-//@ count "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[*]" 1
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref.lifetime" "\"'b\""
-//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref"
-//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref.lifetime" "\"'b\""
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.generics" '{"params": [{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"}],"where_predicates": []}'
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.is_mutable" 'false'
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.lifetime" "\"'a\""
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.lifetime" null
+//@ count "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[*]" 1
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref.lifetime" "\"'b\""
+//@ has "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref"
+//@ is "$.index[?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref.lifetime" "\"'b\""
 pub type RefFn<'a> = &'a dyn for<'b> Fn(&'b i32) -> &'b i32;
 
-//@ is    "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Send"'
-//@ is    "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Debug"'
+//@ is    "$.index[?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Send"'
+//@ is    "$.index[?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Debug"'
 pub type WeirdOrder = Box<dyn Send + Debug>;
diff --git a/tests/rustdoc-json/type/extern.rs b/tests/rustdoc-json/type/extern.rs
index 97e1c3760ee5f..7963690e4484a 100644
--- a/tests/rustdoc-json/type/extern.rs
+++ b/tests/rustdoc-json/type/extern.rs
@@ -5,5 +5,5 @@ extern "C" {
     pub type Foo;
 }
 
-//@ is "$.index[*][?(@.docs=='No inner information')].name" '"Foo"'
-//@ is "$.index[*][?(@.docs=='No inner information')].inner" \"extern_type\"
+//@ is "$.index[?(@.docs=='No inner information')].name" '"Foo"'
+//@ is "$.index[?(@.docs=='No inner information')].inner" \"extern_type\"
diff --git a/tests/rustdoc-json/type/fn_lifetime.rs b/tests/rustdoc-json/type/fn_lifetime.rs
index aaa716bf11fda..10e95cc5e5624 100644
--- a/tests/rustdoc-json/type/fn_lifetime.rs
+++ b/tests/rustdoc-json/type/fn_lifetime.rs
@@ -1,24 +1,24 @@
-//@ has "$.index[*][?(@.name=='GenericFn')].inner.type_alias"
+//@ has "$.index[?(@.name=='GenericFn')].inner.type_alias"
 
-//@ ismany "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].name" \"\'a\"
-//@ has    "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime"
-//@ count  "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime.outlives[*]" 0
-//@ count  "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.where_predicates[*]" 0
-//@ count  "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.generic_params[*]" 0
-//@ count  "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
-//@ is     "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
-//@ is     "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
+//@ ismany "$.index[?(@.name=='GenericFn')].inner.type_alias.generics.params[*].name" \"\'a\"
+//@ has    "$.index[?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime"
+//@ count  "$.index[?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime.outlives[*]" 0
+//@ count  "$.index[?(@.name=='GenericFn')].inner.type_alias.generics.where_predicates[*]" 0
+//@ count  "$.index[?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.generic_params[*]" 0
+//@ count  "$.index[?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
+//@ is     "$.index[?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
+//@ is     "$.index[?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
 
 pub type GenericFn<'a> = fn(&'a i32) -> &'a i32;
 
-//@ has    "$.index[*][?(@.name=='ForAll')].inner.type_alias"
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.generics.params[*]" 0
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.generics.where_predicates[*]" 0
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*]" 1
-//@ is    "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].name" \"\'a\"
-//@ has   "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime"
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime.outlives[*]" 0
-//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
-//@ is    "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
-//@ is    "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
+//@ has    "$.index[?(@.name=='ForAll')].inner.type_alias"
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.generics.params[*]" 0
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.generics.where_predicates[*]" 0
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*]" 1
+//@ is    "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].name" \"\'a\"
+//@ has   "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime"
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime.outlives[*]" 0
+//@ count "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
+//@ is    "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
+//@ is    "$.index[?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
 pub type ForAll = for<'a> fn(&'a i32) -> &'a i32;
diff --git a/tests/rustdoc-json/type/generic_default.rs b/tests/rustdoc-json/type/generic_default.rs
index 2d2ce9cd10332..26a232a1562b3 100644
--- a/tests/rustdoc-json/type/generic_default.rs
+++ b/tests/rustdoc-json/type/generic_default.rs
@@ -1,31 +1,31 @@
-//@ set result = "$.index[*][?(@.name=='Result')].id"
+//@ set result = "$.index[?(@.name=='Result')].id"
 pub enum Result<T, E> {
     Ok(T),
     Err(E),
 }
 
-//@ set my_error = "$.index[*][?(@.name=='MyError')].id"
+//@ set my_error = "$.index[?(@.name=='MyError')].id"
 pub struct MyError {}
 
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias"
-//@ count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.where_predicates[*]" 0
-//@ count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[*]" 2
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].name" \"T\"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].name" \"E\"
-//@ has   "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type"
-//@ has   "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type"
-//@ count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.bounds[*]" 0
-//@ count "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.bounds[*]" 0
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.default" null
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.id" $my_error
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.path" \"MyError\"
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.id" $result
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.path" \"Result\"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic"
-//@ has    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic" \"T\"
-//@ is    "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic" \"E\"
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias"
+//@ count "$.index[?(@.name=='MyResult')].inner.type_alias.generics.where_predicates[*]" 0
+//@ count "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[*]" 2
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[0].name" \"T\"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].name" \"E\"
+//@ has   "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type"
+//@ has   "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type"
+//@ count "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.bounds[*]" 0
+//@ count "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.bounds[*]" 0
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.default" null
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.id" $my_error
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.path" \"MyError\"
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.id" $result
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.path" \"Result\"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic"
+//@ has    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic" \"T\"
+//@ is    "$.index[?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic" \"E\"
 pub type MyResult<T, E = MyError> = Result<T, E>;
diff --git a/tests/rustdoc-json/type/hrtb.rs b/tests/rustdoc-json/type/hrtb.rs
index 08b35b90a2b10..68b7a556a69a2 100644
--- a/tests/rustdoc-json/type/hrtb.rs
+++ b/tests/rustdoc-json/type/hrtb.rs
@@ -1,5 +1,5 @@
-//@ is "$.index[*][?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.type" '{"generic": "F"}'
-//@ is "$.index[*][?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
+//@ is "$.index[?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.type" '{"generic": "F"}'
+//@ is "$.index[?(@.name=='genfn')].inner.function.generics.where_predicates[0].bound_predicate.generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
 pub fn genfn<F>(f: F)
 where
     for<'a, 'b> F: Fn(&'a i32, &'b i32),
@@ -8,12 +8,12 @@ where
     f(&zero, &zero);
 }
 
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.lifetime" null
-//@ count "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[*]" 1
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
-//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
+//@ is "$.index[?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
+//@ is "$.index[?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
+//@ is "$.index[?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.lifetime" null
+//@ count "$.index[?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[*]" 1
+//@ is "$.index[?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
+//@ is "$.index[?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
 pub fn dynfn(f: &dyn for<'a, 'b> Fn(&'a i32, &'b i32)) {
     let zero = 0;
     f(&zero, &zero);
diff --git a/tests/rustdoc-json/type/inherent_associated_type.rs b/tests/rustdoc-json/type/inherent_associated_type.rs
index e26f8f7c651bd..e96a92f7cfb4b 100644
--- a/tests/rustdoc-json/type/inherent_associated_type.rs
+++ b/tests/rustdoc-json/type/inherent_associated_type.rs
@@ -1,23 +1,23 @@
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
 
-//@ set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id'
+//@ set OwnerMetadata = '$.index[?(@.name=="OwnerMetadata")].id'
 pub struct OwnerMetadata;
-//@ set Owner = '$.index[*][?(@.name=="Owner")].id'
+//@ set Owner = '$.index[?(@.name=="Owner")].id'
 pub struct Owner;
 
 pub fn create() -> Owner::Metadata {
     OwnerMetadata
 }
-//@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.name' '"Metadata"'
-//@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.trait' null
-//@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.self_type.resolved_path.id' $Owner
+//@ is '$.index[?(@.name=="create")].inner.function.sig.output.qualified_path.name' '"Metadata"'
+//@ is '$.index[?(@.name=="create")].inner.function.sig.output.qualified_path.trait' null
+//@ is '$.index[?(@.name=="create")].inner.function.sig.output.qualified_path.self_type.resolved_path.id' $Owner
 
 /// impl
 impl Owner {
     /// iat
     pub type Metadata = OwnerMetadata;
 }
-//@ set iat = '$.index[*][?(@.docs=="iat")].id'
-//@ is '$.index[*][?(@.docs=="impl")].inner.impl.items[*]' $iat
-//@ is '$.index[*][?(@.docs=="iat")].inner.assoc_type.type.resolved_path.id' $OwnerMetadata
+//@ set iat = '$.index[?(@.docs=="iat")].id'
+//@ is '$.index[?(@.docs=="impl")].inner.impl.items[*]' $iat
+//@ is '$.index[?(@.docs=="iat")].inner.assoc_type.type.resolved_path.id' $OwnerMetadata
diff --git a/tests/rustdoc-json/type/inherent_associated_type_bound.rs b/tests/rustdoc-json/type/inherent_associated_type_bound.rs
index 22c9c9c1149a8..20354909f8ec2 100644
--- a/tests/rustdoc-json/type/inherent_associated_type_bound.rs
+++ b/tests/rustdoc-json/type/inherent_associated_type_bound.rs
@@ -1,17 +1,17 @@
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
 
-//@ set Carrier = '$.index[*][?(@.name=="Carrier")].id'
+//@ set Carrier = '$.index[?(@.name=="Carrier")].id'
 pub struct Carrier<'a>(&'a ());
 
-//@ count "$.index[*][?(@.name=='user')].inner.function.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='user')].inner.function.sig.inputs[0][0]" '"_"'
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.generic_params[*].name' \""'b"\"
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Carrier
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].lifetime' \""'b"\"
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.name' '"Focus"'
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.trait' null
-//@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.args.angle_bracketed.args[0].type.primitive' '"i32"'
+//@ count "$.index[?(@.name=='user')].inner.function.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='user')].inner.function.sig.inputs[0][0]" '"_"'
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.generic_params[*].name' \""'b"\"
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Carrier
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].lifetime' \""'b"\"
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.name' '"Focus"'
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.trait' null
+//@ is '$.index[?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.args.angle_bracketed.args[0].type.primitive' '"i32"'
 pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {}
 
 impl<'a> Carrier<'a> {
diff --git a/tests/rustdoc-json/type/inherent_associated_type_projections.rs b/tests/rustdoc-json/type/inherent_associated_type_projections.rs
index 501694dce8b6d..934daba11bb1f 100644
--- a/tests/rustdoc-json/type/inherent_associated_type_projections.rs
+++ b/tests/rustdoc-json/type/inherent_associated_type_projections.rs
@@ -1,15 +1,15 @@
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
 
-//@ set Parametrized = '$.index[*][?(@.name=="Parametrized")].id'
+//@ set Parametrized = '$.index[?(@.name=="Parametrized")].id'
 pub struct Parametrized<T>(T);
 
-//@ count "$.index[*][?(@.name=='test')].inner.function.sig.inputs[*]" 1
-//@ is "$.index[*][?(@.name=='test')].inner.function.sig.inputs[0][0]" '"_"'
-//@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Parametrized
-//@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].type.primitive' \"i32\"
-//@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.name' '"Proj"'
-//@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.trait' null
+//@ count "$.index[?(@.name=='test')].inner.function.sig.inputs[*]" 1
+//@ is "$.index[?(@.name=='test')].inner.function.sig.inputs[0][0]" '"_"'
+//@ is '$.index[?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Parametrized
+//@ is '$.index[?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].type.primitive' \"i32\"
+//@ is '$.index[?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.name' '"Proj"'
+//@ is '$.index[?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.trait' null
 pub fn test(_: Parametrized<i32>::Proj) {}
 
 /// param_bool
@@ -24,10 +24,10 @@ impl Parametrized<i32> {
     pub type Proj = String;
 }
 
-//@ set param_bool = '$.index[*][?(@.docs=="param_bool")].id'
-//@ set param_i32 = '$.index[*][?(@.docs=="param_i32")].id'
-//@ set param_bool_proj = '$.index[*][?(@.docs=="param_bool_proj")].id'
-//@ set param_i32_proj = '$.index[*][?(@.docs=="param_i32_proj")].id'
+//@ set param_bool = '$.index[?(@.docs=="param_bool")].id'
+//@ set param_i32 = '$.index[?(@.docs=="param_i32")].id'
+//@ set param_bool_proj = '$.index[?(@.docs=="param_bool_proj")].id'
+//@ set param_i32_proj = '$.index[?(@.docs=="param_i32_proj")].id'
 
-//@ is '$.index[*][?(@.docs=="param_bool")].inner.impl.items[*]' $param_bool_proj
-//@ is '$.index[*][?(@.docs=="param_i32")].inner.impl.items[*]' $param_i32_proj
+//@ is '$.index[?(@.docs=="param_bool")].inner.impl.items[*]' $param_bool_proj
+//@ is '$.index[?(@.docs=="param_i32")].inner.impl.items[*]' $param_i32_proj
diff --git a/tests/rustdoc-json/type_alias.rs b/tests/rustdoc-json/type_alias.rs
index 2f2b4c42d441d..7fd23a48040d1 100644
--- a/tests/rustdoc-json/type_alias.rs
+++ b/tests/rustdoc-json/type_alias.rs
@@ -1,15 +1,15 @@
-//@ set IntVec = "$.index[*][?(@.name=='IntVec')].id"
-//@ is "$.index[*][?(@.name=='IntVec')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='IntVec')].inner.type_alias"
-//@ is "$.index[*][?(@.name=='IntVec')].span.filename" $FILE
+//@ set IntVec = "$.index[?(@.name=='IntVec')].id"
+//@ is "$.index[?(@.name=='IntVec')].visibility" \"public\"
+//@ has "$.index[?(@.name=='IntVec')].inner.type_alias"
+//@ is "$.index[?(@.name=='IntVec')].span.filename" $FILE
 pub type IntVec = Vec<u32>;
 
-//@ is "$.index[*][?(@.name=='f')].inner.function.sig.output.resolved_path.id" $IntVec
+//@ is "$.index[?(@.name=='f')].inner.function.sig.output.resolved_path.id" $IntVec
 pub fn f() -> IntVec {
     vec![0; 32]
 }
 
-//@ !is "$.index[*][?(@.name=='g')].inner.function.sig.output.resolved_path.id" $IntVec
+//@ !is "$.index[?(@.name=='g')].inner.function.sig.output.resolved_path.id" $IntVec
 pub fn g() -> Vec<u32> {
     vec![0; 32]
 }
diff --git a/tests/rustdoc-json/unions/field_order.rs b/tests/rustdoc-json/unions/field_order.rs
index a1616f627513f..b3a07a13bc813 100644
--- a/tests/rustdoc-json/unions/field_order.rs
+++ b/tests/rustdoc-json/unions/field_order.rs
@@ -15,24 +15,24 @@ pub union Foo {
     pub vll_9: i32,
 }
 
-//@ set 0 = '$.index[*][?(@.name == "ews_0")].id'
-//@ set 1 = '$.index[*][?(@.name == "dik_1")].id'
-//@ set 2 = '$.index[*][?(@.name == "hsk_2")].id'
-//@ set 3 = '$.index[*][?(@.name == "djt_3")].id'
-//@ set 4 = '$.index[*][?(@.name == "jnr_4")].id'
-//@ set 5 = '$.index[*][?(@.name == "dfs_5")].id'
-//@ set 6 = '$.index[*][?(@.name == "bja_6")].id'
-//@ set 7 = '$.index[*][?(@.name == "lyc_7")].id'
-//@ set 8 = '$.index[*][?(@.name == "yqd_8")].id'
-//@ set 9 = '$.index[*][?(@.name == "vll_9")].id'
+//@ set 0 = '$.index[?(@.name == "ews_0")].id'
+//@ set 1 = '$.index[?(@.name == "dik_1")].id'
+//@ set 2 = '$.index[?(@.name == "hsk_2")].id'
+//@ set 3 = '$.index[?(@.name == "djt_3")].id'
+//@ set 4 = '$.index[?(@.name == "jnr_4")].id'
+//@ set 5 = '$.index[?(@.name == "dfs_5")].id'
+//@ set 6 = '$.index[?(@.name == "bja_6")].id'
+//@ set 7 = '$.index[?(@.name == "lyc_7")].id'
+//@ set 8 = '$.index[?(@.name == "yqd_8")].id'
+//@ set 9 = '$.index[?(@.name == "vll_9")].id'
 
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[0]' $0
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[1]' $1
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[2]' $2
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[3]' $3
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[4]' $4
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[5]' $5
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[6]' $6
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[7]' $7
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[8]' $8
-//@ is '$.index[*][?(@.name == "Foo")].inner.union.fields[9]' $9
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[0]' $0
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[1]' $1
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[2]' $2
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[3]' $3
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[4]' $4
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[5]' $5
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[6]' $6
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[7]' $7
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[8]' $8
+//@ is '$.index[?(@.name == "Foo")].inner.union.fields[9]' $9
diff --git a/tests/rustdoc-json/unions/impl.rs b/tests/rustdoc-json/unions/impl.rs
index 989a025f6690d..6f398cc23f68a 100644
--- a/tests/rustdoc-json/unions/impl.rs
+++ b/tests/rustdoc-json/unions/impl.rs
@@ -1,15 +1,15 @@
 #![no_std]
 
-//@ is "$.index[*][?(@.name=='Ux')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Ux')].inner.union"
+//@ is "$.index[?(@.name=='Ux')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Ux')].inner.union"
 pub union Ux {
     a: u32,
     b: u64,
 }
 
-//@ is "$.index[*][?(@.name=='Num')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Num')].inner.trait"
+//@ is "$.index[?(@.name=='Num')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Num')].inner.trait"
 pub trait Num {}
 
-//@ count "$.index[*][?(@.name=='Ux')].inner.union.impls" 1
+//@ count "$.index[?(@.name=='Ux')].inner.union.impls" 1
 impl Num for Ux {}
diff --git a/tests/rustdoc-json/unions/union.rs b/tests/rustdoc-json/unions/union.rs
index 7f135a72dec63..24ee47f195730 100644
--- a/tests/rustdoc-json/unions/union.rs
+++ b/tests/rustdoc-json/unions/union.rs
@@ -1,14 +1,14 @@
-//@ has "$.index[*][?(@.name=='Union')].visibility" \"public\"
-//@ has "$.index[*][?(@.name=='Union')].inner.union"
-//@ !has "$.index[*][?(@.name=='Union')].inner.union.struct_type"
-//@ set Union = "$.index[*][?(@.name=='Union')].id"
+//@ has "$.index[?(@.name=='Union')].visibility" \"public\"
+//@ has "$.index[?(@.name=='Union')].inner.union"
+//@ !has "$.index[?(@.name=='Union')].inner.union.struct_type"
+//@ set Union = "$.index[?(@.name=='Union')].id"
 pub union Union {
     int: i32,
     float: f32,
 }
 
-//@ has "$.index[*][?(@.name=='make_int_union')].inner.function.sig.output.resolved_path"
-//@ is "$.index[*][?(@.name=='make_int_union')].inner.function.sig.output.resolved_path.id" $Union
+//@ has "$.index[?(@.name=='make_int_union')].inner.function.sig.output.resolved_path"
+//@ is "$.index[?(@.name=='make_int_union')].inner.function.sig.output.resolved_path.id" $Union
 pub fn make_int_union(int: i32) -> Union {
     Union { int }
 }
diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs
index cffb41742b4e4..0a579a07cef16 100644
--- a/tests/ui-fulldeps/stable-mir/smir_visitor.rs
+++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs
@@ -18,6 +18,7 @@ extern crate stable_mir;
 
 use rustc_smir::rustc_internal;
 use stable_mir::mir::MirVisitor;
+use stable_mir::mir::MutMirVisitor;
 use stable_mir::*;
 use std::collections::HashSet;
 use std::io::Write;
@@ -99,6 +100,83 @@ impl<'a> mir::MirVisitor for TestVisitor<'a> {
     }
 }
 
+fn test_mut_visitor() -> ControlFlow<()> {
+    let main_fn = stable_mir::entry_fn();
+    let mut main_body = main_fn.unwrap().expect_body();
+    let locals = main_body.locals().to_vec();
+    let mut main_visitor = TestMutVisitor::collect(locals);
+    main_visitor.visit_body(&mut main_body);
+    assert!(main_visitor.ret_val.is_some());
+    assert!(main_visitor.args.is_empty());
+    assert!(main_visitor.tys.contains(&main_visitor.ret_val.unwrap().ty));
+    assert!(!main_visitor.calls.is_empty());
+
+    let exit_fn = main_visitor.calls.last().unwrap();
+    assert!(exit_fn.mangled_name().contains("exit_fn"), "Unexpected last function: {exit_fn:?}");
+
+    let mut exit_body = exit_fn.body().unwrap();
+    let locals = exit_body.locals().to_vec();
+    let mut exit_visitor = TestMutVisitor::collect(locals);
+    exit_visitor.visit_body(&mut exit_body);
+    assert!(exit_visitor.ret_val.is_some());
+    assert_eq!(exit_visitor.args.len(), 1);
+    assert!(exit_visitor.tys.contains(&exit_visitor.ret_val.unwrap().ty));
+    assert!(exit_visitor.tys.contains(&exit_visitor.args[0].ty));
+    ControlFlow::Continue(())
+}
+
+struct TestMutVisitor {
+    locals: Vec<mir::LocalDecl>,
+    pub tys: HashSet<ty::Ty>,
+    pub ret_val: Option<mir::LocalDecl>,
+    pub args: Vec<mir::LocalDecl>,
+    pub calls: Vec<mir::mono::Instance>,
+}
+
+impl TestMutVisitor {
+    fn collect(locals: Vec<mir::LocalDecl>) -> TestMutVisitor {
+        let visitor = TestMutVisitor {
+            locals: locals,
+            tys: Default::default(),
+            ret_val: None,
+            args: vec![],
+            calls: vec![],
+        };
+        visitor
+    }
+}
+
+impl mir::MutMirVisitor for TestMutVisitor {
+    fn visit_ty(&mut self, ty: &mut ty::Ty, _location: mir::visit::Location) {
+        self.tys.insert(*ty);
+        self.super_ty(ty)
+    }
+
+    fn visit_ret_decl(&mut self, local: mir::Local, decl: &mut mir::LocalDecl) {
+        assert!(local == mir::RETURN_LOCAL);
+        assert!(self.ret_val.is_none());
+        self.ret_val = Some(decl.clone());
+        self.super_ret_decl(local, decl);
+    }
+
+    fn visit_arg_decl(&mut self, local: mir::Local, decl: &mut mir::LocalDecl) {
+        self.args.push(decl.clone());
+        assert_eq!(local, self.args.len());
+        self.super_arg_decl(local, decl);
+    }
+
+    fn visit_terminator(&mut self, term: &mut mir::Terminator, location: mir::visit::Location) {
+        if let mir::TerminatorKind::Call { func, .. } = &mut term.kind {
+            let ty::TyKind::RigidTy(ty) = func.ty(&self.locals).unwrap().kind() else {
+                unreachable!()
+            };
+            let ty::RigidTy::FnDef(def, args) = ty else { unreachable!() };
+            self.calls.push(mir::mono::Instance::resolve(def, &args).unwrap());
+        }
+        self.super_terminator(term, location);
+    }
+}
+
 /// This test will generate and analyze a dummy crate using the stable mir.
 /// For that, it will first write the dummy crate into a file.
 /// Then it will create a `StableMir` using custom arguments and then
@@ -113,7 +191,8 @@ fn main() {
         CRATE_NAME.to_string(),
         path.to_string(),
     ];
-    run!(args, test_visitor).unwrap();
+    run!(args.clone(), test_visitor).unwrap();
+    run!(args, test_mut_visitor).unwrap();
 }
 
 fn generate_input(path: &str) -> std::io::Result<()> {