diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /tests/rustdoc-js | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-js')
-rw-r--r-- | tests/rustdoc-js/generics-impl.js | 13 | ||||
-rw-r--r-- | tests/rustdoc-js/generics-nested.js | 33 | ||||
-rw-r--r-- | tests/rustdoc-js/generics-nested.rs | 19 | ||||
-rw-r--r-- | tests/rustdoc-js/generics.js | 16 | ||||
-rw-r--r-- | tests/rustdoc-js/primitive.js | 10 | ||||
-rw-r--r-- | tests/rustdoc-js/search-bag-semantics.js | 20 | ||||
-rw-r--r-- | tests/rustdoc-js/search-bag-semantics.rs | 4 | ||||
-rw-r--r-- | tests/rustdoc-js/where-clause.js | 30 | ||||
-rw-r--r-- | tests/rustdoc-js/where-clause.rs | 30 |
9 files changed, 175 insertions, 0 deletions
diff --git a/tests/rustdoc-js/generics-impl.js b/tests/rustdoc-js/generics-impl.js index bb6e0041d..5051743bd 100644 --- a/tests/rustdoc-js/generics-impl.js +++ b/tests/rustdoc-js/generics-impl.js @@ -5,6 +5,8 @@ const QUERY = [ 'Aaaaaaa -> bool', 'Aaaaaaa -> usize', 'Read -> u64', + 'trait:Read -> u64', + 'struct:Read -> u64', 'bool -> u64', 'Ddddddd -> u64', '-> Ddddddd' @@ -37,6 +39,17 @@ const EXPECTED = [ ], }, { + // trait:Read -> u64 + 'others': [ + { 'path': 'generics_impl::Ddddddd', 'name': 'eeeeeee' }, + { 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' }, + ], + }, + { + // struct:Read -> u64 + 'others': [], + }, + { // bool -> u64 'others': [ { 'path': 'generics_impl::Ddddddd', 'name': 'fffffff' }, diff --git a/tests/rustdoc-js/generics-nested.js b/tests/rustdoc-js/generics-nested.js new file mode 100644 index 000000000..8701f2d49 --- /dev/null +++ b/tests/rustdoc-js/generics-nested.js @@ -0,0 +1,33 @@ +// exact-check + +const QUERY = [ + '-> Out<First<Second>>', + '-> Out<Second<First>>', + '-> Out<First, Second>', + '-> Out<Second, First>', +]; + +const EXPECTED = [ + { + // -> Out<First<Second>> + 'others': [ + { 'path': 'generics_nested', 'name': 'alef' }, + ], + }, + { + // -> Out<Second<First>> + 'others': [], + }, + { + // -> Out<First, Second> + 'others': [ + { 'path': 'generics_nested', 'name': 'bet' }, + ], + }, + { + // -> Out<Second, First> + 'others': [ + { 'path': 'generics_nested', 'name': 'bet' }, + ], + }, +]; diff --git a/tests/rustdoc-js/generics-nested.rs b/tests/rustdoc-js/generics-nested.rs new file mode 100644 index 000000000..5140422e3 --- /dev/null +++ b/tests/rustdoc-js/generics-nested.rs @@ -0,0 +1,19 @@ +pub struct Out<A, B = ()> { + a: A, + b: B, +} + +pub struct First<In = ()> { + in_: In, +} + +pub struct Second; + +// Out<First<Second>> +pub fn alef() -> Out<First<Second>> { + loop {} +} + +pub fn bet() -> Out<First, Second> { + loop {} +} diff --git a/tests/rustdoc-js/generics.js b/tests/rustdoc-js/generics.js index 5e5ba7cd9..f79c709ad 100644 --- a/tests/rustdoc-js/generics.js +++ b/tests/rustdoc-js/generics.js @@ -2,6 +2,8 @@ const QUERY = [ 'R<P>', + 'R<struct:P>', + 'R<enum:P>', '"P"', 'P', 'ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>', @@ -21,6 +23,20 @@ const EXPECTED = [ ], }, { + // R<struct:P> + 'returned': [ + { 'path': 'generics', 'name': 'alef' }, + ], + 'in_args': [ + { 'path': 'generics', 'name': 'alpha' }, + ], + }, + { + // R<enum:P> + 'returned': [], + 'in_args': [], + }, + { // "P" 'others': [ { 'path': 'generics', 'name': 'P' }, diff --git a/tests/rustdoc-js/primitive.js b/tests/rustdoc-js/primitive.js index 918f70999..4aec98c34 100644 --- a/tests/rustdoc-js/primitive.js +++ b/tests/rustdoc-js/primitive.js @@ -3,6 +3,8 @@ const QUERY = [ "i32", "str", + "primitive:str", + "struct:str", "TotoIsSomewhere", ]; @@ -18,6 +20,14 @@ const EXPECTED = [ ], }, { + 'returned': [ + { 'path': 'primitive', 'name': 'foo' }, + ], + }, + { + 'returned': [], + }, + { 'others': [], 'in_args': [], 'returned': [], diff --git a/tests/rustdoc-js/search-bag-semantics.js b/tests/rustdoc-js/search-bag-semantics.js new file mode 100644 index 000000000..c56a3df5f --- /dev/null +++ b/tests/rustdoc-js/search-bag-semantics.js @@ -0,0 +1,20 @@ +// exact-check + +const QUERY = [ + 'P', + 'P, P', +]; + +const EXPECTED = [ + { + 'in_args': [ + { 'path': 'search_bag_semantics', 'name': 'alacazam' }, + { 'path': 'search_bag_semantics', 'name': 'abracadabra' }, + ], + }, + { + 'others': [ + { 'path': 'search_bag_semantics', 'name': 'abracadabra' }, + ], + }, +]; diff --git a/tests/rustdoc-js/search-bag-semantics.rs b/tests/rustdoc-js/search-bag-semantics.rs new file mode 100644 index 000000000..546572dc4 --- /dev/null +++ b/tests/rustdoc-js/search-bag-semantics.rs @@ -0,0 +1,4 @@ +pub struct P; + +pub fn abracadabra(a: P, b: P) {} +pub fn alacazam(a: P) {} diff --git a/tests/rustdoc-js/where-clause.js b/tests/rustdoc-js/where-clause.js new file mode 100644 index 000000000..86254a80e --- /dev/null +++ b/tests/rustdoc-js/where-clause.js @@ -0,0 +1,30 @@ +const QUERY = ['trait<nested>', '-> trait<nested>', 't1, t2', '-> shazam', 'drizzel -> shazam']; + +const EXPECTED = [ + { + 'in_args': [ + { 'path': 'where_clause', 'name': 'abracadabra' }, + ], + }, + { + 'others': [ + { 'path': 'where_clause', 'name': 'alacazam' }, + ], + }, + { + 'others': [ + { 'path': 'where_clause', 'name': 'presto' }, + ], + }, + { + 'others': [ + { 'path': 'where_clause', 'name': 'bippety' }, + { 'path': 'where_clause::Drizzel', 'name': 'boppety' }, + ], + }, + { + 'others': [ + { 'path': 'where_clause::Drizzel', 'name': 'boppety' }, + ], + }, +]; diff --git a/tests/rustdoc-js/where-clause.rs b/tests/rustdoc-js/where-clause.rs new file mode 100644 index 000000000..56c01019f --- /dev/null +++ b/tests/rustdoc-js/where-clause.rs @@ -0,0 +1,30 @@ +pub struct Nested; + +pub trait Trait<T> { + fn thank_you(x: T); +} + +pub fn abracadabra<X>(_: X) where X: Trait<Nested> {} + +pub fn alacazam<X>() -> X where X: Trait<Nested> {} + +pub trait T1 {} +pub trait T2<'a, T> { + fn please(_: &'a T); +} + +pub fn presto<A, B>(_: A, _: B) where A: T1, B: for <'b> T2<'b, Nested> {} + +pub trait Shazam {} + +pub fn bippety<X>() -> &'static X where X: Shazam { + panic!() +} + +pub struct Drizzel<T>(T); + +impl<T> Drizzel<T> { + pub fn boppety(&self) -> &T where T: Shazam { + panic!(); + } +} |