about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-08-25 16:19:17 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-08-25 16:22:35 +0200
commitca6be7414a4f01d4369ebc21773008532f8081ea (patch)
tree23c777e00b7802ab4ccb27dcd49c6bf155e523e5
parentb581fed15ef93b4d048097afe728dd052e5668ea (diff)
downloadrust-ca6be7414a4f01d4369ebc21773008532f8081ea.tar.gz
rust-ca6be7414a4f01d4369ebc21773008532f8081ea.zip
Add regression test for impl associated types source link
-rw-r--r--tests/rustdoc/assoc-type-source-link.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/rustdoc/assoc-type-source-link.rs b/tests/rustdoc/assoc-type-source-link.rs
new file mode 100644
index 00000000000..34b156b9649
--- /dev/null
+++ b/tests/rustdoc/assoc-type-source-link.rs
@@ -0,0 +1,26 @@
+// This test ensures that the source links are generated for impl associated types.
+
+#![crate_name = "foo"]
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+//@ has 'foo/struct.Bar.html'
+pub struct Bar;
+
+impl Bar {
+    //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a' 'source'
+    //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a/@href' \
+    // '../src/foo/assoc-type-source-link.rs.html#14'
+    pub type Y = u8;
+}
+
+pub trait Foo {
+    type Z;
+}
+
+impl Foo for Bar {
+    //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a' 'source'
+    //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a/@href' \
+    // '../src/foo/assoc-type-source-link.rs.html#25'
+    type Z = u8;
+}