about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-16 06:44:10 +0000
committerbors <bors@rust-lang.org>2021-07-16 06:44:10 +0000
commita6470c7fa8a511cfbcf9e9d3e1ab6779ac661edb (patch)
tree0e336fb7e40ac0eb14ff61b2962b559408d4b4c4 /src/test/rustdoc
parent057050a95bdfc5849a893208c53c7b2a081c6808 (diff)
parent450c28a45e387fb54bbc84cf88c3556f93bcf1b8 (diff)
downloadrust-a6470c7fa8a511cfbcf9e9d3e1ab6779ac661edb.tar.gz
rust-a6470c7fa8a511cfbcf9e9d3e1ab6779ac661edb.zip
Auto merge of #86662 - mockersf:fix-86620-link-unknown-location, r=jyn514
fix dead link for method in trait of blanket impl from third party crate

fix #86620

* changes `href` method to raise the actual error it had instead of an `Option`
* set the href link correctly in case of an error

I did not manage to make a small reproducer, I think it happens in a situation where
* crate A expose a trait with a blanket impl
* crate B use the trait from crate A
* crate C use types from crate B
* building docs for crate C without dependencies

r? `@jyn514`
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/auxiliary/issue-86620-1.rs11
-rw-r--r--src/test/rustdoc/extern-default-method.rs2
-rw-r--r--src/test/rustdoc/issue-86620.rs9
3 files changed, 22 insertions, 0 deletions
diff --git a/src/test/rustdoc/auxiliary/issue-86620-1.rs b/src/test/rustdoc/auxiliary/issue-86620-1.rs
new file mode 100644
index 00000000000..f6debf6fb4e
--- /dev/null
+++ b/src/test/rustdoc/auxiliary/issue-86620-1.rs
@@ -0,0 +1,11 @@
+#![crate_name = "issue_86620_1"]
+
+pub trait VZip {
+    fn vzip() -> usize;
+}
+
+impl<T> VZip for T {
+    fn vzip() -> usize {
+        0
+    }
+}
diff --git a/src/test/rustdoc/extern-default-method.rs b/src/test/rustdoc/extern-default-method.rs
index 810c591c53e..efa2025b4b9 100644
--- a/src/test/rustdoc/extern-default-method.rs
+++ b/src/test/rustdoc/extern-default-method.rs
@@ -4,4 +4,6 @@
 extern crate rustdoc_extern_default_method as ext;
 
 // @count extern_default_method/struct.Struct.html '//*[@id="method.provided"]' 1
+// @has extern_default_method/struct.Struct.html '//div[@id="method.provided"]//a[@class="fnname"]/@href' #method.provided
+// @has extern_default_method/struct.Struct.html '//div[@id="method.provided"]//a[@class="anchor"]/@href' #method.provided
 pub use ext::Struct;
diff --git a/src/test/rustdoc/issue-86620.rs b/src/test/rustdoc/issue-86620.rs
new file mode 100644
index 00000000000..b14e266f7f9
--- /dev/null
+++ b/src/test/rustdoc/issue-86620.rs
@@ -0,0 +1,9 @@
+// aux-build:issue-86620-1.rs
+
+extern crate issue_86620_1;
+
+use issue_86620_1::*;
+
+// @!has issue_86620/struct.S.html '//div[@id="method.vzip"]//a[@class="fnname"]/@href' #tymethod.vzip
+// @has issue_86620/struct.S.html '//div[@id="method.vzip"]//a[@class="anchor"]/@href' #method.vzip
+pub struct S;