summaryrefslogtreecommitdiffstats
path: root/src/librustdoc/passes/collect_intra_doc_links.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustdoc/passes/collect_intra_doc_links.rs')
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 061a572c4..0dd9e590b 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -205,7 +205,7 @@ impl UrlFragment {
&UrlFragment::Item(def_id) => {
let kind = match tcx.def_kind(def_id) {
DefKind::AssocFn => {
- if tcx.impl_defaultness(def_id).has_value() {
+ if tcx.defaultness(def_id).has_value() {
"method."
} else {
"tymethod."
@@ -398,6 +398,10 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
.doc_link_resolutions(module_id)
.get(&(Symbol::intern(path_str), ns))
.copied()
+ // NOTE: do not remove this panic! Missing links should be recorded as `Res::Err`; if
+ // `doc_link_resolutions` is missing a `path_str`, that means that there are valid links
+ // that are being missed. To fix the ICE, change
+ // `rustc_resolve::rustdoc::attrs_to_preprocessed_links` to cache the link.
.unwrap_or_else(|| panic!("no resolution for {:?} {:?} {:?}", path_str, ns, module_id))
.and_then(|res| res.try_into().ok())
.or_else(|| resolve_primitive(path_str, ns));
@@ -842,7 +846,7 @@ impl PreprocessingError {
match self {
PreprocessingError::MultipleAnchors => report_multiple_anchors(cx, diag_info),
PreprocessingError::Disambiguator(range, msg) => {
- disambiguator_error(cx, diag_info, range.clone(), msg.as_str())
+ disambiguator_error(cx, diag_info, range.clone(), msg.clone())
}
PreprocessingError::MalformedGenerics(err, path_str) => {
report_malformed_generics(cx, diag_info, *err, path_str)