diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-10-02 03:16:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-02 03:16:39 +0200 |
| commit | 3d71ff48d22ddf35ac4fe221cb67b5a8aa74d2a9 (patch) | |
| tree | 7aac4d01a50f7cf451f5412d7317abd453ab3db2 /src/test/rustdoc/array-links.rs | |
| parent | baba8391c30e6dfdbc712dc5be6693886677ffe3 (diff) | |
| parent | 598a02c6ad78fc00fbfc1370391c645b9446e3f1 (diff) | |
| download | rust-3d71ff48d22ddf35ac4fe221cb67b5a8aa74d2a9.tar.gz rust-3d71ff48d22ddf35ac4fe221cb67b5a8aa74d2a9.zip | |
Rollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jsha
rustdoc: remove orphaned link on array bracket This is #98069, but for arrays instead. For non-generics, this retains links to the array page, but instead of trying to link it all, it only links the length part, which distinguishes arrays from slices. For generics, the entire thing becomes a link, just like slices. | Type | Before | After | |--|--|--| | u32 | <code>pub fn alpha() -> &'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn alpha() -> &'static [<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a>; <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">1</a>]</code> | generic | <code>pub fn beta<T>() -> &'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a>T<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn beta<T>() -> &'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[T; 1]</a></code>
Diffstat (limited to 'src/test/rustdoc/array-links.rs')
| -rw-r--r-- | src/test/rustdoc/array-links.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/rustdoc/array-links.rs b/src/test/rustdoc/array-links.rs new file mode 100644 index 00000000000..07f92ac51b9 --- /dev/null +++ b/src/test/rustdoc/array-links.rs @@ -0,0 +1,28 @@ +#![crate_name = "foo"] +#![no_std] + +pub struct MyBox<T: ?Sized>(*const T); + +// @has 'foo/fn.alpha.html' +// @snapshot link_slice_u32 - '//pre[@class="rust fn"]/code' +pub fn alpha() -> &'static [u32; 1] { + loop {} +} + +// @has 'foo/fn.beta.html' +// @snapshot link_slice_generic - '//pre[@class="rust fn"]/code' +pub fn beta<T>() -> &'static [T; 1] { + loop {} +} + +// @has 'foo/fn.gamma.html' +// @snapshot link_box_u32 - '//pre[@class="rust fn"]/code' +pub fn gamma() -> MyBox<[u32; 1]> { + loop {} +} + +// @has 'foo/fn.delta.html' +// @snapshot link_box_generic - '//pre[@class="rust fn"]/code' +pub fn delta<T>() -> MyBox<[T; 1]> { + loop {} +} |
