Skip to content

Commit a07ffc7

Browse files
committed
Don't resolve variant_field in more than one place
Now that `resolve` handles it, `resolve_associated_item` doesn't need to.
1 parent 12d5e1d commit a07ffc7

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+2-27
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
461461
_ => None,
462462
}
463463
} else {
464-
// We already know this isn't in ValueNS, so no need to check variant_field
465-
return Err(ResolutionFailure::NotResolved {
466-
module_id,
467-
partial_res: Some(ty_res),
468-
unresolved: item_str.into(),
469-
}
470-
.into());
464+
None
471465
}
472466
}
473467
Res::Def(DefKind::Trait, did) => cx
@@ -528,30 +522,11 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
528522
item_name,
529523
ns.descr()
530524
);
531-
// primitives will never have a variant field
532-
Some(Err(ResolutionFailure::NotResolved {
533-
module_id,
534-
partial_res: Some(ty_res),
535-
unresolved: item_str.into(),
536-
}
537-
.into()))
525+
None
538526
}
539527
_ => None,
540528
};
541529
res.unwrap_or_else(|| {
542-
if ns == Namespace::ValueNS {
543-
debug!("considering variant fields for {}", item_str);
544-
let mut iter = item_str.rmatch_indices("::");
545-
let segments = iter.by_ref().take(2);
546-
if let Some((idx, _)) = segments.last() {
547-
// If we had `a::b::variant::field`, where `a` is `ty_res` and `b` is unresolved,
548-
// don't treat it as `a::variant::field`
549-
if !iter.next().is_some() {
550-
debug!("looking for variant field {:?}", &item_str[(idx + 2)..]);
551-
return self.variant_field(ty_res, &item_str[(idx + 2)..], module_id);
552-
}
553-
}
554-
}
555530
Err(ResolutionFailure::NotResolved {
556531
module_id,
557532
partial_res: Some(ty_res),

0 commit comments

Comments
 (0)