Skip to content

Commit bb9d157

Browse files
committed
Address my own review comments
- Remove unneeded lifetime parameter - Comment why some code doesn't use `check_full_res`
1 parent 2ca6f11 commit bb9d157

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
399399
} else {
400400
// See if it only broke because of the namespace.
401401
let kind = cx.enter_resolver(|resolver| {
402+
// NOTE: this doesn't use `check_full_res` because we explicitly want to ignore `TypeNS` (we already checked it)
402403
for &ns in &[MacroNS, ValueNS] {
403404
match resolver
404405
.resolve_str_path_error(DUMMY_SP, &path_root, ns, module_id)
@@ -563,9 +564,15 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
563564
}
564565
}
565566

566-
// used for reporting better errors
567+
/// Used for reporting better errors.
568+
///
569+
/// Returns whether the link resolved 'fully' in another namespace.
570+
/// 'fully' here means that all parts of the link resolved, not just some path segments.
571+
/// This returns the `Res` even if it was erroneous for some reason
572+
/// (such as having invalid URL fragments or being in the wrong namespace).
567573
fn check_full_res(
568574
&self,
575+
// TODO: is this parameter actually needed, since we return results for the wrong namespace?
569576
ns: Namespace,
570577
path_str: &str,
571578
base_node: Option<DefId>,
@@ -1609,10 +1616,10 @@ fn anchor_failure(
16091616
});
16101617
}
16111618

1612-
fn ambiguity_error<'a>(
1619+
fn ambiguity_error(
16131620
cx: &DocContext<'_>,
16141621
item: &Item,
1615-
path_str: &'a str,
1622+
path_str: &str,
16161623
dox: &str,
16171624
link_range: Option<Range<usize>>,
16181625
candidates: Vec<Res>,

0 commit comments

Comments
 (0)