about summary refs log tree commit diff
path: root/tests/rustdoc-js/slice-array.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-04-24 12:14:35 -0700
committerMichael Howell <michael@notriddle.com>2023-04-24 12:14:35 -0700
commitc4e00f7bd525dd480341c1790d10276274eed9a6 (patch)
tree55d4de701b8cc56fb5c173f907d044b4615df9eb /tests/rustdoc-js/slice-array.rs
parentb72460fe46a873da0c40582636c26e7675e92288 (diff)
downloadrust-c4e00f7bd525dd480341c1790d10276274eed9a6.tar.gz
rust-c4e00f7bd525dd480341c1790d10276274eed9a6.zip
rustdoc-search: add slices and arrays to index
This indexes them as primitives with generics, so `slice<u32>` is
how you search for `[u32]`, and `array<u32>` for `[u32; 1]`.
A future commit will desugar the square bracket syntax to search
both arrays and slices at once.
Diffstat (limited to 'tests/rustdoc-js/slice-array.rs')
-rw-r--r--tests/rustdoc-js/slice-array.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/rustdoc-js/slice-array.rs b/tests/rustdoc-js/slice-array.rs
new file mode 100644
index 00000000000..2523b21cfaa
--- /dev/null
+++ b/tests/rustdoc-js/slice-array.rs
@@ -0,0 +1,16 @@
+pub struct P;
+pub struct Q;
+pub struct R<T>(T);
+
+// returns test
+pub fn alef() -> &'static [R<P>] { loop {} }
+pub fn bet() -> R<[Q; 32]> { loop {} }
+
+// in_args test
+pub fn alpha(_x: R<&'static [P]>) { loop {} }
+pub fn beta(_x: [R<Q>; 32]) { loop {} }
+
+pub trait TraitCat {}
+pub trait TraitDog {}
+
+pub fn gamma<T: TraitCat + TraitDog>(t: [T; 32]) {}