summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-11-19 04:01:29 +0100
committerGitHub <noreply@github.com>2024-11-19 04:01:29 +0100
commitf66e1749c0264f7661e7f2dba8dac0478c39f95d (patch)
tree66f0b97b838b2c79e2a922ce3cd2e7ea54ec6e7e /tests
parent22265415c46843cad718c1a8609c5ff1d4437916 (diff)
parent8b0f8cb73c29b9466d817c3d7fda4ff52b90c4a7 (diff)
downloadrust-f66e1749c0264f7661e7f2dba8dac0478c39f95d.tar.gz
rust-f66e1749c0264f7661e7f2dba8dac0478c39f95d.zip
Rollup merge of #133180 - GuillaumeGomez:jump-to-def-links-generics, r=notriddle
[rustdoc] Fix items with generics not having their jump to def link generated

Because the span originally included the generics, during the highlighting, it was not retrieved and therefore its jump to def link was not generated.

r? ``@notriddle``
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc/link-on-path-with-generics.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/rustdoc/link-on-path-with-generics.rs b/tests/rustdoc/link-on-path-with-generics.rs
new file mode 100644
index 00000000000..22ba36c9f15
--- /dev/null
+++ b/tests/rustdoc/link-on-path-with-generics.rs
@@ -0,0 +1,14 @@
+// This test ensures that paths with generics still get their link to their definition
+// correctly generated.
+
+//@ compile-flags: -Zunstable-options --generate-link-to-definition
+#![crate_name = "foo"]
+
+//@ has 'src/foo/link-on-path-with-generics.rs.html'
+
+pub struct Soyo<T>(T);
+pub struct Saya;
+
+//@ has - '//pre[@class="rust"]//a[@href="#9"]' 'Soyo'
+//@ has - '//pre[@class="rust"]//a[@href="#10"]' 'Saya'
+pub fn bar<T>(s: Soyo<T>, x: Saya) {}