1
Fork 0

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`
This commit is contained in:
bors 2021-07-16 06:44:10 +00:00
commit a6470c7fa8
6 changed files with 71 additions and 31 deletions

View file

@ -459,7 +459,7 @@ impl Item {
.filter_map(|ItemLink { link: s, link_text, did, ref fragment }| {
match did {
Some(did) => {
if let Some((mut href, ..)) = href(did.clone(), cx) {
if let Ok((mut href, ..)) = href(did.clone(), cx) {
if let Some(ref fragment) = *fragment {
href.push('#');
href.push_str(fragment);