about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-02-27 12:07:54 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-02-27 12:07:54 +0100
commit9b8a6b97e5fc08a8f5a1aedc803e1f7b44dd50b5 (patch)
tree889093d093eb187cf53e64ae696136d271742dfa
parent7e0a2a765e4214597e5db690463c10634347d71f (diff)
downloadrust-9b8a6b97e5fc08a8f5a1aedc803e1f7b44dd50b5.tar.gz
rust-9b8a6b97e5fc08a8f5a1aedc803e1f7b44dd50b5.zip
Add test to ensure that links to impls are correctly generated
-rw-r--r--src/test/rustdoc/issue-78701.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/rustdoc/issue-78701.rs b/src/test/rustdoc/issue-78701.rs
new file mode 100644
index 00000000000..796d553fac4
--- /dev/null
+++ b/src/test/rustdoc/issue-78701.rs
@@ -0,0 +1,20 @@
+#![crate_name = "foo"]
+
+// This test ensures that if a blanket impl has the same ID as another impl, it'll
+// link to the blanket impl and not the other impl. Basically, we're checking if
+// the ID is correctly derived.
+
+// @has 'foo/struct.AnotherStruct.html'
+// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait"]' 1
+// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-1"]' 1
+
+pub trait Something {}
+
+pub trait AnAmazingTrait {}
+
+impl<T: Something> AnAmazingTrait for T {}
+
+pub struct AnotherStruct<T>(T);
+
+impl<T: Something> Something for AnotherStruct<T> {}
+impl AnAmazingTrait for AnotherStruct<()> {}