Skip to content

Commit b4b23aa

Browse files
committed
fns/ is done
1 parent 06a4150 commit b4b23aa

File tree

10 files changed

+71
-110
lines changed

10 files changed

+71
-110
lines changed

tests/rustdoc-json/fns/abi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#![feature(rust_cold_cc)]
22

3-
//@ is "$.index[?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
3+
//@ jq .index[] | select(.name == "abi_rust").inner.function.header?.abi == "Rust"
44
pub fn abi_rust() {}
55

6-
//@ is "$.index[?(@.name=='abi_c')].inner.function.header.abi" '{"C": {"unwind": false}}'
6+
//@ jq .index[] | select(.name == "abi_c").inner.function.header?.abi == {"C": {"unwind": false}}
77
pub extern "C" fn abi_c() {}
88

9-
//@ is "$.index[?(@.name=='abi_system')].inner.function.header.abi" '{"System": {"unwind": false}}'
9+
//@ jq .index[] | select(.name == "abi_system").inner.function.header?.abi == {"System": {"unwind": false}}
1010
pub extern "system" fn abi_system() {}
1111

12-
//@ is "$.index[?(@.name=='abi_c_unwind')].inner.function.header.abi" '{"C": {"unwind": true}}'
12+
//@ jq .index[] | select(.name == "abi_c_unwind").inner.function.header?.abi == {"C": {"unwind": true}}
1313
pub extern "C-unwind" fn abi_c_unwind() {}
1414

15-
//@ is "$.index[?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
15+
//@ jq .index[] | select(.name == "abi_system_unwind").inner.function.header?.abi == {"System": {"unwind": true}}
1616
pub extern "system-unwind" fn abi_system_unwind() {}
1717

18-
//@ is "$.index[?(@.name=='abi_rust_cold')].inner.function.header.abi.Other" '"\"rust-cold\""'
18+
//@ jq .index[] | select(.name == "abi_rust_cold").inner.function.header?.abi.Other == "\"rust-cold\""
1919
pub extern "rust-cold" fn abi_rust_cold() {}

tests/rustdoc-json/fns/async_return.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44

55
use std::future::Future;
66

7-
//@ is "$.index[?(@.name=='get_int')].inner.function.sig.output.primitive" \"i32\"
8-
//@ is "$.index[?(@.name=='get_int')].inner.function.header.is_async" false
7+
//@ jq .index[] | select(.name == "get_int").inner.function | .sig?.output.primitive == "i32" and .header?.is_async == false
98
pub fn get_int() -> i32 {
109
42
1110
}
1211

13-
//@ is "$.index[?(@.name=='get_int_async')].inner.function.sig.output.primitive" \"i32\"
14-
//@ is "$.index[?(@.name=='get_int_async')].inner.function.header.is_async" true
12+
//@ jq .index[] | select(.name == "get_int_async").inner.function | .sig?.output.primitive == "i32" and .header?.is_async == true
1513
pub async fn get_int_async() -> i32 {
1614
42
1715
}
1816

19-
//@ is "$.index[?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
20-
//@ is "$.index[?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
21-
//@ 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\"
22-
//@ is "$.index[?(@.name=='get_int_future')].inner.function.header.is_async" false
17+
//@ arg get_int_future .index[] | select(.name == "get_int_future").inner.function
18+
//@ jq $get_int_future.sig?.output.impl_trait[]?.trait_bound.trait?.path == "Future"
19+
//@ jq $get_int_future.sig?.output.impl_trait[]?.trait_bound.trait?.args.angle_bracketed?.constraints?[].name == "Output"
20+
//@ jq $get_int_future.sig?.output.impl_trait[]?.trait_bound.trait?.args.angle_bracketed?.constraints?[].binding.equality.type?.primitive == "i32"
21+
//@ jq $get_int_future.header?.is_async == false
2322
pub fn get_int_future() -> impl Future<Output = i32> {
2423
async { 42 }
2524
}
2625

27-
//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
28-
//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
29-
//@ 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\"
30-
//@ is "$.index[?(@.name=='get_int_future_async')].inner.function.header.is_async" true
26+
//@ arg get_int_future_async .index[] | select(.name == "get_int_future_async").inner.function
27+
//@ jq $get_int_future_async.sig?.output.impl_trait[]?.trait_bound.trait?.path == "Future"
28+
//@ jq $get_int_future_async.sig?.output.impl_trait[]?.trait_bound.trait?.args.angle_bracketed?.constraints?[].name == "Output"
29+
//@ jq $get_int_future_async.sig?.output.impl_trait[]?.trait_bound.trait?.args.angle_bracketed?.constraints?[].binding.equality.type?.primitive == "i32"
30+
//@ jq $get_int_future_async.header?.is_async == true
3131
pub async fn get_int_future_async() -> impl Future<Output = i32> {
3232
async { 42 }
3333
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extern "C" {
2-
//@ is "$.index[?(@.name == 'not_variadic')].inner.function.sig.is_c_variadic" false
2+
//@ jq .index[] | select(.name == "not_variadic").inner.function.sig?.is_c_variadic == false
33
pub fn not_variadic(_: i32);
4-
//@ is "$.index[?(@.name == 'variadic')].inner.function.sig.is_c_variadic" true
4+
//@ jq .index[] | select(.name == "variadic").inner.function.sig?.is_c_variadic == true
55
pub fn variadic(_: i32, ...);
66
}

tests/rustdoc-json/fns/extern_safe.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
extern "C" {
2-
//@ is "$.index[?(@.name=='f1')].inner.function.header.is_unsafe" true
2+
//@ jq .index[] | select(.name == "f1").inner.function.header?.is_unsafe == true
33
pub fn f1();
44

55
// items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers
66
}
77

88
unsafe extern "C" {
9-
//@ is "$.index[?(@.name=='f4')].inner.function.header.is_unsafe" true
9+
//@ jq .index[] | select(.name == "f4").inner.function.header?.is_unsafe == true
1010
pub fn f4();
1111

12-
//@ is "$.index[?(@.name=='f5')].inner.function.header.is_unsafe" true
12+
//@ jq .index[] | select(.name == "f5").inner.function.header?.is_unsafe == true
1313
pub unsafe fn f5();
1414

15-
//@ is "$.index[?(@.name=='f6')].inner.function.header.is_unsafe" false
15+
//@ jq .index[] | select(.name == "f6").inner.function.header?.is_unsafe == false
1616
pub safe fn f6();
1717
}

tests/rustdoc-json/fns/generic_args.rs

Lines changed: 23 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,37 @@
1-
//@ set foo = "$.index[?(@.name=='Foo')].id"
1+
//@ arg foo .index[] | select(.name == "Foo").id
22
pub trait Foo {}
33

4-
//@ set generic_foo = "$.index[?(@.name=='GenericFoo')].id"
4+
//@ arg generic_foo .index[] | select(.name == "GenericFoo").id
55
pub trait GenericFoo<'a> {}
66

7-
//@ is "$.index[?(@.name=='generics')].inner.function.generics.where_predicates" "[]"
8-
//@ count "$.index[?(@.name=='generics')].inner.function.generics.params[*]" 1
9-
//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].name" '"F"'
10-
//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.default" 'null'
11-
//@ count "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[*]" 1
12-
//@ is "$.index[?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" '$foo'
13-
//@ count "$.index[?(@.name=='generics')].inner.function.sig.inputs[*]" 1
14-
//@ is "$.index[?(@.name=='generics')].inner.function.sig.inputs[0][0]" '"f"'
15-
//@ is "$.index[?(@.name=='generics')].inner.function.sig.inputs[0][1].generic" '"F"'
7+
//@ arg generics .index[] | select(.name == "generics").inner.function
8+
//@ jq $generics.generics?.where_predicates == []
9+
//@ jq $generics.generics?.params[] | .name == "F" and .kind.type.default? == null and .kind.type.bounds?[].trait_bound.trait?.id == $foo
10+
//@ jq $generics.sig?.inputs[] | .[0] == "f" and .[1].generic == "F"
1611
pub fn generics<F: Foo>(f: F) {}
1712

18-
//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.where_predicates" "[]"
19-
//@ count "$.index[?(@.name=='impl_trait')].inner.function.generics.params[*]" 1
20-
//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.params[0].name" '"impl Foo"'
21-
//@ is "$.index[?(@.name=='impl_trait')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $foo
22-
//@ count "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[*]" 1
23-
//@ is "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][0]" '"f"'
24-
//@ count "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[*]" 1
25-
//@ is "$.index[?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $foo
13+
//@ arg impl_trait .index[] | select(.name == "impl_trait").inner.function
14+
//@ jq $impl_trait.generics?.where_predicates == []
15+
//@ jq $impl_trait.generics?.params[] | .name == "impl Foo" and .kind.type.bounds?[].trait_bound.trait?.id == $foo
16+
//@ jq $impl_trait.sig?.inputs[] | .[0] == "f" and .[1].impl_trait[]?.trait_bound.trait?.id == $foo
2617
pub fn impl_trait(f: impl Foo) {}
2718

28-
//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.params[*]" 3
29-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.params[0].name" '"F"'
30-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "is_synthetic": false}}'
31-
//@ count "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[*]" 3
32-
//@ is "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[0][0]" '"f"'
33-
//@ is "$.index[?(@.name=='where_clase')].inner.function.sig.inputs[0][1].generic" '"F"'
34-
//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[*]" 3
19+
//@ arg where_clase .index[] | select(.name == "where_clase").inner.function
20+
//@ jq $where_clase.generics?.params | length == 3
21+
//@ jq $where_clase.generics?.params[0] | .name == "F" and .kind == {"type": {"bounds": [], "default": null, "is_synthetic": false}}
22+
//@ jq $where_clase.sig?.inputs | length == 3
23+
//@ jq $where_clase.sig?.inputs[0] | .[0] == "f" and .[1].generic == "F"
24+
//@ jq $where_clase.generics?.where_predicates | length == 3
3525

36-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.type.generic" \"F\"
37-
//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]" 1
38-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].trait_bound.trait.id" $foo
26+
//@ jq $where_clase.generics?.where_predicates[0].bound_predicate | .type?.generic == "F" and .bounds?[].trait_bound.trait?.id == $foo
3927

40-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.type.generic" \"G\"
41-
//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[*]" 1
42-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.trait.id" $generic_foo
43-
//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[*]" 1
44-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].name" \"\'a\"
45-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].kind.lifetime.outlives" "[]"
46-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[1].bound_predicate.generic_params" "[]"
28+
//@ jq $where_clase.generics?.where_predicates[1].bound_predicate | .type?.generic == "G" and .generic_params? == []
29+
//@ jq $where_clase.generics?.where_predicates[1].bound_predicate.bounds?[].trait_bound.trait?.id == $generic_foo
30+
//@ jq $where_clase.generics?.where_predicates[1].bound_predicate.bounds?[].trait_bound.generic_params?[] | .name == "'a" and .kind.lifetime.outlives? == []
4731

48-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.lifetime" \"\'b\"
49-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.type.borrowed_ref.type.generic" \"H\"
50-
//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[*]" 1
51-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.trait.id" $foo
52-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.generic_params" "[]"
53-
//@ count "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[*]" 1
54-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].name" \"\'b\"
55-
//@ is "$.index[?(@.name=='where_clase')].inner.function.generics.where_predicates[2].bound_predicate.generic_params[0].kind.lifetime.outlives" "[]"
32+
//@ jq $where_clase.generics?.where_predicates[2].bound_predicate.type?.borrowed_ref | .lifetime? == "'b" and .type?.generic == "H"
33+
//@ jq $where_clase.generics?.where_predicates[2].bound_predicate.bounds?[].trait_bound | .trait?.id == $foo and .generic_params? == []
34+
//@ jq $where_clase.generics?.where_predicates[2].bound_predicate.generic_params?[] | .name == "'b" and .kind.lifetime.outlives? == []
5635
pub fn where_clase<F, G, H>(f: F, g: G, h: H)
5736
where
5837
F: Foo,

tests/rustdoc-json/fns/generic_returns.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
//@ count "$.index[?(@.name=='generic_returns')].inner.module.items[*]" 2
1+
//@ jq .index["\(.root)"].inner.module.items? | length == 2
22

3-
//@ set foo = "$.index[?(@.name=='Foo')].id"
3+
//@ arg foo .index[] | select(.name == "Foo").id
44
pub trait Foo {}
55

6-
//@ is "$.index[?(@.name=='get_foo')].inner.function.sig.inputs" []
7-
//@ count "$.index[?(@.name=='get_foo')].inner.function.sig.output.impl_trait[*]" 1
8-
//@ is "$.index[?(@.name=='get_foo')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $foo
6+
//@ arg get_foo .index[] | select(.name == "get_foo").inner.function.sig
7+
//@ jq $get_foo.inputs? == []
8+
//@ jq $get_foo.output?.impl_trait[]?.trait_bound.trait?.id == $foo
99
pub fn get_foo() -> impl Foo {
1010
Fooer {}
1111
}

tests/rustdoc-json/fns/generics.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
//@ set wham_id = "$.index[?(@.name=='Wham')].id"
1+
//@ arg wham_id .index[] | select(.name == "Wham").id
22
pub trait Wham {}
33

4-
//@ is "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.where_predicates" []
5-
//@ count "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[*]" 1
6-
//@ is "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].name" '"T"'
7-
//@ is "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" false
8-
//@ is "$.index[?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
9-
//@ is "$.index[?(@.name=='one_generic_param_fn')].inner.function.sig.inputs" '[["w", {"generic": "T"}]]'
4+
//@ arg one_generic_param_fn .index[] | select(.name == "one_generic_param_fn").inner.function
5+
//@ jq $one_generic_param_fn.generics? | .where_predicates == [] and .params[].name == "T"
6+
//@ jq $one_generic_param_fn.generics?.params[].kind.type | .is_synthetic? == false and .bounds?[].trait_bound.trait?.id == $wham_id
7+
//@ jq $one_generic_param_fn.sig?.inputs == [["w", {"generic": "T"}]]
108
pub fn one_generic_param_fn<T: Wham>(w: T) {}
119

12-
//@ is "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.where_predicates" []
13-
//@ count "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[*]" 1
14-
//@ is "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].name" '"impl Wham"'
15-
//@ is "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" true
16-
//@ is "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
17-
//@ count "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[*]" 1
18-
//@ is "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][0]" '"w"'
19-
//@ is "$.index[?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $wham_id
10+
//@ arg one_synthetic_generic_param_fn .index[] | select(.name == "one_synthetic_generic_param_fn").inner.function
11+
//@ jq $one_synthetic_generic_param_fn.generics? | .where_predicates == [] and .params[].name == "impl Wham"
12+
//@ jq $one_synthetic_generic_param_fn.generics?.params[].kind.type | .is_synthetic? == true and .bounds?[].trait_bound.trait?.id == $wham_id
13+
//@ jq $one_synthetic_generic_param_fn.sig?.inputs[] | .[0] == "w" and .[1].impl_trait[]?.trait_bound.trait?.id == $wham_id
2014
pub fn one_synthetic_generic_param_fn(w: impl Wham) {}

tests/rustdoc-json/fns/pattern_arg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//@ is "$.index[?(@.name=='fst')].inner.function.sig.inputs[0][0]" '"(x, _)"'
1+
//@ jq .index[] | select(.name == "fst").inner.function.sig?.inputs[][0] == "(x, _)"
22
pub fn fst<X, Y>((x, _): (X, Y)) -> X {
33
x
44
}
55

6-
//@ is "$.index[?(@.name=='drop_int')].inner.function.sig.inputs[0][0]" '"_"'
6+
//@ jq .index[] | select(.name == "drop_int").inner.function.sig?.inputs[][0] == "_"
77
pub fn drop_int(_: i32) {}

tests/rustdoc-json/fns/qualifiers.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
//@ edition:2018
22

3-
//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_async" false
4-
//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_const" false
5-
//@ is "$.index[?(@.name=='nothing_fn')].inner.function.header.is_unsafe" false
3+
//@ jq .index[] | select(.name == "nothing_fn").inner.function.header? | [.is_async, .is_const, .is_unsafe] == [false, false, false]
64
pub fn nothing_fn() {}
75

8-
//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_async" false
9-
//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_const" false
10-
//@ is "$.index[?(@.name=='unsafe_fn')].inner.function.header.is_unsafe" true
6+
//@ jq .index[] | select(.name == "unsafe_fn").inner.function.header? | [.is_async, .is_const, .is_unsafe] == [false, false, true]
117
pub unsafe fn unsafe_fn() {}
128

13-
//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_async" false
14-
//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_const" true
15-
//@ is "$.index[?(@.name=='const_fn')].inner.function.header.is_unsafe" false
9+
//@ jq .index[] | select(.name == "const_fn").inner.function.header? | [.is_async, .is_const, .is_unsafe] == [false, true, false]
1610
pub const fn const_fn() {}
1711

18-
//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_async" true
19-
//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_const" false
20-
//@ is "$.index[?(@.name=='async_fn')].inner.function.header.is_unsafe" false
12+
//@ jq .index[] | select(.name == "async_fn").inner.function.header? | [.is_async, .is_const, .is_unsafe] == [true, false, false]
2113
pub async fn async_fn() {}
2214

23-
//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_async" true
24-
//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_const" false
25-
//@ is "$.index[?(@.name=='async_unsafe_fn')].inner.function.header.is_unsafe" true
15+
//@ jq .index[] | select(.name == "async_unsafe_fn").inner.function.header? | [.is_async, .is_const, .is_unsafe] == [true, false, true]
2616
pub async unsafe fn async_unsafe_fn() {}
2717

28-
//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_async" false
29-
//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_const" true
30-
//@ is "$.index[?(@.name=='const_unsafe_fn')].inner.function.header.is_unsafe" true
18+
//@ jq .index[] | select(.name == "const_unsafe_fn").inner.function.header? | [.is_async, .is_const, .is_unsafe] == [false, true, true]
3119
pub const unsafe fn const_unsafe_fn() {}
3220

3321
// It's impossible for a function to be both const and async, so no test for that
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Regression test for <https://github.com/rust-lang/rust/issues/104851>
22

3-
//@ set foo = "$.index[?(@.name=='Foo')].id"
3+
//@ arg foo .index[] | select(.name == "Foo").id
44
pub type Foo = i32;
55

6-
//@ is "$.index[?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo
6+
//@ jq .index[] | select(.name == "demo").inner.function.sig?.output.resolved_path?.id == $foo
77
pub fn demo() -> Foo {
88
42
99
}

0 commit comments

Comments
 (0)