Skip to content

Commit 7e3e8a8

Browse files
committed
Auto merge of rust-lang#100678 - GuillaumeGomez:improve-rustdoc-json-tests, r=aDotInTheVoid
Improve rustdoc json tests Fixes rust-lang#100588. r? `@aDotInTheVoid`
2 parents 8818b00 + d3d9e22 commit 7e3e8a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+605
-674
lines changed

Diff for: src/test/rustdoc-json/assoc_items.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
#![no_std]
22

3-
// @has assoc_items.json
4-
53
pub struct Simple;
64

75
impl Simple {
8-
// @has - "$.index[*][?(@.name=='CONSTANT')].kind" \"assoc_const\"
6+
// @has "$.index[*][?(@.name=='CONSTANT')].kind" \"assoc_const\"
97
pub const CONSTANT: usize = 0;
108
}
119

1210
pub trait EasyToImpl {
13-
// @has - "$.index[*][?(@.name=='ToDeclare')].kind" \"assoc_type\"
14-
// @has - "$.index[*][?(@.name=='ToDeclare')].inner.default" null
11+
// @has "$.index[*][?(@.name=='ToDeclare')].kind" \"assoc_type\"
12+
// @has "$.index[*][?(@.name=='ToDeclare')].inner.default" null
1513
type ToDeclare;
16-
// @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].kind" \"assoc_const\"
17-
// @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.default" null
14+
// @has "$.index[*][?(@.name=='AN_ATTRIBUTE')].kind" \"assoc_const\"
15+
// @has "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.default" null
1816
const AN_ATTRIBUTE: usize;
1917
}
2018

2119
impl EasyToImpl for Simple {
22-
// @has - "$.index[*][?(@.name=='ToDeclare')].inner.default.kind" \"primitive\"
23-
// @has - "$.index[*][?(@.name=='ToDeclare')].inner.default.inner" \"usize\"
20+
// @has "$.index[*][?(@.name=='ToDeclare')].inner.default.kind" \"primitive\"
21+
// @has "$.index[*][?(@.name=='ToDeclare')].inner.default.inner" \"usize\"
2422
type ToDeclare = usize;
25-
// @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.type.kind" \"primitive\"
26-
// @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.type.inner" \"usize\"
27-
// @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.default" \"12\"
23+
// @has "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.type.kind" \"primitive\"
24+
// @has "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.type.inner" \"usize\"
25+
// @has "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.default" \"12\"
2826
const AN_ATTRIBUTE: usize = 12;
2927
}

Diff for: src/test/rustdoc-json/assoc_type.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Regression test for <https://github.com/rust-lang/rust/issues/98547>.
22

3-
// @has assoc_type.json
4-
// @has - "$.index[*][?(@.name=='Trait')]"
5-
// @has - "$.index[*][?(@.name=='AssocType')]"
6-
// @has - "$.index[*][?(@.name=='S')]"
7-
// @has - "$.index[*][?(@.name=='S2')]"
3+
// @has "$.index[*][?(@.name=='Trait')]"
4+
// @has "$.index[*][?(@.name=='AssocType')]"
5+
// @has "$.index[*][?(@.name=='S')]"
6+
// @has "$.index[*][?(@.name=='S2')]"
87

98
pub trait Trait {
109
type AssocType;

Diff for: src/test/rustdoc-json/blanket_impls.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#![no_std]
44

5-
// @has blanket_impls.json
6-
// @has - "$.index[*][?(@.name=='Error')].kind" \"assoc_type\"
7-
// @has - "$.index[*][?(@.name=='Error')].inner.default.kind" \"resolved_path\"
8-
// @has - "$.index[*][?(@.name=='Error')].inner.default.inner.name" \"Infallible\"
5+
// @has "$.index[*][?(@.name=='Error')].kind" \"assoc_type\"
6+
// @has "$.index[*][?(@.name=='Error')].inner.default.kind" \"resolved_path\"
7+
// @has "$.index[*][?(@.name=='Error')].inner.default.inner.name" \"Infallible\"
98
pub struct ForBlanketTryFromImpl;

Diff for: src/test/rustdoc-json/doc_hidden_failure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mod auto {
1414
}
1515
}
1616

17-
// @count doc_hidden_failure.json "$.index[*][?(@.name=='builders')]" 2
17+
// @count "$.index[*][?(@.name=='builders')]" 2
1818
pub use auto::*;
1919

2020
pub mod builders {

Diff for: src/test/rustdoc-json/enum_variant_hidden.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#![no_core]
44
#![feature(no_core)]
55

6-
// @has enum_variant_hidden.json "$.index[*][?(@.name=='ParseError')]"
7-
// @has - "$.index[*][?(@.name=='UnexpectedEndTag')]"
8-
// @is - "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_kind" '"tuple"'
9-
// @is - "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_inner" []
6+
// @has "$.index[*][?(@.name=='ParseError')]"
7+
// @has "$.index[*][?(@.name=='UnexpectedEndTag')]"
8+
// @is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_kind" '"tuple"'
9+
// @is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_inner" []
1010

1111
pub enum ParseError {
1212
UnexpectedEndTag(#[doc(hidden)] u32),

Diff for: src/test/rustdoc-json/enums/variant_struct.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// @has variant_struct.json "$.index[*][?(@.name=='EnumStruct')].visibility" \"public\"
2-
// @has - "$.index[*][?(@.name=='EnumStruct')].kind" \"enum\"
1+
// @has "$.index[*][?(@.name=='EnumStruct')].visibility" \"public\"
2+
// @has "$.index[*][?(@.name=='EnumStruct')].kind" \"enum\"
33
pub enum EnumStruct {
4-
// @has - "$.index[*][?(@.name=='VariantS')].inner.variant_kind" \"struct\"
5-
// @has - "$.index[*][?(@.name=='x')].kind" \"struct_field\"
6-
// @has - "$.index[*][?(@.name=='y')].kind" \"struct_field\"
4+
// @has "$.index[*][?(@.name=='VariantS')].inner.variant_kind" \"struct\"
5+
// @has "$.index[*][?(@.name=='x')].kind" \"struct_field\"
6+
// @has "$.index[*][?(@.name=='y')].kind" \"struct_field\"
77
VariantS {
88
x: u32,
99
y: String,

Diff for: src/test/rustdoc-json/enums/variant_tuple_struct.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// @has variant_tuple_struct.json "$.index[*][?(@.name=='EnumTupleStruct')].visibility" \"public\"
2-
// @has - "$.index[*][?(@.name=='EnumTupleStruct')].kind" \"enum\"
1+
// @has "$.index[*][?(@.name=='EnumTupleStruct')].visibility" \"public\"
2+
// @has "$.index[*][?(@.name=='EnumTupleStruct')].kind" \"enum\"
33
pub enum EnumTupleStruct {
4-
// @has - "$.index[*][?(@.name=='VariantA')].inner.variant_kind" \"tuple\"
5-
// @has - "$.index[*][?(@.name=='0')].kind" \"struct_field\"
6-
// @has - "$.index[*][?(@.name=='1')].kind" \"struct_field\"
4+
// @has "$.index[*][?(@.name=='VariantA')].inner.variant_kind" \"tuple\"
5+
// @has "$.index[*][?(@.name=='0')].kind" \"struct_field\"
6+
// @has "$.index[*][?(@.name=='1')].kind" \"struct_field\"
77
VariantA(u32, String),
88
}

Diff for: src/test/rustdoc-json/fn_pointer/abi.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
#![feature(abi_vectorcall)]
44
#![feature(c_unwind)]
55

6-
// @is abi.json "$.index[*][?(@.name=='AbiRust')].inner.type.inner.header.abi" \"Rust\"
6+
// @is "$.index[*][?(@.name=='AbiRust')].inner.type.inner.header.abi" \"Rust\"
77
pub type AbiRust = fn();
88

9-
// @is - "$.index[*][?(@.name=='AbiC')].inner.type.inner.header.abi" '{"C": {"unwind": false}}'
9+
// @is "$.index[*][?(@.name=='AbiC')].inner.type.inner.header.abi" '{"C": {"unwind": false}}'
1010
pub type AbiC = extern "C" fn();
1111

12-
// @is - "$.index[*][?(@.name=='AbiSystem')].inner.type.inner.header.abi" '{"System": {"unwind": false}}'
12+
// @is "$.index[*][?(@.name=='AbiSystem')].inner.type.inner.header.abi" '{"System": {"unwind": false}}'
1313
pub type AbiSystem = extern "system" fn();
1414

15-
// @is - "$.index[*][?(@.name=='AbiCUnwind')].inner.type.inner.header.abi" '{"C": {"unwind": true}}'
15+
// @is "$.index[*][?(@.name=='AbiCUnwind')].inner.type.inner.header.abi" '{"C": {"unwind": true}}'
1616
pub type AbiCUnwind = extern "C-unwind" fn();
1717

18-
// @is - "$.index[*][?(@.name=='AbiSystemUnwind')].inner.type.inner.header.abi" '{"System": {"unwind": true}}'
18+
// @is "$.index[*][?(@.name=='AbiSystemUnwind')].inner.type.inner.header.abi" '{"System": {"unwind": true}}'
1919
pub type AbiSystemUnwind = extern "system-unwind" fn();
2020

21-
// @is - "$.index[*][?(@.name=='AbiVecorcall')].inner.type.inner.header.abi.Other" '"\"vectorcall\""'
21+
// @is "$.index[*][?(@.name=='AbiVecorcall')].inner.type.inner.header.abi.Other" '"\"vectorcall\""'
2222
pub type AbiVecorcall = extern "vectorcall" fn();
2323

24-
// @is - "$.index[*][?(@.name=='AbiVecorcallUnwind')].inner.type.inner.header.abi.Other" '"\"vectorcall-unwind\""'
24+
// @is "$.index[*][?(@.name=='AbiVecorcallUnwind')].inner.type.inner.header.abi.Other" '"\"vectorcall-unwind\""'
2525
pub type AbiVecorcallUnwind = extern "vectorcall-unwind" fn();

Diff for: src/test/rustdoc-json/fn_pointer/generics.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#![feature(no_core)]
44
#![no_core]
55

6-
// @count generics.json "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[*]" 1
7-
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][0]" '"val"'
8-
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][1].kind" '"borrowed_ref"'
9-
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][1].inner.lifetime" \"\'c\"
10-
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.output" '{ "kind": "primitive", "inner": "i32" }'
11-
// @count - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[*]" 1
12-
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[0].name" \"\'c\"
13-
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
6+
// @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[*]" 1
7+
// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][0]" '"val"'
8+
// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][1].kind" '"borrowed_ref"'
9+
// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][1].inner.lifetime" \"\'c\"
10+
// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.output" '{ "kind": "primitive", "inner": "i32" }'
11+
// @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[*]" 1
12+
// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[0].name" \"\'c\"
13+
// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
1414
pub type WithHigherRankTraitBounds = for<'c> fn(val: &'c i32) -> i32;

Diff for: src/test/rustdoc-json/fn_pointer/qualifiers.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// @is qualifiers.json "$.index[*][?(@.name=='FnPointer')].inner.type.inner.header.unsafe" false
2-
// @is - "$.index[*][?(@.name=='FnPointer')].inner.type.inner.header.const" false
3-
// @is - "$.index[*][?(@.name=='FnPointer')].inner.type.inner.header.async" false
1+
// @is "$.index[*][?(@.name=='FnPointer')].inner.type.inner.header.unsafe" false
2+
// @is "$.index[*][?(@.name=='FnPointer')].inner.type.inner.header.const" false
3+
// @is "$.index[*][?(@.name=='FnPointer')].inner.type.inner.header.async" false
44
pub type FnPointer = fn();
55

6-
// @is - "$.index[*][?(@.name=='UnsafePointer')].inner.type.inner.header.unsafe" true
7-
// @is - "$.index[*][?(@.name=='UnsafePointer')].inner.type.inner.header.const" false
8-
// @is - "$.index[*][?(@.name=='UnsafePointer')].inner.type.inner.header.async" false
6+
// @is "$.index[*][?(@.name=='UnsafePointer')].inner.type.inner.header.unsafe" true
7+
// @is "$.index[*][?(@.name=='UnsafePointer')].inner.type.inner.header.const" false
8+
// @is "$.index[*][?(@.name=='UnsafePointer')].inner.type.inner.header.async" false
99
pub type UnsafePointer = unsafe fn();

Diff for: src/test/rustdoc-json/fns/abi.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
#![feature(abi_vectorcall)]
44
#![feature(c_unwind)]
55

6-
// @is abi.json "$.index[*][?(@.name=='abi_rust')].inner.header.abi" \"Rust\"
6+
// @is "$.index[*][?(@.name=='abi_rust')].inner.header.abi" \"Rust\"
77
pub fn abi_rust() {}
88

9-
// @is - "$.index[*][?(@.name=='abi_c')].inner.header.abi" '{"C": {"unwind": false}}'
9+
// @is "$.index[*][?(@.name=='abi_c')].inner.header.abi" '{"C": {"unwind": false}}'
1010
pub extern "C" fn abi_c() {}
1111

12-
// @is - "$.index[*][?(@.name=='abi_system')].inner.header.abi" '{"System": {"unwind": false}}'
12+
// @is "$.index[*][?(@.name=='abi_system')].inner.header.abi" '{"System": {"unwind": false}}'
1313
pub extern "system" fn abi_system() {}
1414

15-
// @is - "$.index[*][?(@.name=='abi_c_unwind')].inner.header.abi" '{"C": {"unwind": true}}'
15+
// @is "$.index[*][?(@.name=='abi_c_unwind')].inner.header.abi" '{"C": {"unwind": true}}'
1616
pub extern "C-unwind" fn abi_c_unwind() {}
1717

18-
// @is - "$.index[*][?(@.name=='abi_system_unwind')].inner.header.abi" '{"System": {"unwind": true}}'
18+
// @is "$.index[*][?(@.name=='abi_system_unwind')].inner.header.abi" '{"System": {"unwind": true}}'
1919
pub extern "system-unwind" fn abi_system_unwind() {}
2020

21-
// @is - "$.index[*][?(@.name=='abi_vectorcall')].inner.header.abi.Other" '"\"vectorcall\""'
21+
// @is "$.index[*][?(@.name=='abi_vectorcall')].inner.header.abi.Other" '"\"vectorcall\""'
2222
pub extern "vectorcall" fn abi_vectorcall() {}
2323

24-
// @is - "$.index[*][?(@.name=='abi_vectorcall_unwind')].inner.header.abi.Other" '"\"vectorcall-unwind\""'
24+
// @is "$.index[*][?(@.name=='abi_vectorcall_unwind')].inner.header.abi.Other" '"\"vectorcall-unwind\""'
2525
pub extern "vectorcall-unwind" fn abi_vectorcall_unwind() {}

0 commit comments

Comments
 (0)