Skip to content

Commit d240490

Browse files
committed
Fix outdated code
1 parent ef54cde commit d240490

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,6 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
767767
// Disallow e.g. linking to enums with `struct@`
768768
if let Res::Def(kind, id) = res {
769769
debug!("saw kind {:?} with disambiguator {:?}", kind, disambiguator);
770-
// NOTE: this relies on the fact that `''` is never parsed as a disambiguator
771-
// NOTE: this needs to be kept in sync with the disambiguator parsing
772770
match (self.kind_side_channel.take().unwrap_or(kind), disambiguator) {
773771
| (DefKind::Const | DefKind::ConstParam | DefKind::AssocConst | DefKind::AnonConst, Some(Disambiguator::Kind(DefKind::Const)))
774772
// NOTE: this allows 'method' to mean both normal functions and associated functions
@@ -780,7 +778,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
780778
| (_, None)
781779
// All of these are valid, so do nothing
782780
=> {}
783-
(_, Some(Disambiguator::Kind(expected))) if kind == expected => {}
781+
(actual, Some(Disambiguator::Kind(expected))) if actual == expected => {}
784782
(_, Some(expected)) => {
785783
// The resolved item did not match the disambiguator; give a better error than 'not found'
786784
let msg = format!("incompatible link kind for `{}`", path_str);

src/test/rustdoc/intra-link-trait-item.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// allow-tidy-line-length
1+
// ignore-tidy-linelength
22
#![deny(broken_intra_doc_links)]
33

44
/// Link to [S::assoc_fn()]
55
/// Link to [Default::default()]
6-
// @has intra_link_trait_item/struct.S.html '//*[@href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default"]' 'Default::default()'
7-
// @has - '//*[@href="../intra_link_trait_item/struct.S.html#method.assoc_fn"]' 'S::assoc_fn()'
6+
// @has intra_link_trait_item/struct.S.html '//*[@href="../intra_link_trait_item/struct.S.html#method.assoc_fn"]' 'S::assoc_fn()'
7+
// @has - '//*[@href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default"]' 'Default::default()'
88
pub struct S;
99

1010
impl S {

0 commit comments

Comments
 (0)