Change:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --I tried this code: I expected to see this happen: rustdoc generates intradoc links correctly Instead, this happened: rustdoc cannot resolve . <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: This looks like a regression from , cc modify labels: T-rustdoc A-intra-doc-links C-bug regression-from-stable-to-nightly
Found in
cc
Note I've already patched hyper by removing the link. A guess is that it's related to documenting a method from a trait implementstion ().
Ok, so i found the cause behind it and i'm working on the fix.
Removing label because we are mainly using them for and issues. I'm not aware that is using this label but please feel free to let me know if you find it useful. Otherwise we may not assign it to issues that are already tagged with , or .
it automatically, I think because I the regression label. I agree it doesn't belong on this issue.
Most regressions fall under the purview of , so adding makes sense as a default :)
just in case, I did this automation exactly for the reason described by What I'm suggesting now is that this automation may be better just adding the label if and only if the issue is not already tagged with , or .

Discussion:
DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::TyAlias, did, ) => { <del> // We need item's parent to know if it's // trait impl or struct/enum/etc impl let item_parent = item_opt </del> <ins> // Checks if item_name belongs to `impl SomeItem` let impl_item = cx .tcx .inherent_impls(did) .iter() .flat_map(|imp| cx.tcx.associated_items(*imp).in_definition_order()) .find(|item| item.ident.name == item_name); let trait_item = item_opt </ins> .and_then(|item| self.cx.as_local_hir_id(item.def_id)) .and_then(|item_hir| { <ins> // Checks if item_name belongs to `impl SomeTrait for SomeItem` </ins> let parent_hir = self.cx.tcx.hir().get_parent_item(item_hir); <del> self.cx.tcx.hir().find(parent_hir) </del> <ins> let item_parent = self.cx.tcx.hir().find(parent_hir); match item_parent { Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl { of_trait: Some(_), self_ty, .. }, .. })) => cx .tcx .associated_item_def_ids(self_ty.hir_id.owner) .iter() .map(|child| { let associated_item = cx.tcx.associated_item(*child); associated_item }) .find(|child| child.ident.name == item_name), _ => None, } </ins> }); <del> let item = match item_parent { Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl { of_trait: Some(_), self_ty, .. }, .. })) => { // trait impl cx.tcx .associated_item_def_ids(self_ty.hir_id.owner) .iter() .map(|child| { let associated_item = cx.tcx.associated_item(*child); associated_item }) .find(|child| child.ident.name == item_name) } _ => { // struct/enum/etc. impl cx.tcx .inherent_impls(did) .iter() .flat_map(|imp| cx.tcx.associated_items(*imp).in_definition_order()) .find(|item| item.ident.name == item_name) </del> <ins> let item = match (impl_item, trait_item) { (Some(from_impl), Some(_)) => { // Although it's ambiguous, return impl version for compat. sake. // To handle that properly resolve() would have to support // something like // [`ambi_fn`](<SomeStruct as SomeTrait>::ambi_fn) Some(from_impl) </ins> } <ins> (None, Some(from_trait)) => Some(from_trait), (Some(from_impl), None) => Some(from_impl), _ => None, </ins> }; if let Some(item) = item {

<ins> #![crate_name = "foo"] pub struct Body; impl Body { pub fn empty() -> Self { Body } } impl Default for Body { // @has foo/struct.Body.html '//a/@href' '../foo/struct.Body.html#method.empty' /// Returns [`Body::empty()`](Body::empty). fn default() -> Body { Body::empty() } } </ins>